summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp6
-rw-r--r--microkde/kapplication.cpp4
-rw-r--r--microkde/kdeui/ktoolbar.cpp14
-rw-r--r--microkde/kdeui/ktoolbar.h4
4 files changed, 23 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4e2523e..033e537 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -723,304 +723,308 @@ void KABCore::setContactSelected( const QString &uid )
723 } 723 }
724 724
725 emit contactSelected( px ); 725 emit contactSelected( px );
726 } 726 }
727 } 727 }
728 728
729 729
730 mExtensionManager->setSelectionChanged(); 730 mExtensionManager->setSelectionChanged();
731 731
732 // update the actions 732 // update the actions
733 bool selected = !uid.isEmpty(); 733 bool selected = !uid.isEmpty();
734 734
735 if ( mReadWrite ) { 735 if ( mReadWrite ) {
736 mActionCut->setEnabled( selected ); 736 mActionCut->setEnabled( selected );
737 mActionPaste->setEnabled( selected ); 737 mActionPaste->setEnabled( selected );
738 } 738 }
739 739
740 mActionCopy->setEnabled( selected ); 740 mActionCopy->setEnabled( selected );
741 mActionDelete->setEnabled( selected ); 741 mActionDelete->setEnabled( selected );
742 mActionEditAddressee->setEnabled( selected ); 742 mActionEditAddressee->setEnabled( selected );
743 mActionMail->setEnabled( selected ); 743 mActionMail->setEnabled( selected );
744 mActionMailVCard->setEnabled( selected ); 744 mActionMailVCard->setEnabled( selected );
745 //if (mActionBeam) 745 //if (mActionBeam)
746 //mActionBeam->setEnabled( selected ); 746 //mActionBeam->setEnabled( selected );
747 mActionWhoAmI->setEnabled( selected ); 747 mActionWhoAmI->setEnabled( selected );
748} 748}
749 749
750void KABCore::sendMail() 750void KABCore::sendMail()
751{ 751{
752 sendMail( mViewManager->selectedEmails().join( ", " ) ); 752 sendMail( mViewManager->selectedEmails().join( ", " ) );
753} 753}
754 754
755void KABCore::sendMail( const QString& emaillist ) 755void KABCore::sendMail( const QString& emaillist )
756{ 756{
757 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 757 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
758 if (emaillist.contains(",") > 0) 758 if (emaillist.contains(",") > 0)
759 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 759 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
760 else 760 else
761 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 761 ExternalAppHandler::instance()->mailToOneContact( emaillist );
762} 762}
763 763
764 764
765 765
766void KABCore::mailVCard() 766void KABCore::mailVCard()
767{ 767{
768 QStringList uids = mViewManager->selectedUids(); 768 QStringList uids = mViewManager->selectedUids();
769 if ( !uids.isEmpty() ) 769 if ( !uids.isEmpty() )
770 mailVCard( uids ); 770 mailVCard( uids );
771} 771}
772 772
773void KABCore::mailVCard( const QStringList& uids ) 773void KABCore::mailVCard( const QStringList& uids )
774{ 774{
775 QStringList urls; 775 QStringList urls;
776 776
777// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 777// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
778 778
779 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 779 QString dirName = "/tmp/" + KApplication::randomString( 8 );
780 780
781 781
782 782
783 QDir().mkdir( dirName, true ); 783 QDir().mkdir( dirName, true );
784 784
785 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 785 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
786 KABC::Addressee a = mAddressBook->findByUid( *it ); 786 KABC::Addressee a = mAddressBook->findByUid( *it );
787 787
788 if ( a.isEmpty() ) 788 if ( a.isEmpty() )
789 continue; 789 continue;
790 790
791 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 791 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
792 792
793 QString fileName = dirName + "/" + name; 793 QString fileName = dirName + "/" + name;
794 794
795 QFile outFile(fileName); 795 QFile outFile(fileName);
796 796
797 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 797 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
798 KABC::VCardConverter converter; 798 KABC::VCardConverter converter;
799 QString vcard; 799 QString vcard;
800 800
801 converter.addresseeToVCard( a, vcard ); 801 converter.addresseeToVCard( a, vcard );
802 802
803 QTextStream t( &outFile ); // use a text stream 803 QTextStream t( &outFile ); // use a text stream
804 t.setEncoding( QTextStream::UnicodeUTF8 ); 804 t.setEncoding( QTextStream::UnicodeUTF8 );
805 t << vcard; 805 t << vcard;
806 806
807 outFile.close(); 807 outFile.close();
808 808
809 urls.append( fileName ); 809 urls.append( fileName );
810 } 810 }
811 } 811 }
812 812
813 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 813 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
814 814
815 815
816/*US 816/*US
817 kapp->invokeMailer( QString::null, QString::null, QString::null, 817 kapp->invokeMailer( QString::null, QString::null, QString::null,
818 QString::null, // subject 818 QString::null, // subject
819 QString::null, // body 819 QString::null, // body
820 QString::null, 820 QString::null,
821 urls ); // attachments 821 urls ); // attachments
822*/ 822*/
823 823
824} 824}
825 825
826/** 826/**
827 Beams the "WhoAmI contact. 827 Beams the "WhoAmI contact.
828*/ 828*/
829void KABCore::beamMySelf() 829void KABCore::beamMySelf()
830{ 830{
831 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 831 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
832 if (!a.isEmpty()) 832 if (!a.isEmpty())
833 { 833 {
834 QStringList uids; 834 QStringList uids;
835 uids << a.uid(); 835 uids << a.uid();
836 836
837 beamVCard(uids); 837 beamVCard(uids);
838 } else { 838 } else {
839 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 839 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
840 840
841 841
842 } 842 }
843} 843}
844void KABCore::updateMainWindow() 844void KABCore::updateMainWindow()
845{ 845{
846 mMainWindow->showMaximized(); 846 mMainWindow->showMaximized();
847 //mMainWindow->repaint(); 847 //mMainWindow->repaint();
848} 848}
849void KABCore::resizeEvent(QResizeEvent* e ) 849void KABCore::resizeEvent(QResizeEvent* e )
850{ 850{
851 if ( !mMiniSplitter ) 851 if ( !mMiniSplitter ) {
852 QWidget::resizeEvent( e );
852 return; 853 return;
854 }
855#ifndef DESKTOP_VERSION
853 static int desktop_width = 0; 856 static int desktop_width = 0;
854 //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); 857 //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() );
855 if ( desktop_width != QApplication::desktop()->width() ) 858 if ( desktop_width != QApplication::desktop()->width() )
856 if ( QApplication::desktop()->width() >= 480 ) { 859 if ( QApplication::desktop()->width() >= 480 ) {
857 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 860 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
858 //qDebug("640 "); 861 //qDebug("640 ");
859 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 862 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
860 //qDebug("switch V->H "); 863 //qDebug("switch V->H ");
861 mMiniSplitter->setOrientation( Qt::Horizontal); 864 mMiniSplitter->setOrientation( Qt::Horizontal);
862 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 865 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
863 } 866 }
864 if ( QApplication::desktop()->width() <= 640 ) { 867 if ( QApplication::desktop()->width() <= 640 ) {
865 bool shot = mMainWindow->isVisible(); 868 bool shot = mMainWindow->isVisible();
866 mMainWindow->showMinimized(); 869 mMainWindow->showMinimized();
867 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 870 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
868 mViewManager->getFilterAction()->setComboWidth( 150 ); 871 mViewManager->getFilterAction()->setComboWidth( 150 );
869 if ( mIncSearchWidget ) 872 if ( mIncSearchWidget )
870 mIncSearchWidget->setSize(); 873 mIncSearchWidget->setSize();
871 if ( shot ) 874 if ( shot )
872 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 875 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
873 } 876 }
874 877
875 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 878 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
876 //qDebug("480 "); 879 //qDebug("480 ");
877 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 880 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
878 //qDebug("switch H->V "); 881 //qDebug("switch H->V ");
879 mMiniSplitter->setOrientation( Qt::Vertical ); 882 mMiniSplitter->setOrientation( Qt::Vertical );
880 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 883 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
881 } 884 }
882 if ( QApplication::desktop()->width() <= 640 ) { 885 if ( QApplication::desktop()->width() <= 640 ) {
883 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 886 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
884 bool shot = mMainWindow->isVisible(); 887 bool shot = mMainWindow->isVisible();
885 mMainWindow->showMinimized(); 888 mMainWindow->showMinimized();
886 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 889 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
887 if ( mIncSearchWidget ) { 890 if ( mIncSearchWidget ) {
888 mIncSearchWidget->setSize(); 891 mIncSearchWidget->setSize();
889 } 892 }
890 } else { 893 } else {
891 mViewManager->getFilterAction()->setComboWidth( 0 ); 894 mViewManager->getFilterAction()->setComboWidth( 0 );
892 } 895 }
893 if ( shot ) 896 if ( shot )
894 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 897 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
895 } 898 }
896 } 899 }
897 } 900 }
898 desktop_width = QApplication::desktop()->width(); 901 desktop_width = QApplication::desktop()->width();
902#endif
899 QWidget::resizeEvent( e ); 903 QWidget::resizeEvent( e );
900 904
901} 905}
902void KABCore::export2phone() 906void KABCore::export2phone()
903{ 907{
904 908
905 QStringList uids; 909 QStringList uids;
906 XXPortSelectDialog dlg( this, false, this ); 910 XXPortSelectDialog dlg( this, false, this );
907 if ( dlg.exec() ) 911 if ( dlg.exec() )
908 uids = dlg.uids(); 912 uids = dlg.uids();
909 else 913 else
910 return; 914 return;
911 if ( uids.isEmpty() ) 915 if ( uids.isEmpty() )
912 return; 916 return;
913 // qDebug("count %d ", uids.count()); 917 // qDebug("count %d ", uids.count());
914 918
915 KAex2phonePrefs ex2phone; 919 KAex2phonePrefs ex2phone;
916 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 920 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
917 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 921 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
918 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 922 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
919 923
920 if ( !ex2phone.exec() ) { 924 if ( !ex2phone.exec() ) {
921 return; 925 return;
922 } 926 }
923 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 927 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
924 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 928 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
925 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 929 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
926 930
927 931
928 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 932 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
929 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 933 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
930 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 934 KPimGlobalPrefs::instance()->mEx2PhoneModel );
931 935
932 QString fileName = getPhoneFile(); 936 QString fileName = getPhoneFile();
933 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 937 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
934 return; 938 return;
935 939
936 message(i18n("Exporting to phone...")); 940 message(i18n("Exporting to phone..."));
937 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 941 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
938 942
939} 943}
940QString KABCore::getPhoneFile() 944QString KABCore::getPhoneFile()
941{ 945{
942#ifdef DESKTOP_VERSION 946#ifdef DESKTOP_VERSION
943 return locateLocal("tmp", "phonefile.vcf"); 947 return locateLocal("tmp", "phonefile.vcf");
944#else 948#else
945 return "/tmp/phonefile.vcf"; 949 return "/tmp/phonefile.vcf";
946#endif 950#endif
947 951
948} 952}
949void KABCore::writeToPhone( ) 953void KABCore::writeToPhone( )
950{ 954{
951 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 955 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
952 message(i18n("Export to phone finished!")); 956 message(i18n("Export to phone finished!"));
953 else 957 else
954 qDebug(i18n("KA: Error exporting to phone")); 958 qDebug(i18n("KA: Error exporting to phone"));
955} 959}
956void KABCore::beamVCard() 960void KABCore::beamVCard()
957{ 961{
958 QStringList uids; 962 QStringList uids;
959 XXPortSelectDialog dlg( this, false, this ); 963 XXPortSelectDialog dlg( this, false, this );
960 if ( dlg.exec() ) 964 if ( dlg.exec() )
961 uids = dlg.uids(); 965 uids = dlg.uids();
962 else 966 else
963 return; 967 return;
964 if ( uids.isEmpty() ) 968 if ( uids.isEmpty() )
965 return; 969 return;
966 beamVCard( uids ); 970 beamVCard( uids );
967} 971}
968 972
969 973
970void KABCore::beamVCard(const QStringList& uids) 974void KABCore::beamVCard(const QStringList& uids)
971{ 975{
972 976
973 // LR: we should use the /tmp dir on the Zaurus, 977 // LR: we should use the /tmp dir on the Zaurus,
974 // because: /tmp = RAM, (HOME)/kdepim = flash memory 978 // because: /tmp = RAM, (HOME)/kdepim = flash memory
975 979
976#ifdef DESKTOP_VERSION 980#ifdef DESKTOP_VERSION
977 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 981 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
978#else 982#else
979 QString fileName = "/tmp/kapibeamfile.vcf"; 983 QString fileName = "/tmp/kapibeamfile.vcf";
980#endif 984#endif
981 985
982 KABC::VCardConverter converter; 986 KABC::VCardConverter converter;
983 QString description; 987 QString description;
984 QString datastream; 988 QString datastream;
985 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 989 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
986 KABC::Addressee a = mAddressBook->findByUid( *it ); 990 KABC::Addressee a = mAddressBook->findByUid( *it );
987 991
988 if ( a.isEmpty() ) 992 if ( a.isEmpty() )
989 continue; 993 continue;
990 994
991 if (description.isEmpty()) 995 if (description.isEmpty())
992 description = a.formattedName(); 996 description = a.formattedName();
993 997
994 QString vcard; 998 QString vcard;
995 converter.addresseeToVCard( a, vcard ); 999 converter.addresseeToVCard( a, vcard );
996 int start = 0; 1000 int start = 0;
997 int next; 1001 int next;
998 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 1002 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
999 int semi = vcard.find(";", next); 1003 int semi = vcard.find(";", next);
1000 int dopp = vcard.find(":", next); 1004 int dopp = vcard.find(":", next);
1001 int sep; 1005 int sep;
1002 if ( semi < dopp && semi >= 0 ) 1006 if ( semi < dopp && semi >= 0 )
1003 sep = semi ; 1007 sep = semi ;
1004 else 1008 else
1005 sep = dopp; 1009 sep = dopp;
1006 datastream +=vcard.mid( start, next - start); 1010 datastream +=vcard.mid( start, next - start);
1007 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 1011 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
1008 start = sep; 1012 start = sep;
1009 } 1013 }
1010 datastream += vcard.mid( start,vcard.length() ); 1014 datastream += vcard.mid( start,vcard.length() );
1011 } 1015 }
1012#ifndef DESKTOP_VERSION 1016#ifndef DESKTOP_VERSION
1013 QFile outFile(fileName); 1017 QFile outFile(fileName);
1014 if ( outFile.open(IO_WriteOnly) ) { 1018 if ( outFile.open(IO_WriteOnly) ) {
1015 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 1019 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
1016 QTextStream t( &outFile ); // use a text stream 1020 QTextStream t( &outFile ); // use a text stream
1017 //t.setEncoding( QTextStream::UnicodeUTF8 ); 1021 //t.setEncoding( QTextStream::UnicodeUTF8 );
1018 t.setEncoding( QTextStream::Latin1 ); 1022 t.setEncoding( QTextStream::Latin1 );
1019 t <<datastream.latin1(); 1023 t <<datastream.latin1();
1020 outFile.close(); 1024 outFile.close();
1021 Ir *ir = new Ir( this ); 1025 Ir *ir = new Ir( this );
1022 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 1026 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
1023 ir->send( fileName, description, "text/x-vCard" ); 1027 ir->send( fileName, description, "text/x-vCard" );
1024 } else { 1028 } else {
1025 qDebug("KA: Error open temp beam file "); 1029 qDebug("KA: Error open temp beam file ");
1026 return; 1030 return;
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index f36c5ae..d7c12bb 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -1,188 +1,190 @@
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#include <qregexp.h> 13#include <qregexp.h>
14 14
15int KApplication::random() 15int KApplication::random()
16{ 16{
17 return rand(); 17 return rand();
18} 18}
19 19
20//US 20//US
21QString KApplication::randomString(int length) 21QString KApplication::randomString(int length)
22{ 22{
23 if (length <=0 ) return QString::null; 23 if (length <=0 ) return QString::null;
24 24
25 QString str; 25 QString str;
26 while (length--) 26 while (length--)
27 { 27 {
28 int r=random() % 62; 28 int r=random() % 62;
29 r+=48; 29 r+=48;
30 if (r>57) r+=7; 30 if (r>57) r+=7;
31 if (r>90) r+=6; 31 if (r>90) r+=6;
32 str += char(r); 32 str += char(r);
33 // so what if I work backwards? 33 // so what if I work backwards?
34 } 34 }
35 return str; 35 return str;
36} 36}
37int KApplication::execDialog( QDialog* d ) 37int KApplication::execDialog( QDialog* d )
38{ 38{
39 if (QApplication::desktop()->width() <= 640 ) 39 if (QApplication::desktop()->width() <= 640 )
40 d->showMaximized(); 40 d->showMaximized();
41 else 41 else
42 ;//d->resize( 800, 600 ); 42 ;//d->resize( 800, 600 );
43 return d->exec(); 43 return d->exec();
44} 44}
45void KApplication::showLicence() 45void KApplication::showLicence()
46{ 46{
47 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" ); 47 KApplication::showFile( "KDE-Pim/Pi licence", "kdepim/licence.txt" );
48} 48}
49 49
50void KApplication::testCoords( int* x, int* y, int* wid, int * hei ) 50void KApplication::testCoords( int* x, int* y, int* wid, int * hei )
51{ 51{
52 int dWid = QApplication::desktop()->width() ; 52 int dWid = QApplication::desktop()->width() ;
53 int dHei = QApplication::desktop()->height(); 53 int dHei = QApplication::desktop()->height();
54 if ( *x < 0 ) *x = 0;
55 if ( *y < 20 ) *y = 20 ;
54 if ( *x + *wid > dWid ) { 56 if ( *x + *wid > dWid ) {
55 *x = 0; 57 *x = 0;
56 if ( *wid > dWid ) 58 if ( *wid > dWid )
57 *wid = dWid; 59 *wid = dWid;
58 } 60 }
59 if ( *y + *hei > dHei ) { 61 if ( *y + *hei > dHei ) {
60 *y = 0; 62 *y = 20;
61 if ( *hei > dHei ) 63 if ( *hei > dHei )
62 *hei = dHei; 64 *hei = dHei;
63 } 65 }
64} 66}
65void KApplication::showFile(QString caption, QString fn) 67void KApplication::showFile(QString caption, QString fn)
66{ 68{
67 QString text; 69 QString text;
68 QString fileName; 70 QString fileName;
69#ifndef DESKTOP_VERSION 71#ifndef DESKTOP_VERSION
70 fileName = getenv("QPEDIR"); 72 fileName = getenv("QPEDIR");
71 fileName += "/pics/" + fn ; 73 fileName += "/pics/" + fn ;
72#else 74#else
73 fileName = qApp->applicationDirPath () + "/" + fn; 75 fileName = qApp->applicationDirPath () + "/" + fn;
74#endif 76#endif
75 QFile file( fileName ); 77 QFile file( fileName );
76 if (!file.open( IO_ReadOnly ) ) { 78 if (!file.open( IO_ReadOnly ) ) {
77 return ; 79 return ;
78 } 80 }
79 QTextStream ts( &file ); 81 QTextStream ts( &file );
80 text = ts.read(); 82 text = ts.read();
81 file.close(); 83 file.close();
82 KApplication::showText( caption, text ); 84 KApplication::showText( caption, text );
83 85
84} 86}
85 87
86bool KApplication::convert2latin1(QString fileName) 88bool KApplication::convert2latin1(QString fileName)
87{ 89{
88 QString text; 90 QString text;
89 QFile file( fileName ); 91 QFile file( fileName );
90 if (!file.open( IO_ReadOnly ) ) { 92 if (!file.open( IO_ReadOnly ) ) {
91 return false; 93 return false;
92 94
93 } 95 }
94 QTextStream ts( &file ); 96 QTextStream ts( &file );
95 ts.setEncoding( QTextStream::UnicodeUTF8 ); 97 ts.setEncoding( QTextStream::UnicodeUTF8 );
96 text = ts.read(); 98 text = ts.read();
97 file.close(); 99 file.close();
98 if (!file.open( IO_WriteOnly ) ) { 100 if (!file.open( IO_WriteOnly ) ) {
99 return false; 101 return false;
100 } 102 }
101 QTextStream tsIn( &file ); 103 QTextStream tsIn( &file );
102 tsIn.setEncoding( QTextStream::Latin1 ); 104 tsIn.setEncoding( QTextStream::Latin1 );
103 tsIn << text.latin1(); 105 tsIn << text.latin1();
104 file.close(); 106 file.close();
105 return true; 107 return true;
106 108
107 109
108} 110}
109void KApplication::showText(QString caption, QString text) 111void KApplication::showText(QString caption, QString text)
110{ 112{
111 QDialog dia( 0, "name", true ); ; 113 QDialog dia( 0, "name", true ); ;
112 dia.setCaption( caption ); 114 dia.setCaption( caption );
113 QVBoxLayout* lay = new QVBoxLayout( &dia ); 115 QVBoxLayout* lay = new QVBoxLayout( &dia );
114 lay->setSpacing( 3 ); 116 lay->setSpacing( 3 );
115 lay->setMargin( 3 ); 117 lay->setMargin( 3 );
116 KTextEdit tb ( &dia ); 118 KTextEdit tb ( &dia );
117 tb.setWordWrap( QMultiLineEdit::WidgetWidth ); 119 tb.setWordWrap( QMultiLineEdit::WidgetWidth );
118 lay->addWidget( &tb ); 120 lay->addWidget( &tb );
119 tb.setText( text ); 121 tb.setText( text );
120#ifdef DESKTOP_VERSION 122#ifdef DESKTOP_VERSION
121 dia.resize( 640, 480); 123 dia.resize( 640, 480);
122#else 124#else
123 dia.showMaximized(); 125 dia.showMaximized();
124#endif 126#endif
125 dia.exec(); 127 dia.exec();
126 128
127} 129}
128 130
129#include <qlabel.h> 131#include <qlabel.h>
130#include <qpushbutton.h> 132#include <qpushbutton.h>
131#include <qlayout.h> 133#include <qlayout.h>
132#include <qdir.h> 134#include <qdir.h>
133#include <qradiobutton.h> 135#include <qradiobutton.h>
134#include <qbuttongroup.h> 136#include <qbuttongroup.h>
135#include "kglobal.h" 137#include "kglobal.h"
136#include "klocale.h" 138#include "klocale.h"
137 139
138class KBackupPrefs : public QDialog 140class KBackupPrefs : public QDialog
139{ 141{
140 public: 142 public:
141 KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) : 143 KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) :
142 QDialog( parent, name, true ) 144 QDialog( parent, name, true )
143 { 145 {
144 setCaption( i18n("Backup Failed!") ); 146 setCaption( i18n("Backup Failed!") );
145 QVBoxLayout* lay = new QVBoxLayout( this ); 147 QVBoxLayout* lay = new QVBoxLayout( this );
146 lay->setSpacing( 3 ); 148 lay->setSpacing( 3 );
147 lay->setMargin( 3 ); 149 lay->setMargin( 3 );
148 QLabel * lab = new QLabel( message, this ); 150 QLabel * lab = new QLabel( message, this );
149 lay->addWidget( lab ); 151 lay->addWidget( lab );
150 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this ); 152 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this );
151 lay->addWidget( format ); 153 lay->addWidget( format );
152 format->setExclusive ( true ) ; 154 format->setExclusive ( true ) ;
153 vcal = new QRadioButton(i18n("Try again now"), format ); 155 vcal = new QRadioButton(i18n("Try again now"), format );
154 tcal = new QRadioButton(i18n("Try again later"), format ); 156 tcal = new QRadioButton(i18n("Try again later"), format );
155 ical = new QRadioButton(i18n("Try again tomorrow"), format ); 157 ical = new QRadioButton(i18n("Try again tomorrow"), format );
156 ocal = new QRadioButton(i18n("Disable backup"), format ); 158 ocal = new QRadioButton(i18n("Disable backup"), format );
157 vcal->setChecked( true ); 159 vcal->setChecked( true );
158 QPushButton * ok = new QPushButton( i18n("OK"), this ); 160 QPushButton * ok = new QPushButton( i18n("OK"), this );
159 lay->addWidget(ok ); 161 lay->addWidget(ok );
160 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 162 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
161 } 163 }
162 164
163 bool again() { return vcal->isChecked(); } 165 bool again() { return vcal->isChecked(); }
164 bool later() { return tcal->isChecked(); } 166 bool later() { return tcal->isChecked(); }
165 bool againTomorrow() { return ical->isChecked(); } 167 bool againTomorrow() { return ical->isChecked(); }
166private: 168private:
167 QRadioButton* vcal, *ical, *ocal, *tcal; 169 QRadioButton* vcal, *ical, *ocal, *tcal;
168}; 170};
169int KApplication::createBackup( QString fn, QString dp, int numBup ) 171int KApplication::createBackup( QString fn, QString dp, int numBup )
170{ 172{
171 if ( numBup < 1) return 3; 173 if ( numBup < 1) return 3;
172 int ret = 3; 174 int ret = 3;
173 //qDebug("KApplication::createBackup %s --- %s --- %d", fn.latin1(), dp.latin1(), numBup); 175 //qDebug("KApplication::createBackup %s --- %s --- %d", fn.latin1(), dp.latin1(), numBup);
174 QDir bupDir ( dp ); 176 QDir bupDir ( dp );
175 bool tryAgain = true; 177 bool tryAgain = true;
176 while ( tryAgain ) { 178 while ( tryAgain ) {
177 if ( !bupDir.exists() ) { 179 if ( !bupDir.exists() ) {
178 QString bd = dp.right(25); 180 QString bd = dp.right(25);
179 if ( dp.length() > 25 ) 181 if ( dp.length() > 25 )
180 bd = "..." + bd; 182 bd = "..." + bd;
181 KBackupPrefs noDir( i18n("<b>Backup directory does not exist: </b>") + bd); 183 KBackupPrefs noDir( i18n("<b>Backup directory does not exist: </b>") + bd);
182 if ( !noDir.exec() ) return 3; 184 if ( !noDir.exec() ) return 3;
183 if ( noDir.againTomorrow() ) { 185 if ( noDir.againTomorrow() ) {
184 return 0; 186 return 0;
185 } else if ( noDir.later() ) { 187 } else if ( noDir.later() ) {
186 return 3; 188 return 3;
187 } else if ( !noDir.again() ) { 189 } else if ( !noDir.again() ) {
188 return 2; 190 return 2;
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index df2aad8..027e5e9 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -130,256 +130,258 @@ public:
130 QWidget *m_parent; 130 QWidget *m_parent;
131 131
132 QMainWindow::ToolBarDock oldPos; 132 QMainWindow::ToolBarDock oldPos;
133 133
134 KXMLGUIClient *m_xmlguiClient; 134 KXMLGUIClient *m_xmlguiClient;
135 135
136 struct ToolBarInfo 136 struct ToolBarInfo
137 { 137 {
138//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} 138//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
139 ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} 139 ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {}
140//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} 140//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
141 ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} 141 ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
142 int index, offset; 142 int index, offset;
143 bool newline; 143 bool newline;
144//US Qt::Dock dock; 144//US Qt::Dock dock;
145 QMainWindow::ToolBarDock dock; 145 QMainWindow::ToolBarDock dock;
146 }; 146 };
147 147
148 ToolBarInfo toolBarInfo; 148 ToolBarInfo toolBarInfo;
149 QValueList<int> iconSizes; 149 QValueList<int> iconSizes;
150 QTimer repaintTimer; 150 QTimer repaintTimer;
151 151
152 // Default Values. 152 // Default Values.
153 bool HiddenDefault; 153 bool HiddenDefault;
154 int IconSizeDefault; 154 int IconSizeDefault;
155 QString IconTextDefault; 155 QString IconTextDefault;
156 int IndexDefault; 156 int IndexDefault;
157 bool NewLineDefault; 157 bool NewLineDefault;
158 int OffsetDefault; 158 int OffsetDefault;
159 QString PositionDefault; 159 QString PositionDefault;
160 160
161 QPtrList<QWidget> idleButtons; 161 QPtrList<QWidget> idleButtons;
162}; 162};
163 163
164KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, 164KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent,
165 const char* name ) 165 const char* name )
166 :QFrame( parent, name ), line( l ) 166 :QFrame( parent, name ), line( l )
167{ 167{
168 connect( parent, SIGNAL(orientationChanged(Orientation)), 168 connect( parent, SIGNAL(orientationChanged(Orientation)),
169 this, SLOT(setOrientation(Orientation)) ); 169 this, SLOT(setOrientation(Orientation)) );
170 setOrientation( o ); 170 setOrientation( o );
171 setBackgroundMode( parent->backgroundMode() ); 171 setBackgroundMode( parent->backgroundMode() );
172 setBackgroundOrigin( ParentOrigin ); 172 setBackgroundOrigin( ParentOrigin );
173} 173}
174 174
175void KToolBarSeparator::setOrientation( Orientation o ) 175void KToolBarSeparator::setOrientation( Orientation o )
176{ 176{
177 orient = o; 177 orient = o;
178 if ( line ) { 178 if ( line ) {
179 if ( orientation() == Vertical ) 179 if ( orientation() == Vertical )
180 setFrameStyle( HLine + Sunken ); 180 setFrameStyle( HLine + Sunken );
181 else 181 else
182 setFrameStyle( VLine + Sunken ); 182 setFrameStyle( VLine + Sunken );
183 } else { 183 } else {
184 setFrameStyle( NoFrame ); 184 setFrameStyle( NoFrame );
185 } 185 }
186} 186}
187 187
188void KToolBarSeparator::styleChange( QStyle& ) 188void KToolBarSeparator::styleChange( QStyle& )
189{ 189{
190 setOrientation( orient ); 190 setOrientation( orient );
191} 191}
192 192
193QSize KToolBarSeparator::sizeHint() const 193QSize KToolBarSeparator::sizeHint() const
194{ 194{
195 return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); 195 return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
196} 196}
197 197
198QSizePolicy KToolBarSeparator::sizePolicy() const 198QSizePolicy KToolBarSeparator::sizePolicy() const
199{ 199{
200 return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); 200 return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
201} 201}
202 202
203KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) 203KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig )
204#ifdef DESKTOP_VERSION 204#ifdef DESKTOP_VERSION
205 : QToolBar( QString::fromLatin1( name ), 205 : QToolBar( QString::fromLatin1( name ),
206 parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, 206 parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
207 parent, FALSE, 207 parent, FALSE,
208 name ? name : "mainToolBar") 208 name ? name : "mainToolBar")
209#else 209#else
210 : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, 210 : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
211 QString::fromLatin1( name )) 211 QString::fromLatin1( name ))
212 212
213 213
214#endif 214#endif
215{ 215{
216 init( readConfig, honorStyle ); 216 init( readConfig, honorStyle );
217} 217}
218 218
219KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) 219KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
220#ifdef DESKTOP_VERSION 220#ifdef DESKTOP_VERSION
221 : QToolBar( QString::fromLatin1( name ), 221 : QToolBar( QString::fromLatin1( name ),
222 parentWindow, dock, newLine, 222 parentWindow, dock, newLine,
223 name ? name : "mainToolBar") 223 name ? name : "mainToolBar")
224#else 224#else
225 : QPEToolBar( parentWindow,QString::fromLatin1( name )) 225 : QPEToolBar( parentWindow,QString::fromLatin1( name ))
226 226
227 227
228#endif 228#endif
229 229
230{ 230{
231 init( readConfig, honorStyle ); 231 init( readConfig, honorStyle );
232} 232}
233 233
234KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) 234KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
235#ifdef DESKTOP_VERSION 235#ifdef DESKTOP_VERSION
236 : QToolBar( QString::fromLatin1( name ), 236 : QToolBar( QString::fromLatin1( name ),
237 parentWindow, dock, newLine, 237 parentWindow, dock, newLine,
238 name ? name : "mainToolBar") 238 name ? name : "mainToolBar")
239#else 239#else
240 : QPEToolBar( parentWindow,QString::fromLatin1( name )) 240 : QPEToolBar( parentWindow,QString::fromLatin1( name ))
241 241
242 242
243#endif 243#endif
244 244
245{ 245{
246 init( readConfig, honorStyle ); 246 init( readConfig, honorStyle );
247} 247}
248 248
249KToolBar::~KToolBar() 249KToolBar::~KToolBar()
250{ 250{
251 inshutdownprocess = true; 251 inshutdownprocess = true;
252 emit toolbarDestroyed(); 252 emit toolbarDestroyed();
253 delete d; 253 delete d;
254} 254}
255 255
256void KToolBar::init( bool readConfig, bool honorStyle ) 256void KToolBar::init( bool readConfig, bool honorStyle )
257{ 257{
258 sizeHintW = 240;
259 sizeHintH = 22;
258 inshutdownprocess = false; 260 inshutdownprocess = false;
259 d = new KToolBarPrivate; 261 d = new KToolBarPrivate;
260 setFullSize( TRUE ); 262 setFullSize( TRUE );
261 d->m_honorStyle = honorStyle; 263 d->m_honorStyle = honorStyle;
262 context = 0; 264 context = 0;
263 layoutTimer = new QTimer( this ); 265 layoutTimer = new QTimer( this );
264 connect( layoutTimer, SIGNAL( timeout() ), 266 connect( layoutTimer, SIGNAL( timeout() ),
265 this, SLOT( rebuildLayout() ) ); 267 this, SLOT( rebuildLayout() ) );
266 connect( &(d->repaintTimer), SIGNAL( timeout() ), 268 connect( &(d->repaintTimer), SIGNAL( timeout() ),
267 this, SLOT( slotRepaint() ) ); 269 this, SLOT( slotRepaint() ) );
268/*US 270/*US
269 if ( kapp ) { // may be null when started inside designer 271 if ( kapp ) { // may be null when started inside designer
270 connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); 272 connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged()));
271 // request notification of changes in icon style 273 // request notification of changes in icon style
272 kapp->addKipcEventMask(KIPC::IconChanged); 274 kapp->addKipcEventMask(KIPC::IconChanged);
273 connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); 275 connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int)));
274 } 276 }
275*/ 277*/
276 // finally, read in our configurable settings 278 // finally, read in our configurable settings
277 if ( readConfig ) 279 if ( readConfig )
278 slotReadConfig(); 280 slotReadConfig();
279 281
280 if ( mainWindow() ) 282 if ( mainWindow() )
281 connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), 283 connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ),
282 this, SLOT( toolBarPosChanged( QToolBar * ) ) ); 284 this, SLOT( toolBarPosChanged( QToolBar * ) ) );
283 285
284 // Hack to make sure we recalculate our size when we dock. 286 // Hack to make sure we recalculate our size when we dock.
285//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); 287//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) );
286} 288}
287 289
288int KToolBar::insertButton(const QString& icon, int id, bool enabled, 290int KToolBar::insertButton(const QString& icon, int id, bool enabled,
289 const QString& text, int index/*US, KInstance *_instance*/ ) 291 const QString& text, int index/*US, KInstance *_instance*/ )
290{ 292{
291 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ ); 293 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ );
292 294
293 insertWidgetInternal( button, index, id ); 295 insertWidgetInternal( button, index, id );
294 button->setEnabled( enabled ); 296 button->setEnabled( enabled );
295 doConnections( button ); 297 doConnections( button );
296 return index; 298 return index;
297} 299}
298 300
299 301
300int KToolBar::insertButton(const QString& icon, int id, const char *signal, 302int KToolBar::insertButton(const QString& icon, int id, const char *signal,
301 const QObject *receiver, const char *slot, 303 const QObject *receiver, const char *slot,
302 bool enabled, const QString& text, int index/*US, KInstance *_instance*/ ) 304 bool enabled, const QString& text, int index/*US, KInstance *_instance*/ )
303{ 305{
304 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/); 306 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/);
305 insertWidgetInternal( button, index, id ); 307 insertWidgetInternal( button, index, id );
306 button->setEnabled( enabled ); 308 button->setEnabled( enabled );
307 connect( button, signal, receiver, slot ); 309 connect( button, signal, receiver, slot );
308 doConnections( button ); 310 doConnections( button );
309 return index; 311 return index;
310} 312}
311 313
312 314
313int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled, 315int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled,
314 const QString& text, int index ) 316 const QString& text, int index )
315{ 317{
316 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); 318 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
317 insertWidgetInternal( button, index, id ); 319 insertWidgetInternal( button, index, id );
318 button->setEnabled( enabled ); 320 button->setEnabled( enabled );
319 doConnections( button ); 321 doConnections( button );
320 return index; 322 return index;
321} 323}
322#if 0 324#if 0
323 bar->insertButton( icon, id_, SIGNAL( clicked() ), this, 325 bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
324 SLOT( slotActivated() ), 326 SLOT( slotActivated() ),
325 d->isEnabled(), d->plainText(), index/*US, instance*/ ); 327 d->isEnabled(), d->plainText(), index/*US, instance*/ );
326#endif 328#endif
327 329
328int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, 330int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal,
329 const QObject *receiver, const char *slot, 331 const QObject *receiver, const char *slot,
330 bool enabled, const QString& text, 332 bool enabled, const QString& text,
331 int index ) 333 int index )
332{ 334{
333 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); 335 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
334 insertWidgetInternal( button, index, id ); 336 insertWidgetInternal( button, index, id );
335 button->setEnabled( enabled ); 337 button->setEnabled( enabled );
336 connect( button, signal, receiver, slot ); 338 connect( button, signal, receiver, slot );
337 doConnections( button ); 339 doConnections( button );
338 return index; 340 return index;
339} 341}
340 342
341 343
342int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, 344int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup,
343 bool enabled, const QString &text, int index ) 345 bool enabled, const QString &text, int index )
344{ 346{
345 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); 347 KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text );
346 insertWidgetInternal( button, index, id ); 348 insertWidgetInternal( button, index, id );
347 button->setEnabled( enabled ); 349 button->setEnabled( enabled );
348 button->setPopup( popup ); 350 button->setPopup( popup );
349 doConnections( button ); 351 doConnections( button );
350 return index; 352 return index;
351} 353}
352 354
353 355
354int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, 356int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
355 bool enabled, const QString &text, int index ) 357 bool enabled, const QString &text, int index )
356{ 358{
357 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); 359 KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text );
358 insertWidgetInternal( button, index, id ); 360 insertWidgetInternal( button, index, id );
359 button->setEnabled( enabled ); 361 button->setEnabled( enabled );
360 button->setPopup( popup ); 362 button->setPopup( popup );
361 doConnections( button ); 363 doConnections( button );
362 return index; 364 return index;
363} 365}
364 366
365 367
366int KToolBar::insertLined (const QString& text, int id, 368int KToolBar::insertLined (const QString& text, int id,
367 const char *signal, 369 const char *signal,
368 const QObject *receiver, const char *slot, 370 const QObject *receiver, const char *slot,
369 bool enabled , 371 bool enabled ,
370 const QString& toolTipText, 372 const QString& toolTipText,
371 int size, int index ) 373 int size, int index )
372{ 374{
373 KLineEdit *lined = new KLineEdit ( this, 0 ); 375 KLineEdit *lined = new KLineEdit ( this, 0 );
374 if ( !toolTipText.isEmpty() ) 376 if ( !toolTipText.isEmpty() )
375 QToolTip::add( lined, toolTipText ); 377 QToolTip::add( lined, toolTipText );
376 if ( size > 0 ) 378 if ( size > 0 )
377 lined->setMinimumWidth( size ); 379 lined->setMinimumWidth( size );
378 insertWidgetInternal( lined, index, id ); 380 insertWidgetInternal( lined, index, id );
379 connect( lined, signal, receiver, slot ); 381 connect( lined, signal, receiver, slot );
380 lined->setText(text); 382 lined->setText(text);
381 lined->setEnabled( enabled ); 383 lined->setEnabled( enabled );
382 return index; 384 return index;
383} 385}
384 386
385int KToolBar::insertCombo (const QStringList &list, int id, bool writable, 387int KToolBar::insertCombo (const QStringList &list, int id, bool writable,
@@ -1314,258 +1316,266 @@ void KToolBar::rebuildLayout()
1314 QApplication::sendPostedEvents( this, QEvent::ChildInserted ); 1316 QApplication::sendPostedEvents( this, QEvent::ChildInserted );
1315 QBoxLayout *l = boxLayout(); 1317 QBoxLayout *l = boxLayout();
1316 l->setMargin( 1 ); 1318 l->setMargin( 1 );
1317 // clear the old layout 1319 // clear the old layout
1318 QLayoutIterator it = l->iterator(); 1320 QLayoutIterator it = l->iterator();
1319 1321
1320 while ( it.current() ) { 1322 while ( it.current() ) {
1321 it.deleteCurrent(); 1323 it.deleteCurrent();
1322 } 1324 }
1323 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { 1325 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) {
1324 if ( w == rightAligned ) { 1326 if ( w == rightAligned ) {
1325 continue; 1327 continue;
1326 } 1328 }
1327 if ( w->inherits( "KToolBarSeparator" ) && 1329 if ( w->inherits( "KToolBarSeparator" ) &&
1328 !( (KToolBarSeparator*)w )->showLine() ) { 1330 !( (KToolBarSeparator*)w )->showLine() ) {
1329 l->addSpacing( 6 ); 1331 l->addSpacing( 6 );
1330 w->hide(); 1332 w->hide();
1331 continue; 1333 continue;
1332 } 1334 }
1333 if ( w->inherits( "QPopupMenu" ) ) 1335 if ( w->inherits( "QPopupMenu" ) )
1334 continue; 1336 continue;
1335 l->addWidget( w ); 1337 l->addWidget( w );
1336 w->show(); 1338 w->show();
1337 } 1339 }
1338 if ( rightAligned ) { 1340 if ( rightAligned ) {
1339 l->addStretch(); 1341 l->addStretch();
1340 l->addWidget( rightAligned ); 1342 l->addWidget( rightAligned );
1341 rightAligned->show(); 1343 rightAligned->show();
1342 } 1344 }
1343 1345
1344 if ( fullSize() ) { 1346 if ( fullSize() ) {
1345 // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). 1347 // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword).
1346 //if ( !stretchableWidget && widgets.last() && 1348 //if ( !stretchableWidget && widgets.last() &&
1347 // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) 1349 // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) )
1348 // setStretchableWidget( widgets.last() ); 1350 // setStretchableWidget( widgets.last() );
1349 if ( !rightAligned ) 1351 if ( !rightAligned )
1350 l->addStretch(); 1352 l->addStretch();
1351 if ( stretchableWidget ) 1353 if ( stretchableWidget )
1352 l->setStretchFactor( stretchableWidget, 10 ); 1354 l->setStretchFactor( stretchableWidget, 10 );
1353 } 1355 }
1354 l->invalidate(); 1356 l->invalidate();
1355 QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); 1357 QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) );
1356 //#endif //DESKTOP_VERSION 1358 //#endif //DESKTOP_VERSION
1357} 1359}
1358 1360
1359void KToolBar::childEvent( QChildEvent *e ) 1361void KToolBar::childEvent( QChildEvent *e )
1360{ 1362{
1361 1363
1362 if ( e->child()->isWidgetType() ) { 1364 if ( e->child()->isWidgetType() ) {
1363 QWidget * w = (QWidget*)e->child(); 1365 QWidget * w = (QWidget*)e->child();
1364 if ( e->type() == QEvent::ChildInserted ) { 1366 if ( e->type() == QEvent::ChildInserted ) {
1365 if ( !e->child()->inherits( "QPopupMenu" ) && 1367 if ( !e->child()->inherits( "QPopupMenu" ) &&
1366 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { 1368 ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
1367 1369
1368 // prevent items that have been explicitly inserted by insert*() from 1370 // prevent items that have been explicitly inserted by insert*() from
1369 // being inserted again 1371 // being inserted again
1370 if ( !widget2id.contains( w ) ) 1372 if ( !widget2id.contains( w ) )
1371 { 1373 {
1372 int dummy = -1; 1374 int dummy = -1;
1373 insertWidgetInternal( w, dummy, -1 ); 1375 insertWidgetInternal( w, dummy, -1 );
1374 } 1376 }
1375 } 1377 }
1376 } else { 1378 } else {
1377 removeWidgetInternal( w ); 1379 removeWidgetInternal( w );
1378 } 1380 }
1379 if ( isVisibleTo( 0 ) ) 1381 if ( isVisibleTo( 0 ) )
1380 { 1382 {
1381 QBoxLayout *l = boxLayout(); 1383 QBoxLayout *l = boxLayout();
1382 // QLayout *l = layout(); 1384 // QLayout *l = layout();
1383 1385
1384 // clear the old layout so that we don't get unnecassery layout 1386 // clear the old layout so that we don't get unnecassery layout
1385 // changes till we have rebuild the thing 1387 // changes till we have rebuild the thing
1386 QLayoutIterator it = l->iterator(); 1388 QLayoutIterator it = l->iterator();
1387 while ( it.current() ) { 1389 while ( it.current() ) {
1388 it.deleteCurrent(); 1390 it.deleteCurrent();
1389 } 1391 }
1390 layoutTimer->start( 50, TRUE ); 1392 layoutTimer->start( 50, TRUE );
1391 } 1393 }
1392 } 1394 }
1393 QToolBar::childEvent( e ); 1395 QToolBar::childEvent( e );
1394} 1396}
1395 1397
1396void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) 1398void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
1397{ 1399{
1398 // we can't have it in widgets, or something is really wrong 1400 // we can't have it in widgets, or something is really wrong
1399 //widgets.removeRef( w ); 1401 //widgets.removeRef( w );
1400 1402
1401 connect( w, SIGNAL( destroyed() ), 1403 connect( w, SIGNAL( destroyed() ),
1402 this, SLOT( widgetDestroyed() ) ); 1404 this, SLOT( widgetDestroyed() ) );
1403 if ( index == -1 || index > (int)widgets.count() ) { 1405 if ( index == -1 || index > (int)widgets.count() ) {
1404 widgets.append( w ); 1406 widgets.append( w );
1405 index = (int)widgets.count(); 1407 index = (int)widgets.count();
1406 } 1408 }
1407 else 1409 else
1408 widgets.insert( index, w ); 1410 widgets.insert( index, w );
1409 if ( id == -1 ) 1411 if ( id == -1 )
1410 id = id2widget.count(); 1412 id = id2widget.count();
1411 id2widget.insert( id, w ); 1413 id2widget.insert( id, w );
1412 widget2id.insert( w, id ); 1414 widget2id.insert( w, id );
1413} 1415}
1414void KToolBar::repaintMe() 1416void KToolBar::repaintMe()
1415{ 1417{
1416 setUpdatesEnabled( true ); 1418 setUpdatesEnabled( true );
1417 QToolBar::repaint( true ); 1419 QToolBar::repaint( true );
1418 qDebug(" KToolBar::repaintMe() "); 1420 qDebug(" KToolBar::repaintMe() ");
1419} 1421}
1420 1422
1421void KToolBar::showEvent( QShowEvent *e ) 1423void KToolBar::showEvent( QShowEvent *e )
1422{ 1424{
1423 rebuildLayout(); 1425 rebuildLayout();
1424 QToolBar::showEvent( e ); 1426 QToolBar::showEvent( e );
1425} 1427}
1426 1428
1427void KToolBar::setStretchableWidget( QWidget *w ) 1429void KToolBar::setStretchableWidget( QWidget *w )
1428{ 1430{
1429 QToolBar::setStretchableWidget( w ); 1431 QToolBar::setStretchableWidget( w );
1430 stretchableWidget = w; 1432 stretchableWidget = w;
1431} 1433}
1432 1434
1433QSizePolicy KToolBar::sizePolicy() const 1435QSizePolicy KToolBar::sizePolicy() const
1434{ 1436{
1435 if ( orientation() == Horizontal ) 1437 if ( orientation() == Horizontal )
1436 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); 1438 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
1437 else 1439 else
1438 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); 1440 return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
1439} 1441}
1440 1442
1441QSize KToolBar::sizeHint() const 1443QSize KToolBar::sizeHint() const
1442{ 1444{
1443 return QToolBar::sizeHint(); 1445 QSize sh = QToolBar::sizeHint();
1446 //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() );
1447 if ( sh.height() <= 20 || sh.width() < 60 )
1448 return QSize( sizeHintW, sizeHintH );
1449 KToolBar* ttt = (KToolBar*) this;
1450 ttt->sizeHintW = sh.width();
1451 ttt->sizeHintH = sh.height();
1452 return sh;
1453 //return QToolBar::sizeHint();
1444#if 0 1454#if 0
1445 QWidget::polish(); 1455 QWidget::polish();
1446 static int iii = 0; 1456 static int iii = 0;
1447 ++iii; 1457 ++iii;
1448 qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); 1458 qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
1449 int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); 1459 int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
1450 switch( barPos() ) 1460 switch( barPos() )
1451 { 1461 {
1452 case KToolBar::Top: 1462 case KToolBar::Top:
1453 case KToolBar::Bottom: 1463 case KToolBar::Bottom:
1454 for ( QWidget *w = widgets.first(); w; w =widgets.next() ) 1464 for ( QWidget *w = widgets.first(); w; w =widgets.next() )
1455 { 1465 {
1456 if ( w->inherits( "KToolBarSeparator" ) && 1466 if ( w->inherits( "KToolBarSeparator" ) &&
1457 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1467 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1458 { 1468 {
1459 minSize += QSize(6, 0); 1469 minSize += QSize(6, 0);
1460 } 1470 }
1461 else 1471 else
1462 { 1472 {
1463 QSize sh = w->sizeHint(); 1473 QSize sh = w->sizeHint();
1464 if (!sh.isValid()) 1474 if (!sh.isValid())
1465 sh = w->minimumSize(); 1475 sh = w->minimumSize();
1466 minSize = minSize.expandedTo(QSize(0, sh.height())); 1476 minSize = minSize.expandedTo(QSize(0, sh.height()));
1467 minSize += QSize(sh.width()+1, 0); 1477 minSize += QSize(sh.width()+1, 0);
1468 } 1478 }
1469 } 1479 }
1470/*US 1480/*US
1471 minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); 1481 minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0);
1472*/ 1482*/
1473 minSize += QSize(margin*2, margin*2); 1483 minSize += QSize(margin*2, margin*2);
1474 break; 1484 break;
1475 1485
1476 case KToolBar::Left: 1486 case KToolBar::Left:
1477 case KToolBar::Right: 1487 case KToolBar::Right:
1478 for ( QWidget *w = widgets.first(); w; w = widgets.next() ) 1488 for ( QWidget *w = widgets.first(); w; w = widgets.next() )
1479 { 1489 {
1480 if ( w->inherits( "KToolBarSeparator" ) && 1490 if ( w->inherits( "KToolBarSeparator" ) &&
1481 !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) 1491 !( static_cast<KToolBarSeparator*>(w)->showLine() ) )
1482 { 1492 {
1483 minSize += QSize(0, 6); 1493 minSize += QSize(0, 6);
1484 } 1494 }
1485 else 1495 else
1486 { 1496 {
1487 QSize sh = w->sizeHint(); 1497 QSize sh = w->sizeHint();
1488 if (!sh.isValid()) 1498 if (!sh.isValid())
1489 sh = w->minimumSize(); 1499 sh = w->minimumSize();
1490 minSize = minSize.expandedTo(QSize(sh.width(), 0)); 1500 minSize = minSize.expandedTo(QSize(sh.width(), 0));
1491 minSize += QSize(0, sh.height()+1); 1501 minSize += QSize(0, sh.height()+1);
1492 } 1502 }
1493 } 1503 }
1494/*US 1504/*US
1495 minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); 1505 minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
1496*/ 1506*/
1497 minSize += QSize(margin*2, margin*2); 1507 minSize += QSize(margin*2, margin*2);
1498 break; 1508 break;
1499 1509
1500 default: 1510 default:
1501 minSize = QToolBar::sizeHint(); 1511 minSize = QToolBar::sizeHint();
1502 break; 1512 break;
1503 } 1513 }
1504 return minSize; 1514 return minSize;
1505#endif 1515#endif
1506} 1516}
1507 1517
1508QSize KToolBar::minimumSize() const 1518QSize KToolBar::minimumSize() const
1509{ 1519{
1510 return minimumSizeHint(); 1520 return minimumSizeHint();
1511} 1521}
1512 1522
1513QSize KToolBar::minimumSizeHint() const 1523QSize KToolBar::minimumSizeHint() const
1514{ 1524{
1515 return sizeHint(); 1525 return sizeHint();
1516} 1526}
1517 1527
1518bool KToolBar::highlight() const 1528bool KToolBar::highlight() const
1519{ 1529{
1520 return d->m_highlight; 1530 return d->m_highlight;
1521} 1531}
1522 1532
1523void KToolBar::hide() 1533void KToolBar::hide()
1524{ 1534{
1525 QToolBar::hide(); 1535 QToolBar::hide();
1526} 1536}
1527 1537
1528void KToolBar::show() 1538void KToolBar::show()
1529{ 1539{
1530 QToolBar::show(); 1540 QToolBar::show();
1531} 1541}
1532 1542
1533void KToolBar::resizeEvent( QResizeEvent *e ) 1543void KToolBar::resizeEvent( QResizeEvent *e )
1534{ 1544{
1535 bool b = isUpdatesEnabled(); 1545 bool b = isUpdatesEnabled();
1536 setUpdatesEnabled( FALSE ); 1546 setUpdatesEnabled( FALSE );
1537 QToolBar::resizeEvent( e ); 1547 QToolBar::resizeEvent( e );
1538 if (b) 1548 if (b)
1539 d->repaintTimer.start( 100, true ); 1549 d->repaintTimer.start( 100, true );
1540} 1550}
1541 1551
1542void KToolBar::slotIconChanged(int group) 1552void KToolBar::slotIconChanged(int group)
1543{ 1553{
1544 if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) 1554 if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar))
1545 return; 1555 return;
1546 if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) 1556 if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
1547 return; 1557 return;
1548 1558
1549 emit modechange(); 1559 emit modechange();
1550 if (isVisible()) 1560 if (isVisible())
1551 updateGeometry(); 1561 updateGeometry();
1552} 1562}
1553 1563
1554void KToolBar::slotReadConfig() 1564void KToolBar::slotReadConfig()
1555{ 1565{
1556 //kdDebug(220) << "KToolBar::slotReadConfig" << endl; 1566 //kdDebug(220) << "KToolBar::slotReadConfig" << endl;
1557 // Read appearance settings (hmm, we used to do both here, 1567 // Read appearance settings (hmm, we used to do both here,
1558 // but a well behaved application will call applyMainWindowSettings 1568 // but a well behaved application will call applyMainWindowSettings
1559 // anyway, right ?) 1569 // anyway, right ?)
1560 applyAppearanceSettings(KGlobal::config(), QString::null ); 1570 applyAppearanceSettings(KGlobal::config(), QString::null );
1561} 1571}
1562 1572
1563void KToolBar::slotAppearanceChanged() 1573void KToolBar::slotAppearanceChanged()
1564{ 1574{
1565 // Read appearance settings from global file. 1575 // Read appearance settings from global file.
1566 applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); 1576 applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ );
1567 // And remember to save the new look later 1577 // And remember to save the new look later
1568/*US 1578/*US
1569 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) 1579 if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
1570 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); 1580 static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
1571*/ 1581*/
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 7a5c114..3319fa8 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -956,153 +956,155 @@ signals:
956 956
957 /** 957 /**
958 * Emitted when button @p id is double-clicked. 958 * Emitted when button @p id is double-clicked.
959 * 959 *
960 * Note: you will always 960 * Note: you will always
961 * recive two @ref clicked() , @ref pressed() and @ref released() signals. 961 * recive two @ref clicked() , @ref pressed() and @ref released() signals.
962 * There is no way to avoid it - at least no easy way. 962 * There is no way to avoid it - at least no easy way.
963 * If you need to resolve this all you can do is set up timers 963 * If you need to resolve this all you can do is set up timers
964 * which wait for @ref QApplication::doubleClickInterval() to expire. 964 * which wait for @ref QApplication::doubleClickInterval() to expire.
965 * If in that time you don't get this signal, you may belive that 965 * If in that time you don't get this signal, you may belive that
966 * button was only clicked and not double-clicked. 966 * button was only clicked and not double-clicked.
967 * And please note that butons with popup menus do not emit this signal, 967 * And please note that butons with popup menus do not emit this signal,
968 * but those with delayed popup do. 968 * but those with delayed popup do.
969 */ 969 */
970 void doubleClicked (int id); 970 void doubleClicked (int id);
971 971
972 /** 972 /**
973 * Emitted when button @p id is pressed. 973 * Emitted when button @p id is pressed.
974 */ 974 */
975 void pressed(int); 975 void pressed(int);
976 976
977 /** 977 /**
978 * Emits when button @p id is released. 978 * Emits when button @p id is released.
979 */ 979 */
980 void released(int); 980 void released(int);
981 981
982 /** 982 /**
983 * Emitted when a toggle button changes state. 983 * Emitted when a toggle button changes state.
984 * 984 *
985 * Emitted also if you change state 985 * Emitted also if you change state
986 * with @ref setButton() or @ref toggleButton() 986 * with @ref setButton() or @ref toggleButton()
987 * If you make a button normal again, with 987 * If you make a button normal again, with
988 * setToggle(false), this signal won't 988 * setToggle(false), this signal won't
989 * be emitted. 989 * be emitted.
990 */ 990 */
991 void toggled(int); 991 void toggled(int);
992 992
993 /** 993 /**
994 * This signal is emitted when item id gets highlighted/unhighlighted 994 * This signal is emitted when item id gets highlighted/unhighlighted
995 * (i.e when mouse enters/exits). 995 * (i.e when mouse enters/exits).
996 * 996 *
997 * Note that this signal is emitted from 997 * Note that this signal is emitted from
998 * all buttons (normal, disabled and toggle) even when there is no visible 998 * all buttons (normal, disabled and toggle) even when there is no visible
999 * change in buttons (i.e., buttons do not raise when mouse enters). 999 * change in buttons (i.e., buttons do not raise when mouse enters).
1000 * The parameter @p isHighlighted is @p true when mouse enters and @p false when 1000 * The parameter @p isHighlighted is @p true when mouse enters and @p false when
1001 * mouse exits. 1001 * mouse exits.
1002 */ 1002 */
1003 void highlighted(int id, bool isHighlighted); 1003 void highlighted(int id, bool isHighlighted);
1004 1004
1005 /** 1005 /**
1006 * This signal is emitted when item id gets highlighted/unhighlighted 1006 * This signal is emitted when item id gets highlighted/unhighlighted
1007 * (i.e when mouse enters/exits). 1007 * (i.e when mouse enters/exits).
1008 * 1008 *
1009 * Note that this signal is emitted from 1009 * Note that this signal is emitted from
1010 * all buttons (normal, disabled and toggle) even when there is no visible 1010 * all buttons (normal, disabled and toggle) even when there is no visible
1011 * change in buttons (i.e., buttons do not raise when mouse enters). 1011 * change in buttons (i.e., buttons do not raise when mouse enters).
1012 */ 1012 */
1013 void highlighted(int id ); 1013 void highlighted(int id );
1014 1014
1015 /** 1015 /**
1016 * Emitted when toolbar changes position, or when 1016 * Emitted when toolbar changes position, or when
1017 * an item is removed from toolbar. 1017 * an item is removed from toolbar.
1018 * 1018 *
1019 * If you subclass @ref KMainWindow and reimplement 1019 * If you subclass @ref KMainWindow and reimplement
1020 * @ref KMainWindow::resizeEvent() be sure to connect to 1020 * @ref KMainWindow::resizeEvent() be sure to connect to
1021 * this signal. Note: You can connect this signal to a slot that 1021 * this signal. Note: You can connect this signal to a slot that
1022 * doesn't take parameter. 1022 * doesn't take parameter.
1023 */ 1023 */
1024 void moved( BarPosition ); 1024 void moved( BarPosition );
1025 1025
1026 /** 1026 /**
1027 * @internal 1027 * @internal
1028 * This signal is emitted when toolbar detects changing of 1028 * This signal is emitted when toolbar detects changing of
1029 * following parameters: 1029 * following parameters:
1030 * highlighting, button-size, button-mode. This signal is 1030 * highlighting, button-size, button-mode. This signal is
1031 * internal, aimed to buttons. 1031 * internal, aimed to buttons.
1032 */ 1032 */
1033 void modechange (); 1033 void modechange ();
1034 1034
1035 /** 1035 /**
1036 * This signal is emitted when the toolbar is getting deleted, 1036 * This signal is emitted when the toolbar is getting deleted,
1037 * and before ~KToolbar finishes (so it's still time to remove 1037 * and before ~KToolbar finishes (so it's still time to remove
1038 * widgets from the toolbar). 1038 * widgets from the toolbar).
1039 * Used by KWidgetAction. 1039 * Used by KWidgetAction.
1040 * @since 3.2 1040 * @since 3.2
1041 */ 1041 */
1042 void toolbarDestroyed(); 1042 void toolbarDestroyed();
1043 1043
1044public: 1044public:
1045 /** 1045 /**
1046 * @return global setting for "Highlight buttons under mouse" 1046 * @return global setting for "Highlight buttons under mouse"
1047 */ 1047 */
1048 void repaintMe(); 1048 void repaintMe();
1049 static bool highlightSetting(); 1049 static bool highlightSetting();
1050 1050
1051 /** 1051 /**
1052 * @return global setting for "Toolbars transparent when moving" 1052 * @return global setting for "Toolbars transparent when moving"
1053 */ 1053 */
1054 static bool transparentSetting(); 1054 static bool transparentSetting();
1055 1055
1056 /** 1056 /**
1057 * @return global setting for "Icon Text" 1057 * @return global setting for "Icon Text"
1058 */ 1058 */
1059 static IconText iconTextSetting(); 1059 static IconText iconTextSetting();
1060 1060
1061public slots: 1061public slots:
1062 virtual void setIconText( const QString &txt ) 1062 virtual void setIconText( const QString &txt )
1063 { QToolBar::setIconText( txt ); } 1063 { QToolBar::setIconText( txt ); }
1064 void slotRepaint(); 1064 void slotRepaint();
1065 1065
1066protected: 1066protected:
1067 void mousePressEvent( QMouseEvent * ); 1067 void mousePressEvent( QMouseEvent * );
1068 void childEvent( QChildEvent *e ); 1068 void childEvent( QChildEvent *e );
1069 void showEvent( QShowEvent *e ); 1069 void showEvent( QShowEvent *e );
1070 void resizeEvent( QResizeEvent *e ); 1070 void resizeEvent( QResizeEvent *e );
1071 bool event( QEvent *e ); 1071 bool event( QEvent *e );
1072 void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); 1072 void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false);
1073 QString settingsGroup(); 1073 QString settingsGroup();
1074 1074
1075private slots: 1075private slots:
1076 void rebuildLayout(); 1076 void rebuildLayout();
1077 void slotReadConfig (); 1077 void slotReadConfig ();
1078 void slotAppearanceChanged(); 1078 void slotAppearanceChanged();
1079 void slotIconChanged(int); 1079 void slotIconChanged(int);
1080 void toolBarPosChanged( QToolBar *tb ); 1080 void toolBarPosChanged( QToolBar *tb );
1081 void slotContextAboutToShow(); 1081 void slotContextAboutToShow();
1082 void widgetDestroyed(); 1082 void widgetDestroyed();
1083 1083
1084private: 1084private:
1085 int sizeHintW;
1086 int sizeHintH;
1085 void init( bool readConfig = true, bool honorStyle = false ); 1087 void init( bool readConfig = true, bool honorStyle = false );
1086 void doConnections( KToolBarButton *button ); 1088 void doConnections( KToolBarButton *button );
1087 void insertWidgetInternal( QWidget *w, int &index, int id ); 1089 void insertWidgetInternal( QWidget *w, int &index, int id );
1088 void removeWidgetInternal( QWidget *w ); 1090 void removeWidgetInternal( QWidget *w );
1089 void getAttributes( QString &position, QString &icontext, int &index ); 1091 void getAttributes( QString &position, QString &icontext, int &index );
1090//US KPopupMenu *contextMenu(); 1092//US KPopupMenu *contextMenu();
1091 QPopupMenu *contextMenu(); 1093 QPopupMenu *contextMenu();
1092 1094
1093 QMap<QWidget*, int > widget2id; 1095 QMap<QWidget*, int > widget2id;
1094 typedef QMap<int, QWidget* > Id2WidgetMap; 1096 typedef QMap<int, QWidget* > Id2WidgetMap;
1095 Id2WidgetMap id2widget; 1097 Id2WidgetMap id2widget;
1096//US KPopupMenu *context; 1098//US KPopupMenu *context;
1097 QPopupMenu *context; 1099 QPopupMenu *context;
1098 QPtrList<QWidget> widgets; 1100 QPtrList<QWidget> widgets;
1099 QTimer *layoutTimer; 1101 QTimer *layoutTimer;
1100 QGuardedPtr<QWidget> stretchableWidget, rightAligned; 1102 QGuardedPtr<QWidget> stretchableWidget, rightAligned;
1101protected: 1103protected:
1102 virtual void virtual_hook( int id, void* data ); 1104 virtual void virtual_hook( int id, void* data );
1103private: 1105private:
1104 KToolBarPrivate *d; 1106 KToolBarPrivate *d;
1105 bool inshutdownprocess; 1107 bool inshutdownprocess;
1106}; 1108};
1107 1109
1108#endif 1110#endif