Feature/lock db on session lock #134#135
Feature/lock db on session lock #134#135rockdreamer wants to merge 6 commits intokeepassxreboot:developfrom
Conversation
src/core/ScreenLockListenerDBus.cpp
Outdated
| this, //receiver | ||
| SLOT(unityLocked())); | ||
|
|
||
| /* Currently unable to get the current user session from login1.Manager |
There was a problem hiding this comment.
Are this comments useful or they can be removed?
There was a problem hiding this comment.
Hi TheZ3ro and Happy new year :)
I would remove the comment and add a separate issue.
In theory the login1.Manager interface should provide a common API for handling session status notifications, however I had issues making it work. when I passed the current pid to the getsession call, it wouldn't return a valid session url. Maybe it only works on consoles but it would be nice if it worked across desktop managers.
Once this issue is resolved, I would de-comment and add a signal listener on the returned session much like what is currently done for unity, gnome session etc.
|
I think it's appropriate moving the option under the Security configuration screen. All the configurations that interacts with the DB are placed there. The code seems good, I will test this in the next few days. |
widget. Changed wording and preference variable name for conformity with existing settings.
|
Tested on my Ubuntu/XFCE/LightDM. When I lock the screen KeePassXC doesn't lock. The only dbus signal emitted on locking is this: So I think we should add more DBus signal Under xUbuntu/XFCE: Under KDE it's something like: source Under Cinnamon something like: source I think we should cover them all (unfortunately) |
|
I did a little research and downloaded a couple of live systems to have look at what D-Bus signals are emitted on different distributions. I guess it would be enough to add That locks the database on my main KDE system and the same signal is also emitted in the Manjaro XFCE VM I tried. Looks like this is the freedesktop.org standard interface, unfortunately not implemented by all desktop environments.
I did not test org.freedesktop.login1.Manager because I couldn't get the live system in my VM to suspend and resume properly. Additionally, I think we should enable the option to lock the database when the screen is locked by default. You shouldn't accidentally leave your password database unlocked when you leave the PC. |
phoerious
left a comment
There was a problem hiding this comment.
I added what I summarized in the posting above as inline comments. Please have a look.
| m_secUi->lockDatabaseIdleCheckBox->setChecked(config()->get("security/lockdatabaseidle").toBool()); | ||
| m_secUi->lockDatabaseIdleSpinBox->setValue(config()->get("security/lockdatabaseidlesec").toInt()); | ||
| m_secUi->lockDatabaseMinimizeCheckBox->setChecked(config()->get("security/lockdatabaseminimize").toBool()); | ||
| m_secUi->lockDatabaseOnScreenLockCheckBox->setChecked(config()->get("security/lockdatabasescreenlock").toBool()); |
There was a problem hiding this comment.
Enable this option by default.
| HWND h= reinterpret_cast<HWND>(static_cast<QWidget*>(parent())->winId()); | ||
| WTSUnRegisterSessionNotification(h); | ||
|
|
||
| if(m_powernotificationhandle){ |
There was a problem hiding this comment.
Coding style, please add a space after if. Also applies to the following if conditions in this file. Also add spaces before opening braces.
| } | ||
| } | ||
| if(m->message == WM_WTSSESSION_CHANGE){ | ||
| if (m->wParam==WTS_CONSOLE_DISCONNECT){ |
There was a problem hiding this comment.
Again coding style, please add spaces around == operators and before opening braces.
| Q_EMIT screenLocked(); | ||
| return true; | ||
| } | ||
| if (m->wParam==WTS_SESSION_LOCK){ |
| private Q_SLOTS: | ||
| void gnomeSessionStatusChanged(uint status); | ||
| void logindPrepareForSleep(bool beforeSleep); | ||
| void unityLocked(); |
There was a problem hiding this comment.
Add
void freedesktopScreenSaver(bool status);
unityLocked() probably not needed.
| void ScreenLockListenerDBus::unityLocked() | ||
| { | ||
| Q_EMIT screenLocked(); | ||
| } |
There was a problem hiding this comment.
Add
void ScreenLockListenerDBus::freedesktopScreenSaver(bool status)
{
if (status)
Q_EMIT screenLocked();
}
| } | ||
| } | ||
|
|
||
| void ScreenLockListenerDBus::unityLocked() |
| this, //receiver | ||
| SLOT(logindPrepareForSleep(bool))); | ||
|
|
||
| sessionBus.connect( |
There was a problem hiding this comment.
com.canonical.Unity probably not needed.
| "StatusChanged", // signal name | ||
| this, //receiver | ||
| SLOT(gnomeSessionStatusChanged(uint))); | ||
|
|
There was a problem hiding this comment.
Add
sessionBus.connect(
"org.freedesktop.ScreenSaver", // service
"/org/freedesktop/ScreenSaver", // path
"org.freedesktop.ScreenSaver", // interface
"ActiveChanged", // signal name
this, //receiver
SLOT(freedesktopScreenSaver(bool)));
|
Ping @rockdreamer , this pr needs a fair bit of work. Are you still interested in contributing to it? |
|
I believe this PR has become overcome by #545. Recommend closing. |
Description
Motivation and Context
Implementation of issue #134
How Has This Been Tested?
I have tested on the following platforms:
Screenshots (if appropriate):
Types of changes
This change brings in the following new dependencies:
Checklist: