[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeplasma-addons/applets/dict
From:       Artur Duque de Souza <morpheuz () gmail ! com>
Date:       2009-05-20 15:37:36
Message-ID: 1242833856.604041.1469.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 970708 by asouza:

Creating ToolTip for Dict plasmoid

It just contains the name of the applet (calling applet->name() to
avoid new strings due string freeze - and come on, it makes sense ;) ).

I'm not putting the installed sources on the tooltip because it can get
ugly and a mess if someday we have too many sources installed.

Also using init() to handle this creation and other stuff that was being
handled inside constructor.

BUG:183749


 M  +21 -6     dict.cpp  
 M  +1 -0      dict.h  


--- trunk/KDE/kdeplasma-addons/applets/dict/dict.cpp #970707:970708
@@ -42,7 +42,10 @@
 #include <Plasma/LineEdit>
 #include <Plasma/TextBrowser>
 #include <Plasma/Theme>
+#include <Plasma/ToolTipContent>
+#include <Plasma/ToolTipManager>
 
+
 #define AUTO_DEFINE_TIMEOUT 500
 
 using namespace Plasma;
@@ -62,16 +65,28 @@
     , m_dictsModel(0)
       //m_flash(0)
 {
-    const char* dataEngines[]={"dict","qstardict"};
-    bool engineChoice=dataEngine(dataEngines[1])->isValid();
-//     bool engineChoice=false; //for testing
-    m_dataEngine=dataEngines[int(engineChoice)];
-
-    setHasConfigurationInterface(engineChoice);
     setPopupIcon("accessories-dictionary");
     setAspectRatioMode(Plasma::IgnoreAspectRatio);
 }
 
+void DictApplet::init()
+{
+    const char* dataEngines[]={"dict","qstardict"};
+    bool engineChoice = dataEngine(dataEngines[1])->isValid();
+//     bool engineChoice = false; //for testing
+    m_dataEngine = dataEngines[int(engineChoice)];
+    setHasConfigurationInterface(engineChoice);
+
+    // tooltip stuff
+    Plasma::ToolTipContent toolTipData = Plasma::ToolTipContent();
+    toolTipData.setAutohide(true);
+    toolTipData.setMainText(name());
+    toolTipData.setImage(KIcon("accessories-dictionary"));
+
+    Plasma::ToolTipManager::self()->registerWidget(this);
+    Plasma::ToolTipManager::self()->setContent(this, toolTipData);
+}
+
 DictApplet::~DictApplet()
 {
     m_defBrowser->deleteLater();
--- trunk/KDE/kdeplasma-addons/applets/dict/dict.h #970707:970708
@@ -43,6 +43,7 @@
     public:
         DictApplet(QObject *parent, const QVariantList &args);
         ~DictApplet();
+        void init();
 
         QGraphicsWidget *graphicsWidget();
         void setPath(const QString&);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic