summaryrefslogtreecommitdiffstats
path: root/kicker/applets/systemtray
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-05 07:19:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-08-05 07:19:55 +0000
commitcec8fe0157b0ab37d4919d0f04c131c11f2c9a9e (patch)
tree7063e9fe9a4205b926c181924c226bcf1112d51e /kicker/applets/systemtray
parent80035308b1907d75e7e09be7c8f6e14098edd533 (diff)
downloadtdebase-cec8fe0157b0ab37d4919d0f04c131c11f2c9a9e.tar.gz
tdebase-cec8fe0157b0ab37d4919d0f04c131c11f2c9a9e.zip
Fix up a few Deep Buttons glitches
Add an option to include the clock in the system tray applet Majorly enhance the Quick Launch Kicker applet git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1245129 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker/applets/systemtray')
-rw-r--r--kicker/applets/systemtray/CMakeLists.txt7
-rw-r--r--kicker/applets/systemtray/systemtrayapplet.cpp63
-rw-r--r--kicker/applets/systemtray/systemtrayapplet.h7
3 files changed, 71 insertions, 6 deletions
diff --git a/kicker/applets/systemtray/CMakeLists.txt b/kicker/applets/systemtray/CMakeLists.txt
index cd3fd6348..76151db69 100644
--- a/kicker/applets/systemtray/CMakeLists.txt
+++ b/kicker/applets/systemtray/CMakeLists.txt
@@ -15,10 +15,13 @@ include_directories(
${CMAKE_SOURCE_DIR}/kicker/libkicker
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
+ ${CMAKE_BINARY_DIR}/kicker/applets/clock
+ ${CMAKE_SOURCE_DIR}/kicker/applets/clock
)
link_directories(
${TQT_LIBRARY_DIRS}
+ ${CMAKE_BINARY_DIR}/kicker/applets/clock
)
@@ -37,7 +40,7 @@ set( ${target}_SRCS
tde_add_kpart( ${target} AUTOMOC
SOURCES ${${target}_SRCS}
- LINK kickermain-shared
+ LINK kickermain-shared clock_panelapplet-static
DESTINATION ${PLUGIN_INSTALL_DIR}
- DEPENDENCIES kicker_core-static kicker-static kicker-shared
+ DEPENDENCIES kicker_core-static kicker-static kicker-shared clock_panelapplet-shared
)
diff --git a/kicker/applets/systemtray/systemtrayapplet.cpp b/kicker/applets/systemtray/systemtrayapplet.cpp
index ceeebc381..6a693fbe8 100644
--- a/kicker/applets/systemtray/systemtrayapplet.cpp
+++ b/kicker/applets/systemtray/systemtrayapplet.cpp
@@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tqpixmap.h>
#include <tqevent.h>
#include <tqstyle.h>
+#include <tqgrid.h>
#include <tqpainter.h>
#include <dcopclient.h>
@@ -56,7 +57,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xlib.h>
-//#define ICON_MARGIN KickerSettings::showDeepButtons()?2:1
#define ICON_MARGIN 1
#define ICON_END_MARGIN KickerSettings::showDeepButtons()?4:0
@@ -78,11 +78,14 @@ SystemTrayApplet::SystemTrayApplet(const TQString& configFile, Type type, int ac
m_expandButton(0),
m_leftSpacer(0),
m_rightSpacer(0),
+ m_clockApplet(0),
m_settingsDialog(0),
m_iconSelector(0),
m_autoRetractTimer(0),
m_autoRetract(false),
m_iconSize(24),
+ m_showClockInTray(false),
+ m_showClockSettingCB(0),
m_layout(0)
{
DCOPObject::setObjId("SystemTrayApplet");
@@ -93,6 +96,10 @@ SystemTrayApplet::SystemTrayApplet(const TQString& configFile, Type type, int ac
m_rightSpacer = new TQWidget(this);
m_rightSpacer->setFixedSize(ICON_END_MARGIN,1);
+ m_clockApplet = new ClockApplet(configFile, KPanelApplet::Normal, KPanelApplet::Preferences, this, "clockapplet");
+ updateClockGeometry();
+ connect(m_clockApplet, TQT_SIGNAL(clockReconfigured()), this, TQT_SLOT(updateClockGeometry()));
+
setBackgroundOrigin(AncestorOrigin);
kwin_module = new KWinModule(TQT_TQOBJECT(this));
@@ -105,6 +112,12 @@ SystemTrayApplet::SystemTrayApplet(const TQString& configFile, Type type, int ac
TQTimer::singleShot(0, this, TQT_SLOT(initialize()));
}
+void SystemTrayApplet::updateClockGeometry()
+{
+ if (m_clockApplet)
+ m_clockApplet->setFixedSize(m_clockApplet->widthForHeight(height()-2),height()-2);
+}
+
void SystemTrayApplet::initialize()
{
// register existing tray windows
@@ -185,6 +198,9 @@ SystemTrayApplet::~SystemTrayApplet()
delete *it;
}
+ if (m_leftSpacer) delete m_leftSpacer;
+ if (m_rightSpacer) delete m_rightSpacer;
+
KGlobal::locale()->removeCatalogue("ksystemtrayapplet");
}
@@ -225,10 +241,16 @@ void SystemTrayApplet::preferences()
connect(m_settingsDialog, TQT_SIGNAL(okClicked()), this, TQT_SLOT(applySettings()));
connect(m_settingsDialog, TQT_SIGNAL(finished()), this, TQT_SLOT(settingsDialogFinished()));
- m_iconSelector = new KActionSelector(m_settingsDialog);
+ TQGrid *settingsGrid = m_settingsDialog->makeGridMainWidget( 2, Qt::Vertical);
+
+ m_showClockSettingCB = new TQCheckBox("Show Clock in Tray", settingsGrid);
+ m_showClockSettingCB->setChecked(m_showClockInTray);
+
+ //m_iconSelector = new KActionSelector(m_settingsDialog);
+ m_iconSelector = new KActionSelector(settingsGrid);
m_iconSelector->setAvailableLabel(i18n("Hidden icons:"));
m_iconSelector->setSelectedLabel(i18n("Visible icons:"));
- m_settingsDialog->setMainWidget(m_iconSelector);
+ //m_settingsDialog->setMainWidget(m_iconSelector);
TQListBox *hiddenListBox = m_iconSelector->availableListBox();
TQListBox *shownListBox = m_iconSelector->selectedListBox();
@@ -272,6 +294,8 @@ void SystemTrayApplet::applySettings()
return;
}
+ m_showClockInTray = m_showClockSettingCB->isChecked();
+
KConfig *conf = config();
// Save the sort order and hidden status using the window class (WM_CLASS) rather
@@ -317,6 +341,10 @@ void SystemTrayApplet::applySettings()
m_hiddenIconList.append(item->text());
}
conf->writeEntry("Hidden", m_hiddenIconList);
+
+ conf->setGroup("System Tray");
+ conf->writeEntry("ShowClockInTray", m_showClockInTray);
+
conf->sync();
TrayEmbedList::iterator it = m_shownWins.begin();
@@ -392,7 +420,7 @@ void SystemTrayApplet::showExpandButton(bool show)
{
if (!m_expandButton)
{
- m_expandButton = new SimpleArrowButton(this);
+ m_expandButton = new SimpleArrowButton(this, Qt::UpArrow, 0, KickerSettings::showDeepButtons());
m_expandButton->installEventFilter(this);
refreshExpandButton();
@@ -475,6 +503,7 @@ void SystemTrayApplet::loadSettings()
//Note This setting comes from kdeglobal.
conf->setGroup("System Tray");
m_iconSize = conf->readNumEntry("systrayIconWidth", 22);
+ m_showClockInTray = conf->readNumEntry("ShowClockInTray", false);
}
void SystemTrayApplet::systemTrayWindowAdded( WId w )
@@ -984,6 +1013,18 @@ void SystemTrayApplet::layoutTray()
col, col,
0, nbrOfLines - 1,
Qt::AlignHCenter | Qt::AlignVCenter);
+
+ if (m_clockApplet) {
+ if (m_showClockInTray)
+ m_clockApplet->show();
+ else
+ m_clockApplet->hide();
+
+ m_layout->addMultiCellWidget(m_clockApplet,
+ col+1, col+1,
+ 0, nbrOfLines - 1,
+ Qt::AlignHCenter | Qt::AlignVCenter);
+ }
}
else // horizontal
{
@@ -1047,11 +1088,25 @@ void SystemTrayApplet::layoutTray()
0, nbrOfLines - 1,
col, col,
Qt::AlignHCenter | Qt::AlignVCenter);
+
+ if (m_clockApplet) {
+ if (m_showClockInTray)
+ m_clockApplet->show();
+ else
+ m_clockApplet->hide();
+
+ m_layout->addMultiCellWidget(m_clockApplet,
+ 0, nbrOfLines - 1,
+ col+1, col+1,
+ Qt::AlignHCenter | Qt::AlignVCenter);
+ }
}
tqsetUpdatesEnabled(true);
updateGeometry();
setBackground();
+
+ updateClockGeometry();
}
void SystemTrayApplet::paletteChange(const TQPalette & /* oldPalette */)
diff --git a/kicker/applets/systemtray/systemtrayapplet.h b/kicker/applets/systemtray/systemtrayapplet.h
index c656cfe3d..a7a6a043d 100644
--- a/kicker/applets/systemtray/systemtrayapplet.h
+++ b/kicker/applets/systemtray/systemtrayapplet.h
@@ -28,12 +28,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tqstringlist.h>
#include <tqevent.h>
#include <tqlayout.h>
+#include <tqcheckbox.h>
#include <qxembed.h>
#include <dcopobject.h>
#include <kapplication.h>
#include <kpanelapplet.h>
+#include "clock.h"
+
#include "simplebutton.h"
class TQGridLayout;
@@ -85,6 +88,7 @@ protected slots:
void checkAutoRetract();
void configure() { preferences(); }
void setBackground();
+ void updateClockGeometry();
private:
void embedWindow( WId w, bool kde_tray );
@@ -108,11 +112,14 @@ private:
SimpleArrowButton *m_expandButton;
TQWidget *m_leftSpacer;
TQWidget *m_rightSpacer;
+ ClockApplet *m_clockApplet;
KDialogBase* m_settingsDialog;
KActionSelector* m_iconSelector;
TQTimer* m_autoRetractTimer;
bool m_autoRetract;
int m_iconSize;
+ bool m_showClockInTray;
+ TQCheckBox *m_showClockSettingCB;
TQGridLayout* m_layout;
};