diff --git a/qt/mainwin.cc b/qt/mainwin.cc index 8cf805f16..4c1edeea3 100644 --- a/qt/mainwin.cc +++ b/qt/mainwin.cc @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -285,6 +286,23 @@ TrMainWindow :: ~TrMainWindow( ) ***** ****/ +void +TrMainWindow :: closeEvent( QCloseEvent * event ) +{ + // if they're using a tray icon, close to the tray + // instead of exiting + if( !myPrefs.getBool( Prefs :: SHOW_TRAY_ICON ) ) + event->accept( ); + else { + toggleWindows( false ); + event->ignore( ); + } +} + +/**** +***** +****/ + void TrMainWindow :: onSessionSourceChanged( ) { diff --git a/qt/mainwin.h b/qt/mainwin.h index 40b6bcad3..66f4b3b58 100644 --- a/qt/mainwin.h +++ b/qt/mainwin.h @@ -50,6 +50,9 @@ class TrMainWindow: public QMainWindow { Q_OBJECT + private: + virtual void closeEvent( QCloseEvent * event ); + private: time_t myLastFullUpdateTime; QDialog * mySessionDialog;