[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Patch: more supported type in KDCOP
From: Olivier Goffart <ogoffart () tiscalinet ! be>
Date: 2004-02-06 17:11:23
Message-ID: 200402061811.25776.ogoffart () tiscalinet ! be
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Hello
I've wrote a patch to support more type in KDCOP (QSize, QRect, QPoint,
QColor, QPixmap)
I was about to support more type like QVariant, but i feeled tired
I was not sure if i can commit dirrectly, so i prefer ask here before. is it
ok to commit? or do you have comment?
should i post again to this list before commiting?
["kdcop.diff" (text/x-diff)]
? kdcop.kdevelop
? kdcop.kdevelop.pcs
? kdcop.kdevses
Index: Makefile.am
===================================================================
RCS file: /home/kde/kdebase/kdcop/Makefile.am,v
retrieving revision 1.4
diff -u -p -b -B -r1.4 Makefile.am
--- Makefile.am 1 Nov 2001 03:42:58 -0000 1.4
+++ Makefile.am 6 Feb 2004 15:56:09 -0000
@@ -10,7 +10,7 @@ INCLUDES = $(all_includes)
bin_PROGRAMS = kdcop
kdcop_SOURCES = kdcop.cpp kdcopwindow.cpp kdcoplistview.cpp kdcopview.ui
-kdcop_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_KDEUI) $(LIB_KDECORE) -lDCOP $(LIB_QT)
+kdcop_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_KIO) -lDCOP $(LIB_QT)
noinst_HEADERS = kdcopwindow.h
METASOURCES = AUTO
Index: kdcopwindow.cpp
===================================================================
RCS file: /home/kde/kdebase/kdcop/kdcopwindow.cpp,v
retrieving revision 1.43
diff -u -p -b -B -r1.43 kdcopwindow.cpp
--- kdcopwindow.cpp 5 Feb 2004 22:30:01 -0000 1.43
+++ kdcopwindow.cpp 6 Feb 2004 15:56:09 -0000
@@ -24,6 +24,7 @@
#include <klistbox.h>
#include <kdialogbase.h>
#include <kstdaccel.h>
+#include <kcolorbutton.h>
#include <qtimer.h>
#include <qwidgetstack.h>
@@ -42,17 +43,46 @@
#include <qclipboard.h>
#include <qdatetime.h>
#include <dcopref.h>
+#include <qvbox.h>
#include <kdebug.h>
#include <kkeydialog.h>
#include <stdio.h>
#include <kstatusbar.h>
#include <kurl.h>
+#include <kurlrequester.h>
class DCOPBrowserApplicationItem;
class DCOPBrowserInterfaceItem;
class DCOPBrowserFunctionItem;
+//------------------------------
+
+class KMultiIntEdit : public QVBox
+{
+public:
+ KMultiIntEdit(QWidget *parent , const char * name=0) : QVBox(parent,name) {}
+ void addField(int key, const QString & caption )
+ {
+ QHBox *l=new QHBox(this);
+ new QLabel(caption + ": ", l);
+ KLineEdit* e = new KLineEdit( l );
+ m_widgets.insert(key, e ) ;
+ e->setValidator( new QIntValidator( e ) );
+ }
+ int field(int key)
+ {
+ KLineEdit *e=m_widgets[key];
+ if(!e) return 0;
+ return e->text().toInt();
+ }
+
+private:
+ QMap<int,KLineEdit*> m_widgets;
+};
+
+//------------------------------
+
DCOPBrowserItem::DCOPBrowserItem
(QListView * parent, DCOPBrowserItem::Type type)
: QListViewItem(parent),
@@ -496,6 +526,64 @@ void KDCOPWindow::slotCallFunction( QLis
grid->addWidget( e, i, 2 );
wl.append( e );
}
+ else if ( type == "QColor" )
+ {
+ QLabel* n = new QLabel( names[i-1], frame );
+ grid->addWidget( n, i, 0 );
+ QLabel* l = new QLabel( "QColor", frame );
+ grid->addWidget( l, i, 1 );
+ KColorButton* e = new KColorButton( frame );
+ grid->addWidget( e, i, 2 );
+ wl.append( e );
+ }
+ else if ( type == "QSize" )
+ {
+ QLabel* n = new QLabel( names[i-1], frame );
+ grid->addWidget( n, i, 0 );
+ QLabel* l = new QLabel( "QSize", frame );
+ grid->addWidget( l, i, 1 );
+ KMultiIntEdit* e = new KMultiIntEdit( frame );
+ e->addField( 1, i18n("Width") );
+ e->addField( 2, i18n("Height") );
+ grid->addWidget( e, i, 2 );
+ wl.append( e );
+ }
+ else if ( type == "QPoint" )
+ {
+ QLabel* n = new QLabel( names[i-1], frame );
+ grid->addWidget( n, i, 0 );
+ QLabel* l = new QLabel( "QPoint", frame );
+ grid->addWidget( l, i, 1 );
+ KMultiIntEdit* e = new KMultiIntEdit( frame );
+ e->addField( 1, i18n("X") );
+ e->addField( 2, i18n("Y") );
+ grid->addWidget( e, i, 2 );
+ wl.append( e );
+ }
+ else if ( type == "QRect" )
+ {
+ QLabel* n = new QLabel( names[i-1], frame );
+ grid->addWidget( n, i, 0 );
+ QLabel* l = new QLabel( "QRect", frame );
+ grid->addWidget( l, i, 1 );
+ KMultiIntEdit* e = new KMultiIntEdit( frame );
+ e->addField( 1, i18n("Left") );
+ e->addField( 2, i18n("Top") );
+ e->addField( 3, i18n("Width") );
+ e->addField( 4, i18n("Height") );
+ grid->addWidget( e, i, 2 );
+ wl.append( e );
+ }
+ else if( type == "QPixmap" )
+ {
+ QLabel* n = new QLabel( names[i-1], frame );
+ grid->addWidget( n, i, 0 );
+ QLabel* l = new QLabel( "KURL", frame );
+ grid->addWidget( l, i, 1 );
+ KURLRequester* e = new KURLRequester( frame );
+ grid->addWidget( e, i, 2 );
+ wl.append( e );
+ }
else
{
KMessageBox::sorry(this, i18n("Cannot handle datatype %1").arg(type));
@@ -588,6 +676,31 @@ void KDCOPWindow::slotCallFunction( QLis
KLineEdit* e = (KLineEdit*)wl.at( i );
arg << KURL( e->text() );
}
+ else if( type == "QColor" )
+ {
+ KColorButton* e = (KColorButton*)wl.at( i );
+ arg << e->color();
+ }
+ else if( type == "QSize" )
+ {
+ KMultiIntEdit* e = (KMultiIntEdit*)wl.at( i );
+ arg << QSize(e->field(1) , e->field(2)) ;
+ }
+ else if( type == "QPoint" )
+ {
+ KMultiIntEdit* e = (KMultiIntEdit*)wl.at( i );
+ arg << QPoint(e->field(1) , e->field(2)) ;
+ }
+ else if( type == "QRect" )
+ {
+ KMultiIntEdit* e = (KMultiIntEdit*)wl.at( i );
+ arg << QRect(e->field(1) , e->field(2) , e->field(3) , e->field(4)) ;
+ }
+ else if( type == "QPixmap" )
+ {
+ KURLRequester* e= (KURLRequester*)wl.at( i );
+ arg << QPixmap(e->url());
+ }
else
{
KMessageBox::sorry(this, i18n("Cannot handle datatype %1").arg(type));
[Attachment #6 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic