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

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra=5D_braindump/src=3A_Fix=3A_using_the_arrow?=
From:       Cyrille Berger <cberger () cberger ! net>
Date:       2011-06-30 20:49:05
Message-ID: 20110630204905.723C8A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 7c45978ea5b593d2818f7f937127dd7ee13b13a1 by Cyrille Berger.
Committed on 30/06/2011 at 22:43.
Pushed by berger into branch 'master'.

Fix: using the arrow should change the white board as well

BUG: 255793

M  +7    -0    braindump/src/DocumentModel.cpp     
M  +6    -0    braindump/src/DocumentModel.h     
M  +6    -0    braindump/src/SectionsBoxDock.cpp     
M  +1    -0    braindump/src/SectionsBoxDock.h     

http://commits.kde.org/calligra/7c45978ea5b593d2818f7f937127dd7ee13b13a1

diff --git a/braindump/src/DocumentModel.cpp b/braindump/src/DocumentModel.cpp
index 1a59c74..474fcc0 100644
--- a/braindump/src/DocumentModel.cpp
+++ b/braindump/src/DocumentModel.cpp
@@ -128,6 +128,11 @@ bool DocumentModel::setData(const QModelIndex &index, const \
                QVariant &value, int
         m_document->addCommand(section, new RenameSectionCommand(this, section, \
value.toString()));  return true;
       }
+      case ActiveRole: {
+        Section* section = dataFromIndex(index);
+        emit(activeSectionChanged(section));
+        return true;
+      }
     }
   }
   return false;
@@ -306,3 +311,5 @@ void DocumentModel::changeSectionName( Section* _section, const \
QString& _name)  QModelIndex idx = index(_section);
   emit(dataChanged(idx, idx));
 }
+
+#include "DocumentModel.moc"
diff --git a/braindump/src/DocumentModel.h b/braindump/src/DocumentModel.h
index 0b3890f..8156bd4 100644
--- a/braindump/src/DocumentModel.h
+++ b/braindump/src/DocumentModel.h
@@ -27,6 +27,7 @@ class Section;
 class SectionGroup;
 
 class DocumentModel : public KoDocumentSectionModel {
+    Q_OBJECT
   public:
     enum Role {
       SectionPtr = 0x1252BAD
@@ -56,6 +57,11 @@ class DocumentModel : public KoDocumentSectionModel {
     QModelIndex index( SectionGroup* );
     Section* dataFromIndex(const QModelIndex& index) const;
     void* dataToIndex(Section* section) const;
+  signals:
+    /**
+     * This signal is emitted when the active section is changed.
+     */
+    void activeSectionChanged(Section* section);
   private:
     RootSection* m_document;
 };
diff --git a/braindump/src/SectionsBoxDock.cpp b/braindump/src/SectionsBoxDock.cpp
index ab36c3a..7627f1d 100644
--- a/braindump/src/SectionsBoxDock.cpp
+++ b/braindump/src/SectionsBoxDock.cpp
@@ -117,6 +117,7 @@ void SectionsBoxDock::setup(RootSection* document, View* view)
   delete m_model;
   m_model = model;
 
+  connect(m_model, SIGNAL(activeSectionChanged(Section*)), \
SLOT(slotSectionActivated(Section*)));  connect(m_model, SIGNAL(rowsInserted(const \
QModelIndex&, int, int)), SLOT(insertedSection(QModelIndex,int)));  connect(m_model, \
SIGNAL(rowsRemoved(const QModelIndex&, int, int)), SLOT(removedSection()));  
@@ -129,6 +130,11 @@ void SectionsBoxDock::slotSectionActivated(const QModelIndex& \
index)  m_view->setActiveSection(section);
 }
 
+void SectionsBoxDock::slotSectionActivated(Section* section)
+{
+  m_view->setActiveSection(section);
+}
+
 void SectionsBoxDock::slotMinimalView()
 {
   m_wdgSectionsBox.listSections->setDisplayMode(KoDocumentSectionView::MinimalMode);
diff --git a/braindump/src/SectionsBoxDock.h b/braindump/src/SectionsBoxDock.h
index 8bb7912..07c845f 100644
--- a/braindump/src/SectionsBoxDock.h
+++ b/braindump/src/SectionsBoxDock.h
@@ -40,6 +40,7 @@ class SectionsBoxDock : public QDockWidget {
     void updateGUI();
   private slots:
     void slotSectionActivated(const QModelIndex &);
+    void slotSectionActivated(Section*);
     
     void slotMinimalView();
     void slotDetailedView();


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

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