Bug 58816

Summary: JJ: no way to pass a QStringList as method argument
Product: [Frameworks and Libraries] dcop Reporter: Mario Scalas <mario.scalas>
Component: kdcopAssignee: geiseri
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Attachments: Proposed Implementation

Description Mario Scalas 2003-05-22 19:16:48 UTC
Version:            (using KDE KDE 3.1.2)
Installed from:    Gentoo Packages
Compiler:          gcc-3.2.2 -march=pentium3 -O3 -pipe
OS:          Linux

I have the need to invoke a method of a dcop object which takes a QStringList a parameter:

mario@gecko scripts $ dcop $CVSSERVICE CvsService
<snip>
DCOPRef commit(QStringList files,QString commitMessage,bool recursive)
<snip>

There is no way: whatever syntax I use, with single or double quotes, doesn't work. For example:

mario@gecko scripts $ dcop $CVSSERVICE CvsService commit 'src/cvstest.cpp' 'just a try' false
Not enough arguments.

The message is always the same. I tried the graphical kdcop utility but when I try to call this method it shows a message box which reads: "Cannot handle datatype QStringList": it seems it is the same for comandl-ine dcop ...
Comment 1 Christian Loose 2003-05-22 22:57:26 UTC
Hi Mario, 
 
Wow! I never expected someone would really use my cvs dcop service outside of 
Cervisia. :-) 
 
The following worked for me: 
 
dcop $CVSSERVICE CvsService commit [ 'src/cvstest.cpp' 'just a try' ] false 
 
So you have to mark the start and the end of the QStringList with brackets. Also see 
for more information: 
http://lists.kde.org/?l=kde-core-devel&m=100449158108893&w=2 
 
Bye 
Christian 
Comment 2 Mario Scalas 2003-05-23 16:53:35 UTC
Hey Christian, this was a fast reply. And you are right too :) It works!!! Blame on me 
that didn't search the mailing lists ;( 
 
Another point for command line (dcop) Vs GUI tool (kdcop) ;) 
 
Thanks! 
 
Should it closed as a WORKSFORME or INVALID? 
Comment 3 Christian Loose 2003-05-23 18:06:02 UTC
I changed the component to 'kdcop' since kdcop can't handle QStringList 
arguments as Mario described above. I think it would be good if the GUI Tool 
handles the same data types as the command line client. 
 
Bye 
Christian 
Comment 4 groot 2004-02-01 20:08:23 UTC
Still there post 3.2 - if you click on a method that needs a QStringList, kdcop tells you it doesn't support that datatype. Since the command-line tool _does_ support it, this makes kdcop much less useful than it might be. The more so because the CLI dcop doesn't handle disambiguating overloaded DCOP methods well (viz. klauncher).

[Summary changed with JJ: because I think this is a good QA Team / starter's job.] [OS changed because it's more general.]
Comment 5 Christian Loose 2004-02-01 20:32:26 UTC
Created attachment 4474 [details]
Proposed Implementation

This patch was proposed by Ralf Habacker on kde-core-devel on 01/14/04.
(see http://lists.kde.org/?l=kde-core-devel&m=107410108311352&w=2)

Simon Hausmann said that it was okay to commit but nothing happened.
Comment 6 Christian Loose 2004-02-05 23:30:05 UTC
Subject: kdebase/kdcop

CVS commit by cloose: 

Support for QStringList and QValueList<QCString>.

Original patch by Ralf Habacker (http://lists.kde.org/?l=kde-core-devel&m=107410108311352&w=2).
Slightly modified and tested by me.

CCMAIL: ralf.habacker@freenet.de
CCMAIL: 58816-done@bugs.kde.org


  M +33 -1     kdcopwindow.cpp   1.43


--- kdebase/kdcop/kdcopwindow.cpp  #1.42:1.43
@@ -21,4 +21,5 @@
 #include <kiconloader.h>
 #include <klineedit.h>
+#include <keditlistbox.h>
 #include <klistbox.h>
 #include <kdialogbase.h>
@@ -466,4 +467,24 @@ void KDCOPWindow::slotCallFunction( QLis
         wl.append( e );
       }
+      else if ( type == "QStringList" )
+      {
+        QLabel* n = new QLabel( names[i-1], frame );
+        grid->addWidget( n, i, 0 );
+        QLabel* l = new QLabel( "QStringList", frame );
+        grid->addWidget( l, i, 1 );
+        KEditListBox* e = new KEditListBox ( frame );
+        grid->addWidget( e, i, 2 );
+        wl.append( e );
+      }
+      else if ( type == "QValueList<QCString>" )
+      {
+        QLabel* n = new QLabel( names[i-1], frame );
+        grid->addWidget( n, i, 0 );
+        QLabel* l = new QLabel( "QValueList<QCString>", frame );
+        grid->addWidget( l, i, 1 );
+        KEditListBox* e = new KEditListBox ( frame );
+        grid->addWidget( e, i, 2 );
+        wl.append( e );
+      }
       else if ( type == "KURL" )
       {
@@ -552,4 +573,15 @@ void KDCOPWindow::slotCallFunction( QLis
         arg << e->text();
       }
+      else if( type == "QStringList" )
+      {
+        KEditListBox* e = (KEditListBox*)wl.at( i );
+        arg << e->items();
+      }
+      else if( type == "QValueList<QCString>" )
+      {
+        KEditListBox* e = (KEditListBox*)wl.at( i );
+        for (int i = 0; i < e->count(); i++)
+          arg << QCString( e->text(i).local8Bit() );
+      }
       else if( type == "KURL" )
       {