SettingsDialog: Activate the first page on startup

This commit is contained in:
Christian Kamm 2015-08-19 15:51:48 +02:00
Родитель b155503fa2
Коммит 73785d0473
2 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -50,8 +50,8 @@ public:
void addAccount(const QString &title, QWidget *widget);
void setDefaultAction();
public slots:
void showFirstPage();
void showActivityPage();
void slotSwitchPage(QAction *action);