mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-02 03:26:14 -04:00
Add menu option to allow screenshots
* Fix #7580 * Also refactor the code to move everything into MainWindow
This commit is contained in:
parent
f9f82e9705
commit
0a2e716525
8 changed files with 48 additions and 28 deletions
18
src/main.cpp
18
src/main.cpp
|
@ -183,21 +183,9 @@ int main(int argc, char** argv)
|
|||
|
||||
MainWindow mainWindow;
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
// Disable screen capture if capable and not explicitly allowed
|
||||
if (osUtils->canPreventScreenCapture() && !parser.isSet(allowScreenCaptureOption)) {
|
||||
// This ensures any top-level windows (Main Window, Modal Dialogs, etc.) are excluded from screenshots
|
||||
QObject::connect(&app, &QGuiApplication::focusWindowChanged, &mainWindow, [&](QWindow* window) {
|
||||
if (window) {
|
||||
if (!osUtils->setPreventScreenCapture(window, true)) {
|
||||
mainWindow.displayGlobalMessage(
|
||||
QObject::tr("Warning: Failed to prevent screenshots on a top level window!"),
|
||||
MessageWidget::Error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
// Disable screen capture if not explicitly allowed
|
||||
// This ensures any top-level windows (Main Window, Modal Dialogs, etc.) are excluded from screenshots
|
||||
mainWindow.setAllowScreenCapture(parser.isSet(allowScreenCaptureOption));
|
||||
|
||||
const bool pwstdin = parser.isSet(pwstdinOption);
|
||||
if (!fileNames.isEmpty() && pwstdin) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue