[Pkg-owncloud-commits] [owncloud-client] 06/27: SettingsDialog: Activate the first page on startup

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri Aug 28 09:43:43 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 73785d0473aaa038c1df9d4393dab56f6b7224cf
Author: Christian Kamm <mail at ckamm.de>
Date:   Wed Aug 19 15:51:48 2015 +0200

    SettingsDialog: Activate the first page on startup
---
 src/gui/settingsdialog.cpp | 27 +++++++++++++++------------
 src/gui/settingsdialog.h   |  2 +-
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp
index 30f0c87..e8afdb3 100644
--- a/src/gui/settingsdialog.cpp
+++ b/src/gui/settingsdialog.cpp
@@ -51,17 +51,6 @@ namespace OCC {
 //
 // Whenever you change something here check both settingsdialog.cpp and settingsdialogmac.cpp !
 //
-void SettingsDialog::setDefaultAction()
-{
-    Q_FOREACH(QAction *action, _toolBar->actions()) {
-        if (QWidgetAction *wa = qobject_cast<QWidgetAction*>(action)) {
-            if (QToolButton *qtb = qobject_cast<QToolButton*>(wa->defaultWidget())) {
-                qtb->setChecked(true);
-                break;
-            }
-        }
-    }
-}
 
 SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
     QDialog(parent)
@@ -123,7 +112,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
         accountAdded(ai.data());
     }
 
-    setDefaultAction();
+    QTimer::singleShot(1, this, SLOT(showFirstPage()));
 
     QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
     connect(closeButton, SIGNAL(clicked()), SLOT(accept()));
@@ -179,6 +168,20 @@ void SettingsDialog::slotSwitchPage(QAction *action)
     _ui->stack->setCurrentWidget(_actionGroupWidgets.value(action));
 }
 
+void SettingsDialog::showFirstPage()
+{
+    Q_FOREACH(QAction *action, _toolBar->actions()) {
+        if (QWidgetAction *wa = qobject_cast<QWidgetAction*>(action)) {
+            if (QToolButton *qtb = qobject_cast<QToolButton*>(wa->defaultWidget())) {
+                if (QAction *a2 = qtb->defaultAction()) {
+                    qtb->defaultAction()->trigger();
+                    break;
+                }
+            }
+        }
+    }
+}
+
 void SettingsDialog::showActivityPage()
 {
     if (_protocolAction) {
diff --git a/src/gui/settingsdialog.h b/src/gui/settingsdialog.h
index 36d8bdd..f6a2198 100644
--- a/src/gui/settingsdialog.h
+++ b/src/gui/settingsdialog.h
@@ -50,8 +50,8 @@ public:
 
     void addAccount(const QString &title, QWidget *widget);
 
-    void setDefaultAction();
 public slots:
+    void showFirstPage();
     void showActivityPage();
     void slotSwitchPage(QAction *action);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list