diff --git a/COPYING b/COPYING index 4325e067b9..a518de87e3 100644 --- a/COPYING +++ b/COPYING @@ -150,9 +150,6 @@ Files: share/icons/application/scalable/actions/application-exit.svg share/icons/application/scalable/actions/bugreport.svg share/icons/application/scalable/actions/chevron-double-down.svg share/icons/application/scalable/actions/chevron-double-right.svg - share/icons/application/scalable/actions/totp.svg - share/icons/application/scalable/actions/totp-copy.svg - share/icons/application/scalable/actions/totp-edit.svg share/icons/application/scalable/actions/clipboard-text.svg share/icons/application/scalable/actions/configure.svg share/icons/application/scalable/actions/database-change-key.svg @@ -217,6 +214,10 @@ Files: share/icons/application/scalable/actions/application-exit.svg share/icons/application/scalable/actions/tag.svg share/icons/application/scalable/actions/tag-multiple.svg share/icons/application/scalable/actions/tag-search.svg + share/icons/application/scalable/actions/totp.svg + share/icons/application/scalable/actions/totp-copy.svg + share/icons/application/scalable/actions/totp-copy-password.svg + share/icons/application/scalable/actions/totp-edit.svg share/icons/application/scalable/actions/trash.svg share/icons/application/scalable/actions/url-copy.svg share/icons/application/scalable/actions/user-guide.svg diff --git a/docs/topics/KeyboardShortcuts.adoc b/docs/topics/KeyboardShortcuts.adoc index 93baa303d5..b027ba1fcf 100644 --- a/docs/topics/KeyboardShortcuts.adoc +++ b/docs/topics/KeyboardShortcuts.adoc @@ -25,6 +25,7 @@ NOTE: On macOS please substitute `Ctrl` with `Cmd` (aka `⌘`). |Copy URL | Ctrl + U |Open URL | Ctrl + Shift + U |Copy TOTP | Ctrl + T +|Copy Password and TOTP | Ctrl + Y |Show TOTP | Ctrl + Shift + T |Trigger AutoType | Ctrl + Shift + V |Add key to SSH Agent | Ctrl + H diff --git a/share/icons/application/scalable/actions/totp-copy-password.svg b/share/icons/application/scalable/actions/totp-copy-password.svg new file mode 100644 index 0000000000..935501117f --- /dev/null +++ b/share/icons/application/scalable/actions/totp-copy-password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/share/icons/icons.qrc b/share/icons/icons.qrc index 8c8c78211f..4982e3b0e3 100644 --- a/share/icons/icons.qrc +++ b/share/icons/icons.qrc @@ -11,9 +11,6 @@ application/scalable/actions/bugreport.svg application/scalable/actions/chevron-double-down.svg application/scalable/actions/chevron-double-right.svg - application/scalable/actions/totp.svg - application/scalable/actions/totp-copy.svg - application/scalable/actions/totp-edit.svg application/scalable/actions/clipboard-text.svg application/scalable/actions/configure.svg application/scalable/actions/database-change-key.svg @@ -79,6 +76,10 @@ application/scalable/actions/tag.svg application/scalable/actions/tag-multiple.svg application/scalable/actions/tag-search.svg + application/scalable/actions/totp.svg + application/scalable/actions/totp-copy.svg + application/scalable/actions/totp-copy-password.svg + application/scalable/actions/totp-edit.svg application/scalable/actions/trash.svg application/scalable/actions/url-copy.svg application/scalable/actions/user-guide.svg diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index e36975737c..e22ccb977f 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -5430,6 +5430,10 @@ We recommend you use the AppImage available on our downloads page. + + Copy Password and TOTP + + ManageDatabase diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 08d8d4dec1..8932ffbb78 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -648,6 +648,15 @@ void DatabaseWidget::copyPassword() } } +void DatabaseWidget::copyPasswordTotp() +{ + auto currentEntry = currentSelectedEntry(); + if (currentEntry) { + setClipboardTextAndMinimize( + currentEntry->resolveMultiplePlaceholders(currentEntry->password()).append(currentEntry->totp())); + } +} + void DatabaseWidget::copyURL() { auto currentEntry = currentSelectedEntry(); diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 57108dfbf6..daca949e1b 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -181,6 +181,7 @@ public slots: void showTotp(); void showTotpKeyQrCode(); void copyTotp(); + void copyPasswordTotp(); void setupTotp(); #ifdef WITH_XC_SSHAGENT void addToAgent(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 163ae70115..d761e914e0 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -279,6 +279,7 @@ MainWindow::MainWindow() m_ui->actionEntryTotp->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T); m_ui->actionEntryDownloadIcon->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D); m_ui->actionEntryCopyTotp->setShortcut(Qt::CTRL + Qt::Key_T); + m_ui->actionEntryCopyPasswordTotp->setShortcut(Qt::CTRL + Qt::Key_Y); m_ui->actionEntryMoveUp->setShortcut(Qt::CTRL + Qt::ALT + Qt::Key_Up); m_ui->actionEntryMoveDown->setShortcut(Qt::CTRL + Qt::ALT + Qt::Key_Down); m_ui->actionEntryCopyUsername->setShortcut(Qt::CTRL + Qt::Key_B); @@ -308,6 +309,7 @@ MainWindow::MainWindow() m_ui->actionEntryTotp->setShortcutVisibleInContextMenu(true); m_ui->actionEntryDownloadIcon->setShortcutVisibleInContextMenu(true); m_ui->actionEntryCopyTotp->setShortcutVisibleInContextMenu(true); + m_ui->actionEntryCopyPasswordTotp->setShortcutVisibleInContextMenu(true); m_ui->actionEntryMoveUp->setShortcutVisibleInContextMenu(true); m_ui->actionEntryMoveDown->setShortcutVisibleInContextMenu(true); m_ui->actionEntryCopyUsername->setShortcutVisibleInContextMenu(true); @@ -406,6 +408,7 @@ MainWindow::MainWindow() m_ui->menuEntryTotp->setIcon(icons()->icon("totp")); m_ui->actionEntryTotp->setIcon(icons()->icon("totp")); m_ui->actionEntryCopyTotp->setIcon(icons()->icon("totp-copy")); + m_ui->actionEntryCopyPasswordTotp->setIcon(icons()->icon("totp-copy-password")); m_ui->actionEntryTotpQRCode->setIcon(icons()->icon("qrcode")); m_ui->actionEntrySetupTotp->setIcon(icons()->icon("totp-edit")); m_ui->menuTags->setIcon(icons()->icon("tag-multiple")); @@ -498,6 +501,7 @@ MainWindow::MainWindow() m_actionMultiplexer.connect(m_ui->actionEntrySetupTotp, SIGNAL(triggered()), SLOT(setupTotp())); m_actionMultiplexer.connect(m_ui->actionEntryCopyTotp, SIGNAL(triggered()), SLOT(copyTotp())); + m_actionMultiplexer.connect(m_ui->actionEntryCopyPasswordTotp, SIGNAL(triggered()), SLOT(copyPasswordTotp())); m_actionMultiplexer.connect(m_ui->actionEntryTotpQRCode, SIGNAL(triggered()), SLOT(showTotpKeyQrCode())); m_actionMultiplexer.connect(m_ui->actionEntryCopyTitle, SIGNAL(triggered()), SLOT(copyTitle())); m_actionMultiplexer.connect(m_ui->actionEntryMoveUp, SIGNAL(triggered()), SLOT(moveEntryUp())); @@ -942,6 +946,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) m_ui->actionEntryOpenUrl->setEnabled(singleEntrySelected && dbWidget->currentEntryHasUrl()); m_ui->actionEntryTotp->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTotp()); m_ui->actionEntryCopyTotp->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTotp()); + m_ui->actionEntryCopyPasswordTotp->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTotp()); m_ui->actionEntrySetupTotp->setEnabled(singleEntrySelected); m_ui->actionEntryTotpQRCode->setEnabled(singleEntrySelected && dbWidget->currentEntryHasTotp()); m_ui->actionEntryDownloadIcon->setEnabled((entriesSelected && !singleEntrySelected) diff --git a/src/gui/MainWindow.ui b/src/gui/MainWindow.ui index 86f400f3cb..f41cd508bb 100644 --- a/src/gui/MainWindow.ui +++ b/src/gui/MainWindow.ui @@ -312,6 +312,7 @@ TOTP + @@ -887,6 +888,11 @@ Copy &TOTP + + + + Copy Password and TOTP +