Commit e2111bbe authored by Laurent Montel's avatar Laurent Montel 😁

Show/hide trayicon when we config it

svn path=/trunk/KDE/kdegraphics/kruler/; revision=935465
parent 02474384
......@@ -83,7 +83,8 @@ KLineal::KLineal( QWidget *parent )
mOffsetAction( 0 ),
mClicked( false ),
mActionCollection( 0 ),
mCloseButton( 0 )
mCloseButton( 0 ),
mTrayIcon( 0 )
{
KWindowSystem::setType( winId(), NET::Override ); // or NET::Normal
KWindowSystem::setState( winId(), NET::KeepAbove );
......@@ -231,7 +232,7 @@ KLineal::KLineal( QWidget *parent )
KAction *closeAction = KStandardAction::close( this, SLOT( slotClose() ), this );
mActionCollection->addAction( "close", closeAction );
mMenu->addAction( closeAction );
mCloseButton = new QToolButton( this );
mCloseButton->setIcon( closeAction->icon() );
mCloseButton->setToolTip( closeAction->text().remove( '&' ) );
......@@ -251,8 +252,8 @@ KLineal::KLineal( QWidget *parent )
setOrientation( mOrientation );
if ( RulerSettings::self()->trayIcon() ) {
KSystemTrayIcon *tray = new KSystemTrayIcon( KIcon( "kruler" ), this );
tray->show();
mTrayIcon = new KSystemTrayIcon( KIcon( "kruler" ), this );
mTrayIcon->show();
}
}
......@@ -631,6 +632,17 @@ void KLineal::slotPreferences()
repaint();
saveSettings();
delete dialog;
if ( RulerSettings::self()->trayIcon() ) {
if ( !mTrayIcon )
mTrayIcon = new KSystemTrayIcon( KIcon( "kruler" ), this );
mTrayIcon->show();
}
else {
if ( mTrayIcon ) {
mTrayIcon->hide();
}
}
}
void KLineal::switchRelativeScale( bool checked )
......
......@@ -27,6 +27,7 @@ class KAction;
class KActionCollection;
class KIcon;
class KMenu;
class KSystemTrayIcon;
class KLineal : public QWidget {
Q_OBJECT
......@@ -93,6 +94,7 @@ private:
int mOpacity;
QToolButton *mBtnRotateLeft, *mBtnRotateRight;
QToolButton *mCloseButton;
KSystemTrayIcon *mTrayIcon;
public slots:
void setOrientation( int );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment