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/adept@1124765 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 15 years ago
parent 554e253b00
commit 525b89b11f

@ -50,14 +50,27 @@ void TrayWindow::contextMenuAboutToShow( KPopupMenu *r ) {
m_quit->plug( r ); m_quit->plug( r );
} }
void TrayWindow::resizeEvent ( QResizeEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
setPixmap( m_updates == 0 ?
loadSizedIcon( u8( "adept_notifier_ok" ), width() ) :
loadSizedIcon( u8( "adept_notifier_warning" ), width() ) );
if ( m_updates == 0 )
hide();
else
show();
}
void TrayWindow::setAvailableUpdates( int n ) void TrayWindow::setAvailableUpdates( int n )
{ {
m_updates = n; m_updates = n;
kdDebug() << "TrayWindow obtained " << n << endl; kdDebug() << "TrayWindow obtained " << n << endl;
setPixmap( m_updates == 0 ? setPixmap( m_updates == 0 ?
loadIcon( u8( "adept_notifier_ok" ) ) : loadSizedIcon( u8( "adept_notifier_ok" ), width() ) :
loadIcon( u8( "adept_notifier_warning" ) ) ); loadSizedIcon( u8( "adept_notifier_warning" ), width() ) );
if ( m_updates == 0 ) if ( m_updates == 0 )
hide(); hide();
@ -83,11 +96,23 @@ void ApportTrayWindow::mousePressEvent(QMouseEvent *ev)
hide(); hide();
} }
void ApportTrayWindow::resizeEvent ( QResizeEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
setPixmap( loadSizedIcon(u8("apport"), width()) );
}
void RebootTrayWindow::mousePressEvent(QMouseEvent *ev) void RebootTrayWindow::mousePressEvent(QMouseEvent *ev)
{ {
emit clicked(); emit clicked();
} }
void RebootTrayWindow::resizeEvent ( QResizeEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
setPixmap( loadSizedIcon(u8("reload"), width()) );
}
NotifierApp::NotifierApp(bool allowStyles, bool GUIenabled) NotifierApp::NotifierApp(bool allowStyles, bool GUIenabled)
: KUniqueApplication(allowStyles, GUIenabled), : KUniqueApplication(allowStyles, GUIenabled),
m_tray( 0 ) m_tray( 0 )
@ -144,7 +169,7 @@ NotifierApp::NotifierApp(bool allowStyles, bool GUIenabled)
if (m_crashes) { if (m_crashes) {
ApportTrayWindow* crashApplet = new ApportTrayWindow; ApportTrayWindow* crashApplet = new ApportTrayWindow;
crashApplet->setPixmap( crashApplet->loadIcon(u8("apport")) ); crashApplet->setPixmap( crashApplet->loadSizedIcon(u8("apport"), crashApplet->width()) );
QString crashMessage = i18n("An application has crashed on your " QString crashMessage = i18n("An application has crashed on your "
"system (now or in the past).\n" "system (now or in the past).\n"
"Click to " "Click to "
@ -204,7 +229,7 @@ void NotifierApp::rebootWatcher(const QString& path) {
if (path == QString("/var/lib/update-notifier/dpkg-run-stamp") && m_rebootRequired && !m_rebootShown) { if (path == QString("/var/lib/update-notifier/dpkg-run-stamp") && m_rebootRequired && !m_rebootShown) {
RebootTrayWindow* rebootApplet = new RebootTrayWindow; RebootTrayWindow* rebootApplet = new RebootTrayWindow;
rebootApplet->setPixmap( rebootApplet->loadIcon(u8("reload")) ); rebootApplet->setPixmap( rebootApplet->loadSizedIcon(u8("reload"), rebootApplet->width()) );
QString rebootMessage = i18n("In order to complete the update your system needs to be restarted."); QString rebootMessage = i18n("In order to complete the update your system needs to be restarted.");
QToolTip::add(rebootApplet, rebootMessage); QToolTip::add(rebootApplet, rebootMessage);

@ -25,6 +25,7 @@ signals:
void aboutSelected(); void aboutSelected();
protected: protected:
void mouseReleaseEvent( QMouseEvent * ); void mouseReleaseEvent( QMouseEvent * );
void resizeEvent( QResizeEvent * );
int m_updates; int m_updates;
KAction *m_quit, *m_about; KAction *m_quit, *m_about;
}; };
@ -40,6 +41,7 @@ signals:
void clicked(); void clicked();
protected: protected:
void mousePressEvent(QMouseEvent*); void mousePressEvent(QMouseEvent*);
void resizeEvent(QResizeEvent *);
}; };
// used for the reboot notifier // used for the reboot notifier
@ -50,6 +52,7 @@ signals:
void clicked(); void clicked();
protected: protected:
void mousePressEvent(QMouseEvent*); void mousePressEvent(QMouseEvent*);
void resizeEvent(QResizeEvent *);
}; };

Loading…
Cancel
Save