[rkward-cvs] rkward/rkward/plugin Makefile.am,1.12,1.13 rkcheckbox.cpp,1.8,1.9 rkformula.cpp,1.9,1.10 rkinput.cpp,1.5,1.6 rkinput.h,1.1,1.2 rkpluginbrowser.cpp,1.5,1.6 rkpluginbrowser.h,1.1,1.2 rkpluginspinbox.cpp,1.9,1.10 rkradio.cpp,1.9,1.10 rkstandardcomponent.cpp,1.11,1.12 rkvarslot.cpp,1.17,1.18

Thomas Friedrichsmeier tfry at users.sourceforge.net
Fri Mar 17 16:46:27 UTC 2006


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

Modified Files:
	Makefile.am rkcheckbox.cpp rkformula.cpp rkinput.cpp rkinput.h 
	rkpluginbrowser.cpp rkpluginbrowser.h rkpluginspinbox.cpp 
	rkradio.cpp rkstandardcomponent.cpp rkvarslot.cpp 
Log Message:
Moved over RKInput and RKPluginBrowser to RKComponent-infrastructure

Index: rkradio.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkradio.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rkradio.cpp	17 Mar 2006 13:27:18 -0000	1.9
--- rkradio.cpp	17 Mar 2006 16:46:25 -0000	1.10
***************
*** 104,107 ****
--- 104,109 ----
  	group->setButton (new_id);
  	updating = false;
+ 
+ 	changed ();
  }
  

Index: rkformula.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkformula.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rkformula.cpp	16 Mar 2006 22:31:08 -0000	1.9
--- rkformula.cpp	17 Mar 2006 16:46:25 -0000	1.10
***************
*** 219,222 ****
--- 219,223 ----
  	model->setValue (model_string);
  	labels->setValue (labels_string);
+ 	changed ();
  }
  

Index: rkpluginbrowser.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkpluginbrowser.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkpluginbrowser.h	26 Mar 2005 10:33:30 -0000	1.1
--- rkpluginbrowser.h	17 Mar 2006 16:46:25 -0000	1.2
***************
*** 1,52 ****
! //
! // C++ Interface: %{MODULE}
! //
! // Description: 
! //
! //
! // Author: %{Adrien d'Hardemare} <%{EMAIL}>, (C) %{YEAR}
! //
! // Copyright: See COPYING file that comes with this distribution
! //
! //
  #ifndef RKPLUGINBROWSER_H
  #define RKPLUGINBROWSER_H
  
! #include <rkpluginwidget.h>
! class QTextEdit ; 
! class QLabel ; 
! class QVBoxLayout;
  
  
- /**
  @author Adrien d'Hardemare
  */
- class QPushButton ; 
  
! class RKPluginBrowser : public RKPluginWidget
! {
! Q_OBJECT
  public:
!     	RKPluginBrowser(const QDomElement &element, QWidget *parent, RKPlugin *plugin);
!     	~RKPluginBrowser();
!     	void setEnabled(bool);
! 	QVBoxLayout *vbox	;
! private:
! 	QString depend;
! 	QTextEdit * textedit ; 
! 	QLabel * label ;
! 	QPushButton * button ;
! 	QString type;		
! 	QString size;		
! 	QString filter;
  public slots:
! 	void slotActive();
! 	void slotActive(bool);
! 	void textChanged();
! private slots : 
! 	void slotPopingup();
! protected:
! /** Returns the value of the currently selected option. */
! 	QString value (const QString &modifier);	
  };
  
--- 1,50 ----
! /***************************************************************************
!                           rkpluginbrowser  -  description
!                              -------------------
!     begin                : Sat Mar 10 2005
!     copyright            : (C) 2005, 2006 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 RKPLUGINBROWSER_H
  #define RKPLUGINBROWSER_H
  
! #include "rkcomponent.h"
  
+ #include "rkcomponentproperties.h"
+ 
+ class GetFileNameWidget;
+ class QDomElement;
+ 
+ /** RKComponent to select one or more file(s) or directories
+ 
+ TODO: Rename to somehting like RKComponentFileSelect or a similarilly ugly name
+ TODO: I ripped out multiple file selection for now. GetFileNameWidget should be extended to handle that internally (tfry)
  
  @author Adrien d'Hardemare
  */
  
