mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-18 05:14:16 -05:00
Added freedesktop DBus, fixed codestyle
This commit is contained in:
parent
289e98ed5b
commit
1b7b2ff456
@ -222,9 +222,16 @@ target_link_libraries(keepassx_core
|
||||
${GCRYPT_LIBRARIES}
|
||||
${GPGERROR_LIBRARIES}
|
||||
${ZLIB_LIBRARIES})
|
||||
|
||||
if(APPLE)
|
||||
target_link_libraries(keepassx_core "-framework Foundation")
|
||||
endif()
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(keepassx_core Qt5::DBus)
|
||||
endif()
|
||||
if(MINGW)
|
||||
target_link_libraries(keepassx_core Wtsapi32.lib)
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
include(GenerateProductVersion)
|
||||
|
@ -119,6 +119,7 @@ void Config::init(const QString& fileName)
|
||||
m_defaults.insert("security/lockdatabaseidle", false);
|
||||
m_defaults.insert("security/lockdatabaseidlesec", 240);
|
||||
m_defaults.insert("security/lockdatabaseminimize", false);
|
||||
m_defaults.insert("security/lockdatabasescreenlock", true);
|
||||
m_defaults.insert("security/passwordsrepeat", false);
|
||||
m_defaults.insert("security/passwordscleartext", false);
|
||||
m_defaults.insert("security/autotypeask", true);
|
||||
|
@ -9,6 +9,15 @@ ScreenLockListenerDBus::ScreenLockListenerDBus(QWidget *parent):
|
||||
{
|
||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||
QDBusConnection systemBus = QDBusConnection::systemBus();
|
||||
|
||||
sessionBus.connect(
|
||||
"org.freedesktop.ScreenSaver", // service
|
||||
"/org/freedesktop/ScreenSaver", // path
|
||||
"org.freedesktop.ScreenSaver", // interface
|
||||
"ActiveChanged", // signal name
|
||||
this, //receiver
|
||||
SLOT(freedesktopScreenSaver(bool)));
|
||||
|
||||
sessionBus.connect(
|
||||
"org.gnome.SessionManager", // service
|
||||
"/org/gnome/SessionManager/Presence", // path
|
||||
@ -52,3 +61,10 @@ void ScreenLockListenerDBus::unityLocked()
|
||||
{
|
||||
Q_EMIT screenLocked();
|
||||
}
|
||||
|
||||
void ScreenLockListenerDBus::freedesktopScreenSaver(bool status)
|
||||
{
|
||||
if (status) {
|
||||
Q_EMIT screenLocked();
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ private Q_SLOTS:
|
||||
void gnomeSessionStatusChanged(uint status);
|
||||
void logindPrepareForSleep(bool beforeSleep);
|
||||
void unityLocked();
|
||||
void freedesktopScreenSaver(bool status);
|
||||
};
|
||||
|
||||
#endif // SCREENLOCKLISTENERDBUS_H
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include <QMutexLocker>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
ScreenLockListenerMac* ScreenLockListenerMac::instance(){
|
||||
ScreenLockListenerMac* ScreenLockListenerMac::instance()
|
||||
{
|
||||
static QMutex mutex;
|
||||
QMutexLocker lock(&mutex);
|
||||
|
||||
@ -15,17 +16,20 @@ ScreenLockListenerMac* ScreenLockListenerMac::instance(){
|
||||
}
|
||||
|
||||
void ScreenLockListenerMac::notificationCenterCallBack(CFNotificationCenterRef /*center*/, void */*observer*/,
|
||||
CFNotificationName /*name*/, const void */*object*/, CFDictionaryRef /*userInfo*/){
|
||||
CFNotificationName /*name*/, const void */*object*/, CFDictionaryRef /*userInfo*/)
|
||||
{
|
||||
instance()->onSignalReception();
|
||||
}
|
||||
|
||||
ScreenLockListenerMac::ScreenLockListenerMac(QWidget* parent):
|
||||
ScreenLockListenerPrivate(parent){
|
||||
ScreenLockListenerMac::ScreenLockListenerMac(QWidget* parent)
|
||||
: ScreenLockListenerPrivate(parent)
|
||||
{
|
||||
CFNotificationCenterRef distCenter;
|
||||
CFStringRef screenIsLockedSignal = CFSTR("com.apple.screenIsLocked");
|
||||
distCenter = CFNotificationCenterGetDistributedCenter();
|
||||
if (NULL == distCenter)
|
||||
if (NULL == distCenter) {
|
||||
return;
|
||||
}
|
||||
|
||||
CFNotificationCenterAddObserver(
|
||||
distCenter,
|
||||
|
@ -9,11 +9,13 @@
|
||||
#include "ScreenLockListenerWin.h"
|
||||
#endif
|
||||
|
||||
ScreenLockListenerPrivate::ScreenLockListenerPrivate(QWidget* parent):
|
||||
QObject(parent){
|
||||
ScreenLockListenerPrivate::ScreenLockListenerPrivate(QWidget* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ScreenLockListenerPrivate* ScreenLockListenerPrivate::instance(QWidget* parent){
|
||||
ScreenLockListenerPrivate* ScreenLockListenerPrivate::instance(QWidget* parent)
|
||||
{
|
||||
#if defined(Q_OS_OSX)
|
||||
Q_UNUSED(parent);
|
||||
return ScreenLockListenerMac::instance();
|
||||
|
@ -8,9 +8,9 @@
|
||||
* See https://msdn.microsoft.com/en-us/library/aa383841(v=vs.85).aspx
|
||||
* See https://blogs.msdn.microsoft.com/oldnewthing/20060104-50/?p=32783
|
||||
*/
|
||||
ScreenLockListenerWin::ScreenLockListenerWin(QWidget *parent) :
|
||||
ScreenLockListenerPrivate(parent),
|
||||
QAbstractNativeEventFilter()
|
||||
ScreenLockListenerWin::ScreenLockListenerWin(QWidget *parent)
|
||||
: ScreenLockListenerPrivate(parent)
|
||||
, QAbstractNativeEventFilter()
|
||||
{
|
||||
Q_ASSERT(parent != NULL);
|
||||
// On windows, we need to register for platform specific messages and
|
||||
|
@ -123,6 +123,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="lockDatabaseOnScreenLockCheckBox">
|
||||
<property name="text">
|
||||
<string>Lock databases when session is locked or lid is closed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -142,13 +149,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="lockDatabaseOnScreenLockCheckBox">
|
||||
<property name="text">
|
||||
<string>Lock databases when session is locked or lid is closed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user