[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kdenonbeta/kdedebian/kapture



CVS commit by mornfall: 

Make Kapture a CElemActor. Route celem selection through the Actor
interface as well. Fix the tab captions. Constify CElemAction and pass
is as a const ref. Miracles!


  M +16 -2     kapture/kapture.cpp   1.39
  M +3 -1      kapture/kapture.h   1.19
  M +1 -1      libcapture/celemactor.cpp   1.3
  M +7 -7      libcapture/celemactor.h   1.3
  M +3 -2      libkapture/listtreewidget.cpp   1.38


--- kdenonbeta/kdedebian/kapture/kapture/kapture.cpp  #1.38:1.39
@@ -180,7 +180,9 @@ void Kapture::elemTabChanged (QWidget *w
 void Kapture::showElem (CElemPtr e)
 {
-    if (m_curElemView)
+    if (m_curElemView) {
         m_curElemView -> showElem (e);
-    else
+        m_elemTabs -> changeTab (m_curElemView,
+                m_curElemView -> caption ());
+    } else
         newElemView (e);
 }
@@ -194,4 +196,15 @@ void Kapture::showProgress ()
     m_progressDock -> makeDockVisible ();
 }
+bool Kapture::executeAction (const CElemAction &a)
+{
+    bool ok = false;
+    if (a ("select")) {
+        showElem (a . elem ());
+        ok = true;
+    }
+    if (! ok)
+        ok = DefaultCElemActor::executeAction (a);
+    return ok;
+}
                                                                     /* {{{ */
 void Kapture::closeNodeView ()
@@ -229,4 +242,5 @@ TreeView *Kapture::addView (const char *
             this, SLOT (newElemView (capture::CElemPtr)));
     v -> setCaption (caption);
+    v -> setElemActor (this);
     dock -> manualDock (m_sumDock, KDockWidget::DockCenter);
     return v;

--- kdenonbeta/kdedebian/kapture/kapture/kapture.h  #1.18:1.19
@@ -9,4 +9,5 @@
 #include <apt-pkg/pkgcache.h>
 #include <libcapture/celem.h>
+#include <libcapture/celemactor.h>
 #include <kdockwidget.h>
 
@@ -31,5 +32,5 @@ class TerminalInterface;
 class konsolePart;
 
-class Kapture : public KDockMainWindow
+class Kapture : public KDockMainWindow, capture::DefaultCElemActor
 {
     Q_OBJECT
@@ -38,4 +39,5 @@ class Kapture : public KDockMainWindow
         virtual ~Kapture();
         kapture::TreeView *addView (const char *vt, const char *gt, QString name);
+        bool executeAction (const capture::CElemAction &a);
 
     public slots:

--- kdenonbeta/kdedebian/kapture/libcapture/celemactor.cpp  #1.2:1.3
@@ -26,5 +26,5 @@ CElemActor::ActionVector DefaultCElemAct
 }
 
-bool DefaultCElemActor::executeAction (CElemAction a)
+bool DefaultCElemActor::executeAction (const CElemAction &a)
 {
     bool ok = false;

--- kdenonbeta/kdedebian/kapture/libcapture/celemactor.h  #1.2:1.3
@@ -34,9 +34,9 @@ namespace capture {
                 : m_id (id), m_name (name), m_elem (e)
                 {}
-            bool operator== (const CElemAction &a) { return a . m_elem == m_elem && a . m_id == m_id; }
-            CElemPtr elem () { return m_elem; }
-            bool operator() (std::string i) { return m_id == i; }
-            std::string name () { return m_name; }
-            std::string id () { return m_id; }
+            bool operator== (const CElemAction &a) const { return a . m_elem == m_elem && a . m_id == m_id; }
+            CElemPtr elem () const { return m_elem; }
+            bool operator() (std::string i) const { return m_id == i; }
+            std::string name () const { return m_name; }
+            std::string id () const { return m_id; }
     };
 
@@ -45,5 +45,5 @@ namespace capture {
             typedef std::vector <CElemAction> ActionVector;
             virtual ActionVector listActions (CElemPtr e) = 0;
-            virtual bool executeAction (CElemAction a) = 0;
+            virtual bool executeAction (const CElemAction &a) = 0;
     };
 
@@ -51,5 +51,5 @@ namespace capture {
         public:
             virtual ActionVector listActions (CElemPtr e);
-            virtual bool executeAction (CElemAction a);
+            virtual bool executeAction (const CElemAction &a);
     };
 }

--- kdenonbeta/kdedebian/kapture/libkapture/listtreewidget.cpp  #1.37:1.38
@@ -266,6 +266,7 @@ bool ListTreeWidget::isOpen (std::string
 void ListTreeWidget::forwardSelectionChanged (QListViewItem *i)
 {
-    if (i && i -> isSelectable ()) {
-        KListViewItemCustom *i1 = dynamic_cast<KListViewItemCustom *> (i);
+    if (m_actor && i && i -> isSelectable ()) {
+        CElemPtr e = **(dynamic_cast <KListViewItemCustom *> (i) -> m_treeNode);
+        m_actor -> executeAction (CElemAction ("select", "", e));
         // emit selectionChanged (**(i1 -> m_treeNode));
     }




Reply to: