summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-22 14:12:43 (UTC)
committer zautrix <zautrix>2005-10-22 14:12:43 (UTC)
commita72d70beb381b9cd6f2af301b52ca82cdcafb299 (patch) (unidiff)
treef5b068e80395821abb5717fb07757a17d805f770
parenta72f3f3acfac791715a1c512fc4cc4c3facdbb62 (diff)
downloadkdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.zip
kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.gz
kdepimpi-a72d70beb381b9cd6f2af301b52ca82cdcafb299.tar.bz2
fix
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
@@ -803,144 +803,148 @@ void KABCore::mailVCard( const QStringList& uids )
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
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index f36c5ae..d7c12bb 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -6,103 +6,105 @@
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}
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
@@ -210,96 +210,98 @@ KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool rea
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 );
@@ -1394,98 +1396,106 @@ void KToolBar::childEvent( QChildEvent *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);
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
@@ -1036,73 +1036,75 @@ signals:
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