Commit 2c1742ce authored by Mathias Soeken's avatar Mathias Soeken

Tray Icon for kruler. But it is configurable and hidden by default.

BUGS: 66110

svn path=/trunk/KDE/kdegraphics/kruler/; revision=913380
parent 28862ce2
TODO
* non-model preferences dialog, so that you can see the result when
you change the color
* show/hide tray icon (and close action) when configuring tray icon
* move tray icon to another page in configuration dialog
* move some actions to tray icon context menu
* close button (visible on hover) on the lineal
DONE
* Center scale
......
......@@ -24,16 +24,23 @@
<item row="0" column="1" >
<widget class="KColorButton" name="kcfg_BgColor" />
</item>
<item row="1" column="0" >
<item row="2" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Font:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<item row="2" column="1" >
<widget class="KFontRequester" name="kcfg_ScaleFont" />
</item>
<item row="3" column="1" >
<widget class="QCheckBox" name="kcfg_TrayIcon" >
<property name="text" >
<string>Show tray icon</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutfunction spacing="KDialog::spacingHint" margin="KDialog::marginHint" />
......@@ -52,7 +59,6 @@
<tabstops>
<tabstop>kcfg_BgColor</tabstop>
</tabstops>
<includes/>
<resources/>
<connections/>
</ui>
......@@ -35,6 +35,7 @@
#include <KMenu>
#include <KNotification>
#include <KStandardAction>
#include <KSystemTrayIcon>
#include <KToolInvocation>
#include <KWindowSystem>
#include <KApplication>
......@@ -198,6 +199,12 @@ KLineal::KLineal( QWidget *parent )
mMenu->addMenu( ( new KHelpMenu( this, KGlobal::mainComponent().aboutData(), true ) )->menu() );
mMenu->addSeparator();
if ( RulerSettings::self()->trayIcon() ) {
KAction *closeAction = KStandardAction::close( this, SLOT( slotClose() ), this );
mMenu->addAction( closeAction );
new QShortcut( closeAction->shortcut().primary(), this, SLOT( slotClose() ) );
}
KAction *quit = KStandardAction::quit( kapp, SLOT( quit() ), this );
mMenu->addAction( quit );
new QShortcut( quit->shortcut().primary(), this, SLOT(slotQuit() ) );
......@@ -205,12 +212,22 @@ KLineal::KLineal( QWidget *parent )
mLastClickPos = geometry().topLeft() + QPoint( width() / 2, height() / 2 );
setOrientation( mOrientation );
if ( RulerSettings::self()->trayIcon() ) {
KSystemTrayIcon *tray = new KSystemTrayIcon( KIcon( "kruler" ), this );
tray->show();
}
}
KLineal::~KLineal()
{
}
void KLineal::slotClose()
{
hide();
}
void KLineal::slotQuit()
{
kapp->quit();
......
......@@ -105,6 +105,7 @@ public slots:
void switchRelativeScale( bool checked );
void copyColor();
void saveSettings();
void slotClose();
void slotQuit();
};
#endif
......@@ -33,5 +33,9 @@
<label>Is the scale of the ruler relative (percentage)</label>
<default>false</default>
</entry>
<entry name="TrayIcon" type="Bool">
<label>Is a tray icon used</label>
<default>false</default>
</entry>
</group>
</kcfg>
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