Lock database on ScreenSaver/SessionLock#545
Conversation
|
This needs test on Unity, Gnome, OSX (@weslly) and Windows. I've tested on Xfce and works fine |
|
Edit: Actually it seems when you use the fast user switching menu you aren't locking your session, even though you still need to type the user password to come back, so it still will work in most cases (when the user closes the lid or puts the computer to sleep). |
src/core/ScreenLockListener.h
Outdated
| Q_OBJECT | ||
|
|
||
| public: | ||
| ScreenLockListener(QWidget* parent=NULL); |
There was a problem hiding this comment.
Shouldn't this NULL be nullptr instead?
(Same with other files)
|
Rather than a checkbox, I would consider allowing a delay (eg. waiting another couple of minutes) for db locking after screen lock. Maybe unneeded after #488, though. |
|
Hey! I just tried this on Gnome 3 (specifically 3.22.3-3 on Debian x64 Testing/Sid) with manual lock via menu and just closing the lid. Everything seems to work as expected. But I noticed that this patch adds two checkboxes:
The first one is in the weird place (outside of the tab widget) and isn't connected to anything. Probably is just an artifact of rebase. |
|
|
||
| void ScreenLockListenerDBus::gnomeSessionStatusChanged(uint status) | ||
| { | ||
| if (status != 0) { |
There was a problem hiding this comment.
@TheZ3ro ok so from what I can see from gnome's doc :
The status parameter must be one of the following:
0: Available
1: Invisible
2: Busy
3: Idle
Should we lock for all of the above statuses except for Available (Busy, for instance).
Also, We could extract 0 as a constant to make it more clear why we are ignoring this status : if (status != gnomeStatusAvailable)
There was a problem hiding this comment.
Mmmmh yes, I think I can do that
| } | ||
| } | ||
|
|
||
| void ScreenLockListenerDBus::logindPrepareForSleep(bool beforeSleep) |
There was a problem hiding this comment.
I think this is because org.freedesktop.login1 is the DBus service for logind daemon
src/gui/SettingsWidgetGeneral.ui
Outdated
| </widget> | ||
| </item> | ||
| <item row="15" column="0"> | ||
| <widget class="QCheckBox" name="autoCloseOnScreenLockCheckBox"> |
There was a problem hiding this comment.
This checkbox is appearing OUTSIDE the basic settings view. I think this should really be under the Security Settings anyway.
There was a problem hiding this comment.
Yup, I forgot to remove this after the cherry-pick as this was added by the previous (old) commit
src/gui/SettingsWidgetGeneral.ui
Outdated
| </widget> | ||
| </item> | ||
| <item row="15" column="0"> | ||
| <widget class="QCheckBox" name="autoCloseOnScreenLockCheckBox"> |
There was a problem hiding this comment.
This checkbox is appearing OUTSIDE the basic settings view. I think this should really be under the Security Settings anyway.
We already have an option to lock the database after a delay so this will be partially useless @sainaen Thanks for the test! |
src/core/ScreenLockListenerWin.cpp
Outdated
| * 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) |
src/core/ScreenLockListenerWin.cpp
Outdated
| HPOWERNOTIFY hPnotify = RegisterPowerSettingNotification( | ||
| reinterpret_cast<HWND>(parent->winId()), | ||
| &GUID_LIDSWITCH_STATE_CHANGE, DEVICE_NOTIFY_WINDOW_HANDLE); | ||
| m_powernotificationhandle = reinterpret_cast<void*>(hPnotify); |
src/core/ScreenLockListenerWin.cpp
Outdated
| bool ScreenLockListenerWin::nativeEventFilter(const QByteArray &eventType, void *message, long *) | ||
| { | ||
| if (eventType == "windows_generic_MSG" || eventType == "windows_dispatcher_MSG") { | ||
| MSG* m = static_cast<MSG *>(message); |
|
I tested the feature on Mac, it works great so far! I'll give it a try with Unity as soon as I can. |
|
@TheZ3ro tested with Unity, also working great! |
phoerious
left a comment
There was a problem hiding this comment.
Works on Arch with KDE. Just a few little style things need fixing.
| return m_ptr; | ||
| } | ||
|
|
||
| void ScreenLockListenerMac::notificationCenterCallBack(CFNotificationCenterRef, void*, |
There was a problem hiding this comment.
You should add parameter names, even though they are not used.
There was a problem hiding this comment.
Won't this brings up some unused warning? Should I use Q_UNUSED?
There was a problem hiding this comment.
The names are defined in the header file
There was a problem hiding this comment.
I know. It's just a style thing.
| #if defined(Q_OS_OSX) | ||
| #include "ScreenLockListenerMac.h" | ||
| #endif | ||
| #if defined(Q_OS_LINUX) |
src/core/ScreenLockListenerMac.cpp
Outdated
|
|
||
| void ScreenLockListenerMac::onSignalReception() | ||
| { | ||
| Q_EMIT screenLocked(); |
src/core/ScreenLockListenerDBus.h
Outdated
| public: | ||
| explicit ScreenLockListenerDBus(QWidget *parent = 0); | ||
|
|
||
| private Q_SLOTS: |
src/core/ScreenLockListener.h
Outdated
| ScreenLockListener(QWidget* parent = nullptr); | ||
| ~ScreenLockListener(); | ||
|
|
||
| Q_SIGNALS: |
src/core/ScreenLockListenerDBus.cpp
Outdated
| void ScreenLockListenerDBus::gnomeSessionStatusChanged(uint status) | ||
| { | ||
| if (status != 0) { | ||
| Q_EMIT screenLocked(); |
src/core/ScreenLockListenerPrivate.h
Outdated
| protected: | ||
| ScreenLockListenerPrivate(QWidget* parent = 0); | ||
|
|
||
| Q_SIGNALS: |
src/core/ScreenLockListenerWin.cpp
Outdated
| if (setting != nullptr && setting->PowerSetting == GUID_LIDSWITCH_STATE_CHANGE) { | ||
| const DWORD* state = reinterpret_cast<const DWORD*>(&setting->Data); | ||
| if (*state == 0) { | ||
| Q_EMIT screenLocked(); |
widget. Changed wording and preference variable name for conformity with existing settings.
16e695c to
b69b50c
Compare
|
Fixed and rebased @keepassxreboot/core-developers |
|
For the record, this PR introduces a dbus interface to KeePassXC. |
- Added YubiKey 2FA integration for unlocking databases [#127] - Added TOTP support [#519] - Added CSV import tool [#146, #490] - Added KeePassXC CLI tool [#254] - Added diceware password generator [#373] - Added support for entry references [#370, #378] - Added support for Twofish encryption [#167] - Enabled DEP and ASLR for in-memory protection [#371] - Enabled single instance mode [#510] - Enabled portable mode [#645] - Enabled database lock on screensaver and session lock [#545] - Redesigned welcome screen with common features and recent databases [#292] - Multiple updates to search behavior [#168, #213, #374, #471, #603, #654] - Added auto-type fields {CLEARFIELD}, {SPACE}, {{}, {}} [#267, #427, #480] - Fixed auto-type errors on Linux [#550] - Prompt user prior to executing a cmd:// URL [#235] - Entry attributes can be protected (hidden) [#220] - Added extended ascii to password generator [#538] - Added new database icon to toolbar [#289] - Added context menu entry to empty recycle bin in databases [#520] - Added "apply" button to entry and group edit windows [#624] - Added macOS tray icon and enabled minimize on close [#583] - Fixed issues with unclean shutdowns [#170, #580] - Changed keyboard shortcut to create new database to CTRL+SHIFT+N [#515] - Compare window title to entry URLs [#556] - Implemented inline error messages [#162] - Ignore group expansion and other minor changes when making database "dirty" [#464] - Updated license and copyright information on souce files [#632] - Added contributors list to about dialog [#629]
|
I asked myself “what is lid” and ended up here. |
|
Please open a new issue for this. |
|
This doesn't seem to work with i3lock on Manjaro. When unlocking the screen, the Database is still unlocked. |
|
@Bendodroid please open an issue with all the details, thank you. |
|
Same here as @Bendodroid - I'll create an issue soon. |

Description
This is a rebase of #135 by @rockdreamer
Motivation and Context
Implementation of issue #134
How Has This Been Tested?
I have tested on the following platforms:
Types of changes
This change brings in the following new dependencies:
Checklist:
-DWITH_ASAN=ON. [REQUIRED]