[rkward-cvs] rkward/rkward/windows rkhelpwindow.rc,NONE,1.1 Makefile.am,1.7,1.8 rkhtmlwindow.cpp,1.3,1.4 rkhtmlwindow.h,1.2,1.3 rkoutputwindow.rc,1.1,1.2

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Oct 19 22:38:09 UTC 2005


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

Modified Files:
	Makefile.am rkhtmlwindow.cpp rkhtmlwindow.h rkoutputwindow.rc 
Added Files:
	rkhelpwindow.rc 
Log Message:
Added back/forward to help window, working print to help and output

--- NEW FILE: rkhelpwindow.rc ---
<!DOCTYPE kpartgui>
<kpartgui name="rkward" version="0.3.4">
	<MenuBar>
		<Menu name="file">
			<Action name="print_help"/>
		</Menu>
	</MenuBar>
	<ToolBar fullWidth="true" name="navigation_toolbar">
		<Action name="help_back"/>
		<Action name="help_forward"/>
	</ToolBar>
</kpartgui>

Index: rkhtmlwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhtmlwindow.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rkhtmlwindow.cpp	18 Oct 2005 11:48:24 -0000	1.3
--- rkhtmlwindow.cpp	19 Oct 2005 22:38:06 -0000	1.4
***************
*** 51,54 ****
--- 51,57 ----
  	
  	connect (khtmlpart, SIGNAL (completed ()), this, SLOT (loadDone ()));
+ 
+ 	url_history.setAutoDelete (true);
+ 	back = forward = print = 0;		// initialization done in subclasses
  }
  
***************
*** 57,60 ****
--- 60,93 ----
  }
  
+ void RKHTMLWindow::slotPrint () {
+ 	RK_TRACE (APP);
+ 
+ 	khtmlpart->view ()->print ();
+ }
+ 
+ void RKHTMLWindow::slotForward () {
+ 	RK_TRACE (APP);
+ 
+ 	url_history.next ();
+ 	RK_ASSERT (url_history.current ());
+ 	khtmlpart->openURL (*(url_history.current ()));
+ 	updateCaption (*(url_history.current ()));
+ 
+ 	back->setEnabled (true);
+ 	forward->setEnabled (url_history.current () != url_history.getLast ());
+ }
+ 
+ void RKHTMLWindow::slotBack () {
+ 	RK_TRACE (APP);
+ 
+ 	url_history.prev ();
+ 	RK_ASSERT (url_history.current ());
+ 	khtmlpart->openURL (*(url_history.current ()));
+ 	updateCaption (*(url_history.current ()));
+ 
+ 	forward->setEnabled (true);
+ 	back->setEnabled (url_history.current () != url_history.getFirst ());
+ }
+ 
  bool RKHTMLWindow::openURL (const KURL &url) {
  	RK_TRACE (APP);
***************
*** 66,69 ****
--- 99,113 ----
  	updateCaption (url);
  
+ 	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);
+ 	}
+ 
  	return true;	
  }
***************
*** 100,104 ****
  
  	// strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
! 	RKCommonFunctions::removeContainers (khtmlpart, QStringList::split (',', "tools,security,extraToolBar,saveBackground,saveFrame,kget_menu"), true);
  
  	KInstance* instance = new KInstance ("rkward");
--- 144,148 ----
  
  	// strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
! 	RKCommonFunctions::removeContainers (khtmlpart, QStringList::split (',', "tools,security,extraToolBar,saveBackground,saveFrame,printFrame,kget_menu"), true);
  
  	KInstance* instance = new KInstance ("rkward");
***************
*** 114,117 ****
--- 158,163 ----
  	outputFlush = new KAction (i18n ("&Flush"), 0, 0, this, SLOT (flushOutput ()), actionCollection (), "output_flush");
  	outputRefresh = new KAction (i18n ("&Refresh"), 0, 0, this, SLOT (refreshOutput ()), actionCollection (), "output_refresh");
+ 	print = KStdAction::print (this, SLOT (slotPrint ()), actionCollection (), "print_output");
+ 	print->setText (i18n ("Print Output"));
  
  	RKGlobals::rkApp ()->m_manager->addPart (khtmlpart);
***************
*** 208,218 ****
  
  	// strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
