mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-06 22:17:39 +03:00
Add methods isHardwareKeySupported and refreshHardwareKeys to DBus
This commit is contained in:
parent
d8d5ddcab6
commit
9150febd02
3 changed files with 45 additions and 0 deletions
|
@ -716,6 +716,43 @@ void MainWindow::appExit()
|
|||
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()
|
||||
{
|
||||
m_ui->menuRecentDatabases->clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue