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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Oct 28 19:13:33 UTC 2007


Revision: 2140
          http://rkward.svn.sourceforge.net/rkward/?rev=2140&view=rev
Author:   tfry
Date:     2007-10-28 12:13:32 -0700 (Sun, 28 Oct 2007)

Log Message:
-----------
Remove another Q3PtrList

Modified Paths:
--------------
    branches/KDE4_port/rkward/windows/rkhtmlwindow.cpp
    branches/KDE4_port/rkward/windows/rkhtmlwindow.h

Modified: branches/KDE4_port/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- branches/KDE4_port/rkward/windows/rkhtmlwindow.cpp	2007-10-28 18:43:30 UTC (rev 2139)
+++ branches/KDE4_port/rkward/windows/rkhtmlwindow.cpp	2007-10-28 19:13:32 UTC (rev 2140)
@@ -65,8 +65,8 @@
 	connect (khtmlpart->browserExtension (), SIGNAL (openUrlRequestDelayed (const KUrl&, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)), this, SLOT (slotOpenUrl (const KUrl&, const KParts::OpenUrlArguments&, const KParts::BrowserArguments&)));
 	connect (khtmlpart, SIGNAL (completed ()), this, SLOT (loadDone ()));
 
-	url_history.setAutoDelete (true);
 	back = forward = print = run_selection = 0;		// initialization done in subclasses
+	current_history_position = -1;
 	url_change_is_from_history = false;
 }
 
@@ -145,12 +145,15 @@
 	RK_TRACE (APP);
 
 	url_change_is_from_history = true;
-	url_history.next ();
-	RK_ASSERT (url_history.current ());
-	openURL (*(url_history.current ()));
 
+	++current_history_position;
+	int history_last = url_history.count () - 1;
+	RK_ASSERT (current_history_position > 0);
+	RK_ASSERT (current_history_position <= history_last);
+	openURL (url_history[current_history_position]);
+
 	back->setEnabled (true);
-	forward->setEnabled (url_history.current () != url_history.getLast ());
+	forward->setEnabled (current_history_position < history_last);
 	url_change_is_from_history = false;
 }
 
@@ -158,12 +161,12 @@
 	RK_TRACE (APP);
 
 	url_change_is_from_history = true;
-	url_history.prev ();
-	RK_ASSERT (url_history.current ());
-	openURL (*(url_history.current ()));
+	--current_history_position;
+	RK_ASSERT (current_history_position >= 0);
+	openURL (url_history[current_history_position]);
 
 	forward->setEnabled (true);
-	back->setEnabled (url_history.current () != url_history.getFirst ());
+	back->setEnabled (current_history_position > 0);
 	url_change_is_from_history = false;
 }
 
@@ -200,13 +203,14 @@
 
 	if (!url_change_is_from_history) {
 		if (back && forward) {
-			KUrl *current_url = url_history.current ();
-			while (current_url != url_history.getLast ()) {
+			int history_last = url_history.count () - 1;
+			for (int i = history_last; i > current_history_position; --i) {
 				url_history.removeLast ();
 			}
-			KUrl *url_copy = new KUrl (url);
-			url_history.append (url_copy);
-			back->setEnabled (url_history.count () > 1);
+
+			url_history.append (url);
+			++current_history_position;
+			back->setEnabled (current_history_position > 0);	// may be false, if this is the very first page to be added to the history
 			forward->setEnabled (false);
 		}
 	}

Modified: branches/KDE4_port/rkward/windows/rkhtmlwindow.h
===================================================================
--- branches/KDE4_port/rkward/windows/rkhtmlwindow.h	2007-10-28 18:43:30 UTC (rev 2139)
+++ branches/KDE4_port/rkward/windows/rkhtmlwindow.h	2007-10-28 19:13:32 UTC (rev 2140)
@@ -22,8 +22,6 @@
 #include <kparts/browserextension.h>
 #include <kxmlguiclient.h>
 
-#include <q3ptrlist.h>
-
 #include "../windows/rkmdiwindow.h"
 
 class KHTMLPart;
@@ -84,12 +82,14 @@
 /** called from openURL. Takes care of updating caption, and updating back/forward actions, if available */
 	void changeURL (const KUrl &url);
 protected:
-	Q3PtrList<KUrl> url_history;
+	QList<KUrl> url_history;
+	int current_history_position;
+	bool url_change_is_from_history;	// dirty!!!
+
 	QAction *back;
 	QAction *forward;
 	QAction *print;
 	QAction *run_selection;
-	bool url_change_is_from_history;	// dirty!!!
 	QString goto_anchor_name;
 };
 


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