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

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra/stage-outline-bport-artaud=5D_kpresenter/p?=
From:       Benjamin Port <port.benjamin () gmail ! com>
Date:       2011-04-02 11:42:21
Message-ID: 20110402114221.8958EA609B () git ! kde ! org
[Download RAW message or body]

Git commit 753151b0c2e3401842edf09c73119655df5e9b04 by Benjamin Port.
Committed on 02/04/2011 at 13:40.
Pushed by bport into branch 'stage-outline-bport-artaud'.

Add slot synchronize, and now all block have correct user data

M  +14   -1    kpresenter/part/KPrViewModeOutline.cpp     
M  +5    -0    kpresenter/part/KPrViewModeOutline.h     

http://commits.kde.org/calligra/753151b0c2e3401842edf09c73119655df5e9b04

diff --git a/kpresenter/part/KPrViewModeOutline.cpp \
b/kpresenter/part/KPrViewModeOutline.cpp index e1f69a2..53be0d7 100644
--- a/kpresenter/part/KPrViewModeOutline.cpp
+++ b/kpresenter/part/KPrViewModeOutline.cpp
@@ -98,6 +98,8 @@ void KPrViewModeOutline::activate(KoPAViewMode *previousViewMode)
     
     populate();
     
+    // Enable synchronization
+    connect(m_outlineEditor->document(), SIGNAL(contentsChange(int,int,int)), this, \
SLOT(synchronize(int, int, int)));  KoPAView *view = dynamic_cast<KoPAView \
*>(m_view);  if (view) {
         view->hide();
@@ -109,6 +111,7 @@ void KPrViewModeOutline::activate(KoPAViewMode *previousViewMode)
 
 void KPrViewModeOutline::deactivate()
 {
+    disconnect(m_outlineEditor->document(), SIGNAL(contentsChange(int,int,int)), \
this, SLOT(synchronize(int, int, int)));  m_outlineEditor->hide();
      // Active the view as a basic but active one
     m_view->setActionEnabled(KoPAView::AllActions, true);
@@ -148,8 +151,11 @@ void KPrViewModeOutline::populate()
             foreach (OutlinePair pair, page->placeholders().outlineData()) {
                 if (pair.first == Outline) {
                     currentCursor.insertBlock(blockFormat);
-                    currentCursor.block().setUserData(new \
SlideUserBlockData(pageNumber, pair)); +                    int start = \
                currentCursor.blockNumber();
                     \
currentCursor.insertText(pair.second->document()->toPlainText()); +                   \
for(start; start <= currentCursor.blockNumber(); start++){ +                        \
m_outlineEditor->document()->findBlockByNumber(start).setUserData(new \
SlideUserBlockData(pageNumber, pair)); +                    }
                 }
             }
         }
@@ -160,3 +166,10 @@ void KPrViewModeOutline::populate()
 
     m_outlineEditor->setTextCursor(currentCursor);
 }
+
+void KPrViewModeOutline::synchronize(int position, int charsRemoved, int charsAdded)
+{
+    Q_UNUSED(position);
+    Q_UNUSED(charsRemoved);
+    Q_UNUSED(charsAdded);
+}
diff --git a/kpresenter/part/KPrViewModeOutline.h \
b/kpresenter/part/KPrViewModeOutline.h index 3c96bda..45abf74 100644
--- a/kpresenter/part/KPrViewModeOutline.h
+++ b/kpresenter/part/KPrViewModeOutline.h
@@ -33,6 +33,7 @@ class KPrOutlineEditor;
 
 class KPrViewModeOutline : public KoPAViewMode
 {
+    Q_OBJECT
 public:
     KPrViewModeOutline(KoPAView *view, KoPACanvas *canvas);
 
@@ -49,6 +50,7 @@ public:
     void activate(KoPAViewMode *previousViewMode);
     void deactivate();
     void populate();
+
 protected:
     /**
       * Class to manage block data
@@ -68,6 +70,9 @@ protected:
         OutlinePair m_outlinePair;
     };
 
+protected slots:
+    void synchronize(int position, int charsRemoved, int charsAdded);
+
 private:
     KPrOutlineEditor *m_outlineEditor;
 };


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

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