Q3CString versus QByteArray

Ralf Habacker ralf.habacker at freenet.de
Thu Oct 20 11:41:27 BST 2005


Hi, 

I'm using qt4.0.1 gpl'ed QT version for windows and got problems in the below mentioned files using Q3CString, which let the compiler (gcc 3.4.2) fails with 

kio\kio\kmimetype.cpp: In member function `virtual QString KFolderType::icon(const KURL&, bool) const':
kio\kio\kmimetype.cpp:634: error: no matching function for call to `Q3ValueList<Q3CString>::append(char[260])'
C:/Qt/4.0.1/include/Qt/../../src/qt3support/tools/q3valuelist.h:172: note: candidates are: Q3ValueListIterator<T> Q3ValueList<T>::append(con
st T&) [with T = Q3CString]

kio\kio\kmimetype.cpp:1109: error: no matching function for call to `KDirNotify_stub::KDirNotify_stub(const char[2], const char[12])'
kio/kio/kdirnotify_stub.h:20: note: candidates are: KDirNotify_stub::KDirNotify_stub(const KDirNotify_stub&)
kio/kio/kdirnotify_stub.h:30: note:                 KDirNotify_stub::KDirNotify_stub()
kio/kio/kdirnotify_stub.h:24: note:                 KDirNotify_stub::KDirNotify_stub(const DCOPRef&)
kio/kio/kdirnotify_stub.h:23: note:                 KDirNotify_stub::KDirNotify_stub(DCOPClient*, const Q3CString&, const Q3CString&)
kio/kio/kdirnotify_stub.h:22: note:                 KDirNotify_stub::KDirNotify_stub(const Q3CString&, const Q3CString&)
scons: *** [build\kio\kio\kmimetype.o] Error 1

The QT porting guide suggests general to replace QCString with QByteArray. 
Any problems with this patch ? 

Regards

Ralf 
 



Index: kio/kmimetype.cpp
===================================================================
--- kio/kmimetype.cpp   (revision 471903)
+++ kio/kmimetype.cpp   (working copy)
@@ -629,7 +629,7 @@
       dp = opendir( QFile::encodeName(_url.path()) );
       if ( dp )
       {
-        Q3ValueList<Q3CString> entries;
+        Q3ValueList<QByteArray> entries;
         // Note that readdir isn't guaranteed to return "." and ".." first (#79826)
         ep=readdir( dp ); if ( ep ) entries.append( ep->d_name );
         ep=readdir( dp ); if ( ep ) entries.append( ep->d_name );
@@ -1004,7 +1004,7 @@

   if( cfg.hasKey( "X-KDE-GetActionMenu" )) {
     QString dcopcall = cfg.readEntry( "X-KDE-GetActionMenu" );
-    const Q3CString app = dcopcall.section(' ', 0,0).toUtf8();
+    const QByteArray app = dcopcall.section(' ', 0,0).toUtf8();

     QByteArray dataToSend;
     QDataStream dataStream(&dataToSend, QIODevice::WriteOnly);

+++ kio/kdirnotify_stub.h       (working copy)
@@ -13,14 +13,11 @@
 #include <dcopobject.h>
 #include <kurl.h>

-class Q3CString;
-
-
 class KIO_EXPORT KDirNotify_stub : virtual public DCOPStub
 {
 public:
-    KDirNotify_stub( const Q3CString& app, const Q3CString& id );
-    KDirNotify_stub( DCOPClient* client, const Q3CString& app, const Q3CString& id );
+    KDirNotify_stub( const QByteArray& app, const QByteArray& id );
+    KDirNotify_stub( DCOPClient* client, const QByteArray& app, const QByteArray& id );
     explicit KDirNotify_stub( const DCOPRef& ref );
     virtual ASYNC FilesAdded( const KURL& directory );
     virtual ASYNC FilesRemoved( const KURL::List& fileList );


Index: kio/kdirnotify_stub.cpp
===================================================================
--- kio/kdirnotify_stub.cpp     (revision 471903)
+++ kio/kdirnotify_stub.cpp     (working copy)
@@ -29,15 +29,13 @@

 #include <kdatastream.h>

-#include <q3cstring.h>

-
-KDirNotify_stub::KDirNotify_stub( const Q3CString& app, const Q3CString& obj )
+KDirNotify_stub::KDirNotify_stub( const QByteArray& app, const QByteArray& obj )
   : DCOPStub( app, obj )
 {
 }

-KDirNotify_stub::KDirNotify_stub( DCOPClient* client, const Q3CString& app, const Q3CString& obj )
+KDirNotify_stub::KDirNotify_stub( DCOPClient* client, const QByteArray& app, const QByteArray& obj )
   : DCOPStub( client, app, obj )
 {
 }


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051020/2a2f51ff/attachment.htm>


More information about the kde-core-devel mailing list