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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Nov 13 18:35:47 UTC 2007


Revision: 2217
          http://rkward.svn.sourceforge.net/rkward/?rev=2217&view=rev
Author:   tfry
Date:     2007-11-13 10:35:47 -0800 (Tue, 13 Nov 2007)

Log Message:
-----------
More Qt3 support removals

Modified Paths:
--------------
    branches/KDE4_port/rkward/core/rkvariable.cpp
    branches/KDE4_port/rkward/core/rkvariable.h
    branches/KDE4_port/rkward/dialogs/rkreadlinedialog.cpp
    branches/KDE4_port/rkward/misc/getfilenamewidget.cpp
    branches/KDE4_port/rkward/misc/rkcommonfunctions.cpp
    branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp
    branches/KDE4_port/rkward/misc/rksaveobjectchooser.cpp
    branches/KDE4_port/rkward/misc/xmlhelper.h
    branches/KDE4_port/rkward/rkconsole.cpp

Modified: branches/KDE4_port/rkward/core/rkvariable.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -266,7 +266,6 @@
 	data->formatting_options.precision_mode = FormattingOptions::PrecisionDefault;
 	data->formatting_options.precision = 0;
 	data->previously_valid = true;
-	data->invalid_fields.setAutoDelete (true);
 	data->num_listeners = 0;
 
 	extendToLength (getLength ());
@@ -343,10 +342,10 @@
 void RKVariable::writeInvalidField (int row, RCommandChain *chain) {
 	RK_TRACE (OBJECTS);
 
-	if (data->invalid_fields[row]) {
-		RKGlobals::rInterface ()->issueCommand (".rk.set.invalid.field (" + getFullName () + ", " + QString::number (row+1) + ", " + rQuote (*(data->invalid_fields[row])) + ')', RCommand::App | RCommand::Sync, QString::null, 0,0, chain);
+	if (data->invalid_fields.contains (row)) {
+		RKGlobals::rInterface ()->issueCommand (".rk.set.invalid.field (" + getFullName () + ", " + QString::number (row+1) + ", " + rQuote (data->invalid_fields.value (row)) + ')', RCommand::App | RCommand::Sync, QString::null, 0,0, chain);
 	} else {
-		RKGlobals::rInterface ()->issueCommand (".rk.set.invalid.field (" + getFullName () + ", " + QString::number (row+1) + ", NULL)", RCommand::App | RCommand::Sync, QString::null, 0,0, chain);
+		RKGlobals::rInterface ()->issueCommand (".rk.set.invalid.field (" + getFullName () + ", " + QString::number (row+1) + ", NULL)", RCommand::App | RCommand::Sync, QString (), 0,0, chain);
 	}
 	data->cell_states[row] -= (data->cell_states[row] & RKVarEditData::UnsyncedInvalidState);
 }
@@ -471,8 +470,8 @@
 	}
 
 	if (data->cell_states[row] & RKVarEditData::Invalid) {
-		RK_ASSERT (data->invalid_fields[row] != 0);
-		return (*(data->invalid_fields[row]));
+		RK_ASSERT (data->invalid_fields.contains (row));
+		return (data->invalid_fields.value (row));
 	}
 
 	if (data->cell_states[row] & RKVarEditData::NA) {
@@ -550,7 +549,7 @@
 				data->cell_doubles[row] = text.toInt ();
 				data->cell_states[row] |= RKVarEditData::Valid;
 			} else {
-				data->invalid_fields.replace (row, new QString (text));
+				data->invalid_fields.insert (row, text);
 				data->cell_states[row] |= RKVarEditData::Invalid | RKVarEditData::UnsyncedInvalidState;
 			}
 		} else {
@@ -563,7 +562,7 @@
 				if (ok) {
 					data->cell_states[row] |= RKVarEditData::Valid;
 				} else {
-					data->invalid_fields.replace (row, new QString (text));
+					data->invalid_fields.insert (row, text);
 					data->cell_states[row] |= RKVarEditData::Invalid | RKVarEditData::UnsyncedInvalidState;
 				}
 			}
