[rkward-cvs] SF.net SVN: rkward: [2236] branches/KDE4_port

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Nov 18 18:12:43 UTC 2007


Revision: 2236
          http://rkward.svn.sourceforge.net/rkward/?rev=2236&view=rev
Author:   tfry
Date:     2007-11-18 10:12:43 -0800 (Sun, 18 Nov 2007)

Log Message:
-----------
Make data.frame editor udpate its caption when the object is renamed

Modified Paths:
--------------
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/dataeditor/twintable.cpp
    branches/KDE4_port/rkward/dataeditor/twintable.h

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-11-18 17:49:37 UTC (rev 2235)
+++ branches/KDE4_port/TODO_KDE4	2007-11-18 18:12:43 UTC (rev 2236)
@@ -35,13 +35,6 @@
 			- Can't do any thing about this. It part of the katepart.
 	- placement of menu options?
 
-rkward
-	- does closing windows work
-		+ seems to..
-	- does updating captions work (when switching windows / window url changes)?
-		+ seems to..
-		- probably still need to make data.editor update its caption when name changed
-
 output window
 	- does it reload all changed images?
 

Modified: branches/KDE4_port/rkward/dataeditor/twintable.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintable.cpp	2007-11-18 17:49:37 UTC (rev 2235)
+++ branches/KDE4_port/rkward/dataeditor/twintable.cpp	2007-11-18 18:12:43 UTC (rev 2236)
@@ -33,9 +33,11 @@
 
 #include "../debug.h"
 
-TwinTable::TwinTable (QWidget *parent) : RKEditor (parent) {
+TwinTable::TwinTable (QWidget *parent) : RKEditor (parent), RObjectListener (RObjectListener::Other) {
 	RK_TRACE (EDITOR);
 
+	main_object = 0;
+
 	QVBoxLayout *layout = new QVBoxLayout(this);
 	layout->setContentsMargins (0, 0, 0, 0);
 	
@@ -89,6 +91,8 @@
 TwinTable::~TwinTable() {
 	RK_TRACE (EDITOR);
 
+	RK_ASSERT (main_object);
+	stopListenForObject (main_object);
 // TODO: are the models auto-destructed?
 }
 
@@ -96,6 +100,7 @@
 	RK_TRACE (EDITOR);
 
 	datamodel = model;
+	main_object = object;
 	dataview->setRKModel (model);
 	metaview->setRKModel (model->getMetaModel ());
 	model->setEditor (this);
@@ -106,9 +111,19 @@
 	metaview->setMaximumHeight (metaview->rowHeight (0) * 5 + metaview->horizontalHeader ()->height () + 5);
 	dataview->verticalHeader ()->setFixedWidth (metaview->verticalHeader ()->width ());
 
-	setCaption (object->getShortName ());
+// init caption
+	addNotificationType (RObjectListener::MetaChanged);
+	listenForObject (object);
+	objectMetaChanged (object);
 }
 
+void TwinTable::objectMetaChanged (RObject* changed) {
+	RK_TRACE (EDITOR);
+
+	RK_ASSERT (changed == main_object);
+	setCaption (main_object->getShortName ());
+}
+
 void TwinTable::metaHeaderPressed (int section) {
 	RK_TRACE (EDITOR);
 

Modified: branches/KDE4_port/rkward/dataeditor/twintable.h
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintable.h	2007-11-18 17:49:37 UTC (rev 2235)
+++ branches/KDE4_port/rkward/dataeditor/twintable.h	2007-11-18 18:12:43 UTC (rev 2236)
@@ -23,6 +23,8 @@
 #include <qstring.h>
 #include <QItemSelection>
 
+#include "../core/rkmodificationtracker.h"
+
 class TwinTableMember;
 class QMenu;
 class RKVarEditModel;
@@ -31,7 +33,7 @@
   *@author Thomas Friedrichsmeier
   */
 
-class TwinTable : public RKEditor {
+class TwinTable : public RKEditor, public RObjectListener {
 	Q_OBJECT
 public: 
 	TwinTable (QWidget *parent=0);
@@ -81,6 +83,11 @@
 	QAction* action_insert_row_below;
 	QAction* action_delete_row;
 	QAction* action_delete_rows;
+
+/** receives object meta change notifications. This updates the caption */
+	void objectMetaChanged (RObject* changed);
+
+	RObject* main_object;
 private slots:
 /** inserts a new column (NOTE the action connected to this signal carries the info, where the column is to be inserted) */
 	void insertColumn ();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list