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 14 years ago
parent 554e253b00
commit 525b89b11f

@ -50,14 +50,27 @@ void TrayWindow::contextMenuAboutToShow( KPopupMenu *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 )
{
m_updates = n;
kdDebug() << "TrayWindow obtained " << n << endl;
setPixmap( m_updates == 0 ?
loadIcon( u8( "adept_notifier_ok" ) ) :
loadIcon( u8( "adept_notifier_warning" ) ) );
loadSizedIcon( u8( "adept_notifier_ok" ), width() ) :
loadSizedIcon( u8( "adept_notifier_warning" ), width() ) );
if ( m_updates == 0 )
hide();
@ -83,11 +96,23 @@ void ApportTrayWindow::mousePressEvent(QMouseEvent *ev)
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)
{
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)
: KUniqueApplication(allowStyles, GUIenabled),
m_tray( 0 )
@ -141,10 +166,10 @@ NotifierApp::NotifierApp(bool allowStyles, bool GUIenabled)
*proc << "/usr/share/apport/apport-checkreports";
connect( proc, SIGNAL(processExited(KProcess*)), this, SLOT(apportCheckExited(KProcess*)) );
proc->start(KProcess::Block);
if (m_crashes) {
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 "
"system (now or in the past).\n"
"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) {
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.");
QToolTip::add(rebootApplet, rebootMessage);

@ -25,6 +25,7 @@ signals:
void aboutSelected();
protected:
void mouseReleaseEvent( QMouseEvent * );
void resizeEvent( QResizeEvent * );
int m_updates;
KAction *m_quit, *m_about;
};
@ -40,6 +41,7 @@ signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent*);
void resizeEvent(QResizeEvent *);
};
// used for the reboot notifier
@ -50,12 +52,13 @@ signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent*);
void resizeEvent(QResizeEvent *);
};
// application watching the current status
// it will update the icon and run
// it will update the icon and run
class NotifierApp : public KUniqueApplication
{
Q_OBJECT

Loading…
Cancel
Save