[rkward-cvs] rkward/rkward rkward.cpp,1.66,1.67 rkward.h,1.27,1.28 rkwardui.rc,1.17,1.18

Pierre ecoch at users.sourceforge.net
Sun Apr 3 13:26:22 UTC 2005


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

Modified Files:
	rkward.cpp rkward.h rkwardui.rc 
Log Message:
Trying to use kparts properly. Not finished yet. (but hey, it's cvs, man).

Index: rkward.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** rkward.cpp	24 Mar 2005 20:24:55 -0000	1.66
--- rkward.cpp	3 Apr 2005 13:26:19 -0000	1.67
***************
*** 121,124 ****
--- 121,125 ----
  	KMdiChildView * editorManagerView = createWrapper(RKGlobals::editorManager (), i18n( "Data editor"), i18n( "Data editor"));
  	editorManagerView->setIcon(SmallIcon("spreadsheet"));
+ 	editorManagerView->setName("dataeditor");
  	addWindow( editorManagerView );
  	
***************
*** 143,146 ****
--- 144,248 ----
  	
  
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ //   m_manager = new KParts::PartManager( this );
+ //   // When the manager says the active part changes,
+ //   // the builder updates (recreates) the GUI
+ //   connect( m_manager, SIGNAL( activePartChanged( KParts::Part * ) ),
+ //            this, SLOT( createGUI( KParts::Part * ) ) );
+ //   m_splitter = new QSplitter( this );
+ // 
+ //   // Try to find libkghostview
+ //   KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
+ //   if (factory)
+ //   {
+ //     // Create the part
+ //     m_gvpart = (KParts::ReadOnlyPart *)factory->create( m_splitter,
+ //                 "kgvpart", "KParts::ReadOnlyPart" );
+ //   }
+ // 
+ // 
+ //   factory = KLibLoader::self()->factory( "libkpdfpart" );
+ //   if (factory)
+ //     m_notepadpart = (KParts::ReadOnlyPart *)factory->create( m_splitter,
+ //                      "knotepadpart", "KParts::ReadOnlyPart" );
+ // 
+ // 
+ //   // CHANGE: No longer necessary.
+ //   //setView( m_splitter );
+ //   // Set a reasonable size
+ //   /*m_splitter->setMinimumSize( 500, 400 );
+ //   m_splitter->show();
+ //   setCentralWidget(m_splitter);*/
+ // 
+ //   m_manager->addPart( m_gvpart, true ); // sets as the active part
+ //   m_manager->addPart( m_notepadpart, false );
+ // 
+ // 
+ // addWindow(createWrapper(m_splitter,"bla","bla"));
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ KMdiChildView *view1 = new KMdiChildView( i18n( "View 1" ), this );
+ KMdiChildView *view2 = new KMdiChildView( i18n( "View 1" ), this );
+ 
+   m_manager = new KParts::PartManager( this );
+   // When the manager says the active part changes,
+   // the builder updates (recreates) the GUI
+   connect( m_manager, SIGNAL( activePartChanged( KParts::Part * ) ),
+            this, SLOT( createGUI( KParts::Part * ) ) );
+   m_splitter = new QSplitter( this );
+ 
+   // Try to find libkghostview
+   KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
+   if (factory)
+   {
+     // Create the part
+     m_gvpart = (KParts::ReadOnlyPart *)factory->create( view1,
+                 "kgvpart", "KParts::ReadOnlyPart" );
+     //((QWidget *)m_gvpart)->setFocusPolicy(QWidget::ClickFocus);
+   }
+ 
+ 
+   factory = KLibLoader::self()->factory( "libkpdfpart" );
+   if (factory){
+     m_notepadpart = (KParts::ReadOnlyPart *)factory->create( view2,
+                      "knotepadpart", "KParts::ReadOnlyPart" );
+     //((QWidget *)m_notepadpart)->setFocusPolicy(QWidget::ClickFocus);
+   }
+ 
+   // CHANGE: No longer necessary.
+   //setView( m_splitter );
+   // Set a reasonable size
+   /*m_splitter->setMinimumSize( 500, 400 );
+   m_splitter->show();
+   setCentralWidget(m_splitter);*/
+ addWindow(view1);
+ addWindow(view2);
+ 
+   m_manager->addPart( m_gvpart, true ); // sets as the active part
+   m_manager->addPart( m_notepadpart, false );
+ 
+ 
+ 
+ 
+ 
  	
  }
***************
*** 345,351 ****
  	filePrint->setEnabled (false);
  	fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection(), "file_quitx");
! 
!   editUndo = KStdAction::undo(this, SLOT(slotEditUndo()), actionCollection(), "undo");
!   editRedo = KStdAction::redo(this, SLOT(slotEditRedo()), actionCollection(), "redo");	
    editCut = KStdAction::cut(this, SLOT(slotEditCut()), actionCollection(), "cut");
    editCopy = KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection(), "copy");
