[rkward-cvs] rkward/rkward/windows detachedwindowcontainer.cpp,NONE,1.1 detachedwindowcontainer.h,NONE,1.1 Makefile.am,1.8,1.9 rkcommandeditorwindow.cpp,1.24,1.25 rkcommandeditorwindow.h,1.17,1.18

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri Oct 21 15:23:38 UTC 2005


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

Modified Files:
	Makefile.am rkcommandeditorwindow.cpp rkcommandeditorwindow.h 
Added Files:
	detachedwindowcontainer.cpp detachedwindowcontainer.h 
Log Message:
Make windows detachable. Some more work needs to be done, but basically functioning

Index: Makefile.am
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Makefile.am	19 Oct 2005 22:38:06 -0000	1.8
--- Makefile.am	21 Oct 2005 15:23:36 -0000	1.9
***************
*** 2,7 ****
  METASOURCES = AUTO
  noinst_LIBRARIES =  libwindows.a
! noinst_HEADERS = rkcommandeditorwindow.h rkcommandeditorwindowpart.h rkhtmlwindow.h rcontrolwindow.h
! libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkcommandeditorwindowpart.cpp rkhtmlwindow.cpp rcontrolwindow.cpp
  rcdir = $(kde_datadir)/rkward
  rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc
--- 2,9 ----
  METASOURCES = AUTO
  noinst_LIBRARIES =  libwindows.a
! noinst_HEADERS = rkcommandeditorwindow.h rkcommandeditorwindowpart.h \
! 	rkhtmlwindow.h rcontrolwindow.h detachedwindowcontainer.h
! libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkcommandeditorwindowpart.cpp \
! 	rkhtmlwindow.cpp rcontrolwindow.cpp detachedwindowcontainer.cpp
  rcdir = $(kde_datadir)/rkward
  rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc

Index: rkcommandeditorwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rkcommandeditorwindow.cpp	17 Sep 2005 19:23:52 -0000	1.24
--- rkcommandeditorwindow.cpp	21 Oct 2005 15:23:36 -0000	1.25
***************
*** 82,85 ****
--- 82,97 ----
  }
  
+ void RKCommandEditorWindow::closeEvent (QCloseEvent *e) {
+ 	if (isModified ()) {
+ 		int status = KMessageBox::warningYesNo (this, i18n ("The document \"%1\" has been modified. Close it anyway?").arg (tabCaption ()),i18n ("File not saved"));
+ 	
+ 		if (status != KMessageBox::Yes) {
+ 			e->ignore ();
+ 			return;
+ 		}
+ 	}
+ 
+ 	KMdiChildView::closeEvent (e);
+ }
  
  void RKCommandEditorWindow::setRHighlighting () {
***************
*** 139,144 ****
  }
  
- 
- 
  void RKCommandEditorWindow::updateTabCaption (const KURL &url) {
  	QString fname = url.fileName ();
--- 151,154 ----

--- NEW FILE: detachedwindowcontainer.h ---
/***************************************************************************
                          detachedwindowcontainer  -  description
                             -------------------
    begin                : Wed Oct 21 2005
    copyright            : (C) 2005 by Thomas Friedrichsmeier
    email                : tfry at users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef DETACHEDWINDOWCONTAINER_H
#define DETACHEDWINDOWCONTAINER_H

#include <kparts/part.h>
#include <kparts/mainwindow.h>

#include <qptrlist.h>

class KMdiChildView;

/**
@author Thomas Friedrichsmeier
*/
class DetachedWindowContainer : public KParts::MainWindow {
	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;
};

#endif

--- NEW FILE: detachedwindowcontainer.cpp ---
/***************************************************************************
                          detachedwindowcontainer  -  description
                             -------------------
    begin                : Wed Oct 21 2005
    copyright            : (C) 2005 by Thomas Friedrichsmeier
    email                : tfry at users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "detachedwindowcontainer.h"

#include <kmdichildview.h>

#include <qlayout.h>

#include "../rkward.h"
#include "../rkglobals.h"
#include "../debug.h"

//static
QPtrList<KMdiChildView> DetachedWindowContainer::detached_windows;

DetachedWindowContainer::DetachedWindowContainer (KParts::Part *part_to_capture, KMdiChildView *widget_to_capture) : KParts::MainWindow  (RKGlobals::rkApp ()) {
	RK_TRACE (APP);

	setXMLFile ("adslk");

	widget_to_capture->reparent (this, QPoint (0, 0));
	setCentralWidget (widget_to_capture);
	setCaption (widget_to_capture->caption ());	
	createGUI (part_to_capture);

	detached_windows.append (widget_to_capture);
	connect (widget_to_capture, SIGNAL (destroyed (QObject *)), this, SLOT (viewDestroyed (QObject *)));
}

DetachedWindowContainer::~DetachedWindowContainer () {
	RK_TRACE (APP);

	detached_windows.remove (static_cast<KMdiChildView*> (centralWidget ()));
}

void DetachedWindowContainer::viewDestroyed (QObject *view) {
	RK_TRACE (APP);

	delete this;
}

#include "detachedwindowcontainer.moc"

Index: rkcommandeditorwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rkcommandeditorwindow.h	17 Sep 2005 19:23:52 -0000	1.17
--- rkcommandeditorwindow.h	21 Oct 2005 15:23:36 -0000	1.18
***************
*** 49,57 ****
  	~RKCommandEditorWindow ();
  /** return text of current selection */
! 	QString getSelection();
  /** return text in current line */
! 	QString getLine();
  /** return entire text */
! 	QString getText();
  /** open given URL. 
  @param use_r_highlighting Initialize the view to use R syntax highlighting. Use, if you're going to edit an R syntax file
--- 49,57 ----
  	~RKCommandEditorWindow ();
  /** return text of current selection */
! 	QString getSelection ();
  /** return text in current line */
! 	QString getLine ();
  /** return entire text */
! 	QString getText ();
  /** open given URL. 
  @param use_r_highlighting Initialize the view to use R syntax highlighting. Use, if you're going to edit an R syntax file
***************
*** 63,67 ****
  	void insertText (const QString &text);
  /** Show help about the current word. */
! 	void showHelp();
  private:
  	Kate::Document *m_doc;
--- 63,70 ----
  	void insertText (const QString &text);
  /** Show help about the current word. */
! 	void showHelp ();
! protected:
! /** reimplemented from KMdiChildView: give the editor window a chance to object to being closed (if unsaved) */
! 	void closeEvent (QCloseEvent *e);
  private:
  	Kate::Document *m_doc;





More information about the rkward-tracker mailing list