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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Nov 13 15:02:32 UTC 2007


Revision: 2215
          http://rkward.svn.sourceforge.net/rkward/?rev=2215&view=rev
Author:   tfry
Date:     2007-11-13 07:02:31 -0800 (Tue, 13 Nov 2007)

Log Message:
-----------
More Qt3 support code removed, and use a KDialog for RKProgressControl

Modified Paths:
--------------
    branches/KDE4_port/rkward/dialogs/rkloadlibsdialog.cpp
    branches/KDE4_port/rkward/misc/multistringselector.cpp
    branches/KDE4_port/rkward/misc/multistringselector.h
    branches/KDE4_port/rkward/misc/rkcanceldialog.cpp
    branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp
    branches/KDE4_port/rkward/misc/rkprogresscontrol.h
    branches/KDE4_port/rkward/rbackend/rcommand.cpp
    branches/KDE4_port/rkward/rbackend/rklocalesupport.cpp
    branches/KDE4_port/rkward/robjectviewer.cpp
    branches/KDE4_port/rkward/robjectviewer.h
    branches/KDE4_port/rkward/windows/rkcommandlog.cpp

Modified: branches/KDE4_port/rkward/dialogs/rkloadlibsdialog.cpp
===================================================================
--- branches/KDE4_port/rkward/dialogs/rkloadlibsdialog.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/dialogs/rkloadlibsdialog.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -231,6 +231,7 @@
 
 void RKLoadLibsDialog::installationProcessOutput (K3Process *, char *buffer, int buflen) {
 	RK_TRACE (DIALOGS);
+#warning We seem to handle newlines badly, here. But then, we need to port to QProcess, anyway.
 	emit (installationOutput (Q3CString (buffer, buflen)));
 }
 

Modified: branches/KDE4_port/rkward/misc/multistringselector.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/multistringselector.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/misc/multistringselector.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -17,13 +17,12 @@
 
 #include "multistringselector.h"
 
-#include <q3listview.h>
+#include <QTreeWidget>
 #include <qpushbutton.h>
 #include <qlayout.h>
 #include <qlabel.h>
-//Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <Q3VBoxLayout>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
 
 #include <klocale.h>
 
