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
v3.5.13-sru
tpearson 13 years ago
parent 80035308b1
commit cec8fe0157

@ -29,7 +29,7 @@ install( FILES clockapplet.desktop DESTINATION ${DATA_INSTALL_DIR}/kicker/applet
install( FILES lcd.png DESTINATION ${DATA_INSTALL_DIR}/clockapplet/pics ) install( FILES lcd.png DESTINATION ${DATA_INSTALL_DIR}/clockapplet/pics )
##### clock_panelapplet (module) ################ ##### clock_panelapplet (static) ######################
set( target clock_panelapplet ) set( target clock_panelapplet )
@ -38,6 +38,19 @@ set( ${target}_SRCS
analog.ui digital.ui fuzzy.ui settings.ui prefs.kcfgc analog.ui digital.ui fuzzy.ui settings.ui prefs.kcfgc
) )
tde_add_library( ${target} STATIC AUTOMOC
SOURCES ${${target}_SRCS}
)
##### clock_panelapplet (module) ################
set( target clock_panelapplet )
set( ${target}_SRCS
clock.skel clock.cpp datepicker.cpp zone.cpp
analog.ui digital.ui fuzzy.ui settings.ui prefs.kcfgc init.cpp
)
tde_add_kpart( ${target} AUTOMOC tde_add_kpart( ${target} AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
LINK kickermain-shared LINK kickermain-shared

@ -66,17 +66,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "fuzzy.h" #include "fuzzy.h"
#include "prefs.h" #include "prefs.h"
extern "C"
{
KDE_EXPORT KPanelApplet* init(TQWidget *parent, const TQString& configFile)
{
KGlobal::locale()->insertCatalogue("clockapplet");
KGlobal::locale()->insertCatalogue("timezones"); // For time zone translations
return new ClockApplet(configFile, KPanelApplet::Normal,
KPanelApplet::Preferences, parent, "clockapplet");
}
}
// Settings // Settings
KConfigDialogSingle::KConfigDialogSingle(Zone *zone, TQWidget *parent, KConfigDialogSingle::KConfigDialogSingle(Zone *zone, TQWidget *parent,

@ -290,7 +290,7 @@ class ClockApplet : public KPanelApplet, public KickerTip::Client, public DCOPOb
void reconfigure(); void reconfigure();
protected slots: protected slots:
void slotReconfigure() { reconfigure(); } void slotReconfigure() { reconfigure(); emit clockReconfigured(); }
void slotUpdate(); void slotUpdate();
void slotCalendarDeleted(); void slotCalendarDeleted();
void slotEnableCalendar(); void slotEnableCalendar();
@ -301,6 +301,9 @@ class ClockApplet : public KPanelApplet, public KickerTip::Client, public DCOPOb
void globalPaletteChange(); void globalPaletteChange();
void setTimerTo60(); void setTimerTo60();
signals:
void clockReconfigured();
protected: protected:
void toggleCalendar(); void toggleCalendar();
void openContextMenu(); void openContextMenu();

@ -11,8 +11,10 @@
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}/kicker/libkicker
${CMAKE_SOURCE_DIR}/kicker/libkicker ${CMAKE_SOURCE_DIR}/kicker/libkicker
${CMAKE_SOURCE_DIR}/kicker/kicker/ui ${CMAKE_SOURCE_DIR}/kicker/kicker/ui
${CMAKE_SOURCE_DIR}/kicker/kicker/core
${TDE_INCLUDE_DIR} ${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
) )
@ -43,5 +45,6 @@ tde_add_kpart( launcher_panelapplet AUTOMOC
kicker_core-static kicker_buttons-static kicker_ui-static kicker_core-static kicker_buttons-static kicker_ui-static
-Wl,--end-group -Wl,--end-group
kickermain-shared kutils-shared kabc-shared kickermain-shared kutils-shared kabc-shared
DEPENDENCIES libkicker-shared
DESTINATION ${PLUGIN_INSTALL_DIR} DESTINATION ${PLUGIN_INSTALL_DIR}
) )

@ -27,6 +27,14 @@
<string>Allow drag and drop</string> <string>Allow drag and drop</string>
</property> </property>
</widget> </widget>
<widget class="TQCheckBox">
<property name="name">
<cstring>kcfg_ShowDesktopEnabled</cstring>
</property>
<property name="text">
<string>Enable 'Show Desktop' button</string>
</property>
</widget>
<widget class="TQGroupBox"> <widget class="TQGroupBox">
<property name="name"> <property name="name">
<cstring>groupBox2</cstring> <cstring>groupBox2</cstring>

@ -7,12 +7,16 @@
<group name="General"> <group name="General">
<entry name="ConserveSpace" type="Bool"> <entry name="ConserveSpace" type="Bool">
<label>Conserve Space</label> <label>Conserve Space</label>
<default>true</default> <default>false</default>
</entry> </entry>
<entry name="DragEnabled" type="Bool"> <entry name="DragEnabled" type="Bool">
<label>Drag Enabled</label> <label>Drag Enabled</label>
<default>true</default> <default>true</default>
</entry> </entry>
<entry name="ShowDesktopEnabled" type="Bool">
<label>Show Desktop Button Enabled</label>
<default>true</default>
</entry>
<entry name="IconDim" type="Int"> <entry name="IconDim" type="Int">
<label>Icon Size</label> <label>Icon Size</label>
<default>0</default> <default>0</default>

@ -2,5 +2,5 @@
File=launcherapplet.kcfg File=launcherapplet.kcfg
ClassName=Prefs ClassName=Prefs
Singleton=false Singleton=false
Mutators=AutoAdjustMaxItems,Buttons,VolatileButtons,AutoAdjustMaxItems,AutoAdjustMinItems,AutoAdjustEnabled,IconDim,DragEnabled,ConserveSpace,ServiceInspos,ServiceNames,ServiceHistories Mutators=AutoAdjustMaxItems,Buttons,VolatileButtons,AutoAdjustMaxItems,AutoAdjustMinItems,AutoAdjustEnabled,IconDim,DragEnabled,ShowDesktopEnabled,ConserveSpace,ServiceInspos,ServiceNames,ServiceHistories
# MemberVariables=public # MemberVariables=public

@ -46,6 +46,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <math.h> #include <math.h>
#include <algorithm> #include <algorithm>
#include "showdesktop.h"
#include "kickerSettings.h"
#ifdef DEBUG #ifdef DEBUG
#define DEBUGSTR kdDebug() #define DEBUGSTR kdDebug()
#else #else
@ -56,6 +59,12 @@ QuickURL::QuickURL(const TQString &u)
{ DEBUGSTR<<"QuickURL::QuickURL("<<u<<")"<<endl<<flush; { DEBUGSTR<<"QuickURL::QuickURL("<<u<<")"<<endl<<flush;
KService::Ptr _service=0; KService::Ptr _service=0;
_menuId = u; _menuId = u;
if (_menuId == "SPECIAL_BUTTON__SHOW_DESKTOP") {
m_name = i18n("Show Desktop");
m_genericName = i18n("Show Desktop");
_kurl = _menuId;
}
else {
if (_menuId.startsWith("file:") && _menuId.endsWith(".desktop")) { if (_menuId.startsWith("file:") && _menuId.endsWith(".desktop")) {
// this ensures that desktop entries are referenced by desktop name instead of by file name // this ensures that desktop entries are referenced by desktop name instead of by file name
_menuId=KURL(_menuId).path(); _menuId=KURL(_menuId).path();
@ -104,6 +113,7 @@ QuickURL::QuickURL(const TQString &u)
} else { } else {
m_name = _kurl.prettyURL(); m_name = _kurl.prettyURL();
} }
}
DEBUGSTR<<"QuickURL::QuickURL("<<u<<") END"<<endl<<flush; DEBUGSTR<<"QuickURL::QuickURL("<<u<<") END"<<endl<<flush;
} }
@ -118,8 +128,15 @@ void QuickURL::run() const
//similar to MimeType::pixmapForURL //similar to MimeType::pixmapForURL
TQPixmap QuickURL::pixmap( mode_t _mode, KIcon::Group _group, TQPixmap QuickURL::pixmap( mode_t _mode, KIcon::Group _group,
int _force_size, int _state, TQString *) const int _force_size, int _state, TQString *) const
{ // Load icon {
TQPixmap pxmap = KMimeType::pixmapForURL(_kurl, _mode, _group, _force_size, _state); TQPixmap pxmap;
// Load icon
if (_kurl.url() == "SPECIAL_BUTTON__SHOW_DESKTOP") {
pxmap = KGlobal::iconLoader()->loadIcon("desktop", _group, _force_size, _state);
}
else {
pxmap = KMimeType::pixmapForURL(_kurl, _mode, _group, _force_size, _state);
}
// Resize to fit button // Resize to fit button
pxmap.convertFromImage(pxmap.convertToImage().smoothScale(_force_size,_force_size, TQ_ScaleMin)); pxmap.convertFromImage(pxmap.convertToImage().smoothScale(_force_size,_force_size, TQ_ScaleMin));
return pxmap; return pxmap;
@ -128,7 +145,7 @@ TQPixmap QuickURL::pixmap( mode_t _mode, KIcon::Group _group,
QuickButton::QuickButton(const TQString &u, KAction* configAction, QuickButton::QuickButton(const TQString &u, KAction* configAction,
TQWidget *parent, const char *name) : TQWidget *parent, const char *name) :
SimpleButton(parent, name), SimpleButton(parent, name, KickerSettings::showDeepButtons()),
m_flashCounter(0), m_flashCounter(0),
m_sticky(false) m_sticky(false)
{ {
@ -137,18 +154,24 @@ QuickButton::QuickButton(const TQString &u, KAction* configAction,
_highlight = false; _highlight = false;
_oldCursor = cursor(); _oldCursor = cursor();
_qurl=new QuickURL(u); _qurl=new QuickURL(u);
if (_qurl->url() == "SPECIAL_BUTTON__SHOW_DESKTOP") {
setToggleButton(true);
setOn( ShowDesktop::the()->desktopShowing() );
connect( ShowDesktop::the(), TQT_SIGNAL(desktopShown(bool)), this, TQT_SLOT(toggle(bool)) );
}
TQToolTip::add(this, _qurl->name()); TQToolTip::add(this, _qurl->name());
resize(int(DEFAULT_ICON_DIM),int(DEFAULT_ICON_DIM)); resize(int(DEFAULT_ICON_DIM),int(DEFAULT_ICON_DIM));
TQBrush bgbrush(tqcolorGroup().brush(TQColorGroup::Background)); TQBrush bgbrush(tqcolorGroup().brush(TQColorGroup::Background));
QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu( QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu(
parent, this, _qurl->url()); parent, this, _qurl->url());
_popup = new TQPopupMenu(this); _popup = new TQPopupMenu(this);
_popup->insertItem(i18n("Add Application"), addAppsMenu); _popup->insertItem(i18n("Add Application"), addAppsMenu);
configAction->plug(_popup); configAction->plug(_popup);
_popup->insertSeparator(); _popup->insertSeparator();
_popup->insertItem(SmallIcon("remove"), i18n("Remove"), _popup->insertItem(SmallIcon("remove"), i18n("Remove Application"),
this, TQT_SLOT(removeApp())); this, TQT_SLOT(removeApp()));
m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"), m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"),
@ -168,7 +191,6 @@ QuickButton::~QuickButton()
delete _qurl; delete _qurl;
} }
TQString QuickButton::url() const TQString QuickButton::url() const
{ {
return _qurl->url(); return _qurl->url();
@ -240,10 +262,25 @@ void QuickButton::launch()
setDown(false); setDown(false);
update(); update();
KIconEffect::visualActivate(this, rect()); KIconEffect::visualActivate(this, rect());
_qurl->run(); if (_qurl->kurl().url() == "SPECIAL_BUTTON__SHOW_DESKTOP") {
if (isOn()) {
ShowDesktop::the()->showDesktop(TRUE);
}
else {
ShowDesktop::the()->showDesktop(FALSE);
}
}
else {
_qurl->run();
}
emit executed(_qurl->menuId()); emit executed(_qurl->menuId());
} }
void QuickButton::toggle(bool showDesktop)
{
setOn(showDesktop);
}
void QuickButton::setDragging(bool enable) void QuickButton::setDragging(bool enable)
{ {
setDown(enable); setDown(enable);

@ -104,6 +104,7 @@ protected slots:
void removeApp(); void removeApp();
void slotFlash(); void slotFlash();
void slotStickyToggled(bool isSticky); void slotStickyToggled(bool isSticky);
void toggle(bool);
private: private:
int m_flashCounter; int m_flashCounter;

@ -287,6 +287,10 @@ void QuickLauncher::removeApp(int index, bool manuallyRemoved)
TQString removeAppUrl = (*m_buttons)[index]->url(); TQString removeAppUrl = (*m_buttons)[index]->url();
TQString removeAppMenuId = (*m_buttons)[index]->menuId(); TQString removeAppMenuId = (*m_buttons)[index]->menuId();
if (removeAppUrl == "SPECIAL_BUTTON__SHOW_DESKTOP") {
m_settings->setShowDesktopEnabled(false);
}
delete (*m_buttons)[index]; delete (*m_buttons)[index];
m_buttons->eraseAt(index); m_buttons->eraseAt(index);
@ -689,6 +693,31 @@ void QuickLauncher::clearTempButtons()
void QuickLauncher::refreshContents() void QuickLauncher::refreshContents()
{ {
int idim, d(dimension()); int idim, d(dimension());
// make sure show desktop setting is honored
TQStringList urls, volatileUrls;
ButtonIter iter = m_buttons->begin();
while (iter != m_buttons->end()) {
if ((*iter)->sticky() == false)
{
volatileUrls.append((*iter)->menuId());
}
urls.append((*iter)->menuId());
++iter;
}
if (m_settings->showDesktopEnabled()) {
if (!urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP")) {
urls.prepend("SPECIAL_BUTTON__SHOW_DESKTOP");
addApp("SPECIAL_BUTTON__SHOW_DESKTOP", 0, true);
}
}
else {
if (urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP")) {
urls.remove("SPECIAL_BUTTON__SHOW_DESKTOP");
removeApp("SPECIAL_BUTTON__SHOW_DESKTOP", true);
}
}
// determine button size // determine button size
if (m_settings->iconDim() == SIZE_AUTO) if (m_settings->iconDim() == SIZE_AUTO)
{ {
@ -814,6 +843,14 @@ void QuickLauncher::loadConfig()
DEBUGSTR << " DragEnabled=" << isDragEnabled() << endl << flush;*/ DEBUGSTR << " DragEnabled=" << isDragEnabled() << endl << flush;*/
TQStringList volatileButtons = m_settings->volatileButtons(); TQStringList volatileButtons = m_settings->volatileButtons();
TQStringList urls = m_settings->buttons(); TQStringList urls = m_settings->buttons();
if (m_settings->showDesktopEnabled()) {
if (!urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP"))
urls.prepend("SPECIAL_BUTTON__SHOW_DESKTOP");
}
else {
if (urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP"))
urls.remove("SPECIAL_BUTTON__SHOW_DESKTOP");
}
kdDebug() << "GetButtons " << urls.join("/") << endl; kdDebug() << "GetButtons " << urls.join("/") << endl;
TQStringList::Iterator iter(urls.begin()); TQStringList::Iterator iter(urls.begin());
int n = 0; int n = 0;

@ -15,10 +15,13 @@ include_directories(
${CMAKE_SOURCE_DIR}/kicker/libkicker ${CMAKE_SOURCE_DIR}/kicker/libkicker
${TDE_INCLUDE_DIR} ${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${CMAKE_BINARY_DIR}/kicker/applets/clock
${CMAKE_SOURCE_DIR}/kicker/applets/clock
) )
link_directories( link_directories(
${TQT_LIBRARY_DIRS} ${TQT_LIBRARY_DIRS}
${CMAKE_BINARY_DIR}/kicker/applets/clock
) )
@ -37,7 +40,7 @@ set( ${target}_SRCS
tde_add_kpart( ${target} AUTOMOC tde_add_kpart( ${target} AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
LINK kickermain-shared LINK kickermain-shared clock_panelapplet-static
DESTINATION ${PLUGIN_INSTALL_DIR} DESTINATION ${PLUGIN_INSTALL_DIR}
DEPENDENCIES kicker_core-static kicker-static kicker-shared DEPENDENCIES kicker_core-static kicker-static kicker-shared clock_panelapplet-shared
) )

@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tqpixmap.h> #include <tqpixmap.h>
#include <tqevent.h> #include <tqevent.h>
#include <tqstyle.h> #include <tqstyle.h>
#include <tqgrid.h>
#include <tqpainter.h> #include <tqpainter.h>
#include <dcopclient.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> #include <X11/Xlib.h>
//#define ICON_MARGIN KickerSettings::showDeepButtons()?2:1
#define ICON_MARGIN 1 #define ICON_MARGIN 1
#define ICON_END_MARGIN KickerSettings::showDeepButtons()?4:0 #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_expandButton(0),
m_leftSpacer(0), m_leftSpacer(0),
m_rightSpacer(0), m_rightSpacer(0),
m_clockApplet(0),
m_settingsDialog(0), m_settingsDialog(0),
m_iconSelector(0), m_iconSelector(0),
m_autoRetractTimer(0), m_autoRetractTimer(0),
m_autoRetract(false), m_autoRetract(false),
m_iconSize(24), m_iconSize(24),
m_showClockInTray(false),
m_showClockSettingCB(0),
m_layout(0) m_layout(0)
{ {
DCOPObject::setObjId("SystemTrayApplet"); DCOPObject::setObjId("SystemTrayApplet");
@ -93,6 +96,10 @@ SystemTrayApplet::SystemTrayApplet(const TQString& configFile, Type type, int ac
m_rightSpacer = new TQWidget(this); m_rightSpacer = new TQWidget(this);
m_rightSpacer->setFixedSize(ICON_END_MARGIN,1); 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); setBackgroundOrigin(AncestorOrigin);
kwin_module = new KWinModule(TQT_TQOBJECT(this)); 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())); 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() void SystemTrayApplet::initialize()
{ {
// register existing tray windows // register existing tray windows
@ -185,6 +198,9 @@ SystemTrayApplet::~SystemTrayApplet()
delete *it; delete *it;
} }
if (m_leftSpacer) delete m_leftSpacer;
if (m_rightSpacer) delete m_rightSpacer;
KGlobal::locale()->removeCatalogue("ksystemtrayapplet"); 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(okClicked()), this, TQT_SLOT(applySettings()));
connect(m_settingsDialog, TQT_SIGNAL(finished()), this, TQT_SLOT(settingsDialogFinished())); 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->setAvailableLabel(i18n("Hidden icons:"));
m_iconSelector->setSelectedLabel(i18n("Visible icons:")); m_iconSelector->setSelectedLabel(i18n("Visible icons:"));
m_settingsDialog->setMainWidget(m_iconSelector); //m_settingsDialog->setMainWidget(m_iconSelector);
TQListBox *hiddenListBox = m_iconSelector->availableListBox(); TQListBox *hiddenListBox = m_iconSelector->availableListBox();
TQListBox *shownListBox = m_iconSelector->selectedListBox(); TQListBox *shownListBox = m_iconSelector->selectedListBox();
@ -272,6 +294,8 @@ void SystemTrayApplet::applySettings()
return; return;
} }
m_showClockInTray = m_showClockSettingCB->isChecked();
KConfig *conf = config(); KConfig *conf = config();
// Save the sort order and hidden status using the window class (WM_CLASS) rather // 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()); m_hiddenIconList.append(item->text());
} }
conf->writeEntry("Hidden", m_hiddenIconList); conf->writeEntry("Hidden", m_hiddenIconList);
conf->setGroup("System Tray");
conf->writeEntry("ShowClockInTray", m_showClockInTray);
conf->sync(); conf->sync();
TrayEmbedList::iterator it = m_shownWins.begin(); TrayEmbedList::iterator it = m_shownWins.begin();
@ -392,7 +420,7 @@ void SystemTrayApplet::showExpandButton(bool show)
{ {
if (!m_expandButton) if (!m_expandButton)
{ {
m_expandButton = new SimpleArrowButton(this); m_expandButton = new SimpleArrowButton(this, Qt::UpArrow, 0, KickerSettings::showDeepButtons());
m_expandButton->installEventFilter(this); m_expandButton->installEventFilter(this);
refreshExpandButton(); refreshExpandButton();
@ -475,6 +503,7 @@ void SystemTrayApplet::loadSettings()
//Note This setting comes from kdeglobal. //Note This setting comes from kdeglobal.
conf->setGroup("System Tray"); conf->setGroup("System Tray");
m_iconSize = conf->readNumEntry("systrayIconWidth", 22); m_iconSize = conf->readNumEntry("systrayIconWidth", 22);
m_showClockInTray = conf->readNumEntry("ShowClockInTray", false);
} }
void SystemTrayApplet::systemTrayWindowAdded( WId w ) void SystemTrayApplet::systemTrayWindowAdded( WId w )
@ -984,6 +1013,18 @@ void SystemTrayApplet::layoutTray()
col, col, col, col,
0, nbrOfLines - 1, 0, nbrOfLines - 1,
Qt::AlignHCenter | Qt::AlignVCenter); 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 else // horizontal
{ {
@ -1047,11 +1088,25 @@ void SystemTrayApplet::layoutTray()
0, nbrOfLines - 1, 0, nbrOfLines - 1,
col, col, col, col,
Qt::AlignHCenter | Qt::AlignVCenter); 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); tqsetUpdatesEnabled(true);
updateGeometry(); updateGeometry();
setBackground(); setBackground();
updateClockGeometry();
} }
void SystemTrayApplet::paletteChange(const TQPalette & /* oldPalette */) void SystemTrayApplet::paletteChange(const TQPalette & /* oldPalette */)

@ -28,12 +28,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tqstringlist.h> #include <tqstringlist.h>
#include <tqevent.h> #include <tqevent.h>
#include <tqlayout.h> #include <tqlayout.h>
#include <tqcheckbox.h>
#include <qxembed.h> #include <qxembed.h>
#include <dcopobject.h> #include <dcopobject.h>
#include <kapplication.h> #include <kapplication.h>
#include <kpanelapplet.h> #include <kpanelapplet.h>
#include "clock.h"
#include "simplebutton.h" #include "simplebutton.h"
class TQGridLayout; class TQGridLayout;
@ -85,6 +88,7 @@ protected slots:
void checkAutoRetract(); void checkAutoRetract();
void configure() { preferences(); } void configure() { preferences(); }
void setBackground(); void setBackground();
void updateClockGeometry();
private: private:
void embedWindow( WId w, bool kde_tray ); void embedWindow( WId w, bool kde_tray );
@ -108,11 +112,14 @@ private:
SimpleArrowButton *m_expandButton; SimpleArrowButton *m_expandButton;
TQWidget *m_leftSpacer; TQWidget *m_leftSpacer;
TQWidget *m_rightSpacer; TQWidget *m_rightSpacer;
ClockApplet *m_clockApplet;
KDialogBase* m_settingsDialog; KDialogBase* m_settingsDialog;
KActionSelector* m_iconSelector; KActionSelector* m_iconSelector;
TQTimer* m_autoRetractTimer; TQTimer* m_autoRetractTimer;
bool m_autoRetract; bool m_autoRetract;
int m_iconSize; int m_iconSize;
bool m_showClockInTray;
TQCheckBox *m_showClockSettingCB;
TQGridLayout* m_layout; TQGridLayout* m_layout;
}; };

@ -1400,7 +1400,7 @@ void ExtensionContainer::paintEvent(TQPaintEvent *e)
if (KickerSettings::useResizeHandle()) if (KickerSettings::useResizeHandle())
{ {
// draw resize handle [RAJA] // draw resize handle
TQRect rect; TQRect rect;
TQPainter p( this ); TQPainter p( this );

@ -1513,24 +1513,6 @@ void ContainerArea::setBackground()
TQTimer::singleShot(0, this, TQT_SLOT(updateContainersBackground())); TQTimer::singleShot(0, this, TQT_SLOT(updateContainersBackground()));
} }
} }
// else { // RAJA
// TQRect rect;
// TQImage bgImage;
// TQPixmap bgPixmap(size().width(), size().height());
// bgPixmap.fill(tqcolorGroup().background());
// TQPainter p( TQT_TQPAINTDEVICE(&bgPixmap) );
//
// // FIXME This should change the rectangle based on the container's location on the screen (top, bottom, etc.)
// rect = TQRect(0,0,size().width(),2);
// tqstyle().tqdrawPrimitive( TQStyle::PE_DockWindowSeparator, &p, rect, tqcolorGroup(), TQStyle::Style_Default );
//
// printf("[RAJA DEBUG 100.0] Hi there!\n\r"); fflush(stdout);
// p.fillRect(0,0,100,100,TQColor(0,0,0));
//
// bgImage = bgPixmap;
// setPaletteBackgroundPixmap(TQPixmap(bgImage));
// TQTimer::singleShot(0, this, TQT_SLOT(updateContainersBackground()));
// }
_bgSet = true; _bgSet = true;
} }

