607011 / Qt-SESAM

c't SESAM Password Manager (Qt version)
http://607011.github.io/Qt-SESAM/
GNU General Public License v3.0
77 stars 29 forks source link

Linux: duplicate "Quit" entry in system tray icon menu #44

Closed stefanb2 closed 8 years ago

stefanb2 commented 9 years ago

On my Fedora 22 box with KDE Plasma 5 the system tray icon menu looks like this

![Uploading QtSESAM-tray-menu-KDEPlasma.png…]()

As you can see there is a duplicate "Quit" entry at the end. This is not generated by Qt-SESAM, but automatically by the system (it's translation changes when I switch languages).

I'm not sure how to solve this. If this is the case for every Linux user, but not Windows user, then I would suggest to flag the generation of the "Quit" entry with #ifdef WIN32 in the code.

stefanb2 commented 9 years ago

The one generated by the system (the lower entry with icon) quits the program correctly. But it causes issue #45.

The one generated by QT-SESAM (the upper entry without icon) only closes the main window.

stefanb2 commented 9 years ago

As far as I can tell from the source code, the main menu entry File -> Exit and the system tray icon menu entry Quit are connected to the main window slot close(). I.e. they only close the main window, but do not exit the application.

The system generated entry on the system tray icon menu causes this dialog:

![Uploading QtSESAM-tray-menu-Exit-Dialog.png…]()

which I can't find in the source code. So I assume this is a "force application" dialog from the system.

IMHO a real "exit" is missing in the Qt-SESAM code

stefanb2 commented 9 years ago

ah damn... wrong button. This is NOT closed :-(

stefanb2 commented 9 years ago

OK, somehow the PNG uploads got lost. Trying again:

qtsesam-tray-menu-exit-dialog

qtsesam-tray-menu-kdeplasma

607011 commented 9 years ago

If close() is called on the MainWindow the main loop exits, thus ending the application. That's the theory and works on Windows in practice. Regarding the Qt docs this is the desired behavior of close() and should be the same on other platforms. Should

stefanb2 commented 9 years ago

I checked the documentation: your mainwindow code looks correct. Except maybe the QMainWindow::closeEvent() calls.

I even connected the exit with the closeAllWindows slot on qApp and it still doesn't work.

So my assumption is that the problem is in QApplication, not your main window code. I.e. the application doesn't exit when the last window is closed.

607011 commented 9 years ago

Regarding the extra "Quit" tray item: It doesn't appear on every Linux desktop. So it leads to nothing to #ifdef WIN32 the code section that inserts the "Quit" action :-(

607011 commented 8 years ago

Obviously some Linux desktops add a quit button by themselves. Won't do anything about it. Thus closing this issue.