@@ -718,14 +717,12 @@
 	int offset = (to_row - from_row) + 1;
 
 	for (int row = from_row; row < getLength (); ++row) {
-		QString *dummy = data->invalid_fields.take (row);
-		if (dummy) {
+		if (data->invalid_fields.contains (row)) {
+			QString inv = data->invalid_fields.take (row);
 			changed_invalids.append (row);
 			if (row > to_row) {
 				changed_invalids.append (row - offset);
-				data->invalid_fields.replace (row - offset, dummy);
-			} else {
-				delete dummy;
+				data->invalid_fields.insert (row - offset, inv);
 			}
 		}
 	}
@@ -767,11 +764,11 @@
 
 	QList<int> changed_invalids;
 	for (int i = getLength () - count - 1; i >= row; --i) {
-		QString *dummy = data->invalid_fields.take (i);
-		if (dummy) {
+		if (data->invalid_fields.contains (i)) {
+			QString dummy = data->invalid_fields.take (i);
 			changed_invalids.append (i);
 			changed_invalids.append (i + count);
-			data->invalid_fields.replace (i + count, dummy);
+			data->invalid_fields.insert (i + count, dummy);
 		}
 	}
 

Modified: branches/KDE4_port/rkward/core/rkvariable.h
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.h	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/core/rkvariable.h	2007-11-13 18:35:47 UTC (rev 2217)
@@ -18,7 +18,7 @@
 #define RKVARIABLE_H
 
 #include <qstring.h>
-#include <q3intdict.h>
+#include <QHash>
 
 #include "robject.h"
 
@@ -169,7 +169,7 @@
 /// the formatting options set for this var (see FormattingOptions) */
 		FormattingOptions formatting_options;
 /// storage for invalid fields
-		Q3IntDict<QString> invalid_fields;
+		QHash<int, QString> invalid_fields;
 /// how many models need our data?
 		int num_listeners;
 	};

Modified: branches/KDE4_port/rkward/dialogs/rkreadlinedialog.cpp
===================================================================
--- branches/KDE4_port/rkward/dialogs/rkreadlinedialog.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/dialogs/rkreadlinedialog.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -18,14 +18,15 @@
 #include "rkreadlinedialog.h"
 
 #include <qlineedit.h>
-#include <q3textedit.h>
+#include <QTextEdit>
 #include <qlabel.h>
-#include <q3vbox.h>
 #include <qapplication.h>
 #include <qdesktopwidget.h>
+#include <QScrollBar>
 
 #include <klocale.h>
 #include <kvbox.h>
+#include <kglobalsettings.h>
 
 #include "../rbackend/rcommand.h"
 
@@ -52,16 +53,17 @@
 	if (!context.isEmpty ()) {
 		new QLabel (i18n ("Context:"), page);
 
-		Q3TextEdit *output = new Q3TextEdit (page);
+		QTextEdit *output = new QTextEdit (page);
 		output->setUndoRedoEnabled (false);
-		output->setTextFormat (Qt::PlainText);
-		output->setCurrentFont (QFont ("Courier"));
-		output->setWordWrap (Q3TextEdit::NoWrap);
-		output->setText (context);
+		output->setPlainText (QString ());
+		output->setCurrentFont (KGlobalSettings::fixedFont ());
+		output->setLineWrapMode (QTextEdit::NoWrap);
+		output->insert (context);
 		output->setReadOnly (true);
-		int cwidth = output->contentsWidth ();
+		// there seems to be no easier way to get at the contents width...
+		int cwidth = output->horizontalScrollBar ()->maximum () + output->width ();
 		output->setMinimumWidth (screen_width < cwidth ? screen_width : cwidth);
-		output->scrollToBottom ();
+		output->moveCursor (QTextCursor::End);
 		output->setFocusPolicy (Qt::NoFocus);
 	}
 

Modified: branches/KDE4_port/rkward/misc/getfilenamewidget.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/getfilenamewidget.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/misc/getfilenamewidget.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -16,10 +16,8 @@
  ***************************************************************************/
 #include "getfilenamewidget.h"
 
-#include <qlayout.h>
 #include <qlabel.h>
-//Added by qt3to4:
-#include <Q3VBoxLayout>
+#include <QVBoxLayout>
 
 #include <klocale.h>
 #include <klineedit.h>
@@ -29,7 +27,8 @@
 
 GetFileNameWidget::GetFileNameWidget (QWidget *parent, FileType mode, const QString &label, const QString &caption, const QString &initial) : QWidget (parent) {
 	RK_TRACE (MISC);
-	Q3VBoxLayout *vbox = new Q3VBoxLayout (this);
+	QVBoxLayout *vbox = new QVBoxLayout (this);
+	vbox->setContentsMargins (0, 0, 0, 0);
 	vbox->setResizeMode (QLayout::Minimum);
 
 	vbox->addWidget (new QLabel (label, this));

Modified: branches/KDE4_port/rkward/misc/rkcommonfunctions.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/rkcommonfunctions.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/misc/rkcommonfunctions.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -19,8 +19,6 @@
 #include <qstringlist.h>
 #include <qdom.h>
 #include <qregexp.h>
-//Added by qt3to4:
-#include <Q3PtrList>
 
 #include <kxmlguiclient.h>
 #include <kglobal.h>

Modified: branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/misc/rkprogresscontrol.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -239,7 +239,6 @@
 	if (mode_flags & RKProgressControl::AllowCancel) setButtonText (KDialog::Cancel, i18n ("Cancel"));
 	else (setCloseTextToClose ());
 
-#warning TODO the KDialog size adjustment seems to be somewhat buggy in current kdelibs. Investigate later.
 	setDetailsWidgetVisible (mode_flags & RKProgressControl::OutputShownByDefault);
 
 	prevent_close = (mode_flags & RKProgressControl::PreventClose);

Modified: branches/KDE4_port/rkward/misc/rksaveobjectchooser.cpp
===================================================================
--- branches/KDE4_port/rkward/misc/rksaveobjectchooser.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/misc/rksaveobjectchooser.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -19,10 +19,8 @@
 
 #include <qlineedit.h>
 #include <qcheckbox.h>
-#include <qlayout.h>
 #include <qlabel.h>
-//Added by qt3to4:
-#include <Q3VBoxLayout>
+#include <QVBoxLayout>
 
 #include <klocale.h>
 
@@ -36,7 +34,8 @@
 	prev_ok = true;
 	object_exists = false;
 
-	Q3VBoxLayout *layout = new Q3VBoxLayout (this);
+	QVBoxLayout *layout = new QVBoxLayout (this);
+	layout->setContentsMargins (0, 0, 0, 0);
 
 	QLabel *label = new QLabel (prompt.isNull () ? i18n ("Object name to save to") : prompt, this);
 	layout->addWidget (label);

Modified: branches/KDE4_port/rkward/misc/xmlhelper.h
===================================================================
--- branches/KDE4_port/rkward/misc/xmlhelper.h	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/misc/xmlhelper.h	2007-11-13 18:35:47 UTC (rev 2217)
@@ -19,10 +19,9 @@
 #define XMLHELPER_H
 
 #include <qdom.h>
-#include <q3valuelist.h>
 
 /** a helper type used to pass a list of direct child elements of a node */
-typedef Q3ValueList<QDomElement> XMLChildList;
+typedef QList<QDomElement> XMLChildList;
 
 /** This class contains some convenience functions for parsing XML files (DOM). Usually you will use a static instance of this class (getStaticHelper ()), which will be created early in rkward initialization. The error-logs will be reset every time you open a new XML-file using openXMLFile (). This is fine as long as you are parsing files one by one instead of mixing several files. In the latter case you will want to create additional instances of XMLHelper (it's quite possible, this mechanism will be changed, but I want to get going before considering all implications ;-)).
 

Modified: branches/KDE4_port/rkward/rkconsole.cpp
===================================================================
--- branches/KDE4_port/rkward/rkconsole.cpp	2007-11-13 17:29:12 UTC (rev 2216)
+++ branches/KDE4_port/rkward/rkconsole.cpp	2007-11-13 18:35:47 UTC (rev 2217)
@@ -72,7 +72,6 @@
 	view = doc->createView (this);
 	layout->addWidget (view);
 
-// KDE4: does this work?
 	KTextEditor::ConfigInterface *confint = qobject_cast<KTextEditor::ConfigInterface*> (view);
 	RK_ASSERT (view);
 	confint->setConfigValue ("dynamic-word-wrap", false);
@@ -80,10 +79,8 @@
 	setFocusProxy (view);
 	setFocusPolicy (Qt::StrongFocus);
 	
-	/* We need to unplug kactions that were plugged to the KateViewInternal in kateview.cpp.
-	These actions include Key_Up, Key_Down, etc.
-	It's a bit boring to do, but there is no way to do that another way yet.
-	Apparently, things will be different in KDE 4.*/
+	/* We need to disable kactions that were plugged to the KateViewInternal in kateview.cpp.
+	These actions include Key_Up, Key_Down, etc. */
 	kate_edit_actions = view->findChild<KActionCollection*> ("edit_actions");
 	if (kate_edit_actions) {
 		// make sure these actions never get triggered by a shortcut


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