@ -40,13 +40,13 @@ public:
bool fullSpan () const { return true; } bool fullSpan () const { return true; }
void paint(TQPainter* p, const TQColorGroup& cg, void paint(TQPainter* p, const TQColorGroup& cg,
bool /* act */, bool /*enabled*/, bool /* act */, bool /*enabled*/,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
p->save(); p->save();
TQRect r(x, y, w, h); TQRect r(x, y, w, h);
kapp->tqstyle().tqdrawPrimitive(TQStyle::PE_HeaderSection, kapp->tqstyle().tqdrawPrimitive(TQStyle::PE_HeaderSectionMenu,
p, r, cg); p, r, cg);
if (!m_desktopName.isEmpty()) if (!m_desktopName.isEmpty())
@ -54,7 +54,7 @@ public:
p->setPen(cg.buttonText()); p->setPen(cg.buttonText());
p->setFont(m_font); p->setFont(m_font);
p->drawText(x, y, w, h, p->drawText(x, y, w, h,
AlignCenter | SingleLine, AlignCenter | SingleLine,
m_desktopName); m_desktopName);
} }
@ -72,7 +72,7 @@ public:
TQSize tqsizeHint() TQSize tqsizeHint()
{ {
TQSize size = TQFontMetrics(m_font).size(AlignHCenter, m_desktopName); TQSize size = TQFontMetrics(m_font).size(AlignHCenter, m_desktopName);
size.setHeight(size.height() + size.setHeight(size.height() +
(kapp->tqstyle().tqpixelMetric(TQStyle::PM_DefaultFrameWidth) * 2 + 1)); (kapp->tqstyle().tqpixelMetric(TQStyle::PM_DefaultFrameWidth) * 2 + 1));
return size; return size;
} }

