[rkward-cvs] SF.net SVN: rkward: [1087] trunk/rkward/rkward/windows

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Jan 8 00:58:44 UTC 2007


Revision: 1087
          http://svn.sourceforge.net/rkward/?rev=1087&view=rev
Author:   tfry
Date:     2007-01-07 16:58:44 -0800 (Sun, 07 Jan 2007)

Log Message:
-----------
Make back and forward work in help

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkhtmlwindow.cpp
    trunk/rkward/rkward/windows/rkhtmlwindow.h

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2007-01-08 00:52:29 UTC (rev 1086)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp	2007-01-08 00:58:44 UTC (rev 1087)
@@ -60,6 +60,7 @@
 
 	url_history.setAutoDelete (true);
 	back = forward = print = 0;		// initialization done in subclasses
+	url_change_is_from_history = false;
 }
 
 RKHTMLWindow::~RKHTMLWindow () {
@@ -101,27 +102,27 @@
 void RKHTMLWindow::slotForward () {
 	RK_TRACE (APP);
 
+	url_change_is_from_history = true;
 	url_history.next ();
 	RK_ASSERT (url_history.current ());
-qDebug ("Error is here");
-	khtmlpart->openURL (*(url_history.current ()));
-	updateCaption (*(url_history.current ()));
+	openURL (*(url_history.current ()));
 
 	back->setEnabled (true);
 	forward->setEnabled (url_history.current () != url_history.getLast ());
+	url_change_is_from_history = false;
 }
 
 void RKHTMLWindow::slotBack () {
 	RK_TRACE (APP);
 
+	url_change_is_from_history = true;
 	url_history.prev ();
 	RK_ASSERT (url_history.current ());
-qDebug ("Error is here");
-	khtmlpart->openURL (*(url_history.current ()));
-	updateCaption (*(url_history.current ()));
+	openURL (*(url_history.current ()));
 
 	forward->setEnabled (true);
 	back->setEnabled (url_history.current () != url_history.getFirst ());
+	url_change_is_from_history = false;
 }
 
 bool RKHTMLWindow::openURL (const KURL &url) {
@@ -146,15 +147,17 @@
 void RKHTMLWindow::changeURL (const KURL &url) {
 	updateCaption (url);
 
-	if (back && forward) {
-		KURL *current_url = url_history.current ();
-		while (current_url != url_history.getLast ()) {
-			url_history.removeLast ();
+	if (!url_change_is_from_history) {
+		if (back && forward) {
+			KURL *current_url = url_history.current ();
+			while (current_url != url_history.getLast ()) {
+				url_history.removeLast ();
+			}
+			KURL *url_copy = new KURL (url);
+			url_history.append (url_copy);
+			back->setEnabled (url_history.count () > 1);
+			forward->setEnabled (false);
 		}
-		KURL *url_copy = new KURL (url);
-		url_history.append (url_copy);
-		back->setEnabled (url_history.count () > 1);
-		forward->setEnabled (false);
 	}
 }
 
@@ -367,7 +370,7 @@
 	} else if (url.protocol () == "rkhelp") {
 		ok = renderRKHelp (url);
 	} else {
-		ok = RKHTMLWindow::openURL (url);
+		return (RKHTMLWindow::openURL (url));
 	}
 
 	if (!ok) {

Modified: trunk/rkward/rkward/windows/rkhtmlwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.h	2007-01-08 00:52:29 UTC (rev 1086)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.h	2007-01-08 00:58:44 UTC (rev 1087)
@@ -82,6 +82,7 @@
 	KAction *back;
 	KAction *forward;
 	KAction *print;
+	bool url_change_is_from_history;	// dirty!!!
 };
 
 /**


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