[rkward-cvs] rkward/rkward rkeditormanager.cpp,1.8,1.9 rkward.cpp,1.95,1.96 rkward.h,1.44,1.45

Thomas Friedrichsmeier tfry at users.sourceforge.net
Sat Sep 17 15:55:32 UTC 2005


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

Modified Files:
	rkeditormanager.cpp rkward.cpp rkward.h 
Log Message:
Window->close/close all working properly

Index: rkward.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -C2 -d -r1.95 -r1.96
*** rkward.cpp	16 Sep 2005 16:08:11 -0000	1.95
--- rkward.cpp	17 Sep 2005 15:55:30 -0000	1.96
***************
*** 82,86 ****
  #include "agents/showedittextfileagent.h"	// TODO: see below: needed purely for linking!
  
! RKwardApp::RKwardApp (KURL *load_url) : KMdiMainFrm (0, 0, KMdi::IDEAlMode), DCOPObject ("rkwardapp") {
  	ShowEditTextFileAgent::showEditFiles (0);		// TODO: AAAAAAAARGGGH!!!! It won't link without this bogus line!!!
  
--- 82,86 ----
  #include "agents/showedittextfileagent.h"	// TODO: see below: needed purely for linking!
  
! RKwardApp::RKwardApp (KURL *load_url) : DCOPObject ("rkwardapp"), KMdiMainFrm (0, 0, KMdi::IDEAlMode) {
  	ShowEditTextFileAgent::showEditFiles (0);		// TODO: AAAAAAAARGGGH!!!! It won't link without this bogus line!!!
  
***************
*** 153,157 ****
  RKwardApp::~RKwardApp() {
  	RK_TRACE (APP);
! 	RKGlobals::editorManager()->closeAll ();
  	delete RKGlobals::rInterface ();
  	delete RKGlobals::rObjectList ();
--- 153,157 ----
  RKwardApp::~RKwardApp() {
  	RK_TRACE (APP);
! 	closeAllViews ();
  	delete RKGlobals::rInterface ();
  	delete RKGlobals::rObjectList ();
***************
*** 313,317 ****
  
  	close_all_editors = new KAction (i18n ("Close All Data"), 0, 0, this, SLOT (slotCloseAllEditors ()), actionCollection (), "close_all_editors");
- 	window_close = new KAction (i18n ("Close"), 0, KShortcut ("Crtl+W"), this, SLOT (slotCloseWindow ()), actionCollection (), "window_close");
  	window_close_all = new KAction (i18n ("Close All Windows"), 0, 0, this, SLOT (slotCloseAllWindows ()), actionCollection (), "window_close_all");
  	window_detach = new KAction (i18n ("Detach"), 0, 0, this, SLOT (slotDetachWindow ()), actionCollection (), "window_detach");
--- 313,316 ----
***************
*** 663,690 ****
  }
  
- void RKwardApp::slotCloseWindow () {
- 	RK_TRACE (APP);
- 
- 	if (!activeWindow ()) {
- 		qDebug ("no active window");
- 	}
- 
- 	closeActiveView ();
- 
- /*	KMdiChildView *w = activeWindow ();
- 
- 	if (w) {
- 		RK_TRACE (APP);
- 		removeWindowFromMdi (w);
- 		delete w;
- 	} */
- }
- 
  void RKwardApp::slotCloseAllWindows () {
  	RK_TRACE (APP);
  
  	closeAllViews ();
- 	// editor windows somehow are not recognized by closeAllViews ()
- 	RKGlobals::editorManager()->closeAll ();
  }
  
--- 662,669 ----
***************
*** 816,819 ****
--- 795,799 ----
  void RKwardApp::slotChildWindowCloseRequest (KMdiChildView * window) {
  	//If it's an unsaved command editor window, there is a warning.
+ 	// TODO: it's sort of ugly, having to handle this here. Can't we somehow handle it in RKCommandEditorWindow instead?
  	if (window->inherits("RKCommandEditorWindow")) {
  		RKCommandEditorWindow * editor = (RKCommandEditorWindow*) window;
***************
*** 821,836 ****
  			int status = KMessageBox::warningYesNo(this,i18n("The document \"%1\" has been modified. Close it anyway?").arg(editor->tabCaption()),i18n("File not saved"));
  	
! 			if (status == KMessageBox::Yes) {
! 				closeWindow(window);
  			}
  		}
- 		else {
- 			closeWindow(window);
- 		}
- 	}
- 	else if (window->inherits("RKHelpWindow"))
- 	{
- 		closeWindow(window);
  	}
  }
  
--- 801,811 ----
  			int status = KMessageBox::warningYesNo(this,i18n("The document \"%1\" has been modified. Close it anyway?").arg(editor->tabCaption()),i18n("File not saved"));
  	
! 			if (status != KMessageBox::Yes) {
! 				return;
  			}
  		}
  	}
+ 
+ 	closeWindow(window);
  }
  

Index: rkward.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** rkward.h	16 Sep 2005 16:08:11 -0000	1.44
--- rkward.h	17 Sep 2005 15:55:30 -0000	1.45
***************
*** 193,199 ****
  	void slotOpenRecentCommandEditor(const KURL&);
  
! /** close current window (Windows->Close) */
! 	void slotCloseWindow ();
! /** close current window (Windows->Close) */
  	void slotCloseAllWindows ();
  /** detach current window (Windows->Detach) */
--- 193,197 ----
  	void slotOpenRecentCommandEditor(const KURL&);
  
! /** close all windows (Windows->Close All) */
  	void slotCloseAllWindows ();
  /** detach current window (Windows->Detach) */
***************
*** 232,236 ****
  	KToggleAction* viewStatusBar;
  
- 	KAction* window_close;
  	KAction* window_close_all;
  	KAction* window_detach;
--- 230,233 ----

Index: rkeditormanager.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkeditormanager.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rkeditormanager.cpp	16 Sep 2005 16:08:11 -0000	1.8
--- rkeditormanager.cpp	17 Sep 2005 15:55:30 -0000	1.9
***************
*** 112,116 ****
  	
  	RObject *object = editor->getObject ();
! 	RKGlobals::rkApp ()->closeWindow (editor);
  
  	RCommand *command = new RCommand (".rk.editor.closed (" + object->getFullName() + ")", RCommand::App | RCommand::Sync);
--- 112,116 ----
  	
  	RObject *object = editor->getObject ();
! 	editor->close ();
  
  	RCommand *command = new RCommand (".rk.editor.closed (" + object->getFullName() + ")", RCommand::App | RCommand::Sync);
***************
*** 134,138 ****
  		RKEditor *ed = *it;
  		++it;
! 		RKGlobals::rkApp ()->closeWindow (ed);		// will be removed from list of editors in editorDestroyed ()
  	}
  }
--- 134,138 ----
  		RKEditor *ed = *it;
  		++it;
! 		ed->close ();			// will be removed from list of editors in editorDestroyed ()
  	}
  }
***************
*** 159,167 ****
  	RKEditorDataFrame *ed = new RKEditorDataFrame (0);
  	(RKGlobals::rkApp()->m_manager)->addPart (ed->getPart (), false);
- 	RKGlobals::rkApp ()->addWindow (ed);
  	ed->setIcon (SmallIcon ("spreadsheet"));
  	editors.append (ed);
  	connect (ed, SIGNAL (destroyed (QObject*)), this, SLOT (editorDestroyed (QObject*)));
! 	RKGlobals::rkApp ()->activateGUI (ed->getPart ());
  
  	return ed;
--- 159,168 ----
  	RKEditorDataFrame *ed = new RKEditorDataFrame (0);
  	(RKGlobals::rkApp()->m_manager)->addPart (ed->getPart (), false);
  	ed->setIcon (SmallIcon ("spreadsheet"));
+ 	RKGlobals::rkApp ()->addWindow (ed);
+ 	ed->activate ();		// it seems, sometimes we need to call this explicitely
  	editors.append (ed);
  	connect (ed, SIGNAL (destroyed (QObject*)), this, SLOT (editorDestroyed (QObject*)));
! 	RKGlobals::rkApp ()->activateGUI (ed->getPart ());		// it seems, sometimes we need to call this explicitely
  
  	return ed;





More information about the rkward-tracker mailing list