! 	RKCommonFunctions::removeContainers (khtmlpart, QStringList::split (',', "tools,security,extraToolBar,saveBackground,saveDocument,saveFrame,kget_menu"), true);
  
! /*	KInstance* instance = new KInstance ("rkward");
  	setInstance (instance);
! 	setXMLFile ("rkhelpwindow.rc");		// TODO: create .rc-file
  
! 	khtmlpart->insertChildClient (this); */
  
  	setIcon (SmallIcon ("help"));
--- 254,269 ----
  
  	// strip down the khtmlpart's GUI. remove some stuff we definitely don't need.
! 	RKCommonFunctions::removeContainers (khtmlpart, QStringList::split (',', "tools,security,extraToolBar,saveBackground,saveDocument,saveFrame,printFrame,kget_menu"), true);
  
! 	back = KStdAction::back (this, SLOT (slotBack ()), actionCollection (), "help_back");
! 	forward = KStdAction::forward (this, SLOT (slotForward ()), actionCollection (), "help_forward");
! 	print = KStdAction::print (this, SLOT (slotPrint ()), actionCollection (), "print_help");
! 	print->setText (i18n ("Print Help"));
! 
! 	KInstance* instance = new KInstance ("rkward");
  	setInstance (instance);
! 	setXMLFile ("rkhelpwindow.rc");
  
! 	khtmlpart->insertChildClient (this);
  
  	setIcon (SmallIcon ("help"));

Index: rkoutputwindow.rc
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkoutputwindow.rc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkoutputwindow.rc	12 Oct 2005 14:37:07 -0000	1.1
--- rkoutputwindow.rc	19 Oct 2005 22:38:06 -0000	1.2
***************
*** 1,5 ****
  <!DOCTYPE kpartgui>
! <kpartgui name="rkward" version="0.3.3">
  	<MenuBar>
  		<Menu name="output"><text>&Output</text>
  			<Separator/>
--- 1,8 ----
  <!DOCTYPE kpartgui>
! <kpartgui name="rkward" version="0.3.4">
  	<MenuBar>
+ 		<Menu name="file">
+ 			<Action name="print_output"/>
+ 		</Menu>
  		<Menu name="output"><text>&Output</text>
  			<Separator/>
***************
*** 7,10 ****
  			<Separator/>
  			<Action name="output_flush"/>
! 		</Menu>   
  </kpartgui>
--- 10,14 ----
  			<Separator/>
  			<Action name="output_flush"/>
! 		</Menu>
! 	</MenuBar>
  </kpartgui>

Index: Makefile.am
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Makefile.am	13 Oct 2005 21:01:57 -0000	1.7
--- Makefile.am	19 Oct 2005 22:38:06 -0000	1.8
***************
*** 5,7 ****
  libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkcommandeditorwindowpart.cpp rkhtmlwindow.cpp rcontrolwindow.cpp
  rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc
--- 5,7 ----
  libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkcommandeditorwindowpart.cpp rkhtmlwindow.cpp rcontrolwindow.cpp
  rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc

Index: rkhtmlwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhtmlwindow.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rkhtmlwindow.h	12 Oct 2005 14:51:20 -0000	1.2
--- rkhtmlwindow.h	19 Oct 2005 22:38:06 -0000	1.3
***************
*** 24,27 ****
--- 24,29 ----
  #include <kxmlguiclient.h>
  
+ #include <qptrlist.h>
+ 
  class KHTMLPart;
  
***************
*** 51,54 ****
--- 53,59 ----
  /** this is used for browsing only. Use openURL instead, when calling from outside. */
  	void slotOpenURLRequest (const KURL &url, const KParts::URLArgs &);
+ 	void slotPrint ();
+ 	void slotForward ();
+ 	void slotBack ();
  private slots:
  /** This slot is called when the new page has finished loading. Sets scroll position to scroll_position */
***************
*** 61,64 ****
--- 66,74 ----
  /** update caption according to given URL */
  	virtual void updateCaption (const KURL &url);
+ protected:
+ 	QPtrList<KURL> url_history;
+ 	KAction *back;
+ 	KAction *forward;
+ 	KAction *print;
  };
  





More information about the rkward-tracker mailing list