mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-10-12 21:40:54 -04:00
Add DBus support: control keepassxc on desktop events (load database when log in, close all databases when log out)
This commit is contained in:
parent
46c58b3202
commit
e560650bf3
9 changed files with 226 additions and 1 deletions
|
@ -64,6 +64,13 @@
|
|||
#include "gui/SettingsWidget.h"
|
||||
#include "gui/PasswordGeneratorWidget.h"
|
||||
|
||||
#ifdef WITH_XC_DBUS
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include <QtDBus>
|
||||
#include "gui/MainWindowAdaptor.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WITH_XC_HTTP
|
||||
class HttpPlugin: public ISettingsPage
|
||||
{
|
||||
|
@ -168,6 +175,16 @@ MainWindow::MainWindow()
|
|||
, m_appExiting(false)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
#ifdef WITH_XC_DBUS
|
||||
#if defined(Q_OS_LINUX)
|
||||
new MainWindowAdaptor(this);
|
||||
QDBusConnection dbus = QDBusConnection::sessionBus();
|
||||
dbus.registerObject("/keepassxc", this);
|
||||
dbus.registerService("org.keepassxc.MainWindow");
|
||||
#else
|
||||
qWarning("DBus is not available on this system");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
|
@ -1123,3 +1140,8 @@ void MainWindow::dropEvent(QDropEvent* event)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeAllDatabases()
|
||||
{
|
||||
m_ui->tabWidget->closeAllDatabases();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue