Selective sync: Don't show negative size
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 22 Feb 2016 16:26:09 +0000 (17:26 +0100)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 22 Feb 2016 16:26:09 +0000 (17:26 +0100)
Relates to issue #4491

src/gui/folderstatusmodel.cpp
src/gui/selectivesyncdialog.cpp

index f4b06cf387bda514bd3f93ad9a4907de3e8b19cd..d7185c354480d8b536eaf548afbf10a54cb8d0d9 100644 (file)
@@ -145,7 +145,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
         case Qt::ToolTipRole:
         case Qt::DisplayRole:
             //: Example text: "File.txt (23KB)"
-            return tr("%1 (%2)").arg(x._name, Utility::octetsToString(x._size));
+            return x._size < 0 ? x._name : tr("%1 (%2)").arg(x._name, Utility::octetsToString(x._size));
         case Qt::CheckStateRole:
             return x._checked;
         case Qt::DecorationRole:
index 9a6682ff5f9a276d6976fdae0a45430289d950ae..cc361cd05d7e8c5893d92cfb40e54d3c7b5a75b3 100644 (file)
@@ -145,8 +145,10 @@ void SelectiveSyncTreeView::recursiveInsert(QTreeWidgetItem* parent, QStringList
             }
             item->setIcon(0, folderIcon);
             item->setText(0, pathTrail.first());
-            item->setText(1, Utility::octetsToString(size));
-            item->setData(1, Qt::UserRole, size);
+            if (size >= 0) {
+                item->setText(1, Utility::octetsToString(size));
+                item->setData(1, Qt::UserRole, size);
+            }
 //            item->setData(0, Qt::UserRole, pathTrail.first());
             item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
         }