Welcome to mirror list, hosted at ThFree Co, Russian Federation.

protocolitem.cpp « gui « src - github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 12c361f7a1162d864d0b953924dc9df895c653ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 */
#include "protocolitem.h"

#include "folderman.h"
#include "progressdispatcher.h"

#include <QApplication>
#include <QFileInfo>
#include <QMenu>
#include <QPointer>


using namespace OCC;


ProtocolItem::ProtocolItem(Folder *folder, const SyncFileItemPtr &item)
    : _path(item->destination())
    , _folder(folder)
    , _size(item->_size)
    , _status(item->_status)
    , _direction(item->_direction)
    , _message(item->_errorString)
    , _sizeIsRelevant(ProgressInfo::isSizeDependent(*item))
{
    if (!item->_responseTimeStamp.isEmpty()) {
        _timestamp = QDateTime::fromString(QString::fromUtf8(item->_responseTimeStamp), Qt::RFC2822Date);
    } else {
        _timestamp = QDateTime::currentDateTimeUtc();
    }
    if (_message.isEmpty()) {
        _message = Progress::asResultString(*item);
    }
}

QString ProtocolItem::path() const
{
    return _path;
}

Folder *ProtocolItem::folder() const
{
    return _folder;
}

QDateTime ProtocolItem::timestamp() const
{
    return _timestamp;
}

qint64 ProtocolItem::size() const
{
    return _size;
}

SyncFileItem::Status ProtocolItem::status() const
{
    return _status;
}

SyncFileItem::Direction ProtocolItem::direction() const
{
    return _direction;
}

QString ProtocolItem::message() const
{
    return _message;
}

bool ProtocolItem::isSizeRelevant() const
{
    return _sizeIsRelevant;
}