2011-04-08 13:36:53 +04:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
{
|
|
|
|
|
2011-10-13 18:41:24 +04:00
|
|
|
SyncResult::SyncResult()
|
2013-08-02 16:22:01 +04:00
|
|
|
: _status( Undefined ),
|
|
|
|
_warnCount(0)
|
2011-10-13 18:41:24 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
SyncResult::SyncResult(SyncResult::Status status )
|
2013-08-02 16:22:01 +04:00
|
|
|
: _status(status),
|
|
|
|
_warnCount(0)
|
2011-04-08 13:36:53 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
SyncResult::Status SyncResult::status() const
|
2011-04-08 13:36:53 +04:00
|
|
|
{
|
2012-02-20 19:45:27 +04:00
|
|
|
return _status;
|
2011-04-08 13:36:53 +04:00
|
|
|
}
|
|
|
|
|
2012-07-30 18:09:49 +04:00
|
|
|
QString SyncResult::statusString() const
|
|
|
|
{
|
|
|
|
QString re;
|
|
|
|
Status stat = status();
|
|
|
|
|
|
|
|
switch( stat ){
|
2013-08-07 16:46:47 +04:00
|
|
|
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 Problem:
|
2013-12-03 15:31:28 +04:00
|
|
|
re = QLatin1String("Success, some files were ignored.");
|
2013-08-07 16:46:47 +04:00
|
|
|
break;
|
|
|
|
case Unavailable:
|
|
|
|
re = QLatin1String("Not availabe");
|
|
|
|
break;
|
2013-10-03 17:32:44 +04:00
|
|
|
case SyncAbortRequested:
|
|
|
|
re = QLatin1String("Sync Request aborted by user");
|
|
|
|
break;
|
2014-01-08 17:34:04 +04:00
|
|
|
case Paused:
|
|
|
|
re = QLatin1String("Sync Paused");
|
|
|
|
break;
|
2012-07-30 18:09:49 +04:00
|
|
|
}
|
|
|
|
return re;
|
|
|
|
}
|
|
|
|
|
2012-03-22 19:22:08 +04:00
|
|
|
void SyncResult::setStatus( Status stat )
|
|
|
|
{
|
|
|
|
_status = stat;
|
2013-01-15 23:41:52 +04:00
|
|
|
_syncTime = QDateTime::currentDateTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SyncResult::setSyncFileItemVector( const SyncFileItemVector& items )
|
|
|
|
{
|
|
|
|
_syncItems = items;
|
|
|
|
}
|
|
|
|
|
|
|
|
SyncFileItemVector SyncResult::syncFileItemVector() const
|
|
|
|
{
|
|
|
|
return _syncItems;
|
|
|
|
}
|
|
|
|
|
|
|
|
QDateTime SyncResult::syncTime() const
|
|
|
|
{
|
|
|
|
return _syncTime;
|
2012-03-22 19:22:08 +04:00
|
|
|
}
|
|
|
|
|
2013-08-02 16:22:01 +04:00
|
|
|
void SyncResult::setWarnCount(int wc)
|
|
|
|
{
|
|
|
|
_warnCount = wc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SyncResult::warnCount() const
|
|
|
|
{
|
|
|
|
return _warnCount;
|
|
|
|
}
|
|
|
|
|
2012-03-22 19:22:08 +04:00
|
|
|
void SyncResult::setErrorStrings( const QStringList& list )
|
|
|
|
{
|
|
|
|
_errors = list;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList SyncResult::errorStrings() const
|
|
|
|
{
|
|
|
|
return _errors;
|
|
|
|
}
|
|
|
|
|
2011-09-26 20:19:01 +04:00
|
|
|
void SyncResult::setErrorString( const QString& err )
|
|
|
|
{
|
2012-03-22 19:22:08 +04:00
|
|
|
_errors.append( err );
|
2011-09-26 20:19:01 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
QString SyncResult::errorString() const
|
|
|
|
{
|
2012-08-17 19:13:17 +04:00
|
|
|
if( _errors.isEmpty() ) return QString::null;
|
2012-03-22 19:22:08 +04:00
|
|
|
return _errors.first();
|
2011-09-26 20:19:01 +04:00
|
|
|
}
|
|
|
|
|
2012-04-17 15:12:53 +04:00
|
|
|
void SyncResult::clearErrors()
|
|
|
|
{
|
|
|
|
_errors.clear();
|
|
|
|
}
|
|
|
|
|
2013-08-06 20:04:42 +04:00
|
|
|
void SyncResult::setFolder(const QString& folder)
|
|
|
|
{
|
|
|
|
_folder = folder;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SyncResult::folder() const
|
|
|
|
{
|
|
|
|
return _folder;
|
|
|
|
}
|
|
|
|
|
2011-04-08 13:36:53 +04:00
|
|
|
SyncResult::~SyncResult()
|
|
|
|
{
|
2013-08-06 20:04:42 +04:00
|
|
|
|
2011-04-08 13:36:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
} // ns mirall
|