! class RKPluginBrowser : public RKComponent {
! 	Q_OBJECT
  public:
! 	RKPluginBrowser (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget);
! 	~RKPluginBrowser ();
! 
! 	RKComponentPropertyBase *selection;
  public slots:
! 	void textChanged ();
! 	void textChanged (RKComponentPropertyBase *);
! private:
! 	GetFileNameWidget *selector;
! 	bool updating;
  };
  

Index: rkinput.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkinput.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rkinput.cpp	29 Sep 2005 16:02:51 -0000	1.5
--- rkinput.cpp	17 Mar 2006 16:46:25 -0000	1.6
***************
*** 1,82 ****
  
  #include "rkinput.h"
  
- #include <qdom.h>
  #include <qlayout.h>
  #include <qtextedit.h>
  #include <qlabel.h>
- #include <qvbox.h>
- #include <qgrid.h>
  
! #include "rkplugin.h"
  #include "../rkglobals.h"
  #include "../debug.h"
  
! RKInput::RKInput(const QDomElement &element, QWidget *parent, RKPlugin *plugin) : RKPluginWidget (element, parent, plugin) {
  	RK_TRACE (PLUGIN);
  
! 	vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
! 	label = new QLabel (element.attribute ("label", "Enter your text"), this);
! 	QString initial = element.attribute ("initial", QString::null) ;
! 	textedit = new QTextEdit ( initial ,
! 	QString::null,this, element.attribute ("id")) ;
  	vbox->addWidget (label);
! 	vbox->addWidget (textedit);
! 	connect(textedit,SIGNAL(textChanged()),SLOT(textChanged()));
! 	
! 	size = element.attribute ("size", "medium");
! 	if (size == "small") {
! 	textedit->setMaximumSize (100,25) ; 
! 	textedit->setMinimumSize (100,25) ; 
! 	} else if (size == "medium") {
! 	textedit->setMaximumSize (250,25) ; 
! 	textedit->setMinimumSize (250,25) ; 
! 	} else if (size == "big") {
! 	textedit->setMinimumSize (250,100) ; 
  	}
  
! 	
! 	//textedit->setMinimumSize (50 , 300) ; 
  
  }
  
! 
! RKInput::~RKInput()
! {
  	RK_TRACE (PLUGIN);
  }
  
! void RKInput::setEnabled(bool checked){
  	RK_TRACE (PLUGIN);
- label->setEnabled(checked);
- textedit->setEnabled(checked);
- }
  
  
! void RKInput::slotActive(bool isOk){
! 	RK_TRACE (PLUGIN);
! textedit->setEnabled(isOk) ;
! label->setEnabled(isOk) ;
! }
  
!   
! void RKInput::slotActive(){
! 	RK_TRACE (PLUGIN);
! bool isOk = textedit->isEnabled();
! textedit->setEnabled(! isOk) ;
! label->setEnabled(! isOk) ;
  }
  
! QString RKInput::value (const QString &) {
  	RK_TRACE (PLUGIN);
- 	return textedit->text();
- }
  
! 
! void RKInput::textChanged(){
! 	RK_TRACE (PLUGIN);
! 	emit(changed());
  }
  
- 
  #include "rkinput.moc"
--- 1,87 ----
+ /***************************************************************************
+                           rkinput  -  description
+                              -------------------
+     begin                : Sat Mar 10 2005
+     copyright            : (C) 2005, 2006 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 "rkinput.h"
  
  #include <qlayout.h>
  #include <qtextedit.h>
  #include <qlabel.h>
  
! #include <klocale.h>
! 
! #include "../misc/xmlhelper.h"
  #include "../rkglobals.h"
  #include "../debug.h"
  
! RKInput::RKInput (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
  	RK_TRACE (PLUGIN);
  
! 	// get xml-helper
! 	XMLHelper *xml = XMLHelper::getStaticHelper ();
! 
! 	// create and add property
! 	addChild ("text", text = new RKComponentPropertyBase (this, false));
! 	connect (text, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (textChanged ( RKComponentPropertyBase *)));
! 
! 	// do all the layouting
! 	QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
! 	QLabel *label = new QLabel (xml->getStringAttribute (element, "label", i18n ("Enter text"), DL_INFO), this);
  	vbox->addWidget (label);
! 
! 
! 	textedit = new QTextEdit (this);
! 	int size = xml->getMultiChoiceAttribute (element, "size", "small;medium;large", 1, DL_INFO);
! 	if (size == 0) {
! 		textedit->setFixedSize (100,25);
! 	} else if (size == 1) {
! 		textedit->setFixedSize (250,25);
! 	} else if (size == 2) {
! 		textedit->setMinimumSize (250, 100);
  	}
+ 	vbox->addWidget (textedit);
+ 	connect (textedit, SIGNAL (textChanged ()),SLOT (textChanged ()));
  
! 	vbox->addStretch (1);		// to keep the label attached
  
+ 	// initialize
+ 	updating = false;
+ 	text->setValue (xml->getStringAttribute (element, "initial", QString::null, DL_INFO));
  }
  
! RKInput::~RKInput () {
  	RK_TRACE (PLUGIN);
  }
  
! void RKInput::textChanged (RKComponentPropertyBase *) {
  	RK_TRACE (PLUGIN);
  
+ 	if (updating) return;
+ 	updating = true;
  
! 	textedit->setText (text->value ());
  
! 	updating = false;
! 	changed ();
  }
  
! void RKInput::textChanged () {
  	RK_TRACE (PLUGIN);
  
! 	text->setValue (textedit->text ());
  }
  
  #include "rkinput.moc"

Index: rkvarslot.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkvarslot.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rkvarslot.cpp	15 Mar 2006 20:31:28 -0000	1.17
--- rkvarslot.cpp	17 Mar 2006 16:46:25 -0000	1.18
***************
*** 63,68 ****
  	g_layout->addWidget (list, 1, 2);
  
- 	g_layout->setRowStretch (3, 1);		// so the label does not get separated from the view
- 
  	// initialize properties
  	addChild ("source", source = new RKComponentPropertyRObjects (this, false));
--- 63,66 ----
***************
*** 84,87 ****
--- 82,86 ----
  		list->setHScrollBarMode (QScrollView::AlwaysOff);
  		list->setVScrollBarMode (QScrollView::AlwaysOff);
+ 		g_layout->setRowStretch (3, 1);		// so the label does not get separated from the view
  	}
  
***************
*** 154,157 ****
--- 153,158 ----
  		list->setPaletteBackgroundColor (QColor (255, 255, 255));
  	}
+ 
+ 	changed ();
  }
  

Index: rkinput.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkinput.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkinput.h	26 Mar 2005 10:33:30 -0000	1.1
--- rkinput.h	17 Mar 2006 16:46:25 -0000	1.2
***************
*** 1,45 ****
! //
! // C++ Interface: %{MODULE}
! //
! // Description: 
! //
! //
! // Author: %{AUTHOR} <%{EMAIL}>, (C) %{YEAR}
! //
! // Copyright: See COPYING file that comes with this distribution
! //
! //
  #ifndef RKINPUT_H
  #define RKINPUT_H
  
! #include <rkpluginwidget.h>
! class QTextEdit ; 
! class QLabel ; 
! class QVBoxLayout;
  
  
- /**
  @author Adrien d'Hardemare
  */
! class RKInput : public RKPluginWidget
! {
! Q_OBJECT
  public:
!     	RKInput(const QDomElement &element, QWidget *parent, RKPlugin *plugin);
!     	~RKInput();
!     	void setEnabled(bool);
! 	QVBoxLayout *vbox	;
! private:
! 	QString depend;
! 	QTextEdit * textedit ; 
! 	QLabel * label ;
! 	QString size ; 
  public slots:
! 	void slotActive();
! 	void slotActive(bool);
! 	void textChanged();
! protected:
! /** Returns the value of the currently selected option. */
! 	QString value (const QString &modifier);	
  };
  
--- 1,48 ----
! /***************************************************************************
!                           rkinput  -  description
!                              -------------------
!     begin                : Sat Mar 10 2005
!     copyright            : (C) 2005, 2006 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 RKINPUT_H
  #define RKINPUT_H
  
! #include "rkcomponent.h"
  
+ #include "rkcomponentproperties.h"
+ 
+ class QTextEdit;
+ class QDomElement;
+ 
+ /** A component to enter plain text
+ 
+ TODO: Use separate internal widgets for single line and multi line input
  
  @author Adrien d'Hardemare
  */
! class RKInput : public RKComponent {
! 	Q_OBJECT
  public:
! 	RKInput (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget);
! 	~RKInput ();
! 
! 	RKComponentPropertyBase *text;
  public slots:
! 	void textChanged ();
! 	void textChanged (RKComponentPropertyBase *);
! private:
! 	bool updating;
! 	QTextEdit *textedit;
  };
  

