+! Don't allow interacting with the tray icon until the program loads fully.

This commit is contained in:
Konstantin Isakov 2009-10-09 21:03:55 +00:00
parent 356570b244
commit 9aefea2dc8

View file

@ -168,11 +168,15 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
connect( dictionaryBar.toggleViewAction(), SIGNAL(toggled(bool)), connect( dictionaryBar.toggleViewAction(), SIGNAL(toggled(bool)),
this, SLOT(dictionaryBarToggled(bool)) ); this, SLOT(dictionaryBarToggled(bool)) );
// Show tray icon early so the user would be happy // Show tray icon early so the user would be happy. It won't be functional
updateTrayIcon(); // though until the program inits fully.
if ( trayIcon ) if ( cfg.preferences.enableTrayIcon )
{
trayIcon = new QSystemTrayIcon( QIcon( ":/icons/programicon.png" ), this );
trayIcon->setToolTip( tr( "Loading..." ) ); trayIcon->setToolTip( tr( "Loading..." ) );
trayIcon->show();
}
connect( navBack, SIGNAL( activated() ), connect( navBack, SIGNAL( activated() ),
this, SLOT( backClicked() ) ); this, SLOT( backClicked() ) );
@ -270,6 +274,17 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
ui.translateLine->setFocus(); ui.translateLine->setFocus();
if ( trayIcon )
{
// Upgrade existing dummy tray icon into a full-functional one
trayIcon->setContextMenu( &trayIconMenu );
trayIcon->show();
connect( trayIcon, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ),
this, SLOT( trayIconActivated( QSystemTrayIcon::ActivationReason ) ) );
}
updateTrayIcon(); updateTrayIcon();
// Update zoomers // Update zoomers