mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-21 05:58:44 -04:00
Add methods isHardwareKeySupported and refreshHardwareKeys to DBus
This commit is contained in:
parent
20a2a96222
commit
de3d40b644
3 changed files with 45 additions and 0 deletions
|
@ -716,6 +716,43 @@ void MainWindow::appExit()
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if application was built with hardware key support.
|
||||||
|
* Intented to be used by 3rd-party applications using DBus.
|
||||||
|
*
|
||||||
|
* @return True if built with hardware key support, false otherwise
|
||||||
|
*/
|
||||||
|
bool MainWindow::isHardwareKeySupported()
|
||||||
|
{
|
||||||
|
#ifdef WITH_XC_YUBIKEY
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshes list of hardware keys known.
|
||||||
|
* Triggers the DatabaseOpenWidget to automatically select the key last used for a database if found.
|
||||||
|
* Intented to be used by 3rd-party applications using DBus.
|
||||||
|
*
|
||||||
|
* @return True if any key was found, false otherwise or if application lacks hardware key support
|
||||||
|
*/
|
||||||
|
bool MainWindow::refreshHardwareKeys()
|
||||||
|
{
|
||||||
|
#ifdef WITH_XC_YUBIKEY
|
||||||
|
auto yk = YubiKey::instance();
|
||||||
|
// find keys sync to allow returning if any key was found
|
||||||
|
bool found = yk->findValidKeys();
|
||||||
|
// emit signal so DatabaseOpenWidget can select last used key
|
||||||
|
// emit here manually because sync findValidKeys() cannot do that properly
|
||||||
|
emit yk->detectComplete(found);
|
||||||
|
return found;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::updateLastDatabasesMenu()
|
void MainWindow::updateLastDatabasesMenu()
|
||||||
{
|
{
|
||||||
m_ui->menuRecentDatabases->clear();
|
m_ui->menuRecentDatabases->clear();
|
||||||
|
|
|
@ -69,6 +69,8 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void openDatabase(const QString& filePath, const QString& password = {}, const QString& keyfile = {});
|
void openDatabase(const QString& filePath, const QString& password = {}, const QString& keyfile = {});
|
||||||
void appExit();
|
void appExit();
|
||||||
|
bool isHardwareKeySupported();
|
||||||
|
bool refreshHardwareKeys();
|
||||||
void displayGlobalMessage(const QString& text,
|
void displayGlobalMessage(const QString& text,
|
||||||
MessageWidget::MessageType type,
|
MessageWidget::MessageType type,
|
||||||
bool showClosebutton = true,
|
bool showClosebutton = true,
|
||||||
|
|
|
@ -15,6 +15,12 @@
|
||||||
</method>
|
</method>
|
||||||
<method name="appExit">
|
<method name="appExit">
|
||||||
</method>
|
</method>
|
||||||
|
<method name="isHardwareKeySupported">
|
||||||
|
<arg name="hardwareKeySupported" type="b" direction="out"/>
|
||||||
|
</method>
|
||||||
|
<method name="refreshHardwareKeys">
|
||||||
|
<arg name="found" type="b" direction="out"/>
|
||||||
|
</method>
|
||||||
<method name="lockAllDatabases">
|
<method name="lockAllDatabases">
|
||||||
</method>
|
</method>
|
||||||
<method name="closeAllDatabases">
|
<method name="closeAllDatabases">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue