2013-01-15 23:41:52 +04:00
|
|
|
#ifndef SYNCFILEITEM_H
|
|
|
|
#define SYNCFILEITEM_H
|
|
|
|
|
|
|
|
#include <QVector>
|
2013-05-03 21:11:00 +04:00
|
|
|
#include <QString>
|
2013-01-15 23:41:52 +04:00
|
|
|
|
|
|
|
#include <csync.h>
|
|
|
|
|
|
|
|
namespace Mirall {
|
|
|
|
|
|
|
|
// FIXME: Unhack this.
|
|
|
|
class SyncFileItem {
|
|
|
|
public:
|
|
|
|
typedef enum {
|
|
|
|
None = 0,
|
|
|
|
Up,
|
|
|
|
Down } Direction;
|
|
|
|
|
|
|
|
SyncFileItem() {}
|
|
|
|
|
2013-05-03 21:11:00 +04:00
|
|
|
friend bool operator==(const SyncFileItem& item1, const SyncFileItem& item2) {
|
|
|
|
return item1._file == item2._file;
|
|
|
|
}
|
|
|
|
|
|
|
|
friend bool operator<(const SyncFileItem& item1, const SyncFileItem& item2) {
|
2013-05-15 17:22:20 +04:00
|
|
|
// Delete at the end:
|
|
|
|
if (item1._instruction == CSYNC_INSTRUCTION_REMOVE && item2._instruction != CSYNC_INSTRUCTION_REMOVE)
|
|
|
|
return false;
|
|
|
|
if (item1._instruction != CSYNC_INSTRUCTION_REMOVE && item2._instruction == CSYNC_INSTRUCTION_REMOVE)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Sort by destination
|
|
|
|
return item1.destination() < item2.destination();
|
2013-01-15 23:41:52 +04:00
|
|
|
}
|
|
|
|
|
2013-05-15 17:22:20 +04:00
|
|
|
QString destination() const {
|
|
|
|
return _instruction == CSYNC_INSTRUCTION_RENAME ? _renameTarget : _file;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-14 19:25:00 +04:00
|
|
|
bool isEmpty() const {
|
|
|
|
return _file.isEmpty();
|
|
|
|
}
|
|
|
|
|
2013-01-15 23:41:52 +04:00
|
|
|
// variables
|
|
|
|
QString _file;
|
|
|
|
QString _renameTarget;
|
2013-05-15 17:22:20 +04:00
|
|
|
QByteArray _originalFile; // as it is in the csync tree
|
2013-01-15 23:41:52 +04:00
|
|
|
csync_instructions_e _instruction;
|
|
|
|
Direction _dir;
|
2013-05-03 21:11:00 +04:00
|
|
|
bool _isDirectory;
|
|
|
|
time_t _modtime;
|
2013-05-06 18:59:11 +04:00
|
|
|
QByteArray _etag;
|
2013-05-05 13:41:31 +04:00
|
|
|
|
|
|
|
QString _errorString;
|
|
|
|
QString _errorDetail;
|
|
|
|
int _httpCode;
|
|
|
|
|
2013-01-15 23:41:52 +04:00
|
|
|
};
|
|
|
|
|
2013-05-03 21:11:00 +04:00
|
|
|
|
|
|
|
|
2013-01-15 23:41:52 +04:00
|
|
|
typedef QVector<SyncFileItem> SyncFileItemVector;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SYNCFILEITEM_H
|