summaryrefslogtreecommitdiffstats
path: root/kicker/applets/launcher
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/launcher
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/launcher')
-rw-r--r--kicker/applets/launcher/CMakeLists.txt3
-rw-r--r--kicker/applets/launcher/configdlgbase.ui8
-rw-r--r--kicker/applets/launcher/launcherapplet.kcfg6
-rw-r--r--kicker/applets/launcher/prefs.kcfgc2
-rw-r--r--kicker/applets/launcher/quickbutton.cpp53
-rw-r--r--kicker/applets/launcher/quickbutton.h1
-rw-r--r--kicker/applets/launcher/quicklauncher.cpp37
7 files changed, 100 insertions, 10 deletions
diff --git a/kicker/applets/launcher/CMakeLists.txt b/kicker/applets/launcher/CMakeLists.txt
index e5bf4e92b..dab1a8c95 100644
--- a/kicker/applets/launcher/CMakeLists.txt
+++ b/kicker/applets/launcher/CMakeLists.txt
@@ -11,8 +11,10 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/kicker/libkicker
${CMAKE_SOURCE_DIR}/kicker/libkicker
${CMAKE_SOURCE_DIR}/kicker/kicker/ui
+ ${CMAKE_SOURCE_DIR}/kicker/kicker/core
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
)
@@ -43,5 +45,6 @@ tde_add_kpart( launcher_panelapplet AUTOMOC
kicker_core-static kicker_buttons-static kicker_ui-static
-Wl,--end-group
kickermain-shared kutils-shared kabc-shared
+ DEPENDENCIES libkicker-shared
DESTINATION ${PLUGIN_INSTALL_DIR}
)
diff --git a/kicker/applets/launcher/configdlgbase.ui b/kicker/applets/launcher/configdlgbase.ui
index 49916ebeb..e551864b1 100644
--- a/kicker/applets/launcher/configdlgbase.ui
+++ b/kicker/applets/launcher/configdlgbase.ui
@@ -27,6 +27,14 @@
<string>Allow drag and drop</string>
</property>
</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">
<property name="name">
<cstring>groupBox2</cstring>
diff --git a/kicker/applets/launcher/launcherapplet.kcfg b/kicker/applets/launcher/launcherapplet.kcfg
index 3433bf437..83828c4af 100644
--- a/kicker/applets/launcher/launcherapplet.kcfg
+++ b/kicker/applets/launcher/launcherapplet.kcfg
@@ -7,12 +7,16 @@
<group name="General">
<entry name="ConserveSpace" type="Bool">
<label>Conserve Space</label>
- <default>true</default>
+ <default>false</default>
</entry>
<entry name="DragEnabled" type="Bool">
<label>Drag Enabled</label>
<default>true</default>
</entry>
+ <entry name="ShowDesktopEnabled" type="Bool">
+ <label>Show Desktop Button Enabled</label>
+ <default>true</default>
+ </entry>
<entry name="IconDim" type="Int">
<label>Icon Size</label>
<default>0</default>
diff --git a/kicker/applets/launcher/prefs.kcfgc b/kicker/applets/launcher/prefs.kcfgc
index 26a3f3d07..243e97868 100644
--- a/kicker/applets/launcher/prefs.kcfgc
+++ b/kicker/applets/launcher/prefs.kcfgc
@@ -2,5 +2,5 @@
File=launcherapplet.kcfg
ClassName=Prefs
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
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 <math.h>
#include <algorithm>
+#include "showdesktop.h"
+#include "kickerSettings.h"
+
#ifdef DEBUG
#define DEBUGSTR kdDebug()
#else
@@ -56,6 +59,12 @@ QuickURL::QuickURL(const TQString &u)
{ DEBUGSTR<<"QuickURL::QuickURL("<<u<<")"<<endl<<flush;
KService::Ptr _service=0;
_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")) {
// this ensures that desktop entries are referenced by desktop name instead of by file name
_menuId=KURL(_menuId).path();
@@ -104,6 +113,7 @@ QuickURL::QuickURL(const TQString &u)
} else {
m_name = _kurl.prettyURL();
}
+ }
DEBUGSTR<<"QuickURL::QuickURL("<<u<<") END"<<endl<<flush;
}
@@ -118,8 +128,15 @@ void QuickURL::run() const
//similar to MimeType::pixmapForURL
TQPixmap QuickURL::pixmap( mode_t _mode, KIcon::Group _group,
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
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);
diff --git a/kicker/applets/launcher/quickbutton.h b/kicker/applets/launcher/quickbutton.h
index 13917a5ac..d4f5be29e 100644
--- a/kicker/applets/launcher/quickbutton.h
+++ b/kicker/applets/launcher/quickbutton.h
@@ -104,6 +104,7 @@ protected slots:
void removeApp();
void slotFlash();
void slotStickyToggled(bool isSticky);
+ void toggle(bool);
private:
int m_flashCounter;
diff --git a/kicker/applets/launcher/quicklauncher.cpp b/kicker/applets/launcher/quicklauncher.cpp
index 85bea706e..b5b512d20 100644
--- a/kicker/applets/launcher/quicklauncher.cpp
+++ b/kicker/applets/launcher/quicklauncher.cpp
@@ -287,6 +287,10 @@ void QuickLauncher::removeApp(int index, bool manuallyRemoved)
TQString removeAppUrl = (*m_buttons)[index]->url();
TQString removeAppMenuId = (*m_buttons)[index]->menuId();
+
+ if (removeAppUrl == "SPECIAL_BUTTON__SHOW_DESKTOP") {
+ m_settings->setShowDesktopEnabled(false);
+ }
delete (*m_buttons)[index];
m_buttons->eraseAt(index);
@@ -689,6 +693,31 @@ void QuickLauncher::clearTempButtons()
void QuickLauncher::refreshContents()
{
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
if (m_settings->iconDim() == SIZE_AUTO)
{
@@ -814,6 +843,14 @@ void QuickLauncher::loadConfig()
DEBUGSTR << " DragEnabled=" << isDragEnabled() << endl << flush;*/
TQStringList volatileButtons = m_settings->volatileButtons();
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;
TQStringList::Iterator iter(urls.begin());
int n = 0;