Show a more informative problem message in progress.

This commit is contained in:
Klaas Freitag 2013-08-07 12:15:28 +02:00
parent 6226a6ee8f
commit 364d4340fd
3 changed files with 39 additions and 8 deletions

View file

@ -233,6 +233,20 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
break;
}
switch( file->type ) {
case CSYNC_FTW_TYPE_DIR:
item._type = SyncFileItem::Directory;
break;
case CSYNC_FTW_TYPE_FILE:
item._type = SyncFileItem::File;
break;
case CSYNC_FTW_TYPE_SLINK:
item._type = SyncFileItem::SoftLink;
break;
default:
item._type = SyncFileItem::UnknownType;
}
item._dir = dir;
_mutex.lock();
_syncedItems.append(item);

View file

@ -139,20 +139,29 @@ void ItemProgressDialog::setSyncResult( const SyncResult& result )
for (i = items.begin(); i != items.end(); ++i) {
const SyncFileItem& item = *i;
QString errMsg;
if( item._instruction == CSYNC_INSTRUCTION_IGNORE ) {
QStringList columns;
QString timeStr = QTime::currentTime().toString("hh:mm");
columns << timeStr;
columns << item._file;
QString errMsg = tr("File ignored.");
if( item._type == SyncFileItem::File ) {
errMsg = tr("File ignored.");
} else if( item._type == SyncFileItem::Directory ){
errMsg = tr("Directory ignored.");
} else if( item._type == SyncFileItem::SoftLink ) {
errMsg = tr("Soft Link ignored.");
} else {
errMsg = tr("Ignored.");
}
columns << errMsg;
QTreeWidgetItem *item = new QTreeWidgetItem(folderItem, columns);
item->setData(0, ErrorIndicatorRole, QVariant(true) );
item->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem, true));
QTreeWidgetItem *twitem = new QTreeWidgetItem(folderItem, columns);
twitem->setData(0, ErrorIndicatorRole, QVariant(true) );
twitem->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem, true));
Q_UNUSED(item);
Q_UNUSED(twitem);
}
}
}

View file

@ -11,9 +11,16 @@ namespace Mirall {
class SyncFileItem {
public:
typedef enum {
None = 0,
Up,
Down } Direction;
None = 0,
Up,
Down } Direction;
typedef enum {
UnknownType,
File,
Directory,
SoftLink
} Type;
SyncFileItem() {}
@ -30,6 +37,7 @@ public:
QString _renameTarget;
csync_instructions_e _instruction;
Direction _dir;
Type _type;
};
typedef QVector<SyncFileItem> SyncFileItemVector;