diff options
author | Francois Andriot <francois.andriot@free.fr> | 2013-05-19 16:09:35 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-05-19 16:09:35 +0200 |
commit | 718f6ae321b507dbb5bca737a1d1d486b2b41dc5 (patch) | |
tree | 9addd0db5d4efd71789c04d9151049afb7fe5b59 /kicker/kicker/ui/service_mnu.cpp | |
parent | fa33b95995f81283ba6fb9226db96827e7994fde (diff) | |
download | tdebase-718f6ae321b507dbb5bca737a1d1d486b2b41dc5.tar.gz tdebase-718f6ae321b507dbb5bca737a1d1d486b2b41dc5.zip |
Add tooltip support in KMenu
Diffstat (limited to 'kicker/kicker/ui/service_mnu.cpp')
-rw-r--r-- | kicker/kicker/ui/service_mnu.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/kicker/kicker/ui/service_mnu.cpp b/kicker/kicker/ui/service_mnu.cpp index 6e3d7beda..ed8b4edda 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 <tdeapplication.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())); + } +} + |