mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Store clear clipboard settings.
This commit is contained in:
parent
7194a3d7a8
commit
d707fb4760
@ -26,6 +26,8 @@
|
||||
#include <QtDBus/QDBusMessage>
|
||||
#endif
|
||||
|
||||
#include "core/Config.h"
|
||||
|
||||
Clipboard::Clipboard(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_timer(new QTimer(this))
|
||||
@ -41,7 +43,7 @@ Clipboard::~Clipboard()
|
||||
}
|
||||
}
|
||||
|
||||
void Clipboard::setText(const QString& text, int clearTimeout)
|
||||
void Clipboard::setText(const QString& text)
|
||||
{
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
|
||||
@ -50,8 +52,11 @@ void Clipboard::setText(const QString& text, int clearTimeout)
|
||||
clipboard->setText(text, QClipboard::Selection);
|
||||
}
|
||||
|
||||
if (clearTimeout > 0) {
|
||||
m_timer->start(clearTimeout);
|
||||
if (config()->get("security/clearclipboard").toBool()) {
|
||||
int timeout = config()->get("security/clearclipboardtimeout").toInt();
|
||||
if (timeout > 0) {
|
||||
m_timer->start(timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Clipboard : public QObject
|
||||
|
||||
public:
|
||||
~Clipboard();
|
||||
void setText(const QString& text, int clearTimeout = 0);
|
||||
void setText(const QString& text);
|
||||
|
||||
private Q_SLOTS:
|
||||
void clearClipboard();
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "SettingsWidget.h"
|
||||
#include "ui_SettingsWidgetSecurity.h"
|
||||
|
||||
#include "core/Config.h"
|
||||
|
||||
SettingsWidget::SettingsWidget(QWidget* parent)
|
||||
: EditWidget(parent)
|
||||
, m_secWidget(new QWidget())
|
||||
@ -40,9 +42,14 @@ SettingsWidget::~SettingsWidget()
|
||||
|
||||
void SettingsWidget::loadSettings()
|
||||
{
|
||||
m_secUi->clearClipboardCheckBox->setChecked(config()->get("security/clearclipboard").toBool());
|
||||
m_secUi->clearClipboardSpinBox->setValue(config()->get("security/clearclipboardtimeout").toInt());
|
||||
|
||||
setCurrentRow(0);
|
||||
}
|
||||
|
||||
void SettingsWidget::saveSettings()
|
||||
{
|
||||
config()->set("security/clearclipboard", m_secUi->clearClipboardCheckBox->isChecked());
|
||||
config()->set("security/clearclipboardtimeout", m_secUi->clearClipboardSpinBox->value());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user