summaryrefslogtreecommitdiffabout
path: root/microkde/kdecore
Unidiff
Diffstat (limited to 'microkde/kdecore') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdecore/kcatalogue.cpp4
-rw-r--r--microkde/kdecore/kconfigbase.h4
-rw-r--r--microkde/kdecore/klibloader.cpp29
-rw-r--r--microkde/kdecore/klibloader.h10
-rw-r--r--microkde/kdecore/klocale.cpp23
-rw-r--r--microkde/kdecore/klocale.h4
-rw-r--r--microkde/kdecore/kmdcodec.cpp139
-rw-r--r--microkde/kdecore/kmdcodec.h38
-rw-r--r--microkde/kdecore/kprefs.cpp16
-rw-r--r--microkde/kdecore/kprefs.h10
-rw-r--r--microkde/kdecore/kshortcut.h8
-rw-r--r--microkde/kdecore/kstandarddirs.cpp24
-rw-r--r--microkde/kdecore/kstandarddirs.h10
13 files changed, 167 insertions, 152 deletions
diff --git a/microkde/kdecore/kcatalogue.cpp b/microkde/kdecore/kcatalogue.cpp
index 97ac326..1600b08 100644
--- a/microkde/kdecore/kcatalogue.cpp
+++ b/microkde/kdecore/kcatalogue.cpp
@@ -11,24 +11,26 @@
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20//US #include <config.h> 20//US #include <config.h>
21 21
22#include <qfile.h> 22#include <qfile.h>
23//Added by qt3to4:
24#include <Q3CString>
23 25
24#include <kdebug.h> 26#include <kdebug.h>
25 27
26#include "kcatalogue.h" 28#include "kcatalogue.h"
27 29
28char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file, 30char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file,
29 const char *msgid); 31 const char *msgid);
30void k_nl_unload_domain (struct loaded_domain *domain); 32void k_nl_unload_domain (struct loaded_domain *domain);
31 33
32#ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp 34#ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp
33struct kde_loaded_l10nfile 35struct kde_loaded_l10nfile
34{ 36{
@@ -79,25 +81,25 @@ KCatalogue::~KCatalogue()
79QString KCatalogue::name() const 81QString KCatalogue::name() const
80{ 82{
81 return d->name; 83 return d->name;
82} 84}
83 85
84void KCatalogue::setFileName( const QString & fileName ) 86void KCatalogue::setFileName( const QString & fileName )
85{ 87{
86 // nothing to do if the file name is already the same 88 // nothing to do if the file name is already the same
87 if ( this->fileName() == fileName ) return; 89 if ( this->fileName() == fileName ) return;
88 90
89 doUnload(); 91 doUnload();
90 92
91 QCString newFileName = QFile::encodeName( fileName ); 93 Q3CString newFileName = QFile::encodeName( fileName );
92 94
93 if ( !fileName.isEmpty() ) 95 if ( !fileName.isEmpty() )
94 { 96 {
95 // set file name 97 // set file name
96 char *filename = new char[ newFileName.length() + 1 ]; 98 char *filename = new char[ newFileName.length() + 1 ];
97 ::qstrcpy( filename, newFileName ); 99 ::qstrcpy( filename, newFileName );
98 d->domain.filename = filename; 100 d->domain.filename = filename;
99 } 101 }
100} 102}
101 103
102QString KCatalogue::fileName() const 104QString KCatalogue::fileName() const
103{ 105{
diff --git a/microkde/kdecore/kconfigbase.h b/microkde/kdecore/kconfigbase.h
index 7e56d11..1ef6a04 100644
--- a/microkde/kdecore/kconfigbase.h
+++ b/microkde/kdecore/kconfigbase.h
@@ -17,24 +17,26 @@
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23// $Id$ 23// $Id$
24 24
25#ifndef _KCONFIGBASE_H 25#ifndef _KCONFIGBASE_H
26#define _KCONFIGBASE_H 26#define _KCONFIGBASE_H
27 27
28#include "kconfig.h" 28#include "kconfig.h"
29//Added by qt3to4:
30#include <Q3CString>
29 31
30/** 32/**
31 * Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig 33 * Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig
32 * groups. 34 * groups.
33 * 35 *
34 * Careful programmers always set the group of a 36 * Careful programmers always set the group of a
35 * @ref KConfig @ref KSimpleConfig object to the group they want to read from 37 * @ref KConfig @ref KSimpleConfig object to the group they want to read from
36 * and set it back to the old one of afterwards. This is usually 38 * and set it back to the old one of afterwards. This is usually
37 * written as: 39 * written as:
38 * <pre> 40 * <pre>
39 * 41 *
40 * QString oldgroup config->group(); 42 * QString oldgroup config->group();
@@ -73,25 +75,25 @@ public:
73 * KConfigGroupSaver works on. 75 * KConfigGroupSaver works on.
74 * @param group The new group that the config object should switch to. 76 * @param group The new group that the config object should switch to.
75 */ 77 */
76 KConfigGroupSaver( KConfig* config, QString group ) 78 KConfigGroupSaver( KConfig* config, QString group )
77 /* KDE 4 : make the second parameter const QString & */ 79 /* KDE 4 : make the second parameter const QString & */
78 : _config(config), _oldgroup(config->group()) 80 : _config(config), _oldgroup(config->group())
79 { _config->setGroup( group ); } 81 { _config->setGroup( group ); }
80 82
81 KConfigGroupSaver( KConfig* config, const char *group ) 83 KConfigGroupSaver( KConfig* config, const char *group )
82 : _config(config), _oldgroup(config->group()) 84 : _config(config), _oldgroup(config->group())
83 { _config->setGroup( group ); } 85 { _config->setGroup( group ); }
84 86
85 KConfigGroupSaver( KConfig* config, const QCString &group ) 87 KConfigGroupSaver( KConfig* config, const Q3CString &group )
86 : _config(config), _oldgroup(config->group()) 88 : _config(config), _oldgroup(config->group())
87 { _config->setGroup( group ); } 89 { _config->setGroup( group ); }
88 90
89 ~KConfigGroupSaver() { _config->setGroup( _oldgroup ); } 91 ~KConfigGroupSaver() { _config->setGroup( _oldgroup ); }
90 92
91 KConfig* config() { return _config; }; 93 KConfig* config() { return _config; };
92 94
93private: 95private:
94 KConfig* _config; 96 KConfig* _config;
95 QString _oldgroup; 97 QString _oldgroup;
96 98
97 KConfigGroupSaver(const KConfigGroupSaver&); 99 KConfigGroupSaver(const KConfigGroupSaver&);
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index 6d0475a..0b54eb6 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -11,50 +11,53 @@
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19//US #include <config.h> 19//US #include <config.h>
20#include <qclipboard.h> 20#include <qclipboard.h>
21#include <qfile.h> 21#include <qfile.h>
22#include <qtimer.h> 22#include <qtimer.h>
23#include <qobjectdict.h> 23#include <q3objectdict.h>
24#include <qwidgetlist.h>
25#include <qwidget.h> 24#include <qwidget.h>
25#include <qwidget.h>
26//Added by qt3to4:
27#include <Q3CString>
28#include <Q3PtrList>
26 29
27#include "kapplication.h" 30#include "kapplication.h"
28#include "klibloader.h" 31#include "klibloader.h"
29#include "kstandarddirs.h" 32#include "kstandarddirs.h"
30#include "kdebug.h" 33#include "kdebug.h"
31#include "klocale.h" 34#include "klocale.h"
32 35
33/*US 36/*US
34#ifndef NDEBUG 37#ifndef NDEBUG
35#include "ltdl.h" 38#include "ltdl.h"
36#endif 39#endif
37*/ 40*/
38 41
39//US do everything through qlibrary 42//US do everything through qlibrary
40#ifndef DESKTOP_VERSION 43#ifndef DESKTOP_VERSION
41#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
42#include <qtopia/qlibrary.h> 45#include <qtopia/qlibrary.h>
43#else 46#else
44#include <qlibrary.h> 47#include <qlibrary.h>
45#endif 48#endif
46 49
47 50
48template class QAsciiDict<KLibrary>; 51template class Q3AsciiDict<KLibrary>;
49 52
50#include <stdlib.h> //getenv 53#include <stdlib.h> //getenv
51 54
52/*US 55/*US
53#if HAVE_DLFCN_H 56#if HAVE_DLFCN_H
54# include <dlfcn.h> 57# include <dlfcn.h>
55#endif 58#endif
56 59
57#ifdef RTLD_GLOBAL 60#ifdef RTLD_GLOBAL
58# define LT_GLOBAL RTLD_GLOBAL 61# define LT_GLOBAL RTLD_GLOBAL
59#else 62#else
60# ifdef DL_GLOBAL 63# ifdef DL_GLOBAL
@@ -111,25 +114,25 @@ KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* h
111 m_timer = 0; 114 m_timer = 0;
112} 115}
113 116
114KLibrary::~KLibrary() 117KLibrary::~KLibrary()
115{ 118{
116// kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl; 119// kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl;
117 if ( m_timer && m_timer->isActive() ) 120 if ( m_timer && m_timer->isActive() )
118 m_timer->stop(); 121 m_timer->stop();
119 122
120 // If any object is remaining, delete 123 // If any object is remaining, delete
121 if ( m_objs.count() > 0 ) 124 if ( m_objs.count() > 0 )
122 { 125 {
123 QPtrListIterator<QObject> it( m_objs ); 126 Q3PtrListIterator<QObject> it( m_objs );
124 for ( ; it.current() ; ++it ) 127 for ( ; it.current() ; ++it )
125 { 128 {
126 kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl; 129 kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl;
127 disconnect( it.current(), SIGNAL( destroyed() ), 130 disconnect( it.current(), SIGNAL( destroyed() ),
128 this, SLOT( slotObjectDestroyed() ) ); 131 this, SLOT( slotObjectDestroyed() ) );
129 } 132 }
130 m_objs.setAutoDelete(true); 133 m_objs.setAutoDelete(true);
131 m_objs.clear(); 134 m_objs.clear();
132 } 135 }
133 136
134 if ( m_factory ) { 137 if ( m_factory ) {
135 //kdDebug(150) << " ... deleting the factory " << m_factory << endl; 138 //kdDebug(150) << " ... deleting the factory " << m_factory << endl;
@@ -143,25 +146,25 @@ QString KLibrary::name() const
143} 146}
144 147
145QString KLibrary::fileName() const 148QString KLibrary::fileName() const
146{ 149{
147 return m_filename; 150 return m_filename;
148} 151}
149 152
150KLibFactory* KLibrary::factory() 153KLibFactory* KLibrary::factory()
151{ 154{
152 if ( m_factory ) 155 if ( m_factory )
153 return m_factory; 156 return m_factory;
154 157
155 QCString symname; 158 Q3CString symname;
156 symname.sprintf("init_%s", name().latin1() ); 159 symname.sprintf("init_%s", name().latin1() );
157 160
158 void* sym = symbol( symname ); 161 void* sym = symbol( symname );
159 if ( !sym ) 162 if ( !sym )
160 { 163 {
161 qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data()); 164 qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data());
162#ifndef NDEBUG 165#ifndef NDEBUG
163//US qDebug("KLibrary: errorcode: %s", lt_dlerror()); 166//US qDebug("KLibrary: errorcode: %s", lt_dlerror());
164#endif 167#endif
165 kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl; 168 kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl;
166 return 0; 169 return 0;
167 } 170 }
@@ -296,26 +299,26 @@ KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h)
296//US use instead: 299//US use instead:
297 if (h->resolve("__kde_do_not_unload") != 0) { 300 if (h->resolve("__kde_do_not_unload") != 0) {
298// kdDebug(150) << "Will not unload " << name << endl; 301// kdDebug(150) << "Will not unload " << name << endl;
299 unload_mode = DONT_UNLOAD; 302 unload_mode = DONT_UNLOAD;
300 } else if (h->resolve("__kde_do_unload") != 0) { 303 } else if (h->resolve("__kde_do_unload") != 0) {
301 unload_mode = UNLOAD; 304 unload_mode = UNLOAD;
302 } 305 }
303} 306}
304 307
305class KLibLoaderPrivate 308class KLibLoaderPrivate
306{ 309{
307public: 310public:
308 QPtrList<KLibWrapPrivate> loaded_stack; 311 Q3PtrList<KLibWrapPrivate> loaded_stack;
309 QPtrList<KLibWrapPrivate> pending_close; 312 Q3PtrList<KLibWrapPrivate> pending_close;
310 enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode; 313 enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode;
311 314
312 QString errorMessage; 315 QString errorMessage;
313}; 316};
314 317
315KLibLoader* KLibLoader::s_self = 0; 318KLibLoader* KLibLoader::s_self = 0;
316 319
317KLibLoader* KLibLoader::self() 320KLibLoader* KLibLoader::self()
318{ 321{
319 if ( !s_self ) 322 if ( !s_self )
320 s_self = new KLibLoader; 323 s_self = new KLibLoader;
321 return s_self; 324 return s_self;
@@ -339,41 +342,41 @@ KLibLoader::KLibLoader( QObject* parent, const char* name )
339 d->unload_mode = KLibLoaderPrivate::UNKNOWN; 342 d->unload_mode = KLibLoaderPrivate::UNKNOWN;
340 if (getenv("KDE_NOUNLOAD") != 0) 343 if (getenv("KDE_NOUNLOAD") != 0)
341 d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; 344 d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD;
342 else if (getenv("KDE_DOUNLOAD") != 0) 345 else if (getenv("KDE_DOUNLOAD") != 0)
343 d->unload_mode = KLibLoaderPrivate::UNLOAD; 346 d->unload_mode = KLibLoaderPrivate::UNLOAD;
344 d->loaded_stack.setAutoDelete( true ); 347 d->loaded_stack.setAutoDelete( true );
345} 348}
346 349
347KLibLoader::~KLibLoader() 350KLibLoader::~KLibLoader()
348{ 351{
349// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; 352// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl;
350 353
351 QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); 354 Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs );
352 for (; it.current(); ++it ) 355 for (; it.current(); ++it )
353 { 356 {
354 kdDebug(150) << "The KLibLoader contains the library " << it.current()->name 357 kdDebug(150) << "The KLibLoader contains the library " << it.current()->name
355 << " (" << it.current()->lib << ")" << endl; 358 << " (" << it.current()->lib << ")" << endl;
356 d->pending_close.append(it.current()); 359 d->pending_close.append(it.current());
357 } 360 }
358 361
359 close_pending(0); 362 close_pending(0);
360 363
361 delete d; 364 delete d;
362} 365}
363 366
364//static 367//static
365QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) 368QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ )
366{ 369{
367 QCString libname( name ); 370 Q3CString libname( name );
368 371
369 // only append ".la" if there is no extension 372 // only append ".la" if there is no extension
370 // this allows to load non-libtool libraries as well 373 // this allows to load non-libtool libraries as well
371 // (mhk, 20000228) 374 // (mhk, 20000228)
372 int pos = libname.findRev('/'); 375 int pos = libname.findRev('/');
373 if (pos < 0) 376 if (pos < 0)
374 pos = 0; 377 pos = 0;
375/*US 378/*US
376 if (libname.find('.', pos) < 0) { 379 if (libname.find('.', pos) < 0) {
377 libname += ".la"; 380 libname += ".la";
378 } 381 }
379*/ 382*/
@@ -412,25 +415,25 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta
412//US libfile = instance->dirs()->findResource( "lib", libname ); 415//US libfile = instance->dirs()->findResource( "lib", libname );
413 libfile = KGlobal::dirs()->findResource( "lib", libname ); 416 libfile = KGlobal::dirs()->findResource( "lib", libname );
414 //qDebug("libfile2 = %s ",libfile.latin1() ); 417 //qDebug("libfile2 = %s ",libfile.latin1() );
415#ifndef NDEBUG 418#ifndef NDEBUG
416 if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules 419 if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
417 kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; 420 kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
418#endif 421#endif
419 } 422 }
420 if ( libfile.isEmpty() ) 423 if ( libfile.isEmpty() )
421 { 424 {
422#ifndef NDEBUG 425#ifndef NDEBUG
423 kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; 426 kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl;
424 self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); 427 self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(QString(libname));
425 428
426 qDebug("KLibLoader::library could not find library: %s", libname.data()); 429 qDebug("KLibLoader::library could not find library: %s", libname.data());
427#endif 430#endif
428 431
429 } 432 }
430 else 433 else
431 self()->d->errorMessage = QString::null; 434 self()->d->errorMessage = QString::null;
432 } 435 }
433 436
434 //qDebug("return libfile = %s ",libfile.latin1() ); 437 //qDebug("return libfile = %s ",libfile.latin1() );
435 return libfile; 438 return libfile;
436} 439}
@@ -460,25 +463,25 @@ KLibrary* KLibLoader::library( const char *name )
460 if (!name) 463 if (!name)
461 return 0; 464 return 0;
462 465
463 KLibWrapPrivate* wrap = m_libs[name]; 466 KLibWrapPrivate* wrap = m_libs[name];
464 if (wrap) { 467 if (wrap) {
465 /* Nothing to do to load the library. */ 468 /* Nothing to do to load the library. */
466 wrap->ref_count++; 469 wrap->ref_count++;
467 return wrap->lib; 470 return wrap->lib;
468 } 471 }
469 472
470 /* Test if this library was loaded at some time, but got 473 /* Test if this library was loaded at some time, but got
471 unloaded meanwhile, whithout being dlclose()'ed. */ 474 unloaded meanwhile, whithout being dlclose()'ed. */
472 QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack); 475 Q3PtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
473 for (; it.current(); ++it) { 476 for (; it.current(); ++it) {
474 if (it.current()->name == name) 477 if (it.current()->name == name)
475 wrap = it.current(); 478 wrap = it.current();
476 } 479 }
477 480
478 if (wrap) { 481 if (wrap) {
479 d->pending_close.removeRef(wrap); 482 d->pending_close.removeRef(wrap);
480 if (!wrap->lib) { 483 if (!wrap->lib) {
481 /* This lib only was in loaded_stack, but not in m_libs. */ 484 /* This lib only was in loaded_stack, but not in m_libs. */
482 wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); 485 wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
483 } 486 }
484 wrap->ref_count++; 487 wrap->ref_count++;
@@ -541,44 +544,44 @@ KLibFactory* KLibLoader::factory( const char* name )
541{ 544{
542 KLibrary* lib = library( name ); 545 KLibrary* lib = library( name );
543 if ( !lib ) 546 if ( !lib )
544 return 0; 547 return 0;
545 548
546 return lib->factory(); 549 return lib->factory();
547} 550}
548 551
549void KLibLoader::slotLibraryDestroyed() 552void KLibLoader::slotLibraryDestroyed()
550{ 553{
551 const KLibrary *lib = static_cast<const KLibrary *>( sender() ); 554 const KLibrary *lib = static_cast<const KLibrary *>( sender() );
552 555
553 QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); 556 Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs );
554 for (; it.current(); ++it ) 557 for (; it.current(); ++it )
555 if ( it.current()->lib == lib ) 558 if ( it.current()->lib == lib )
556 { 559 {
557 KLibWrapPrivate *wrap = it.current(); 560 KLibWrapPrivate *wrap = it.current();
558 wrap->lib = 0; /* the KLibrary object is already away */ 561 wrap->lib = 0; /* the KLibrary object is already away */
559 m_libs.remove( it.currentKey() ); 562 m_libs.remove( it.currentKey() );
560 close_pending( wrap ); 563 close_pending( wrap );
561 return; 564 return;
562 } 565 }
563} 566}
564 567
565void KLibLoader::close_pending(KLibWrapPrivate *wrap) 568void KLibLoader::close_pending(KLibWrapPrivate *wrap)
566{ 569{
567 if (wrap && !d->pending_close.containsRef( wrap )) 570 if (wrap && !d->pending_close.containsRef( wrap ))
568 d->pending_close.append( wrap ); 571 d->pending_close.append( wrap );
569 572
570 /* First delete all KLibrary objects in pending_close, but _don't_ unload 573 /* First delete all KLibrary objects in pending_close, but _don't_ unload
571 the DSO behind it. */ 574 the DSO behind it. */
572 QPtrListIterator<KLibWrapPrivate> it(d->pending_close); 575 Q3PtrListIterator<KLibWrapPrivate> it(d->pending_close);
573 for (; it.current(); ++it) { 576 for (; it.current(); ++it) {
574 wrap = it.current(); 577 wrap = it.current();
575 if (wrap->lib) { 578 if (wrap->lib) {
576 disconnect( wrap->lib, SIGNAL( destroyed() ), 579 disconnect( wrap->lib, SIGNAL( destroyed() ),
577 this, SLOT( slotLibraryDestroyed() ) ); 580 this, SLOT( slotLibraryDestroyed() ) );
578 delete wrap->lib; 581 delete wrap->lib;
579 wrap->lib = 0; 582 wrap->lib = 0;
580 } 583 }
581 } 584 }
582 585
583 if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return; 586 if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return;
584 587
diff --git a/microkde/kdecore/klibloader.h b/microkde/kdecore/klibloader.h
index ed57109..53d146e 100644
--- a/microkde/kdecore/klibloader.h
+++ b/microkde/kdecore/klibloader.h
@@ -12,26 +12,26 @@
12 12
13 You should have received a copy of the GNU Library General Public License 13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to 14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17*/ 17*/
18#ifndef KLIBLOADER_H 18#ifndef KLIBLOADER_H
19#define KLIBLOADER_H 19#define KLIBLOADER_H
20 20
21#include <qobject.h> 21#include <qobject.h>
22#include <qstring.h> 22#include <qstring.h>
23#include <qstringlist.h> 23#include <qstringlist.h>
24#include <qasciidict.h> 24#include <q3asciidict.h>
25#include <qptrlist.h> 25#include <q3ptrlist.h>
26#include <kglobal.h> 26#include <kglobal.h>
27 27
28#include <stdlib.h> // For backwards compatibility 28#include <stdlib.h> // For backwards compatibility
29 29
30class KInstance; 30class KInstance;
31class QTimer; 31class QTimer;
32class KLibrary; 32class KLibrary;
33class KLibFactory; 33class KLibFactory;
34class KLibFactoryPrivate; 34class KLibFactoryPrivate;
35class KLibLoaderPrivate; 35class KLibLoaderPrivate;
36class KLibraryPrivate; 36class KLibraryPrivate;
37 37
@@ -43,25 +43,25 @@ class QLibrary;
43/** 43/**
44 * @short Represents a dynamically loaded library. 44 * @short Represents a dynamically loaded library.
45 * 45 *
46 * KLibrary allows you to look up symbols of the shared library. 46 * KLibrary allows you to look up symbols of the shared library.
47 * Use @ref KLibLoader to create a new instance of KLibrary. 47 * Use @ref KLibLoader to create a new instance of KLibrary.
48 * 48 *
49 * @see KLibLoader 49 * @see KLibLoader
50 * @author Torben Weis <weis@kde.org> 50 * @author Torben Weis <weis@kde.org>
51 */ 51 */
52class KLibrary : public QObject 52class KLibrary : public QObject
53{ 53{
54 friend class KLibLoader; 54 friend class KLibLoader;
55 friend class QAsciiDict<KLibrary>; 55 friend class Q3AsciiDict<KLibrary>;
56 56
57 Q_OBJECT 57 Q_OBJECT
58public: 58public:
59 /** 59 /**
60 * @internal 60 * @internal
61 * Don't create KLibrary objects on your own. Instead use @ref KLibLoader. 61 * Don't create KLibrary objects on your own. Instead use @ref KLibLoader.
62 */ 62 */
63//US KLibrary( const QString& libname, const QString& filename, void * handle ); 63//US KLibrary( const QString& libname, const QString& filename, void * handle );
64 KLibrary( const QString& libname, const QString& filename, QLibrary* handle ); 64 KLibrary( const QString& libname, const QString& filename, QLibrary* handle );
65 65
66 /** 66 /**
67 * Returns the name of the library. 67 * Returns the name of the library.
@@ -118,25 +118,25 @@ private slots:
118private: 118private:
119 /** 119 /**
120 * @internal 120 * @internal
121 * Don't destruct KLibrary objects yourself. Instead use @ref unload() instead. 121 * Don't destruct KLibrary objects yourself. Instead use @ref unload() instead.
122 */ 122 */
123 ~KLibrary(); 123 ~KLibrary();
124 124
125 QString m_libname; 125 QString m_libname;
126 QString m_filename; 126 QString m_filename;
127 KLibFactory* m_factory; 127 KLibFactory* m_factory;
128//US void * m_handle; 128//US void * m_handle;
129 QLibrary* m_handle; 129 QLibrary* m_handle;
130 QPtrList<QObject> m_objs; 130 Q3PtrList<QObject> m_objs;
131 QTimer *m_timer; 131 QTimer *m_timer;
132 KLibraryPrivate *d; 132 KLibraryPrivate *d;
133}; 133};
134 134
135class KLibWrapPrivate; 135class KLibWrapPrivate;
136 136
137/** 137/**
138 * The KLibLoader allows you to load libraries dynamically at runtime. 138 * The KLibLoader allows you to load libraries dynamically at runtime.
139 * Dependent libraries are loaded automatically. 139 * Dependent libraries are loaded automatically.
140 * 140 *
141 * KLibLoader follows the singleton pattern. You can not create multiple 141 * KLibLoader follows the singleton pattern. You can not create multiple
142 * instances. Use @ref self() to get a pointer to the loader. 142 * instances. Use @ref self() to get a pointer to the loader.
@@ -278,25 +278,25 @@ public:
278 * ".la" will be appended. 278 * ".la" will be appended.
279 * @param instance a KInstance used to get the standard paths 279 * @param instance a KInstance used to get the standard paths
280 */ 280 */
281 static QString findLibrary( const char * name/*US , const KInstance * instance = KGlobal::instance()*/ ); 281 static QString findLibrary( const char * name/*US , const KInstance * instance = KGlobal::instance()*/ );
282 282
283protected: 283protected:
284 KLibLoader( QObject* parent = 0, const char* name = 0 ); 284 KLibLoader( QObject* parent = 0, const char* name = 0 );
285 285
286private slots: 286private slots:
287 void slotLibraryDestroyed(); 287 void slotLibraryDestroyed();
288private: 288private:
289 void close_pending( KLibWrapPrivate * ); 289 void close_pending( KLibWrapPrivate * );
290 QAsciiDict<KLibWrapPrivate> m_libs; 290 Q3AsciiDict<KLibWrapPrivate> m_libs;
291 291
292 static KLibLoader* s_self; 292 static KLibLoader* s_self;
293 293
294protected: 294protected:
295 virtual void virtual_hook( int id, void* data ); 295 virtual void virtual_hook( int id, void* data );
296private: 296private:
297 KLibLoaderPrivate *d; 297 KLibLoaderPrivate *d;
298}; 298};
299 299
300/** 300/**
301 * If you develop a library that is to be loaded dynamically at runtime, then 301 * If you develop a library that is to be loaded dynamically at runtime, then
302 * you should return a pointer to your factory. The K_EXPORT_COMPONENT_FACTORY 302 * you should return a pointer to your factory. The K_EXPORT_COMPONENT_FACTORY
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 1d8ae9f..dd310fa 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -1,27 +1,28 @@
1#include <qregexp.h> 1#include <qregexp.h>
2#include <qapplication.h> 2#include <qapplication.h>
3#include <QDesktopWidget>
3 4
4#include "kdebug.h" 5#include "kdebug.h"
5#include "kcalendarsystemgregorian.h" 6#include "kcalendarsystemgregorian.h"
6 7
7#include "klocale.h" 8#include "klocale.h"
8 9
9#include <qstringlist.h> 10#include <qstringlist.h>
10 11
11//#define COLLECT_TRANSLATION 12//#define COLLECT_TRANSLATION
12 13
13 14
14QDict<QString> *mLocaleDict = 0; 15Q3Dict<QString> *mLocaleDict = 0;
15void setLocaleDict( QDict<QString> * dict ) 16void setLocaleDict( Q3Dict<QString> * dict )
16{ 17{
17 mLocaleDict = dict; 18 mLocaleDict = dict;
18 19
19} 20}
20 21
21#ifdef COLLECT_TRANSLATION 22#ifdef COLLECT_TRANSLATION
22 23
23QStringList missingTrans; 24QStringList missingTrans;
24QStringList existingTrans1; 25QStringList existingTrans1;
25QStringList existingTrans2; 26QStringList existingTrans2;
26 27
27void addMissing(const char *text) 28void addMissing(const char *text)
@@ -36,53 +37,53 @@ void addExist(const char *text,QString trans )
36{ 37{
37 //return; 38 //return;
38 QString mis ( text ); 39 QString mis ( text );
39 if ( !existingTrans1.contains( mis ) ) { 40 if ( !existingTrans1.contains( mis ) ) {
40 existingTrans1.append(mis); 41 existingTrans1.append(mis);
41 existingTrans2.append(trans); 42 existingTrans2.append(trans);
42 43
43 } 44 }
44 45
45} 46}
46 47
47#include <qfile.h> 48#include <qfile.h>
48#include <qtextstream.h> 49#include <q3textstream.h>
49#include <qtextcodec.h> 50#include <qtextcodec.h>
50#endif 51#endif
51void dumpMissing() 52void dumpMissing()
52{ 53{
53#ifdef COLLECT_TRANSLATION 54#ifdef COLLECT_TRANSLATION
54 QString fileName = "/tmp/usernewtrans.txt"; 55 QString fileName = "/tmp/usernewtrans.txt";
55 QFile file( fileName ); 56 QFile file( fileName );
56 if (!file.open( IO_WriteOnly ) ) { 57 if (!file.open( QIODevice::WriteOnly ) ) {
57 return ; 58 return ;
58 } 59 }
59 QTextStream ts( &file ); 60 Q3TextStream ts( &file );
60 ts.setCodec( QTextCodec::codecForName("utf8") ); 61 ts.setCodec( QTextCodec::codecForName("utf8") );
61 62
62 int i; 63 int i;
63 for ( i = 0; i< missingTrans.count(); ++i ) { 64 for ( i = 0; i< missingTrans.count(); ++i ) {
64 65
65 QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" ); 66 QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" );
66 ts << "{ \""<<text<< "\",\""<< text <<"\" },\n"; 67 ts << "{ \""<<text<< "\",\""<< text <<"\" },\n";
67 68
68 } 69 }
69 file.close(); 70 file.close();
70 { 71 {
71 QString fileName = "/tmp/usertrans.txt"; 72 QString fileName = "/tmp/usertrans.txt";
72 QFile file( fileName ); 73 QFile file( fileName );
73 if (!file.open( IO_WriteOnly ) ) { 74 if (!file.open( QIODevice::WriteOnly ) ) {
74 return ; 75 return ;
75 } 76 }
76 QTextStream ts( &file ); 77 Q3TextStream ts( &file );
77 ts.setCodec( QTextCodec::codecForName("utf8") ); 78 ts.setCodec( QTextCodec::codecForName("utf8") );
78 79
79 int i; 80 int i;
80 for ( i = 0; i< existingTrans1.count(); ++i ) { 81 for ( i = 0; i< existingTrans1.count(); ++i ) {
81 82
82 QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" ); 83 QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" );
83 QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" ); 84 QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" );
84 ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n"; 85 ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n";
85 86
86 } 87 }
87 file.close(); 88 file.close();
88 } 89 }
@@ -458,25 +459,25 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat
458 459
459QString KLocale::formatDateTime(const QDateTime &pDateTime, 460QString KLocale::formatDateTime(const QDateTime &pDateTime,
460 bool shortFormat, 461 bool shortFormat,
461 bool includeSeconds, 462 bool includeSeconds,
462 IntDateFormat intIntDateFormat) const 463 IntDateFormat intIntDateFormat) const
463{ 464{
464 QString format("%1 %2"); 465 QString format("%1 %2");
465 466
466 if ( intIntDateFormat == Default ) 467 if ( intIntDateFormat == Default )
467 format = "%1 %2"; 468 format = "%1 %2";
468 else if ( intIntDateFormat == Format1 ) 469 else if ( intIntDateFormat == Format1 )
469 format = "%1 %2"; 470 format = "%1 %2";
470 else if ( intIntDateFormat == ISODate ) 471 else if ( intIntDateFormat == Qt::ISODate )
471 format = "%1T%2"; 472 format = "%1T%2";
472 473
473 QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat )) 474 QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat ))
474 .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat )); 475 .arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat ));
475 476
476 //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() ); 477 //qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() );
477 478
478 return res; 479 return res;
479} 480}
480 481
481QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const 482QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const
482{ 483{
@@ -518,25 +519,25 @@ QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) con
518 if (c.isSpace()) 519 if (c.isSpace())
519 strpos++; 520 strpos++;
520 else if (c != str.at(strpos++)) 521 else if (c != str.at(strpos++))
521 goto error; 522 goto error;
522 continue; 523 continue;
523 } 524 }
524 525
525 // remove space at the begining 526 // remove space at the begining
526 if (str.length() > strpos && str.at(strpos).isSpace()) 527 if (str.length() > strpos && str.at(strpos).isSpace())
527 strpos++; 528 strpos++;
528 529
529 c = fmt.at(fmtpos++); 530 c = fmt.at(fmtpos++);
530 switch (c) 531 switch (c.unicode())
531 { 532 {
532 case 'a': 533 case 'a':
533 case 'A': 534 case 'A':
534 // this will just be ignored 535 // this will just be ignored
535 { // Cristian Tache: porting to Win: Block added because of "j" redefinition 536 { // Cristian Tache: porting to Win: Block added because of "j" redefinition
536 for (int j = 1; j < 8; j++) { 537 for (int j = 1; j < 8; j++) {
537 QString s = weekDayName(j, c == 'a').lower(); 538 QString s = weekDayName(j, c == 'a').lower();
538 int len = s.length(); 539 int len = s.length();
539 if (str.mid(strpos, len) == s) 540 if (str.mid(strpos, len) == s)
540 strpos += len; 541 strpos += len;
541 } 542 }
542 break; 543 break;
@@ -629,25 +630,25 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
629 if (c.isSpace()) 630 if (c.isSpace())
630 strpos++; 631 strpos++;
631 else if (c != str.at(strpos++)) 632 else if (c != str.at(strpos++))
632 goto error; 633 goto error;
633 continue; 634 continue;
634 } 635 }
635 636
636 // remove space at the begining 637 // remove space at the begining
637 if (str.length() > strpos && str.at(strpos).isSpace()) 638 if (str.length() > strpos && str.at(strpos).isSpace())
638 strpos++; 639 strpos++;
639 640
640 c = Format.at(Formatpos++); 641 c = Format.at(Formatpos++);
641 switch (c) 642 switch (c.unicode())
642 { 643 {
643 case 'p': 644 case 'p':
644 { 645 {
645 QString s; 646 QString s;
646 s = i18n("pm").lower(); 647 s = i18n("pm").lower();
647 int len = s.length(); 648 int len = s.length();
648 if (str.mid(strpos, len) == s) 649 if (str.mid(strpos, len) == s)
649 { 650 {
650 pm = true; 651 pm = true;
651 strpos += len; 652 strpos += len;
652 } 653 }
653 else 654 else
@@ -725,25 +726,25 @@ QDateTime KLocale::readDateTime(const QString &intstr,
725 qDebug("KLocale::readDateTime, only ISODate is supported."); 726 qDebug("KLocale::readDateTime, only ISODate is supported.");
726 return QDateTime(); 727 return QDateTime();
727 } 728 }
728 729
729 int pos = intstr.find("T"); 730 int pos = intstr.find("T");
730 QString date = intstr.left(pos); 731 QString date = intstr.left(pos);
731 QString time = intstr.mid(pos+1); 732 QString time = intstr.mid(pos+1);
732 733
733 QString dformat = dateFormat(intIntDateFormat); 734 QString dformat = dateFormat(intIntDateFormat);
734 QString tformat = timeFormat(intIntDateFormat); 735 QString tformat = timeFormat(intIntDateFormat);
735 736
736 QDate m_date = readDate(date, dformat, &ok1); 737 QDate m_date = readDate(date, dformat, &ok1);
737 QTime m_time = readTime(time, tformat, &ok2); 738 QTime m_time = readTime(time, !tformat.isEmpty(), &ok2);
738 739
739 QDateTime m_dt; 740 QDateTime m_dt;
740 741
741 if (ok) 742 if (ok)
742 { 743 {
743 if ((ok1 == false) || (ok2 == false)) 744 if ((ok1 == false) || (ok2 == false))
744 *ok = false; 745 *ok = false;
745 else 746 else
746 *ok = true; 747 *ok = true;
747 } 748 }
748 749
749 //only set values if both operations returned true. 750 //only set values if both operations returned true.
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 58e0b39..840fc9d 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -1,26 +1,26 @@
1#ifndef MINIKDE_KLOCALE_H 1#ifndef MINIKDE_KLOCALE_H
2#define MINIKDE_KLOCALE_H 2#define MINIKDE_KLOCALE_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qstringlist.h> 5#include <qstringlist.h>
6#include <qdatetime.h> 6#include <qdatetime.h>
7#include <qdict.h> 7#include <q3dict.h>
8 8
9#ifndef I18N_NOOP 9#ifndef I18N_NOOP
10#define I18N_NOOP(x) (x) 10#define I18N_NOOP(x) (x)
11#endif 11#endif
12 12
13class KCalendarSystem; 13class KCalendarSystem;
14void setLocaleDict( QDict<QString> * dict ); 14void setLocaleDict( Q3Dict<QString> * dict );
15QString i18n(const char *text); 15QString i18n(const char *text);
16QString i18n(const char *hint, const char *text); 16QString i18n(const char *hint, const char *text);
17QString i18n(const char *text1, const char *textn, int num); 17QString i18n(const char *text1, const char *textn, int num);
18 18
19// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict 19// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict
20// with our i18n method. we use uic -tr tr2i18n to redirect 20// with our i18n method. we use uic -tr tr2i18n to redirect
21// to the right i18n() function 21// to the right i18n() function
22inline QString tr2i18n(const char* message, const char* =0) { 22inline QString tr2i18n(const char* message, const char* =0) {
23 return i18n( message); 23 return i18n( message);
24} 24}
25 25
26class KLocale 26class KLocale
diff --git a/microkde/kdecore/kmdcodec.cpp b/microkde/kdecore/kmdcodec.cpp
index bc03569..db11e52 100644
--- a/microkde/kdecore/kmdcodec.cpp
+++ b/microkde/kdecore/kmdcodec.cpp
@@ -30,24 +30,26 @@
30 The quoted-printable codec as described in RFC 2045, section 6.7. is by 30 The quoted-printable codec as described in RFC 2045, section 6.7. is by
31 Rik Hemsley (C) 2001. 31 Rik Hemsley (C) 2001.
32*/ 32*/
33 33
34//US #include <config.h> 34//US #include <config.h>
35 35
36#include <stdio.h> 36#include <stdio.h>
37#include <string.h> 37#include <string.h>
38#include <stdlib.h> 38#include <stdlib.h>
39 39
40#include <kdebug.h> 40#include <kdebug.h>
41#include "kmdcodec.h" 41#include "kmdcodec.h"
42//Added by qt3to4:
43#include <Q3CString>
42 44
43#define KMD5_S11 7 45#define KMD5_S11 7
44#define KMD5_S12 12 46#define KMD5_S12 12
45#define KMD5_S13 17 47#define KMD5_S13 17
46#define KMD5_S14 22 48#define KMD5_S14 22
47#define KMD5_S21 5 49#define KMD5_S21 5
48#define KMD5_S22 9 50#define KMD5_S22 9
49#define KMD5_S23 14 51#define KMD5_S23 14
50#define KMD5_S24 20 52#define KMD5_S24 20
51#define KMD5_S31 4 53#define KMD5_S31 4
52#define KMD5_S32 11 54#define KMD5_S32 11
53#define KMD5_S33 16 55#define KMD5_S33 16
@@ -138,32 +140,32 @@ static int rikFindChar(register const char * _s, const char c)
138 140
139 while (true) 141 while (true)
140 { 142 {
141 if ((0 == *s) || (c == *s)) break; ++s; 143 if ((0 == *s) || (c == *s)) break; ++s;
142 if ((0 == *s) || (c == *s)) break; ++s; 144 if ((0 == *s) || (c == *s)) break; ++s;
143 if ((0 == *s) || (c == *s)) break; ++s; 145 if ((0 == *s) || (c == *s)) break; ++s;
144 if ((0 == *s) || (c == *s)) break; ++s; 146 if ((0 == *s) || (c == *s)) break; ++s;
145 } 147 }
146 148
147 return s - _s; 149 return s - _s;
148} 150}
149 151
150QCString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF) 152Q3CString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF)
151{ 153{
152 QByteArray out; 154 QByteArray out;
153 quotedPrintableEncode (in, out, useCRLF); 155 quotedPrintableEncode (in, out, useCRLF);
154 return QCString (out.data(), out.size()+1); 156 return Q3CString (out.data(), out.size()+1);
155} 157}
156 158
157QCString KCodecs::quotedPrintableEncode(const QCString& str, bool useCRLF) 159Q3CString KCodecs::quotedPrintableEncode(const Q3CString& str, bool useCRLF)
158{ 160{
159 if (str.isEmpty()) 161 if (str.isEmpty())
160 return ""; 162 return "";
161 163
162 QByteArray in (str.length()); 164 QByteArray in (str.length());
163 memcpy (in.data(), str.data(), str.length()); 165 memcpy (in.data(), str.data(), str.length());
164 return quotedPrintableEncode(in, useCRLF); 166 return quotedPrintableEncode(in, useCRLF);
165} 167}
166 168
167void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool useCRLF) 169void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool useCRLF)
168{ 170{
169 out.resize (0); 171 out.resize (0);
@@ -271,32 +273,32 @@ void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool
271 } else { 273 } else {
272 *cursor++ = '='; 274 *cursor++ = '=';
273 *cursor++ = '\n'; 275 *cursor++ = '\n';
274 } 276 }
275 277
276 lineLength = 0; 278 lineLength = 0;
277 } 279 }
278 } 280 }
279 281
280 out.truncate(cursor - out.data()); 282 out.truncate(cursor - out.data());
281} 283}
282 284
283QCString KCodecs::quotedPrintableDecode(const QByteArray & in) 285Q3CString KCodecs::quotedPrintableDecode(const QByteArray & in)
284{ 286{
285 QByteArray out; 287 QByteArray out;
286 quotedPrintableDecode (in, out); 288 quotedPrintableDecode (in, out);
287 return QCString (out.data(), out.size()+1); 289 return Q3CString (out.data(), out.size()+1);
288} 290}
289 291
290QCString KCodecs::quotedPrintableDecode(const QCString & str) 292Q3CString KCodecs::quotedPrintableDecode(const Q3CString & str)
291{ 293{
292 if (str.isEmpty()) 294 if (str.isEmpty())
293 return ""; 295 return "";
294 296
295 QByteArray in (str.length()); 297 QByteArray in (str.length());
296 memcpy (in.data(), str.data(), str.length()); 298 memcpy (in.data(), str.data(), str.length());
297 return quotedPrintableDecode (in); 299 return quotedPrintableDecode (in);
298} 300}
299 301
300void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out) 302void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
301{ 303{
302 // clear out the output buffer 304 // clear out the output buffer
@@ -346,39 +348,39 @@ void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
346 } 348 }
347 } 349 }
348 } 350 }
349 else 351 else
350 { 352 {
351 *cursor++ = c; 353 *cursor++ = c;
352 } 354 }
353 } 355 }
354 356
355 out.truncate(cursor - out.data()); 357 out.truncate(cursor - out.data());
356} 358}
357 359
358QCString KCodecs::base64Encode( const QCString& str, bool insertLFs ) 360Q3CString KCodecs::base64Encode( const Q3CString& str, bool insertLFs )
359{ 361{
360 if ( str.isEmpty() ) 362 if ( str.isEmpty() )
361 return ""; 363 return "";
362 364
363 QByteArray in (str.length()); 365 QByteArray in (str.length());
364 memcpy( in.data(), str.data(), str.length() ); 366 memcpy( in.data(), str.data(), str.length() );
365 return base64Encode( in, insertLFs ); 367 return base64Encode( in, insertLFs );
366} 368}
367 369
368QCString KCodecs::base64Encode( const QByteArray& in, bool insertLFs ) 370Q3CString KCodecs::base64Encode( const QByteArray& in, bool insertLFs )
369{ 371{
370 QByteArray out; 372 QByteArray out;
371 base64Encode( in, out, insertLFs ); 373 base64Encode( in, out, insertLFs );
372 return QCString( out.data(), out.size()+1 ); 374 return Q3CString( out.data(), out.size()+1 );
373} 375}
374 376
375void KCodecs::base64Encode( const QByteArray& in, QByteArray& out, 377void KCodecs::base64Encode( const QByteArray& in, QByteArray& out,
376 bool insertLFs ) 378 bool insertLFs )
377{ 379{
378 // clear out the output buffer 380 // clear out the output buffer
379 out.resize (0); 381 out.resize (0);
380 if ( in.isEmpty() ) 382 if ( in.isEmpty() )
381 return; 383 return;
382 384
383 unsigned int sidx = 0; 385 unsigned int sidx = 0;
384 unsigned int didx = 0; 386 unsigned int didx = 0;
@@ -396,78 +398,75 @@ void KCodecs::base64Encode( const QByteArray& in, QByteArray& out,
396 398
397 int count = 0; 399 int count = 0;
398 out.resize( out_len ); 400 out.resize( out_len );
399 401
400 // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion 402 // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
401 if ( len > 1 ) 403 if ( len > 1 )
402 { 404 {
403 while (sidx < len-2) 405 while (sidx < len-2)
404 { 406 {
405 if ( insertLFs ) 407 if ( insertLFs )
406 { 408 {
407 if ( count && (count%76) == 0 ) 409 if ( count && (count%76) == 0 )
408 out.at(didx++) = '\n'; 410 out[didx++] = '\n';
409 count += 4; 411 count += 4;
410 } 412 }
411 out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077]; 413 out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077];
412 out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 | 414 out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 |
413 (data[sidx] << 4) & 077]; 415 (data[sidx] << 4) & 077];
414 out.at(didx++) = Base64EncMap[(data[sidx+2] >> 6) & 003 | 416 out[didx++] = Base64EncMap[(data[sidx+2] >> 6) & 003 |
415 (data[sidx+1] << 2) & 077]; 417 (data[sidx+1] << 2) & 077];
416 out.at(didx++) = Base64EncMap[data[sidx+2] & 077]; 418 out[didx++] = Base64EncMap[data[sidx+2] & 077];
417 sidx += 3; 419 sidx += 3;
418 } 420 }
419 } 421 }
420 422
421 if (sidx < len) 423 if (sidx < len)
422 { 424 {
423 if ( insertLFs && (count > 0) && (count%76) == 0 ) 425 if ( insertLFs && (count > 0) && (count%76) == 0 )
424 out.at(didx++) = '\n'; 426 out[didx++] = '\n';
425 427
426 out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077]; 428 out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077];
427 if (sidx < len-1) 429 if (sidx < len-1)
428 { 430 {
429 out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 | 431 out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 |
430 (data[sidx] << 4) & 077]; 432 (data[sidx] << 4) & 077];
431 out.at(didx++) = Base64EncMap[(data[sidx+1] << 2) & 077]; 433 out[didx++] = Base64EncMap[(data[sidx+1] << 2) & 077];
432 } 434 }
433 else 435 else
434 { 436 {
435 out.at(didx++) = Base64EncMap[(data[sidx] << 4) & 077]; 437 out[didx++] = Base64EncMap[(data[sidx] << 4) & 077];
436 } 438 }
437 } 439 }
438 440
439 // Add padding 441 // Add padding
440 while (didx < out.size()) 442 while (didx < out.size())
441 { 443 out[didx++] = '=';
442 out.at(didx) = '=';
443 didx++;
444 }
445} 444}
446 445
447QCString KCodecs::base64Decode( const QCString& str ) 446Q3CString KCodecs::base64Decode( const Q3CString& str )
448{ 447{
449 if ( str.isEmpty() ) 448 if ( str.isEmpty() )
450 return ""; 449 return "";
451 450
452 QByteArray in( str.length() ); 451 QByteArray in( str.length() );
453 memcpy( in.data(), str.data(), str.length() ); 452 memcpy( in.data(), str.data(), str.length() );
454 return base64Decode( in ); 453 return base64Decode( in );
455} 454}
456 455
457QCString KCodecs::base64Decode( const QByteArray& in ) 456Q3CString KCodecs::base64Decode( const QByteArray& in )
458{ 457{
459 QByteArray out; 458 QByteArray out;
460 base64Decode( in, out ); 459 base64Decode( in, out );
461 return QCString( out.data(), out.size()+1 ); 460 return Q3CString( out.data(), out.size()+1 );
462} 461}
463 462
464void KCodecs::base64Decode( const QByteArray& in, QByteArray& out ) 463void KCodecs::base64Decode( const QByteArray& in, QByteArray& out )
465{ 464{
466 out.resize(0); 465 out.resize(0);
467 if ( in.isEmpty() ) 466 if ( in.isEmpty() )
468 return; 467 return;
469 468
470 unsigned int count = 0; 469 unsigned int count = 0;
471 unsigned int len = in.size(), tail = len; 470 unsigned int len = in.size(), tail = len;
472 const char* data = in.data(); 471 const char* data = in.data();
473 472
@@ -496,174 +495,174 @@ void KCodecs::base64Decode( const QByteArray& in, QByteArray& out )
496 if ( data[--tail] != '=' ) len = tail; 495 if ( data[--tail] != '=' ) len = tail;
497 496
498 unsigned int outIdx = 0; 497 unsigned int outIdx = 0;
499 out.resize( (count=len) ); 498 out.resize( (count=len) );
500 for (unsigned int idx = 0; idx < count; idx++) 499 for (unsigned int idx = 0; idx < count; idx++)
501 { 500 {
502 // Adhere to RFC 2045 and ignore characters 501 // Adhere to RFC 2045 and ignore characters
503 // that are not part of the encoding table. 502 // that are not part of the encoding table.
504 unsigned char ch = data[idx]; 503 unsigned char ch = data[idx];
505 if ((ch > 47 && ch < 58) || (ch > 64 && ch < 91) || 504 if ((ch > 47 && ch < 58) || (ch > 64 && ch < 91) ||
506 (ch > 96 && ch < 123) || ch == '+' || ch == '/' || ch == '=') 505 (ch > 96 && ch < 123) || ch == '+' || ch == '/' || ch == '=')
507 { 506 {
508 out.at(outIdx++) = Base64DecMap[ch]; 507 out[outIdx++] = Base64DecMap[ch];
509 } 508 }
510 else 509 else
511 { 510 {
512 len--; 511 len--;
513 tail--; 512 tail--;
514 } 513 }
515 } 514 }
516 515
517 // kdDebug() << "Tail size = " << tail << ", Length size = " << len << endl; 516 // kdDebug() << "Tail size = " << tail << ", Length size = " << len << endl;
518 517
519 // 4-byte to 3-byte conversion 518 // 4-byte to 3-byte conversion
520 len = (tail>(len/4)) ? tail-(len/4) : 0; 519 len = (tail>(len/4)) ? tail-(len/4) : 0;
521 unsigned int sidx = 0, didx = 0; 520 unsigned int sidx = 0, didx = 0;
522 if ( len > 1 ) 521 if ( len > 1 )
523 { 522 {
524 while (didx < len-2) 523 while (didx < len-2)
525 { 524 {
526 out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003)); 525 out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
527 out.at(didx+1) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017)); 526 out[didx+1] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
528 out.at(didx+2) = (((out.at(sidx+2) << 6) & 255) | (out.at(sidx+3) & 077)); 527 out[didx+2] = (((out[sidx+2] << 6) & 255) | (out[sidx+3] & 077));
529 sidx += 4; 528 sidx += 4;
530 didx += 3; 529 didx += 3;
531 } 530 }
532 } 531 }
533 532
534 if (didx < len) 533 if (didx < len)
535 out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003)); 534 out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
536 535
537 if (++didx < len ) 536 if (++didx < len )
538 out.at(didx) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017)); 537 out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
539 538
540 // Resize the output buffer 539 // Resize the output buffer
541 if ( len == 0 || len < out.size() ) 540 if ( len == 0 || len < out.size() )
542 out.resize(len); 541 out.resize(len);
543} 542}
544 543
545QCString KCodecs::uuencode( const QCString& str ) 544Q3CString KCodecs::uuencode( const Q3CString& str )
546{ 545{
547 if ( str.isEmpty() ) 546 if ( str.isEmpty() )
548 return ""; 547 return "";
549 548
550 QByteArray in; 549 QByteArray in;
551 in.resize( str.length() ); 550 in.resize( str.length() );
552 memcpy( in.data(), str.data(), str.length() ); 551 memcpy( in.data(), str.data(), str.length() );
553 return uuencode( in ); 552 return uuencode( in );
554} 553}
555 554
556QCString KCodecs::uuencode( const QByteArray& in ) 555Q3CString KCodecs::uuencode( const QByteArray& in )
557{ 556{
558 QByteArray out; 557 QByteArray out;
559 uuencode( in, out ); 558 uuencode( in, out );
560 return QCString( out.data(), out.size()+1 ); 559 return Q3CString( out.data(), out.size()+1 );
561} 560}
562 561
563void KCodecs::uuencode( const QByteArray& in, QByteArray& out ) 562void KCodecs::uuencode( const QByteArray& in, QByteArray& out )
564{ 563{
565 out.resize( 0 ); 564 out.resize( 0 );
566 if( in.isEmpty() ) 565 if( in.isEmpty() )
567 return; 566 return;
568 567
569 unsigned int sidx = 0; 568 unsigned int sidx = 0;
570 unsigned int didx = 0; 569 unsigned int didx = 0;
571 unsigned int line_len = 45; 570 unsigned int line_len = 45;
572 571
573 const char nl[] = "\n"; 572 const char nl[] = "\n";
574 const char* data = in.data(); 573 const char* data = in.data();
575 const unsigned int nl_len = strlen(nl); 574 const unsigned int nl_len = strlen(nl);
576 const unsigned int len = in.size(); 575 const unsigned int len = in.size();
577 576
578 out.resize( (len+2)/3*4 + ((len+line_len-1)/line_len)*(nl_len+1) ); 577 out.resize( (len+2)/3*4 + ((len+line_len-1)/line_len)*(nl_len+1) );
579 // split into lines, adding line-length and line terminator 578 // split into lines, adding line-length and line terminator
580 while (sidx+line_len < len) 579 while (sidx+line_len < len)
581 { 580 {
582 // line length 581 // line length
583 out.at(didx++) = UUEncMap[line_len]; 582 out[didx++] = UUEncMap[line_len];
584 583
585 // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion 584 // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
586 for (unsigned int end = sidx+line_len; sidx < end; sidx += 3) 585 for (unsigned int end = sidx+line_len; sidx < end; sidx += 3)
587 { 586 {
588 out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; 587 out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
589 out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | 588 out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
590 (data[sidx] << 4) & 077]; 589 (data[sidx] << 4) & 077];
591 out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 | 590 out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 |
592 (data[sidx+1] << 2) & 077]; 591 (data[sidx+1] << 2) & 077];
593 out.at(didx++) = UUEncMap[data[sidx+2] & 077]; 592 out[didx++] = UUEncMap[data[sidx+2] & 077];
594 } 593 }
595 594
596 // line terminator 595 // line terminator
597 //for (unsigned int idx=0; idx < nl_len; idx++) 596 //for (unsigned int idx=0; idx < nl_len; idx++)
598 //out.at(didx++) = nl[idx]; 597 //out[didx++] = nl[idx];
599 memcpy(out.data()+didx, nl, nl_len); 598 memcpy(out.data()+didx, nl, nl_len);
600 didx += nl_len; 599 didx += nl_len;
601 } 600 }
602 601
603 // line length 602 // line length
604 out.at(didx++) = UUEncMap[len-sidx]; 603 out[didx++] = UUEncMap[len-sidx];
605 // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion 604 // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
606 while (sidx+2 < len) 605 while (sidx+2 < len)
607 { 606 {
608 out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; 607 out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
609 out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | 608 out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
610 (data[sidx] << 4) & 077]; 609 (data[sidx] << 4) & 077];
611 out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 | 610 out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 |
612 (data[sidx+1] << 2) & 077]; 611 (data[sidx+1] << 2) & 077];
613 out.at(didx++) = UUEncMap[data[sidx+2] & 077]; 612 out[didx++] = UUEncMap[data[sidx+2] & 077];
614 sidx += 3; 613 sidx += 3;
615 } 614 }
616 615
617 if (sidx < len-1) 616 if (sidx < len-1)
618 { 617 {
619 out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; 618 out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
620 out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 | 619 out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
621 (data[sidx] << 4) & 077]; 620 (data[sidx] << 4) & 077];
622 out.at(didx++) = UUEncMap[(data[sidx+1] << 2) & 077]; 621 out[didx++] = UUEncMap[(data[sidx+1] << 2) & 077];
623 out.at(didx++) = UUEncMap[0]; 622 out[didx++] = UUEncMap[0];
624 } 623 }
625 else if (sidx < len) 624 else if (sidx < len)
626 { 625 {
627 out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077]; 626 out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
628 out.at(didx++) = UUEncMap[(data[sidx] << 4) & 077]; 627 out[didx++] = UUEncMap[(data[sidx] << 4) & 077];
629 out.at(didx++) = UUEncMap[0]; 628 out[didx++] = UUEncMap[0];
630 out.at(didx++) = UUEncMap[0]; 629 out[didx++] = UUEncMap[0];
631 } 630 }
632 631
633 // line terminator 632 // line terminator
634 memcpy(out.data()+didx, nl, nl_len); 633 memcpy(out.data()+didx, nl, nl_len);
635 didx += nl_len; 634 didx += nl_len;
636 635
637 // sanity check 636 // sanity check
638 if ( didx != out.size() ) 637 if ( didx != out.size() )
639 out.resize( 0 ); 638 out.resize( 0 );
640} 639}
641 640
642QCString KCodecs::uudecode( const QCString& str ) 641Q3CString KCodecs::uudecode( const Q3CString& str )
643{ 642{
644 if ( str.isEmpty() ) 643 if ( str.isEmpty() )
645 return ""; 644 return "";
646 645
647 QByteArray in; 646 QByteArray in;
648 in.resize( str.length() ); 647 in.resize( str.length() );
649 memcpy( in.data(), str.data(), str.length() ); 648 memcpy( in.data(), str.data(), str.length() );
650 return uudecode( in ); 649 return uudecode( in );
651} 650}
652 651
653QCString KCodecs::uudecode( const QByteArray& in ) 652Q3CString KCodecs::uudecode( const QByteArray& in )
654{ 653{
655 QByteArray out; 654 QByteArray out;
656 uudecode( in, out ); 655 uudecode( in, out );
657 return QCString( out.data(), out.size()+1 ); 656 return Q3CString( out.data(), out.size()+1 );
658} 657}
659 658
660void KCodecs::uudecode( const QByteArray& in, QByteArray& out ) 659void KCodecs::uudecode( const QByteArray& in, QByteArray& out )
661{ 660{
662 out.resize( 0 ); 661 out.resize( 0 );
663 if( in.isEmpty() ) 662 if( in.isEmpty() )
664 return; 663 return;
665 664
666 unsigned int sidx = 0; 665 unsigned int sidx = 0;
667 unsigned int didx = 0; 666 unsigned int didx = 0;
668 unsigned int len = in.size(); 667 unsigned int len = in.size();
669 unsigned int line_len, end; 668 unsigned int line_len, end;
@@ -696,43 +695,43 @@ void KCodecs::uudecode( const QByteArray& in, QByteArray& out )
696 // get line length (in number of encoded octets) 695 // get line length (in number of encoded octets)
697 line_len = UUDecMap[ (unsigned char) data[sidx++]]; 696 line_len = UUDecMap[ (unsigned char) data[sidx++]];
698 // ascii printable to 0-63 and 4-byte to 3-byte conversion 697 // ascii printable to 0-63 and 4-byte to 3-byte conversion
699 end = didx+line_len; 698 end = didx+line_len;
700 char A, B, C, D; 699 char A, B, C, D;
701 if (end > 2) { 700 if (end > 2) {
702 while (didx < end-2) 701 while (didx < end-2)
703 { 702 {
704 A = UUDecMap[(unsigned char) data[sidx]]; 703 A = UUDecMap[(unsigned char) data[sidx]];
705 B = UUDecMap[(unsigned char) data[sidx+1]]; 704 B = UUDecMap[(unsigned char) data[sidx+1]];
706 C = UUDecMap[(unsigned char) data[sidx+2]]; 705 C = UUDecMap[(unsigned char) data[sidx+2]];
707 D = UUDecMap[(unsigned char) data[sidx+3]]; 706 D = UUDecMap[(unsigned char) data[sidx+3]];
708 out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) ); 707 out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) );
709 out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) ); 708 out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) );
710 out.at(didx++) = ( ((C << 6) & 255) | (D & 077) ); 709 out[didx++] = ( ((C << 6) & 255) | (D & 077) );
711 sidx += 4; 710 sidx += 4;
712 } 711 }
713 } 712 }
714 713
715 if (didx < end) 714 if (didx < end)
716 { 715 {
717 A = UUDecMap[(unsigned char) data[sidx]]; 716 A = UUDecMap[(unsigned char) data[sidx]];
718 B = UUDecMap[(unsigned char) data[sidx+1]]; 717 B = UUDecMap[(unsigned char) data[sidx+1]];
719 out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) ); 718 out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) );
720 } 719 }
721 720
722 if (didx < end) 721 if (didx < end)
723 { 722 {
724 B = UUDecMap[(unsigned char) data[sidx+1]]; 723 B = UUDecMap[(unsigned char) data[sidx+1]];
725 C = UUDecMap[(unsigned char) data[sidx+2]]; 724 C = UUDecMap[(unsigned char) data[sidx+2]];
726 out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) ); 725 out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) );
727 } 726 }
728 727
729 // skip padding 728 // skip padding
730 while (sidx < len && data[sidx] != '\n' && data[sidx] != '\r') 729 while (sidx < len && data[sidx] != '\n' && data[sidx] != '\r')
731 sidx++; 730 sidx++;
732 731
733 // skip end of line 732 // skip end of line
734 while (sidx < len && (data[sidx] == '\n' || data[sidx] == '\r')) 733 while (sidx < len && (data[sidx] == '\n' || data[sidx] == '\r'))
735 sidx++; 734 sidx++;
736 735
737 // skip the "END" separator when present. 736 // skip the "END" separator when present.
738 if ( hasLF && QString( data+sidx).left(3).lower() == "end" ) 737 if ( hasLF && QString( data+sidx).left(3).lower() == "end" )
@@ -752,36 +751,36 @@ KMD5::KMD5()
752KMD5::KMD5(const char *in, int len) 751KMD5::KMD5(const char *in, int len)
753{ 752{
754 init(); 753 init();
755 update(in, len); 754 update(in, len);
756} 755}
757 756
758KMD5::KMD5(const QByteArray& in) 757KMD5::KMD5(const QByteArray& in)
759{ 758{
760 init(); 759 init();
761 update( in ); 760 update( in );
762} 761}
763 762
764KMD5::KMD5(const QCString& in) 763KMD5::KMD5(const Q3CString& in)
765{ 764{
766 init(); 765 init();
767 update( in ); 766 update( in );
768} 767}
769 768
770void KMD5::update(const QByteArray& in) 769void KMD5::update(const QByteArray& in)
771{ 770{
772 update(in.data(), int(in.size())); 771 update(in.data(), int(in.size()));
773} 772}
774 773
775void KMD5::update(const QCString& in) 774void KMD5::update(const Q3CString& in)
776{ 775{
777 update(in.data(), int(in.length())); 776 update(in.data(), int(in.length()));
778} 777}
779 778
780void KMD5::update(const unsigned char* in, int len) 779void KMD5::update(const unsigned char* in, int len)
781{ 780{
782 if (len < 0) 781 if (len < 0)
783 len = qstrlen(reinterpret_cast<const char*>(in)); 782 len = qstrlen(reinterpret_cast<const char*>(in));
784 783
785 if (!len) 784 if (!len)
786 return; 785 return;
787 786
@@ -864,67 +863,67 @@ void KMD5::finalize ()
864 memset ( (void *)m_buffer, 0, sizeof(*m_buffer)); 863 memset ( (void *)m_buffer, 0, sizeof(*m_buffer));
865 864
866 m_finalized = true; 865 m_finalized = true;
867} 866}
868 867
869 868
870bool KMD5::verify( const KMD5::Digest& digest) 869bool KMD5::verify( const KMD5::Digest& digest)
871{ 870{
872 finalize(); 871 finalize();
873 return (0 == memcmp(rawDigest(), digest, sizeof(KMD5::Digest))); 872 return (0 == memcmp(rawDigest(), digest, sizeof(KMD5::Digest)));
874} 873}
875 874
876bool KMD5::verify( const QCString& hexdigest) 875bool KMD5::verify( const Q3CString& hexdigest)
877{ 876{
878 finalize(); 877 finalize();
879 return (0 == strcmp(hexDigest().data(), hexdigest)); 878 return (0 == strcmp(hexDigest().data(), hexdigest));
880} 879}
881 880
882const KMD5::Digest& KMD5::rawDigest() 881const KMD5::Digest& KMD5::rawDigest()
883{ 882{
884 finalize(); 883 finalize();
885 return m_digest; 884 return m_digest;
886} 885}
887 886
888void KMD5::rawDigest( KMD5::Digest& bin ) 887void KMD5::rawDigest( KMD5::Digest& bin )
889{ 888{
890 finalize(); 889 finalize();
891 memcpy( bin, m_digest, 16 ); 890 memcpy( bin, m_digest, 16 );
892} 891}
893 892
894 893
895QCString KMD5::hexDigest() 894Q3CString KMD5::hexDigest()
896{ 895{
897 QCString s(33); 896 Q3CString s(33);
898 897
899 finalize(); 898 finalize();
900 sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", 899 sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
901 m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5], 900 m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5],
902 m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11], 901 m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11],
903 m_digest[12], m_digest[13], m_digest[14], m_digest[15]); 902 m_digest[12], m_digest[13], m_digest[14], m_digest[15]);
904 903
905 return s; 904 return s;
906} 905}
907 906
908void KMD5::hexDigest(QCString& s) 907void KMD5::hexDigest(Q3CString& s)
909{ 908{
910 finalize(); 909 finalize();
911 s.resize(33); 910 s.resize(33);
912 sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", 911 sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
913 m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5], 912 m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5],
914 m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11], 913 m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11],
915 m_digest[12], m_digest[13], m_digest[14], m_digest[15]); 914 m_digest[12], m_digest[13], m_digest[14], m_digest[15]);
916} 915}
917 916
918QCString KMD5::base64Digest() 917Q3CString KMD5::base64Digest()
919{ 918{
920 QByteArray ba(16); 919 QByteArray ba(16);
921 920
922 finalize(); 921 finalize();
923 memcpy(ba.data(), m_digest, 16); 922 memcpy(ba.data(), m_digest, 16);
924 return KCodecs::base64Encode(ba); 923 return KCodecs::base64Encode(ba);
925} 924}
926 925
927 926
928void KMD5::init() 927void KMD5::init()
929{ 928{
930 d = 0; 929 d = 0;
@@ -947,25 +946,25 @@ void KMD5::reset()
947 memset ( m_digest, 0, sizeof(*m_digest)); 946 memset ( m_digest, 0, sizeof(*m_digest));
948} 947}
949 948
950void KMD5::transform( const unsigned char block[64] ) 949void KMD5::transform( const unsigned char block[64] )
951{ 950{
952 951
953 Q_UINT32 a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], x[16]; 952 Q_UINT32 a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], x[16];
954 953
955 decode (x, block, 64); 954 decode (x, block, 64);
956 //memcpy( x, block, 64 ); 955 //memcpy( x, block, 64 );
957 956
958//US Q_ASSERT(!m_finalized); // not just a user error, since the method is private 957//US Q_ASSERT(!m_finalized); // not just a user error, since the method is private
959 ASSERT(!m_finalized); // not just a user error, since the method is private 958 Q_ASSERT(!m_finalized); // not just a user error, since the method is private
960 959
961 /* Round 1 */ 960 /* Round 1 */
962 FF (a, b, c, d, x[ 0], KMD5_S11, 0xd76aa478); /* 1 */ 961 FF (a, b, c, d, x[ 0], KMD5_S11, 0xd76aa478); /* 1 */
963 FF (d, a, b, c, x[ 1], KMD5_S12, 0xe8c7b756); /* 2 */ 962 FF (d, a, b, c, x[ 1], KMD5_S12, 0xe8c7b756); /* 2 */
964 FF (c, d, a, b, x[ 2], KMD5_S13, 0x242070db); /* 3 */ 963 FF (c, d, a, b, x[ 2], KMD5_S13, 0x242070db); /* 3 */
965 FF (b, c, d, a, x[ 3], KMD5_S14, 0xc1bdceee); /* 4 */ 964 FF (b, c, d, a, x[ 3], KMD5_S14, 0xc1bdceee); /* 4 */
966 FF (a, b, c, d, x[ 4], KMD5_S11, 0xf57c0faf); /* 5 */ 965 FF (a, b, c, d, x[ 4], KMD5_S11, 0xf57c0faf); /* 5 */
967 FF (d, a, b, c, x[ 5], KMD5_S12, 0x4787c62a); /* 6 */ 966 FF (d, a, b, c, x[ 5], KMD5_S12, 0x4787c62a); /* 6 */
968 FF (c, d, a, b, x[ 6], KMD5_S13, 0xa8304613); /* 7 */ 967 FF (c, d, a, b, x[ 6], KMD5_S13, 0xa8304613); /* 7 */
969 FF (b, c, d, a, x[ 7], KMD5_S14, 0xfd469501); /* 8 */ 968 FF (b, c, d, a, x[ 7], KMD5_S14, 0xfd469501); /* 8 */
970 FF (a, b, c, d, x[ 8], KMD5_S11, 0x698098d8); /* 9 */ 969 FF (a, b, c, d, x[ 8], KMD5_S11, 0x698098d8); /* 9 */
971 FF (d, a, b, c, x[ 9], KMD5_S12, 0x8b44f7af); /* 10 */ 970 FF (d, a, b, c, x[ 9], KMD5_S12, 0x8b44f7af); /* 10 */
diff --git a/microkde/kdecore/kmdcodec.h b/microkde/kdecore/kmdcodec.h
index 2c4d611..616b683 100644
--- a/microkde/kdecore/kmdcodec.h
+++ b/microkde/kdecore/kmdcodec.h
@@ -30,24 +30,26 @@
30 The quoted-printable codec as described in RFC 2045, section 6.7. is by 30 The quoted-printable codec as described in RFC 2045, section 6.7. is by
31 Rik Hemsley (C) 2001. 31 Rik Hemsley (C) 2001.
32*/ 32*/
33 33
34#ifndef _KMDBASE_H 34#ifndef _KMDBASE_H
35#define _KMDBASE_H 35#define _KMDBASE_H
36 36
37#define KBase64 KCodecs 37#define KBase64 KCodecs
38 38
39#include <qglobal.h> 39#include <qglobal.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qiodevice.h> 41#include <qiodevice.h>
42//Added by qt3to4:
43#include <Q3CString>
42 44
43/** 45/**
44 * A wrapper class for the most commonly used encoding and 46 * A wrapper class for the most commonly used encoding and
45 * decoding algorithms. Currently there is support for encoding 47 * decoding algorithms. Currently there is support for encoding
46 * and decoding input using base64, uu and the quoted-printable 48 * and decoding input using base64, uu and the quoted-printable
47 * specifications. 49 * specifications.
48 * 50 *
49 * @sect Usage: 51 * @sect Usage:
50 * 52 *
51 * <PRE> 53 * <PRE>
52 * QCString input = "Aladdin:open sesame"; 54 * QCString input = "Aladdin:open sesame";
53 * QCString result = KCodecs::base64Encode(input); 55 * QCString result = KCodecs::base64Encode(input);
@@ -72,40 +74,40 @@ class KCodecs
72{ 74{
73public: 75public:
74 76
75 /** 77 /**
76 * Encodes the given data using the quoted-printable algorithm. 78 * Encodes the given data using the quoted-printable algorithm.
77 * 79 *
78 * @param in data to be encoded. 80 * @param in data to be encoded.
79 * @param useCRLF if true the input data is expected to have 81 * @param useCRLF if true the input data is expected to have
80 * CRLF line breaks and the output will have CRLF line 82 * CRLF line breaks and the output will have CRLF line
81 * breaks, too. 83 * breaks, too.
82 * @return quoted-printable encoded data. 84 * @return quoted-printable encoded data.
83 */ 85 */
84 static QCString quotedPrintableEncode(const QByteArray & in, 86 static Q3CString quotedPrintableEncode(const QByteArray & in,
85 bool useCRLF = true); 87 bool useCRLF = true);
86 88
87 /** 89 /**
88 * @overload 90 * @overload
89 * 91 *
90 * Same as above except it accepts a null terminated 92 * Same as above except it accepts a null terminated
91 * string instead an array. 93 * string instead an array.
92 * 94 *
93 * @param str data to be encoded. 95 * @param str data to be encoded.
94 * @param useCRLF if true the input data is expected to have 96 * @param useCRLF if true the input data is expected to have
95 * CRLF line breaks and the output will have CRLF line 97 * CRLF line breaks and the output will have CRLF line
96 * breaks, too. 98 * breaks, too.
97 * @return quoted-printable encoded data. 99 * @return quoted-printable encoded data.
98 */ 100 */
99 static QCString quotedPrintableEncode(const QCString & str, 101 static Q3CString quotedPrintableEncode(const Q3CString & str,
100 bool useCRLF = true); 102 bool useCRLF = true);
101 103
102 /** 104 /**
103 * Encodes the given data using the quoted-printable algorithm. 105 * Encodes the given data using the quoted-printable algorithm.
104 * 106 *
105 * Use this function if you want the result of the encoding 107 * Use this function if you want the result of the encoding
106 * to be placed in another array which cuts down the number 108 * to be placed in another array which cuts down the number
107 * of copy operation that have to be performed in the process. 109 * of copy operation that have to be performed in the process.
108 * This is also the preferred method for encoding binary data. 110 * This is also the preferred method for encoding binary data.
109 * 111 *
110 * NOTE: the output array is first reset and then resized 112 * NOTE: the output array is first reset and then resized
111 * appropriately before use, hence, all data stored in the 113 * appropriately before use, hence, all data stored in the
@@ -120,36 +122,36 @@ public:
120 */ 122 */
121 static void quotedPrintableEncode(const QByteArray & in, QByteArray& out, 123 static void quotedPrintableEncode(const QByteArray & in, QByteArray& out,
122 bool useCRLF); 124 bool useCRLF);
123 125
124 /** 126 /**
125 * Decodes a quoted-printable encoded string. 127 * Decodes a quoted-printable encoded string.
126 * 128 *
127 * Accepts data with CRLF or standard unix line breaks. 129 * Accepts data with CRLF or standard unix line breaks.
128 * 130 *
129 * @param in the data to be decoded. 131 * @param in the data to be decoded.
130 * @return decoded data. 132 * @return decoded data.
131 */ 133 */
132 static QCString quotedPrintableDecode(const QByteArray & in); 134 static Q3CString quotedPrintableDecode(const QByteArray & in);
133 135
134 /** 136 /**
135 * @overload 137 * @overload
136 * 138 *
137 * Same as above except it accepts a null terminated 139 * Same as above except it accepts a null terminated
138 * string instead an array. 140 * string instead an array.
139 * 141 *
140 * @param str the data to be decoded. 142 * @param str the data to be decoded.
141 * @return decoded data. 143 * @return decoded data.
142 */ 144 */
143 static QCString quotedPrintableDecode(const QCString & str); 145 static Q3CString quotedPrintableDecode(const Q3CString & str);
144 146
145 /** 147 /**
146 * Decodes a quoted-printable encoded data. 148 * Decodes a quoted-printable encoded data.
147 * 149 *
148 * Accepts data with CRLF or standard unix line breaks. 150 * Accepts data with CRLF or standard unix line breaks.
149 * Use this function if you want the result of the decoding 151 * Use this function if you want the result of the decoding
150 * to be placed in another array which cuts down the number 152 * to be placed in another array which cuts down the number
151 * of copy operation that have to be performed in the process. 153 * of copy operation that have to be performed in the process.
152 * This is also the preferred method for decoding an encoded 154 * This is also the preferred method for decoding an encoded
153 * binary data. 155 * binary data.
154 * 156 *
155 * NOTE: the output array is first reset and then resized 157 * NOTE: the output array is first reset and then resized
@@ -166,36 +168,36 @@ public:
166 168
167 /** 169 /**
168 * Encodes the given data using the uuencode algorithm. 170 * Encodes the given data using the uuencode algorithm.
169 * 171 *
170 * The output is split into lines starting with the number of 172 * The output is split into lines starting with the number of
171 * encoded octets in the line and ending with a newline. No 173 * encoded octets in the line and ending with a newline. No
172 * line is longer than 45 octets (60 characters), excluding the 174 * line is longer than 45 octets (60 characters), excluding the
173 * line terminator. 175 * line terminator.
174 * 176 *
175 * @param in the data to be uuencoded 177 * @param in the data to be uuencoded
176 * @return a uuencoded data. 178 * @return a uuencoded data.
177 */ 179 */
178 static QCString uuencode( const QByteArray& in ); 180 static Q3CString uuencode( const QByteArray& in );
179 181
180 /** 182 /**
181 * @overload 183 * @overload
182 * 184 *
183 * Same as the above functions except it accepts 185 * Same as the above functions except it accepts
184 * a null terminated string instead an array. 186 * a null terminated string instead an array.
185 * 187 *
186 * @param str the string to be uuencoded. 188 * @param str the string to be uuencoded.
187 * @return the encoded string. 189 * @return the encoded string.
188 */ 190 */
189 static QCString uuencode( const QCString& str ); 191 static Q3CString uuencode( const Q3CString& str );
190 192
191 /** 193 /**
192 * Encodes the given data using the uuencode algorithm. 194 * Encodes the given data using the uuencode algorithm.
193 * 195 *
194 * Use this function if you want the result of the encoding 196 * Use this function if you want the result of the encoding
195 * to be placed in another array and cut down the number of 197 * to be placed in another array and cut down the number of
196 * copy operation that have to be performed in the process. 198 * copy operation that have to be performed in the process.
197 * This is the preffered method for encoding binary data. 199 * This is the preffered method for encoding binary data.
198 * 200 *
199 * NOTE: the output array is first reset and then resized 201 * NOTE: the output array is first reset and then resized
200 * appropriately before use, hence, all data stored in the 202 * appropriately before use, hence, all data stored in the
201 * output array will be lost. 203 * output array will be lost.
@@ -206,36 +208,36 @@ public:
206 static void uuencode( const QByteArray& in, QByteArray& out ); 208 static void uuencode( const QByteArray& in, QByteArray& out );
207 209
208 /** 210 /**
209 * Decodes the given data using the uuencode algorithm. 211 * Decodes the given data using the uuencode algorithm.
210 * 212 *
211 * Any 'begin' and 'end' lines like those generated by 213 * Any 'begin' and 'end' lines like those generated by
212 * the utilities in unix and unix-like OS will be 214 * the utilities in unix and unix-like OS will be
213 * automatically ignored. 215 * automatically ignored.
214 * 216 *
215 * @param in the data uuencoded data to be decoded. 217 * @param in the data uuencoded data to be decoded.
216 * @return a decoded string. 218 * @return a decoded string.
217 */ 219 */
218 static QCString uudecode( const QByteArray& in ); 220 static Q3CString uudecode( const QByteArray& in );
219 221
220 /** 222 /**
221 * @overload 223 * @overload
222 * 224 *
223 * Same as the above functions except it accepts 225 * Same as the above functions except it accepts
224 * a null terminated string instead an array. 226 * a null terminated string instead an array.
225 * 227 *
226 * @param str the string to be decoded. 228 * @param str the string to be decoded.
227 * @return a uudecoded string. 229 * @return a uudecoded string.
228 */ 230 */
229 static QCString uudecode( const QCString& str ); 231 static Q3CString uudecode( const Q3CString& str );
230 232
231 /** 233 /**
232 * Decodes the given data using the uudecode algorithm. 234 * Decodes the given data using the uudecode algorithm.
233 * 235 *
234 * Use this function if you want the result of the decoding 236 * Use this function if you want the result of the decoding
235 * to be placed in another array which cuts down the number 237 * to be placed in another array which cuts down the number
236 * of copy operation that have to be performed in the process. 238 * of copy operation that have to be performed in the process.
237 * This is the preferred method for decoding binary data. 239 * This is the preferred method for decoding binary data.
238 * 240 *
239 * Any 'begin' and 'end' lines like those generated by 241 * Any 'begin' and 'end' lines like those generated by
240 * the utilities in unix and unix-like OS will be 242 * the utilities in unix and unix-like OS will be
241 * automatically ignored. 243 * automatically ignored.
@@ -254,37 +256,37 @@ public:
254 * Encodes the given data using the base64 algorithm. 256 * Encodes the given data using the base64 algorithm.
255 * 257 *
256 * The boolean argument determines if the encoded data is 258 * The boolean argument determines if the encoded data is
257 * going to be restricted to 76 characters or less per line 259 * going to be restricted to 76 characters or less per line
258 * as specified by RFC 2045. If @p insertLFs is true, then 260 * as specified by RFC 2045. If @p insertLFs is true, then
259 * there will be 76 characters or less per line. 261 * there will be 76 characters or less per line.
260 * 262 *
261 * @param in the data to be encoded. 263 * @param in the data to be encoded.
262 * @param insertLFs limit the number of characters per line. 264 * @param insertLFs limit the number of characters per line.
263 * 265 *
264 * @return a base64 encoded string. 266 * @return a base64 encoded string.
265 */ 267 */
266 static QCString base64Encode( const QByteArray& in, bool insertLFs = false); 268 static Q3CString base64Encode( const QByteArray& in, bool insertLFs = false);
267 269
268 /** 270 /**
269 * @overload 271 * @overload
270 * 272 *
271 * Same as the above functions except it accepts 273 * Same as the above functions except it accepts
272 * a null terminated string instead an array. 274 * a null terminated string instead an array.
273 * 275 *
274 * @param str the string to be encoded. 276 * @param str the string to be encoded.
275 * @param insertLFs limit the number of characters per line. 277 * @param insertLFs limit the number of characters per line.
276 * @return the decoded string. 278 * @return the decoded string.
277 */ 279 */
278 static QCString base64Encode( const QCString& str, bool insertLFs = false ); 280 static Q3CString base64Encode( const Q3CString& str, bool insertLFs = false );
279 281
280 /** 282 /**
281 * Encodes the given data using the base64 algorithm. 283 * Encodes the given data using the base64 algorithm.
282 * 284 *
283 * Use this function if you want the result of the encoding 285 * Use this function if you want the result of the encoding
284 * to be placed in another array which cuts down the number 286 * to be placed in another array which cuts down the number
285 * of copy operation that have to be performed in the process. 287 * of copy operation that have to be performed in the process.
286 * This is also the preferred method for encoding binary data. 288 * This is also the preferred method for encoding binary data.
287 * 289 *
288 * The boolean argument determines if the encoded data is going 290 * The boolean argument determines if the encoded data is going
289 * to be restricted to 76 characters or less per line as specified 291 * to be restricted to 76 characters or less per line as specified
290 * by RFC 2045. If @p insertLFs is true, then there will be 76 292 * by RFC 2045. If @p insertLFs is true, then there will be 76
@@ -299,36 +301,36 @@ public:
299 * @param insertLFs limit the number of characters per line. 301 * @param insertLFs limit the number of characters per line.
300 */ 302 */
301 static void base64Encode( const QByteArray& in, QByteArray& out, 303 static void base64Encode( const QByteArray& in, QByteArray& out,
302 bool insertLFs = false ); 304 bool insertLFs = false );
303 305
304 /** 306 /**
305 * Decodes the given data that was encoded using the 307 * Decodes the given data that was encoded using the
306 * base64 algorithm. 308 * base64 algorithm.
307 * 309 *
308 * @param in the base64-encoded data to be decoded. 310 * @param in the base64-encoded data to be decoded.
309 * @return the decoded data. 311 * @return the decoded data.
310 */ 312 */
311 static QCString base64Decode( const QByteArray& in ); 313 static Q3CString base64Decode( const QByteArray& in );
312 314
313 /** 315 /**
314 * @overload 316 * @overload
315 * 317 *
316 * Same as the above functions except it accepts 318 * Same as the above functions except it accepts
317 * a null terminated string instead an array. 319 * a null terminated string instead an array.
318 * 320 *
319 * @param str the base64-encoded string. 321 * @param str the base64-encoded string.
320 * @return the decoded string. 322 * @return the decoded string.
321 */ 323 */
322 static QCString base64Decode( const QCString& str ); 324 static Q3CString base64Decode( const Q3CString& str );
323 325
324 /** 326 /**
325 * Decodes the given data that was encoded with the base64 327 * Decodes the given data that was encoded with the base64
326 * algorithm. 328 * algorithm.
327 * 329 *
328 * Use this function if you want the result of the decoding 330 * Use this function if you want the result of the decoding
329 * to be placed in another array which cuts down the number 331 * to be placed in another array which cuts down the number
330 * of copy operation that have to be performed in the process. 332 * of copy operation that have to be performed in the process.
331 * This is also the preferred method for decoding an encoded 333 * This is also the preferred method for decoding an encoded
332 * binary data. 334 * binary data.
333 * 335 *
334 * NOTE: the output array is first reset and then resized 336 * NOTE: the output array is first reset and then resized
@@ -422,25 +424,25 @@ public:
422 /** 424 /**
423 * @overload 425 * @overload
424 * 426 *
425 * Same as above except it accepts a QByteArray as its argument. 427 * Same as above except it accepts a QByteArray as its argument.
426 */ 428 */
427 KMD5(const QByteArray& a ); 429 KMD5(const QByteArray& a );
428 430
429 /** 431 /**
430 * @overload 432 * @overload
431 * 433 *
432 * Same as above except it accepts a QByteArray as its argument. 434 * Same as above except it accepts a QByteArray as its argument.
433 */ 435 */
434 KMD5(const QCString& a ); 436 KMD5(const Q3CString& a );
435 437
436 /** 438 /**
437 * Updates the message to be digested. Be sure to add all data 439 * Updates the message to be digested. Be sure to add all data
438 * before you read the digest. After reading the digest, you 440 * before you read the digest. After reading the digest, you
439 * can <b>not</b> add more data! 441 * can <b>not</b> add more data!
440 * 442 *
441 * @param in message to be added to digest 443 * @param in message to be added to digest
442 * @param len the length of the given message. 444 * @param len the length of the given message.
443 */ 445 */
444 void update(const char* in, int len = -1) { update(reinterpret_cast<const unsigned char*>(in), len); } 446 void update(const char* in, int len = -1) { update(reinterpret_cast<const unsigned char*>(in), len); }
445 447
446 /** 448 /**
@@ -451,25 +453,25 @@ public:
451 /** 453 /**
452 * @overload 454 * @overload
453 * 455 *
454 * @param in message to be added to the digest (QByteArray). 456 * @param in message to be added to the digest (QByteArray).
455 */ 457 */
456 void update(const QByteArray& in ); 458 void update(const QByteArray& in );
457 459
458 /** 460 /**
459 * @overload 461 * @overload
460 * 462 *
461 * @param in message to be added to the digest (QByteArray). 463 * @param in message to be added to the digest (QByteArray).
462 */ 464 */
463 void update(const QCString& in ); 465 void update(const Q3CString& in );
464 466
465 /** 467 /**
466 * @overload 468 * @overload
467 * 469 *
468 * reads the data from an I/O device, i.e. from a file (QFile). 470 * reads the data from an I/O device, i.e. from a file (QFile).
469 * 471 *
470 * NOTE that the file must be open for reading. 472 * NOTE that the file must be open for reading.
471 * 473 *
472 * @param file a pointer to FILE as returned by calls like f{d,re}open 474 * @param file a pointer to FILE as returned by calls like f{d,re}open
473 * 475 *
474 * @returns false if an error occured during reading. 476 * @returns false if an error occured during reading.
475 */ 477 */
@@ -493,47 +495,47 @@ public:
493 * 495 *
494 * Use this method if you do not want to worry about making 496 * Use this method if you do not want to worry about making
495 * copy of the digest once you obtain it. 497 * copy of the digest once you obtain it.
496 * 498 *
497 * @param bin an array of 16 characters ( char[16] ) 499 * @param bin an array of 16 characters ( char[16] )
498 */ 500 */
499 void rawDigest( KMD5::Digest& bin ); 501 void rawDigest( KMD5::Digest& bin );
500 502
501 /** 503 /**
502 * Returns the value of the calculated message digest in 504 * Returns the value of the calculated message digest in
503 * a hexadecimal representation. 505 * a hexadecimal representation.
504 */ 506 */
505 QCString hexDigest (); 507 Q3CString hexDigest ();
506 508
507 /** 509 /**
508 * @overload 510 * @overload
509 */ 511 */
510 void hexDigest(QCString&); 512 void hexDigest(Q3CString&);
511 513
512 /** 514 /**
513 * Returns the value of the calculated message digest in 515 * Returns the value of the calculated message digest in
514 * a base64-encoded representation. 516 * a base64-encoded representation.
515 */ 517 */
516 QCString base64Digest (); 518 Q3CString base64Digest ();
517 519
518 /** 520 /**
519 * returns true if the calculated digest for the given 521 * returns true if the calculated digest for the given
520 * message matches the given one. 522 * message matches the given one.
521 */ 523 */
522 bool verify( const KMD5::Digest& digest); 524 bool verify( const KMD5::Digest& digest);
523 525
524 /** 526 /**
525 * @overload 527 * @overload
526 */ 528 */
527 bool verify(const QCString&); 529 bool verify(const Q3CString&);
528 530
529protected: 531protected:
530 /** 532 /**
531 * Performs the real update work. Note 533 * Performs the real update work. Note
532 * that length is implied to be 64. 534 * that length is implied to be 64.
533 */ 535 */
534 void transform( const unsigned char buffer[64] ); 536 void transform( const unsigned char buffer[64] );
535 537
536 /** 538 /**
537 * finalizes the digest 539 * finalizes the digest
538 */ 540 */
539 void finalize(); 541 void finalize();
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp
index 0220a34..d4010fa 100644
--- a/microkde/kdecore/kprefs.cpp
+++ b/microkde/kdecore/kprefs.cpp
@@ -12,24 +12,26 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include <qcolor.h> 23#include <qcolor.h>
24//Added by qt3to4:
25#include <Q3ValueList>
24 26
25#include <kconfig.h> 27#include <kconfig.h>
26#include <kstandarddirs.h> 28#include <kstandarddirs.h>
27#include <kglobal.h> 29#include <kglobal.h>
28#include <kdebug.h> 30#include <kdebug.h>
29 31
30#include "kprefs.h" 32#include "kprefs.h"
31 33
32class KPrefsItemBool : public KPrefsItem { 34class KPrefsItemBool : public KPrefsItem {
33 public: 35 public:
34 KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true); 36 KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true);
35 virtual ~KPrefsItemBool() {} 37 virtual ~KPrefsItemBool() {}
@@ -131,35 +133,35 @@ class KPrefsItemStringList : public KPrefsItem {
131 void setDefault(); 133 void setDefault();
132 void readConfig(KConfig *); 134 void readConfig(KConfig *);
133 void writeConfig(KConfig *); 135 void writeConfig(KConfig *);
134 136
135 private: 137 private:
136 QStringList *mReference; 138 QStringList *mReference;
137 QStringList mDefault; 139 QStringList mDefault;
138}; 140};
139 141
140 142
141class KPrefsItemIntList : public KPrefsItem { 143class KPrefsItemIntList : public KPrefsItem {
142 public: 144 public:
143 KPrefsItemIntList(const QString &group,const QString &name,QValueList<int> *, 145 KPrefsItemIntList(const QString &group,const QString &name,Q3ValueList<int> *,
144 const QValueList<int> &defaultValue=QValueList<int>()); 146 const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
145 virtual ~KPrefsItemIntList() {} 147 virtual ~KPrefsItemIntList() {}
146 148
147 void setDefault(); 149 void setDefault();
148 void readConfig(KConfig *); 150 void readConfig(KConfig *);
149 void writeConfig(KConfig *); 151 void writeConfig(KConfig *);
150 152
151 private: 153 private:
152 QValueList<int> *mReference; 154 Q3ValueList<int> *mReference;
153 QValueList<int> mDefault; 155 Q3ValueList<int> mDefault;
154}; 156};
155 157
156 158
157KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name, 159KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name,
158 bool *reference,bool defaultValue) : 160 bool *reference,bool defaultValue) :
159 KPrefsItem(group,name) 161 KPrefsItem(group,name)
160{ 162{
161 mReference = reference; 163 mReference = reference;
162 mDefault = defaultValue; 164 mDefault = defaultValue;
163} 165}
164 166
165void KPrefsItemBool::setDefault() 167void KPrefsItemBool::setDefault()
@@ -355,25 +357,25 @@ void KPrefsItemStringList::writeConfig(KConfig *config)
355 config->setGroup(mGroup); 357 config->setGroup(mGroup);
356 config->writeEntry(mName,*mReference); 358 config->writeEntry(mName,*mReference);
357} 359}
358 360
359void KPrefsItemStringList::readConfig(KConfig *config) 361void KPrefsItemStringList::readConfig(KConfig *config)
360{ 362{
361 config->setGroup(mGroup); 363 config->setGroup(mGroup);
362 *mReference = config->readListEntry(mName); 364 *mReference = config->readListEntry(mName);
363} 365}
364 366
365 367
366KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name, 368KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name,
367 QValueList<int> *reference,const QValueList<int> &defaultValue) : 369 Q3ValueList<int> *reference,const Q3ValueList<int> &defaultValue) :
368 KPrefsItem(group,name) 370 KPrefsItem(group,name)
369{ 371{
370 mReference = reference; 372 mReference = reference;
371 mDefault = defaultValue; 373 mDefault = defaultValue;
372} 374}
373 375
374void KPrefsItemIntList::setDefault() 376void KPrefsItemIntList::setDefault()
375{ 377{
376 *mReference = mDefault; 378 *mReference = mDefault;
377} 379}
378 380
379void KPrefsItemIntList::writeConfig(KConfig *config) 381void KPrefsItemIntList::writeConfig(KConfig *config)
@@ -496,17 +498,17 @@ void KPrefs::addItemString(const QString &key,QString *reference,const QString &
496 498
497void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue) 499void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue)
498{ 500{
499 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true)); 501 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true));
500} 502}
501 503
502void KPrefs::addItemStringList(const QString &key,QStringList *reference, 504void KPrefs::addItemStringList(const QString &key,QStringList *reference,
503 const QStringList &defaultValue) 505 const QStringList &defaultValue)
504{ 506{
505 addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue)); 507 addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue));
506} 508}
507 509
508void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference, 510void KPrefs::addItemIntList(const QString &key,Q3ValueList<int> *reference,
509 const QValueList<int> &defaultValue) 511 const Q3ValueList<int> &defaultValue)
510{ 512{
511 addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue)); 513 addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue));
512} 514}
diff --git a/microkde/kdecore/kprefs.h b/microkde/kdecore/kprefs.h
index 95d2724..d9d1572 100644
--- a/microkde/kdecore/kprefs.h
+++ b/microkde/kdecore/kprefs.h
@@ -12,29 +12,31 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef _KPREFS_H 20#ifndef _KPREFS_H
21#define _KPREFS_H 21#define _KPREFS_H
22// $Id$ 22// $Id$
23 23
24#include <qptrlist.h> 24#include <q3ptrlist.h>
25#include <qcolor.h> 25#include <qcolor.h>
26#include <qfont.h> 26#include <qfont.h>
27#include <qsize.h> 27#include <qsize.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29//Added by qt3to4:
30#include <Q3ValueList>
29 31
30class KConfig; 32class KConfig;
31 33
32/** 34/**
33 @short Class for storing a preferences setting 35 @short Class for storing a preferences setting
34 @author Cornelius Schumacher 36 @author Cornelius Schumacher
35 @see KPref 37 @see KPref
36 38
37 This class represents one preferences setting as used by @ref KPrefs. 39 This class represents one preferences setting as used by @ref KPrefs.
38 Subclasses of KPrefsItem implement storage functions for a certain type of 40 Subclasses of KPrefsItem implement storage functions for a certain type of
39 setting. Normally you don't have to use this class directly. Use the special 41 setting. Normally you don't have to use this class directly. Use the special
40 addItem() functions of KPrefs instead. If you subclass this class you will 42 addItem() functions of KPrefs instead. If you subclass this class you will
@@ -274,26 +276,26 @@ class KPrefs {
274 const QStringList &defaultValue=QStringList()); 276 const QStringList &defaultValue=QStringList());
275 277
276 /** 278 /**
277 Register an item of type QValueList<int>. 279 Register an item of type QValueList<int>.
278 280
279 @param key Key used in config file. 281 @param key Key used in config file.
280 @param reference Pointer to the variable, which is set by readConfig() 282 @param reference Pointer to the variable, which is set by readConfig()
281 and setDefaults() calls and read by writeConfig() calls. 283 and setDefaults() calls and read by writeConfig() calls.
282 @param defaultValue Default value, which is used by setDefaults() and 284 @param defaultValue Default value, which is used by setDefaults() and
283 when the config file does not yet contain the key of 285 when the config file does not yet contain the key of
284 this item. 286 this item.
285 */ 287 */
286 void addItemIntList(const QString &key,QValueList<int> *reference, 288 void addItemIntList(const QString &key,Q3ValueList<int> *reference,
287 const QValueList<int> &defaultValue=QValueList<int>()); 289 const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
288 290
289 protected: 291 protected:
290 /** 292 /**
291 Implemented by subclasses that use special defaults. 293 Implemented by subclasses that use special defaults.
292 */ 294 */
293 virtual void usrSetDefaults() {}; 295 virtual void usrSetDefaults() {};
294 /** 296 /**
295 Implemented by subclasses that read special config values. 297 Implemented by subclasses that read special config values.
296 */ 298 */
297 virtual void usrReadConfig() {}; 299 virtual void usrReadConfig() {};
298 /** 300 /**
299 Implemented by subclasses that write special config values. 301 Implemented by subclasses that write special config values.
@@ -301,16 +303,16 @@ class KPrefs {
301 virtual void usrWriteConfig() {}; 303 virtual void usrWriteConfig() {};
302 304
303 /** 305 /**
304 Return the @ref KConfig object used for reading and writing the settings. 306 Return the @ref KConfig object used for reading and writing the settings.
305 */ 307 */
306 KConfig *config() const; 308 KConfig *config() const;
307 309
308 private: 310 private:
309 static QString *mCurrentGroup; 311 static QString *mCurrentGroup;
310 312
311 KConfig *mConfig; // pointer to KConfig object 313 KConfig *mConfig; // pointer to KConfig object
312 314
313 QPtrList<KPrefsItem> mItems; 315 Q3PtrList<KPrefsItem> mItems;
314}; 316};
315 317
316#endif 318#endif
diff --git a/microkde/kdecore/kshortcut.h b/microkde/kdecore/kshortcut.h
index 4813734..244d590 100644
--- a/microkde/kdecore/kshortcut.h
+++ b/microkde/kdecore/kshortcut.h
@@ -554,25 +554,25 @@ class KShortcut
554 * @see null() 554 * @see null()
555 * @see isNull() 555 * @see isNull()
556 * @see clear() 556 * @see clear()
557 */ 557 */
558 KShortcut() {} 558 KShortcut() {}
559 559
560 /** 560 /**
561 * Creates a new shortcut with the given Qt key code 561 * Creates a new shortcut with the given Qt key code
562 * as the only key sequence. 562 * as the only key sequence.
563 * @param keyQt the qt keycode 563 * @param keyQt the qt keycode
564 * @see Qt::Key 564 * @see Qt::Key
565 */ 565 */
566 KShortcut( int keyQt ) {} 566 KShortcut( int /*keyQt */) {}
567 567
568 /** 568 /**
569 * Creates a new shortcut that contains only the given qt key 569 * Creates a new shortcut that contains only the given qt key
570 * sequence. 570 * sequence.
571 * @param keySeq the qt key sequence to add 571 * @param keySeq the qt key sequence to add
572 */ 572 */
573 //USKShortcut( const QKeySequence& keySeq ) {} 573 //USKShortcut( const QKeySequence& keySeq ) {}
574 574
575 /** 575 /**
576 * Creates a new shortcut that contains only the given key 576 * Creates a new shortcut that contains only the given key
577 * in its only sequence. 577 * in its only sequence.
578 * @param key the key to add 578 * @param key the key to add
@@ -590,34 +590,34 @@ class KShortcut
590 * Copies the given shortcut. 590 * Copies the given shortcut.
591 * @param shortcut the shortcut to add 591 * @param shortcut the shortcut to add
592 */ 592 */
593 //USKShortcut( const KShortcut& shortcut ); 593 //USKShortcut( const KShortcut& shortcut );
594 594
595 /** 595 /**
596 * Creates a new key sequence that contains the given key sequence. 596 * Creates a new key sequence that contains the given key sequence.
597 * The description consists of semicolon-separated keys as 597 * The description consists of semicolon-separated keys as
598 * used in @ref KKeySequence::KKeySequence(const QString&). 598 * used in @ref KKeySequence::KKeySequence(const QString&).
599 * @param shortcut the description of the key 599 * @param shortcut the description of the key
600 * @see KKeySequence::KKeySequence(const QString&) 600 * @see KKeySequence::KKeySequence(const QString&)
601 */ 601 */
602 KShortcut( const char* shortcut ) {} 602 KShortcut( const char* /*shortcut */) {}
603 603
604 /** 604 /**
605 * Creates a new key sequence that contains the given key sequence. 605 * Creates a new key sequence that contains the given key sequence.
606 * The description consists of semicolon-separated keys as 606 * The description consists of semicolon-separated keys as
607 * used in @ref KKeySequence::KKeySequence(const QString&). 607 * used in @ref KKeySequence::KKeySequence(const QString&).
608 * @param shortcut the description of the key 608 * @param shortcut the description of the key
609 * @see KKeySequence::KKeySequence(const QString&) 609 * @see KKeySequence::KKeySequence(const QString&)
610 */ 610 */
611 KShortcut( const QString& shortcut ) {} 611 KShortcut( const QString& /*shortcut */) {}
612 ~KShortcut() {} 612 ~KShortcut() {}
613 613
614 /** 614 /**
615 * Clears the shortcut. The shortcut is null after calling this 615 * Clears the shortcut. The shortcut is null after calling this
616 * function. 616 * function.
617 * @see isNull() 617 * @see isNull()
618 */ 618 */
619 //USvoid clear(); 619 //USvoid clear();
620 620
621 /** 621 /**
622 * Initializes the shortcut with the given Qt key code 622 * Initializes the shortcut with the given Qt key code
623 * as the only key sequence. 623 * as the only key sequence.
@@ -807,25 +807,25 @@ class KShortcut
807 /** 807 /**
808 * Returns a description of the shortcut as semicolon-separated 808 * Returns a description of the shortcut as semicolon-separated
809 * ket sequences, as returned by @ref KKeySequence::toString(). 809 * ket sequences, as returned by @ref KKeySequence::toString().
810 * @return the string represenation of this shortcut 810 * @return the string represenation of this shortcut
811 * @see KKey::toString() 811 * @see KKey::toString()
812 * @see KKeySequence::toString() 812 * @see KKeySequence::toString()
813 */ 813 */
814 //USQString toString() const; 814 //USQString toString() const;
815 815
816 /** 816 /**
817 * @internal 817 * @internal
818 */ 818 */
819 QString toStringInternal( const KShortcut* pcutDefault = 0 ) const 819 QString toStringInternal( const KShortcut* /*pcutDefault*/ = 0 ) const
820 { 820 {
821 return "EMPTY IMPL."; 821 return "EMPTY IMPL.";
822 } 822 }
823 823
824 /** 824 /**
825 * Returns a null shortcut. 825 * Returns a null shortcut.
826 * @return the null shortcut 826 * @return the null shortcut
827 * @see isNull() 827 * @see isNull()
828 * @see clear() 828 * @see clear()
829 */ 829 */
830 //USstatic KShortcut& null(); 830 //USstatic KShortcut& null();
831 831
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index d5bfefd..f10934b 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -28,73 +28,75 @@
28 28
29#include <stdlib.h> 29#include <stdlib.h>
30#include <assert.h> 30#include <assert.h>
31//US#include <errno.h> 31//US#include <errno.h>
32//US #ifdef HAVE_SYS_STAT_H 32//US #ifdef HAVE_SYS_STAT_H
33//US #include <sys/stat.h> 33//US #include <sys/stat.h>
34//US #endif 34//US #endif
35//US#include <sys/types.h> 35//US#include <sys/types.h>
36//US#include <dirent.h> 36//US#include <dirent.h>
37//US#include <pwd.h> 37//US#include <pwd.h>
38 38
39#include <qregexp.h> 39#include <qregexp.h>
40#include <qasciidict.h> 40#include <q3asciidict.h>
41#include <qdict.h> 41#include <q3dict.h>
42#include <qdir.h> 42#include <qdir.h>
43#include <qfileinfo.h> 43#include <qfileinfo.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qmessagebox.h> 45#include <qmessagebox.h>
46#include <qapplication.h> 46#include <qapplication.h>
47 47
48#include <qstringlist.h> 48#include <qstringlist.h>
49//Added by qt3to4:
50#include <Q3CString>
49 51
50#include "kstandarddirs.h" 52#include "kstandarddirs.h"
51#include "kconfig.h" 53#include "kconfig.h"
52#include "kdebug.h" 54#include "kdebug.h"
53//US #include "kinstance.h" 55//US #include "kinstance.h"
54#include "kshell.h" 56#include "kshell.h"
55//US#include <sys/param.h> 57//US#include <sys/param.h>
56//US#include <unistd.h> 58//US#include <unistd.h>
57 59
58//US 60//US
59QString KStandardDirs::mAppDir = QString::null; 61QString KStandardDirs::mAppDir = QString::null;
60 62
61 63
62template class QDict<QStringList>; 64template class Q3Dict<QStringList>;
63 65
64#if 0 66#if 0
65#include <qtextedit.h> 67#include <q3textedit.h>
66void ddd( QString op ) 68void ddd( QString op )
67{ 69{
68 static QTextEdit * dot = 0; 70 static Q3TextEdit * dot = 0;
69 if ( ! dot ) 71 if ( ! dot )
70 dot = new QTextEdit(); 72 dot = new Q3TextEdit();
71 73
72 dot->show(); 74 dot->show();
73 75
74 dot->append( op ); 76 dot->append( op );
75 77
76} 78}
77#endif 79#endif
78class KStandardDirs::KStandardDirsPrivate 80class KStandardDirs::KStandardDirsPrivate
79{ 81{
80public: 82public:
81 KStandardDirsPrivate() 83 KStandardDirsPrivate()
82 : restrictionsActive(false), 84 : restrictionsActive(false),
83 dataRestrictionActive(false) 85 dataRestrictionActive(false)
84 { } 86 { }
85 87
86 bool restrictionsActive; 88 bool restrictionsActive;
87 bool dataRestrictionActive; 89 bool dataRestrictionActive;
88 QAsciiDict<bool> restrictions; 90 Q3AsciiDict<bool> restrictions;
89 QStringList xdgdata_prefixes; 91 QStringList xdgdata_prefixes;
90 QStringList xdgconf_prefixes; 92 QStringList xdgconf_prefixes;
91}; 93};
92 94
93static const char* const types[] = {"html", "icon", "apps", "sound", 95static const char* const types[] = {"html", "icon", "apps", "sound",
94 "data", "locale", "services", "mime", 96 "data", "locale", "services", "mime",
95 "servicetypes", "config", "exe", "tmp", 97 "servicetypes", "config", "exe", "tmp",
96 "wallpaper", "lib", "pixmap", "templates", 98 "wallpaper", "lib", "pixmap", "templates",
97 "module", "qtplugins", 99 "module", "qtplugins",
98 "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 }; 100 "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 };
99 101
100static int tokenize( QStringList& token, const QString& str, 102static int tokenize( QStringList& token, const QString& str,
@@ -436,25 +438,25 @@ static void lookupDirectory(const QString& path, const QString &relPart,
436 it++; 438 it++;
437 if ( fn.isNull() ) 439 if ( fn.isNull() )
438 break; 440 break;
439 441
440 if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' ) 442 if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' )
441 continue; 443 continue;
442 444
443/*US 445/*US
444 if (!recursive && !regexp.exactMatch(fn)) 446 if (!recursive && !regexp.exactMatch(fn))
445 continue; // No match 447 continue; // No match
446*/ 448*/
447//US this should do the same: 449//US this should do the same:
448 int pos = regexp.match(fn); 450 int pos = regexp.exactMatch(fn);
449 if (!recursive && !pos == 0) 451 if (!recursive && !pos == 0)
450 continue; // No match 452 continue; // No match
451 453
452 QString pathfn = path + fn; 454 QString pathfn = path + fn;
453/*US 455/*US
454 if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) { 456 if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) {
455 kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl; 457 kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl;
456 continue; // Couldn't stat (e.g. no read permissions) 458 continue; // Couldn't stat (e.g. no read permissions)
457 } 459 }
458 460
459 if ( recursive ) 461 if ( recursive )
460 { 462 {
@@ -473,25 +475,25 @@ static void lookupDirectory(const QString& path, const QString &relPart,
473 if ( recursive ) 475 if ( recursive )
474 { 476 {
475 if ( pathfnInfo.isDir()) { 477 if ( pathfnInfo.isDir()) {
476 lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq); 478 lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq);
477 } 479 }
478 480
479 481
480/*US 482/*US
481 if (!regexp.exactMatch(fn)) 483 if (!regexp.exactMatch(fn))
482 continue; // No match 484 continue; // No match
483*/ 485*/
484//US this should do the same: 486//US this should do the same:
485 pos = regexp.match(fn); 487 pos = regexp.exactMatch(fn);
486 if (!pos == 0) 488 if (!pos == 0)
487 continue; // No match 489 continue; // No match
488 } 490 }
489 491
490//US if ( S_ISREG( buff.st_mode)) 492//US if ( S_ISREG( buff.st_mode))
491 if ( pathfnInfo.isFile()) 493 if ( pathfnInfo.isFile())
492 { 494 {
493 if (!uniq || !relList.contains(relPart + fn)) 495 if (!uniq || !relList.contains(relPart + fn))
494 { 496 {
495 list.append( pathfn ); 497 list.append( pathfn );
496 relList.append( relPart + fn ); 498 relList.append( relPart + fn );
497 } 499 }
@@ -1099,25 +1101,25 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
1099 // append trailing slash if missing 1101 // append trailing slash if missing
1100 if (dir.at(len - 1) != '/') 1102 if (dir.at(len - 1) != '/')
1101 target += '/'; 1103 target += '/';
1102 1104
1103 QString base(""); 1105 QString base("");
1104 uint i = 1; 1106 uint i = 1;
1105 1107
1106 while( i < len ) 1108 while( i < len )
1107 { 1109 {
1108//US struct stat st; 1110//US struct stat st;
1109 int pos = target.find('/', i); 1111 int pos = target.find('/', i);
1110 base += target.mid(i - 1, pos - i + 1); 1112 base += target.mid(i - 1, pos - i + 1);
1111 QCString baseEncoded = QFile::encodeName(base); 1113 Q3CString baseEncoded = QFile::encodeName(base);
1112 // bail out if we encountered a problem 1114 // bail out if we encountered a problem
1113//US if (stat(baseEncoded, &st) != 0) 1115//US if (stat(baseEncoded, &st) != 0)
1114 QFileInfo baseEncodedInfo(baseEncoded); 1116 QFileInfo baseEncodedInfo(baseEncoded);
1115 if (!baseEncodedInfo.exists()) 1117 if (!baseEncodedInfo.exists())
1116 { 1118 {
1117 // Directory does not exist.... 1119 // Directory does not exist....
1118 // Or maybe a dangling symlink ? 1120 // Or maybe a dangling symlink ?
1119//US if (lstat(baseEncoded, &st) == 0) 1121//US if (lstat(baseEncoded, &st) == 0)
1120 if (baseEncodedInfo.isSymLink()) { 1122 if (baseEncodedInfo.isSymLink()) {
1121//US (void)unlink(baseEncoded); // try removing 1123//US (void)unlink(baseEncoded); // try removing
1122 QFile(baseEncoded).remove(); 1124 QFile(baseEncoded).remove();
1123 } 1125 }
@@ -1199,25 +1201,25 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
1199 1201
1200 i = pos + 1; 1202 i = pos + 1;
1201 } 1203 }
1202 return true; 1204 return true;
1203 1205
1204} 1206}
1205 1207
1206QString readEnvPath(const char *env) 1208QString readEnvPath(const char *env)
1207{ 1209{
1208 //#ifdef _WIN32_ 1210 //#ifdef _WIN32_
1209 // return ""; 1211 // return "";
1210 //#else 1212 //#else
1211 QCString c_path; 1213 Q3CString c_path;
1212 if ( getenv(env) != NULL ) 1214 if ( getenv(env) != NULL )
1213 c_path = QString ( getenv(env) ); 1215 c_path = QString ( getenv(env) );
1214 if (c_path.isEmpty()) 1216 if (c_path.isEmpty())
1215 return QString::null; 1217 return QString::null;
1216 return QFile::decodeName(c_path); 1218 return QFile::decodeName(c_path);
1217 //#endif 1219 //#endif
1218 1220
1219} 1221}
1220 1222
1221void KStandardDirs::addKDEDefaults() 1223void KStandardDirs::addKDEDefaults()
1222{ 1224{
1223 1225
diff --git a/microkde/kdecore/kstandarddirs.h b/microkde/kdecore/kstandarddirs.h
index 901384e..f0e28fc 100644
--- a/microkde/kdecore/kstandarddirs.h
+++ b/microkde/kdecore/kstandarddirs.h
@@ -15,25 +15,25 @@
15 Library General Public License for more details. 15 Library General Public License for more details.
16 16
17 You should have received a copy of the GNU Library General Public License 17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to 18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#ifndef SSK_KSTDDIRS_H 23#ifndef SSK_KSTDDIRS_H
24#define SSK_KSTDDIRS_H 24#define SSK_KSTDDIRS_H
25 25
26#include <qstring.h> 26#include <qstring.h>
27#include <qdict.h> 27#include <q3dict.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <kglobal.h> 29#include <kglobal.h>
30 30
31class KConfig; 31class KConfig;
32class KStandardDirsPrivate; 32class KStandardDirsPrivate;
33 33
34 34
35/** 35/**
36 * @short Site-independent access to standard KDE directories. 36 * @short Site-independent access to standard KDE directories.
37 * @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org> 37 * @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
38 * @version $Id$ 38 * @version $Id$
39 * 39 *
@@ -565,29 +565,29 @@ public:
565 * @since 3.1 565 * @since 3.1
566 */ 566 */
567 static QString realPath(const QString &dirname); 567 static QString realPath(const QString &dirname);
568 568
569 static void setAppDir( const QString & ); 569 static void setAppDir( const QString & );
570 static QString appDir(); 570 static QString appDir();
571 571
572 private: 572 private:
573 573
574 QStringList prefixes; 574 QStringList prefixes;
575 575
576 // Directory dictionaries 576 // Directory dictionaries
577 QDict<QStringList> absolutes; 577 Q3Dict<QStringList> absolutes;
578 QDict<QStringList> relatives; 578 Q3Dict<QStringList> relatives;
579 579
580 mutable QDict<QStringList> dircache; 580 mutable Q3Dict<QStringList> dircache;
581 mutable QDict<QString> savelocations; 581 mutable Q3Dict<QString> savelocations;
582 582
583 // Disallow assignment and copy-construction 583 // Disallow assignment and copy-construction
584 KStandardDirs( const KStandardDirs& ); 584 KStandardDirs( const KStandardDirs& );
585 KStandardDirs& operator= ( const KStandardDirs& ); 585 KStandardDirs& operator= ( const KStandardDirs& );
586 586
587 bool addedCustoms; 587 bool addedCustoms;
588 588
589 class KStandardDirsPrivate; 589 class KStandardDirsPrivate;
590 KStandardDirsPrivate *d; 590 KStandardDirsPrivate *d;
591//US 591//US
592 static QString mAppDir; 592 static QString mAppDir;
593 593