Account Settings: A link should make sure all the parents are expanded
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 19 Oct 2015 16:46:39 +0000 (18:46 +0200)
committerKlaas Freitag <freitag@owncloud.com>
Tue, 27 Oct 2015 16:37:12 +0000 (17:37 +0100)
src/gui/accountsettings.cpp

index d267f3ca22a25ae874ef4d338a2253d0da93b0ee..962cddda7834f3cf64be84007ae4e41853534949 100644 (file)
@@ -522,16 +522,21 @@ void AccountSettings::slotLinkActivated(const QString& link)
         const QString alias = li[1];
         if(myFolder.endsWith(QLatin1Char('/'))) myFolder.chop(1);
 
+        // Make sure the folder itself is expanded
         Folder *f = FolderMan::instance()->folder(alias);
         QModelIndex folderIndx = _model->indexForPath(f, QString());
-
         if( !ui->_folderList->isExpanded(folderIndx)) {
             ui->_folderList->setExpanded(folderIndx, true);
-            return;
         }
 
         QModelIndex indx = _model->indexForPath(f, myFolder);
         if( indx.isValid() ) {
+            // make sure all the parents are expanded
+            for (auto i = indx.parent(); i.isValid(); i = i.parent()) {
+                if( !ui->_folderList->isExpanded(i)) {
+                    ui->_folderList->setExpanded(i, true);
+                }
+            }
             ui->_folderList->setSelectionMode(QAbstractItemView::SingleSelection);
             ui->_folderList->setCurrentIndex(indx);
             ui->_folderList->scrollTo(indx);