Manged folder list in the tray icon is now sorted

We are using a QHash to store all the folder objects. This does not allow for
easy sorting and looks weird to the user. Now they are first inserted into a
temp QMap to sort them properly.
This commit is contained in:
Roeland Jago Douma 2014-12-19 13:59:50 +01:00
parent e8efaa5ed8
commit 8677fb18bb

View file

@ -323,7 +323,13 @@ void ownCloudGui::setupContextMenu()
if ( folderCnt > 1) {
_contextMenu->addAction(tr("Managed Folders:"))->setDisabled(true);
}
foreach (Folder *folder, folderMan->map() ) {
// Put everything first in a QMap to properly sort
QMap<QString, Folder*> folders;
for( auto i = folderMan->map().constBegin(); i != folderMan->map().constEnd(); i++) {
folders.insert(i.key(), i.value());
}
foreach (auto folder, folders) {
QAction *action = new QAction( tr("Open folder '%1'").arg(folder->alias()), this );
connect( action, SIGNAL(triggered()),_folderOpenActionMapper,SLOT(map()));
_folderOpenActionMapper->setMapping( action, folder->alias() );