0
0
mirror of https://github.com/keepassxreboot/keepassxc.git synced 2024-09-19 20:02:18 +02:00

Improve handling of clipboard actions

* Fix #10804
This commit is contained in:
Jonathan White 2024-05-25 09:13:43 -04:00
parent 28e6887aa4
commit 3662f6aa77
4 changed files with 6 additions and 5 deletions

View File

@ -201,6 +201,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(m_previewSplitter, SIGNAL(splitterMoved(int,int)), SIGNAL(splitterSizesChanged()));
connect(this, SIGNAL(currentModeChanged(DatabaseWidget::Mode)), m_previewView, SLOT(setDatabaseMode(DatabaseWidget::Mode)));
connect(m_previewView, SIGNAL(entryUrlActivated(Entry*)), SLOT(openUrlForEntry(Entry*)));
connect(m_previewView, SIGNAL(copyTextRequested(const QString&)), SLOT(setClipboardTextAndMinimize(const QString&)));
connect(m_entryView, SIGNAL(viewStateChanged()), SIGNAL(entryViewStateChanged()));
connect(m_groupView, SIGNAL(groupSelectionChanged()), SLOT(onGroupChanged()));
connect(m_groupView, &GroupView::groupFocused, this, [this] { m_previewView->setGroup(currentGroup()); });

View File

@ -206,6 +206,7 @@ public slots:
void performAutoTypePassword();
void performAutoTypePasswordEnter();
void performAutoTypeTOTP();
void setClipboardTextAndMinimize(const QString& text);
void openUrl();
void downloadSelectedFavicons();
void downloadAllFavicons();
@ -285,7 +286,6 @@ private slots:
private:
int addChildWidget(QWidget* w);
void setClipboardTextAndMinimize(const QString& text);
void processAutoOpen();
void openDatabaseFromEntry(const Entry* entry, bool inBackground = true);
void performIconDownloads(const QList<Entry*>& entries, bool force = false, bool downloadInBackground = false);

View File

@ -22,7 +22,6 @@
#include "Application.h"
#include "core/Config.h"
#include "core/Totp.h"
#include "gui/Clipboard.h"
#include "gui/Font.h"
#include "gui/Icons.h"
#if defined(WITH_XC_KEESHARE)
@ -85,10 +84,10 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
});
connect(&m_totpTimer, SIGNAL(timeout()), SLOT(updateTotpLabel()));
connect(m_ui->entryAttributesTable, &QTableWidget::itemDoubleClicked, this, [](QTableWidgetItem* item) {
connect(m_ui->entryAttributesTable, &QTableWidget::itemDoubleClicked, this, [this](QTableWidgetItem* item) {
auto userData = item->data(Qt::UserRole);
if (userData.isValid()) {
clipboard()->setText(userData.toString());
emit copyTextRequested(userData.toString());
}
});
@ -117,7 +116,7 @@ bool EntryPreviewWidget::eventFilter(QObject* object, QEvent* event)
{
if (object == m_ui->entryTotpLabel && event->type() == QEvent::MouseButtonDblClick) {
if (m_currentEntry && m_currentEntry->hasTotp()) {
clipboard()->setText(m_currentEntry->totp());
emit copyTextRequested(m_currentEntry->totp());
m_ui->entryTotpLabel->clearFocus();
return true;
}

View File

@ -46,6 +46,7 @@ public slots:
signals:
void entryUrlActivated(Entry* entry);
void copyTextRequested(const QString& text);
protected:
bool eventFilter(QObject* object, QEvent* event) override;