Part of batch commit to enable true tasktray resize support for Trinity applications

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1124759 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 3ef2d4c713
commit 54887c51b1

@ -105,7 +105,7 @@ KNotesApp::KNotesApp()
KWin::setSystemTrayWindowFor( winId(), qt_xrootwin() ); KWin::setSystemTrayWindowFor( winId(), qt_xrootwin() );
QToolTip::add( this, i18n( "KNotes: Sticky notes for KDE" ) ); QToolTip::add( this, i18n( "KNotes: Sticky notes for KDE" ) );
setBackgroundMode( X11ParentRelative ); setBackgroundMode( X11ParentRelative );
setPixmap( KSystemTray::loadIcon( "knotes" ) ); setPixmap( KSystemTray::loadSizedIcon( "knotes", QWidget::width() ) );
// set the initial style // set the initial style
KNote::setStyle( KNotesGlobalConfig::style() ); KNote::setStyle( KNotesGlobalConfig::style() );
@ -210,6 +210,19 @@ KNotesApp::KNotesApp()
updateNoteActions(); 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() KNotesApp::~KNotesApp()
{ {
saveNotes(); saveNotes();

@ -102,6 +102,7 @@ public slots:
protected: protected:
void mousePressEvent( QMouseEvent* ); void mousePressEvent( QMouseEvent* );
void resizeEvent ( QResizeEvent * );
protected slots: protected slots:
void slotShowNote(); void slotShowNote();

@ -58,8 +58,8 @@ AlarmDockWindow::AlarmDockWindow( const char *name )
// Set up icons // Set up icons
KGlobal::iconLoader()->addAppDir( "korgac" ); KGlobal::iconLoader()->addAppDir( "korgac" );
mPixmapEnabled = loadIcon( "korgac" ); mPixmapEnabled = loadSizedIcon( "korgac", width() );
mPixmapDisabled = loadIcon( "korgac_disabled" ); mPixmapDisabled = loadSizedIcon( "korgac_disabled", width() );
setPixmap( alarmsEnabled ? mPixmapEnabled : mPixmapDisabled ); 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 ) void AlarmDockWindow::slotUpdate( int reminders )
{ {
QToolTip::remove( this ); QToolTip::remove( this );

@ -50,6 +50,7 @@ class AlarmDockWindow : public KSystemTray
protected: protected:
void mousePressEvent( QMouseEvent * ); void mousePressEvent( QMouseEvent * );
// void closeEvent( QCloseEvent * ); // void closeEvent( QCloseEvent * );
void resizeEvent ( QResizeEvent * );
protected slots: protected slots:
void slotQuit(); void slotQuit();

Loading…
Cancel
Save