--- 447,451 ----
  	filePrint->setEnabled (false);
  	fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection(), "file_quitx");
! 	
    editCut = KStdAction::cut(this, SLOT(slotEditCut()), actionCollection(), "cut");
    editCopy = KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection(), "copy");
***************
*** 362,370 ****
  	
  	runAll = new KAction (i18n ("Run All"), 0, 0, this, SLOT (slotRunAll ()), actionCollection (), "run_all");
! 	runAll->setIcon("package_system");
  	runSelection = new KAction (i18n ("Run Selection"), 0, 0, this, SLOT (slotRunSelection ()), actionCollection (), "run_selection");
! 	runSelection->setIcon("run");
  	interruptCommand = new KAction (i18n ("Interrupt running command"), 0, 0, this, SLOT (slotInterruptCommand ()), actionCollection (), "interrupt");
! 	interruptCommand->setIcon("stop");
  	file_load_libs = new KAction (i18n ("Configure Packages"), 0, 0, this, SLOT (slotFileLoadLibs ()), actionCollection (), "file_load_libs");	
  	configure = new KAction (i18n ("Configure RKWard"), 0, 0, this, SLOT(slotConfigure ()), actionCollection(), "configure");
--- 462,470 ----
  	
  	runAll = new KAction (i18n ("Run All"), 0, 0, this, SLOT (slotRunAll ()), actionCollection (), "run_all");
! 	runAll->setIcon("player_fwd");
  	runSelection = new KAction (i18n ("Run Selection"), 0, 0, this, SLOT (slotRunSelection ()), actionCollection (), "run_selection");
! 	runSelection->setIcon("player_play");
  	interruptCommand = new KAction (i18n ("Interrupt running command"), 0, 0, this, SLOT (slotInterruptCommand ()), actionCollection (), "interrupt");
! 	interruptCommand->setIcon("player_stop");
  	file_load_libs = new KAction (i18n ("Configure Packages"), 0, 0, this, SLOT (slotFileLoadLibs ()), actionCollection (), "file_load_libs");	
  	configure = new KAction (i18n ("Configure RKWard"), 0, 0, this, SLOT(slotConfigure ()), actionCollection(), "configure");
***************
*** 390,394 ****
    
    // use the absolute path to your rkwardui.rc file for testing purpose in createGUI();
!   setXMLFile( "rkwardui.rc" );
    createShellGUI ( true );
  
--- 490,494 ----
    
    // use the absolute path to your rkwardui.rc file for testing purpose in createGUI();
!   setXMLFile( "/home/pierre/adetr/rkward/rkward/rkwardui.rc" );
    createShellGUI ( true );
  
***************
*** 1072,1076 ****
  void RKwardApp::slotViewActivated (KMdiChildView * window)
  {
! 	setEnabledActions(activeWindow()->inherits("RKCommandEditorWindow"));
  }
  
--- 1172,1179 ----
  void RKwardApp::slotViewActivated (KMdiChildView * window)
  {
! 	if ((QString) activeWindow()->name()=="dataeditor"){
! 		createGUI(0L);
! 	}
! 	setEnabledActions((QString) activeWindow()->name()=="dataeditor");
  }
  
***************
*** 1089,1098 ****
  
  
! void RKwardApp::setEnabledActions(bool commandEditor)
  {
! 	if (commandEditor) {
! 		editUndo->setEnabled(true);
! 		editRedo->setEnabled(true);
! 		editPaste->setEnabled(true);
  		fileSave->setEnabled(true);
  		fileSaveAs->setEnabled(true);
--- 1192,1203 ----
  
  
! void RKwardApp::setEnabledActions(bool objectEditor)
  {
! 	if (!objectEditor) {
!   		editCut->setEnabled(false);
!   		editCopy->setEnabled(false);
!   		editPaste->setEnabled(false);
!     		editPasteToSelection->setEnabled(false);
!     		editPasteToTable->setEnabled(false);
  		fileSave->setEnabled(true);
  		fileSaveAs->setEnabled(true);
***************
*** 1101,1111 ****
  		interruptCommand->setEnabled(true);
  		fileOpenRecent->setEnabled(true);
!     		editPasteToSelection->setEnabled(false);
!     		editPasteToTable->setEnabled(false);
  	}
  	else {
! 		editUndo->setEnabled(false);
! 		editRedo->setEnabled(false);
! 		editPaste->setEnabled(false);
  		fileSave->setEnabled(false);
  		fileSaveAs->setEnabled(false);
--- 1206,1217 ----
  		interruptCommand->setEnabled(true);
  		fileOpenRecent->setEnabled(true);
! 
  	}
  	else {
!   		editCut->setEnabled(true);
!   		editCopy->setEnabled(true);
!   		editPaste->setEnabled(true);
!     		editPasteToSelection->setEnabled(true);
!     		editPasteToTable->setEnabled(true);
  		fileSave->setEnabled(false);
  		fileSaveAs->setEnabled(false);
***************
*** 1114,1119 ****
  		interruptCommand->setEnabled(false);
  		fileOpenRecent->setEnabled(false);
!     		editPasteToSelection->setEnabled(true);
!     		editPasteToTable->setEnabled(true);
  	}
  }
--- 1220,1224 ----
  		interruptCommand->setEnabled(false);
  		fileOpenRecent->setEnabled(false);
! 
  	}
  }
