summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2005-02-07 20:05:18 (UTC)
committer zautrix <zautrix>2005-02-07 20:05:18 (UTC)
commitda5e47069d88fa9aa656423ce4c60bf505728e1c (patch) (unidiff)
treefdbaf29835a028f1204a19fc10dea97d469c0b29 /microkde
parent456b0246521847635fe98471691ceecae211e0c3 (diff)
downloadkdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.zip
kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.gz
kdepimpi-da5e47069d88fa9aa656423ce4c60bf505728e1c.tar.bz2
fixes
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kapplication.cpp3
-rw-r--r--microkde/kdecore/klibloader.cpp14
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.h2
4 files changed, 7 insertions, 14 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index 21aa0a4..f05b91b 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -1,110 +1,111 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <stdio.h> 2#include <stdio.h>
3 3
4#include "kapplication.h" 4#include "kapplication.h"
5#include "ktextedit.h" 5#include "ktextedit.h"
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qstring.h> 7#include <qstring.h>
8#include <qfile.h> 8#include <qfile.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qdialog.h> 10#include <qdialog.h>
11#include <qlayout.h> 11#include <qlayout.h>
12#include <qtextbrowser.h> 12#include <qtextbrowser.h>
13 13
14int KApplication::random() 14int KApplication::random()
15{ 15{
16 return rand(); 16 return rand();
17} 17}
18 18
19//US 19//US
20QString KApplication::randomString(int length) 20QString KApplication::randomString(int length)
21{ 21{
22 if (length <=0 ) return QString::null; 22 if (length <=0 ) return QString::null;
23 23
24 QString str; 24 QString str;
25 while (length--) 25 while (length--)
26 { 26 {
27 int r=random() % 62; 27 int r=random() % 62;
28 r+=48; 28 r+=48;
29 if (r>57) r+=7; 29 if (r>57) r+=7;
30 if (r>90) r+=6; 30 if (r>90) r+=6;
31 str += char(r); 31 str += char(r);
32 // so what if I work backwards? 32 // so what if I work backwards?
33 } 33 }
34 return str; 34 return str;
35} 35}
36int KApplication::execDialog( QDialog* d ) 36int KApplication::execDialog( QDialog* d )
37{ 37{
38 if (QApplication::desktop()->width() <= 640 ) 38 if (QApplication::desktop()->width() <= 640 )
39 d->showMaximized(); 39 d->showMaximized();
40 else 40 else
41 ;//d->resize( 800, 600 ); 41 ;//d->resize( 800, 600 );
42 return d->exec(); 42 return d->exec();
43} 43}
44void KApplication::showLicence() 44void KApplication::showLicence()
45{ 45{
46 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" ); 46 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" );
47} 47}
48 48
49void KApplication::showFile(QString caption, QString fn) 49void KApplication::showFile(QString caption, QString fn)
50{ 50{
51 QString text; 51 QString text;
52 QString fileName; 52 QString fileName;
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54 fileName = getenv("QPEDIR"); 54 fileName = getenv("QPEDIR");
55 fileName += "/pics/" + fn ; 55 fileName += "/pics/" + fn ;
56#else 56#else
57 fileName = qApp->applicationDirPath () + "/" + fn; 57 fileName = qApp->applicationDirPath () + "/" + fn;
58#endif 58#endif
59 QFile file( fileName ); 59 QFile file( fileName );
60 if (!file.open( IO_ReadOnly ) ) { 60 if (!file.open( IO_ReadOnly ) ) {
61 return ; 61 return ;
62 } 62 }
63 QTextStream ts( &file ); 63 QTextStream ts( &file );
64 text = ts.read(); 64 text = ts.read();
65 file.close(); 65 file.close();
66 KApplication::showText( caption, text ); 66 KApplication::showText( caption, text );
67 67
68} 68}
69 69
70bool KApplication::convert2latin1(QString fileName) 70bool KApplication::convert2latin1(QString fileName)
71{ 71{
72 QString text; 72 QString text;
73 QFile file( fileName ); 73 QFile file( fileName );
74 if (!file.open( IO_ReadOnly ) ) { 74 if (!file.open( IO_ReadOnly ) ) {
75 return false; 75 return false;
76 76
77 } 77 }
78 QTextStream ts( &file ); 78 QTextStream ts( &file );
79 ts.setEncoding( QTextStream::UnicodeUTF8 ); 79 ts.setEncoding( QTextStream::UnicodeUTF8 );
80 text = ts.read(); 80 text = ts.read();
81 file.close(); 81 file.close();
82 if (!file.open( IO_WriteOnly ) ) { 82 if (!file.open( IO_WriteOnly ) ) {
83 return false; 83 return false;
84 } 84 }
85 QTextStream tsIn( &file ); 85 QTextStream tsIn( &file );
86 tsIn.setEncoding( QTextStream::Latin1 ); 86 tsIn.setEncoding( QTextStream::Latin1 );
87 tsIn << text.latin1(); 87 tsIn << text.latin1();
88 file.close(); 88 file.close();
89 return true;
89 90
90 91
91} 92}
92void KApplication::showText(QString caption, QString text) 93void KApplication::showText(QString caption, QString text)
93{ 94{
94 QDialog dia( 0, "name", true ); ; 95 QDialog dia( 0, "name", true ); ;
95 dia.setCaption( caption ); 96 dia.setCaption( caption );
96 QVBoxLayout* lay = new QVBoxLayout( &dia ); 97 QVBoxLayout* lay = new QVBoxLayout( &dia );
97 lay->setSpacing( 3 ); 98 lay->setSpacing( 3 );
98 lay->setMargin( 3 ); 99 lay->setMargin( 3 );
99 KTextEdit tb ( &dia ); 100 KTextEdit tb ( &dia );
100 tb.setWordWrap( QMultiLineEdit::WidgetWidth ); 101 tb.setWordWrap( QMultiLineEdit::WidgetWidth );
101 lay->addWidget( &tb ); 102 lay->addWidget( &tb );
102 tb.setText( text ); 103 tb.setText( text );
103#ifdef DESKTOP_VERSION 104#ifdef DESKTOP_VERSION
104 dia.resize( 640, 480); 105 dia.resize( 640, 480);
105#else 106#else
106 dia.showMaximized(); 107 dia.showMaximized();
107#endif 108#endif
108 dia.exec(); 109 dia.exec();
109 110
110} 111}
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index 1394154..6d0475a 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -403,203 +403,195 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta
403 403
404 404
405//US libfile = instance->dirs()->findResource( "module", libname ); 405//US libfile = instance->dirs()->findResource( "module", libname );
406 //qDebug("libname = %s ",libname.data() ); 406 //qDebug("libname = %s ",libname.data() );
407 libfile = KGlobal::dirs()->findResource( "module", libname ); 407 libfile = KGlobal::dirs()->findResource( "module", libname );
408 //qDebug("libfile = %s ",libfile.latin1() ); 408 //qDebug("libfile = %s ",libfile.latin1() );
409 409
410 if ( libfile.isEmpty() ) 410 if ( libfile.isEmpty() )
411 { 411 {
412//US libfile = instance->dirs()->findResource( "lib", libname ); 412//US libfile = instance->dirs()->findResource( "lib", libname );
413 libfile = KGlobal::dirs()->findResource( "lib", libname ); 413 libfile = KGlobal::dirs()->findResource( "lib", libname );
414 //qDebug("libfile2 = %s ",libfile.latin1() ); 414 //qDebug("libfile2 = %s ",libfile.latin1() );
415#ifndef NDEBUG 415#ifndef NDEBUG
416 if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules 416 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; 417 kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
418#endif 418#endif
419 } 419 }
420 if ( libfile.isEmpty() ) 420 if ( libfile.isEmpty() )
421 { 421 {
422#ifndef NDEBUG 422#ifndef NDEBUG
423 kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; 423 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); 424 self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname);
425 425
426 qDebug("KLibLoader::library could not find library: %s", libname.data()); 426 qDebug("KLibLoader::library could not find library: %s", libname.data());
427#endif 427#endif
428 428
429 } 429 }
430 else 430 else
431 self()->d->errorMessage = QString::null; 431 self()->d->errorMessage = QString::null;
432 } 432 }
433 433
434 //qDebug("return libfile = %s ",libfile.latin1() ); 434 //qDebug("return libfile = %s ",libfile.latin1() );
435 return libfile; 435 return libfile;
436} 436}
437 437
438 438
439KLibrary* KLibLoader::globalLibrary( const char *name ) 439KLibrary* KLibLoader::globalLibrary( const char *name )
440{ 440{
441KLibrary *tmp; 441KLibrary *tmp;
442/*US 442/*US
443int olt_dlopen_flag = lt_dlopen_flag; 443int olt_dlopen_flag = lt_dlopen_flag;
444 444
445 lt_dlopen_flag |= LT_GLOBAL; 445 lt_dlopen_flag |= LT_GLOBAL;
446 kdDebug(150) << "Loading the next library global with flag " 446 kdDebug(150) << "Loading the next library global with flag "
447 << lt_dlopen_flag 447 << lt_dlopen_flag
448 << "." << endl; 448 << "." << endl;
449*/ 449*/
450 tmp = library(name); 450 tmp = library(name);
451/*US 451/*US
452 lt_dlopen_flag = olt_dlopen_flag; 452 lt_dlopen_flag = olt_dlopen_flag;
453*/ 453*/
454return tmp; 454return tmp;
455} 455}
456 456
457 457
458KLibrary* KLibLoader::library( const char *name ) 458KLibrary* KLibLoader::library( const char *name )
459{ 459{
460 if (!name) 460 if (!name)
461 return 0; 461 return 0;
462 462
463 KLibWrapPrivate* wrap = m_libs[name]; 463 KLibWrapPrivate* wrap = m_libs[name];
464 if (wrap) { 464 if (wrap) {
465 /* Nothing to do to load the library. */ 465 /* Nothing to do to load the library. */
466 wrap->ref_count++; 466 wrap->ref_count++;
467 return wrap->lib; 467 return wrap->lib;
468 } 468 }
469 469
470 /* Test if this library was loaded at some time, but got 470 /* Test if this library was loaded at some time, but got
471 unloaded meanwhile, whithout being dlclose()'ed. */ 471 unloaded meanwhile, whithout being dlclose()'ed. */
472 QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack); 472 QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
473 for (; it.current(); ++it) { 473 for (; it.current(); ++it) {
474 if (it.current()->name == name) 474 if (it.current()->name == name)
475 wrap = it.current(); 475 wrap = it.current();
476 } 476 }
477 477
478 if (wrap) { 478 if (wrap) {
479 d->pending_close.removeRef(wrap); 479 d->pending_close.removeRef(wrap);
480 if (!wrap->lib) { 480 if (!wrap->lib) {
481 /* This lib only was in loaded_stack, but not in m_libs. */ 481 /* This lib only was in loaded_stack, but not in m_libs. */
482 wrap->lib = new KLibrary( name, wrap->filename, wrap->handle ); 482 wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
483 } 483 }
484 wrap->ref_count++; 484 wrap->ref_count++;
485 } else { 485 } else {
486 QString libfile = findLibrary( name ); 486 QString libfile = findLibrary( name );
487 if ( libfile.isEmpty() ) 487 if ( libfile.isEmpty() )
488 return 0; 488 return 0;
489#ifdef DESKTOP_VERSION 489#ifdef DESKTOP_VERSION
490 QLibrary *qlib = new QLibrary( libfile.latin1() ); 490 QLibrary *qlib = new QLibrary( libfile.latin1() );
491#else 491#else
492 QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately ); 492 QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately );
493#endif 493#endif
494 494
495//US lt_dlhandle handle = lt_dlopen( libfile.latin1() ); 495//US lt_dlhandle handle = lt_dlopen( libfile.latin1() );
496//US if ( !handle ) 496//US if ( !handle )
497 if ( !qlib ) 497 if ( !qlib )
498 { 498 {
499//US const char* errmsg = lt_dlerror(); 499 qDebug( "KLibLoader::library could not load library: %s", libfile.latin1());
500 char* errmsg; 500 d->errorMessage = QString::null;
501 sprintf(errmsg, "KLibLoader::library could not load library: %s", libfile.latin1()); 501 return 0;
502 qDebug(errmsg);
503
504 if(errmsg)
505 d->errorMessage = QString::fromLatin1(errmsg);
506 else
507 d->errorMessage = QString::null;
508 kdWarning(150) << "library=" << name << ": file=" << libfile << ": " << d->errorMessage << endl;
509 return 0;
510 } 502 }
511 else 503 else
512 d->errorMessage = QString::null; 504 d->errorMessage = QString::null;
513 505
514 KLibrary *lib = new KLibrary( name, libfile, qlib ); 506 KLibrary *lib = new KLibrary( name, libfile, qlib );
515 wrap = new KLibWrapPrivate(lib, qlib); 507 wrap = new KLibWrapPrivate(lib, qlib);
516 d->loaded_stack.prepend(wrap); 508 d->loaded_stack.prepend(wrap);
517 } 509 }
518 m_libs.insert( name, wrap ); 510 m_libs.insert( name, wrap );
519 511
520 connect( wrap->lib, SIGNAL( destroyed() ), 512 connect( wrap->lib, SIGNAL( destroyed() ),
521 this, SLOT( slotLibraryDestroyed() ) ); 513 this, SLOT( slotLibraryDestroyed() ) );
522 514
523 return wrap->lib; 515 return wrap->lib;
524} 516}
525 517
526QString KLibLoader::lastErrorMessage() const 518QString KLibLoader::lastErrorMessage() const
527{ 519{
528 return d->errorMessage; 520 return d->errorMessage;
529} 521}
530 522
531void KLibLoader::unloadLibrary( const char *libname ) 523void KLibLoader::unloadLibrary( const char *libname )
532{ 524{
533 KLibWrapPrivate *wrap = m_libs[ libname ]; 525 KLibWrapPrivate *wrap = m_libs[ libname ];
534 if (!wrap) 526 if (!wrap)
535 return; 527 return;
536 if (--wrap->ref_count) 528 if (--wrap->ref_count)
537 return; 529 return;
538 530
539// kdDebug(150) << "closing library " << libname << endl; 531// kdDebug(150) << "closing library " << libname << endl;
540 532
541 m_libs.remove( libname ); 533 m_libs.remove( libname );
542 534
543 disconnect( wrap->lib, SIGNAL( destroyed() ), 535 disconnect( wrap->lib, SIGNAL( destroyed() ),
544 this, SLOT( slotLibraryDestroyed() ) ); 536 this, SLOT( slotLibraryDestroyed() ) );
545 close_pending( wrap ); 537 close_pending( wrap );
546} 538}
547 539
548KLibFactory* KLibLoader::factory( const char* name ) 540KLibFactory* KLibLoader::factory( const char* name )
549{ 541{
550 KLibrary* lib = library( name ); 542 KLibrary* lib = library( name );
551 if ( !lib ) 543 if ( !lib )
552 return 0; 544 return 0;
553 545
554 return lib->factory(); 546 return lib->factory();
555} 547}
556 548
557void KLibLoader::slotLibraryDestroyed() 549void KLibLoader::slotLibraryDestroyed()
558{ 550{
559 const KLibrary *lib = static_cast<const KLibrary *>( sender() ); 551 const KLibrary *lib = static_cast<const KLibrary *>( sender() );
560 552
561 QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); 553 QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
562 for (; it.current(); ++it ) 554 for (; it.current(); ++it )
563 if ( it.current()->lib == lib ) 555 if ( it.current()->lib == lib )
564 { 556 {
565 KLibWrapPrivate *wrap = it.current(); 557 KLibWrapPrivate *wrap = it.current();
566 wrap->lib = 0; /* the KLibrary object is already away */ 558 wrap->lib = 0; /* the KLibrary object is already away */
567 m_libs.remove( it.currentKey() ); 559 m_libs.remove( it.currentKey() );
568 close_pending( wrap ); 560 close_pending( wrap );
569 return; 561 return;
570 } 562 }
571} 563}
572 564
573void KLibLoader::close_pending(KLibWrapPrivate *wrap) 565void KLibLoader::close_pending(KLibWrapPrivate *wrap)
574{ 566{
575 if (wrap && !d->pending_close.containsRef( wrap )) 567 if (wrap && !d->pending_close.containsRef( wrap ))
576 d->pending_close.append( wrap ); 568 d->pending_close.append( wrap );
577 569
578 /* First delete all KLibrary objects in pending_close, but _don't_ unload 570 /* First delete all KLibrary objects in pending_close, but _don't_ unload
579 the DSO behind it. */ 571 the DSO behind it. */
580 QPtrListIterator<KLibWrapPrivate> it(d->pending_close); 572 QPtrListIterator<KLibWrapPrivate> it(d->pending_close);
581 for (; it.current(); ++it) { 573 for (; it.current(); ++it) {
582 wrap = it.current(); 574 wrap = it.current();
583 if (wrap->lib) { 575 if (wrap->lib) {
584 disconnect( wrap->lib, SIGNAL( destroyed() ), 576 disconnect( wrap->lib, SIGNAL( destroyed() ),
585 this, SLOT( slotLibraryDestroyed() ) ); 577 this, SLOT( slotLibraryDestroyed() ) );
586 delete wrap->lib; 578 delete wrap->lib;
587 wrap->lib = 0; 579 wrap->lib = 0;
588 } 580 }
589 } 581 }
590 582
591 if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return; 583 if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return;
592 584
593 bool deleted_one = false; 585 bool deleted_one = false;
594 while ((wrap = d->loaded_stack.first())) { 586 while ((wrap = d->loaded_stack.first())) {
595 /* Let's first see, if we want to try to unload this lib. 587 /* Let's first see, if we want to try to unload this lib.
596 If the env. var KDE_DOUNLOAD is set, we try to unload every lib. 588 If the env. var KDE_DOUNLOAD is set, we try to unload every lib.
597 If not, we look at the lib itself, and unload it only, if it exports 589 If not, we look at the lib itself, and unload it only, if it exports
598 the symbol __kde_do_unload. */ 590 the symbol __kde_do_unload. */
599 if (d->unload_mode != KLibLoaderPrivate::UNLOAD 591 if (d->unload_mode != KLibLoaderPrivate::UNLOAD
600 && wrap->unload_mode != KLibWrapPrivate::UNLOAD) 592 && wrap->unload_mode != KLibWrapPrivate::UNLOAD)
601 break; 593 break;
602 594
603 /* Now ensure, that the libs are only unloaded in the reverse direction 595 /* Now ensure, that the libs are only unloaded in the reverse direction
604 they were loaded. */ 596 they were loaded. */
605 if (!d->pending_close.containsRef( wrap )) { 597 if (!d->pending_close.containsRef( wrap )) {
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 1ad1728..09ad0c8 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -785,193 +785,193 @@ void KToolBar::setItemAutoSized (int id, bool yes )
785 785
786void KToolBar::clear () 786void KToolBar::clear ()
787{ 787{
788 QToolBar::clear(); 788 QToolBar::clear();
789 widget2id.clear(); 789 widget2id.clear();
790 id2widget.clear(); 790 id2widget.clear();
791} 791}
792 792
793 793
794void KToolBar::removeItem(int id) 794void KToolBar::removeItem(int id)
795{ 795{
796 Id2WidgetMap::Iterator it = id2widget.find( id ); 796 Id2WidgetMap::Iterator it = id2widget.find( id );
797 if ( it == id2widget.end() ) 797 if ( it == id2widget.end() )
798 { 798 {
799 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; 799 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
800 return; 800 return;
801 } 801 }
802 QWidget * w = (*it); 802 QWidget * w = (*it);
803 id2widget.remove( id ); 803 id2widget.remove( id );
804 widget2id.remove( w ); 804 widget2id.remove( w );
805 widgets.removeRef( w ); 805 widgets.removeRef( w );
806 delete w; 806 delete w;
807} 807}
808 808
809 809
810void KToolBar::removeItemDelayed(int id) 810void KToolBar::removeItemDelayed(int id)
811{ 811{
812 Id2WidgetMap::Iterator it = id2widget.find( id ); 812 Id2WidgetMap::Iterator it = id2widget.find( id );
813 if ( it == id2widget.end() ) 813 if ( it == id2widget.end() )
814 { 814 {
815 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl; 815 kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
816 return; 816 return;
817 } 817 }
818 QWidget * w = (*it); 818 QWidget * w = (*it);
819 id2widget.remove( id ); 819 id2widget.remove( id );
820 widget2id.remove( w ); 820 widget2id.remove( w );
821 widgets.removeRef( w ); 821 widgets.removeRef( w );
822 822
823 w->blockSignals(true); 823 w->blockSignals(true);
824 d->idleButtons.append(w); 824 d->idleButtons.append(w);
825 layoutTimer->start( 50, TRUE ); 825 layoutTimer->start( 50, TRUE );
826} 826}
827 827
828 828
829void KToolBar::hideItem (int id) 829void KToolBar::hideItem (int id)
830{ 830{
831 QWidget *w = getWidget(id); 831 QWidget *w = getWidget(id);
832 if ( w ) 832 if ( w )
833 w->hide(); 833 w->hide();
834} 834}
835 835
836 836
837void KToolBar::showItem (int id) 837void KToolBar::showItem (int id)
838{ 838{
839 QWidget *w = getWidget(id); 839 QWidget *w = getWidget(id);
840 if ( w ) 840 if ( w )
841 w->show(); 841 w->show();
842} 842}
843 843
844 844
845int KToolBar::itemIndex (int id) 845int KToolBar::itemIndex (int id)
846{ 846{
847 QWidget *w = getWidget(id); 847 QWidget *w = getWidget(id);
848 return w ? widgets.findRef(w) : -1; 848 return w ? widgets.findRef(w) : -1;
849} 849}
850 850
851 851
852void KToolBar::setFullSize(bool flag ) 852void KToolBar::setFullSize(bool flag )
853{ 853{
854 setHorizontalStretchable( flag ); 854 setHorizontalStretchable( flag );
855 setVerticalStretchable( flag ); 855 setVerticalStretchable( flag );
856} 856}
857 857
858 858
859bool KToolBar::fullSize() const 859bool KToolBar::fullSize() const
860{ 860{
861 return isHorizontalStretchable() || isVerticalStretchable(); 861 return isHorizontalStretchable() || isVerticalStretchable();
862} 862}
863 863
864 864
865void KToolBar::enableMoving(bool flag ) 865void KToolBar::enableMoving(bool flag )
866{ 866{
867//US setMovingEnabled(flag); 867//US setMovingEnabled(flag);
868 this->mainWindow()->setToolBarsMovable(flag); 868 this->mainWindow()->setToolBarsMovable(flag);
869} 869}
870 870
871 871
872void KToolBar::setBarPos (BarPosition bpos) 872void KToolBar::setBarPos (BarPosition bpos)
873{ 873{
874 if ( !mainWindow() ) 874 if ( !mainWindow() )
875 return; 875 return;
876//US mainWindow()->moveDockWindow( this, (Dock)bpos ); 876//US mainWindow()->moveDockWindow( this, (Dock)bpos );
877 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); 877 mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
878} 878}
879 879
880 880
881KToolBar::BarPosition KToolBar::barPos() 881KToolBar::BarPosition KToolBar::barPos() const
882{ 882{
883 if ( !(QMainWindow*)mainWindow() ) 883 if ( !(QMainWindow*)mainWindow() )
884 return KToolBar::Top; 884 return KToolBar::Top;
885//US Dock dock; 885//US Dock dock;
886 QMainWindow::ToolBarDock dock; 886 QMainWindow::ToolBarDock dock;
887 int dm1, dm2; 887 int dm1, dm2;
888 bool dm3; 888 bool dm3;
889 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 ); 889 ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
890//US if ( dock == DockUnmanaged ) { 890//US if ( dock == DockUnmanaged ) {
891 if ( dock == QMainWindow::Unmanaged ) { 891 if ( dock == QMainWindow::Unmanaged ) {
892 return (KToolBar::BarPosition)Top; 892 return (KToolBar::BarPosition)Top;
893 } 893 }
894 return (BarPosition)dock; 894 return (BarPosition)dock;
895} 895}
896 896
897 897
898bool KToolBar::enable(BarStatus stat) 898bool KToolBar::enable(BarStatus stat)
899{ 899{
900 bool mystat = isVisible(); 900 bool mystat = isVisible();
901 901
902 if ( (stat == Toggle && mystat) || stat == Hide ) 902 if ( (stat == Toggle && mystat) || stat == Hide )
903 hide(); 903 hide();
904 else 904 else
905 show(); 905 show();
906 906
907 return isVisible() == mystat; 907 return isVisible() == mystat;
908} 908}
909 909
910 910
911void KToolBar::setMaxHeight ( int h ) 911void KToolBar::setMaxHeight ( int h )
912{ 912{
913 setMaximumHeight( h ); 913 setMaximumHeight( h );
914} 914}
915 915
916int KToolBar::maxHeight() 916int KToolBar::maxHeight()
917{ 917{
918 return maximumHeight(); 918 return maximumHeight();
919} 919}
920 920
921 921
922void KToolBar::setMaxWidth (int dw) 922void KToolBar::setMaxWidth (int dw)
923{ 923{
924 setMaximumWidth( dw ); 924 setMaximumWidth( dw );
925} 925}
926 926
927 927
928int KToolBar::maxWidth() 928int KToolBar::maxWidth()
929{ 929{
930 return maximumWidth(); 930 return maximumWidth();
931} 931}
932 932
933 933
934void KToolBar::setTitle (const QString& _title) 934void KToolBar::setTitle (const QString& _title)
935{ 935{
936 setLabel( _title ); 936 setLabel( _title );
937} 937}
938 938
939 939
940void KToolBar::enableFloating (bool ) 940void KToolBar::enableFloating (bool )
941{ 941{
942} 942}
943 943
944 944
945void KToolBar::setIconText(IconText it) 945void KToolBar::setIconText(IconText it)
946{ 946{
947 setIconText( it, true ); 947 setIconText( it, true );
948} 948}
949 949
950 950
951void KToolBar::setIconText(IconText icontext, bool update) 951void KToolBar::setIconText(IconText icontext, bool update)
952{ 952{
953 bool doUpdate=false; 953 bool doUpdate=false;
954 954
955 if (icontext != d->m_iconText) { 955 if (icontext != d->m_iconText) {
956 d->m_iconText = icontext; 956 d->m_iconText = icontext;
957 doUpdate=true; 957 doUpdate=true;
958 } 958 }
959 959
960 if (update == false) 960 if (update == false)
961 return; 961 return;
962 962
963 if (doUpdate) 963 if (doUpdate)
964 emit modechange(); // tell buttons what happened 964 emit modechange(); // tell buttons what happened
965 965
966 // ugly hack to force a QMainWindow::triggerLayout( TRUE ) 966 // ugly hack to force a QMainWindow::triggerLayout( TRUE )
967 if ( mainWindow() ) { 967 if ( mainWindow() ) {
968 QMainWindow *mw = mainWindow(); 968 QMainWindow *mw = mainWindow();
969 mw->setUpdatesEnabled( FALSE ); 969 mw->setUpdatesEnabled( FALSE );
970 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 970 mw->setToolBarsMovable( !mw->toolBarsMovable() );
971 mw->setToolBarsMovable( !mw->toolBarsMovable() ); 971 mw->setToolBarsMovable( !mw->toolBarsMovable() );
972 mw->setUpdatesEnabled( TRUE ); 972 mw->setUpdatesEnabled( TRUE );
973 } 973 }
974} 974}
975 975
976 976
977KToolBar::IconText KToolBar::iconText() const 977KToolBar::IconText KToolBar::iconText() const
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 61b5ea3..49ff856 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -653,193 +653,193 @@ public:
653 * you will probably have to call QToolBar::updateRects(true) 653 * you will probably have to call QToolBar::updateRects(true)
654 * @see QWidget 654 * @see QWidget
655 * @see updateRects() 655 * @see updateRects()
656 * 656 *
657 * KDE4: make this const! 657 * KDE4: make this const!
658 */ 658 */
659 QWidget *getWidget (int id); 659 QWidget *getWidget (int id);
660 660
661 /** 661 /**
662 * Set item autosized. 662 * Set item autosized.
663 * 663 *
664 * This works only if the toolbar is set to full width. 664 * This works only if the toolbar is set to full width.
665 * Only @p one item can be autosized, and it has to be 665 * Only @p one item can be autosized, and it has to be
666 * the last left-aligned item. Items that come after this must be right 666 * the last left-aligned item. Items that come after this must be right
667 * aligned. Items that can be right aligned are Lineds, Frames, Widgets and 667 * aligned. Items that can be right aligned are Lineds, Frames, Widgets and
668 * Combos. An autosized item will resize itself whenever the toolbar geometry 668 * Combos. An autosized item will resize itself whenever the toolbar geometry
669 * changes to the last right-aligned item (or to end of toolbar if there 669 * changes to the last right-aligned item (or to end of toolbar if there
670 * are no right-aligned items.) 670 * are no right-aligned items.)
671 * @see setFullWidth() 671 * @see setFullWidth()
672 * @see alignItemRight() 672 * @see alignItemRight()
673 */ 673 */
674 void setItemAutoSized (int id, bool yes = true); 674 void setItemAutoSized (int id, bool yes = true);
675 675
676 /** 676 /**
677 * Remove all items. 677 * Remove all items.
678 * 678 *
679 * The toolbar is redrawn after it. 679 * The toolbar is redrawn after it.
680 */ 680 */
681 void clear (); 681 void clear ();
682 682
683 /** 683 /**
684 * Remove item @p id. 684 * Remove item @p id.
685 * 685 *
686 * Item is deleted. Toolbar is redrawn after it. 686 * Item is deleted. Toolbar is redrawn after it.
687 */ 687 */
688 void removeItem (int id); 688 void removeItem (int id);
689 689
690 /** 690 /**
691 * Remove item @p id. 691 * Remove item @p id.
692 * 692 *
693 * Item is deleted when toolbar is redrawn. 693 * Item is deleted when toolbar is redrawn.
694 */ 694 */
695 void removeItemDelayed (int id); 695 void removeItemDelayed (int id);
696 696
697 /** 697 /**
698 * Hide item. 698 * Hide item.
699 */ 699 */
700 void hideItem (int id); 700 void hideItem (int id);
701 701
702 /** 702 /**
703 * Show item. 703 * Show item.
704 */ 704 */
705 void showItem (int id); 705 void showItem (int id);
706 706
707 /** 707 /**
708 * Returns the index of the given item. 708 * Returns the index of the given item.
709 * 709 *
710 * KDE4: make this const! 710 * KDE4: make this const!
711 */ 711 */
712 int itemIndex (int id); 712 int itemIndex (int id);
713 713
714 /** 714 /**
715 * Set toolbar to full parent size (default). 715 * Set toolbar to full parent size (default).
716 * 716 *
717 * In full size mode the bar 717 * In full size mode the bar
718 * extends over the parent's full width or height. If the mode is disabled 718 * extends over the parent's full width or height. If the mode is disabled
719 * the toolbar tries to take as much space as it needs without wrapping, but 719 * the toolbar tries to take as much space as it needs without wrapping, but
720 * it does not exceed the parent box. You can force a certain width or 720 * it does not exceed the parent box. You can force a certain width or
721 * height with @ref setMaxWidth() or @ref setMaxHeight(). 721 * height with @ref setMaxWidth() or @ref setMaxHeight().
722 * 722 *
723 * If you want to use right-aligned items or auto-sized items you must use 723 * If you want to use right-aligned items or auto-sized items you must use
724 * full size mode. 724 * full size mode.
725 */ 725 */
726 void setFullSize(bool flag = true); 726 void setFullSize(bool flag = true);
727 727
728 /** 728 /**
729 * @return @p true if the full-size mode is enabled. Otherwise 729 * @return @p true if the full-size mode is enabled. Otherwise
730 * it returns @false. 730 * it returns @false.
731 */ 731 */
732 bool fullSize() const; 732 bool fullSize() const;
733 733
734 /** 734 /**
735 * @deprecated use setMovingEnabled(bool) instead. 735 * @deprecated use setMovingEnabled(bool) instead.
736 * Enable or disable moving of toolbar. 736 * Enable or disable moving of toolbar.
737 */ 737 */
738 void enableMoving(bool flag = true); 738 void enableMoving(bool flag = true);
739 739
740 /** 740 /**
741 * Set position of toolbar. 741 * Set position of toolbar.
742 * @see BarPosition() 742 * @see BarPosition()
743 */ 743 */
744 void setBarPos (BarPosition bpos); 744 void setBarPos (BarPosition bpos);
745 745
746 /** 746 /**
747 * Returns position of toolbar. 747 * Returns position of toolbar.
748 */ 748 */
749 BarPosition barPos(); 749 BarPosition barPos() const;
750 750
751 /** 751 /**
752 * @deprecated 752 * @deprecated
753 * Show, hide, or toggle toolbar. 753 * Show, hide, or toggle toolbar.
754 * 754 *
755 * This method is provided for compatibility only, 755 * This method is provided for compatibility only,
756 * please use show() and/or hide() instead. 756 * please use show() and/or hide() instead.
757 * @see BarStatus 757 * @see BarStatus
758 */ 758 */
759 bool enable(BarStatus stat); 759 bool enable(BarStatus stat);
760 760
761 /** 761 /**
762 * @deprecated 762 * @deprecated
763 * Use setMaximumHeight() instead. 763 * Use setMaximumHeight() instead.
764 */ 764 */
765 void setMaxHeight (int h); // Set max height for vertical toolbars 765 void setMaxHeight (int h); // Set max height for vertical toolbars
766 766
767 /** 767 /**
768 * @deprecated 768 * @deprecated
769 * Use maximumHeight() instead. 769 * Use maximumHeight() instead.
770 * Returns the value that was set with @ref setMaxHeight(). 770 * Returns the value that was set with @ref setMaxHeight().
771 */ 771 */
772 int maxHeight(); 772 int maxHeight();
773 773
774 /** 774 /**
775 * @deprecated 775 * @deprecated
776 * Use setMaximumWidth() instead. 776 * Use setMaximumWidth() instead.
777 * Set maximal width of horizontal (top or bottom) toolbar. 777 * Set maximal width of horizontal (top or bottom) toolbar.
778 */ 778 */
779 void setMaxWidth (int dw); 779 void setMaxWidth (int dw);
780 780
781 /** 781 /**
782 * @deprecated 782 * @deprecated
783 * Use maximumWidth() instead. 783 * Use maximumWidth() instead.
784 * Returns the value that was set with @ref setMaxWidth(). 784 * Returns the value that was set with @ref setMaxWidth().
785 */ 785 */
786 int maxWidth(); 786 int maxWidth();
787 787
788 /** 788 /**
789 * Set title for toolbar when it floats. 789 * Set title for toolbar when it floats.
790 * 790 *
791 * Titles are however not (yet) 791 * Titles are however not (yet)
792 * visible. You can't change toolbar's title while it's floating. 792 * visible. You can't change toolbar's title while it's floating.
793 */ 793 */
794 void setTitle (const QString& _title); 794 void setTitle (const QString& _title);
795 795
796 /** 796 /**
797 * @deprecated 797 * @deprecated
798 * Use enableMoving() instead. 798 * Use enableMoving() instead.
799 */ 799 */
800 void enableFloating (bool arrrrrrgh); 800 void enableFloating (bool arrrrrrgh);
801 801
802 /** 802 /**
803 * Set the kind of painting for buttons. 803 * Set the kind of painting for buttons.
804 * 804 *
805 * Choose from: 805 * Choose from:
806 * @li IconOnly (only icons), 806 * @li IconOnly (only icons),
807 * @li IconTextRight (icon and text, text is left from icons), 807 * @li IconTextRight (icon and text, text is left from icons),
808 * @li TextOnly (only text), 808 * @li TextOnly (only text),
809 * @li IconTextBottom (icons and text, text is under icons). 809 * @li IconTextBottom (icons and text, text is under icons).
810 * @see IconText 810 * @see IconText
811 * 811 *
812 */ 812 */
813 void setIconText(IconText it); 813 void setIconText(IconText it);
814 // Note: don't merge with the next one, it breaks Qt properties 814 // Note: don't merge with the next one, it breaks Qt properties
815 815
816 /** 816 /**
817 * Similar to @ref setIconText(IconText it) but allows you to 817 * Similar to @ref setIconText(IconText it) but allows you to
818 * disable or enable updating. If @p update is false, then the 818 * disable or enable updating. If @p update is false, then the
819 * buttons will not be updated. This is useful only if you know 819 * buttons will not be updated. This is useful only if you know
820 * that you will be forcing an update later. 820 * that you will be forcing an update later.
821 */ 821 */
822 void setIconText(IconText it, bool update); 822 void setIconText(IconText it, bool update);
823 823
824 /** 824 /**
825 * @return The current text style for buttons. 825 * @return The current text style for buttons.
826 */ 826 */
827 IconText iconText() const; 827 IconText iconText() const;
828 828
829 /** 829 /**
830 * Set the icon size to load. Usually you should not call 830 * Set the icon size to load. Usually you should not call
831 * this, the icon size is taken care of by KIconLoader 831 * this, the icon size is taken care of by KIconLoader
832 * and globally configured. 832 * and globally configured.
833 * By default, the toolbar will load icons of size 32 for main 833 * By default, the toolbar will load icons of size 32 for main
834 * toolbars and 22 for other toolbars 834 * toolbars and 22 for other toolbars
835 * @see KIconLoader. 835 * @see KIconLoader.
836 * 836 *
837 * @param size The size to use 837 * @param size The size to use
838 */ 838 */
839 void setIconSize(int size); 839 void setIconSize(int size);
840 // Note: don't merge with the next one, it breaks Qt properties 840 // Note: don't merge with the next one, it breaks Qt properties
841 841
842 /** 842 /**
843 * Same as @ref setIconText(int size) but allows you 843 * Same as @ref setIconText(int size) but allows you
844 * to disable the toolbar update. 844 * to disable the toolbar update.
845 * 845 *