summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kcontrol/icons/icons.cpp44
-rw-r--r--kcontrol/icons/icons.h5
-rw-r--r--kcontrol/randr/krandrtray.cpp15
-rw-r--r--kcontrol/randr/krandrtray.h1
-rw-r--r--kicker/applets/systemtray/systemtrayapplet.cpp38
-rw-r--r--kicker/applets/systemtray/systemtrayapplet.h2
-rw-r--r--klipper/toplevel.cpp18
-rw-r--r--klipper/toplevel.h3
8 files changed, 92 insertions, 34 deletions
diff --git a/kcontrol/icons/icons.cpp b/kcontrol/icons/icons.cpp
index 37bc31210..4ce1e4d98 100644
--- a/kcontrol/icons/icons.cpp
+++ b/kcontrol/icons/icons.cpp
@@ -62,12 +62,12 @@ KIconConfig::KIconConfig(QWidget *parent, const char *name)
QPushButton *push;
- push = addPreviewIcon(0, i18n("Default"), this, g_lay);
- connect(push, SIGNAL(clicked()), SLOT(slotEffectSetup0()));
- push = addPreviewIcon(1, i18n("Active"), this, g_lay);
- connect(push, SIGNAL(clicked()), SLOT(slotEffectSetup1()));
- push = addPreviewIcon(2, i18n("Disabled"), this, g_lay);
- connect(push, SIGNAL(clicked()), SLOT(slotEffectSetup2()));
+ mPreviewButton1 = addPreviewIcon(0, i18n("Default"), this, g_lay);
+ connect(mPreviewButton1, SIGNAL(clicked()), SLOT(slotEffectSetup0()));
+ mPreviewButton2 = addPreviewIcon(1, i18n("Active"), this, g_lay);
+ connect(mPreviewButton2, SIGNAL(clicked()), SLOT(slotEffectSetup1()));
+ mPreviewButton3 = addPreviewIcon(2, i18n("Disabled"), this, g_lay);
+ connect(mPreviewButton3, SIGNAL(clicked()), SLOT(slotEffectSetup2()));
m_pTab1 = new QWidget(this, "General Tab");
top->addWidget(m_pTab1, 0, 1);
@@ -278,12 +278,6 @@ void KIconConfig::read()
mpKickerConfig->setGroup("General");
mQuickLaunchSize = mpKickerConfig->readNumEntry("panelIconWidth", KIcon::SizeLarge);
-
- // FIXME
- // Due to issues with the system tray handling code, mpSysTraySizeBox should be be disabled
- // This should be fixed ASAP
- // Specifically, kicker does not automatically reconfigure the system tray icon sizes on its configure() DCOP call
- //mpSysTraySizeBox->setEnabled(false);
}
void KIconConfig::apply()
@@ -455,6 +449,11 @@ void KIconConfig::save()
}
}
+ // Reload kicker/systray configuration files; we have no way of knowing if any other parameters changed
+ // from initial read to this write request
+ mpSystrayConfig->reparseConfiguration();
+ mpKickerConfig->reparseConfiguration();
+
mpSystrayConfig->setGroup("System Tray");
mpSystrayConfig->writeEntry("systrayIconWidth", mSysTraySize);
mpKickerConfig->setGroup("General");
@@ -478,6 +477,9 @@ void KIconConfig::save()
// Signal kicker to reload icon configuration
kapp->dcopClient()->send("kicker", "kicker", "configure()", QByteArray());
+
+ // Signal system tray to reload icon configuration
+ kapp->dcopClient()->send("kicker", "SystemTrayApplet", "iconSizeChanged()", QByteArray());
}
void KIconConfig::defaults()
@@ -496,27 +498,35 @@ void KIconConfig::slotUsage(int index)
mpSizeBox->setEnabled(true);
mpDPCheck->setEnabled(false);
mpAnimatedCheck->setEnabled(false);
+ mPreviewButton1->setEnabled(false);
+ mPreviewButton2->setEnabled(false);
+ mPreviewButton3->setEnabled(false);
}
else if (mpUsageList->text(index) == i18n("System Tray Icons")) {
- // FIXME
- // Due to issues with the system tray handling code, mpSysTraySizeBox should be be disabled
- // This should be fixed ASAP
- // Specifically, kicker does not automatically reconfigure the system tray icon sizes on its configure() DCOP call
- mpSizeBox->setEnabled(false);
+ mpSizeBox->setEnabled(true);
mpDPCheck->setEnabled(false);
mpAnimatedCheck->setEnabled(false);
+ mPreviewButton1->setEnabled(false);
+ mPreviewButton2->setEnabled(false);
+ mPreviewButton3->setEnabled(false);
}
else if ( mUsage == KIcon::Panel || mUsage == KIcon::LastGroup )
{
mpSizeBox->setEnabled(false);
mpDPCheck->setEnabled(false);
mpAnimatedCheck->setEnabled( mUsage == KIcon::Panel );
+ mPreviewButton1->setEnabled(true);
+ mPreviewButton2->setEnabled(true);
+ mPreviewButton3->setEnabled(true);
}
else
{
mpSizeBox->setEnabled(true);
mpDPCheck->setEnabled(true);
mpAnimatedCheck->setEnabled( mUsage == KIcon::Desktop );
+ mPreviewButton1->setEnabled(true);
+ mPreviewButton2->setEnabled(true);
+ mPreviewButton3->setEnabled(true);
}
apply();
diff --git a/kcontrol/icons/icons.h b/kcontrol/icons/icons.h
index 7e29e377a..6fa27eee3 100644
--- a/kcontrol/icons/icons.h
+++ b/kcontrol/icons/icons.h
@@ -115,6 +115,7 @@ private:
QCheckBox *mpDPCheck, *wordWrapCB, *underlineCB, *mpAnimatedCheck;
QTabWidget *m_pTabWidget;
QWidget *m_pTab1;
+ QPushButton *mPreviewButton1, *mPreviewButton2, *mPreviewButton3;
};
class KIconEffectSetupDialog: public KDialogBase
@@ -152,6 +153,6 @@ private:
QImage mExample;
QGroupBox *mpEffectGroup;
QLabel *mpPreview, *mpEffectLabel, *mpEffectColor, *mpEffectColor2;
-};
-
+};
+
#endif
diff --git a/kcontrol/randr/krandrtray.cpp b/kcontrol/randr/krandrtray.cpp
index adfe48e5f..8b230ba74 100644
--- a/kcontrol/randr/krandrtray.cpp
+++ b/kcontrol/randr/krandrtray.cpp
@@ -51,7 +51,7 @@ KRandRSystemTray::KRandRSystemTray(QWidget* parent, const char *name)
, m_popupUp(false)
, m_help(new KHelpMenu(this, KGlobal::instance()->aboutData(), false, actionCollection()))
{
- setPixmap(KSystemTray::loadIcon("randr"));
+ setPixmap(KSystemTray::loadSizedIcon("randr", width()));
setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
connect(this, SIGNAL(quitSelected()), kapp, SLOT(quit()));
QToolTip::add(this, i18n("Screen resize & rotate"));
@@ -88,6 +88,19 @@ KRandRSystemTray::KRandRSystemTray(QWidget* parent, const char *name)
}
}
+void KRandRSystemTray::resizeEvent ( QResizeEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ QPixmap origpixmap;
+ QPixmap scaledpixmap;
+ QImage newIcon;
+ origpixmap = KSystemTray::loadSizedIcon( "randr", width() );
+ newIcon = origpixmap;
+ newIcon = newIcon.smoothScale(width(), height());
+ scaledpixmap = newIcon;
+ setPixmap(scaledpixmap);
+}
+
void KRandRSystemTray::mousePressEvent(QMouseEvent* e)
{
// Popup the context menu with left-click
diff --git a/kcontrol/randr/krandrtray.h b/kcontrol/randr/krandrtray.h
index d34c85071..145fb89b0 100644
--- a/kcontrol/randr/krandrtray.h
+++ b/kcontrol/randr/krandrtray.h
@@ -59,6 +59,7 @@ protected slots:
protected:
void mousePressEvent( QMouseEvent *e );
+ void resizeEvent ( QResizeEvent * );
private:
void populateMenu(KPopupMenu* menu);
diff --git a/kicker/applets/systemtray/systemtrayapplet.cpp b/kicker/applets/systemtray/systemtrayapplet.cpp
index 8ae502fb4..1d9e40747 100644
--- a/kicker/applets/systemtray/systemtrayapplet.cpp
+++ b/kicker/applets/systemtray/systemtrayapplet.cpp
@@ -5,6 +5,7 @@ Copyright (c) 2000-2001 Matthias Ettrich <ettrich@kde.org>
2001 Carsten Pfeiffer <pfeiffer@kde.org>
2001 Martijn Klingens <mklingens@yahoo.com>
2004 Aaron J. Seigo <aseigo@kde.org>
+ 2010 Timothy Pearson <kb9vqf@pearsoncomputing.net>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -79,6 +80,7 @@ SystemTrayApplet::SystemTrayApplet(const QString& configFile, Type type, int act
m_iconSize(24),
m_layout(0)
{
+ DCOPObject::setObjId("SystemTrayApplet");
loadSettings();
setBackgroundOrigin(AncestorOrigin);
@@ -399,6 +401,24 @@ void SystemTrayApplet::orientationChange( Orientation /*orientation*/ )
refreshExpandButton();
}
+void SystemTrayApplet::iconSizeChanged() {
+ loadSettings();
+ updateVisibleWins();
+ layoutTray();
+
+ TrayEmbedList::iterator emb = m_shownWins.begin();
+ while (emb != m_shownWins.end()) {
+ (*emb)->setFixedSize(m_iconSize, m_iconSize);
+ ++emb;
+ }
+
+ emb = m_hiddenWins.begin();
+ while (emb != m_hiddenWins.end()) {
+ (*emb)->setFixedSize(m_iconSize, m_iconSize);
+ ++emb;
+ }
+}
+
void SystemTrayApplet::loadSettings()
{
// set our defaults
@@ -406,6 +426,7 @@ void SystemTrayApplet::loadSettings()
m_showFrame = false;
KConfig *conf = config();
+ conf->reparseConfiguration();
conf->setGroup("General");
if (conf->readBoolEntry("ShowPanelFrame", false))
@@ -517,7 +538,6 @@ void SystemTrayApplet::updateVisibleWins()
{
for (; emb != lastEmb; ++emb)
{
- //(*emb)->hide();
(*emb)->setBackground();
(*emb)->show();
}
@@ -841,7 +861,7 @@ void SystemTrayApplet::layoutTray()
// to avoid nbrOfLines=0 we ensure heightWidth >= iconWidth!
heightWidth = heightWidth < iconWidth ? iconWidth : heightWidth;
nbrOfLines = heightWidth / iconWidth;
-
+
if (showExpandButton)
{
m_layout->addMultiCellWidget(m_expandButton,
@@ -858,9 +878,8 @@ void SystemTrayApplet::layoutTray()
emb != lastEmb; ++emb)
{
line = i % nbrOfLines;
- //(*emb)->hide();
(*emb)->show();
- m_layout->addWidget(*emb, col, line,
+ m_layout->addWidget((*emb), col, line,
Qt::AlignHCenter | Qt::AlignVCenter);
if ((line + 1) == nbrOfLines)
@@ -877,9 +896,8 @@ void SystemTrayApplet::layoutTray()
emb != lastEmb; ++emb)
{
line = i % nbrOfLines;
- //(*emb)->hide();
(*emb)->show();
- m_layout->addWidget(*emb, col, line,
+ m_layout->addWidget((*emb), col, line,
Qt::AlignHCenter | Qt::AlignVCenter);
if ((line + 1) == nbrOfLines)
@@ -912,9 +930,8 @@ void SystemTrayApplet::layoutTray()
for (TrayEmbedList::const_iterator emb = m_hiddenWins.begin(); emb != lastEmb; ++emb)
{
line = i % nbrOfLines;
- //(*emb)->hide();
(*emb)->show();
- m_layout->addWidget(*emb, line, col,
+ m_layout->addWidget((*emb), line, col,
Qt::AlignHCenter | Qt::AlignVCenter);
if ((line + 1) == nbrOfLines)
@@ -931,9 +948,8 @@ void SystemTrayApplet::layoutTray()
emb != lastEmb; ++emb)
{
line = i % nbrOfLines;
- //(*emb)->hide();
(*emb)->show();
- m_layout->addWidget(*emb, line, col,
+ m_layout->addWidget((*emb), line, col,
Qt::AlignHCenter | Qt::AlignVCenter);
if ((line + 1) == nbrOfLines)
@@ -973,6 +989,8 @@ TrayEmbed::TrayEmbed( bool kdeTray, QWidget* parent )
: QXEmbed( parent ), kde_tray( kdeTray )
{
hide();
+ m_scaledWidget = new QWidget(parent);
+ m_scaledWidget->hide();
}
void TrayEmbed::getIconSize(int defaultIconSize)
diff --git a/kicker/applets/systemtray/systemtrayapplet.h b/kicker/applets/systemtray/systemtrayapplet.h
index 7afc18bf9..848be90f0 100644
--- a/kicker/applets/systemtray/systemtrayapplet.h
+++ b/kicker/applets/systemtray/systemtrayapplet.h
@@ -63,6 +63,7 @@ public:
k_dcop:
void loadSettings();
+ void iconSizeChanged();
protected:
void resizeEvent(QResizeEvent*);
@@ -121,6 +122,7 @@ public:
void getIconSize(int defaultIconSize);
private:
bool kde_tray;
+ QWidget *m_scaledWidget;
};
#endif
diff --git a/klipper/toplevel.cpp b/klipper/toplevel.cpp
index cc5de3f63..748d4a78f 100644
--- a/klipper/toplevel.cpp
+++ b/klipper/toplevel.cpp
@@ -196,7 +196,9 @@ KlipperWidget::KlipperWidget( QWidget *parent, KConfig* config )
connect( poll, SIGNAL( clipboardChanged( bool ) ),
this, SLOT( newClipData( bool ) ) );
- m_pixmap = KSystemTray::loadIcon( "klipper" );
+ m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
+ m_iconOrigWidth = width();
+ m_iconOrigHeight = height();
adjustSize();
globalKeys = new KGlobalAccel(this);
@@ -290,11 +292,19 @@ void KlipperWidget::mousePressEvent(QMouseEvent *e)
void KlipperWidget::paintEvent(QPaintEvent *)
{
QPainter p(this);
- int x = (width() - m_pixmap.width()) / 2;
- int y = (height() - m_pixmap.height()) / 2;
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ if ((m_iconOrigWidth != width()) || (m_iconOrigHeight != height())) {
+ QImage newIcon;
+ m_pixmap = KSystemTray::loadSizedIcon( "klipper", width() );
+ newIcon = m_pixmap;
+ newIcon = newIcon.smoothScale(width(), height());
+ m_scaledpixmap = newIcon;
+ }
+ int x = (width() - m_scaledpixmap.width()) / 2;
+ int y = (height() - m_scaledpixmap.height()) / 2;
if ( x < 0 ) x = 0;
if ( y < 0 ) y = 0;
- p.drawPixmap(x , y, m_pixmap);
+ p.drawPixmap(x, y, m_scaledpixmap);
p.end();
}
diff --git a/klipper/toplevel.h b/klipper/toplevel.h
index 735698487..20a6a3027 100644
--- a/klipper/toplevel.h
+++ b/klipper/toplevel.h
@@ -173,6 +173,9 @@ private:
KAction* configureAction;
KAction* quitAction;
QPixmap m_pixmap;
+ QPixmap m_scaledpixmap;
+ int m_iconOrigWidth;
+ int m_iconOrigHeight;
bool bPopupAtMouse :1;
bool bKeepContents :1;
bool bURLGrabber :1;