add function for locking DBs from DBus, fix #687

This commit is contained in:
thez3ro 2018-01-16 00:49:32 +01:00
parent e560650bf3
commit 98a89e4f2c
No known key found for this signature in database
GPG key ID: F628F9E41DD7C073
9 changed files with 40 additions and 88 deletions

View file

@ -24,11 +24,6 @@
#include <QShortcut>
#include <QTimer>
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_DBUS)
#include <QList>
#include <QtDBus/QtDBus>
#endif
#include "config-keepassx.h"
#include "autotype/AutoType.h"
@ -61,15 +56,14 @@
#include "browser/BrowserOptionDialog.h"
#endif
#include "gui/SettingsWidget.h"
#include "gui/PasswordGeneratorWidget.h"
#ifdef WITH_XC_DBUS
#if defined(Q_OS_LINUX)
#include <QtDBus>
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_DBUS)
#include <QList>
#include <QtDBus/QtDBus>
#include "gui/MainWindowAdaptor.h"
#endif
#endif
#include "gui/SettingsWidget.h"
#include "gui/PasswordGeneratorWidget.h"
#ifdef WITH_XC_HTTP
class HttpPlugin: public ISettingsPage
@ -175,16 +169,13 @@ MainWindow::MainWindow()
, m_appExiting(false)
{
m_ui->setupUi(this);
#ifdef WITH_XC_DBUS
#if defined(Q_OS_LINUX)
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_DBUS)
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
dbus.registerService("org.keepassxc.KeePassXC.MainWindow");
#endif
setAcceptDrops(true);
@ -1145,3 +1136,8 @@ void MainWindow::closeAllDatabases()
{
m_ui->tabWidget->closeAllDatabases();
}
void MainWindow::lockAllDatabases()
{
lockDatabasesAfterInactivity();
}