11// Author: Kang Lin <kl222@126.com>
22
3+ #include < QWhatsThisClickedEvent>
4+ #include < QDesktopServices>
35#include < QMessageBox>
46#include < QFileDialog>
57#include < QLoggingCategory>
@@ -16,6 +18,7 @@ CParameterPluginUI::CParameterPluginUI(QWidget *parent) :
1618 m_pPara(nullptr )
1719{
1820 ui->setupUi (this );
21+
1922 setWindowTitle (tr (" Plugin" ));
2023 if (RabbitCommon::CTools::HasAdministratorPrivilege ()) {
2124 ui->cbPromptAdminPrivilege ->setText (" " );
@@ -25,7 +28,21 @@ CParameterPluginUI::CParameterPluginUI(QWidget *parent) :
2528 tr (" Prompt administrator privilege" ));
2629 ui->cbPromptAdminPrivilege ->show ();
2730 }
31+
2832 ui->pbEncryptKey ->setToolTip (tr (" Enable view password" ));
33+
34+ QString szPasswordUrl;
35+ szPasswordUrl = " <a href=https://github.com/KangLin/RabbitRemoteControl/wiki/UserManual#password-security>" + tr (" Password Security" ) + " </a>" ;
36+ ui->gbPassword ->setWhatsThis (szPasswordUrl);
37+ ui->gbPassword ->installEventFilter (this );
38+ ui->pbEncryptKey ->setWhatsThis (szPasswordUrl);
39+ ui->pbEncryptKey ->installEventFilter (this );
40+ ui->cbSystemCredential ->setWhatsThis (szPasswordUrl);
41+ ui->cbSystemCredential ->installEventFilter (this );
42+ ui->leEncryptKey ->setWhatsThis (szPasswordUrl);
43+ ui->leEncryptKey ->installEventFilter (this );
44+ ui->gpEncryptKey ->setWhatsThis (szPasswordUrl);
45+ ui->gpEncryptKey ->installEventFilter (this );
2946}
3047
3148CParameterPluginUI::~CParameterPluginUI ()
@@ -137,8 +154,7 @@ int CParameterPluginUI::SetParameter(CParameter *pParameter)
137154#endif
138155 ui->leEncryptKey ->setText (m_pPara->GetEncryptKey ());
139156 ui->cbSavePassword ->setChecked (m_pPara->GetSavePassword ());
140- on_cbSavePassword_checkStateChanged (ui->cbSavePassword ->checkState ());
141-
157+
142158 ui->cbEnableViewPassword ->setChecked (m_pPara->GetViewPassowrd ());
143159 ui->pbEncryptKey ->setEnabled (ui->cbEnableViewPassword ->isChecked ());
144160 switch (m_pPara->GetPromptType ()) {
@@ -165,13 +181,6 @@ void CParameterPluginUI::on_cbSystemCredential_checkStateChanged(const Qt::Check
165181 ui->gpEncryptKey ->setEnabled (Qt::Unchecked == state);
166182}
167183
168- void CParameterPluginUI::on_cbSavePassword_checkStateChanged (const Qt::CheckState &state)
169- {
170- bool bEnabled = Qt::CheckState::Checked == state;
171- ui->cbSystemCredential ->setVisible (bEnabled);
172- ui->gpEncryptKey ->setVisible (bEnabled);
173- }
174-
175184void CParameterPluginUI::on_pbDesktopShortcutsDisable_clicked ()
176185{
177186 QString szDir = ui->leDesktopShortcutsDisableScript ->text ();
@@ -198,3 +207,15 @@ void CParameterPluginUI::on_cbCaptureAllKeyboard_checkStateChanged(const Qt::Che
198207{
199208 ui->gpDesktopShortcutsSctipt ->setEnabled (Qt::CheckState::Checked == arg1);
200209}
210+
211+ bool CParameterPluginUI::eventFilter (QObject *watched, QEvent *event)
212+ {
213+ if (event->type () == QEvent::WhatsThisClicked) {
214+ QWhatsThisClickedEvent* e = (QWhatsThisClickedEvent*)event;
215+ if (e) {
216+ qDebug (log) << e->href ();
217+ return QDesktopServices::openUrl (e->href ());
218+ }
219+ }
220+ return QWidget::eventFilter (watched, event);
221+ }
0 commit comments