Index: rkpluginspinbox.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkpluginspinbox.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rkpluginspinbox.cpp	17 Mar 2006 15:18:38 -0000	1.9
--- rkpluginspinbox.cpp	17 Mar 2006 16:46:25 -0000	1.10
***************
*** 79,82 ****
--- 79,83 ----
  	// finish layout
  	vbox->addWidget (spinbox);
+ 	vbox->addStretch (1);		// make sure label remains attached to spinbox
  	if (xml->getStringAttribute (element, "size", "normal", DL_INFO) == "small") {
  		spinbox->setFixedWidth (100);

Index: Makefile.am
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/Makefile.am,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Makefile.am	17 Mar 2006 15:18:38 -0000	1.12
--- Makefile.am	17 Mar 2006 16:46:25 -0000	1.13
***************
*** 4,18 ****
  libplugin_a_SOURCES = rkcomponentmap.cpp rkcomponentproperties.cpp rkcomponent.cpp \
  	rkstandardcomponent.cpp rkvarselector.cpp rkvarslot.cpp rkformula.cpp rkradio.cpp \
! 	rkcheckbox.cpp rkpluginspinbox.cpp
  # rkplugin.cpp \
  #	rkpluginhandle.cpp rkpluginwidget.cpp rktext.cpp \
! #	 rkinput.cpp rknote.cpp \
! #	rkpluginbrowser.cpp 
  noinst_HEADERS = rkcomponentmap.h rkcomponentproperties.h rkcomponent.h \
  	rkstandardcomponent.h rkvarselector.h rkvarslot.h rkformula.h rkradio.h \
! 	rkcheckbox.h rkpluginspinbox.h
  # rkplugin.h rkpluginhandle.h \
  # rkpluginwidget.h rktext.h  \
! #	rkpluginbrowser.h rkinput.h rknote.h 
  
  
--- 4,18 ----
  libplugin_a_SOURCES = rkcomponentmap.cpp rkcomponentproperties.cpp rkcomponent.cpp \
  	rkstandardcomponent.cpp rkvarselector.cpp rkvarslot.cpp rkformula.cpp rkradio.cpp \
! 	rkcheckbox.cpp rkpluginspinbox.cpp rkinput.cpp rkpluginbrowser.cpp
  # rkplugin.cpp \
  #	rkpluginhandle.cpp rkpluginwidget.cpp rktext.cpp \
! #	  rknote.cpp
! 
  noinst_HEADERS = rkcomponentmap.h rkcomponentproperties.h rkcomponent.h \
  	rkstandardcomponent.h rkvarselector.h rkvarslot.h rkformula.h rkradio.h \
! 	rkcheckbox.h rkpluginspinbox.h rkinput.h rkpluginbrowser.h
  # rkplugin.h rkpluginhandle.h \
  # rkpluginwidget.h rktext.h  \
! # rknote.h 
  
  

Index: rkstandardcomponent.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkstandardcomponent.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkstandardcomponent.cpp	17 Mar 2006 15:18:38 -0000	1.11
--- rkstandardcomponent.cpp	17 Mar 2006 16:46:25 -0000	1.12
***************
*** 57,64 ****
  #include "rkcheckbox.h"
  #include "rkpluginspinbox.h"
- /*#include "rktext.h"
- #include "rknote.h"
  #include "rkinput.h"
! #include "rkpluginbrowser.h" */
  
  #include "../rkglobals.h"
--- 57,64 ----
  #include "rkcheckbox.h"
  #include "rkpluginspinbox.h"
  #include "rkinput.h"
! #include "rkpluginbrowser.h"
! //#include "rktext.h"
! //#include "rknote.h"
  
  #include "../rkglobals.h"
***************
*** 179,183 ****
  			buildElement (e, box);
  		} else if (e.tagName () == "frame") {
! 			QGroupBox *box = new QGroupBox (1, Qt::Vertical, e.attribute ("label"), parent_widget);
  			box->setInsideSpacing (RKGlobals::spacingHint ());
  			buildElement (e, box);
--- 179,183 ----
  			buildElement (e, box);
  		} else if (e.tagName () == "frame") {
! 			QGroupBox *box = new QGroupBox (1, Qt::Horizontal, e.attribute ("label"), parent_widget);
  			box->setInsideSpacing (RKGlobals::spacingHint ());
  			buildElement (e, box);
***************
*** 209,220 ****
  		} else if (e.tagName () == "spinbox") {
  			widget = new RKPluginSpinBox (e, component (), parent_widget);
- //		} else if (e.tagName () == "note") {		//TODO: remove corresponding class
- //			widget = new RKNote (e, parent_widget, this);
- /*		} else if (e.tagName () == "browser") {
- 			widget = new RKPluginBrowser (e, component (), parent_widget);
  		} else if (e.tagName () == "input") {
  			widget = new RKInput (e, component (), parent_widget);
! 		} else if (e.tagName () == "text") {
  			widget = new RKText (e, component (), parent_widget); */
  		} else {
  			xml->displayError (&e, QString ("Invalid tagname '%1'").arg (e.tagName ()), DL_ERROR);
--- 209,220 ----
  		} else if (e.tagName () == "spinbox") {
  			widget = new RKPluginSpinBox (e, component (), parent_widget);
  		} else if (e.tagName () == "input") {
  			widget = new RKInput (e, component (), parent_widget);
! 		} else if (e.tagName () == "browser") {
! 			widget = new RKPluginBrowser (e, component (), parent_widget);
! /*		} else if (e.tagName () == "text") {
  			widget = new RKText (e, component (), parent_widget); */
+ //		} else if (e.tagName () == "note") {		//TODO: remove corresponding class, it's a dupe
+ //			widget = new RKNote (e, parent_widget, this);
  		} else {
  			xml->displayError (&e, QString ("Invalid tagname '%1'").arg (e.tagName ()), DL_ERROR);

Index: rkpluginbrowser.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkpluginbrowser.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rkpluginbrowser.cpp	29 Sep 2005 16:02:51 -0000	1.5
--- rkpluginbrowser.cpp	17 Mar 2006 16:46:25 -0000	1.6
***************
*** 1,115 ****
  
  #include "rkpluginbrowser.h"
  
- #include <qdom.h>
  #include <qlayout.h>
- #include <qtextedit.h>
- #include <qlabel.h>
- #include <qvbox.h>
- #include <qgrid.h>
- #include <qstring.h>
- #include <qpushbutton.h>
  
- #include <kfiledialog.h>
  #include <klocale.h>
- #include <kurl.h>
  
! #include "rkplugin.h"
  #include "../rkglobals.h"
  #include "../debug.h"
  
! // /////////////////////
! 
! RKPluginBrowser::RKPluginBrowser(const QDomElement &element, QWidget *parent, RKPlugin *plugin) : RKPluginWidget (element, parent, plugin) {
  	RK_TRACE (PLUGIN);
  
! 	vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
! 	label = new QLabel (element.attribute ("label", "Enter your text"), this);
! 	textedit = new QTextEdit ( element.attribute ("initial", QString::null), QString::null,this, element.attribute ("id")) ;
! 	button = new QPushButton (i18n("Browse..."),this);
! //	size = element.attribute ("size", "small");
! 	vbox->addWidget (label);
! 	vbox->addWidget (textedit);
! 	vbox->addWidget (button);
! 	type = element.attribute("type","file") ;
! 	filter = element.attribute("filter", QString::null) ;
! 	connect(textedit,SIGNAL(textChanged()),SLOT(textChanged()));
! 	connect(button,SIGNAL(clicked()),SLOT(slotPopingup()));
! 
! 	size = element.attribute ("size", "small");
! 	if (size == "small") {
! 	textedit->setMinimumSize (300,25) ; 
! 	button ->setMinimumSize (300,25) ; 
! 	textedit->setMaximumSize (300,25) ; 
! 	button ->setMaximumSize (300,25) ; 
! 	}
! 	else if (size == "big") {
! 	textedit->setMinimumSize (300,100) ; 
! 	button->setMinimumSize (300,100) ; 
! 	}
! 	
! 	
! }
  
  
! RKPluginBrowser::~RKPluginBrowser()
! {
! 	RK_TRACE (PLUGIN);
! }
  
! void RKPluginBrowser::setEnabled(bool checked){
! 	RK_TRACE (PLUGIN);
! label->setEnabled(checked);
! textedit->setEnabled(checked);
! button->setEnabled(checked);
! }
  
  
! void RKPluginBrowser::slotActive(bool isOk){
! 	RK_TRACE (PLUGIN);
! textedit->setEnabled(isOk) ;
! button->setEnabled(isOk) ;
! label->setEnabled(isOk) ;
  }
  
!   
! void RKPluginBrowser::slotActive(){
  	RK_TRACE (PLUGIN);
- bool isOk = textedit->isEnabled();
- textedit->setEnabled(! isOk) ;
- button->setEnabled(! isOk) ;
- label->setEnabled(! isOk) ;
  }
  
! QString RKPluginBrowser::value (const QString &) {
  	RK_TRACE (PLUGIN);
- 	return textedit->text();
- }
  
  
! void RKPluginBrowser::textChanged(){
! 	RK_TRACE (PLUGIN);
! 	emit(changed());
  }
  
! void RKPluginBrowser::slotPopingup(){
  	RK_TRACE (PLUGIN);
- 	if (type == "file") {
- 		QString filename= KFileDialog:: getOpenFileName(QString::null,filter,0, QString::null) ; 
- 		textedit ->setText(filename);
- 		emit(changed());}
- 	else if (type=="dir"){
- 		QString filename= KFileDialog::getExistingDirectory(); 
- 		textedit ->setText(filename);
- 		emit(changed());}
- 	else if (type=="files"){
- 		QStringList filenames =KFileDialog:: getOpenFileNames(QString::null,filter,0,QString::null);
- 		QString filename = filenames.join( "\n" );
- 		textedit ->setText(filename);
- 		emit(changed());
- 		};
- 	
- }
  
  
  #include "rkpluginbrowser.moc"
--- 1,82 ----
+ /***************************************************************************
+                           rkpluginbrowser  -  description
+                              -------------------
+     begin                : Sat Mar 10 2005
+     copyright            : (C) 2005, 2006 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 "rkpluginbrowser.h"
  
  #include <qlayout.h>
  
  #include <klocale.h>
  
! #include "../misc/xmlhelper.h"
! #include "../misc/getfilenamewidget.h"
  #include "../rkglobals.h"
  #include "../debug.h"
  
! RKPluginBrowser::RKPluginBrowser (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
  	RK_TRACE (PLUGIN);
  
! 	// get xml-helper
! 	XMLHelper *xml = XMLHelper::getStaticHelper ();
  
+ 	// create and add property
+ 	addChild ("selection", selection = new RKComponentPropertyBase (this, true));
+ 	connect (selection, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (textChanged (RKComponentPropertyBase *)));
  
! 	QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
  
! 	int intmode = xml->getMultiChoiceAttribute (element, "type", "file;dir", 0, DL_INFO);
! 	GetFileNameWidget::FileType mode;
! 	if (intmode == 0) {
! 		mode = GetFileNameWidget::ExistingFile;
! 	} else {
! 		mode = GetFileNameWidget::ExistingDirectory;
! 	}
! 	selector = new GetFileNameWidget (this, mode, xml->getStringAttribute (element, "label", i18n ("Enter filename"), DL_INFO), i18n ("Select"), xml->getStringAttribute (element, "initial", QString::null, DL_INFO));
! 	selector->setFilter (xml->getStringAttribute (element, "filter", QString::null, DL_INFO));
! 	connect (selector, SIGNAL (locationChanged ()), SLOT (textChanged ()));
  
+ 	vbox->addWidget (selector);
  
! 	// initialize
! 	updating = true;
! 	textChanged ();
! 	updating = false;
  }
  
! RKPluginBrowser::~RKPluginBrowser () {
  	RK_TRACE (PLUGIN);
  }
  
! void RKPluginBrowser::textChanged (RKComponentPropertyBase *) {
  	RK_TRACE (PLUGIN);
  
+ 	if (updating) return;
+ 	updating = true;
  
! 	selector->setLocation (selection->value ());
! 
! 	updating = false;
! 	selection->setValue (selector->getLocation ());
  }
  
! void RKPluginBrowser::textChanged () {
  	RK_TRACE (PLUGIN);
  
+ 	selection->setValue (selector->getLocation ());
+ }
  
  #include "rkpluginbrowser.moc"

Index: rkcheckbox.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcheckbox.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rkcheckbox.cpp	17 Mar 2006 13:27:18 -0000	1.8
--- rkcheckbox.cpp	17 Mar 2006 16:46:25 -0000	1.9
***************
*** 56,59 ****
--- 56,61 ----
  	checkbox->setChecked (state->boolValue ());
  	updating = false;
+ 
+ 	changed ();
  }
  





More information about the rkward-tracker mailing list