~ci-train-bot/ubuntu-download-manager/ubuntu-download-manager-ubuntu-zesty-2267

« back to all changes in this revision

Viewing changes to src/downloads/common/ubuntu/download_manager/download_state_struct.cpp

  • Committer: Bileto Bot
  • Author(s): jonas-drange
  • Date: 2016-08-12 14:33:22 UTC
  • mfrom: (358.3.9 retrieve-metadata)
  • Revision ID: ci-train-bot@canonical.com-20160812143322-2o3dmng5go78bmtc
restore metadata from the database

Approved by: Michael Sheldon

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    : _state(-1),
28
28
      _url(QString::null),
29
29
      _filePath(QString::null),
30
 
      _hash(QString::null) {
 
30
      _hash(QString::null),
 
31
      _metadata(QVariantMap()) {
31
32
 
32
33
}
33
34
 
35
36
    : _state(state),
36
37
      _url(url),
37
38
      _filePath(QString::null),
38
 
      _hash(hash) {
 
39
      _hash(hash),
 
40
      _metadata(QVariantMap()) {
39
41
 
40
42
}
41
43
 
44
46
        : _state(state),
45
47
          _url(url),
46
48
          _filePath(filePath),
47
 
          _hash(hash) {
 
49
          _hash(hash),
 
50
          _metadata(QVariantMap()) {
 
51
 
 
52
}
 
53
 
 
54
DownloadStateStruct::DownloadStateStruct(int state, const QString& url, const QString& filePath,
 
55
                                         const QString& hash, const QVariantMap& metadata)
 
56
        : _state(state),
 
57
          _url(url),
 
58
          _filePath(filePath),
 
59
          _hash(hash),
 
60
          _metadata(metadata) {
48
61
 
49
62
}
50
63
 
52
65
        : _state(other._state),
53
66
          _url(other._url),
54
67
          _filePath(other._filePath),
55
 
          _hash(other._hash) {
 
68
          _hash(other._hash),
 
69
          _metadata(other._metadata) {
56
70
}
57
71
 
58
72
DownloadStateStruct& DownloadStateStruct::operator=(const DownloadStateStruct& other) {
60
74
    _url = other._url;
61
75
    _filePath= other._filePath;
62
76
    _hash = other._hash;
 
77
    _metadata = other._metadata;
63
78
 
64
79
    return *this;
65
80
}
71
86
    argument << download._url;
72
87
    argument << download._filePath;
73
88
    argument << download._hash;
 
89
    argument << download._metadata;
74
90
    argument.endStructure();
75
91
 
76
92
    return argument;
83
99
    argument >> download._url;
84
100
    argument >> download._filePath;
85
101
    argument >> download._hash;
 
102
    argument >> download._metadata;
86
103
    argument.endStructure();
87
104
 
88
105
    return argument;
108
125
    return _hash;
109
126
}
110
127
 
 
128
QVariantMap
 
129
DownloadStateStruct::getMetadata() const {
 
130
    return _metadata;
 
131
}
 
132
 
111
133
bool
112
134
DownloadStateStruct::isValid() {
113
135
    return _url != QString::null;