From cec8fe0157b0ab37d4919d0f04c131c11f2c9a9e Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 5 Aug 2011 07:19:55 +0000 Subject: 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 --- kicker/applets/launcher/quickbutton.cpp | 53 ++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 8 deletions(-) (limited to 'kicker/applets/launcher/quickbutton.cpp') diff --git a/kicker/applets/launcher/quickbutton.cpp b/kicker/applets/launcher/quickbutton.cpp index 6e68e2ce1..088e4a573 100644 --- a/kicker/applets/launcher/quickbutton.cpp +++ b/kicker/applets/launcher/quickbutton.cpp @@ -46,6 +46,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +#include "showdesktop.h" +#include "kickerSettings.h" + #ifdef DEBUG #define DEBUGSTR kdDebug() #else @@ -56,6 +59,12 @@ QuickURL::QuickURL(const TQString &u) { DEBUGSTR<<"QuickURL::QuickURL("<loadIcon("desktop", _group, _force_size, _state); + } + else { + pxmap = KMimeType::pixmapForURL(_kurl, _mode, _group, _force_size, _state); + } // Resize to fit button pxmap.convertFromImage(pxmap.convertToImage().smoothScale(_force_size,_force_size, TQ_ScaleMin)); return pxmap; @@ -128,7 +145,7 @@ TQPixmap QuickURL::pixmap( mode_t _mode, KIcon::Group _group, QuickButton::QuickButton(const TQString &u, KAction* configAction, TQWidget *parent, const char *name) : - SimpleButton(parent, name), + SimpleButton(parent, name, KickerSettings::showDeepButtons()), m_flashCounter(0), m_sticky(false) { @@ -137,18 +154,24 @@ QuickButton::QuickButton(const TQString &u, KAction* configAction, _highlight = false; _oldCursor = cursor(); _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()); resize(int(DEFAULT_ICON_DIM),int(DEFAULT_ICON_DIM)); TQBrush bgbrush(tqcolorGroup().brush(TQColorGroup::Background)); - + QuickAddAppsMenu *addAppsMenu = new QuickAddAppsMenu( parent, this, _qurl->url()); _popup = new TQPopupMenu(this); _popup->insertItem(i18n("Add Application"), addAppsMenu); configAction->plug(_popup); _popup->insertSeparator(); - _popup->insertItem(SmallIcon("remove"), i18n("Remove"), + _popup->insertItem(SmallIcon("remove"), i18n("Remove Application"), this, TQT_SLOT(removeApp())); m_stickyAction = new KToggleAction(i18n("Never Remove Automatically"), @@ -168,7 +191,6 @@ QuickButton::~QuickButton() delete _qurl; } - TQString QuickButton::url() const { return _qurl->url(); @@ -240,10 +262,25 @@ void QuickButton::launch() setDown(false); update(); 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()); } +void QuickButton::toggle(bool showDesktop) +{ + setOn(showDesktop); +} + void QuickButton::setDragging(bool enable) { setDown(enable); -- cgit v1.2.1