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