mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04: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}
|
${GCRYPT_LIBRARIES}
|
||||||
${GPGERROR_LIBRARIES}
|
${GPGERROR_LIBRARIES}
|
||||||
${ZLIB_LIBRARIES})
|
${ZLIB_LIBRARIES})
|
||||||
|
|
||||||
|
if(APPLE)
|
||||||
|
target_link_libraries(keepassx_core "-framework Foundation")
|
||||||
|
endif()
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
target_link_libraries(keepassx_core Qt5::DBus)
|
target_link_libraries(keepassx_core Qt5::DBus)
|
||||||
endif()
|
endif()
|
||||||
|
if(MINGW)
|
||||||
|
target_link_libraries(keepassx_core Wtsapi32.lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
include(GenerateProductVersion)
|
include(GenerateProductVersion)
|
||||||
|
@ -119,6 +119,7 @@ void Config::init(const QString& fileName)
|
|||||||
m_defaults.insert("security/lockdatabaseidle", false);
|
m_defaults.insert("security/lockdatabaseidle", false);
|
||||||
m_defaults.insert("security/lockdatabaseidlesec", 240);
|
m_defaults.insert("security/lockdatabaseidlesec", 240);
|
||||||
m_defaults.insert("security/lockdatabaseminimize", false);
|
m_defaults.insert("security/lockdatabaseminimize", false);
|
||||||
|
m_defaults.insert("security/lockdatabasescreenlock", true);
|
||||||
m_defaults.insert("security/passwordsrepeat", false);
|
m_defaults.insert("security/passwordsrepeat", false);
|
||||||
m_defaults.insert("security/passwordscleartext", false);
|
m_defaults.insert("security/passwordscleartext", false);
|
||||||
m_defaults.insert("security/autotypeask", true);
|
m_defaults.insert("security/autotypeask", true);
|
||||||
|
@ -9,6 +9,15 @@ ScreenLockListenerDBus::ScreenLockListenerDBus(QWidget *parent):
|
|||||||
{
|
{
|
||||||
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
QDBusConnection sessionBus = QDBusConnection::sessionBus();
|
||||||
QDBusConnection systemBus = QDBusConnection::systemBus();
|
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(
|
sessionBus.connect(
|
||||||
"org.gnome.SessionManager", // service
|
"org.gnome.SessionManager", // service
|
||||||
"/org/gnome/SessionManager/Presence", // path
|
"/org/gnome/SessionManager/Presence", // path
|
||||||
@ -52,3 +61,10 @@ void ScreenLockListenerDBus::unityLocked()
|
|||||||
{
|
{
|
||||||
Q_EMIT screenLocked();
|
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 gnomeSessionStatusChanged(uint status);
|
||||||
void logindPrepareForSleep(bool beforeSleep);
|
void logindPrepareForSleep(bool beforeSleep);
|
||||||
void unityLocked();
|
void unityLocked();
|
||||||
|
void freedesktopScreenSaver(bool status);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCREENLOCKLISTENERDBUS_H
|
#endif // SCREENLOCKLISTENERDBUS_H
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
ScreenLockListenerMac* ScreenLockListenerMac::instance(){
|
ScreenLockListenerMac* ScreenLockListenerMac::instance()
|
||||||
|
{
|
||||||
static QMutex mutex;
|
static QMutex mutex;
|
||||||
QMutexLocker lock(&mutex);
|
QMutexLocker lock(&mutex);
|
||||||
|
|
||||||
@ -15,17 +16,20 @@ ScreenLockListenerMac* ScreenLockListenerMac::instance(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenLockListenerMac::notificationCenterCallBack(CFNotificationCenterRef /*center*/, void */*observer*/,
|
void ScreenLockListenerMac::notificationCenterCallBack(CFNotificationCenterRef /*center*/, void */*observer*/,
|
||||||
CFNotificationName /*name*/, const void */*object*/, CFDictionaryRef /*userInfo*/){
|
CFNotificationName /*name*/, const void */*object*/, CFDictionaryRef /*userInfo*/)
|
||||||
|
{
|
||||||
instance()->onSignalReception();
|
instance()->onSignalReception();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenLockListenerMac::ScreenLockListenerMac(QWidget* parent):
|
ScreenLockListenerMac::ScreenLockListenerMac(QWidget* parent)
|
||||||
ScreenLockListenerPrivate(parent){
|
: ScreenLockListenerPrivate(parent)
|
||||||
|
{
|
||||||
CFNotificationCenterRef distCenter;
|
CFNotificationCenterRef distCenter;
|
||||||
CFStringRef screenIsLockedSignal = CFSTR("com.apple.screenIsLocked");
|
CFStringRef screenIsLockedSignal = CFSTR("com.apple.screenIsLocked");
|
||||||
distCenter = CFNotificationCenterGetDistributedCenter();
|
distCenter = CFNotificationCenterGetDistributedCenter();
|
||||||
if (NULL == distCenter)
|
if (NULL == distCenter) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CFNotificationCenterAddObserver(
|
CFNotificationCenterAddObserver(
|
||||||
distCenter,
|
distCenter,
|
||||||
|
@ -9,11 +9,13 @@
|
|||||||
#include "ScreenLockListenerWin.h"
|
#include "ScreenLockListenerWin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ScreenLockListenerPrivate::ScreenLockListenerPrivate(QWidget* parent):
|
ScreenLockListenerPrivate::ScreenLockListenerPrivate(QWidget* parent)
|
||||||
QObject(parent){
|
: QObject(parent)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenLockListenerPrivate* ScreenLockListenerPrivate::instance(QWidget* parent){
|
ScreenLockListenerPrivate* ScreenLockListenerPrivate::instance(QWidget* parent)
|
||||||
|
{
|
||||||
#if defined(Q_OS_OSX)
|
#if defined(Q_OS_OSX)
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
return ScreenLockListenerMac::instance();
|
return ScreenLockListenerMac::instance();
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
* See https://msdn.microsoft.com/en-us/library/aa383841(v=vs.85).aspx
|
* See https://msdn.microsoft.com/en-us/library/aa383841(v=vs.85).aspx
|
||||||
* See https://blogs.msdn.microsoft.com/oldnewthing/20060104-50/?p=32783
|
* See https://blogs.msdn.microsoft.com/oldnewthing/20060104-50/?p=32783
|
||||||
*/
|
*/
|
||||||
ScreenLockListenerWin::ScreenLockListenerWin(QWidget *parent) :
|
ScreenLockListenerWin::ScreenLockListenerWin(QWidget *parent)
|
||||||
ScreenLockListenerPrivate(parent),
|
: ScreenLockListenerPrivate(parent)
|
||||||
QAbstractNativeEventFilter()
|
, QAbstractNativeEventFilter()
|
||||||
{
|
{
|
||||||
Q_ASSERT(parent != NULL);
|
Q_ASSERT(parent != NULL);
|
||||||
// On windows, we need to register for platform specific messages and
|
// On windows, we need to register for platform specific messages and
|
||||||
|
@ -123,6 +123,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -142,13 +149,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
Loading…
Reference in New Issue
Block a user