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

List:       kde-commits
Subject:    KDE/kdebase/workspace/systemsettings
From:       Ben Cooksley <sourtooth () gmail ! com>
Date:       2009-08-11 9:00:49
Message-ID: 1249981249.509571.15333.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1009929 by bcooksley:

Move tooltip handling into main application to prevent views from disabling it and \
disobeying global setting

 M  +13 -3     app/SettingsBase.cpp  
 M  +2 -0      app/SettingsBase.h  
 M  +0 -20     core/BaseMode.cpp  
 M  +5 -14     core/BaseMode.h  


--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.cpp #1009928:1009929
@@ -101,6 +101,8 @@
             kWarning() << "View load error: " + error;
         }
     }
+    searchText->completionObject()->setIgnoreCase( true );
+    searchText->completionObject()->setItems( \
BaseData::instance()->menuItem()->keywords() );  changePlugin();
 }
 
@@ -279,11 +281,19 @@
         stackedWidget->addWidget(activeView->mainWidget());
     }
 
+    // Handle the tooltips
+    qDeleteAll( tooltipManagers );
+    tooltipManagers.clear();
+    if ( BaseConfig::showToolTips() ) {
+        QList<QAbstractItemView*> theViews = activeView->views();
+        foreach ( QAbstractItemView* view, theViews ) {
+            tooltipManagers << new ToolTipManager( view );
+        }
+    }
+
     changeAboutMenu( activeView->aboutData(), aboutViewAction, i18n("About Active \
View") );  viewChange(false);
-    searchText->completionObject()->setIgnoreCase( true );
-    searchText->completionObject()->setItems( \
                BaseData::instance()->menuItem()->keywords() );
-    activeView->setEnhancedTooltipEnabled( BaseConfig::showToolTips() );
+
     stackedWidget->setCurrentWidget(activeView->mainWidget());
     updateViewActions();
 
--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.h #1009928:1009929
@@ -22,6 +22,7 @@
 
 #include "MenuItem.h"
 #include "BaseMode.h"
+#include "ToolTipManager.h"
 #include "ui_configDialog.h"
 
 #include <QMap>
@@ -64,6 +65,7 @@
 private:
     // The plugins
     QMap<QString, BaseMode *> possibleViews;
+    QList<ToolTipManager*> tooltipManagers;
     BaseMode * activeView;
     // The search bar
     KLineEdit * searchText;
--- trunk/KDE/kdebase/workspace/systemsettings/core/BaseMode.cpp #1009928:1009929
@@ -29,7 +29,6 @@
 #include "MenuItem.h"
 #include "BaseData.h"
 #include "ModuleView.h"
-#include "ToolTipManager.h"
 
 class BaseMode::Private {
 public:
@@ -39,7 +38,6 @@
     KService::Ptr service;
     MenuItem *rootItem;
     KConfigGroup config;
-    QList<ToolTipManager*> tooltipManagers;
 };
 
 BaseMode::BaseMode( QObject* parent )
@@ -91,29 +89,11 @@
     return d->service;
 }
 
-bool BaseMode::isEnhancedTooltipEnabled() const
-{
-    return !d->tooltipManagers.empty();
-}
-
 void BaseMode::searchChanged( const QString& text )
 {
     Q_UNUSED( text );
 }
 
-void BaseMode::setEnhancedTooltipEnabled( bool enable )
-{
-    QList<QAbstractItemView*> theViews = views();
-    if ( enable && d->tooltipManagers.empty() && !theViews.empty() ) {
-        foreach ( QAbstractItemView* view, theViews ) {
-            d->tooltipManagers << new ToolTipManager( view );
-        }
-    } else if ( !enable && !d->tooltipManagers.empty() ) {
-        qDeleteAll( d->tooltipManagers );
-        d->tooltipManagers.clear();
-    }
-}
-
 void BaseMode::saveState()
 {
 }
--- trunk/KDE/kdebase/workspace/systemsettings/core/BaseMode.h #1009928:1009929
@@ -47,6 +47,11 @@
 {
     Q_OBJECT
 
+    /**
+     * System Settings main application is allowed privilaged access to handle \
tooltips +     */
+    friend class SettingsBase;
+
 public:
     /**
      * Constructs a BaseMode for use in System Settings.\n
@@ -150,14 +155,6 @@
      */
     const KService::Ptr& service() const;
 
-    /**
-     * Returns whether the enhanced tooltip is enabled. This tooltip
-     * can only be enabled when an item view is provided by views().
-     *
-     * @returns true if the enhanced tooltip is enabled.
-     */
-    bool isEnhancedTooltipEnabled() const;
-
 public Q_SLOTS:
     /**
      * Called when the text in the search box changes allowing the display to be \
filtered. @@ -166,12 +163,6 @@
      */
     virtual void searchChanged( const QString& text );
 
-    /**
-     * Enables or disables the enhanced tooltip. The normal tooltip will be shown if \
                this is disabled.
-     * For internal use only.
-     */
-    void setEnhancedTooltipEnabled( bool enable );
-
 Q_SIGNALS:
     /**
      * Triggers a reload of the views actions by the host application.


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

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