mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-03 12:06:25 -04:00
Merge remote-tracking branch 'github/pr/74'
This commit is contained in:
commit
efc4cd5969
3 changed files with 39 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QKeyEvent>
|
||||
#include <QSplitter>
|
||||
#include <QTimer>
|
||||
#include <QProcess>
|
||||
|
@ -88,6 +89,7 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
|||
m_searchUi->closeSearchButton->setShortcut(Qt::Key_Escape);
|
||||
m_searchWidget->hide();
|
||||
m_searchUi->caseSensitiveCheckBox->setVisible(false);
|
||||
m_searchUi->searchEdit->installEventFilter(this);
|
||||
|
||||
QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget);
|
||||
vLayout->setMargin(0);
|
||||
|
@ -982,3 +984,33 @@ bool DatabaseWidget::currentEntryHasNotes()
|
|||
}
|
||||
return !currentEntry->notes().isEmpty();
|
||||
}
|
||||
|
||||
bool DatabaseWidget::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
if (object == m_searchUi->searchEdit) {
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
if (keyEvent->matches(QKeySequence::Copy)) {
|
||||
// If Control+C is pressed in the search edit when no
|
||||
// text is selected, copy the password of the current
|
||||
// entry.
|
||||
Entry* currentEntry = m_entryView->currentEntry();
|
||||
if (currentEntry && !m_searchUi->searchEdit->hasSelectedText()) {
|
||||
setClipboardTextAndMinimize(currentEntry->password());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (keyEvent->matches(QKeySequence::MoveToNextLine)) {
|
||||
// If Down is pressed at EOL in the search edit, move
|
||||
// the focus to the entry view.
|
||||
if (!m_searchUi->searchEdit->hasSelectedText() &&
|
||||
m_searchUi->searchEdit->cursorPosition() == m_searchUi->searchEdit->text().length()) {
|
||||
m_entryView->setFocus();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ Q_SIGNALS:
|
|||
void splitterSizesChanged();
|
||||
void entryColumnSizesChanged();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* object, QEvent* event);
|
||||
|
||||
public Q_SLOTS:
|
||||
void createEntry();
|
||||
void cloneEntry();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue