[rkward-cvs] rkward/rkward/windows detachedwindowcontainer.rc,NONE,1.1 Makefile.am,1.9,1.10 detachedwindowcontainer.cpp,1.1,1.2 detachedwindowcontainer.h,1.1,1.2

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri Oct 21 16:04:35 UTC 2005


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

Modified Files:
	Makefile.am detachedwindowcontainer.cpp 
	detachedwindowcontainer.h 
Added Files:
	detachedwindowcontainer.rc 
Log Message:
Window detaching functionality completed (I think)

Index: detachedwindowcontainer.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/detachedwindowcontainer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** detachedwindowcontainer.h	21 Oct 2005 15:23:36 -0000	1.1
--- detachedwindowcontainer.h	21 Oct 2005 16:04:32 -0000	1.2
***************
*** 26,30 ****
  class KMdiChildView;
  
! /**
  @author Thomas Friedrichsmeier
  */
--- 26,31 ----
  class KMdiChildView;
  
! /** This class can be used host a (part) window detached from the main window. @see RKwardApp::slotDetachWindow ().
! 
  @author Thomas Friedrichsmeier
  */
***************
*** 32,44 ****
  	Q_OBJECT
  public:
  	DetachedWindowContainer (KParts::Part *part_to_capture, KMdiChildView *widget_to_capture);
! 
  	~DetachedWindowContainer ();
  
  	static QPtrList<KMdiChildView> *detachedWindows () { return &detached_windows; };
  public slots:
  	void viewDestroyed (QObject *view);
  private:
  	static QPtrList<KMdiChildView> detached_windows;
  };
  
--- 33,53 ----
  	Q_OBJECT
  public:
+ /** constructor.
+ @param part_to_capture The part to use to create the GUI in the detached window
+ @param widget_to_capture The view to reparent into the detached window */
  	DetachedWindowContainer (KParts::Part *part_to_capture, KMdiChildView *widget_to_capture);
! /** destructor. Usually you don't call this explicitely, but rather delete/close the child view. The DetachedWindowContainer will then self destruct */
  	~DetachedWindowContainer ();
  
+ /** static list of all detached windows */
  	static QPtrList<KMdiChildView> *detachedWindows () { return &detached_windows; };
  public slots:
+ /** self-destruct, when child view is destroyed */
  	void viewDestroyed (QObject *view);
+ /** re-attach to the main window */
+ 	void slotReattach ();
  private:
  	static QPtrList<KMdiChildView> detached_windows;
+ 	KParts::Part *part;
  };
  

Index: Makefile.am
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Makefile.am	21 Oct 2005 15:23:36 -0000	1.9
--- Makefile.am	21 Oct 2005 16:04:32 -0000	1.10
***************
*** 7,9 ****
  	rkhtmlwindow.cpp rcontrolwindow.cpp detachedwindowcontainer.cpp
  rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc
--- 7,9 ----
  	rkhtmlwindow.cpp rcontrolwindow.cpp detachedwindowcontainer.cpp
  rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc detachedwindowcontainer.rc

--- NEW FILE: detachedwindowcontainer.rc ---
<!DOCTYPE kpartgui>
<kpartgui name="rkward" version="0.3.4">
	<MenuBar>
		<Merge/>
		<Menu name="window"><text>&Window</text>
			<Action name="dwindow_close"/>
			<Separator/>
			<Action name="dwindow_attach"/>
		</Menu>
		<Menu name="help">
			<Merge/>
		</Menu>
	</MenuBar>
</kpartgui>

Index: detachedwindowcontainer.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/detachedwindowcontainer.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** detachedwindowcontainer.cpp	21 Oct 2005 15:23:36 -0000	1.1
--- detachedwindowcontainer.cpp	21 Oct 2005 16:04:32 -0000	1.2
***************
*** 19,22 ****
--- 19,24 ----
  
  #include <kmdichildview.h>
+ #include <klocale.h>
+ #include <kstdaction.h>
  
  #include <qlayout.h>
***************
*** 32,37 ****
  	RK_TRACE (APP);
  
! 	setXMLFile ("adslk");
  
  	widget_to_capture->reparent (this, QPoint (0, 0));
  	setCentralWidget (widget_to_capture);
--- 34,45 ----
  	RK_TRACE (APP);
  
! // create own GUI
! 	setXMLFile ("detachedwindowcontainer.rc");
! 	KStdAction::close (widget_to_capture, SLOT (close ()), actionCollection (), "dwindow_close");
! 	new KAction (i18n ("Attach to main window"), 0, this, SLOT (slotReattach ()), actionCollection (), "dwindow_attach");
! 	createShellGUI ();
  
+ // capture widget
+ 	part = part_to_capture;
  	widget_to_capture->reparent (this, QPoint (0, 0));
  	setCentralWidget (widget_to_capture);
***************
*** 39,43 ****
--- 47,53 ----
  	createGUI (part_to_capture);
  
+ // add widget to list of detached windows
  	detached_windows.append (widget_to_capture);
+ // should self-destruct, when child widget is destroyed
  	connect (widget_to_capture, SIGNAL (destroyed (QObject *)), this, SLOT (viewDestroyed (QObject *)));
  }
***************
*** 49,53 ****
  }
  
! void DetachedWindowContainer::viewDestroyed (QObject *view) {
  	RK_TRACE (APP);
  
--- 59,63 ----
  }
  
! void DetachedWindowContainer::viewDestroyed (QObject *) {
  	RK_TRACE (APP);
  
***************
*** 55,57 ****
--- 65,80 ----
  }
  
+ void DetachedWindowContainer::slotReattach () {
+ 	RK_TRACE (APP);
+ 
+ 	KMdiChildView *view = static_cast<KMdiChildView *> (centralWidget ());
+ 
+ 	view->reparent (0, QPoint (0, 0));
+ 	RKGlobals::rkApp ()->addWindow (view);
+ 	RKGlobals::rkApp ()->m_manager->addPart (part);
+ 	view->show ();
+ 	view->setFocus ();
+ 	delete this;
+ }
+ 
  #include "detachedwindowcontainer.moc"





More information about the rkward-tracker mailing list