From 38826a851da650609b7456a8a931835423189ad7 Mon Sep 17 00:00:00 2001
From: Julius Bullinger <303458+bllngr@users.noreply.github.com>
Date: Sun, 24 Mar 2019 15:13:50 +0100
Subject: [PATCH] Add button to open Custom Auto-type sequence documentation
(#2733)
This change adds a button next to the text edit field which opens the following wiki page: https://github.com/keepassxreboot/keepassxc/wiki/Autotype-Custom-Sequence
---
src/gui/entry/EditEntryWidget.cpp | 11 +++++++++++
src/gui/entry/EditEntryWidget.h | 1 +
src/gui/entry/EditEntryWidgetAutoType.ui | 17 +++++++++++++++++
3 files changed, 29 insertions(+)
diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp
index e57bc97d6..9a4c1600f 100644
--- a/src/gui/entry/EditEntryWidget.cpp
+++ b/src/gui/entry/EditEntryWidget.cpp
@@ -198,11 +198,18 @@ void EditEntryWidget::setupIcon()
connect(this, SIGNAL(rejected()), m_iconsWidget, SLOT(abortRequests()));
}
+void EditEntryWidget::openAutotypeHelp()
+{
+ QDesktopServices::openUrl(QUrl("https://github.com/keepassxreboot/keepassxc/wiki/Autotype-Custom-Sequence"));
+}
+
void EditEntryWidget::setupAutoType()
{
m_autoTypeUi->setupUi(m_autoTypeWidget);
addPage(tr("Auto-Type"), FilePath::instance()->icon("actions", "key-enter"), m_autoTypeWidget);
+ m_autoTypeUi->openHelpButton->setIcon(filePath()->icon("actions", "system-help"));
+
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->inheritSequenceButton);
m_autoTypeDefaultSequenceGroup->addButton(m_autoTypeUi->customSequenceButton);
m_autoTypeAssocModel->setAutoTypeAssociations(m_autoTypeAssoc);
@@ -213,6 +220,9 @@ void EditEntryWidget::setupAutoType()
connect(m_autoTypeUi->enableButton, SIGNAL(toggled(bool)), SLOT(updateAutoTypeEnabled()));
connect(m_autoTypeUi->customSequenceButton, SIGNAL(toggled(bool)),
m_autoTypeUi->sequenceEdit, SLOT(setEnabled(bool)));
+ connect(m_autoTypeUi->customSequenceButton, SIGNAL(toggled(bool)),
+ m_autoTypeUi->openHelpButton, SLOT(setEnabled(bool)));
+ connect(m_autoTypeUi->openHelpButton, SIGNAL(clicked()), SLOT(openAutotypeHelp()));
connect(m_autoTypeUi->customWindowSequenceButton, SIGNAL(toggled(bool)),
m_autoTypeUi->windowSequenceEdit, SLOT(setEnabled(bool)));
connect(m_autoTypeUi->assocAddButton, SIGNAL(clicked()), SLOT(insertAutoTypeAssoc()));
@@ -1185,6 +1195,7 @@ void EditEntryWidget::updateAutoTypeEnabled()
m_autoTypeUi->inheritSequenceButton->setEnabled(!m_history && autoTypeEnabled);
m_autoTypeUi->customSequenceButton->setEnabled(!m_history && autoTypeEnabled);
m_autoTypeUi->sequenceEdit->setEnabled(autoTypeEnabled && m_autoTypeUi->customSequenceButton->isChecked());
+ m_autoTypeUi->openHelpButton->setEnabled(autoTypeEnabled && m_autoTypeUi->customSequenceButton->isChecked());
m_autoTypeUi->assocView->setEnabled(autoTypeEnabled);
m_autoTypeUi->assocAddButton->setEnabled(!m_history);
diff --git a/src/gui/entry/EditEntryWidget.h b/src/gui/entry/EditEntryWidget.h
index 07a4b7895..4c6870594 100644
--- a/src/gui/entry/EditEntryWidget.h
+++ b/src/gui/entry/EditEntryWidget.h
@@ -90,6 +90,7 @@ private slots:
void protectCurrentAttribute(bool state);
void revealCurrentAttribute();
void updateAutoTypeEnabled();
+ void openAutotypeHelp();
void insertAutoTypeAssoc();
void removeAutoTypeAssoc();
void loadCurrentAssoc(const QModelIndex& current);
diff --git a/src/gui/entry/EditEntryWidgetAutoType.ui b/src/gui/entry/EditEntryWidgetAutoType.ui
index 3d4ec7a3e..81261394d 100644
--- a/src/gui/entry/EditEntryWidgetAutoType.ui
+++ b/src/gui/entry/EditEntryWidgetAutoType.ui
@@ -85,6 +85,22 @@
+ -
+
+
+ false
+
+
+ Open AutoType help webpage
+
+
+ AutoType help button
+
+
+
+
+
+
-
@@ -268,6 +284,7 @@
inheritSequenceButton
customSequenceButton
sequenceEdit
+ openHelpButton
assocView
windowTitleCombo
customWindowSequenceButton