diff options
author | Lubos Dolezel <lubos@dolezel.info> | 2015-06-05 13:30:30 +0200 |
---|---|---|
committer | Lubos Dolezel <lubos@dolezel.info> | 2015-06-05 13:30:30 +0200 |
commit | 5daafc03aefdb111919859167a93228995ff8366 (patch) | |
tree | 6ebbb0536f96fb4130293276d1141d06e59d7ae8 /src/gui/mphoneform.cpp | |
parent | 2fd87e218717ab8f198702c3ee438f6ac12e0038 (diff) | |
download | twinkle-5daafc03aefdb111919859167a93228995ff8366.tar twinkle-5daafc03aefdb111919859167a93228995ff8366.tar.gz twinkle-5daafc03aefdb111919859167a93228995ff8366.tar.lz twinkle-5daafc03aefdb111919859167a93228995ff8366.tar.xz twinkle-5daafc03aefdb111919859167a93228995ff8366.zip |
Correct system tray icon behavior (fixes #1)
Diffstat (limited to 'src/gui/mphoneform.cpp')
-rw-r--r-- | src/gui/mphoneform.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/mphoneform.cpp b/src/gui/mphoneform.cpp index 7726a41..96a3519 100644 --- a/src/gui/mphoneform.cpp +++ b/src/gui/mphoneform.cpp @@ -183,6 +183,9 @@ void MphoneForm::init() menu = new QMenu(this); sysTray->setContextMenu(menu); + + connect(sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), + this, SLOT(sysTrayIconClicked(QSystemTrayIcon::ActivationReason))); // Call menu menu->addAction(callInvite); @@ -363,7 +366,7 @@ void MphoneForm::closeEvent( QCloseEvent *e ) void MphoneForm::fileExit() { hide(); - QApplication::exit(0); + qApp->quit(); } // Append a string to the display window @@ -3186,3 +3189,14 @@ void MphoneForm::whatsThis() { QWhatsThis::enterWhatsThisMode(); } + +void MphoneForm::sysTrayIconClicked(QSystemTrayIcon::ActivationReason reason) +{ + if (reason == QSystemTrayIcon::Trigger || reason == QSystemTrayIcon::DoubleClick) + { + if (sys_config->get_gui_hide_on_close()) + setVisible(!isVisible()); + else + activateWindow(); + } +} |