SettingsDialog: Use separator instead of custom spacer
authorDaniel Molkentin <danimo@owncloud.com>
Tue, 11 Aug 2015 19:44:35 +0000 (21:44 +0200)
committerDaniel Molkentin <danimo@owncloud.com>
Tue, 11 Aug 2015 19:44:35 +0000 (21:44 +0200)
... and make sure to hide if when there are no accounts

src/gui/settingsdialog.cpp

index a231552613208a62ad3712064c26324a3049315d..f8a0fe8c603729d913c9052f3c7c442d1c31e509 100644 (file)
@@ -81,9 +81,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
     setWindowTitle(Theme::instance()->appNameGUI());
 
     // Add a spacer so config buttons are right aligned and account buttons will be left aligned
-    auto spacer = new QWidget();
-    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-    _toolBar->addWidget(spacer);
+    _seperatorAction = _toolBar->addSeparator();
     _actionGroup = new QActionGroup(this);
     _actionGroup->setExclusive(true);
 
@@ -207,6 +205,8 @@ void SettingsDialog::accountAdded(AccountState *s)
     connect( accountSettings, SIGNAL(folderChanged()), _gui, SLOT(slotFoldersChanged()));
     connect( accountSettings, SIGNAL(openFolderAlias(const QString&)),
              _gui, SLOT(slotFolderOpenAction(QString)));
+
+    _seperatorAction->setVisible(!_toolbarAccountActions.isEmpty());
 }
 
 void SettingsDialog::accountRemoved(AccountState *s)
@@ -226,6 +226,8 @@ void SettingsDialog::accountRemoved(AccountState *s)
             break;
         }
     }
+
+    _seperatorAction->setVisible(!_toolbarAccountActions.isEmpty());
 }
 
 void SettingsDialog::customizeStyle()