[rkward-cvs] rkward/rkward/windows rkcommandeditorwindowpart.cpp,NONE,1.1 rkcommandeditorwindowpart.h,NONE,1.1 Makefile.am,1.3,1.4 rkcommandeditorwindow.cpp,1.19,1.20 rkcommandeditorwindow.h,1.14,1.15

Thomas Friedrichsmeier tfry at users.sourceforge.net
Thu Sep 15 11:50:05 UTC 2005


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

Modified Files:
	Makefile.am rkcommandeditorwindow.cpp rkcommandeditorwindow.h 
Added Files:
	rkcommandeditorwindowpart.cpp rkcommandeditorwindowpart.h 
Log Message:
Create extension part for run line/selection/all, as a child of the katepart. Moving corresponding actions and slots to RKCommandEditorWindowPart. Some more dead code cleanups in RKCommandEditorWindow

--- NEW FILE: rkcommandeditorwindowpart.cpp ---
/***************************************************************************
                          rkeditordataframepart  -  description
                             -------------------
    begin                : Wed Sep 14 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 "rkcommandeditorwindowpart.h"

#include <kinstance.h>
#include <klocale.h>
#include <kaction.h>

#include "rkcommandeditorwindow.h"
#include "../rkglobals.h"
#include "../rbackend/rinterface.h"
#include "../debug.h"

RKCommandEditorWindowPart::RKCommandEditorWindowPart (QWidget *parent, RKCommandEditorWindow *editor_widget) : KParts::ReadWritePart (parent) {
	RK_TRACE (COMMANDEDITOR);

	KInstance* instance = new KInstance ("rkward");
	setInstance (instance);
 
	command_editor = editor_widget;

	setXMLFile ("rkcommandeditorwindowpart.rc");

	setReadWrite (true);

	initializeActions ();
}

RKCommandEditorWindowPart::~RKCommandEditorWindowPart () {
	RK_TRACE (COMMANDEDITOR);
}

void RKCommandEditorWindowPart::initializeActions () {
	RK_TRACE (COMMANDEDITOR);

	runAll = new KAction (i18n ("Run all"), KShortcut ("F9"), this, SLOT (slotRunAll ()), actionCollection (), "run_all");
	runAll->setIcon("player_fwd");
	runSelection = new KAction (i18n ("Run selection"), KShortcut ("F8"), this, SLOT (slotRunSelection ()), actionCollection (), "run_selection");
	runSelection->setIcon("player_play");
	runLine = new KAction (i18n ("Run current line"), KShortcut ("Ctrl+L"), this, SLOT (slotRunLine ()), actionCollection (), "run_line");
	runLine->setIcon("player_play");
}

void RKCommandEditorWindowPart::slotRunSelection() {
	RK_TRACE (COMMANDEDITOR);

	if (command_editor->getSelection ().isEmpty () || command_editor->getSelection ().isNull ())
		return;

	RKGlobals::rInterface ()->issueCommand (new RCommand (command_editor->getSelection (), RCommand::User, ""));
}

void RKCommandEditorWindowPart::slotRunLine() {
	RK_TRACE (COMMANDEDITOR);

	if (command_editor->getLine ().isEmpty () || command_editor->getLine().isNull ())
		return;

	RKGlobals::rInterface ()->issueCommand (new RCommand (command_editor->getLine (), RCommand::User, ""));
}


void RKCommandEditorWindowPart::slotRunAll() {
	RK_TRACE (COMMANDEDITOR);

	if (command_editor->getText ().isEmpty () || command_editor->getText ().isNull ())
		return;
		
	RKGlobals::rInterface ()->issueCommand (new RCommand (command_editor->getText (), RCommand::User, ""));
}

#include "rkcommandeditorwindowpart.moc"


Index: Makefile.am
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile.am	25 Feb 2005 14:44:41 -0000	1.3
--- Makefile.am	15 Sep 2005 11:50:03 -0000	1.4
***************
*** 2,7 ****
  METASOURCES = AUTO
  noinst_LIBRARIES =  libwindows.a
! noinst_HEADERS = rkcommandeditorwindow.h rkhelpwindow.h
! libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkhelpwindow.cpp
  rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowui.rc
--- 2,9 ----
  METASOURCES = AUTO
  noinst_LIBRARIES =  libwindows.a
! noinst_HEADERS = rkcommandeditorwindow.h rkhelpwindow.h \
! 	rkcommandeditorwindowpart.h
! libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkhelpwindow.cpp \
! 	rkcommandeditorwindowpart.cpp
  rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc
\ No newline at end of file

Index: rkcommandeditorwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rkcommandeditorwindow.cpp	14 Sep 2005 21:07:07 -0000	1.19
--- rkcommandeditorwindow.cpp	15 Sep 2005 11:50:03 -0000	1.20
***************
*** 51,54 ****
--- 51,55 ----
  #include "../rkglobals.h"
  #include "../rkward.h"
+ #include "rkcommandeditorwindowpart.h"
  
  #include "../debug.h"
***************
*** 58,73 ****
  RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highlighting) : KMdiChildView (parent) {
  	RK_TRACE (COMMANDEDITOR);
-     KParts::ReadWritePart *m_katepart;
  
  	KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
  	if (factory) {
  		// Create the part
! 		m_katepart = (KParts::ReadWritePart *)factory->create( this,
! 			"katepart", "KParts::ReadWritePart" );
  	}
- 	(RKGlobals::rkApp()->m_manager)->addPart((KParts::Part*)m_katepart,false);
  
! 	m_doc = (Kate::Document *) m_katepart;
! 	m_view = (Kate::View *) m_katepart->widget();
  
  	QHBoxLayout *pLayout = new QHBoxLayout( this, 0, -1, "layout");
--- 59,74 ----
  RKCommandEditorWindow::RKCommandEditorWindow (QWidget *parent, bool use_r_highlighting) : KMdiChildView (parent) {
  	RK_TRACE (COMMANDEDITOR);
  
  	KLibFactory *factory = KLibLoader::self()->factory( "libkatepart" );
  	if (factory) {
  		// Create the part
! 		m_doc = (Kate::Document *) factory->create( this, "katepart", "KParts::ReadWritePart" );
! 		RK_ASSERT (m_doc);
! 		m_view = (Kate::View *) m_doc->widget();
  	}
  
! 	m_doc->insertChildClient (new RKCommandEditorWindowPart (m_view, this));
! 
! 	RKGlobals::rkApp()->m_manager->addPart(m_doc, false);
  
  	QHBoxLayout *pLayout = new QHBoxLayout( this, 0, -1, "layout");
***************
*** 167,190 ****
  
  
- 
- 
- KURL RKCommandEditorWindow::url(){
-     return m_doc->url();
- }
- 
- 
- 
- bool RKCommandEditorWindow::save(){
-     return m_doc->save();
- }
- 
- bool RKCommandEditorWindow::saveAs(const KURL &url){
- 	bool result = m_doc->saveAs(url);
- 	updateTabCaption(url); 
- 	return result;
- }
- 
- 
- 
  bool RKCommandEditorWindow::isModified() {
      return m_doc->isModified();
--- 168,171 ----

--- NEW FILE: rkcommandeditorwindowpart.h ---
/***************************************************************************
                          rkeditordataframepart  -  description
                             -------------------
    begin                : Wed Sep 14 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 RKCOMMANDEDITORWINDOWPART_H
#define RKCOMMANDEDITORWINDOWPART_H

#include <kparts/part.h>

class RKCommandEditorWindow;
class KAction;


/** This class provides a KPart interface to RKCommandEditorWindow. Basically, it is responsible for creating the menu-entries the RKCommandEditorWindow provides, and keeps the corresponding Actions. The reason to use this, is so the required menus/menu-items can be merged in on the fly.

@author Thomas Friedrichsmeier
*/
class RKCommandEditorWindowPart : public KParts::ReadWritePart {
	Q_OBJECT
public:
	RKCommandEditorWindowPart (QWidget *parent, RKCommandEditorWindow *editor_widget);

	~RKCommandEditorWindowPart ();

public slots:
	void slotRunSelection();
	void slotRunLine();
	void slotRunAll();
private:
	RKCommandEditorWindow *command_editor;

	void initializeActions ();

	KAction* runAll;
	KAction* runSelection;
	KAction* runLine;
protected:
	bool openFile () { return false; };
	bool saveFile () { return false; };
};

#endif

Index: rkcommandeditorwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** rkcommandeditorwindow.h	14 Sep 2005 21:07:07 -0000	1.14
--- rkcommandeditorwindow.h	15 Sep 2005 11:50:03 -0000	1.15
***************
*** 58,64 ****
      QString getText();
      bool openURL(const KURL &url, bool use_r_highlighting=true, bool read_only=false);
-     KURL url();
-     bool save();
-     bool saveAs(const KURL &url);
      bool isModified();
      void insertText(QString text);
--- 58,61 ----





More information about the rkward-tracker mailing list