From f09f00a6b8b24acaaa8583177352c5538dfbc4d0 Mon Sep 17 00:00:00 2001 From: Christian Kieschnick Date: Mon, 25 Feb 2019 17:45:59 +0100 Subject: [PATCH] Add clear functionality to group share settings Settings in a group can now be cleared using a single button press on 'clear'. --- src/keeshare/group/EditGroupWidgetKeeShare.cpp | 12 ++++++++++++ src/keeshare/group/EditGroupWidgetKeeShare.h | 1 + src/keeshare/group/EditGroupWidgetKeeShare.ui | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/src/keeshare/group/EditGroupWidgetKeeShare.cpp b/src/keeshare/group/EditGroupWidgetKeeShare.cpp index 253bb9819..e0827a36b 100644 --- a/src/keeshare/group/EditGroupWidgetKeeShare.cpp +++ b/src/keeshare/group/EditGroupWidgetKeeShare.cpp @@ -54,6 +54,7 @@ EditGroupWidgetKeeShare::EditGroupWidgetKeeShare(QWidget* parent) connect(m_ui->pathEdit, SIGNAL(editingFinished()), SLOT(selectPath())); connect(m_ui->pathSelectionButton, SIGNAL(pressed()), SLOT(launchPathSelectionDialog())); connect(m_ui->typeComboBox, SIGNAL(currentIndexChanged(int)), SLOT(selectType())); + connect(m_ui->clearButton, SIGNAL(clicked(bool)), SLOT(clearInputs())); connect(KeeShare::instance(), SIGNAL(activeChanged()), SLOT(showSharingState())); @@ -166,6 +167,17 @@ void EditGroupWidgetKeeShare::update() m_ui->togglePasswordButton->setChecked(false); } +void EditGroupWidgetKeeShare::clearInputs() +{ + if (m_temporaryGroup) { + KeeShare::setReferenceTo(m_temporaryGroup, KeeShareSettings::Reference()); + } + m_ui->passwordEdit->clear(); + m_ui->pathEdit->clear(); + m_ui->typeComboBox->setCurrentIndex(KeeShareSettings::Inactive); + m_ui->passwordGenerator->setVisible(false); +} + void EditGroupWidgetKeeShare::togglePasswordGeneratorButton(bool checked) { m_ui->passwordGenerator->regeneratePassword(); diff --git a/src/keeshare/group/EditGroupWidgetKeeShare.h b/src/keeshare/group/EditGroupWidgetKeeShare.h index 140f13c86..8ecfc2bc6 100644 --- a/src/keeshare/group/EditGroupWidgetKeeShare.h +++ b/src/keeshare/group/EditGroupWidgetKeeShare.h @@ -44,6 +44,7 @@ private slots: private slots: void update(); + void clearInputs(); void selectType(); void selectPassword(); void launchPathSelectionDialog(); diff --git a/src/keeshare/group/EditGroupWidgetKeeShare.ui b/src/keeshare/group/EditGroupWidgetKeeShare.ui index 02361f92d..30e34962f 100644 --- a/src/keeshare/group/EditGroupWidgetKeeShare.ui +++ b/src/keeshare/group/EditGroupWidgetKeeShare.ui @@ -97,6 +97,13 @@ + + + + Clear + + +