Skip to content

Commit

Permalink
SSH Agent: Replace all occurrences of 'flush' with 'clear' (keepassxr…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexpFr committed Apr 28, 2024
1 parent 5e78dee commit 32c608b
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3083,7 +3083,7 @@ Would you like to correct it?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Flush agent</source>
<source>Clear agent</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down Expand Up @@ -5856,11 +5856,11 @@ We recommend you use the AppImage available on our downloads page.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Flush SSH Agent</source>
<source>Clear SSH Agent</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Flush identities like ssh-add -D</source>
<source>Clear all identities like ssh-add -D</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down
4 changes: 2 additions & 2 deletions src/gui/DatabaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,10 +811,10 @@ void DatabaseWidget::removeFromAgent()
}
}

void DatabaseWidget::flushSSHAgent()
void DatabaseWidget::clearSSHAgent()
{
SSHAgent* agent = SSHAgent::instance();
if (!agent->flushAllAgentIdentities()) {
if (!agent->clearAllAgentIdentities()) {
showMessage(agent->errorString(), MessageWidget::Error);
} else {
showMessage(agent->errorString(), MessageWidget::Positive);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/DatabaseWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public slots:
#ifdef WITH_XC_SSHAGENT
void addToAgent();
void removeFromAgent();
void flushSSHAgent();
void clearSSHAgent();
#endif
void performAutoType(const QString& sequence = {});
void performAutoTypeUsername();
Expand Down
18 changes: 9 additions & 9 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ MainWindow::MainWindow()
connect(sshAgent(), SIGNAL(enabledChanged(bool)), this, SLOT(agentEnabled(bool)));
m_ui->settingsWidget->addSettingsPage(new AgentSettingsPage());
if (!sshAgent()->isEnabled()) {
m_ui->actionFlushSSHAgent->setEnabled(false);
m_ui->actionFlushSSHAgent->setVisible(false);
m_ui->actionClearSSHAgent->setEnabled(false);
m_ui->actionClearSSHAgent->setVisible(false);
}
#else
m_ui->actionFlushSSHAgent->setVisible(false);
m_ui->actionFlushSSHAgent->setEnabled(false);
m_ui->actionClearSSHAgent->setVisible(false);
m_ui->actionClearSSHAgent->setEnabled(false);
#endif

#if defined(WITH_XC_KEESHARE)
Expand Down Expand Up @@ -405,7 +405,7 @@ MainWindow::MainWindow()

m_ui->actionSettings->setIcon(icons()->icon("configure"));
#ifdef WITH_XC_SSHAGENT
m_ui->actionFlushSSHAgent->setIcon(icons()->icon("utilities-terminal"));
m_ui->actionClearSSHAgent->setIcon(icons()->icon("utilities-terminal"));
#endif
m_ui->actionPasswordGenerator->setIcon(icons()->icon("password-generator"));

Expand Down Expand Up @@ -519,7 +519,7 @@ MainWindow::MainWindow()
#ifdef WITH_XC_SSHAGENT
m_actionMultiplexer.connect(m_ui->actionEntryAddToAgent, SIGNAL(triggered()), SLOT(addToAgent()));
m_actionMultiplexer.connect(m_ui->actionEntryRemoveFromAgent, SIGNAL(triggered()), SLOT(removeFromAgent()));
m_actionMultiplexer.connect(m_ui->actionFlushSSHAgent, SIGNAL(triggered()), SLOT(flushSSHAgent()));
m_actionMultiplexer.connect(m_ui->actionClearSSHAgent, SIGNAL(triggered()), SLOT(clearSSHAgent()));
#endif

m_actionMultiplexer.connect(m_ui->actionGroupNew, SIGNAL(triggered()), SLOT(createGroup()));
Expand Down Expand Up @@ -1608,8 +1608,8 @@ void MainWindow::agentEnabled(bool enabled)
{
m_ui->actionEntryAddToAgent->setVisible(enabled);
m_ui->actionEntryRemoveFromAgent->setVisible(enabled);
m_ui->actionFlushSSHAgent->setEnabled(enabled);
m_ui->actionFlushSSHAgent->setVisible(enabled);
m_ui->actionClearSSHAgent->setEnabled(enabled);
m_ui->actionClearSSHAgent->setVisible(enabled);
}

void MainWindow::showEntryContextMenu(const QPoint& globalPos)
Expand Down Expand Up @@ -2118,7 +2118,7 @@ void MainWindow::initActionCollection()
// Tools Menu
m_ui->actionPasswordGenerator,
#ifdef WITH_XC_SSHAGENT
m_ui->actionFlushSSHAgent,
m_ui->actionClearSSHAgent,
#endif
m_ui->actionSettings,
// View Menu
Expand Down
8 changes: 4 additions & 4 deletions src/gui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@
<string>&amp;Tools</string>
</property>
<addaction name="actionPasswordGenerator"/>
<addaction name="actionFlushSSHAgent"/>
<addaction name="actionClearSSHAgent"/>
<addaction name="actionSettings"/>
</widget>
<widget class="QMenu" name="menuView">
Expand Down Expand Up @@ -1292,12 +1292,12 @@
<string>Import…</string>
</property>
</action>
<action name="actionFlushSSHAgent">
<action name="actionClearSSHAgent">
<property name="text">
<string>Flush SSH Agent</string>
<string>Clear SSH Agent</string>
</property>
<property name="toolTip">
<string>Flush identities like ssh-add -D</string>
<string>Clear all identities like ssh-add -D</string>
</property>
<property name="menuRole">
<enum>QAction::TextHeuristicRole</enum>
Expand Down
8 changes: 4 additions & 4 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void EditEntryWidget::setupSSHAgent()
connect(m_sshAgentUi->browseButton, &QPushButton::clicked, this, &EditEntryWidget::browsePrivateKey);
connect(m_sshAgentUi->addToAgentButton, &QPushButton::clicked, this, &EditEntryWidget::addKeyToAgent);
connect(m_sshAgentUi->removeFromAgentButton, &QPushButton::clicked, this, &EditEntryWidget::removeKeyFromAgent);
connect(m_sshAgentUi->flushAgentButton, &QPushButton::clicked, this, &EditEntryWidget::flushAgent);
connect(m_sshAgentUi->clearAgentButton, &QPushButton::clicked, this, &EditEntryWidget::clearAgent);
connect(m_sshAgentUi->decryptButton, &QPushButton::clicked, this, &EditEntryWidget::decryptPrivateKey);
connect(m_sshAgentUi->copyToClipboardButton, &QPushButton::clicked, this, &EditEntryWidget::copyPublicKey);
connect(m_sshAgentUi->generateButton, &QPushButton::clicked, this, &EditEntryWidget::generatePrivateKey);
Expand Down Expand Up @@ -685,7 +685,7 @@ void EditEntryWidget::updateSSHAgentKeyInfo()
if (sshAgent()->isAgentRunning()) {
m_sshAgentUi->addToAgentButton->setEnabled(true);
m_sshAgentUi->removeFromAgentButton->setEnabled(true);
m_sshAgentUi->flushAgentButton->setEnabled(true);
m_sshAgentUi->clearAgentButton->setEnabled(true);

sshAgent()->setAutoRemoveOnLock(key, m_sshAgentUi->removeKeyFromAgentCheckBox->isChecked());
}
Expand Down Expand Up @@ -788,9 +788,9 @@ void EditEntryWidget::removeKeyFromAgent()
}
}

void EditEntryWidget::flushAgent()
void EditEntryWidget::clearAgent()
{
if (!sshAgent()->flushAllAgentIdentities()) {
if (!sshAgent()->clearAllAgentIdentities()) {
showMessage(sshAgent()->errorString(), MessageWidget::Error);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/entry/EditEntryWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private slots:
void browsePrivateKey();
void addKeyToAgent();
void removeKeyFromAgent();
void flushAgent();
void clearAgent();
void decryptPrivateKey();
void copyPublicKey();
void generatePrivateKey();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/entry/EditEntryWidgetSSHAgent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="flushAgentButton">
<widget class="QPushButton" name="clearAgentButton">
<property name="text">
<string>Flush agent</string>
<string>Clear agent</string>
</property>
</widget>
</item>
Expand Down
4 changes: 2 additions & 2 deletions src/sshagent/SSHAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,15 @@ bool SSHAgent::removeIdentity(OpenSSHKey& key)
}

/**
* Flush all identities from the SSH agent.
* Remove all identities from the SSH agent.
*
* Since the agent might be forwarded, old or non-OpenSSH, when asked
* to remove all keys, attempt to remove both protocol v.1 and v.2
* keys.
*
* @return true on success
*/
bool SSHAgent::flushAllAgentIdentities()
bool SSHAgent::clearAllAgentIdentities()
{
if (!isAgentRunning()) {
m_error = tr("No agent running, cannot remove identity.");
Expand Down
2 changes: 1 addition & 1 deletion src/sshagent/SSHAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class SSHAgent : public QObject
bool checkIdentity(const OpenSSHKey& key, bool& loaded);
bool removeIdentity(OpenSSHKey& key);
void removeAllIdentities();
bool flushAllAgentIdentities();
bool clearAllAgentIdentities();
void setAutoRemoveOnLock(const OpenSSHKey& key, bool autoRemove);

signals:
Expand Down

0 comments on commit 32c608b

Please sign in to comment.