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

List:       kde-commits
Subject:    KDE/kdelibs/kate/view
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2010-07-06 7:55:43
Message-ID: 20100706080502.2FBB8AC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1146542 by cullmann:

dhaumann:
    make hasBarWidget public, as it's useful if you call removeBarWidget
    Can be used to hide the power search bar


 M  +3 -9      kateviewhelpers.cpp  
 M  +7 -1      kateviewhelpers.h  


--- trunk/KDE/kdelibs/kate/view/kateviewhelpers.cpp #1146541:1146542
@@ -1856,7 +1856,7 @@
 
 void KateViewBar::addBarWidget (KateViewBarWidget *newBarWidget)
 {
-  if (hasWidget(newBarWidget)) {
+  if (hasBarWidget(newBarWidget)) {
     kDebug(13025) << "this bar widget is already added";
     return;
   }
@@ -1926,16 +1926,10 @@
   }
 }
 
-bool KateViewBar::hasWidget(KateViewBarWidget* wid) const
+bool KateViewBar::hasBarWidget(KateViewBarWidget* barWidget) const
 {
-    int count = m_stack->count();
-    for (int i=0; i<count; ++i) {
-        if (m_stack->widget(i) == wid) {
-            return true;
+  return m_stack->indexOf(barWidget) != -1;
         }
-    }
-    return false;
-}
 
 void KateViewBar::hideCurrentBarWidget ()
 {
--- trunk/KDE/kdelibs/kate/view/kateviewhelpers.h #1146541:1146542
@@ -291,6 +291,11 @@
     void removeBarWidget (KateViewBarWidget *barWidget);
 
     /**
+     * @return if viewbar has widget @p barWidget
+     */
+    bool hasBarWidget(KateViewBarWidget* barWidget) const;
+
+    /**
      * Shows barWidget that was previously added with addBarWidget.
      * @see hideCurrentBarWidget
      */
@@ -308,6 +313,7 @@
      * Old widget is not deleted, caller can do it if it wishes
      */
     void addPermanentBarWidget (KateViewBarWidget *barWidget);
+
     /**
      * Removes permanent bar widget from viewbar.
      * If no other viewbar widgets are shown, viewbar gets hidden.
@@ -315,6 +321,7 @@
      * barWidget is not deleted, caller must do it if it wishes
      */
     void removePermanentBarWidget (KateViewBarWidget *barWidget);
+
     /**
      * @return if viewbar has permanent widget @p barWidget
      */
@@ -331,7 +338,6 @@
     virtual void hideEvent(QHideEvent* event);
 
   private:
-    bool hasWidget(KateViewBarWidget*) const;
     /**
      * Shows or hides whole viewbar
      */
[prev in list] [next in list] [prev in thread] [next in thread] 

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