mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Add helper slots and signals to catch SettingsDialog's window activation events
Signal the SettingsDialog's window activation event down to ownCloudGui and Application, so that other classes can hook in to get notified when the SettingsDialog is being shown again. This approach has been chosen because we otherwise would have to deal with new instance pointers of the current SettingsWindow - but Application is already there ;-) Purpose: The floating re-auth windows of the WebFlowCredentialsDialog often get hidden behind the SettingsDialog, and the users have to minimize a lot of other windows to find them again. This commit implements the preparation for the upcoming fix commit. Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
parent
be10d5200f
commit
addb27a085
6 changed files with 23 additions and 0 deletions
|
@ -263,6 +263,9 @@ Application::Application(int &argc, char **argv)
|
|||
|
||||
// Cleanup at Quit.
|
||||
connect(this, &QCoreApplication::aboutToQuit, this, &Application::slotCleanup);
|
||||
|
||||
// Allow other classes to hook into isShowingSettingsDialog() signals (re-auth widgets, for example)
|
||||
connect(_gui.data(), &ownCloudGui::isShowingSettingsDialog, this, &Application::slotGuiIsShowingSettings);
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
|
@ -655,5 +658,9 @@ void Application::showSettingsDialog()
|
|||
_gui->slotShowSettings();
|
||||
}
|
||||
|
||||
void Application::slotGuiIsShowingSettings()
|
||||
{
|
||||
emit isShowingSettingsDialog();
|
||||
}
|
||||
|
||||
} // namespace OCC
|
||||
|
|
|
@ -82,6 +82,7 @@ protected:
|
|||
signals:
|
||||
void folderRemoved();
|
||||
void folderStateChanged(Folder *);
|
||||
void isShowingSettingsDialog();
|
||||
|
||||
protected slots:
|
||||
void slotParseMessage(const QString &, QObject *);
|
||||
|
@ -91,6 +92,7 @@ protected slots:
|
|||
void slotAccountStateAdded(AccountState *accountState);
|
||||
void slotAccountStateRemoved(AccountState *accountState);
|
||||
void slotSystemOnlineConfigurationChanged(QNetworkConfiguration);
|
||||
void slotGuiIsShowingSettings();
|
||||
|
||||
private:
|
||||
void setHelp();
|
||||
|
|
|
@ -1075,6 +1075,11 @@ void ownCloudGui::slotShowSettings()
|
|||
raiseDialog(_settingsDialog.data());
|
||||
}
|
||||
|
||||
void ownCloudGui::slotSettingsDialogActivated()
|
||||
{
|
||||
emit isShowingSettingsDialog();
|
||||
}
|
||||
|
||||
void ownCloudGui::slotShowSyncProtocol()
|
||||
{
|
||||
slotShowSettings();
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
signals:
|
||||
void setupProxy();
|
||||
void serverError(int code, const QString &message);
|
||||
void isShowingSettingsDialog();
|
||||
|
||||
public slots:
|
||||
void setupContextMenu();
|
||||
|
@ -93,6 +94,7 @@ public slots:
|
|||
void slotToggleLogBrowser();
|
||||
void slotOpenOwnCloud();
|
||||
void slotOpenSettingsDialog();
|
||||
void slotSettingsDialogActivated();
|
||||
void slotHelp();
|
||||
void slotOpenPath(const QString &path);
|
||||
void slotAccountStateChanged();
|
||||
|
|
|
@ -127,6 +127,8 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent)
|
|||
connect(showLogWindow, &QAction::triggered, gui, &ownCloudGui::slotToggleLogBrowser);
|
||||
addAction(showLogWindow);
|
||||
|
||||
connect(this, &SettingsDialog::onActivate, gui, &ownCloudGui::slotSettingsDialogActivated);
|
||||
|
||||
customizeStyle();
|
||||
|
||||
cfg.restoreGeometry(this);
|
||||
|
@ -163,6 +165,10 @@ void SettingsDialog::changeEvent(QEvent *e)
|
|||
// Notify the other widgets (Dark-/Light-Mode switching)
|
||||
emit styleChanged();
|
||||
break;
|
||||
case QEvent::ActivationChange:
|
||||
if(isActiveWindow())
|
||||
emit onActivate();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void styleChanged();
|
||||
void onActivate();
|
||||
|
||||
protected:
|
||||
void reject() override;
|
||||
|
|
Loading…
Reference in a new issue