diff options
-rw-r--r-- | knotes/knotesapp.cpp | 15 | ||||
-rw-r--r-- | knotes/knotesapp.h | 1 | ||||
-rw-r--r-- | korganizer/korgac/alarmdockwindow.cpp | 15 | ||||
-rw-r--r-- | korganizer/korgac/alarmdockwindow.h | 1 |
4 files changed, 29 insertions, 3 deletions
diff --git a/knotes/knotesapp.cpp b/knotes/knotesapp.cpp index 80bf1f086..1a1bdde89 100644 --- a/knotes/knotesapp.cpp +++ b/knotes/knotesapp.cpp @@ -105,7 +105,7 @@ KNotesApp::KNotesApp() KWin::setSystemTrayWindowFor( winId(), qt_xrootwin() ); QToolTip::add( this, i18n( "KNotes: Sticky notes for KDE" ) ); setBackgroundMode( X11ParentRelative ); - setPixmap( KSystemTray::loadIcon( "knotes" ) ); + setPixmap( KSystemTray::loadSizedIcon( "knotes", QWidget::width() ) ); // set the initial style KNote::setStyle( KNotesGlobalConfig::style() ); @@ -210,6 +210,19 @@ KNotesApp::KNotesApp() updateNoteActions(); } +void KNotesApp::resizeEvent ( QResizeEvent * ) +{ + // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes + QPixmap origpixmap; + QPixmap scaledpixmap; + QImage newIcon; + origpixmap = KSystemTray::loadSizedIcon( "knotes", QWidget::width() ); + newIcon = origpixmap; + newIcon = newIcon.smoothScale(QWidget::width(), QWidget::height()); + scaledpixmap = newIcon; + setPixmap(scaledpixmap); +} + KNotesApp::~KNotesApp() { saveNotes(); diff --git a/knotes/knotesapp.h b/knotes/knotesapp.h index f0cf8551b..9cfa5ad31 100644 --- a/knotes/knotesapp.h +++ b/knotes/knotesapp.h @@ -102,6 +102,7 @@ public slots: protected: void mousePressEvent( QMouseEvent* ); + void resizeEvent ( QResizeEvent * ); protected slots: void slotShowNote(); diff --git a/korganizer/korgac/alarmdockwindow.cpp b/korganizer/korgac/alarmdockwindow.cpp index 5f2c419c7..074ee9206 100644 --- a/korganizer/korgac/alarmdockwindow.cpp +++ b/korganizer/korgac/alarmdockwindow.cpp @@ -58,8 +58,8 @@ AlarmDockWindow::AlarmDockWindow( const char *name ) // Set up icons KGlobal::iconLoader()->addAppDir( "korgac" ); - mPixmapEnabled = loadIcon( "korgac" ); - mPixmapDisabled = loadIcon( "korgac_disabled" ); + mPixmapEnabled = loadSizedIcon( "korgac", width() ); + mPixmapDisabled = loadSizedIcon( "korgac_disabled", width() ); setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled ); @@ -104,6 +104,17 @@ AlarmDockWindow::~AlarmDockWindow() { } +void AlarmDockWindow::resizeEvent ( QResizeEvent * ) +{ + // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes + mPixmapEnabled = loadSizedIcon( "korgac", width() ); + mPixmapDisabled = loadSizedIcon( "korgac_disabled", width() ); + + KConfig *config = kapp->config(); + bool alarmsEnabled = config->readBoolEntry( "Enabled", true ); + setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled ); +} + void AlarmDockWindow::slotUpdate( int reminders ) { QToolTip::remove( this ); diff --git a/korganizer/korgac/alarmdockwindow.h b/korganizer/korgac/alarmdockwindow.h index 5671b92f7..f26b6d8c1 100644 --- a/korganizer/korgac/alarmdockwindow.h +++ b/korganizer/korgac/alarmdockwindow.h @@ -50,6 +50,7 @@ class AlarmDockWindow : public KSystemTray protected: void mousePressEvent( QMouseEvent * ); // void closeEvent( QCloseEvent * ); + void resizeEvent ( QResizeEvent * ); protected slots: void slotQuit(); |