1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

(trunk qt) #2321: in qt client in 1.73, When main window minimized click on tray icon does nothing

This commit is contained in:
Charles Kerr 2009-08-11 18:57:49 +00:00
parent cb79214854
commit 3cdaeef78f
2 changed files with 20 additions and 5 deletions

View file

@ -227,7 +227,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
myTrayIcon.setIcon( QApplication::windowIcon( ) ); myTrayIcon.setIcon( QApplication::windowIcon( ) );
connect( &myPrefs, SIGNAL(changed(int)), this, SLOT(refreshPref(int)) ); connect( &myPrefs, SIGNAL(changed(int)), this, SLOT(refreshPref(int)) );
connect( ui.action_ShowMainWindow, SIGNAL(toggled(bool)), this, SLOT(toggleWindows())); connect( ui.action_ShowMainWindow, SIGNAL(toggled(bool)), this, SLOT(toggleWindows(bool)));
connect( &myTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), connect( &myTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason))); this, SLOT(trayActivated(QSystemTrayIcon::ActivationReason)));
@ -883,17 +883,32 @@ TrMainWindow :: setStatusbarVisible( bool visible )
**/ **/
void void
TrMainWindow :: toggleWindows( ) TrMainWindow :: toggleWindows( bool doShow )
{ {
setVisible( !isVisible( ) ); if( !doShow )
{
hide( );
}
else
{
if ( !isVisible( ) ) show( );
if ( isMinimized( ) ) showNormal( );
activateWindow( );
raise( );
}
} }
void void
TrMainWindow :: trayActivated( QSystemTrayIcon::ActivationReason reason ) TrMainWindow :: trayActivated( QSystemTrayIcon::ActivationReason reason )
{ {
if( reason == QSystemTrayIcon::Trigger ) if( reason == QSystemTrayIcon::Trigger )
{
if( isMinimized ( ) )
toggleWindows( true );
else
ui.action_ShowMainWindow->toggle( ); ui.action_ShowMainWindow->toggle( );
} }
}
void void

View file

@ -118,7 +118,7 @@ class TrMainWindow: public QMainWindow
void toggleSpeedMode( ); void toggleSpeedMode( );
void dataReadProgress( ); void dataReadProgress( );
void dataSendProgress( ); void dataSendProgress( );
void toggleWindows( ); void toggleWindows( bool doShow );
void onSetPrefs( ); void onSetPrefs( );
void onSetPrefs( bool ); void onSetPrefs( bool );
void onSessionSourceChanged( ); void onSessionSourceChanged( );