From 9d28aa1d1bc251e4bd39fb21a49c3408829c526b Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 27 Sep 2017 19:36:00 +0200 Subject: [PATCH] Ref T165, use "?" for context help in update dialog --- .../components/downloadandinstalldialog.cpp | 15 +++++++++++++-- .../components/downloadandinstalldialog.h | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/blackgui/components/downloadandinstalldialog.cpp b/src/blackgui/components/downloadandinstalldialog.cpp index 67faf38c6..0cff5b940 100644 --- a/src/blackgui/components/downloadandinstalldialog.cpp +++ b/src/blackgui/components/downloadandinstalldialog.cpp @@ -9,6 +9,7 @@ #include "downloadandinstalldialog.h" #include "ui_downloadandinstalldialog.h" +#include "blackgui/guiapplication.h" #include #include @@ -16,8 +17,6 @@ using namespace BlackMisc::Db; namespace BlackGui { - class COverlayMessagesFrame; - namespace Components { CDownloadAndInstallDialog::CDownloadAndInstallDialog(QWidget *parent) : @@ -55,6 +54,13 @@ namespace BlackGui return QDialog::Rejected; } + bool CDownloadAndInstallDialog::event(QEvent *event) + { + if (event->type() != QEvent::EnterWhatsThisMode) { return QDialog::event(event); } + QTimer::singleShot(0, this, &CDownloadAndInstallDialog::requestHelp); + return true; + } + void CDownloadAndInstallDialog::onDontShowAgain(bool dontShowAgain) { m_setting.setAndSave(!dontShowAgain); @@ -65,5 +71,10 @@ namespace BlackGui const bool nv = ui->comp_DistributionInfo->isNewVersionAvailable(); ui->bb_DownloadInstallDialog->button(QDialogButtonBox::Ok)->setEnabled(nv); } + + void CDownloadAndInstallDialog::requestHelp() + { + if (sGui) { sGui->showHelp(this); } + } } // ns } // ns diff --git a/src/blackgui/components/downloadandinstalldialog.h b/src/blackgui/components/downloadandinstalldialog.h index 923473551..9747703dc 100644 --- a/src/blackgui/components/downloadandinstalldialog.h +++ b/src/blackgui/components/downloadandinstalldialog.h @@ -41,6 +41,9 @@ namespace BlackGui //! \copydoc QDialog::exec virtual int exec() override; + //! \copydoc QObject::event + virtual bool event(QEvent *event) override; + private: QScopedPointer ui; BlackMisc::CSetting m_setting { this }; //!< show again? @@ -50,6 +53,9 @@ namespace BlackGui //! Selection in distribution component changed void selectionChanged(); + + //! Request context help + void requestHelp(); }; } // ns } // ns