author | zautrix <zautrix> | 2005-08-23 21:48:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-23 21:48:53 (UTC) |
commit | 2acca9aff5bd651923b5d728712a0fd80b3d54e9 (patch) (unidiff) | |
tree | c2113d441908520d86902a8a9fade08eb05ee0d0 | |
parent | 6f5464760f5fb1e4c13027464cfe4943b85d29a0 (diff) | |
download | kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.zip kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.tar.gz kdepimpi-2acca9aff5bd651923b5d728712a0fd80b3d54e9.tar.bz2 |
fastload fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 15 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 4 |
4 files changed, 29 insertions, 16 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index af12f2b..4e2523e 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -567,97 +567,97 @@ void KABCore::restoreSettings() | |||
567 | mMiniSplitter->setSizes( splitterSize ); | 567 | mMiniSplitter->setSizes( splitterSize ); |
568 | if ( mExtensionBarSplitter ) { | 568 | if ( mExtensionBarSplitter ) { |
569 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 569 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
570 | if ( true /*splitterSize.count() == 0*/ ) { | 570 | if ( true /*splitterSize.count() == 0*/ ) { |
571 | splitterSize.append( wid / 2 ); | 571 | splitterSize.append( wid / 2 ); |
572 | splitterSize.append( wid / 2 ); | 572 | splitterSize.append( wid / 2 ); |
573 | } | 573 | } |
574 | mExtensionBarSplitter->setSizes( splitterSize ); | 574 | mExtensionBarSplitter->setSizes( splitterSize ); |
575 | 575 | ||
576 | } | 576 | } |
577 | #ifdef DESKTOP_VERSION | 577 | #ifdef DESKTOP_VERSION |
578 | KConfig *config = KABPrefs::instance()->getConfig(); | 578 | KConfig *config = KABPrefs::instance()->getConfig(); |
579 | config->setGroup("WidgetLayout"); | 579 | config->setGroup("WidgetLayout"); |
580 | QStringList list; | 580 | QStringList list; |
581 | list = config->readListEntry("MainLayout"); | 581 | list = config->readListEntry("MainLayout"); |
582 | int x,y,w,h; | 582 | int x,y,w,h; |
583 | if ( ! list.isEmpty() ) { | 583 | if ( ! list.isEmpty() ) { |
584 | x = list[0].toInt(); | 584 | x = list[0].toInt(); |
585 | y = list[1].toInt(); | 585 | y = list[1].toInt(); |
586 | w = list[2].toInt(); | 586 | w = list[2].toInt(); |
587 | h = list[3].toInt(); | 587 | h = list[3].toInt(); |
588 | KApplication::testCoords( &x,&y,&w,&h ); | 588 | KApplication::testCoords( &x,&y,&w,&h ); |
589 | topLevelWidget()->setGeometry(x,y,w,h); | 589 | topLevelWidget()->setGeometry(x,y,w,h); |
590 | 590 | ||
591 | } else { | 591 | } else { |
592 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 592 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
593 | } | 593 | } |
594 | #endif | 594 | #endif |
595 | } | 595 | } |
596 | 596 | ||
597 | void KABCore::saveSettings() | 597 | void KABCore::saveSettings() |
598 | { | 598 | { |
599 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 599 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
600 | if ( mExtensionBarSplitter ) | 600 | if ( mExtensionBarSplitter ) |
601 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 601 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
602 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 602 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
603 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 603 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
604 | #ifndef KAB_EMBEDDED | 604 | #ifndef KAB_EMBEDDED |
605 | 605 | ||
606 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 606 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
607 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 607 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
608 | #endif //KAB_EMBEDDED | 608 | #endif //KAB_EMBEDDED |
609 | mExtensionManager->saveSettings(); | 609 | mExtensionManager->saveSettings(); |
610 | mViewManager->saveSettings(); | 610 | mViewManager->saveSettings(); |
611 | 611 | ||
612 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 612 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
613 | 613 | ||
614 | KABPrefs::instance()->writeConfig(); | 614 | KABPrefs::instance()->writeConfig(); |
615 | qDebug("KA: KABCore::saveSettings() "); | 615 | //qDebug("KA: KABCore::saveSettings() "); |
616 | } | 616 | } |
617 | 617 | ||
618 | KABC::AddressBook *KABCore::addressBook() const | 618 | KABC::AddressBook *KABCore::addressBook() const |
619 | { | 619 | { |
620 | return mAddressBook; | 620 | return mAddressBook; |
621 | } | 621 | } |
622 | 622 | ||
623 | KConfig *KABCore::config() | 623 | KConfig *KABCore::config() |
624 | { | 624 | { |
625 | #ifndef KAB_EMBEDDED | 625 | #ifndef KAB_EMBEDDED |
626 | return KABPrefs::instance()->config(); | 626 | return KABPrefs::instance()->config(); |
627 | #else //KAB_EMBEDDED | 627 | #else //KAB_EMBEDDED |
628 | return KABPrefs::instance()->getConfig(); | 628 | return KABPrefs::instance()->getConfig(); |
629 | #endif //KAB_EMBEDDED | 629 | #endif //KAB_EMBEDDED |
630 | } | 630 | } |
631 | 631 | ||
632 | KActionCollection *KABCore::actionCollection() const | 632 | KActionCollection *KABCore::actionCollection() const |
633 | { | 633 | { |
634 | return mGUIClient->actionCollection(); | 634 | return mGUIClient->actionCollection(); |
635 | } | 635 | } |
636 | 636 | ||
637 | KABC::Field *KABCore::currentSearchField() const | 637 | KABC::Field *KABCore::currentSearchField() const |
638 | { | 638 | { |
639 | if (mIncSearchWidget) | 639 | if (mIncSearchWidget) |
640 | return mIncSearchWidget->currentField(); | 640 | return mIncSearchWidget->currentField(); |
641 | else | 641 | else |
642 | return 0; | 642 | return 0; |
643 | } | 643 | } |
644 | 644 | ||
645 | QStringList KABCore::selectedUIDs() const | 645 | QStringList KABCore::selectedUIDs() const |
646 | { | 646 | { |
647 | return mViewManager->selectedUids(); | 647 | return mViewManager->selectedUids(); |
648 | } | 648 | } |
649 | 649 | ||
650 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 650 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
651 | { | 651 | { |
652 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 652 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
653 | 653 | ||
654 | QPtrList<KRES::Resource> kresResources; | 654 | QPtrList<KRES::Resource> kresResources; |
655 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 655 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
656 | KABC::Resource *resource; | 656 | KABC::Resource *resource; |
657 | while ( ( resource = resIt.current() ) != 0 ) { | 657 | while ( ( resource = resIt.current() ) != 0 ) { |
658 | ++resIt; | 658 | ++resIt; |
659 | if ( !resource->readOnly() ) { | 659 | if ( !resource->readOnly() ) { |
660 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 660 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
661 | if ( res ) | 661 | if ( res ) |
662 | kresResources.append( res ); | 662 | kresResources.append( res ); |
663 | } | 663 | } |
@@ -799,138 +799,148 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
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 | */ |
829 | void KABCore::beamMySelf() | 829 | void 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 | } |
844 | void KABCore::updateMainWindow() | 844 | void KABCore::updateMainWindow() |
845 | { | 845 | { |
846 | mMainWindow->showMaximized(); | 846 | mMainWindow->showMaximized(); |
847 | mMainWindow->update(); | 847 | //mMainWindow->repaint(); |
848 | } | 848 | } |
849 | void KABCore::resizeEvent(QResizeEvent* e ) | 849 | void KABCore::resizeEvent(QResizeEvent* e ) |
850 | { | 850 | { |
851 | if ( !mMiniSplitter ) | 851 | if ( !mMiniSplitter ) |
852 | return; | 852 | return; |
853 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 853 | static int desktop_width = 0; |
854 | if ( e->oldSize().width() != e->size().width() ) | 854 | //qDebug("KABCore::resizeEvent %d %d ",desktop_width,QApplication::desktop()->width() ); |
855 | if ( desktop_width != QApplication::desktop()->width() ) | ||
855 | if ( QApplication::desktop()->width() >= 480 ) { | 856 | if ( QApplication::desktop()->width() >= 480 ) { |
856 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 857 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
858 | //qDebug("640 "); | ||
857 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 859 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
860 | //qDebug("switch V->H "); | ||
858 | mMiniSplitter->setOrientation( Qt::Horizontal); | 861 | mMiniSplitter->setOrientation( Qt::Horizontal); |
859 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 862 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
860 | } | 863 | } |
861 | if ( QApplication::desktop()->width() <= 640 ) { | 864 | if ( QApplication::desktop()->width() <= 640 ) { |
865 | bool shot = mMainWindow->isVisible(); | ||
862 | mMainWindow->showMinimized(); | 866 | mMainWindow->showMinimized(); |
863 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 867 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
864 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 868 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
865 | if ( mIncSearchWidget ) | 869 | if ( mIncSearchWidget ) |
866 | mIncSearchWidget->setSize(); | 870 | mIncSearchWidget->setSize(); |
867 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 871 | if ( shot ) |
872 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
868 | } | 873 | } |
869 | 874 | ||
870 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 875 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
876 | //qDebug("480 "); | ||
871 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 877 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
878 | //qDebug("switch H->V "); | ||
872 | mMiniSplitter->setOrientation( Qt::Vertical ); | 879 | mMiniSplitter->setOrientation( Qt::Vertical ); |
873 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 880 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
874 | } | 881 | } |
875 | if ( QApplication::desktop()->width() <= 640 ) { | 882 | if ( QApplication::desktop()->width() <= 640 ) { |
876 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 883 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
884 | bool shot = mMainWindow->isVisible(); | ||
877 | mMainWindow->showMinimized(); | 885 | mMainWindow->showMinimized(); |
878 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | 886 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { |
879 | if ( mIncSearchWidget ) { | 887 | if ( mIncSearchWidget ) { |
880 | mIncSearchWidget->setSize(); | 888 | mIncSearchWidget->setSize(); |
881 | } | 889 | } |
882 | } else { | 890 | } else { |
883 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 891 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
884 | } | 892 | } |
885 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 893 | if ( shot ) |
894 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | ||
886 | } | 895 | } |
887 | } | 896 | } |
888 | } | 897 | } |
898 | desktop_width = QApplication::desktop()->width(); | ||
889 | QWidget::resizeEvent( e ); | 899 | QWidget::resizeEvent( e ); |
890 | 900 | ||
891 | } | 901 | } |
892 | void KABCore::export2phone() | 902 | void KABCore::export2phone() |
893 | { | 903 | { |
894 | 904 | ||
895 | QStringList uids; | 905 | QStringList uids; |
896 | XXPortSelectDialog dlg( this, false, this ); | 906 | XXPortSelectDialog dlg( this, false, this ); |
897 | if ( dlg.exec() ) | 907 | if ( dlg.exec() ) |
898 | uids = dlg.uids(); | 908 | uids = dlg.uids(); |
899 | else | 909 | else |
900 | return; | 910 | return; |
901 | if ( uids.isEmpty() ) | 911 | if ( uids.isEmpty() ) |
902 | return; | 912 | return; |
903 | // qDebug("count %d ", uids.count()); | 913 | // qDebug("count %d ", uids.count()); |
904 | 914 | ||
905 | KAex2phonePrefs ex2phone; | 915 | KAex2phonePrefs ex2phone; |
906 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 916 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
907 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 917 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
908 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 918 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
909 | 919 | ||
910 | if ( !ex2phone.exec() ) { | 920 | if ( !ex2phone.exec() ) { |
911 | return; | 921 | return; |
912 | } | 922 | } |
913 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 923 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
914 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 924 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
915 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 925 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
916 | 926 | ||
917 | 927 | ||
918 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 928 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
919 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 929 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
920 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 930 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
921 | 931 | ||
922 | QString fileName = getPhoneFile(); | 932 | QString fileName = getPhoneFile(); |
923 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 933 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
924 | return; | 934 | return; |
925 | 935 | ||
926 | message(i18n("Exporting to phone...")); | 936 | message(i18n("Exporting to phone...")); |
927 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 937 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
928 | 938 | ||
929 | } | 939 | } |
930 | QString KABCore::getPhoneFile() | 940 | QString KABCore::getPhoneFile() |
931 | { | 941 | { |
932 | #ifdef DESKTOP_VERSION | 942 | #ifdef DESKTOP_VERSION |
933 | return locateLocal("tmp", "phonefile.vcf"); | 943 | return locateLocal("tmp", "phonefile.vcf"); |
934 | #else | 944 | #else |
935 | return "/tmp/phonefile.vcf"; | 945 | return "/tmp/phonefile.vcf"; |
936 | #endif | 946 | #endif |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 02fc40a..272f2eb 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -289,100 +289,102 @@ void KAddressBookTableView::readConfig(KConfig *config) | |||
289 | // Restore the layout of the listview | 289 | // Restore the layout of the listview |
290 | mListView->restoreLayout(config, config->group()); | 290 | mListView->restoreLayout(config, config->group()); |
291 | } | 291 | } |
292 | 292 | ||
293 | void KAddressBookTableView::refresh(QString uid) | 293 | void KAddressBookTableView::refresh(QString uid) |
294 | { | 294 | { |
295 | // For now just repopulate. In reality this method should | 295 | // For now just repopulate. In reality this method should |
296 | // check the value of uid, and if valid iterate through | 296 | // check the value of uid, and if valid iterate through |
297 | // the listview to find the entry, then tell it to refresh. | 297 | // the listview to find the entry, then tell it to refresh. |
298 | 298 | ||
299 | if (uid.isNull()) { | 299 | if (uid.isNull()) { |
300 | // Clear the list view | 300 | // Clear the list view |
301 | QString currentUID, nextUID; | 301 | QString currentUID, nextUID; |
302 | #ifndef KAB_EMBEDDED | 302 | #ifndef KAB_EMBEDDED |
303 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 303 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |
304 | #else //KAB_EMBEDDED | 304 | #else //KAB_EMBEDDED |
305 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); | 305 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); |
306 | #endif //KAB_EMBEDDED | 306 | #endif //KAB_EMBEDDED |
307 | 307 | ||
308 | if ( currentItem ) { | 308 | if ( currentItem ) { |
309 | #ifndef KAB_EMBEDDED | 309 | #ifndef KAB_EMBEDDED |
310 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); | 310 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); |
311 | #else //KAB_EMBEDDED | 311 | #else //KAB_EMBEDDED |
312 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); | 312 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); |
313 | #endif //KAB_EMBEDDED | 313 | #endif //KAB_EMBEDDED |
314 | if ( nextItem ) | 314 | if ( nextItem ) |
315 | nextUID = nextItem->addressee().uid(); | 315 | nextUID = nextItem->addressee().uid(); |
316 | currentUID = currentItem->addressee().uid(); | 316 | currentUID = currentItem->addressee().uid(); |
317 | } | 317 | } |
318 | 318 | ||
319 | mListView->clear(); | 319 | mListView->clear(); |
320 | 320 | ||
321 | currentItem = 0; | 321 | currentItem = 0; |
322 | KABC::Addressee::List addresseeList = addressees(); | 322 | KABC::Addressee::List addresseeList = addressees(); |
323 | KABC::Addressee::List::Iterator it; | 323 | KABC::Addressee::List::Iterator it; |
324 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 324 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
325 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 325 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
326 | continue; | 326 | continue; |
327 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 327 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
328 | if ( (*it).uid() == currentUID ) | 328 | if ( (*it).uid() == currentUID ) |
329 | currentItem = item; | 329 | currentItem = item; |
330 | else if ( (*it).uid() == nextUID && !currentItem ) | 330 | else if ( (*it).uid() == nextUID && !currentItem ) |
331 | currentItem = item; | 331 | currentItem = item; |
332 | } | 332 | } |
333 | 333 | ||
334 | // Sometimes the background pixmap gets messed up when we add lots | 334 | // Sometimes the background pixmap gets messed up when we add lots |
335 | // of items. | 335 | // of items. |
336 | mListView->repaint(); | 336 | mListView->repaint(); |
337 | 337 | if ( !currentItem ) | |
338 | currentItem = (ContactListViewItem *)mListView->firstChild(); | ||
338 | if ( currentItem ) { | 339 | if ( currentItem ) { |
339 | mListView->setCurrentItem( currentItem ); | 340 | mListView->setCurrentItem( currentItem ); |
340 | mListView->ensureItemVisible( currentItem ); | 341 | mListView->ensureItemVisible( currentItem ); |
342 | mListView->setSelected( currentItem, true ); | ||
341 | } | 343 | } |
342 | } else { | 344 | } else { |
343 | // Only need to update on entry. Iterate through and try to find it | 345 | // Only need to update on entry. Iterate through and try to find it |
344 | ContactListViewItem *ceItem; | 346 | ContactListViewItem *ceItem; |
345 | QListViewItemIterator it( mListView ); | 347 | QListViewItemIterator it( mListView ); |
346 | while ( it.current() ) { | 348 | while ( it.current() ) { |
347 | #ifndef KAB_EMBEDDED | 349 | #ifndef KAB_EMBEDDED |
348 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 350 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
349 | #else //KAB_EMBEDDED | 351 | #else //KAB_EMBEDDED |
350 | ceItem = (ContactListViewItem*)( it.current() ); | 352 | ceItem = (ContactListViewItem*)( it.current() ); |
351 | #endif //KAB_EMBEDDED | 353 | #endif //KAB_EMBEDDED |
352 | 354 | ||
353 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 355 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
354 | ceItem->refresh(); | 356 | ceItem->refresh(); |
355 | return; | 357 | return; |
356 | } | 358 | } |
357 | ++it; | 359 | ++it; |
358 | } | 360 | } |
359 | 361 | ||
360 | refresh( QString::null ); | 362 | refresh( QString::null ); |
361 | } | 363 | } |
362 | } | 364 | } |
363 | 365 | ||
364 | QStringList KAddressBookTableView::selectedUids() | 366 | QStringList KAddressBookTableView::selectedUids() |
365 | { | 367 | { |
366 | QStringList uidList; | 368 | QStringList uidList; |
367 | QListViewItem *item; | 369 | QListViewItem *item; |
368 | ContactListViewItem *ceItem; | 370 | ContactListViewItem *ceItem; |
369 | 371 | ||
370 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 372 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
371 | { | 373 | { |
372 | if (mListView->isSelected( item )) | 374 | if (mListView->isSelected( item )) |
373 | { | 375 | { |
374 | #ifndef KAB_EMBEDDED | 376 | #ifndef KAB_EMBEDDED |
375 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 377 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
376 | #else //KAB_EMBEDDED | 378 | #else //KAB_EMBEDDED |
377 | ceItem = (ContactListViewItem*)(item); | 379 | ceItem = (ContactListViewItem*)(item); |
378 | #endif //KAB_EMBEDDED | 380 | #endif //KAB_EMBEDDED |
379 | 381 | ||
380 | if (ceItem != 0L) | 382 | if (ceItem != 0L) |
381 | uidList << ceItem->addressee().uid(); | 383 | uidList << ceItem->addressee().uid(); |
382 | } | 384 | } |
383 | } | 385 | } |
384 | if ( uidList.count() == 0 ) | 386 | if ( uidList.count() == 0 ) |
385 | if ( mListView->currentItem() ) { | 387 | if ( mListView->currentItem() ) { |
386 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; | 388 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; |
387 | uidList << ceItem->addressee().uid(); | 389 | uidList << ceItem->addressee().uid(); |
388 | } | 390 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 8c72d89..70baf5c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -244,170 +244,171 @@ MainWindow::MainWindow( QWidget *parent, const char *name ) : | |||
244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 244 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 245 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
246 | filterToolBar->hide(); | 246 | filterToolBar->hide(); |
247 | } else { | 247 | } else { |
248 | filterToolBar = 0; | 248 | filterToolBar = 0; |
249 | filterMenubar = 0; | 249 | filterMenubar = 0; |
250 | filterPopupMenu = 0; | 250 | filterPopupMenu = 0; |
251 | } | 251 | } |
252 | if ( p->mShowIconOnetoolbar ) { | 252 | if ( p->mShowIconOnetoolbar ) { |
253 | viewToolBar = iconToolBar ; | 253 | viewToolBar = iconToolBar ; |
254 | navigatorToolBar = iconToolBar ; | 254 | navigatorToolBar = iconToolBar ; |
255 | } else { | 255 | } else { |
256 | #ifndef DESKTOP_VERSION | 256 | #ifndef DESKTOP_VERSION |
257 | setToolBarsMovable( false ); | 257 | setToolBarsMovable( false ); |
258 | #endif | 258 | #endif |
259 | if ( p->mToolBarHorV ) { | 259 | if ( p->mToolBarHorV ) { |
260 | if ( p->mToolBarUpV ) | 260 | if ( p->mToolBarUpV ) |
261 | tbd = Bottom; | 261 | tbd = Bottom; |
262 | else | 262 | else |
263 | tbd = Top; | 263 | tbd = Top; |
264 | } | 264 | } |
265 | else { | 265 | else { |
266 | if ( p->mToolBarUpV ) | 266 | if ( p->mToolBarUpV ) |
267 | tbd = Right; | 267 | tbd = Right; |
268 | else | 268 | else |
269 | tbd = Left; | 269 | tbd = Left; |
270 | } | 270 | } |
271 | viewToolBar = new QPEToolBar( this ); | 271 | viewToolBar = new QPEToolBar( this ); |
272 | addToolBar (viewToolBar , tbd ); | 272 | addToolBar (viewToolBar , tbd ); |
273 | if ( p->mToolBarHorN ) { | 273 | if ( p->mToolBarHorN ) { |
274 | if ( p->mToolBarUpN ) | 274 | if ( p->mToolBarUpN ) |
275 | tbd = Bottom; | 275 | tbd = Bottom; |
276 | else | 276 | else |
277 | tbd = Top; | 277 | tbd = Top; |
278 | } | 278 | } |
279 | else { | 279 | else { |
280 | if ( p->mToolBarUpN ) | 280 | if ( p->mToolBarUpN ) |
281 | tbd = Right; | 281 | tbd = Right; |
282 | else | 282 | else |
283 | tbd = Left; | 283 | tbd = Left; |
284 | } | 284 | } |
285 | navigatorToolBar = new QPEToolBar( this ); | 285 | navigatorToolBar = new QPEToolBar( this ); |
286 | addToolBar (navigatorToolBar , tbd ); | 286 | addToolBar (navigatorToolBar , tbd ); |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | 290 | ||
291 | mCalendarModifiedFlag = false; | 291 | mCalendarModifiedFlag = false; |
292 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 292 | // QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
293 | splash->setAlignment ( AlignCenter ); | 293 | //splash->setAlignment ( AlignCenter ); |
294 | setCentralWidget( splash ); | 294 | //setCentralWidget( splash ); |
295 | #ifndef DESKTOP_VERSION | 295 | #ifndef DESKTOP_VERSION |
296 | showMaximized(); | 296 | //showMaximized(); |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 299 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
300 | setDefaultPreferences(); | 300 | setDefaultPreferences(); |
301 | mCalendar = new CalendarLocal(); | 301 | mCalendar = new CalendarLocal(); |
302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 302 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
303 | mView->hide(); | 303 | setCentralWidget( mView ); |
304 | //mView->hide(); | ||
304 | //mView->resize(splash->size() ); | 305 | //mView->resize(splash->size() ); |
305 | initActions(); | 306 | initActions(); |
306 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 307 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
307 | mSyncManager->setBlockSave(false); | 308 | mSyncManager->setBlockSave(false); |
308 | mView->setSyncManager(mSyncManager); | 309 | mView->setSyncManager(mSyncManager); |
309 | #ifndef DESKTOP_VERSION | 310 | #ifndef DESKTOP_VERSION |
310 | iconToolBar->show(); | 311 | iconToolBar->show(); |
311 | qApp->processEvents(); | 312 | qApp->processEvents(); |
312 | #endif | 313 | #endif |
313 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 314 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
314 | int vh = height() ; | 315 | int vh = height() ; |
315 | int vw = width(); | 316 | int vw = width(); |
316 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 317 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
317 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 318 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
318 | vh -= iconToolBar->height(); | 319 | vh -= iconToolBar->height(); |
319 | } else { | 320 | } else { |
320 | vw -= iconToolBar->height(); | 321 | vw -= iconToolBar->height(); |
321 | } | 322 | } |
322 | //mView->setMaximumSize( splash->size() ); | 323 | //mView->setMaximumSize( splash->size() ); |
323 | //mView->resize( splash->size() ); | 324 | //mView->resize( splash->size() ); |
324 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 325 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
325 | mView->readSettings(); | 326 | mView->readSettings(); |
326 | bool newFile = false; | 327 | bool newFile = false; |
327 | if( !QFile::exists( defaultFileName() ) ) { | 328 | if( !QFile::exists( defaultFileName() ) ) { |
328 | QFileInfo finfo ( defaultFileName() ); | 329 | QFileInfo finfo ( defaultFileName() ); |
329 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 330 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
330 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 331 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
331 | finfo.setFile( oldFile ); | 332 | finfo.setFile( oldFile ); |
332 | if (finfo.exists() ) { | 333 | if (finfo.exists() ) { |
333 | KMessageBox::information( this, message); | 334 | KMessageBox::information( this, message); |
334 | mView->openCalendar( oldFile ); | 335 | mView->openCalendar( oldFile ); |
335 | qApp->processEvents(); | 336 | qApp->processEvents(); |
336 | } else { | 337 | } else { |
337 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 338 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
338 | finfo.setFile( oldFile ); | 339 | finfo.setFile( oldFile ); |
339 | if (finfo.exists() ) { | 340 | if (finfo.exists() ) { |
340 | KMessageBox::information( this, message); | 341 | KMessageBox::information( this, message); |
341 | mView->openCalendar( oldFile ); | 342 | mView->openCalendar( oldFile ); |
342 | qApp->processEvents(); | 343 | qApp->processEvents(); |
343 | } | 344 | } |
344 | } | 345 | } |
345 | mView->saveCalendar( defaultFileName() ); | 346 | mView->saveCalendar( defaultFileName() ); |
346 | newFile = true; | 347 | newFile = true; |
347 | } | 348 | } |
348 | 349 | ||
349 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); | 350 | //QTime neededSaveTime = QDateTime::currentDateTime().time(); |
350 | //mView->loadCalendars(); | 351 | //mView->loadCalendars(); |
351 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 352 | //int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
352 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 353 | //qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
353 | 354 | ||
354 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 355 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
355 | KOPrefs::instance()->setAllDefaults(); | 356 | KOPrefs::instance()->setAllDefaults(); |
356 | } | 357 | } |
357 | 358 | ||
358 | 359 | ||
359 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 360 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
360 | SLOT( disableBR(bool) ) ); | 361 | SLOT( disableBR(bool) ) ); |
361 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 362 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
362 | setCentralWidget( mView ); | 363 | setCentralWidget( mView ); |
363 | globalFlagBlockStartup = 0; | 364 | globalFlagBlockStartup = 0; |
364 | mView->show(); | 365 | //mView->show(); |
365 | delete splash; | 366 | //delete splash; |
366 | if ( newFile ) | 367 | if ( newFile ) |
367 | mView->updateConfig(); | 368 | mView->updateConfig(); |
368 | // qApp->processEvents(); | 369 | // qApp->processEvents(); |
369 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 370 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
370 | //fillSyncMenu(); | 371 | //fillSyncMenu(); |
371 | 372 | ||
372 | 373 | ||
373 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 374 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
374 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 375 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
375 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 376 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
376 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 377 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
377 | mSyncManager->setDefaultFileName( sentSyncFile()); | 378 | mSyncManager->setDefaultFileName( sentSyncFile()); |
378 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 379 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
379 | mSyncManager->fillSyncMenu(); | 380 | mSyncManager->fillSyncMenu(); |
380 | 381 | ||
381 | 382 | ||
382 | 383 | ||
383 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 384 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
384 | if ( showWarning ) { | 385 | if ( showWarning ) { |
385 | KMessageBox::information( this, | 386 | KMessageBox::information( this, |
386 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 387 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
387 | qApp->processEvents(); | 388 | qApp->processEvents(); |
388 | mView->dialogManager()->showSyncOptions(); | 389 | mView->dialogManager()->showSyncOptions(); |
389 | } | 390 | } |
390 | 391 | ||
391 | //US listen for result adressed from Ka/Pi | 392 | //US listen for result adressed from Ka/Pi |
392 | 393 | ||
393 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
394 | infrared = 0; | 395 | infrared = 0; |
395 | #endif | 396 | #endif |
396 | updateFilterToolbar(); | 397 | updateFilterToolbar(); |
397 | updateWeek( mView->startDate() ); | 398 | updateWeek( mView->startDate() ); |
398 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 399 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
399 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 400 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
400 | mBRdisabled = false; | 401 | mBRdisabled = false; |
401 | //toggleBeamReceive(); | 402 | //toggleBeamReceive(); |
402 | 403 | ||
403 | setCaption(i18n("Loading calendar files ... please wait" )); | 404 | setCaption(i18n("Loading calendar files ... please wait" )); |
404 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); | 405 | QTimer::singleShot( 10, this, SLOT ( loadDataAfterStart() )); |
405 | } | 406 | } |
406 | MainWindow::~MainWindow() | 407 | MainWindow::~MainWindow() |
407 | { | 408 | { |
408 | //qDebug("MainWindow::~MainWindow() "); | 409 | //qDebug("MainWindow::~MainWindow() "); |
409 | //save toolbar location | 410 | //save toolbar location |
410 | delete mCalendar; | 411 | delete mCalendar; |
411 | delete mSyncManager; | 412 | delete mSyncManager; |
412 | #ifndef DESKTOP_VERSION | 413 | #ifndef DESKTOP_VERSION |
413 | if ( infrared ) | 414 | if ( infrared ) |
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 36ede81..df2aad8 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -1370,103 +1370,103 @@ void KToolBar::childEvent( QChildEvent *e ) | |||
1370 | if ( !widget2id.contains( w ) ) | 1370 | if ( !widget2id.contains( w ) ) |
1371 | { | 1371 | { |
1372 | int dummy = -1; | 1372 | int dummy = -1; |
1373 | insertWidgetInternal( w, dummy, -1 ); | 1373 | insertWidgetInternal( w, dummy, -1 ); |
1374 | } | 1374 | } |
1375 | } | 1375 | } |
1376 | } else { | 1376 | } else { |
1377 | removeWidgetInternal( w ); | 1377 | removeWidgetInternal( w ); |
1378 | } | 1378 | } |
1379 | if ( isVisibleTo( 0 ) ) | 1379 | if ( isVisibleTo( 0 ) ) |
1380 | { | 1380 | { |
1381 | QBoxLayout *l = boxLayout(); | 1381 | QBoxLayout *l = boxLayout(); |
1382 | // QLayout *l = layout(); | 1382 | // QLayout *l = layout(); |
1383 | 1383 | ||
1384 | // clear the old layout so that we don't get unnecassery layout | 1384 | // clear the old layout so that we don't get unnecassery layout |
1385 | // changes till we have rebuild the thing | 1385 | // changes till we have rebuild the thing |
1386 | QLayoutIterator it = l->iterator(); | 1386 | QLayoutIterator it = l->iterator(); |
1387 | while ( it.current() ) { | 1387 | while ( it.current() ) { |
1388 | it.deleteCurrent(); | 1388 | it.deleteCurrent(); |
1389 | } | 1389 | } |
1390 | layoutTimer->start( 50, TRUE ); | 1390 | layoutTimer->start( 50, TRUE ); |
1391 | } | 1391 | } |
1392 | } | 1392 | } |
1393 | QToolBar::childEvent( e ); | 1393 | QToolBar::childEvent( e ); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) | 1396 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) |
1397 | { | 1397 | { |
1398 | // we can't have it in widgets, or something is really wrong | 1398 | // we can't have it in widgets, or something is really wrong |
1399 | //widgets.removeRef( w ); | 1399 | //widgets.removeRef( w ); |
1400 | 1400 | ||
1401 | connect( w, SIGNAL( destroyed() ), | 1401 | connect( w, SIGNAL( destroyed() ), |
1402 | this, SLOT( widgetDestroyed() ) ); | 1402 | this, SLOT( widgetDestroyed() ) ); |
1403 | if ( index == -1 || index > (int)widgets.count() ) { | 1403 | if ( index == -1 || index > (int)widgets.count() ) { |
1404 | widgets.append( w ); | 1404 | widgets.append( w ); |
1405 | index = (int)widgets.count(); | 1405 | index = (int)widgets.count(); |
1406 | } | 1406 | } |
1407 | else | 1407 | else |
1408 | widgets.insert( index, w ); | 1408 | widgets.insert( index, w ); |
1409 | if ( id == -1 ) | 1409 | if ( id == -1 ) |
1410 | id = id2widget.count(); | 1410 | id = id2widget.count(); |
1411 | id2widget.insert( id, w ); | 1411 | id2widget.insert( id, w ); |
1412 | widget2id.insert( w, id ); | 1412 | widget2id.insert( w, id ); |
1413 | } | 1413 | } |
1414 | void KToolBar::repaintMe() | 1414 | void KToolBar::repaintMe() |
1415 | { | 1415 | { |
1416 | setUpdatesEnabled( true ); | 1416 | setUpdatesEnabled( true ); |
1417 | QToolBar::repaint( true ); | 1417 | QToolBar::repaint( true ); |
1418 | //qDebug(" KToolBar::repaintMe() "); | 1418 | qDebug(" KToolBar::repaintMe() "); |
1419 | } | 1419 | } |
1420 | 1420 | ||
1421 | void KToolBar::showEvent( QShowEvent *e ) | 1421 | void KToolBar::showEvent( QShowEvent *e ) |
1422 | { | 1422 | { |
1423 | QToolBar::showEvent( e ); | ||
1424 | rebuildLayout(); | 1423 | rebuildLayout(); |
1424 | QToolBar::showEvent( e ); | ||
1425 | } | 1425 | } |
1426 | 1426 | ||
1427 | void KToolBar::setStretchableWidget( QWidget *w ) | 1427 | void KToolBar::setStretchableWidget( QWidget *w ) |
1428 | { | 1428 | { |
1429 | QToolBar::setStretchableWidget( w ); | 1429 | QToolBar::setStretchableWidget( w ); |
1430 | stretchableWidget = w; | 1430 | stretchableWidget = w; |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | QSizePolicy KToolBar::sizePolicy() const | 1433 | QSizePolicy KToolBar::sizePolicy() const |
1434 | { | 1434 | { |
1435 | if ( orientation() == Horizontal ) | 1435 | if ( orientation() == Horizontal ) |
1436 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); | 1436 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); |
1437 | else | 1437 | else |
1438 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); | 1438 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | QSize KToolBar::sizeHint() const | 1441 | QSize KToolBar::sizeHint() const |
1442 | { | 1442 | { |
1443 | return QToolBar::sizeHint(); | 1443 | return QToolBar::sizeHint(); |
1444 | #if 0 | 1444 | #if 0 |
1445 | QWidget::polish(); | 1445 | QWidget::polish(); |
1446 | static int iii = 0; | 1446 | static int iii = 0; |
1447 | ++iii; | 1447 | ++iii; |
1448 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); | 1448 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); |
1449 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); | 1449 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); |
1450 | switch( barPos() ) | 1450 | switch( barPos() ) |
1451 | { | 1451 | { |
1452 | case KToolBar::Top: | 1452 | case KToolBar::Top: |
1453 | case KToolBar::Bottom: | 1453 | case KToolBar::Bottom: |
1454 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) | 1454 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) |
1455 | { | 1455 | { |
1456 | if ( w->inherits( "KToolBarSeparator" ) && | 1456 | if ( w->inherits( "KToolBarSeparator" ) && |
1457 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1457 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1458 | { | 1458 | { |
1459 | minSize += QSize(6, 0); | 1459 | minSize += QSize(6, 0); |
1460 | } | 1460 | } |
1461 | else | 1461 | else |
1462 | { | 1462 | { |
1463 | QSize sh = w->sizeHint(); | 1463 | QSize sh = w->sizeHint(); |
1464 | if (!sh.isValid()) | 1464 | if (!sh.isValid()) |
1465 | sh = w->minimumSize(); | 1465 | sh = w->minimumSize(); |
1466 | minSize = minSize.expandedTo(QSize(0, sh.height())); | 1466 | minSize = minSize.expandedTo(QSize(0, sh.height())); |
1467 | minSize += QSize(sh.width()+1, 0); | 1467 | minSize += QSize(sh.width()+1, 0); |
1468 | } | 1468 | } |
1469 | } | 1469 | } |
1470 | /*US | 1470 | /*US |
1471 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); | 1471 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); |
1472 | */ | 1472 | */ |