[rkward-cvs] rkward/rkward/windows rkhtmlwindow.cpp,1.5,1.6

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sun Nov 13 16:13:03 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/windows
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9410/rkward/windows

Modified Files:
	rkhtmlwindow.cpp 
Log Message:
Handle non-local and non-existing URLs gracefully in HTMLWindow

Index: rkhtmlwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhtmlwindow.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rkhtmlwindow.cpp	20 Oct 2005 19:45:54 -0000	1.5
--- rkhtmlwindow.cpp	13 Nov 2005 16:13:01 -0000	1.6
***************
*** 23,26 ****
--- 23,27 ----
  #include <kiconloader.h>
  #include <kmessagebox.h>
+ #include <krun.h>
  #include <kparts/partmanager.h>
  
***************
*** 92,98 ****
  bool RKHTMLWindow::openURL (const KURL &url) {
  	RK_TRACE (APP);
- 	bool ok = QFile (url.path ()).exists ();
  
! 	if (!ok) return false;
  
  	khtmlpart->openURL (url);
--- 93,105 ----
  bool RKHTMLWindow::openURL (const KURL &url) {
  	RK_TRACE (APP);
  
! 	// asyncrhonously dealing with non-local files would be quite a task. We chose the simple answer instead...
! 	if (!url.isLocalFile ()) {
! 		if (KMessageBox::questionYesNo (this, i18n ("The url you are trying to open ('%1') is not a local file. Do you want to open the url in the default application?").arg (url.prettyURL ()), i18n ("Open in default application?")) != KMessageBox::Yes) {
! 			return false;
! 		}
! 		KRun *runner = new KRun (url);		// according to KRun-documentation, KRun will self-destruct when done.
! 		runner->setRunExecutables (false);
! 	}
  
  	khtmlpart->openURL (url);
***************
*** 134,139 ****
  }
  
- 
- 
  //##################### BEGIN RKOutputWindow #####################
  //static 
--- 141,144 ----
***************
*** 257,261 ****
--- 262,268 ----
  
  	back = KStdAction::back (this, SLOT (slotBack ()), actionCollection (), "help_back");
+ 	back->setEnabled (false);
  	forward = KStdAction::forward (this, SLOT (slotForward ()), actionCollection (), "help_forward");
+ 	forward->setEnabled (false);
  	print = KStdAction::print (this, SLOT (slotPrint ()), actionCollection (), "print_help");
  	print->setText (i18n ("Print Help"));





More information about the rkward-tracker mailing list