summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Andriot <francois.andriot@free.fr>2013-05-19 16:09:35 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-05-19 16:58:18 +0200
commit4844466a7d3358a673a6a5afaf0a087342cc4ae6 (patch)
tree57073d51ecac7144a76154b5dd1580ed9f72313f
parentd531f6f8413e13d29991463f853b3615ac3bcea9 (diff)
downloadtdebase-4844466a7d3358a673a6a5afaf0a087342cc4ae6.tar.gz
tdebase-4844466a7d3358a673a6a5afaf0a087342cc4ae6.zip
Add tooltip support in KMenu
(cherry picked from commit 718f6ae321b507dbb5bca737a1d1d486b2b41dc5)
-rw-r--r--kcontrol/kicker/menutab.ui14
-rw-r--r--kcontrol/kicker/menutab_impl.cpp12
-rw-r--r--kicker/kicker/ui/service_mnu.cpp18
-rw-r--r--kicker/kicker/ui/service_mnu.h1
-rw-r--r--kicker/libkicker/kickerSettings.kcfg5
5 files changed, 50 insertions, 0 deletions
diff --git a/kcontrol/kicker/menutab.ui b/kcontrol/kicker/menutab.ui
index 2dcb62818..6b7af897b 100644
--- a/kcontrol/kicker/menutab.ui
+++ b/kcontrol/kicker/menutab.ui
@@ -173,6 +173,20 @@
</widget>
<widget class="TQCheckBox">
<property name="name">
+ <cstring>kcfg_UseTooltip</cstring>
+ </property>
+ <property name="text">
+ <string>Show T&amp;ooltip</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;When this option is selected a tooltip will appear on the KMenu items.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
<cstring>kcfg_UseSidePixmap</cstring>
</property>
<property name="text">
diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp
index 3b5edc11f..b7356ea13 100644
--- a/kcontrol/kicker/menutab_impl.cpp
+++ b/kcontrol/kicker/menutab_impl.cpp
@@ -170,10 +170,12 @@ void MenuTab::load( bool useDefaults )
void MenuTab::menuStyleChanged()
{
+ // Classic K Menu
if (m_comboMenuStyle->currentItem()==1) {
m_openOnHover->setEnabled(false);
m_subMenus->setEnabled(true);
kcfg_UseSidePixmap->setEnabled(true);
+ kcfg_UseTooltip->setEnabled(true);
kcfg_MenuEntryFormat->setEnabled(true);
kcfg_RecentVsOften->setEnabled(true);
m_showFrequent->setEnabled(true);
@@ -182,10 +184,13 @@ void MenuTab::menuStyleChanged()
maxrecentdocs->setEnabled(true);
kcfg_NumVisibleEntries->setEnabled(true);
}
+
+ // Kickoff Menu
else {
m_openOnHover->setEnabled(true);
m_subMenus->setEnabled(false);
kcfg_UseSidePixmap->setEnabled(false);
+ kcfg_UseTooltip->setEnabled(false);
kcfg_MenuEntryFormat->setEnabled(false);
kcfg_RecentVsOften->setEnabled(false);
m_showFrequent->setEnabled(false);
@@ -244,6 +249,13 @@ void MenuTab::save()
forceRestart = true;
}
+ bool tooltipsetting = kcfg_UseTooltip->isChecked();
+ bool oldtooltipsetting = c->readBoolEntry("UseTooltip", false);
+
+ if (tooltipsetting != oldtooltipsetting) {
+ forceRestart = true;
+ }
+
// Save KMenu settings
c->setGroup("KMenu");
c->writeEntry("CustomIcon", m_kmenu_icon);
diff --git a/kicker/kicker/ui/service_mnu.cpp b/kicker/kicker/ui/service_mnu.cpp
index 8dcc2fbde..0f2526841 100644
--- a/kicker/kicker/ui/service_mnu.cpp
+++ b/kicker/kicker/ui/service_mnu.cpp
@@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <tqpixmap.h>
#include <tqimage.h>
#include <tqmap.h>
+#include <tqtooltip.h>
#include <dcopclient.h>
#include <kapplication.h>
@@ -70,6 +71,7 @@ PanelServiceMenu::PanelServiceMenu(const TQString & label, const TQString & relP
connect(KSycoca::self(), TQT_SIGNAL(databaseChanged()),
TQT_SLOT(slotClearOnClose()));
connect(this, TQT_SIGNAL(aboutToHide()), this, TQT_SLOT(slotClose()));
+ connect(this, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(slotSetTooltip(int)));
}
PanelServiceMenu::~PanelServiceMenu()
@@ -1006,3 +1008,19 @@ void PanelServiceMenu::updateRecentlyUsedApps(KService::Ptr &service)
RecentlyLaunchedApps::the().m_bNeedToUpdate = true;
}
+void PanelServiceMenu::slotSetTooltip(int id)
+{
+ TQToolTip::remove(this);
+ if (KickerSettings::useTooltip() && entryMap_.contains(id) && entryMap_[id]->isType(KST_KService)) {
+ KService::Ptr s(static_cast<KService *>(entryMap_[id].data()));
+ TQString text;
+ if (!s->genericName().isEmpty()) {
+ text = s->genericName();
+ }
+ if (text.isEmpty() && !s->comment().isEmpty()) {
+ text = s->comment();
+ }
+ TQToolTip::add(this, i18n(text.utf8()));
+ }
+}
+
diff --git a/kicker/kicker/ui/service_mnu.h b/kicker/kicker/ui/service_mnu.h
index 44e35a6c2..3d5bcb492 100644
--- a/kicker/kicker/ui/service_mnu.h
+++ b/kicker/kicker/ui/service_mnu.h
@@ -81,6 +81,7 @@ protected slots:
virtual void slotClear();
virtual void configChanged();
virtual void slotClose();
+ void slotSetTooltip(int id);
void slotDragObjectDestroyed();
// for use in Add Applicaton To Panel
diff --git a/kicker/libkicker/kickerSettings.kcfg b/kicker/libkicker/kickerSettings.kcfg
index 7e1e26651..59fa041e9 100644
--- a/kicker/libkicker/kickerSettings.kcfg
+++ b/kicker/libkicker/kickerSettings.kcfg
@@ -359,6 +359,11 @@
<default>true</default>
</entry>
+<entry name="UseTooltip" type="Bool" >
+ <label>Use Tooltip in Kmenu</label>
+ <default>false</default>
+</entry>
+
<entry name="UseSearchBar" type="Bool" >
<label>Show searh field in Kmenu</label>
<default>true</default>