[rkward-cvs] SF.net SVN: rkward: [2264] branches/KDE4_port/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Thu Nov 22 13:58:17 UTC 2007
Revision: 2264
http://rkward.svn.sourceforge.net/rkward/?rev=2264&view=rev
Author: tfry
Date: 2007-11-22 05:58:17 -0800 (Thu, 22 Nov 2007)
Log Message:
-----------
Make RObjectViewer listen for meta and data changes
Modified Paths:
--------------
branches/KDE4_port/rkward/robjectviewer.cpp
branches/KDE4_port/rkward/robjectviewer.h
Modified: branches/KDE4_port/rkward/robjectviewer.cpp
===================================================================
--- branches/KDE4_port/rkward/robjectviewer.cpp 2007-11-22 13:42:56 UTC (rev 2263)
+++ branches/KDE4_port/rkward/robjectviewer.cpp 2007-11-22 13:58:17 UTC (rev 2264)
@@ -39,19 +39,19 @@
#include "debug.h"
RObjectViewer::RObjectViewer (QWidget *parent, RObject *object, ViewerPage initial_page) : RKMDIWindow (parent, RKMDIWindow::ObjectWindow, false), RObjectListener (RObjectListener::ObjectView) {
-// KDE 4: TODO might listen for object meta / data changes as well
RK_TRACE (APP);
RK_ASSERT (object);
_object = object;
addNotificationType (RObjectListener::ObjectRemoved);
+ addNotificationType (RObjectListener::MetaChanged);
+ addNotificationType (RObjectListener::DataChanged);
listenForObject (_object);
QVBoxLayout *layout = new QVBoxLayout (this);
layout->setContentsMargins (0, 0, 0, 0);
- // TODO: what an ugly hack... This should be the job of RObject::getObjectDescription().
- description_label = new QLabel ("<nobr>" + _object->getObjectDescription ().replace ("<br>", " -</nobr> <nobr>") + "</nobr>", this);
+ description_label = new QLabel (this);
description_label->setWordWrap (true);
layout->addWidget (description_label);
status_label = new QLabel (this);
@@ -71,7 +71,7 @@
currentTabChanged (initial_page);
connect (tabs, SIGNAL (currentChanged(int)), this, SLOT (currentTabChanged (int)));
- setCaption (i18n("Object Viewer: ") + object->getShortName ());
+ initDescription (false);
}
RObjectViewer::~RObjectViewer () {
@@ -104,6 +104,41 @@
}
}
+void RObjectViewer::objectMetaChanged (RObject* object) {
+ RK_TRACE (APP);
+
+ if (object == _object) {
+ initDescription (true);
+ } else {
+ RK_ASSERT (false);
+ }
+}
+
+void RObjectViewer::objectDataChanged (RObject* object) {
+ RK_TRACE (APP);
+
+ if (object == _object) {
+ initDescription (true);
+ } else {
+ RK_ASSERT (false);
+ }
+}
+
+void RObjectViewer::initDescription (bool notify) {
+ RK_TRACE (APP);
+
+ if (!_object) return;
+
+ setCaption (i18n("Object Viewer: %1", _object->getShortName ()));
+ // TODO: what an ugly hack... This should be the job of RObject::getObjectDescription().
+ description_label->setText ("<nobr>" + _object->getObjectDescription ().replace ("<br>", " -</nobr> <nobr>") + "</nobr>");
+ if (notify) {
+ QString reason = i18n ("The object was changed. You may want to click \"Update\"");
+ summary_widget->invalidate (reason);
+ print_widget->invalidate (reason);
+ }
+}
+
void RObjectViewer::currentTabChanged (int new_current) {
RK_TRACE (APP);
Modified: branches/KDE4_port/rkward/robjectviewer.h
===================================================================
--- branches/KDE4_port/rkward/robjectviewer.h 2007-11-22 13:42:56 UTC (rev 2263)
+++ branches/KDE4_port/rkward/robjectviewer.h 2007-11-22 13:58:17 UTC (rev 2264)
@@ -54,7 +54,11 @@
RObjectViewer (QWidget *parent, RObject *object, ViewerPage initial_page = SummaryPage);
void objectRemoved (RObject *object);
+ void objectMetaChanged (RObject *object);
+ void objectDataChanged (RObject *object);
private:
+ void initDescription (bool notify);
+
QLabel *status_label;
QLabel *description_label;
QTabWidget* tabs;
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