***************
*** 1131,1140 ****
  void RKwardApp::slotFunctionReference()
  {
! 	//if (! activeWindow()->inherits("RKCommandEditorWindow"))
! 	//	return;
! 	//((RKCommandEditorWindow*) activeWindow())->showHelp();
! 	helpDlg = new KHelpDlg(0);
! 	helpDlg->setIcon(SmallIcon("help"));
! 	addToolWindow(helpDlg,KDockWidget::DockBottom, getMainDockWidget(), 10);
  }
  
--- 1236,1242 ----
  void RKwardApp::slotFunctionReference()
  {
! 	if (! activeWindow()->inherits("RKCommandEditorWindow"))
! 		return;
! 	((RKCommandEditorWindow*) activeWindow())->showHelp();
  }
  

Index: rkward.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkward.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** rkward.h	25 Feb 2005 22:28:26 -0000	1.27
--- rkward.h	3 Apr 2005 13:26:20 -0000	1.28
***************
*** 50,53 ****
--- 50,55 ----
  class KHelpDlg;
  
+ class QSplitter;
+ 
  /**
    * The base class for RKward application windows. It sets up the main
***************
*** 82,85 ****
--- 84,89 ----
  	void fileOpenAskSave (const KURL &url);
  	void openHTML(KURL url);
+ 
+ 	KParts::PartManager *m_manager;
  protected:
  	void openWorkspace (const KURL &url);
***************
*** 284,287 ****
--- 288,306 ----
  	void saveAsProcedure(RKCommandEditorWindow *editor);
      void setEnabledActions(bool commandEditor);
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+   KParts::ReadOnlyPart *m_gvpart;
+   KParts::ReadOnlyPart *m_notepadpart;
+   
+   QSplitter *m_splitter;
+ 
+ 
+ 
+ 
  signals:
      void childWindowCloseRequest(KMdiChildView * window);

Index: rkwardui.rc
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/rkwardui.rc,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rkwardui.rc	25 Feb 2005 15:46:01 -0000	1.17
--- rkwardui.rc	3 Apr 2005 13:26:20 -0000	1.18
***************
*** 14,17 ****
--- 14,22 ----
  		<Action name="file_save_asy"/>
  		<Separator/>
+ 		<Action name="file_quitx"/>
+ 	</Menu>
+ 		
+ 		
+ 	<Menu name="workspace"><text>&Workspace</text>
  		<Action name="file_openx"/>
  		<Action name="file_open_recentx"/>
***************
*** 22,40 ****
  		<Separator/>
  		<Action name="file_printx"/>
! 		<Separator/>
! 		<Action name="file_quitx"/>
  	</Menu>
  	
  	
  	<Menu name="edit"><text>&Edit</text>
- 		<Action name="undo"/>
- 		<Action name="redo"/>
- 		<Separator/>
  		<Action name="cut"/>
  		<Action name="copy"/>
  		<Action name="paste"/>
- 		<Separator/>
  		<Action name="paste_to_selection"/>
  		<Action name="paste_to_table"/>
  	</Menu>
    
--- 27,42 ----
  		<Separator/>
  		<Action name="file_printx"/>
! 
  	</Menu>
  	
  	
  	<Menu name="edit"><text>&Edit</text>
  		<Action name="cut"/>
  		<Action name="copy"/>
  		<Action name="paste"/>
  		<Action name="paste_to_selection"/>
  		<Action name="paste_to_table"/>
+ 		<Separator/>
+ 		<Merge/> 
  	</Menu>
    
***************
*** 59,66 ****
  		<Action name="new_data_frame"/>
  		<Action name="new_command_editor"/>
- 		<Separator/>
- 		<Action name="file_openy"/>
- 		<Action name="file_savey"/>
- 		<Action name="file_save_asy"/>
  </ToolBar>
  <ToolBar fullWidth="true" name="editToolBar">
--- 61,64 ----





More information about the rkward-tracker mailing list