FolderStatusModel::~FolderStatusModel()
{ }
+static bool sortByFolderHeader(const FolderStatusModel::SubFolderInfo& lhs, const FolderStatusModel::SubFolderInfo& rhs)
+{
+ return QString::compare(lhs._folder->shortGuiRemotePathOrAppName(),
+ rhs._folder->shortGuiRemotePathOrAppName(),
+ Qt::CaseInsensitive) < 0;
+}
void FolderStatusModel::setAccountState(const AccountState* accountState)
{
if (f->accountState() != accountState)
continue;
SubFolderInfo info;
- info._pathIdx << _folders.size();
info._name = f->alias();
info._path = "/";
info._folder = f;
connect(f, SIGNAL(newBigFolderDiscovered(QString)), this, SLOT(slotNewBigFolder()), Qt::UniqueConnection);
}
+ // Sort by header text
+ qSort(_folders.begin(), _folders.end(), sortByFolderHeader);
+
+ // Set the root _pathIdx after the sorting
+ for (int i = 0; i < _folders.size(); ++i) {
+ _folders[i]._pathIdx << i;
+ }
+
endResetModel();
emit dirtyChanged();
}