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

syncresult.cpp « mirall « src - github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93e303069bed818a4fcb7286b9ab04953c691550 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 * Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
 *
 * 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 "mirall/syncresult.h"

namespace Mirall
{

SyncResult::SyncResult()
    : _status( Undefined ),
      _warnCount(0)
{
}

SyncResult::SyncResult(SyncResult::Status status )
    : _status(status),
      _warnCount(0)
{
}

SyncResult::Status SyncResult::status() const
{
    return _status;
}

QString SyncResult::statusString() const
{
    QString re;
    Status stat = status();

    switch( stat ){
        case Undefined:
            re = QLatin1String("Undefined");
            break;
        case NotYetStarted:
            re = QLatin1String("Not yet Started");
            break;
        case SyncRunning:
            re = QLatin1String("Sync Running");
            break;
        case Success:
            re = QLatin1String("Success");
            break;
        case Error:
            re = QLatin1String("Error");
            break;
        case SetupError:
            re = QLatin1String("SetupError");
            break;
	case SyncPrepare:
	    re = QLatin1String("SyncPrepare");
	    break;
        case Unavailable:
            re = QLatin1String("Not availabe");
            break;
    }
    return re;
}

void SyncResult::setStatus( Status stat )
{
    _status = stat;
    _syncTime = QDateTime::currentDateTime();
}

void SyncResult::setSyncFileItemVector( const SyncFileItemVector& items )
{
    _syncItems = items;
}

SyncFileItemVector SyncResult::syncFileItemVector() const
{
    return _syncItems;
}

QDateTime SyncResult::syncTime() const
{
    return _syncTime;
}

void SyncResult::setWarnCount(int wc)
{
    _warnCount = wc;
}

int SyncResult::warnCount() const
{
    return _warnCount;
}

void SyncResult::setErrorStrings( const QStringList& list )
{
    _errors = list;
}

QStringList SyncResult::errorStrings() const
{
    return _errors;
}

void SyncResult::setErrorString( const QString& err )
{
    _errors.append( err );
}

QString SyncResult::errorString() const
{
    if( _errors.isEmpty() ) return QString::null;
    return _errors.first();
}

void SyncResult::clearErrors()
{
    _errors.clear();
}

SyncResult::~SyncResult()
{
}

} // ns mirall