Commit 5174ad92 authored by Laurent Montel's avatar Laurent Montel 😁

Create quit button when it's necessary

svn path=/trunk/KDE/kdegraphics/kruler/; revision=989368
parent 115c9582
......@@ -87,6 +87,7 @@ KLineal::KLineal( QWidget *parent )
mCloseButton( 0 ),
mTrayIcon( 0 )
{
firstCreate = true;
KWindowSystem::setType( winId(), NET::Override ); // or NET::Normal
KWindowSystem::setState( winId(), NET::KeepAbove );
......@@ -253,16 +254,22 @@ KLineal::~KLineal()
void KLineal::createSystemTray()
{
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( '&' ) );
connect( mCloseButton, SIGNAL( clicked() ), this, SLOT( slotClose() ) );
mTrayIcon = new KRulerSystemTray( KIcon( "kruler" ), this,mActionCollection );
mTrayIcon->setCategory(Experimental::KNotificationItem::ApplicationStatus);
if( firstCreate)
{
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( '&' ) );
connect( mCloseButton, SIGNAL( clicked() ), this, SLOT( slotClose() ) );
firstCreate = false;
}
if(!mTrayIcon) {
mTrayIcon = new KRulerSystemTray( KIcon( "kruler" ), this,mActionCollection );
mTrayIcon->setCategory(Experimental::KNotificationItem::ApplicationStatus);
}
}
......
......@@ -98,6 +98,7 @@ private:
QToolButton *mCloseButton;
KRulerSystemTray *mTrayIcon;
bool firstCreate;
public slots:
void setOrientation( int );
void setNorth();
......
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