@@ -33,20 +32,23 @@
 MultiStringSelector::MultiStringSelector (const QString& label, QWidget* parent) : QWidget (parent) {
 	RK_TRACE (MISC);
 
-	Q3HBoxLayout *hbox = new Q3HBoxLayout (this, RKGlobals::spacingHint ());
+	QHBoxLayout *hbox = new QHBoxLayout (this);
+	hbox->setContentsMargins (0, 0, 0, 0);
 
-	Q3VBoxLayout *main_box = new Q3VBoxLayout (hbox, RKGlobals::spacingHint ());
-	Q3VBoxLayout *button_box = new Q3VBoxLayout (hbox, RKGlobals::spacingHint ());
+	QVBoxLayout *main_box = new QVBoxLayout (hbox);
+	main_box->setContentsMargins (0, 0, 0, 0);
+	QVBoxLayout *button_box = new QVBoxLayout (hbox);
+	button_box->setContentsMargins (0, 0, 0, 0);
 
 	QLabel *label_widget = new QLabel (label, this);
 	main_box->addWidget (label_widget);
 
-	list_view = new Q3ListView (this);
-	list_view->addColumn (i18n ("Filename"));
-	list_view->setSelectionMode (Q3ListView::Single);
-	list_view->setSorting (-1);
-	connect (list_view, SIGNAL (selectionChanged ()), this, SLOT (listSelectionChanged ()));
-	main_box->addWidget (list_view);
+	tree_view = new QTreeWidget (this);
+	tree_view->setHeaderLabel (i18n ("Filename"));
+	tree_view->setSelectionMode (QAbstractItemView::SingleSelection);
+	tree_view->setSortingEnabled (false);
+	connect (tree_view, SIGNAL (itemSelectionChanged ()), this, SLOT (listSelectionChanged ()));
+	main_box->addWidget (tree_view);
 
 	add_button = new QPushButton (i18n ("Add"), this);
 	connect (add_button, SIGNAL (clicked ()), this, SLOT (addButtonClicked ()));
@@ -79,11 +81,11 @@
 	RK_TRACE (MISC);
 
 	QStringList list;
-	Q3ListViewItem *item = list_view->firstChild ();
-	
-	while (item) {
+	for (int i = 0; i < tree_view->topLevelItemCount (); ++i) {
+		QTreeWidgetItem* item = tree_view->topLevelItem (i);
+		RK_ASSERT (item);
 		list.append (item->text (0));
-		item = item->nextSibling ();
+
 	}
 
 	return list;
@@ -92,9 +94,9 @@
 void MultiStringSelector::setValues (const QStringList& values) {
 	RK_TRACE (MISC);
 
-	list_view->clear ();
+	tree_view->clear ();
 	for (QStringList::const_iterator it = values.begin (); it != values.end (); ++it) {
-		Q3ListViewItem *item = new Q3ListViewItem (list_view, list_view->lastItem ());
+		QTreeWidgetItem* item = new QTreeWidgetItem (tree_view);
 		item->setText (0, (*it));
 	}
 	listSelectionChanged ();
@@ -104,50 +106,72 @@
 void MultiStringSelector::addButtonClicked () {
 	RK_TRACE (MISC);
 
+	tree_view->setFocus ();
 	QStringList new_strings;
 	emit (getNewStrings (&new_strings));
 	for (QStringList::const_iterator it = new_strings.begin (); it != new_strings.end (); ++it) {
-		Q3ListViewItem *item = new Q3ListViewItem (list_view, list_view->lastItem ());
+		QTreeWidgetItem* item = new QTreeWidgetItem (tree_view);
 		item->setText (0, (*it));
 	}
 	emit (listChanged ());
 	listSelectionChanged ();		// update button states
 }
 
+QTreeWidgetItem* MultiStringSelector::treeSelectedItem () const {
+	RK_TRACE (MISC);
+
+	QList<QTreeWidgetItem *> sel = tree_view->selectedItems ();
+	if (sel.isEmpty ()) return 0;
+	RK_ASSERT (sel.count () == 1);
+	return sel[0];
+}
+
 void MultiStringSelector::removeButtonClicked () {
 	RK_TRACE (MISC);
 
-	delete (list_view->selectedItem ());
+	tree_view->setFocus ();
+	delete (treeSelectedItem ());
 	emit (listChanged ());
 }
 
 void MultiStringSelector::upButtonClicked () {
 	RK_TRACE (MISC);
 
-	Q3ListViewItem *sel = list_view->selectedItem ();
-	RK_ASSERT (sel);
+	tree_view->setFocus ();
+	QTreeWidgetItem* sel = treeSelectedItem ();
+	if (!sel) {
+		RK_ASSERT (false);
+		return;
+	}
+	int pos = tree_view->indexOfTopLevelItem (sel);
+	if (pos <= 0) return;	// already at top
 
-	Q3ListViewItem *above = sel->itemAbove ();
-	if (above) {
-		above->moveItem (sel);
-	}
+	tree_view->insertTopLevelItem (pos - 1, tree_view->takeTopLevelItem (pos));
+	tree_view->setCurrentItem (sel);
 	emit (listChanged ());
 }
 
 void MultiStringSelector::downButtonClicked () {
 	RK_TRACE (MISC);
 
-	Q3ListViewItem *sel = list_view->selectedItem ();
-	RK_ASSERT (sel);
+	tree_view->setFocus ();
+	QTreeWidgetItem* sel = treeSelectedItem ();
+	if (!sel) {
+		RK_ASSERT (false);
+		return;
+	}
+	int pos = tree_view->indexOfTopLevelItem (sel);
+	if (pos >= (tree_view->topLevelItemCount () - 1)) return;	// already at bottom
 
-	if (sel->nextSibling ()) sel->moveItem (sel->nextSibling ());
+	tree_view->insertTopLevelItem (pos + 1, tree_view->takeTopLevelItem (pos));
+	tree_view->setCurrentItem (sel);
 	emit (listChanged ());
 }
 
 void MultiStringSelector::listSelectionChanged () {
 	RK_TRACE (MISC);
 
-	if (list_view->selectedItem ()) {
+	if (treeSelectedItem ()) {
 		remove_button->setEnabled (true);
 		up_button->setEnabled (true);
 		down_button->setEnabled (true);

Modified: branches/KDE4_port/rkward/misc/multistringselector.h
===================================================================
--- branches/KDE4_port/rkward/misc/multistringselector.h	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/misc/multistringselector.h	2007-11-13 15:02:31 UTC (rev 2215)
@@ -22,7 +22,8 @@
 #include <qstringlist.h>
 #include <qstring.h>
 
-class Q3ListView;
+class QTreeWidget;
+class QTreeWidgetItem;
 class QPushButton;
 
 /** This convenience widget allows to select one or more strings (e.g. filenames) and sort them in any order. The function to acutally select new strings to add to the selection is not implemented in this class for more flexibility. Rather, connect to the getNewStrings () signal and assign the desired QString(s) in a custom slot.
@@ -47,7 +48,10 @@
 	void downButtonClicked ();
 	void listSelectionChanged ();
 private:
-	Q3ListView* list_view;
+/** convenience function to get the (single) selected item of the tree_view, or 0 if no item is selected */
+	QTreeWidgetItem* treeSelectedItem () const;
+
+	QTreeWidget* tree_view;
 	QPushButton* add_button;
 	QPushButton* remove_button;
 	QPushButton* up_button;

Modified: branches/KDE4_port/rkward/misc/rkcanceldialog.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/rkcanceldialog.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/misc/rkcanceldialog.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -19,8 +19,7 @@
 #include <qlayout.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
-//Added by qt3to4:
-#include <Q3VBoxLayout>
+#include <QVBoxLayout>
 #include <QCloseEvent>
 
 #include <klocale.h>
@@ -35,7 +34,7 @@
 	RK_TRACE (DIALOGS);
 	setCaption (caption);
 	
-	Q3VBoxLayout *layout = new Q3VBoxLayout (this, KDialog::marginHint (), KDialog::spacingHint ());
+	QVBoxLayout *layout = new QVBoxLayout (this);
 	QLabel *label = new QLabel (text, this);
 	label->setWordWrap (true);
 	layout->addWidget (label);

Modified: branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -17,17 +17,16 @@
 
 #include "rkprogresscontrol.h"
 
+#include <QHBoxLayout>
+#include <QCloseEvent>
+#include <QVBoxLayout>
+
 #include <klocale.h>
 
 #include "../rkglobals.h"
 #include "../rbackend/rinterface.h"
 
 #include "../debug.h"
-//Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <QCloseEvent>
-#include <Q3ValueList>
-#include <Q3VBoxLayout>
 
 RKProgressControl::RKProgressControl (QObject *parent, const QString &text, const QString &caption, int mode_flags) : QObject (parent) {
 	RK_TRACE (MISC);
@@ -146,7 +145,6 @@
 
 	is_done = true;
 	if (dialog) {
-		dialog->setCloseTextToClose ();
 		dialog->done ();
 	}
 
@@ -162,8 +160,8 @@
 	dialog = new RKProgressControlDialog (text, caption, mode, modal);
 	connect (dialog, SIGNAL (destroyed ()), this, SLOT (dialogDestroyed ()));
 	if (is_done) done ();
-	for (Q3ValueList<ROutput>::const_iterator it = output_log.begin (); it != output_log.end (); ++it) {
-		dialog->addOutput (&(*it));
+	for (int i = 0; i < output_log.count (); ++i) {
+		dialog->addOutput (&(output_log[i]));
 	}
 }
 
@@ -189,69 +187,63 @@
 //////////////////////////// RKProgressControlDialog ///////////////////////////////////////////7
 
 #include <qlayout.h>
-#include <q3textedit.h>
+#include <QTextEdit>
 #include <qlabel.h>
-#include <qpushbutton.h>
-#include <q3vbox.h>
 
-RKProgressControlDialog::RKProgressControlDialog (const QString &text, const QString &caption, int mode_flags, bool modal) : QDialog (0, 0, modal, Qt::WDestructiveClose) {
+#include <kvbox.h>
+#include <kstandardguiitem.h>
+
+RKProgressControlDialog::RKProgressControlDialog (const QString &text, const QString &caption, int mode_flags, bool modal) : KDialog (0, Qt::WDestructiveClose) {
 	RK_TRACE (MISC);
 
+	setModal (modal);
 	setCaption (caption);
 
-	Q3VBoxLayout *vbox = new Q3VBoxLayout (this, RKGlobals::marginHint (), RKGlobals::spacingHint ());
+	KVBox *vbox = new KVBox (this);
+	setMainWidget (vbox);
 
-	QLabel *label = new QLabel (text, this);
+	QLabel *label = new QLabel (text, vbox);
 	label->setWordWrap (true);
-	vbox->addWidget (label);
 
-	error_indicator = new QLabel (i18n ("<b>There have been errors and / or warnings! See below for a transcript</b>"), this);
+	error_indicator = new QLabel (i18n ("<b>There have been errors and / or warnings! See below for a transcript</b>"), vbox);
 	error_indicator->setPaletteForegroundColor (QColor (255, 0, 0));
 	error_indicator->hide ();
-	vbox->addWidget (error_indicator);
 
-	output_box = new Q3VBox (this);
-	vbox->addWidget (output_box);
+	output_box = new KVBox ();
 	if (mode_flags & (RKProgressControl::IncludeErrorOutput | RKProgressControl::IncludeRegularOutput)) {
 		QString ocaption;
 		if (mode_flags & RKProgressControl::IncludeRegularOutput) {
-			show_output_text = i18n ("Show Output");
-			hide_output_text = i18n ("Hide Output");
+			output_button_text = i18n ("Output");
 			ocaption = i18n ("Output:");
 		} else {
-			show_output_text = i18n ("Show Errors / Warnings");
-			hide_output_text = i18n ("Hide Errors / Warnings");
+			output_button_text = i18n ("Errors / Warnings");
 			ocaption = i18n ("Errors / Warnings:");
 		}
 		output_caption = new QLabel (ocaption, output_box);
 
-		output_text = new Q3TextEdit (output_box);
+		output_text = new QTextEdit (output_box);
 		output_text->setReadOnly (true);
-		output_text->setTextFormat (Qt::PlainText);
+		output_text->setPlainText (QString ());
 		output_text->setUndoRedoEnabled (false);
 
 		if (!(mode_flags & RKProgressControl::OutputShownByDefault)) {
 			output_box->hide ();
 		}
 	}
+	setDetailsWidget (output_box);
 
-	Q3HBoxLayout *button_layout = new Q3HBoxLayout (0, 0, RKGlobals::spacingHint ());
-	vbox->addLayout (button_layout);
+	KDialog::ButtonCodes button_codes = KDialog::Cancel;
+	if (mode_flags & RKProgressControl::OutputSwitchable) button_codes |= KDialog::Details;
+	setButtons (button_codes);
+	setButtonText (KDialog::Details, output_button_text);
+	if (mode_flags & RKProgressControl::AllowCancel) setButtonText (KDialog::Cancel, i18n ("Cancel"));
+	else (setCloseTextToClose ());
 
-	toggle_output_button = new QPushButton (show_output_text, this);
-	if (!(mode_flags & RKProgressControl::OutputSwitchable)) toggle_output_button->hide ();
-	if (mode_flags & RKProgressControl::OutputShownByDefault) toggle_output_button->setText (hide_output_text);
-	connect (toggle_output_button, SIGNAL (clicked ()), this, SLOT (toggleOutputButtonPressed ()));
-	button_layout->addWidget (toggle_output_button);
-	button_layout->addStretch ();
+	setDetailsWidgetVisible (mode_flags & RKProgressControl::OutputShownByDefault);
 
-	close_button = new QPushButton (QString::null, this);
-	if (mode_flags & RKProgressControl::AllowCancel) close_button->setText (i18n ("Cancel"));
-	else setCloseTextToClose ();
-	connect (close_button, SIGNAL (clicked ()), this, SLOT (reject ()));
-	button_layout->addWidget (close_button);
-
 	prevent_close = (mode_flags & RKProgressControl::PreventClose);
+
+	last_output_type = ROutput::Output;
 	is_done = false;
 }
 
@@ -262,38 +254,33 @@
 void RKProgressControlDialog::addOutput (const ROutput *output) {
 	RK_TRACE (MISC);
 
-	if (output->type != ROutput::Output) {
-		output_text->setColor (Qt::red);
-		if (!output_box->isShown ()) toggleOutputButtonPressed ();
-		error_indicator->show ();
+	if (output->type != last_output_type) {
+		output_text->insertPlainText ("\n");
+
+		if (output->type == ROutput::Output) {
+			output_text->setColor (Qt::black);
+		} else {
+			output_text->setColor (Qt::red);
+			setDetailsWidgetVisible (true);
+			error_indicator->show ();
+		}
 	}
 
-	output_text->append (output->output);
-	output_text->setColor (Qt::black);
+	output_text->insertPlainText (output->output);
 }
 
 void RKProgressControlDialog::setCloseTextToClose () {
 	RK_TRACE (MISC);
 
-	close_button->setText (i18n ("Done"));
+	setButtonGuiItem (KDialog::Cancel, KStandardGuiItem::ok ());
+	setButtonText (KDialog::Cancel, i18n ("Done"));
 }
 
-void RKProgressControlDialog::toggleOutputButtonPressed () {
-	RK_TRACE (MISC);
-
-	if (output_box->isShown ()) {
-		output_box->hide ();
-		toggle_output_button->setText (show_output_text);
-	} else {
-		output_box->show ();
-		toggle_output_button->setText (hide_output_text);
-	}
-}
-
 void RKProgressControlDialog::done () {
 	RK_TRACE (MISC);
 
 	is_done = true;
+	setCloseTextToClose ();
 	if (!output_box->isShown ()) reject ();
 }
 
@@ -303,7 +290,7 @@
 	if (prevent_close && (!is_done)) {
 		e->ignore ();
 	} else {
-		QDialog::closeEvent (e);
+		KDialog::closeEvent (e);
 	}
 }
 

Modified: branches/KDE4_port/rkward/misc/rkprogresscontrol.h
===================================================================
--- branches/KDE4_port/rkward/misc/rkprogresscontrol.h	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/misc/rkprogresscontrol.h	2007-11-13 15:02:31 UTC (rev 2215)
@@ -18,19 +18,17 @@
 #define RKPROGRESSCONTROL_H
 
 #include <qobject.h>
-//Added by qt3to4:
-#include <QLabel>
-#include <Q3ValueList>
-#include <QCloseEvent>
-#include "../rbackend/rcommandreceiver.h"
-
+#include <QList>
 #include <qstring.h>
-#include <qdialog.h>
+#include <kdialog.h>
 
+#include "../rbackend/rcommandreceiver.h"
+
+class QCloseEvent;
 class QDialog;
 class QLabel;
-class Q3TextEdit;
-class Q3VBox;
+class QTextEdit;
+class KVBox;
 
 class RKProgressControlDialog;
 
@@ -96,7 +94,7 @@
 	void createDialog ();
 
 	RKProgressControlDialog *dialog;
-	Q3ValueList<ROutput> output_log;
+	QList<ROutput> output_log;
 
 	RCommand *done_command;
 
@@ -112,8 +110,7 @@
 };
 
 /** This class provides the dialog shown as part of an RKProgressControl. Generally you should not use this class directly, but rather use RKProgressControl. */
-class RKProgressControlDialog : public QDialog {
-	Q_OBJECT
+class RKProgressControlDialog : public KDialog {
 public:
 /** constructor. */
 	RKProgressControlDialog (const QString &text, const QString &caption, int mode_flags, bool modal);
@@ -123,22 +120,17 @@
 	void addOutput (const ROutput *output);
 	void setCloseTextToClose ();
 	void done ();
-public slots:
-	void toggleOutputButtonPressed ();
 protected:
 	void closeEvent (QCloseEvent *e);
 private:
 	QLabel *output_caption;
 	QLabel *error_indicator;
-	Q3TextEdit *output_text;
-	Q3VBox *output_box;
+	QTextEdit *output_text;
+	KVBox *output_box;
 
-	QString show_output_text;
-	QString hide_output_text;
+	QString output_button_text;
 
-	QPushButton *close_button;
-	QPushButton *toggle_output_button;
-
+	ROutput::ROutputType last_output_type;
 	bool prevent_close;
 	bool is_done;
 };

Modified: branches/KDE4_port/rkward/rbackend/rcommand.cpp
===================================================================
--- branches/KDE4_port/rkward/rbackend/rcommand.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/rbackend/rcommand.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -22,8 +22,6 @@
 
 #include "../debug.h"
 #include "../rkglobals.h"
-//Added by qt3to4:
-#include <Q3ValueList>
 
 #define MAX_RECEIVERS 3
 

Modified: branches/KDE4_port/rkward/rbackend/rklocalesupport.cpp
===================================================================
--- branches/KDE4_port/rkward/rbackend/rklocalesupport.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/rbackend/rklocalesupport.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -25,8 +25,7 @@
 #include <ctype.h>
 
 #include <qtextcodec.h>
-//Added by qt3to4:
-#include <Q3CString>
+#include <QByteArray>
 
 /* NOTE: The code in this file is an almost literal copy taken from setupLocaleMapper in qtextcodec.cpp in Qt 3.3.8 !*/
 
@@ -35,7 +34,7 @@
     if (!c) {
         const char *at = strchr(name, '@');
         if (at) {
-            Q3CString n(name, at - name + 1);
+            QByteArray n(name, at - name);
             c = QTextCodec::codecForName(n.data());
         }
     }
@@ -122,7 +121,7 @@
 static QTextCodec * ru_RU_hack( const char * i ) {
     QTextCodec * ru_RU_codec = 0;
 
-    Q3CString origlocale = setlocale( LC_CTYPE, i );
+    QByteArray origlocale(setlocale(LC_CTYPE, i));
     // unicode   koi8r   latin5   name
     // 0x044E    0xC0    0xEE     CYRILLIC SMALL LETTER YU
     // 0x042E    0xE0    0xCE     CYRILLIC CAPITAL LETTER YU

Modified: branches/KDE4_port/rkward/robjectviewer.cpp
===================================================================
--- branches/KDE4_port/rkward/robjectviewer.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/robjectviewer.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -17,18 +17,17 @@
 #include "robjectviewer.h"
 
 #include <qlayout.h>
-#include <q3scrollview.h>
-#include <q3vbox.h>
-#include <q3hbox.h>
+#include <QScrollArea>
 #include <qlabel.h>
-#include <q3textedit.h>
+#include <QTextEdit>
 #include <qfont.h>
 #include <QPushButton>
-//Added by qt3to4:
-#include <Q3VBoxLayout>
 #include <QCloseEvent>
+#include <QVBoxLayout>
 
 #include <klocale.h>
+#include <kvbox.h>
+#include <khbox.h>
 #include <kglobalsettings.h>
 
 #include "rbackend/rinterface.h"
@@ -52,20 +51,21 @@
 	addNotificationType (RObjectListener::ObjectRemoved);
 	listenForObject (_object);
 
-	Q3VBoxLayout *layout = new Q3VBoxLayout (this);
-	Q3ScrollView *wrapper = new Q3ScrollView (this);
-	wrapper->setResizePolicy (Q3ScrollView::AutoOneFit);
-	Q3VBox *box = new Q3VBox (wrapper->viewport ());
-	wrapper->addChild (box);
+	QVBoxLayout *layout = new QVBoxLayout (this);
+	layout->setContentsMargins (0, 0, 0, 0);
+	QScrollArea *wrapper = new QScrollArea (this);
+	wrapper->setWidgetResizable (true);
+	KVBox *box = new KVBox (wrapper);
+	wrapper->setWidget (box);
 	layout->addWidget (wrapper);
 
 	wrapper->setFocusPolicy (Qt::StrongFocus);
 	setPart (new RKDummyPart (this, wrapper));
 	initializeActivationSignals ();
 
-	Q3HBox *toprow = new Q3HBox (box);
+	KHBox *toprow = new KHBox (box);
 	description_label = new QLabel (toprow);
-	Q3VBox *statusbox = new Q3VBox (toprow);
+	KVBox *statusbox = new KVBox (toprow);
 	statusbox->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
 	status_label = new QLabel (statusbox);
 	update_button = new QPushButton (i18n ("Update"), statusbox);
@@ -73,27 +73,25 @@
 	connect (update_button, SIGNAL (clicked ()), this, SLOT (update ()));
 	connect (cancel_button, SIGNAL (clicked ()), this, SLOT (cancel ()));
 
-	Q3HBox *row = new Q3HBox (box);
+	KHBox *row = new KHBox (box);
 	QLabel *label = new QLabel (i18n("\nResult of 'summary (%1)':\n", object->getFullName ()), row);
 	row->setStretchFactor (label, 10);
 	toggle_summary_button = new QPushButton (i18n ("Hide"), row);
 	connect (toggle_summary_button, SIGNAL (clicked ()), this, SLOT (toggleSummary ()));
 
-	summary_area = new Q3TextEdit (box);
-	summary_area->setTextFormat (Qt::PlainText);
+	summary_area = new QTextEdit (box);
 	summary_area->setReadOnly (true);
-	summary_area->setWordWrap (Q3TextEdit::NoWrap);
+	summary_area->setLineWrapMode (QTextEdit::NoWrap);
 
-	row = new Q3HBox (box);
+	row = new KHBox (box);
 	label = new QLabel (i18n("\nResult of 'print (%1)':\n", object->getFullName ()), row);
 	row->setStretchFactor (label, 10);
 	toggle_print_button = new QPushButton (i18n ("Hide"), row);
 	connect (toggle_print_button, SIGNAL (clicked ()), this, SLOT (togglePrint ()));
 
-	print_area = new Q3TextEdit (box);
-	print_area->setTextFormat (Qt::PlainText);
+	print_area = new QTextEdit (box);
 	print_area->setReadOnly (true);
-	print_area->setWordWrap (Q3TextEdit::NoWrap);
+	print_area->setLineWrapMode (QTextEdit::NoWrap);
 
 	setCaption (i18n("Object Viewer: ") + object->getShortName ());
 	//resize (minimumSizeHint ().expandedTo (QSize (640, 480)));
@@ -146,8 +144,8 @@
 	update_button->setEnabled (false);
 	description_label->setText (_object->getObjectDescription ());
 
-	summary_area->setText (QString::null);
-	print_area->setText (QString::null);
+	summary_area->setPlainText (QString::null);
+	print_area->setPlainText (QString::null);
 	QFont font = KGlobalSettings::fixedFont ();
 	summary_area->setCurrentFont (font);
 	print_area->setCurrentFont (font);
@@ -183,9 +181,9 @@
 	RK_ASSERT (command);
 
 	if (command->getFlags () == SUMMARY_COMMAND) {
-		summary_area->append (command->fullOutput ());
+		summary_area->insertPlainText (command->fullOutput ());
 	} else if (command->getFlags () == PRINT_COMMAND) {
-		print_area->append (command->fullOutput ());
+		print_area->insertPlainText (command->fullOutput ());
 		status_label->setText (i18n ("Ready"));
 		update_button->setEnabled (true);
 		cancel_button->setEnabled (false);

Modified: branches/KDE4_port/rkward/robjectviewer.h
===================================================================
--- branches/KDE4_port/rkward/robjectviewer.h	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/robjectviewer.h	2007-11-13 15:02:31 UTC (rev 2215)
@@ -19,16 +19,13 @@
 
 #include <qwidget.h>
 #include <qstring.h>
-//Added by qt3to4:
-#include <QCloseEvent>
-#include <QLabel>
 
 #include "rbackend/rcommandreceiver.h"
 #include "core/rkmodificationtracker.h"
 #include "windows/rkmdiwindow.h"
 
 class RObject;
-class Q3TextEdit;
+class QTextEdit;
 class QCloseEvent;
 class QLabel;
 class QPushButton;
@@ -63,8 +60,8 @@
 	QPushButton *cancel_button;
 	QPushButton *toggle_summary_button;
 	QPushButton *toggle_print_button;
-	Q3TextEdit *print_area;
-	Q3TextEdit *summary_area;
+	QTextEdit *print_area;
+	QTextEdit *summary_area;
 	QString caption;
 
 	RObject *_object;

Modified: branches/KDE4_port/rkward/windows/rkcommandlog.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkcommandlog.cpp	2007-11-13 01:32:05 UTC (rev 2214)
+++ branches/KDE4_port/rkward/windows/rkcommandlog.cpp	2007-11-13 15:02:31 UTC (rev 2215)
@@ -96,7 +96,7 @@
 
 	log_view->setFontItalic (true);
 
-	log_view->insert (command->command () + '\n');
+	log_view->insertPlainText (command->command () + '\n');
 
 	checkRaiseWindow (command);
 	linesAdded ();
@@ -123,7 +123,7 @@
 		log_view->textCursor ().mergeBlockFormat (f);
 	}
 
-	log_view->insert (output->output);
+	log_view->insertPlainText (output->output);
 
 	if (output->type != ROutput::Output) {
 		QTextBlockFormat f;
@@ -189,7 +189,7 @@
 		}
 	}
 
-	if (RKSettingsModuleWatch::shouldShowOutput (command)) log_view->insert ("\n");
+	if (RKSettingsModuleWatch::shouldShowOutput (command)) log_view->insertPlainText ("\n");
 }
 
 void RKCommandLog::settingsChanged (RKSettings::SettingsPage page) {


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