@ -326,7 +326,7 @@ int PanelButton::heightForWidth(int width) const
const TQPixmap& PanelButton::labelIcon() const const TQPixmap& PanelButton::labelIcon() const
{ {
if (m_disableHighlighting) if (m_disableHighlighting || (!KickerSettings::showMouseOverEffects()))
return m_icon; return m_icon;
else else
return m_highlight ? m_iconh : m_icon; return m_highlight ? m_iconh : m_icon;

@ -32,12 +32,18 @@
#include <kipc.h> #include <kipc.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include "kickerSettings.h"
#define BUTTON_MARGIN KDialog::spacingHint() #define BUTTON_MARGIN KDialog::spacingHint()
SimpleButton::SimpleButton(TQWidget *parent, const char *name) // For now link these two
#define m_disableHighlighting m_forceStandardCursor
SimpleButton::SimpleButton(TQWidget *parent, const char *name, bool forceStandardCursor)
: TQButton(parent, name), : TQButton(parent, name),
m_highlight(false), m_highlight(false),
m_orientation(Qt::Horizontal) m_orientation(Qt::Horizontal),
m_forceStandardCursor(forceStandardCursor)
{ {
setBackgroundOrigin( AncestorOrigin ); setBackgroundOrigin( AncestorOrigin );
@ -87,6 +93,16 @@ TQSize SimpleButton::tqminimumSizeHint() const
void SimpleButton::drawButton( TQPainter *p ) void SimpleButton::drawButton( TQPainter *p )
{ {
TQRect r(0, 0, width(), height());
if (m_disableHighlighting == TRUE) {
if (m_highlight || isDown() || isOn()) {
int flags = TQStyle::Style_Default | TQStyle::Style_Enabled;
if (isDown() || isOn()) flags |= TQStyle::Style_Down;
tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonTool, p, r, tqcolorGroup(), flags);
}
}
drawButtonLabel(p); drawButtonLabel(p);
} }
@ -97,14 +113,19 @@ void SimpleButton::drawButtonLabel( TQPainter *p )
return; return;
} }
TQPixmap pix = isEnabled() ? (m_highlight? m_activeIcon : m_normalIcon) : m_disabledIcon; TQPixmap pix = isEnabled() ? ((m_highlight&&(!m_disableHighlighting))? m_activeIcon : m_normalIcon) : m_disabledIcon;
if (isOn() || isDown()) if ((isOn() || isDown()) && (m_disableHighlighting == FALSE))
{ {
pix = TQImage(pix.convertToImage()).smoothScale(pix.width() - 2, pix = TQImage(pix.convertToImage()).smoothScale(pix.width() - 2,
pix.height() - 2); pix.height() - 2);
} }
if (m_disableHighlighting == TRUE) {
pix = TQImage(pix.convertToImage()).smoothScale(pix.width() - 4,
pix.height() - 4);
}
int h = height(); int h = height();
int w = width(); int w = width();
int ph = pix.height(); int ph = pix.height();
@ -149,7 +170,11 @@ void SimpleButton::slotSettingsChanged(int category)
return; return;
} }
bool changeCursor = KGlobalSettings::changeCursorOverIcon(); bool changeCursor;
if (m_forceStandardCursor == FALSE)
changeCursor = KGlobalSettings::changeCursorOverIcon();
else
changeCursor = FALSE;
if (changeCursor) if (changeCursor)
{ {
@ -174,7 +199,8 @@ void SimpleButton::slotIconChanged( int group )
void SimpleButton::enterEvent( TQEvent *e ) void SimpleButton::enterEvent( TQEvent *e )
{ {
m_highlight = true; if (KickerSettings::showMouseOverEffects())
m_highlight = true;
tqrepaint( false ); tqrepaint( false );
TQButton::enterEvent( e ); TQButton::enterEvent( e );
@ -194,8 +220,9 @@ void SimpleButton::resizeEvent( TQResizeEvent * )
} }
SimpleArrowButton::SimpleArrowButton(TQWidget *parent, Qt::ArrowType arrow, const char *name) SimpleArrowButton::SimpleArrowButton(TQWidget *parent, Qt::ArrowType arrow, const char *name, bool forceStandardCursor)
: SimpleButton(parent, name) : SimpleButton(parent, name, forceStandardCursor),
m_forceStandardCursor(forceStandardCursor)
{ {
setBackgroundOrigin(AncestorOrigin); setBackgroundOrigin(AncestorOrigin);
_arrow = arrow; _arrow = arrow;
@ -224,7 +251,7 @@ Qt::ArrowType SimpleArrowButton::arrowType() const
void SimpleArrowButton::drawButton( TQPainter *p ) void SimpleArrowButton::drawButton( TQPainter *p )
{ {
TQRect r(1, 1, width() - 2, height() - 2); TQRect r(1, 1, width() - 2, height() - 2);
TQStyle::PrimitiveElement pe = TQStyle::PE_ArrowLeft; TQStyle::PrimitiveElement pe = TQStyle::PE_ArrowLeft;
switch (_arrow) switch (_arrow)
{ {
@ -233,10 +260,14 @@ void SimpleArrowButton::drawButton( TQPainter *p )
case Qt::UpArrow: pe = TQStyle::PE_ArrowUp; break; case Qt::UpArrow: pe = TQStyle::PE_ArrowUp; break;
case Qt::DownArrow: pe = TQStyle::PE_ArrowDown; break; case Qt::DownArrow: pe = TQStyle::PE_ArrowDown; break;
} }
int flags = TQStyle::Style_Default | TQStyle::Style_Enabled; int flags = TQStyle::Style_Default | TQStyle::Style_Enabled;
if (isDown() || isOn()) flags |= TQStyle::Style_Down; if (isDown() || isOn()) flags |= TQStyle::Style_Down;
tqstyle().tqdrawPrimitive(pe, p, r, tqcolorGroup(), flags); tqstyle().tqdrawPrimitive(pe, p, r, tqcolorGroup(), flags);
if (m_forceStandardCursor) {
SimpleButton::drawButton(p);
}
} }
void SimpleArrowButton::enterEvent( TQEvent *e ) void SimpleArrowButton::enterEvent( TQEvent *e )
@ -249,7 +280,7 @@ void SimpleArrowButton::enterEvent( TQEvent *e )
void SimpleArrowButton::leaveEvent( TQEvent *e ) void SimpleArrowButton::leaveEvent( TQEvent *e )
{ {
_inside = false; _inside = false;
SimpleButton::enterEvent( e ); SimpleButton::leaveEvent( e );
update(); update();
} }

@ -31,7 +31,7 @@ class KDE_EXPORT SimpleButton : public TQButton
Q_OBJECT Q_OBJECT
public: public:
SimpleButton(TQWidget *parent, const char *name = 0); SimpleButton(TQWidget *parent, const char *name = 0, bool forceStandardCursor = FALSE);
void setPixmap(const TQPixmap &pix); void setPixmap(const TQPixmap &pix);
void setOrientation(Qt::Orientation orientaton); void setOrientation(Qt::Orientation orientaton);
TQSize tqsizeHint() const; TQSize tqsizeHint() const;
@ -56,6 +56,7 @@ class KDE_EXPORT SimpleButton : public TQButton
TQPixmap m_activeIcon; TQPixmap m_activeIcon;
TQPixmap m_disabledIcon; TQPixmap m_disabledIcon;
Qt::Orientation m_orientation; Qt::Orientation m_orientation;
bool m_forceStandardCursor;
class SimpleButtonPrivate; class SimpleButtonPrivate;
SimpleButtonPrivate* d; SimpleButtonPrivate* d;
}; };
@ -65,7 +66,7 @@ class KDE_EXPORT SimpleArrowButton: public SimpleButton
Q_OBJECT Q_OBJECT
public: public:
SimpleArrowButton(TQWidget *parent = 0, Qt::ArrowType arrow = Qt::UpArrow, const char *name = 0); SimpleArrowButton(TQWidget *parent = 0, Qt::ArrowType arrow = Qt::UpArrow, const char *name = 0, bool forceStandardCursor = FALSE);
virtual ~SimpleArrowButton() {}; virtual ~SimpleArrowButton() {};
TQSize tqsizeHint() const; TQSize tqsizeHint() const;
@ -80,6 +81,7 @@ class KDE_EXPORT SimpleArrowButton: public SimpleButton
private: private:
Qt::ArrowType _arrow; Qt::ArrowType _arrow;
bool m_forceStandardCursor;
bool _inside; bool _inside;
}; };

@ -771,7 +771,7 @@ void TaskContainer::drawButton(TQPainter *p)
} }
// draw popup arrow // draw popup arrow
if (m_filteredTasks.count() > 1) if ((m_filteredTasks.count() > 1) && (!KickerSettings::showDeepButtons()))
{ {
TQStyle::PrimitiveElement e = TQStyle::PE_ArrowLeft; TQStyle::PrimitiveElement e = TQStyle::PE_ArrowLeft;

Loading…
Cancel
Save