summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:02:44 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:02:44 +0000
commit301036d85a5e6404941e296263c6faaa47eb18b1 (patch)
tree69bddadf5eaab03a1638fefd027503d05274bb37
parent5c528607a9fc462f07fd1b3142b18a66e9abc2b2 (diff)
downloadknemo-301036d85a5e6404941e296263c6faaa47eb18b1.tar.gz
knemo-301036d85a5e6404941e296263c6faaa47eb18b1.zip
Part of batch commit to enable true tasktray resize support for Trinity applications
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knemo@1124764 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--src/knemod/interfaceicon.cpp17
-rw-r--r--src/knemod/interfaceicon.h5
-rw-r--r--src/knemod/interfacetray.cpp6
-rw-r--r--src/knemod/interfacetray.h2
4 files changed, 25 insertions, 5 deletions
diff --git a/src/knemod/interfaceicon.cpp b/src/knemod/interfaceicon.cpp
index 4bda3df..f57626a 100644
--- a/src/knemod/interfaceicon.cpp
+++ b/src/knemod/interfaceicon.cpp
@@ -88,24 +88,24 @@ void InterfaceIcon::updateStatus( int status )
if ( status == Interface::NOT_AVAILABLE ||
status == Interface::NOT_EXISTING )
{
- mTray->setPixmap( mTray->loadIcon( ICON_DISCONNECTED + suffix ) );
+ mTray->setPixmap( mTray->loadSizedIcon( ICON_DISCONNECTED + suffix, mTray->width() ) );
}
else if ( ( status & Interface::RX_TRAFFIC ) &&
( status & Interface::TX_TRAFFIC ) )
{
- mTray->setPixmap( mTray->loadIcon( ICON_TRAFFIC + suffix ) );
+ mTray->setPixmap( mTray->loadSizedIcon( ICON_TRAFFIC + suffix, mTray->width() ) );
}
else if ( status & Interface::RX_TRAFFIC )
{
- mTray->setPixmap( mTray->loadIcon( ICON_INCOMING + suffix ) );
+ mTray->setPixmap( mTray->loadSizedIcon( ICON_INCOMING + suffix, mTray->width() ) );
}
else if ( status & Interface::TX_TRAFFIC )
{
- mTray->setPixmap( mTray->loadIcon( ICON_OUTGOING + suffix ) );
+ mTray->setPixmap( mTray->loadSizedIcon( ICON_OUTGOING + suffix, mTray->width() ) );
}
else
{
- mTray->setPixmap( mTray->loadIcon( ICON_CONNECTED + suffix ) );
+ mTray->setPixmap( mTray->loadSizedIcon( ICON_CONNECTED + suffix, mTray->width() ) );
}
}
@@ -150,6 +150,11 @@ void InterfaceIcon::updateMenu()
}
}
+void InterfaceIcon::resizeIcon()
+{
+ updateTrayStatus(0);
+}
+
void InterfaceIcon::updateTrayStatus( int previousState )
{
bool interfaceExists = mInterface->getData().existing;
@@ -236,6 +241,8 @@ void InterfaceIcon::updateTrayStatus( int previousState )
mInterface, SLOT( showSignalPlotter( bool ) ) );
connect( mTray, SIGNAL( configSelected() ),
this, SLOT( showConfigDialog() ) );
+ connect( mTray, SIGNAL( iconResized() ),
+ this, SLOT( resizeIcon() ) );
updateStatus( mInterface->getState() );
updateToolTip();
diff --git a/src/knemod/interfaceicon.h b/src/knemod/interfaceicon.h
index 96d320b..6c962ec 100644
--- a/src/knemod/interfaceicon.h
+++ b/src/knemod/interfaceicon.h
@@ -74,6 +74,11 @@ public slots:
*/
void updateTrayStatus( int previousState );
+ /*
+ * Resizes the tray icon
+ */
+ void resizeIcon();
+
private slots:
/*
* Called when the user selects 'Configure KNemo' from the context menu
diff --git a/src/knemod/interfacetray.cpp b/src/knemod/interfacetray.cpp
index 5e2e154..c8ab03a 100644
--- a/src/knemod/interfacetray.cpp
+++ b/src/knemod/interfacetray.cpp
@@ -65,6 +65,12 @@ InterfaceTray::~InterfaceTray()
{
}
+void InterfaceTray::resizeEvent ( QResizeEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ emit iconResized();
+}
+
void InterfaceTray::mousePressEvent( QMouseEvent* e )
{
if ( !rect().contains( e->pos() ) )
diff --git a/src/knemod/interfacetray.h b/src/knemod/interfacetray.h
index b783c45..61b442b 100644
--- a/src/knemod/interfacetray.h
+++ b/src/knemod/interfacetray.h
@@ -54,9 +54,11 @@ signals:
void configSelected();
void startCommandSelected();
void stopCommandSelected();
+ void iconResized();
protected:
void mousePressEvent( QMouseEvent* e );
+ void resizeEvent ( QResizeEvent * );
protected slots:
/**