Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Spets <toni.spets@iki.fi>2018-05-10 16:12:36 +0300
committerJonathan White <support@dmapps.us>2020-04-08 20:44:27 +0300
commitef668f552ed20b801f62b9cd2b6cf395c01bab0c (patch)
treea376f1cf23ac3f67859e96a48a62e1d28cac6362 /src/gui/DatabaseWidget.cpp
parentd41a37c9bc4947c9aa7bbbe5fa46f74933a74795 (diff)
SSH Agent: Entry context menu control
Diffstat (limited to 'src/gui/DatabaseWidget.cpp')
-rw-r--r--src/gui/DatabaseWidget.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index e6cc9f309..a9f628735 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -699,6 +699,50 @@ void DatabaseWidget::setClipboardTextAndMinimize(const QString& text)
}
}
+#ifdef WITH_XC_SSHAGENT
+void DatabaseWidget::addToAgent()
+{
+ Entry* currentEntry = m_entryView->currentEntry();
+ Q_ASSERT(currentEntry);
+ if (!currentEntry) {
+ return;
+ }
+
+ KeeAgentSettings settings;
+ if (!settings.fromEntry(currentEntry)) {
+ return;
+ }
+
+ OpenSSHKey key;
+ if (settings.toOpenSSHKey(currentEntry, key, true)) {
+ SSHAgent::instance()->addIdentity(key, settings);
+ } else {
+ m_messageWidget->showMessage(key.errorString(), MessageWidget::Error);
+ }
+}
+
+void DatabaseWidget::removeFromAgent()
+{
+ Entry* currentEntry = m_entryView->currentEntry();
+ Q_ASSERT(currentEntry);
+ if (!currentEntry) {
+ return;
+ }
+
+ KeeAgentSettings settings;
+ if (!settings.fromEntry(currentEntry)) {
+ return;
+ }
+
+ OpenSSHKey key;
+ if (settings.toOpenSSHKey(currentEntry, key, false)) {
+ SSHAgent::instance()->removeIdentity(key);
+ } else {
+ m_messageWidget->showMessage(key.errorString(), MessageWidget::Error);
+ }
+}
+#endif
+
void DatabaseWidget::performAutoType()
{
auto currentEntry = currentSelectedEntry();
@@ -1625,6 +1669,19 @@ bool DatabaseWidget::currentEntryHasTotp()
return currentEntry->hasTotp();
}
+#ifdef WITH_XC_SSHAGENT
+bool DatabaseWidget::currentEntryHasSshKey()
+{
+ Entry* currentEntry = m_entryView->currentEntry();
+ Q_ASSERT(currentEntry);
+ if (!currentEntry) {
+ return false;
+ }
+
+ return KeeAgentSettings::inEntry(currentEntry);
+}
+#endif
+
bool DatabaseWidget::currentEntryHasNotes()
{
auto currentEntry = currentSelectedEntry();