summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/storagehowto.txt80
-rw-r--r--desktop/rpm/kdepim_rpm2
-rw-r--r--kaddressbook/kabcore.cpp13
-rw-r--r--kaddressbook/kabcore.h2
-rw-r--r--korganizer/mainwindow.cpp10
-rw-r--r--korganizer/mainwindow.h1
-rw-r--r--version2
7 files changed, 106 insertions, 4 deletions
diff --git a/bin/kdepim/storagehowto.txt b/bin/kdepim/storagehowto.txt
new file mode 100644
index 0000000..4bb036b
--- a/dev/null
+++ b/bin/kdepim/storagehowto.txt
@@ -0,0 +1,80 @@
1
2KDE-Pim/Pi Storage HowTo
3
4As a default KDE-Pim/Pi is storing it's configuration and application (contacts and calendar) data in the directory <yourHome>/kdepim/.
5This Howto is about to change these settings.
6
7CONTENT:
8
90) General problems
101) Zaurus and desktop settings
112) Additional settings for the desktop
123) Technical background information
13
14********************************************
150) General problems
16********************************************
17
18There is no problem if you start KDE-Pim/Pi, set the storage dir and restart KDE-Pim/Pi and import all your data.
19In general you can copy your data to another directory and set this a the new storage dir. The only problem are the absolute paths in the KA/Pi resource configuration.
20KA/Pi stores it's resource information in the file <storageDir>/config/kabcrc.
21Change the absolute paths there if you changed your storageDir or (that is recommended) change the path of the resources in the KA/Pi resource configuration directly.
22
23********************************************
241) Zaurus and desktop settings
25********************************************
26
27You can access the global settings from KA/Pi and from KO/Pi.
28To change the storage dir go to configure dialog. Choose there the "Global" TAB and there the "Data storage path" TAB.
29Change the value of the current storage path to a new (absolute) path and press the button "Save settings".
30Restart the application.
31Import your data to the application or copy the old storage dir to the new dir. Solve the KA/Pi resource path problem as in 0).
32
33********************************************
342) Additional settings for the desktop
35********************************************
36
37The LOCAL option:
38In the desktop versions (NOT on the Zaurus) you have the possibility to set the storage dir relative to the executable binary.
39That does mean: You can copy all the data (binaries, config data, application data) of the directory where the binaries are to another directory and it will find all files without needing to change anything. NO resource path change is needed.
40In this LOCAL mode only resource files are supported (no resource directories) and only in the <storageDir>/apps/kabc/ directory (the default directory).
41
42To set the LOCAL mode go to configure dialog. Choose there the "Global" TAB and there the "Data storage path" TAB.
43Press there the button "Save using LOCAL storage".
44Restart the application.
45
46This LOCAL mode makes it possible to run KO/Pi and KA/Pi from a USB stick:
47All data is read from and written to the stick.
48Just put KDE-Pim/Pi on a memory stick and you can access all your PIM data on every computer with Windows XP. It will work with the ME and Linux versions as well.
49
50********************************************
513) Technical background information
52********************************************
53
54Directly after the start KDE-Pim/Pi looks for the evironment variable MICROKDEHOME.
55If the variable is set, the path in the MICROKDEHOME is used as the storage dir. End.
56
57If MICROKDEHOME is not set ( what is usually the case ), then
58
59###DESKTOP_VERSION ONLY###
60It looks for the file .microkdehome in the directory of the binary.
61(That file is written by pressing the "Save using LOCAL storage" button in the "Data storage path" TAB ).
62If this file is found, it sets the path in the this file as the storage dir.End.
63If the path starts with a LOCAL:
64it sets the environment variable LOCALMICROKDEHOME to the path of the binary
65and takes that path as storage dir.End.
66
67If the file .microkdehome in the directory of the binary is not found:
68###DESKTOP_VERSION ONLY END###
69
70It looks for the file .microkdehome in the home directory of the user.
71(That file is written by pressing the "Save settings" button in the "Data storage path" TAB ).
72If this file is found, it sets the path in this file as the storage dir.End.
73
74If the file .microkdehome in the home directory of the user is not found, it sets the
75<yourHome>/kdepim/ directory as the storage dir.
76End of setting the storage dir.
77
78If KA/Pi opens a resource it looks for the environment variable LOCALMICROKDEHOME.
79If the variable is set, the file resource takes the path in LOCALMICROKDEHOME to find it's file.
80
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm
index 088d3fe..5e7783b 100644
--- a/desktop/rpm/kdepim_rpm
+++ b/desktop/rpm/kdepim_rpm
@@ -1,84 +1,84 @@
1Summary: A collection of PIM programs 1Summary: A collection of PIM programs
2Name: KDE-Pim-Pi 2Name: KDE-Pim-Pi
3Version: 2.0.23 3Version: 2.0.24
4Release: SuSE_9.2 4Release: SuSE_9.2
5Copyright:GPL 5Copyright:GPL
6Group: Productivity/Pim 6Group: Productivity/Pim
7Source:http://sourceforge.net/projects/kdepimpi/ 7Source:http://sourceforge.net/projects/kdepimpi/
8URL:http://sourceforge.net/projects/kdepimpi/ 8URL:http://sourceforge.net/projects/kdepimpi/
9Packager: zautrix 9Packager: zautrix
10 10
11%description 11%description
12This package contains the platform-independent PIM programs from 12This package contains the platform-independent PIM programs from
13www.pi-sync.info, compiled for SuSE 9.2: 13www.pi-sync.info, compiled for SuSE 9.2:
14KTimeTacker/Pi 14KTimeTacker/Pi
15KPhone/Pi 15KPhone/Pi
16KAddressbook/Pi 16KAddressbook/Pi
17KOrganizer/Pi 17KOrganizer/Pi
18PasswordManager/Pi 18PasswordManager/Pi
19KOPieMail/Pi 19KOPieMail/Pi
20 20
21These applications do not need anything from the KDE-desktop 21These applications do not need anything from the KDE-desktop
22at all to run on Linux. However, there is a dependency from 22at all to run on Linux. However, there is a dependency from
23two KDE libs, because a small command line program is included 23two KDE libs, because a small command line program is included
24to make it possible to sync with the KDE-desktop applications. 24to make it possible to sync with the KDE-desktop applications.
25 25
26These applications are independent from the KDE-desktop 26These applications are independent from the KDE-desktop
27environment. That means, nothing of your existing 27environment. That means, nothing of your existing
28KDE-desktop setup will be changed, or any data 28KDE-desktop setup will be changed, or any data
29(calendar-addressbook) used by the KDE-desktop 29(calendar-addressbook) used by the KDE-desktop
30applications will be changed or accessed. 30applications will be changed or accessed.
31These applications stores their data and config in 31These applications stores their data and config in
32$HOME/kdepim/ 32$HOME/kdepim/
33However, because the same file format is used, 33However, because the same file format is used,
34an easy exchange of data with the KDE-desktop 34an easy exchange of data with the KDE-desktop
35is possible. 35is possible.
36A small command line program is included 36A small command line program is included
37to make it possible to sync with the KDE-desktop applications. 37to make it possible to sync with the KDE-desktop applications.
38You do not need to call this program from the commandline, 38You do not need to call this program from the commandline,
39it is called from the KDE-Pim/Pi apps when you choose there: 39it is called from the KDE-Pim/Pi apps when you choose there:
40Sync with KDE_Desktop. 40Sync with KDE_Desktop.
41If something is going wrong, please start the 41If something is going wrong, please start the
42KDE-Pim/Pi program itself from the console to get detailed output. 42KDE-Pim/Pi program itself from the console to get detailed output.
43 43
44After installation, you should have a 44After installation, you should have a
45PIM-pi 45PIM-pi
46folder in your KDE start menu, where you can 46folder in your KDE start menu, where you can
47start the applications from. 47start the applications from.
48 48
49These programs makes it possible to sync your Zaurus easily 49These programs makes it possible to sync your Zaurus easily
50(with the KDE-Pim/Pi programs running on the Zaurus) 50(with the KDE-Pim/Pi programs running on the Zaurus)
51with the KDE-desktop calendar/addressbook data. 51with the KDE-desktop calendar/addressbook data.
52If you want to use that, you have to update your 52If you want to use that, you have to update your
53KDE-desktop to version 3.3.0 or higher. 53KDE-desktop to version 3.3.0 or higher.
54SuSE 9.2 contains KDE 3.3.0 such that no update is needed. 54SuSE 9.2 contains KDE 3.3.0 such that no update is needed.
55Actually - after the (non difficult) configuration is set up - 55Actually - after the (non difficult) configuration is set up -
56with two mouseklicks on the Zaurus, 56with two mouseklicks on the Zaurus,
57the Zaurus syncs with the corresponding KDE-Pim/Pi 57the Zaurus syncs with the corresponding KDE-Pim/Pi
58program on the Linux Desktop which syncs automatically 58program on the Linux Desktop which syncs automatically
59with the KDE-desktop data. 59with the KDE-desktop data.
60 60
61If you want to use the KDE-desktop calendar/addressbook applications, 61If you want to use the KDE-desktop calendar/addressbook applications,
62just install these apps in this package and use them as a syncing tool for the 62just install these apps in this package and use them as a syncing tool for the
63Zaurus <-> KDE-desktop sync. 63Zaurus <-> KDE-desktop sync.
64The sync requires a network connection from your Zaurus to 64The sync requires a network connection from your Zaurus to
65the PC. A detailed Sync HowTo is available in the 65the PC. A detailed Sync HowTo is available in the
66Help menu of the applications. 66Help menu of the applications.
67 67
68These applications makes it also possible, that you can sync 68These applications makes it also possible, that you can sync
69(or just export the data to) your mobile phone with your 69(or just export the data to) your mobile phone with your
70data of the KDE-desktop calendar/addressbook applications. 70data of the KDE-desktop calendar/addressbook applications.
71This is tested and working for Nokia mobile phones, 71This is tested and working for Nokia mobile phones,
72it may work with others as well. 72it may work with others as well.
73(More info about that: -> Sync HowTo) 73(More info about that: -> Sync HowTo)
74 74
75NOTE: 75NOTE:
76When using SuSE 9.1 you have to update your KDE to 3.3.x 76When using SuSE 9.1 you have to update your KDE to 3.3.x
77and you have to make an online update in SuSE 9.1 to make it 77and you have to make an online update in SuSE 9.1 to make it
78possible to get the infrared connection working, such that 78possible to get the infrared connection working, such that
79you can sync your (Nokia) mobile phone via infrared. 79you can sync your (Nokia) mobile phone via infrared.
80 80
81%files 81%files
82/opt/kde3/share/applnk/PIM-pi/ 82/opt/kde3/share/applnk/PIM-pi/
83/opt/kdepimpi/ 83/opt/kdepimpi/
84/usr/lib/libmicro* 84/usr/lib/libmicro*
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index ce5c755..eba74a6 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -565,2835 +565,2846 @@ void KABCore::saveSettings()
565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 565 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 566 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
567#endif //KAB_EMBEDDED 567#endif //KAB_EMBEDDED
568 mExtensionManager->saveSettings(); 568 mExtensionManager->saveSettings();
569 mViewManager->saveSettings(); 569 mViewManager->saveSettings();
570 570
571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 571 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
572 KABPrefs::instance()->writeConfig(); 572 KABPrefs::instance()->writeConfig();
573 qDebug("KA: KABCore::saveSettings() "); 573 qDebug("KA: KABCore::saveSettings() ");
574} 574}
575 575
576KABC::AddressBook *KABCore::addressBook() const 576KABC::AddressBook *KABCore::addressBook() const
577{ 577{
578 return mAddressBook; 578 return mAddressBook;
579} 579}
580 580
581KConfig *KABCore::config() 581KConfig *KABCore::config()
582{ 582{
583#ifndef KAB_EMBEDDED 583#ifndef KAB_EMBEDDED
584 return KABPrefs::instance()->config(); 584 return KABPrefs::instance()->config();
585#else //KAB_EMBEDDED 585#else //KAB_EMBEDDED
586 return KABPrefs::instance()->getConfig(); 586 return KABPrefs::instance()->getConfig();
587#endif //KAB_EMBEDDED 587#endif //KAB_EMBEDDED
588} 588}
589 589
590KActionCollection *KABCore::actionCollection() const 590KActionCollection *KABCore::actionCollection() const
591{ 591{
592 return mGUIClient->actionCollection(); 592 return mGUIClient->actionCollection();
593} 593}
594 594
595KABC::Field *KABCore::currentSearchField() const 595KABC::Field *KABCore::currentSearchField() const
596{ 596{
597 if (mIncSearchWidget) 597 if (mIncSearchWidget)
598 return mIncSearchWidget->currentField(); 598 return mIncSearchWidget->currentField();
599 else 599 else
600 return 0; 600 return 0;
601} 601}
602 602
603QStringList KABCore::selectedUIDs() const 603QStringList KABCore::selectedUIDs() const
604{ 604{
605 return mViewManager->selectedUids(); 605 return mViewManager->selectedUids();
606} 606}
607 607
608KABC::Resource *KABCore::requestResource( QWidget *parent ) 608KABC::Resource *KABCore::requestResource( QWidget *parent )
609{ 609{
610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 610 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
611 611
612 QPtrList<KRES::Resource> kresResources; 612 QPtrList<KRES::Resource> kresResources;
613 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 613 QPtrListIterator<KABC::Resource> resIt( kabcResources );
614 KABC::Resource *resource; 614 KABC::Resource *resource;
615 while ( ( resource = resIt.current() ) != 0 ) { 615 while ( ( resource = resIt.current() ) != 0 ) {
616 ++resIt; 616 ++resIt;
617 if ( !resource->readOnly() ) { 617 if ( !resource->readOnly() ) {
618 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 618 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
619 if ( res ) 619 if ( res )
620 kresResources.append( res ); 620 kresResources.append( res );
621 } 621 }
622 } 622 }
623 623
624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 624 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
625 return static_cast<KABC::Resource*>( res ); 625 return static_cast<KABC::Resource*>( res );
626} 626}
627 627
628#ifndef KAB_EMBEDDED 628#ifndef KAB_EMBEDDED
629KAboutData *KABCore::createAboutData() 629KAboutData *KABCore::createAboutData()
630#else //KAB_EMBEDDED 630#else //KAB_EMBEDDED
631void KABCore::createAboutData() 631void KABCore::createAboutData()
632#endif //KAB_EMBEDDED 632#endif //KAB_EMBEDDED
633{ 633{
634#ifndef KAB_EMBEDDED 634#ifndef KAB_EMBEDDED
635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 635 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
636 "3.1", I18N_NOOP( "The KDE Address Book" ), 636 "3.1", I18N_NOOP( "The KDE Address Book" ),
637 KAboutData::License_GPL_V2, 637 KAboutData::License_GPL_V2,
638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 638 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 639 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 640 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
641 about->addAuthor( "Cornelius Schumacher", 641 about->addAuthor( "Cornelius Schumacher",
642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 642 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
643 "schumacher@kde.org" ); 643 "schumacher@kde.org" );
644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 644 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
645 "mpilone@slac.com" ); 645 "mpilone@slac.com" );
646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 646 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 647 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 648 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
649 "michel@klaralvdalens-datakonsult.se" ); 649 "michel@klaralvdalens-datakonsult.se" );
650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 650 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
651 "hansen@kde.org" ); 651 "hansen@kde.org" );
652 652
653 return about; 653 return about;
654#endif //KAB_EMBEDDED 654#endif //KAB_EMBEDDED
655 655
656 QString version; 656 QString version;
657#include <../version> 657#include <../version>
658 QMessageBox::about( this, "About KAddressbook/Pi", 658 QMessageBox::about( this, "About KAddressbook/Pi",
659 "KAddressbook/Platform-independent\n" 659 "KAddressbook/Platform-independent\n"
660 "(KA/Pi) " +version + " - " + 660 "(KA/Pi) " +version + " - " +
661#ifdef DESKTOP_VERSION 661#ifdef DESKTOP_VERSION
662 "Desktop Edition\n" 662 "Desktop Edition\n"
663#else 663#else
664 "PDA-Edition\n" 664 "PDA-Edition\n"
665 "for: Zaurus 5500 / 7x0 / 8x0\n" 665 "for: Zaurus 5500 / 7x0 / 8x0\n"
666#endif 666#endif
667 667
668 "(c) 2004 Ulf Schenk\n" 668 "(c) 2004 Ulf Schenk\n"
669 "(c) 2004 Lutz Rogowski\n" 669 "(c) 2004 Lutz Rogowski\n"
670 "(c) 1997-2003, The KDE PIM Team\n" 670 "(c) 1997-2003, The KDE PIM Team\n"
671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 671 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
672 "Don Sanders Original author\n" 672 "Don Sanders Original author\n"
673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 673 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 674 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
675 "Greg Stern DCOP interface\n" 675 "Greg Stern DCOP interface\n"
676 "Mark Westcot Contact pinning\n" 676 "Mark Westcot Contact pinning\n"
677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 677 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 678 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
679#ifdef _WIN32_ 679#ifdef _WIN32_
680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 680 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
681#endif 681#endif
682 ); 682 );
683} 683}
684 684
685void KABCore::setContactSelected( const QString &uid ) 685void KABCore::setContactSelected( const QString &uid )
686{ 686{
687 KABC::Addressee addr = mAddressBook->findByUid( uid ); 687 KABC::Addressee addr = mAddressBook->findByUid( uid );
688 if ( !mDetails->isHidden() ) 688 if ( !mDetails->isHidden() )
689 mDetails->setAddressee( addr ); 689 mDetails->setAddressee( addr );
690 690
691 if ( !addr.isEmpty() ) { 691 if ( !addr.isEmpty() ) {
692 emit contactSelected( addr.formattedName() ); 692 emit contactSelected( addr.formattedName() );
693 KABC::Picture pic = addr.photo(); 693 KABC::Picture pic = addr.photo();
694 if ( pic.isIntern() ) { 694 if ( pic.isIntern() ) {
695//US emit contactSelected( pic.data() ); 695//US emit contactSelected( pic.data() );
696//US instead use: 696//US instead use:
697 QPixmap px; 697 QPixmap px;
698 if (pic.data().isNull() != true) 698 if (pic.data().isNull() != true)
699 { 699 {
700 px.convertFromImage(pic.data()); 700 px.convertFromImage(pic.data());
701 } 701 }
702 702
703 emit contactSelected( px ); 703 emit contactSelected( px );
704 } 704 }
705 } 705 }
706 706
707 707
708 mExtensionManager->setSelectionChanged(); 708 mExtensionManager->setSelectionChanged();
709 709
710 // update the actions 710 // update the actions
711 bool selected = !uid.isEmpty(); 711 bool selected = !uid.isEmpty();
712 712
713 if ( mReadWrite ) { 713 if ( mReadWrite ) {
714 mActionCut->setEnabled( selected ); 714 mActionCut->setEnabled( selected );
715 mActionPaste->setEnabled( selected ); 715 mActionPaste->setEnabled( selected );
716 } 716 }
717 717
718 mActionCopy->setEnabled( selected ); 718 mActionCopy->setEnabled( selected );
719 mActionDelete->setEnabled( selected ); 719 mActionDelete->setEnabled( selected );
720 mActionEditAddressee->setEnabled( selected ); 720 mActionEditAddressee->setEnabled( selected );
721 mActionMail->setEnabled( selected ); 721 mActionMail->setEnabled( selected );
722 mActionMailVCard->setEnabled( selected ); 722 mActionMailVCard->setEnabled( selected );
723 //if (mActionBeam) 723 //if (mActionBeam)
724 //mActionBeam->setEnabled( selected ); 724 //mActionBeam->setEnabled( selected );
725 mActionWhoAmI->setEnabled( selected ); 725 mActionWhoAmI->setEnabled( selected );
726} 726}
727 727
728void KABCore::sendMail() 728void KABCore::sendMail()
729{ 729{
730 sendMail( mViewManager->selectedEmails().join( ", " ) ); 730 sendMail( mViewManager->selectedEmails().join( ", " ) );
731} 731}
732 732
733void KABCore::sendMail( const QString& emaillist ) 733void KABCore::sendMail( const QString& emaillist )
734{ 734{
735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 735 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
736 if (emaillist.contains(",") > 0) 736 if (emaillist.contains(",") > 0)
737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 737 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
738 else 738 else
739 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 739 ExternalAppHandler::instance()->mailToOneContact( emaillist );
740} 740}
741 741
742 742
743 743
744void KABCore::mailVCard() 744void KABCore::mailVCard()
745{ 745{
746 QStringList uids = mViewManager->selectedUids(); 746 QStringList uids = mViewManager->selectedUids();
747 if ( !uids.isEmpty() ) 747 if ( !uids.isEmpty() )
748 mailVCard( uids ); 748 mailVCard( uids );
749} 749}
750 750
751void KABCore::mailVCard( const QStringList& uids ) 751void KABCore::mailVCard( const QStringList& uids )
752{ 752{
753 QStringList urls; 753 QStringList urls;
754 754
755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
756 756
757 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 757 QString dirName = "/tmp/" + KApplication::randomString( 8 );
758 758
759 759
760 760
761 QDir().mkdir( dirName, true ); 761 QDir().mkdir( dirName, true );
762 762
763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
764 KABC::Addressee a = mAddressBook->findByUid( *it ); 764 KABC::Addressee a = mAddressBook->findByUid( *it );
765 765
766 if ( a.isEmpty() ) 766 if ( a.isEmpty() )
767 continue; 767 continue;
768 768
769 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 769 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
770 770
771 QString fileName = dirName + "/" + name; 771 QString fileName = dirName + "/" + name;
772 772
773 QFile outFile(fileName); 773 QFile outFile(fileName);
774 774
775 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 775 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
776 KABC::VCardConverter converter; 776 KABC::VCardConverter converter;
777 QString vcard; 777 QString vcard;
778 778
779 converter.addresseeToVCard( a, vcard ); 779 converter.addresseeToVCard( a, vcard );
780 780
781 QTextStream t( &outFile ); // use a text stream 781 QTextStream t( &outFile ); // use a text stream
782 t.setEncoding( QTextStream::UnicodeUTF8 ); 782 t.setEncoding( QTextStream::UnicodeUTF8 );
783 t << vcard; 783 t << vcard;
784 784
785 outFile.close(); 785 outFile.close();
786 786
787 urls.append( fileName ); 787 urls.append( fileName );
788 } 788 }
789 } 789 }
790 790
791 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 791 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
792 792
793 793
794/*US 794/*US
795 kapp->invokeMailer( QString::null, QString::null, QString::null, 795 kapp->invokeMailer( QString::null, QString::null, QString::null,
796 QString::null, // subject 796 QString::null, // subject
797 QString::null, // body 797 QString::null, // body
798 QString::null, 798 QString::null,
799 urls ); // attachments 799 urls ); // attachments
800*/ 800*/
801 801
802} 802}
803 803
804/** 804/**
805 Beams the "WhoAmI contact. 805 Beams the "WhoAmI contact.
806*/ 806*/
807void KABCore::beamMySelf() 807void KABCore::beamMySelf()
808{ 808{
809 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 809 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
810 if (!a.isEmpty()) 810 if (!a.isEmpty())
811 { 811 {
812 QStringList uids; 812 QStringList uids;
813 uids << a.uid(); 813 uids << a.uid();
814 814
815 beamVCard(uids); 815 beamVCard(uids);
816 } else { 816 } else {
817 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 817 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
818 818
819 819
820 } 820 }
821} 821}
822void KABCore::updateMainWindow() 822void KABCore::updateMainWindow()
823{ 823{
824 mMainWindow->showMaximized(); 824 mMainWindow->showMaximized();
825 mMainWindow->update(); 825 mMainWindow->update();
826} 826}
827void KABCore::resizeEvent(QResizeEvent* e ) 827void KABCore::resizeEvent(QResizeEvent* e )
828{ 828{
829 if ( !mMiniSplitter ) 829 if ( !mMiniSplitter )
830 return; 830 return;
831 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 831 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
832 if ( QApplication::desktop()->width() >= 480 ) { 832 if ( QApplication::desktop()->width() >= 480 ) {
833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
834 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 834 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
835 mMiniSplitter->setOrientation( Qt::Horizontal); 835 mMiniSplitter->setOrientation( Qt::Horizontal);
836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
837 } 837 }
838 if ( QApplication::desktop()->width() <= 640 ) { 838 if ( QApplication::desktop()->width() <= 640 ) {
839 mMainWindow->showMinimized(); 839 mMainWindow->showMinimized();
840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
841 mViewManager->getFilterAction()->setComboWidth( 150 ); 841 mViewManager->getFilterAction()->setComboWidth( 150 );
842 if ( mIncSearchWidget ) 842 if ( mIncSearchWidget )
843 mIncSearchWidget->setSize(); 843 mIncSearchWidget->setSize();
844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
845 } 845 }
846 846
847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
849 mMiniSplitter->setOrientation( Qt::Vertical ); 849 mMiniSplitter->setOrientation( Qt::Vertical );
850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
851 } 851 }
852 if ( QApplication::desktop()->width() <= 640 ) { 852 if ( QApplication::desktop()->width() <= 640 ) {
853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
854 mMainWindow->showMinimized(); 854 mMainWindow->showMinimized();
855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
856 if ( mIncSearchWidget ) { 856 if ( mIncSearchWidget ) {
857 mIncSearchWidget->setSize(); 857 mIncSearchWidget->setSize();
858 } 858 }
859 } else { 859 } else {
860 mViewManager->getFilterAction()->setComboWidth( 0 ); 860 mViewManager->getFilterAction()->setComboWidth( 0 );
861 } 861 }
862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
863 } 863 }
864 } 864 }
865 } 865 }
866 QWidget::resizeEvent( e ); 866 QWidget::resizeEvent( e );
867 867
868} 868}
869void KABCore::export2phone() 869void KABCore::export2phone()
870{ 870{
871 871
872 QStringList uids; 872 QStringList uids;
873 XXPortSelectDialog dlg( this, false, this ); 873 XXPortSelectDialog dlg( this, false, this );
874 if ( dlg.exec() ) 874 if ( dlg.exec() )
875 uids = dlg.uids(); 875 uids = dlg.uids();
876 else 876 else
877 return; 877 return;
878 if ( uids.isEmpty() ) 878 if ( uids.isEmpty() )
879 return; 879 return;
880 // qDebug("count %d ", uids.count()); 880 // qDebug("count %d ", uids.count());
881 881
882 KAex2phonePrefs ex2phone; 882 KAex2phonePrefs ex2phone;
883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
886 886
887 if ( !ex2phone.exec() ) { 887 if ( !ex2phone.exec() ) {
888 return; 888 return;
889 } 889 }
890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
893 893
894 894
895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
896 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 896 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
897 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 897 KPimGlobalPrefs::instance()->mEx2PhoneModel );
898 898
899 QString fileName = getPhoneFile(); 899 QString fileName = getPhoneFile();
900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
901 return; 901 return;
902 902
903 message(i18n("Exporting to phone...")); 903 message(i18n("Exporting to phone..."));
904 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 904 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
905 905
906} 906}
907QString KABCore::getPhoneFile() 907QString KABCore::getPhoneFile()
908{ 908{
909#ifdef DESKTOP_VERSION 909#ifdef DESKTOP_VERSION
910 return locateLocal("tmp", "phonefile.vcf"); 910 return locateLocal("tmp", "phonefile.vcf");
911#else 911#else
912 return "/tmp/phonefile.vcf"; 912 return "/tmp/phonefile.vcf";
913#endif 913#endif
914 914
915} 915}
916void KABCore::writeToPhone( ) 916void KABCore::writeToPhone( )
917{ 917{
918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
919 message(i18n("Export to phone finished!")); 919 message(i18n("Export to phone finished!"));
920 else 920 else
921 qDebug(i18n("KA: Error exporting to phone")); 921 qDebug(i18n("KA: Error exporting to phone"));
922} 922}
923void KABCore::beamVCard() 923void KABCore::beamVCard()
924{ 924{
925 QStringList uids; 925 QStringList uids;
926 XXPortSelectDialog dlg( this, false, this ); 926 XXPortSelectDialog dlg( this, false, this );
927 if ( dlg.exec() ) 927 if ( dlg.exec() )
928 uids = dlg.uids(); 928 uids = dlg.uids();
929 else 929 else
930 return; 930 return;
931 if ( uids.isEmpty() ) 931 if ( uids.isEmpty() )
932 return; 932 return;
933 beamVCard( uids ); 933 beamVCard( uids );
934} 934}
935 935
936 936
937void KABCore::beamVCard(const QStringList& uids) 937void KABCore::beamVCard(const QStringList& uids)
938{ 938{
939 939
940 // LR: we should use the /tmp dir on the Zaurus, 940 // LR: we should use the /tmp dir on the Zaurus,
941 // because: /tmp = RAM, (HOME)/kdepim = flash memory 941 // because: /tmp = RAM, (HOME)/kdepim = flash memory
942 942
943#ifdef DESKTOP_VERSION 943#ifdef DESKTOP_VERSION
944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
945#else 945#else
946 QString fileName = "/tmp/kapibeamfile.vcf"; 946 QString fileName = "/tmp/kapibeamfile.vcf";
947#endif 947#endif
948 948
949 KABC::VCardConverter converter; 949 KABC::VCardConverter converter;
950 QString description; 950 QString description;
951 QString datastream; 951 QString datastream;
952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
953 KABC::Addressee a = mAddressBook->findByUid( *it ); 953 KABC::Addressee a = mAddressBook->findByUid( *it );
954 954
955 if ( a.isEmpty() ) 955 if ( a.isEmpty() )
956 continue; 956 continue;
957 957
958 if (description.isEmpty()) 958 if (description.isEmpty())
959 description = a.formattedName(); 959 description = a.formattedName();
960 960
961 QString vcard; 961 QString vcard;
962 converter.addresseeToVCard( a, vcard ); 962 converter.addresseeToVCard( a, vcard );
963 int start = 0; 963 int start = 0;
964 int next; 964 int next;
965 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 965 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
966 int semi = vcard.find(";", next); 966 int semi = vcard.find(";", next);
967 int dopp = vcard.find(":", next); 967 int dopp = vcard.find(":", next);
968 int sep; 968 int sep;
969 if ( semi < dopp && semi >= 0 ) 969 if ( semi < dopp && semi >= 0 )
970 sep = semi ; 970 sep = semi ;
971 else 971 else
972 sep = dopp; 972 sep = dopp;
973 datastream +=vcard.mid( start, next - start); 973 datastream +=vcard.mid( start, next - start);
974 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 974 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
975 start = sep; 975 start = sep;
976 } 976 }
977 datastream += vcard.mid( start,vcard.length() ); 977 datastream += vcard.mid( start,vcard.length() );
978 } 978 }
979#ifndef DESKTOP_VERSION 979#ifndef DESKTOP_VERSION
980 QFile outFile(fileName); 980 QFile outFile(fileName);
981 if ( outFile.open(IO_WriteOnly) ) { 981 if ( outFile.open(IO_WriteOnly) ) {
982 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 982 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
983 QTextStream t( &outFile ); // use a text stream 983 QTextStream t( &outFile ); // use a text stream
984 //t.setEncoding( QTextStream::UnicodeUTF8 ); 984 //t.setEncoding( QTextStream::UnicodeUTF8 );
985 t.setEncoding( QTextStream::Latin1 ); 985 t.setEncoding( QTextStream::Latin1 );
986 t <<datastream.latin1(); 986 t <<datastream.latin1();
987 outFile.close(); 987 outFile.close();
988 Ir *ir = new Ir( this ); 988 Ir *ir = new Ir( this );
989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 989 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
990 ir->send( fileName, description, "text/x-vCard" ); 990 ir->send( fileName, description, "text/x-vCard" );
991 } else { 991 } else {
992 qDebug("KA: Error open temp beam file "); 992 qDebug("KA: Error open temp beam file ");
993 return; 993 return;
994 } 994 }
995#endif 995#endif
996 996
997} 997}
998 998
999void KABCore::beamDone( Ir *ir ) 999void KABCore::beamDone( Ir *ir )
1000{ 1000{
1001#ifndef DESKTOP_VERSION 1001#ifndef DESKTOP_VERSION
1002 delete ir; 1002 delete ir;
1003#endif 1003#endif
1004 topLevelWidget()->raise(); 1004 topLevelWidget()->raise();
1005 message( i18n("Beaming finished!") ); 1005 message( i18n("Beaming finished!") );
1006} 1006}
1007 1007
1008 1008
1009void KABCore::browse( const QString& url ) 1009void KABCore::browse( const QString& url )
1010{ 1010{
1011#ifndef KAB_EMBEDDED 1011#ifndef KAB_EMBEDDED
1012 kapp->invokeBrowser( url ); 1012 kapp->invokeBrowser( url );
1013#else //KAB_EMBEDDED 1013#else //KAB_EMBEDDED
1014 qDebug("KABCore::browse must be fixed"); 1014 qDebug("KABCore::browse must be fixed");
1015#endif //KAB_EMBEDDED 1015#endif //KAB_EMBEDDED
1016} 1016}
1017 1017
1018void KABCore::selectAllContacts() 1018void KABCore::selectAllContacts()
1019{ 1019{
1020 mViewManager->setSelected( QString::null, true ); 1020 mViewManager->setSelected( QString::null, true );
1021} 1021}
1022 1022
1023void KABCore::deleteContacts() 1023void KABCore::deleteContacts()
1024{ 1024{
1025 QStringList uidList = mViewManager->selectedUids(); 1025 QStringList uidList = mViewManager->selectedUids();
1026 deleteContacts( uidList ); 1026 deleteContacts( uidList );
1027} 1027}
1028 1028
1029void KABCore::deleteContacts( const QStringList &uids ) 1029void KABCore::deleteContacts( const QStringList &uids )
1030{ 1030{
1031 if ( uids.count() > 0 ) { 1031 if ( uids.count() > 0 ) {
1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1032 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1033 UndoStack::instance()->push( command ); 1033 UndoStack::instance()->push( command );
1034 RedoStack::instance()->clear(); 1034 RedoStack::instance()->clear();
1035 1035
1036 // now if we deleted anything, refresh 1036 // now if we deleted anything, refresh
1037 setContactSelected( QString::null ); 1037 setContactSelected( QString::null );
1038 setModified( true ); 1038 setModified( true );
1039 } 1039 }
1040} 1040}
1041 1041
1042void KABCore::copyContacts() 1042void KABCore::copyContacts()
1043{ 1043{
1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1044 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1045 1045
1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1046 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1047 1047
1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1048 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1049 1049
1050 QClipboard *cb = QApplication::clipboard(); 1050 QClipboard *cb = QApplication::clipboard();
1051 cb->setText( clipText ); 1051 cb->setText( clipText );
1052} 1052}
1053 1053
1054void KABCore::cutContacts() 1054void KABCore::cutContacts()
1055{ 1055{
1056 QStringList uidList = mViewManager->selectedUids(); 1056 QStringList uidList = mViewManager->selectedUids();
1057 1057
1058//US if ( uidList.size() > 0 ) { 1058//US if ( uidList.size() > 0 ) {
1059 if ( uidList.count() > 0 ) { 1059 if ( uidList.count() > 0 ) {
1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1060 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1061 UndoStack::instance()->push( command ); 1061 UndoStack::instance()->push( command );
1062 RedoStack::instance()->clear(); 1062 RedoStack::instance()->clear();
1063 1063
1064 setModified( true ); 1064 setModified( true );
1065 } 1065 }
1066} 1066}
1067 1067
1068void KABCore::pasteContacts() 1068void KABCore::pasteContacts()
1069{ 1069{
1070 QClipboard *cb = QApplication::clipboard(); 1070 QClipboard *cb = QApplication::clipboard();
1071 1071
1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1072 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1073 1073
1074 pasteContacts( list ); 1074 pasteContacts( list );
1075} 1075}
1076 1076
1077void KABCore::pasteContacts( KABC::Addressee::List &list ) 1077void KABCore::pasteContacts( KABC::Addressee::List &list )
1078{ 1078{
1079 KABC::Resource *resource = requestResource( this ); 1079 KABC::Resource *resource = requestResource( this );
1080 KABC::Addressee::List::Iterator it; 1080 KABC::Addressee::List::Iterator it;
1081 for ( it = list.begin(); it != list.end(); ++it ) 1081 for ( it = list.begin(); it != list.end(); ++it )
1082 (*it).setResource( resource ); 1082 (*it).setResource( resource );
1083 1083
1084 PwPasteCommand *command = new PwPasteCommand( this, list ); 1084 PwPasteCommand *command = new PwPasteCommand( this, list );
1085 UndoStack::instance()->push( command ); 1085 UndoStack::instance()->push( command );
1086 RedoStack::instance()->clear(); 1086 RedoStack::instance()->clear();
1087 1087
1088 setModified( true ); 1088 setModified( true );
1089} 1089}
1090 1090
1091void KABCore::setWhoAmI() 1091void KABCore::setWhoAmI()
1092{ 1092{
1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1093 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1094 1094
1095 if ( addrList.count() > 1 ) { 1095 if ( addrList.count() > 1 ) {
1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1096 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1097 return; 1097 return;
1098 } 1098 }
1099 1099
1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1100 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1101 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1102 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1103} 1103}
1104void KABCore::editCategories() 1104void KABCore::editCategories()
1105{ 1105{
1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1106 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1107 dlg.exec(); 1107 dlg.exec();
1108} 1108}
1109void KABCore::setCategories() 1109void KABCore::setCategories()
1110{ 1110{
1111 1111
1112 QStringList uids; 1112 QStringList uids;
1113 XXPortSelectDialog dlgx( this, false, this ); 1113 XXPortSelectDialog dlgx( this, false, this );
1114 if ( dlgx.exec() ) 1114 if ( dlgx.exec() )
1115 uids = dlgx.uids(); 1115 uids = dlgx.uids();
1116 else 1116 else
1117 return; 1117 return;
1118 if ( uids.isEmpty() ) 1118 if ( uids.isEmpty() )
1119 return; 1119 return;
1120 // qDebug("count %d ", uids.count()); 1120 // qDebug("count %d ", uids.count());
1121 1121
1122 1122
1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1123 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1124 if ( !dlg.exec() ) { 1124 if ( !dlg.exec() ) {
1125 message( i18n("Setting categories cancelled") ); 1125 message( i18n("Setting categories cancelled") );
1126 return; 1126 return;
1127 } 1127 }
1128 bool merge = false; 1128 bool merge = false;
1129 QString msg = i18n( "Merge with existing categories?" ); 1129 QString msg = i18n( "Merge with existing categories?" );
1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1130 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1131 merge = true; 1131 merge = true;
1132 1132
1133 message( i18n("Setting categories ... please wait!") ); 1133 message( i18n("Setting categories ... please wait!") );
1134 QStringList categories = dlg.selectedCategories(); 1134 QStringList categories = dlg.selectedCategories();
1135 1135
1136 //QStringList uids = mViewManager->selectedUids(); 1136 //QStringList uids = mViewManager->selectedUids();
1137 QStringList::Iterator it; 1137 QStringList::Iterator it;
1138 for ( it = uids.begin(); it != uids.end(); ++it ) { 1138 for ( it = uids.begin(); it != uids.end(); ++it ) {
1139 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1139 KABC::Addressee addr = mAddressBook->findByUid( *it );
1140 if ( !addr.isEmpty() ) { 1140 if ( !addr.isEmpty() ) {
1141 if ( !merge ) 1141 if ( !merge )
1142 addr.setCategories( categories ); 1142 addr.setCategories( categories );
1143 else { 1143 else {
1144 QStringList addrCategories = addr.categories(); 1144 QStringList addrCategories = addr.categories();
1145 QStringList::Iterator catIt; 1145 QStringList::Iterator catIt;
1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1146 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1147 if ( !addrCategories.contains( *catIt ) ) 1147 if ( !addrCategories.contains( *catIt ) )
1148 addrCategories.append( *catIt ); 1148 addrCategories.append( *catIt );
1149 } 1149 }
1150 addr.setCategories( addrCategories ); 1150 addr.setCategories( addrCategories );
1151 } 1151 }
1152 mAddressBook->insertAddressee( addr ); 1152 mAddressBook->insertAddressee( addr );
1153 } 1153 }
1154 } 1154 }
1155 1155
1156 if ( uids.count() > 0 ) 1156 if ( uids.count() > 0 )
1157 setModified( true ); 1157 setModified( true );
1158 message( i18n("Setting categories completed!") ); 1158 message( i18n("Setting categories completed!") );
1159} 1159}
1160 1160
1161void KABCore::setSearchFields( const KABC::Field::List &fields ) 1161void KABCore::setSearchFields( const KABC::Field::List &fields )
1162{ 1162{
1163 mIncSearchWidget->setFields( fields ); 1163 mIncSearchWidget->setFields( fields );
1164} 1164}
1165 1165
1166void KABCore::incrementalSearch( const QString& text ) 1166void KABCore::incrementalSearch( const QString& text )
1167{ 1167{
1168 QString stext; 1168 QString stext;
1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { 1169 if ( KABPrefs::instance()->mAutoSearchWithWildcard ) {
1170 stext = "*" + text; 1170 stext = "*" + text;
1171 } else { 1171 } else {
1172 stext = text; 1172 stext = text;
1173 } 1173 }
1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); 1174 mViewManager->doSearch( stext, mIncSearchWidget->currentField() );
1175} 1175}
1176void KABCore::incrementalSearchJump( const QString& text ) 1176void KABCore::incrementalSearchJump( const QString& text )
1177{ 1177{
1178 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1178 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1179} 1179}
1180 1180
1181void KABCore::setModified() 1181void KABCore::setModified()
1182{ 1182{
1183 setModified( true ); 1183 setModified( true );
1184} 1184}
1185 1185
1186void KABCore::setModifiedWOrefresh() 1186void KABCore::setModifiedWOrefresh()
1187{ 1187{
1188 // qDebug("KABCore::setModifiedWOrefresh() "); 1188 // qDebug("KABCore::setModifiedWOrefresh() ");
1189 mModified = true; 1189 mModified = true;
1190 mActionSave->setEnabled( mModified ); 1190 mActionSave->setEnabled( mModified );
1191 1191
1192 1192
1193} 1193}
1194void KABCore::setModified( bool modified ) 1194void KABCore::setModified( bool modified )
1195{ 1195{
1196 mModified = modified; 1196 mModified = modified;
1197 mActionSave->setEnabled( mModified ); 1197 mActionSave->setEnabled( mModified );
1198 1198
1199 if ( modified ) 1199 if ( modified )
1200 mJumpButtonBar->recreateButtons(); 1200 mJumpButtonBar->recreateButtons();
1201 1201
1202 mViewManager->refreshView(); 1202 mViewManager->refreshView();
1203 1203
1204} 1204}
1205 1205
1206bool KABCore::modified() const 1206bool KABCore::modified() const
1207{ 1207{
1208 return mModified; 1208 return mModified;
1209} 1209}
1210 1210
1211void KABCore::contactModified( const KABC::Addressee &addr ) 1211void KABCore::contactModified( const KABC::Addressee &addr )
1212{ 1212{
1213 addrModified( addr ); 1213 addrModified( addr );
1214#if 0 // debug only 1214#if 0 // debug only
1215 KABC::Addressee ad = addr; 1215 KABC::Addressee ad = addr;
1216 ad.computeCsum( "123"); 1216 ad.computeCsum( "123");
1217#endif 1217#endif
1218} 1218}
1219 1219
1220void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1220void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1221{ 1221{
1222 1222
1223 Command *command = 0; 1223 Command *command = 0;
1224 QString uid; 1224 QString uid;
1225 1225
1226 // check if it exists already 1226 // check if it exists already
1227 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1227 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1228 if ( origAddr.isEmpty() ) 1228 if ( origAddr.isEmpty() )
1229 command = new PwNewCommand( mAddressBook, addr ); 1229 command = new PwNewCommand( mAddressBook, addr );
1230 else { 1230 else {
1231 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1231 command = new PwEditCommand( mAddressBook, origAddr, addr );
1232 uid = addr.uid(); 1232 uid = addr.uid();
1233 } 1233 }
1234 1234
1235 UndoStack::instance()->push( command ); 1235 UndoStack::instance()->push( command );
1236 RedoStack::instance()->clear(); 1236 RedoStack::instance()->clear();
1237 if ( updateDetails ) 1237 if ( updateDetails )
1238 mDetails->setAddressee( addr ); 1238 mDetails->setAddressee( addr );
1239 setModified( true ); 1239 setModified( true );
1240} 1240}
1241 1241
1242void KABCore::newContact() 1242void KABCore::newContact()
1243{ 1243{
1244 1244
1245 1245
1246 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1246 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1247 1247
1248 QPtrList<KRES::Resource> kresResources; 1248 QPtrList<KRES::Resource> kresResources;
1249 QPtrListIterator<KABC::Resource> it( kabcResources ); 1249 QPtrListIterator<KABC::Resource> it( kabcResources );
1250 KABC::Resource *resource; 1250 KABC::Resource *resource;
1251 while ( ( resource = it.current() ) != 0 ) { 1251 while ( ( resource = it.current() ) != 0 ) {
1252 ++it; 1252 ++it;
1253 if ( !resource->readOnly() ) { 1253 if ( !resource->readOnly() ) {
1254 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1254 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1255 if ( res ) 1255 if ( res )
1256 kresResources.append( res ); 1256 kresResources.append( res );
1257 } 1257 }
1258 } 1258 }
1259 1259
1260 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1260 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1261 resource = static_cast<KABC::Resource*>( res ); 1261 resource = static_cast<KABC::Resource*>( res );
1262 1262
1263 if ( resource ) { 1263 if ( resource ) {
1264 KABC::Addressee addr; 1264 KABC::Addressee addr;
1265 addr.setResource( resource ); 1265 addr.setResource( resource );
1266 mEditorDialog->setAddressee( addr ); 1266 mEditorDialog->setAddressee( addr );
1267 mEditorDialog->setCaption( i18n("Edit new contact")); 1267 mEditorDialog->setCaption( i18n("Edit new contact"));
1268 KApplication::execDialog ( mEditorDialog ); 1268 KApplication::execDialog ( mEditorDialog );
1269 1269
1270 } else 1270 } else
1271 return; 1271 return;
1272 1272
1273 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1273 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1274 1274
1275 1275
1276} 1276}
1277 1277
1278void KABCore::addEmail( QString aStr ) 1278void KABCore::addEmail( QString aStr )
1279{ 1279{
1280#ifndef KAB_EMBEDDED 1280#ifndef KAB_EMBEDDED
1281 QString fullName, email; 1281 QString fullName, email;
1282 1282
1283 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1283 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1284 1284
1285 // Try to lookup the addressee matching the email address 1285 // Try to lookup the addressee matching the email address
1286 bool found = false; 1286 bool found = false;
1287 QStringList emailList; 1287 QStringList emailList;
1288 KABC::AddressBook::Iterator it; 1288 KABC::AddressBook::Iterator it;
1289 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1289 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1290 emailList = (*it).emails(); 1290 emailList = (*it).emails();
1291 if ( emailList.contains( email ) > 0 ) { 1291 if ( emailList.contains( email ) > 0 ) {
1292 found = true; 1292 found = true;
1293 (*it).setNameFromString( fullName ); 1293 (*it).setNameFromString( fullName );
1294 editContact( (*it).uid() ); 1294 editContact( (*it).uid() );
1295 } 1295 }
1296 } 1296 }
1297 1297
1298 if ( !found ) { 1298 if ( !found ) {
1299 KABC::Addressee addr; 1299 KABC::Addressee addr;
1300 addr.setNameFromString( fullName ); 1300 addr.setNameFromString( fullName );
1301 addr.insertEmail( email, true ); 1301 addr.insertEmail( email, true );
1302 1302
1303 mAddressBook->insertAddressee( addr ); 1303 mAddressBook->insertAddressee( addr );
1304 mViewManager->refreshView( addr.uid() ); 1304 mViewManager->refreshView( addr.uid() );
1305 editContact( addr.uid() ); 1305 editContact( addr.uid() );
1306 } 1306 }
1307#else //KAB_EMBEDDED 1307#else //KAB_EMBEDDED
1308 qDebug("KABCore::addEmail finsih method"); 1308 qDebug("KABCore::addEmail finsih method");
1309#endif //KAB_EMBEDDED 1309#endif //KAB_EMBEDDED
1310} 1310}
1311 1311
1312void KABCore::importVCard( const KURL &url, bool showPreview ) 1312void KABCore::importVCard( const KURL &url, bool showPreview )
1313{ 1313{
1314 mXXPortManager->importVCard( url, showPreview ); 1314 mXXPortManager->importVCard( url, showPreview );
1315} 1315}
1316void KABCore::importFromOL() 1316void KABCore::importFromOL()
1317{ 1317{
1318#ifdef _OL_IMPORT_ 1318#ifdef _OL_IMPORT_
1319 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1319 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1320 idgl->exec(); 1320 idgl->exec();
1321 KABC::Addressee::List list = idgl->getAddressList(); 1321 KABC::Addressee::List list = idgl->getAddressList();
1322 if ( list.count() > 0 ) { 1322 if ( list.count() > 0 ) {
1323 KABC::Addressee::List listNew; 1323 KABC::Addressee::List listNew;
1324 KABC::Addressee::List listExisting; 1324 KABC::Addressee::List listExisting;
1325 KABC::Addressee::List::Iterator it; 1325 KABC::Addressee::List::Iterator it;
1326 KABC::AddressBook::Iterator iter; 1326 KABC::AddressBook::Iterator iter;
1327 for ( it = list.begin(); it != list.end(); ++it ) { 1327 for ( it = list.begin(); it != list.end(); ++it ) {
1328 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1328 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1329 listNew.append( (*it) ); 1329 listNew.append( (*it) );
1330 else 1330 else
1331 listExisting.append( (*it) ); 1331 listExisting.append( (*it) );
1332 } 1332 }
1333 if ( listExisting.count() > 0 ) 1333 if ( listExisting.count() > 0 )
1334 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1334 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1335 if ( listNew.count() > 0 ) { 1335 if ( listNew.count() > 0 ) {
1336 pasteWithNewUid = false; 1336 pasteWithNewUid = false;
1337 pasteContacts( listNew ); 1337 pasteContacts( listNew );
1338 pasteWithNewUid = true; 1338 pasteWithNewUid = true;
1339 } 1339 }
1340 } 1340 }
1341 delete idgl; 1341 delete idgl;
1342#endif 1342#endif
1343} 1343}
1344 1344
1345void KABCore::importVCard( const QString &vCard, bool showPreview ) 1345void KABCore::importVCard( const QString &vCard, bool showPreview )
1346{ 1346{
1347 mXXPortManager->importVCard( vCard, showPreview ); 1347 mXXPortManager->importVCard( vCard, showPreview );
1348} 1348}
1349 1349
1350//US added a second method without defaultparameter 1350//US added a second method without defaultparameter
1351void KABCore::editContact2() { 1351void KABCore::editContact2() {
1352 editContact( QString::null ); 1352 editContact( QString::null );
1353} 1353}
1354 1354
1355void KABCore::editContact( const QString &uid ) 1355void KABCore::editContact( const QString &uid )
1356{ 1356{
1357 1357
1358 if ( mExtensionManager->isQuickEditVisible() ) 1358 if ( mExtensionManager->isQuickEditVisible() )
1359 return; 1359 return;
1360 1360
1361 // First, locate the contact entry 1361 // First, locate the contact entry
1362 QString localUID = uid; 1362 QString localUID = uid;
1363 if ( localUID.isNull() ) { 1363 if ( localUID.isNull() ) {
1364 QStringList uidList = mViewManager->selectedUids(); 1364 QStringList uidList = mViewManager->selectedUids();
1365 if ( uidList.count() > 0 ) 1365 if ( uidList.count() > 0 )
1366 localUID = *( uidList.at( 0 ) ); 1366 localUID = *( uidList.at( 0 ) );
1367 } 1367 }
1368 1368
1369 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1369 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1370 if ( !addr.isEmpty() ) { 1370 if ( !addr.isEmpty() ) {
1371 mEditorDialog->setAddressee( addr ); 1371 mEditorDialog->setAddressee( addr );
1372 KApplication::execDialog ( mEditorDialog ); 1372 KApplication::execDialog ( mEditorDialog );
1373 } 1373 }
1374} 1374}
1375 1375
1376/** 1376/**
1377 Shows or edits the detail view for the given uid. If the uid is QString::null, 1377 Shows or edits the detail view for the given uid. If the uid is QString::null,
1378 the method will try to find a selected addressee in the view. 1378 the method will try to find a selected addressee in the view.
1379 */ 1379 */
1380void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1380void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1381{ 1381{
1382 if ( mMultipleViewsAtOnce ) 1382 if ( mMultipleViewsAtOnce )
1383 { 1383 {
1384 editContact( uid ); 1384 editContact( uid );
1385 } 1385 }
1386 else 1386 else
1387 { 1387 {
1388 setDetailsVisible( true ); 1388 setDetailsVisible( true );
1389 mActionDetails->setChecked(true); 1389 mActionDetails->setChecked(true);
1390 } 1390 }
1391 1391
1392} 1392}
1393 1393
1394void KABCore::save() 1394void KABCore::save()
1395{ 1395{
1396 if (syncManager->blockSave()) 1396 if (syncManager->blockSave())
1397 return; 1397 return;
1398 if ( !mModified ) 1398 if ( !mModified )
1399 return; 1399 return;
1400 1400
1401 syncManager->setBlockSave(true); 1401 syncManager->setBlockSave(true);
1402 QString text = i18n( "There was an error while attempting to save\n the " 1402 QString text = i18n( "There was an error while attempting to save\n the "
1403 "address book. Please check that some \nother application is " 1403 "address book. Please check that some \nother application is "
1404 "not using it. " ); 1404 "not using it. " );
1405 message(i18n("Saving ... please wait! "), false); 1405 message(i18n("Saving ... please wait! "), false);
1406 //qApp->processEvents(); 1406 //qApp->processEvents();
1407#ifndef KAB_EMBEDDED 1407#ifndef KAB_EMBEDDED
1408 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1408 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1409 if ( !b || !b->save() ) { 1409 if ( !b || !b->save() ) {
1410 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1410 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1411 } 1411 }
1412#else //KAB_EMBEDDED 1412#else //KAB_EMBEDDED
1413 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1413 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1414 if ( !b || !b->save() ) { 1414 if ( !b || !b->save() ) {
1415 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1415 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1416 } 1416 }
1417#endif //KAB_EMBEDDED 1417#endif //KAB_EMBEDDED
1418 1418
1419 message(i18n("Addressbook saved!")); 1419 message(i18n("Addressbook saved!"));
1420 setModified( false ); 1420 setModified( false );
1421 syncManager->setBlockSave(false); 1421 syncManager->setBlockSave(false);
1422} 1422}
1423 1423
1424 1424
1425void KABCore::undo() 1425void KABCore::undo()
1426{ 1426{
1427 UndoStack::instance()->undo(); 1427 UndoStack::instance()->undo();
1428 1428
1429 // Refresh the view 1429 // Refresh the view
1430 mViewManager->refreshView(); 1430 mViewManager->refreshView();
1431} 1431}
1432 1432
1433void KABCore::redo() 1433void KABCore::redo()
1434{ 1434{
1435 RedoStack::instance()->redo(); 1435 RedoStack::instance()->redo();
1436 1436
1437 // Refresh the view 1437 // Refresh the view
1438 mViewManager->refreshView(); 1438 mViewManager->refreshView();
1439} 1439}
1440void KABCore::setJumpButtonBar( bool visible ) 1440void KABCore::setJumpButtonBar( bool visible )
1441{ 1441{
1442 setJumpButtonBarVisible(visible ); 1442 setJumpButtonBarVisible(visible );
1443 saveSettings(); 1443 saveSettings();
1444} 1444}
1445void KABCore::setJumpButtonBarVisible( bool visible ) 1445void KABCore::setJumpButtonBarVisible( bool visible )
1446{ 1446{
1447 if (mMultipleViewsAtOnce) 1447 if (mMultipleViewsAtOnce)
1448 { 1448 {
1449 if ( visible ) 1449 if ( visible )
1450 mJumpButtonBar->show(); 1450 mJumpButtonBar->show();
1451 else 1451 else
1452 mJumpButtonBar->hide(); 1452 mJumpButtonBar->hide();
1453 } 1453 }
1454 else 1454 else
1455 { 1455 {
1456 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1456 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1457 if (mViewManager->isVisible()) 1457 if (mViewManager->isVisible())
1458 { 1458 {
1459 if ( visible ) 1459 if ( visible )
1460 mJumpButtonBar->show(); 1460 mJumpButtonBar->show();
1461 else 1461 else
1462 mJumpButtonBar->hide(); 1462 mJumpButtonBar->hide();
1463 } 1463 }
1464 else 1464 else
1465 { 1465 {
1466 mJumpButtonBar->hide(); 1466 mJumpButtonBar->hide();
1467 } 1467 }
1468 } 1468 }
1469 if ( visible ) { 1469 if ( visible ) {
1470 if ( mIncSearchWidget->currentItem() == 0 ) { 1470 if ( mIncSearchWidget->currentItem() == 0 ) {
1471 message( i18n("Change search field enable jump bar") ); 1471 message( i18n("Change search field enable jump bar") );
1472 } 1472 }
1473 } 1473 }
1474} 1474}
1475 1475
1476 1476
1477void KABCore::setDetailsToState() 1477void KABCore::setDetailsToState()
1478{ 1478{
1479 setDetailsVisible( mActionDetails->isChecked() ); 1479 setDetailsVisible( mActionDetails->isChecked() );
1480} 1480}
1481void KABCore::setDetailsToggle() 1481void KABCore::setDetailsToggle()
1482{ 1482{
1483 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1483 mActionDetails->setChecked( !mActionDetails->isChecked() );
1484 setDetailsToState(); 1484 setDetailsToState();
1485} 1485}
1486 1486
1487 1487
1488 1488
1489void KABCore::setDetailsVisible( bool visible ) 1489void KABCore::setDetailsVisible( bool visible )
1490{ 1490{
1491 if (visible && mDetails->isHidden()) 1491 if (visible && mDetails->isHidden())
1492 { 1492 {
1493 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1493 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1494 if ( addrList.count() > 0 ) 1494 if ( addrList.count() > 0 )
1495 mDetails->setAddressee( addrList[ 0 ] ); 1495 mDetails->setAddressee( addrList[ 0 ] );
1496 } 1496 }
1497 1497
1498 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1498 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1499 // the listview and the detailview. We do that by changing the splitbar size. 1499 // the listview and the detailview. We do that by changing the splitbar size.
1500 if (mMultipleViewsAtOnce) 1500 if (mMultipleViewsAtOnce)
1501 { 1501 {
1502 if ( visible ) 1502 if ( visible )
1503 mDetails->show(); 1503 mDetails->show();
1504 else 1504 else
1505 mDetails->hide(); 1505 mDetails->hide();
1506 } 1506 }
1507 else 1507 else
1508 { 1508 {
1509 if ( visible ) { 1509 if ( visible ) {
1510 mViewManager->hide(); 1510 mViewManager->hide();
1511 mDetails->show(); 1511 mDetails->show();
1512 mIncSearchWidget->setFocus(); 1512 mIncSearchWidget->setFocus();
1513 } 1513 }
1514 else { 1514 else {
1515 mViewManager->show(); 1515 mViewManager->show();
1516 mDetails->hide(); 1516 mDetails->hide();
1517 mViewManager->setFocusAV(); 1517 mViewManager->setFocusAV();
1518 } 1518 }
1519 setJumpButtonBarVisible( !visible ); 1519 setJumpButtonBarVisible( !visible );
1520 } 1520 }
1521 1521
1522} 1522}
1523 1523
1524void KABCore::extensionChanged( int id ) 1524void KABCore::extensionChanged( int id )
1525{ 1525{
1526 //change the details view only for non desktop systems 1526 //change the details view only for non desktop systems
1527#ifndef DESKTOP_VERSION 1527#ifndef DESKTOP_VERSION
1528 1528
1529 if (id == 0) 1529 if (id == 0)
1530 { 1530 {
1531 //the user disabled the extension. 1531 //the user disabled the extension.
1532 1532
1533 if (mMultipleViewsAtOnce) 1533 if (mMultipleViewsAtOnce)
1534 { // enable detailsview again 1534 { // enable detailsview again
1535 setDetailsVisible( true ); 1535 setDetailsVisible( true );
1536 mActionDetails->setChecked( true ); 1536 mActionDetails->setChecked( true );
1537 } 1537 }
1538 else 1538 else
1539 { //go back to the listview 1539 { //go back to the listview
1540 setDetailsVisible( false ); 1540 setDetailsVisible( false );
1541 mActionDetails->setChecked( false ); 1541 mActionDetails->setChecked( false );
1542 mActionDetails->setEnabled(true); 1542 mActionDetails->setEnabled(true);
1543 } 1543 }
1544 1544
1545 } 1545 }
1546 else 1546 else
1547 { 1547 {
1548 //the user enabled the extension. 1548 //the user enabled the extension.
1549 setDetailsVisible( false ); 1549 setDetailsVisible( false );
1550 mActionDetails->setChecked( false ); 1550 mActionDetails->setChecked( false );
1551 1551
1552 if (!mMultipleViewsAtOnce) 1552 if (!mMultipleViewsAtOnce)
1553 { 1553 {
1554 mActionDetails->setEnabled(false); 1554 mActionDetails->setEnabled(false);
1555 } 1555 }
1556 1556
1557 mExtensionManager->setSelectionChanged(); 1557 mExtensionManager->setSelectionChanged();
1558 1558
1559 } 1559 }
1560 1560
1561#endif// DESKTOP_VERSION 1561#endif// DESKTOP_VERSION
1562 1562
1563} 1563}
1564 1564
1565 1565
1566void KABCore::extensionModified( const KABC::Addressee::List &list ) 1566void KABCore::extensionModified( const KABC::Addressee::List &list )
1567{ 1567{
1568 1568
1569 if ( list.count() != 0 ) { 1569 if ( list.count() != 0 ) {
1570 KABC::Addressee::List::ConstIterator it; 1570 KABC::Addressee::List::ConstIterator it;
1571 for ( it = list.begin(); it != list.end(); ++it ) 1571 for ( it = list.begin(); it != list.end(); ++it )
1572 mAddressBook->insertAddressee( *it ); 1572 mAddressBook->insertAddressee( *it );
1573 if ( list.count() > 1 ) 1573 if ( list.count() > 1 )
1574 setModified(); 1574 setModified();
1575 else 1575 else
1576 setModifiedWOrefresh(); 1576 setModifiedWOrefresh();
1577 } 1577 }
1578 if ( list.count() == 0 ) 1578 if ( list.count() == 0 )
1579 mViewManager->refreshView(); 1579 mViewManager->refreshView();
1580 else 1580 else
1581 mViewManager->refreshView( list[ 0 ].uid() ); 1581 mViewManager->refreshView( list[ 0 ].uid() );
1582 1582
1583 1583
1584 1584
1585} 1585}
1586 1586
1587QString KABCore::getNameByPhone( const QString &phone ) 1587QString KABCore::getNameByPhone( const QString &phone )
1588{ 1588{
1589#ifndef KAB_EMBEDDED 1589#ifndef KAB_EMBEDDED
1590 QRegExp r( "[/*/-/ ]" ); 1590 QRegExp r( "[/*/-/ ]" );
1591 QString localPhone( phone ); 1591 QString localPhone( phone );
1592 1592
1593 bool found = false; 1593 bool found = false;
1594 QString ownerName = ""; 1594 QString ownerName = "";
1595 KABC::AddressBook::Iterator iter; 1595 KABC::AddressBook::Iterator iter;
1596 KABC::PhoneNumber::List::Iterator phoneIter; 1596 KABC::PhoneNumber::List::Iterator phoneIter;
1597 KABC::PhoneNumber::List phoneList; 1597 KABC::PhoneNumber::List phoneList;
1598 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1598 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1599 phoneList = (*iter).phoneNumbers(); 1599 phoneList = (*iter).phoneNumbers();
1600 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1600 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1601 ++phoneIter) { 1601 ++phoneIter) {
1602 // Get rid of separator chars so just the numbers are compared. 1602 // Get rid of separator chars so just the numbers are compared.
1603 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1603 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1604 ownerName = (*iter).formattedName(); 1604 ownerName = (*iter).formattedName();
1605 found = true; 1605 found = true;
1606 } 1606 }
1607 } 1607 }
1608 } 1608 }
1609 1609
1610 return ownerName; 1610 return ownerName;
1611#else //KAB_EMBEDDED 1611#else //KAB_EMBEDDED
1612 qDebug("KABCore::getNameByPhone finsih method"); 1612 qDebug("KABCore::getNameByPhone finsih method");
1613 return ""; 1613 return "";
1614#endif //KAB_EMBEDDED 1614#endif //KAB_EMBEDDED
1615 1615
1616} 1616}
1617 1617
1618void KABCore::openConfigDialog() 1618void KABCore::openConfigDialog()
1619{ 1619{
1620 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1620 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1621 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1621 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1622 ConfigureDialog->addModule(kabcfg ); 1622 ConfigureDialog->addModule(kabcfg );
1623 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1623 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1624 ConfigureDialog->addModule(kdelibcfg ); 1624 ConfigureDialog->addModule(kdelibcfg );
1625 1625
1626 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1626 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1627 this, SLOT( configurationChanged() ) ); 1627 this, SLOT( configurationChanged() ) );
1628 connect( ConfigureDialog, SIGNAL( okClicked() ), 1628 connect( ConfigureDialog, SIGNAL( okClicked() ),
1629 this, SLOT( configurationChanged() ) ); 1629 this, SLOT( configurationChanged() ) );
1630 saveSettings(); 1630 saveSettings();
1631#ifndef DESKTOP_VERSION 1631#ifndef DESKTOP_VERSION
1632 ConfigureDialog->showMaximized(); 1632 ConfigureDialog->showMaximized();
1633#endif 1633#endif
1634 if ( ConfigureDialog->exec() ) 1634 if ( ConfigureDialog->exec() )
1635 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1635 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1636 delete ConfigureDialog; 1636 delete ConfigureDialog;
1637} 1637}
1638 1638
1639void KABCore::openLDAPDialog() 1639void KABCore::openLDAPDialog()
1640{ 1640{
1641#ifndef KAB_EMBEDDED 1641#ifndef KAB_EMBEDDED
1642 if ( !mLdapSearchDialog ) { 1642 if ( !mLdapSearchDialog ) {
1643 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1643 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1644 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1644 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1645 SLOT( refreshView() ) ); 1645 SLOT( refreshView() ) );
1646 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1646 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1647 SLOT( setModified() ) ); 1647 SLOT( setModified() ) );
1648 } else 1648 } else
1649 mLdapSearchDialog->restoreSettings(); 1649 mLdapSearchDialog->restoreSettings();
1650 1650
1651 if ( mLdapSearchDialog->isOK() ) 1651 if ( mLdapSearchDialog->isOK() )
1652 mLdapSearchDialog->exec(); 1652 mLdapSearchDialog->exec();
1653#else //KAB_EMBEDDED 1653#else //KAB_EMBEDDED
1654 qDebug("KABCore::openLDAPDialog() finsih method"); 1654 qDebug("KABCore::openLDAPDialog() finsih method");
1655#endif //KAB_EMBEDDED 1655#endif //KAB_EMBEDDED
1656} 1656}
1657 1657
1658void KABCore::print() 1658void KABCore::print()
1659{ 1659{
1660#ifndef KAB_EMBEDDED 1660#ifndef KAB_EMBEDDED
1661 KPrinter printer; 1661 KPrinter printer;
1662 if ( !printer.setup( this ) ) 1662 if ( !printer.setup( this ) )
1663 return; 1663 return;
1664 1664
1665 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1665 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1666 mViewManager->selectedUids(), this ); 1666 mViewManager->selectedUids(), this );
1667 1667
1668 wizard.exec(); 1668 wizard.exec();
1669#else //KAB_EMBEDDED 1669#else //KAB_EMBEDDED
1670 qDebug("KABCore::print() finsih method"); 1670 qDebug("KABCore::print() finsih method");
1671#endif //KAB_EMBEDDED 1671#endif //KAB_EMBEDDED
1672 1672
1673} 1673}
1674 1674
1675 1675
1676void KABCore::addGUIClient( KXMLGUIClient *client ) 1676void KABCore::addGUIClient( KXMLGUIClient *client )
1677{ 1677{
1678 if ( mGUIClient ) 1678 if ( mGUIClient )
1679 mGUIClient->insertChildClient( client ); 1679 mGUIClient->insertChildClient( client );
1680 else 1680 else
1681 KMessageBox::error( this, "no KXMLGUICLient"); 1681 KMessageBox::error( this, "no KXMLGUICLient");
1682} 1682}
1683 1683
1684 1684
1685void KABCore::configurationChanged() 1685void KABCore::configurationChanged()
1686{ 1686{
1687 mExtensionManager->reconfigure(); 1687 mExtensionManager->reconfigure();
1688} 1688}
1689 1689
1690void KABCore::addressBookChanged() 1690void KABCore::addressBookChanged()
1691{ 1691{
1692/*US 1692/*US
1693 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1693 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1694 while ( it.current() ) { 1694 while ( it.current() ) {
1695 if ( it.current()->dirty() ) { 1695 if ( it.current()->dirty() ) {
1696 QString text = i18n( "Data has been changed externally. Unsaved " 1696 QString text = i18n( "Data has been changed externally. Unsaved "
1697 "changes will be lost." ); 1697 "changes will be lost." );
1698 KMessageBox::information( this, text ); 1698 KMessageBox::information( this, text );
1699 } 1699 }
1700 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1700 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1701 ++it; 1701 ++it;
1702 } 1702 }
1703*/ 1703*/
1704 if (mEditorDialog) 1704 if (mEditorDialog)
1705 { 1705 {
1706 if (mEditorDialog->dirty()) 1706 if (mEditorDialog->dirty())
1707 { 1707 {
1708 QString text = i18n( "Data has been changed externally. Unsaved " 1708 QString text = i18n( "Data has been changed externally. Unsaved "
1709 "changes will be lost." ); 1709 "changes will be lost." );
1710 KMessageBox::information( this, text ); 1710 KMessageBox::information( this, text );
1711 } 1711 }
1712 QString currentuid = mEditorDialog->addressee().uid(); 1712 QString currentuid = mEditorDialog->addressee().uid();
1713 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1713 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1714 } 1714 }
1715 mViewManager->refreshView(); 1715 mViewManager->refreshView();
1716 1716
1717 1717
1718} 1718}
1719 1719
1720AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1720AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1721 const char *name ) 1721 const char *name )
1722{ 1722{
1723 1723
1724 if ( mEditorDialog == 0 ) { 1724 if ( mEditorDialog == 0 ) {
1725 mEditorDialog = new AddresseeEditorDialog( this, parent, 1725 mEditorDialog = new AddresseeEditorDialog( this, parent,
1726 name ? name : "editorDialog" ); 1726 name ? name : "editorDialog" );
1727 1727
1728 1728
1729 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1729 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1730 SLOT( contactModified( const KABC::Addressee& ) ) ); 1730 SLOT( contactModified( const KABC::Addressee& ) ) );
1731 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1731 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1732 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1732 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1733 } 1733 }
1734 1734
1735 return mEditorDialog; 1735 return mEditorDialog;
1736} 1736}
1737 1737
1738void KABCore::slotEditorDestroyed( const QString &uid ) 1738void KABCore::slotEditorDestroyed( const QString &uid )
1739{ 1739{
1740 //mEditorDict.remove( uid ); 1740 //mEditorDict.remove( uid );
1741} 1741}
1742 1742
1743void KABCore::initGUI() 1743void KABCore::initGUI()
1744{ 1744{
1745#ifndef KAB_EMBEDDED 1745#ifndef KAB_EMBEDDED
1746 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1746 QHBoxLayout *topLayout = new QHBoxLayout( this );
1747 topLayout->setSpacing( KDialogBase::spacingHint() ); 1747 topLayout->setSpacing( KDialogBase::spacingHint() );
1748 1748
1749 mExtensionBarSplitter = new QSplitter( this ); 1749 mExtensionBarSplitter = new QSplitter( this );
1750 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1750 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1751 1751
1752 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1752 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1753 1753
1754 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1754 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1755 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1755 mIncSearchWidget = new IncSearchWidget( viewSpace );
1756 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1756 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1757 SLOT( incrementalSearch( const QString& ) ) ); 1757 SLOT( incrementalSearch( const QString& ) ) );
1758 1758
1759 mViewManager = new ViewManager( this, viewSpace ); 1759 mViewManager = new ViewManager( this, viewSpace );
1760 viewSpace->setStretchFactor( mViewManager, 1 ); 1760 viewSpace->setStretchFactor( mViewManager, 1 );
1761 1761
1762 mDetails = new ViewContainer( mDetailsSplitter ); 1762 mDetails = new ViewContainer( mDetailsSplitter );
1763 1763
1764 mJumpButtonBar = new JumpButtonBar( this, this ); 1764 mJumpButtonBar = new JumpButtonBar( this, this );
1765 1765
1766 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1766 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1767 1767
1768 topLayout->addWidget( mExtensionBarSplitter ); 1768 topLayout->addWidget( mExtensionBarSplitter );
1769 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1769 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1770 topLayout->addWidget( mJumpButtonBar ); 1770 topLayout->addWidget( mJumpButtonBar );
1771 //topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1771 //topLayout->setStretchFactor( mJumpButtonBar, 1 );
1772 1772
1773 mXXPortManager = new XXPortManager( this, this ); 1773 mXXPortManager = new XXPortManager( this, this );
1774 1774
1775#else //KAB_EMBEDDED 1775#else //KAB_EMBEDDED
1776 //US initialize viewMenu before settingup viewmanager. 1776 //US initialize viewMenu before settingup viewmanager.
1777 // Viewmanager needs this menu to plugin submenues. 1777 // Viewmanager needs this menu to plugin submenues.
1778 viewMenu = new QPopupMenu( this ); 1778 viewMenu = new QPopupMenu( this );
1779 settingsMenu = new QPopupMenu( this ); 1779 settingsMenu = new QPopupMenu( this );
1780 //filterMenu = new QPopupMenu( this ); 1780 //filterMenu = new QPopupMenu( this );
1781 ImportMenu = new QPopupMenu( this ); 1781 ImportMenu = new QPopupMenu( this );
1782 ExportMenu = new QPopupMenu( this ); 1782 ExportMenu = new QPopupMenu( this );
1783 syncMenu = new QPopupMenu( this ); 1783 syncMenu = new QPopupMenu( this );
1784 changeMenu= new QPopupMenu( this ); 1784 changeMenu= new QPopupMenu( this );
1785 beamMenu= new QPopupMenu( this ); 1785 beamMenu= new QPopupMenu( this );
1786 1786
1787//US since we have no splitter for the embedded system, setup 1787//US since we have no splitter for the embedded system, setup
1788// a layout with two frames. One left and one right. 1788// a layout with two frames. One left and one right.
1789 1789
1790 QBoxLayout *topLayout; 1790 QBoxLayout *topLayout;
1791 1791
1792 // = new QHBoxLayout( this ); 1792 // = new QHBoxLayout( this );
1793// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1793// QBoxLayout *topLayout = (QBoxLayout*)layout();
1794 1794
1795// QWidget *mainBox = new QWidget( this ); 1795// QWidget *mainBox = new QWidget( this );
1796// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1796// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1797 1797
1798#ifdef DESKTOP_VERSION 1798#ifdef DESKTOP_VERSION
1799 topLayout = new QHBoxLayout( this ); 1799 topLayout = new QHBoxLayout( this );
1800 1800
1801 1801
1802 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1802 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1803 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1803 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1804 1804
1805 topLayout->addWidget(mMiniSplitter ); 1805 topLayout->addWidget(mMiniSplitter );
1806 1806
1807 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1807 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1808 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1808 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1809 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1809 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1810 mDetails = new ViewContainer( mMiniSplitter ); 1810 mDetails = new ViewContainer( mMiniSplitter );
1811 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1811 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1812#else 1812#else
1813 if ( QApplication::desktop()->width() > 480 ) { 1813 if ( QApplication::desktop()->width() > 480 ) {
1814 topLayout = new QHBoxLayout( this ); 1814 topLayout = new QHBoxLayout( this );
1815 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1815 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1816 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1816 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1817 } else { 1817 } else {
1818 1818
1819 topLayout = new QHBoxLayout( this ); 1819 topLayout = new QHBoxLayout( this );
1820 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1820 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1821 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1821 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1822 } 1822 }
1823 1823
1824 topLayout->addWidget(mMiniSplitter ); 1824 topLayout->addWidget(mMiniSplitter );
1825 mViewManager = new ViewManager( this, mMiniSplitter ); 1825 mViewManager = new ViewManager( this, mMiniSplitter );
1826 mDetails = new ViewContainer( mMiniSplitter ); 1826 mDetails = new ViewContainer( mMiniSplitter );
1827 1827
1828 1828
1829 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1829 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1830#endif 1830#endif
1831 //eh->hide(); 1831 //eh->hide();
1832 // topLayout->addWidget(mExtensionManager ); 1832 // topLayout->addWidget(mExtensionManager );
1833 1833
1834 1834
1835/*US 1835/*US
1836#ifndef KAB_NOSPLITTER 1836#ifndef KAB_NOSPLITTER
1837 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1837 QHBoxLayout *topLayout = new QHBoxLayout( this );
1838//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1838//US topLayout->setSpacing( KDialogBase::spacingHint() );
1839 topLayout->setSpacing( 10 ); 1839 topLayout->setSpacing( 10 );
1840 1840
1841 mDetailsSplitter = new QSplitter( this ); 1841 mDetailsSplitter = new QSplitter( this );
1842 1842
1843 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1843 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1844 1844
1845 mViewManager = new ViewManager( this, viewSpace ); 1845 mViewManager = new ViewManager( this, viewSpace );
1846 viewSpace->setStretchFactor( mViewManager, 1 ); 1846 viewSpace->setStretchFactor( mViewManager, 1 );
1847 1847
1848 mDetails = new ViewContainer( mDetailsSplitter ); 1848 mDetails = new ViewContainer( mDetailsSplitter );
1849 1849
1850 topLayout->addWidget( mDetailsSplitter ); 1850 topLayout->addWidget( mDetailsSplitter );
1851 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1851 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1852#else //KAB_NOSPLITTER 1852#else //KAB_NOSPLITTER
1853 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1853 QHBoxLayout *topLayout = new QHBoxLayout( this );
1854//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1854//US topLayout->setSpacing( KDialogBase::spacingHint() );
1855 topLayout->setSpacing( 10 ); 1855 topLayout->setSpacing( 10 );
1856 1856
1857// mDetailsSplitter = new QSplitter( this ); 1857// mDetailsSplitter = new QSplitter( this );
1858 1858
1859 QVBox *viewSpace = new QVBox( this ); 1859 QVBox *viewSpace = new QVBox( this );
1860 1860
1861 mViewManager = new ViewManager( this, viewSpace ); 1861 mViewManager = new ViewManager( this, viewSpace );
1862 viewSpace->setStretchFactor( mViewManager, 1 ); 1862 viewSpace->setStretchFactor( mViewManager, 1 );
1863 1863
1864 mDetails = new ViewContainer( this ); 1864 mDetails = new ViewContainer( this );
1865 1865
1866 topLayout->addWidget( viewSpace ); 1866 topLayout->addWidget( viewSpace );
1867// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1867// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1868 topLayout->addWidget( mDetails ); 1868 topLayout->addWidget( mDetails );
1869#endif //KAB_NOSPLITTER 1869#endif //KAB_NOSPLITTER
1870*/ 1870*/
1871 1871
1872 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1872 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1873 syncManager->setBlockSave(false); 1873 syncManager->setBlockSave(false);
1874 1874
1875 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1875 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1876 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1876 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1877 QString sync_file = sentSyncFile(); 1877 QString sync_file = sentSyncFile();
1878 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1878 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1879 syncManager->setDefaultFileName( sync_file ); 1879 syncManager->setDefaultFileName( sync_file );
1880 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1880 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1881 1881
1882#endif //KAB_EMBEDDED 1882#endif //KAB_EMBEDDED
1883 initActions(); 1883 initActions();
1884 1884
1885#ifdef KAB_EMBEDDED 1885#ifdef KAB_EMBEDDED
1886 addActionsManually(); 1886 addActionsManually();
1887 //US make sure the export and import menues are initialized before creating the xxPortManager. 1887 //US make sure the export and import menues are initialized before creating the xxPortManager.
1888 mXXPortManager = new XXPortManager( this, this ); 1888 mXXPortManager = new XXPortManager( this, this );
1889 1889
1890 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1890 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1891 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1891 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1892 // mActionQuit->plug ( mMainWindow->toolBar()); 1892 // mActionQuit->plug ( mMainWindow->toolBar());
1893 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1893 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1894 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1894 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1895 // mIncSearchWidget->hide(); 1895 // mIncSearchWidget->hide();
1896 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1896 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1897 SLOT( incrementalSearch( const QString& ) ) ); 1897 SLOT( incrementalSearch( const QString& ) ) );
1898 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1898 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1899 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1899 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1900 1900
1901 mJumpButtonBar = new JumpButtonBar( this, this ); 1901 mJumpButtonBar = new JumpButtonBar( this, this );
1902 1902
1903 topLayout->addWidget( mJumpButtonBar ); 1903 topLayout->addWidget( mJumpButtonBar );
1904//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1904//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1905 1905
1906// mMainWindow->getIconToolBar()->raise(); 1906// mMainWindow->getIconToolBar()->raise();
1907 1907
1908#endif //KAB_EMBEDDED 1908#endif //KAB_EMBEDDED
1909 1909
1910} 1910}
1911void KABCore::initActions() 1911void KABCore::initActions()
1912{ 1912{
1913//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1913//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1914 1914
1915#ifndef KAB_EMBEDDED 1915#ifndef KAB_EMBEDDED
1916 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1916 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1917 SLOT( clipboardDataChanged() ) ); 1917 SLOT( clipboardDataChanged() ) );
1918#endif //KAB_EMBEDDED 1918#endif //KAB_EMBEDDED
1919 1919
1920 // file menu 1920 // file menu
1921 1921
1922 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1922 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1923 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1923 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1924 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 1924 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1925 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 1925 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1926 1926
1927 1927
1928 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 1928 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1929 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 1929 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1930 1930
1931 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1931 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1932 SLOT( save() ), actionCollection(), "file_sync" ); 1932 SLOT( save() ), actionCollection(), "file_sync" );
1933 1933
1934 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1934 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1935 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1935 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1936 1936
1937 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1937 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1938 this, SLOT( mailVCard() ), 1938 this, SLOT( mailVCard() ),
1939 actionCollection(), "file_mail_vcard"); 1939 actionCollection(), "file_mail_vcard");
1940 1940
1941 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1941 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1942 SLOT( export2phone() ), actionCollection(), 1942 SLOT( export2phone() ), actionCollection(),
1943 "kaddressbook_ex2phone" ); 1943 "kaddressbook_ex2phone" );
1944 1944
1945 mActionBeamVCard = 0; 1945 mActionBeamVCard = 0;
1946 mActionBeam = 0; 1946 mActionBeam = 0;
1947 1947
1948#ifndef DESKTOP_VERSION 1948#ifndef DESKTOP_VERSION
1949 if ( Ir::supported() ) { 1949 if ( Ir::supported() ) {
1950 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1950 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1951 SLOT( beamVCard() ), actionCollection(), 1951 SLOT( beamVCard() ), actionCollection(),
1952 "kaddressbook_beam_vcard" ); 1952 "kaddressbook_beam_vcard" );
1953 1953
1954 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1954 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1955 SLOT( beamMySelf() ), actionCollection(), 1955 SLOT( beamMySelf() ), actionCollection(),
1956 "kaddressbook_beam_myself" ); 1956 "kaddressbook_beam_myself" );
1957 } 1957 }
1958#endif 1958#endif
1959 1959
1960 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1960 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1961 this, SLOT( editContact2() ), 1961 this, SLOT( editContact2() ),
1962 actionCollection(), "file_properties" ); 1962 actionCollection(), "file_properties" );
1963 1963
1964#ifdef KAB_EMBEDDED 1964#ifdef KAB_EMBEDDED
1965 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1965 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1966 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1966 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1967 mMainWindow, SLOT( exit() ), 1967 mMainWindow, SLOT( exit() ),
1968 actionCollection(), "quit" ); 1968 actionCollection(), "quit" );
1969#endif //KAB_EMBEDDED 1969#endif //KAB_EMBEDDED
1970 1970
1971 // edit menu 1971 // edit menu
1972 if ( mIsPart ) { 1972 if ( mIsPart ) {
1973 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1973 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1974 SLOT( copyContacts() ), actionCollection(), 1974 SLOT( copyContacts() ), actionCollection(),
1975 "kaddressbook_copy" ); 1975 "kaddressbook_copy" );
1976 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1976 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1977 SLOT( cutContacts() ), actionCollection(), 1977 SLOT( cutContacts() ), actionCollection(),
1978 "kaddressbook_cut" ); 1978 "kaddressbook_cut" );
1979 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1979 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1980 SLOT( pasteContacts() ), actionCollection(), 1980 SLOT( pasteContacts() ), actionCollection(),
1981 "kaddressbook_paste" ); 1981 "kaddressbook_paste" );
1982 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1982 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1983 SLOT( selectAllContacts() ), actionCollection(), 1983 SLOT( selectAllContacts() ), actionCollection(),
1984 "kaddressbook_select_all" ); 1984 "kaddressbook_select_all" );
1985 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1985 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1986 SLOT( undo() ), actionCollection(), 1986 SLOT( undo() ), actionCollection(),
1987 "kaddressbook_undo" ); 1987 "kaddressbook_undo" );
1988 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1988 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1989 this, SLOT( redo() ), actionCollection(), 1989 this, SLOT( redo() ), actionCollection(),
1990 "kaddressbook_redo" ); 1990 "kaddressbook_redo" );
1991 } else { 1991 } else {
1992 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1992 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1993 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1993 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1994 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1994 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1995 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1995 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1996 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1996 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1997 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1997 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1998 } 1998 }
1999 1999
2000 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 2000 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
2001 Key_Delete, this, SLOT( deleteContacts() ), 2001 Key_Delete, this, SLOT( deleteContacts() ),
2002 actionCollection(), "edit_delete" ); 2002 actionCollection(), "edit_delete" );
2003 2003
2004 mActionUndo->setEnabled( false ); 2004 mActionUndo->setEnabled( false );
2005 mActionRedo->setEnabled( false ); 2005 mActionRedo->setEnabled( false );
2006 2006
2007 // settings menu 2007 // settings menu
2008#ifdef KAB_EMBEDDED 2008#ifdef KAB_EMBEDDED
2009//US special menuentry to configure the addressbook resources. On KDE 2009//US special menuentry to configure the addressbook resources. On KDE
2010// you do that through the control center !!! 2010// you do that through the control center !!!
2011 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 2011 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
2012 SLOT( configureResources() ), actionCollection(), 2012 SLOT( configureResources() ), actionCollection(),
2013 "kaddressbook_configure_resources" ); 2013 "kaddressbook_configure_resources" );
2014#endif //KAB_EMBEDDED 2014#endif //KAB_EMBEDDED
2015 2015
2016 if ( mIsPart ) { 2016 if ( mIsPart ) {
2017 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 2017 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
2018 SLOT( openConfigDialog() ), actionCollection(), 2018 SLOT( openConfigDialog() ), actionCollection(),
2019 "kaddressbook_configure" ); 2019 "kaddressbook_configure" );
2020 2020
2021 //US not implemented yet 2021 //US not implemented yet
2022 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 2022 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
2023 // this, SLOT( configureKeyBindings() ), actionCollection(), 2023 // this, SLOT( configureKeyBindings() ), actionCollection(),
2024 // "kaddressbook_configure_shortcuts" ); 2024 // "kaddressbook_configure_shortcuts" );
2025#ifdef KAB_EMBEDDED 2025#ifdef KAB_EMBEDDED
2026 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 2026 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
2027 mActionConfigureToolbars->setEnabled( false ); 2027 mActionConfigureToolbars->setEnabled( false );
2028#endif //KAB_EMBEDDED 2028#endif //KAB_EMBEDDED
2029 2029
2030 } else { 2030 } else {
2031 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 2031 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
2032 2032
2033 //US not implemented yet 2033 //US not implemented yet
2034 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 2034 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
2035 } 2035 }
2036 2036
2037 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 2037 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2038 actionCollection(), "options_show_jump_bar" ); 2038 actionCollection(), "options_show_jump_bar" );
2039 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); 2039 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) );
2040 2040
2041 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2041 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2042 actionCollection(), "options_show_details" ); 2042 actionCollection(), "options_show_details" );
2043 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2043 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2044 2044
2045 2045
2046 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2046 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2047 SLOT( toggleBeamReceive() ), actionCollection(), 2047 SLOT( toggleBeamReceive() ), actionCollection(),
2048 "kaddressbook_beam_rec" ); 2048 "kaddressbook_beam_rec" );
2049 2049
2050 2050
2051 // misc 2051 // misc
2052 // only enable LDAP lookup if we can handle the protocol 2052 // only enable LDAP lookup if we can handle the protocol
2053#ifndef KAB_EMBEDDED 2053#ifndef KAB_EMBEDDED
2054 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2054 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2055 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2055 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2056 this, SLOT( openLDAPDialog() ), actionCollection(), 2056 this, SLOT( openLDAPDialog() ), actionCollection(),
2057 "ldap_lookup" ); 2057 "ldap_lookup" );
2058 } 2058 }
2059#else //KAB_EMBEDDED 2059#else //KAB_EMBEDDED
2060 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2060 //qDebug("KABCore::initActions() LDAP has to be implemented");
2061#endif //KAB_EMBEDDED 2061#endif //KAB_EMBEDDED
2062 2062
2063 2063
2064 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2064 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2065 SLOT( setWhoAmI() ), actionCollection(), 2065 SLOT( setWhoAmI() ), actionCollection(),
2066 "set_personal" ); 2066 "set_personal" );
2067 2067
2068 2068
2069 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, 2069 mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this,
2070 SLOT( setCategories() ), actionCollection(), 2070 SLOT( setCategories() ), actionCollection(),
2071 "edit_set_categories" ); 2071 "edit_set_categories" );
2072 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, 2072 mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this,
2073 SLOT( editCategories() ), actionCollection(), 2073 SLOT( editCategories() ), actionCollection(),
2074 "edit__categories" ); 2074 "edit__categories" );
2075 2075
2076 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2076 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2077 SLOT( removeVoice() ), actionCollection(), 2077 SLOT( removeVoice() ), actionCollection(),
2078 "remove_voice" ); 2078 "remove_voice" );
2079 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2079 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2080 SLOT( setFormattedName() ), actionCollection(), 2080 SLOT( setFormattedName() ), actionCollection(),
2081 "set_formatted" ); 2081 "set_formatted" );
2082 2082
2083 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2083 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2084 SLOT( manageCategories() ), actionCollection(), 2084 SLOT( manageCategories() ), actionCollection(),
2085 "remove_voice" ); 2085 "remove_voice" );
2086 2086
2087 2087
2088 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2088 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2089 SLOT( importFromOL() ), actionCollection(), 2089 SLOT( importFromOL() ), actionCollection(),
2090 "import_OL" ); 2090 "import_OL" );
2091#ifdef KAB_EMBEDDED 2091#ifdef KAB_EMBEDDED
2092 mActionLicence = new KAction( i18n( "Licence" ), 0, 2092 mActionLicence = new KAction( i18n( "Licence" ), 0,
2093 this, SLOT( showLicence() ), actionCollection(), 2093 this, SLOT( showLicence() ), actionCollection(),
2094 "licence_about_data" ); 2094 "licence_about_data" );
2095 mActionFaq = new KAction( i18n( "Faq" ), 0, 2095 mActionFaq = new KAction( i18n( "Faq" ), 0,
2096 this, SLOT( faq() ), actionCollection(), 2096 this, SLOT( faq() ), actionCollection(),
2097 "faq_about_data" ); 2097 "faq_about_data" );
2098 mActionWN = new KAction( i18n( "What's New?" ), 0, 2098 mActionWN = new KAction( i18n( "What's New?" ), 0,
2099 this, SLOT( whatsnew() ), actionCollection(), 2099 this, SLOT( whatsnew() ), actionCollection(),
2100 "wn" ); 2100 "wn" );
2101
2102
2103
2104 mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0,
2105 this, SLOT( storagehowto() ), actionCollection(),
2106 "storage" );
2107
2101 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2108 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2102 this, SLOT( synchowto() ), actionCollection(), 2109 this, SLOT( synchowto() ), actionCollection(),
2103 "sync" ); 2110 "sync" );
2104 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2111 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2105 this, SLOT( kdesynchowto() ), actionCollection(), 2112 this, SLOT( kdesynchowto() ), actionCollection(),
2106 "kdesync" ); 2113 "kdesync" );
2107 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2114 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2108 this, SLOT( multisynchowto() ), actionCollection(), 2115 this, SLOT( multisynchowto() ), actionCollection(),
2109 "multisync" ); 2116 "multisync" );
2110 2117
2111 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2118 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2112 this, SLOT( createAboutData() ), actionCollection(), 2119 this, SLOT( createAboutData() ), actionCollection(),
2113 "kaddressbook_about_data" ); 2120 "kaddressbook_about_data" );
2114#endif //KAB_EMBEDDED 2121#endif //KAB_EMBEDDED
2115 2122
2116 clipboardDataChanged(); 2123 clipboardDataChanged();
2117 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2124 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2118 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2125 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2119} 2126}
2120 2127
2121//US we need this function, to plug all actions into the correct menues. 2128//US we need this function, to plug all actions into the correct menues.
2122// KDE uses a XML format to plug the actions, but we work her without this overhead. 2129// KDE uses a XML format to plug the actions, but we work her without this overhead.
2123void KABCore::addActionsManually() 2130void KABCore::addActionsManually()
2124{ 2131{
2125//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2132//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2126 2133
2127#ifdef KAB_EMBEDDED 2134#ifdef KAB_EMBEDDED
2128 QPopupMenu *fileMenu = new QPopupMenu( this ); 2135 QPopupMenu *fileMenu = new QPopupMenu( this );
2129 QPopupMenu *editMenu = new QPopupMenu( this ); 2136 QPopupMenu *editMenu = new QPopupMenu( this );
2130 QPopupMenu *helpMenu = new QPopupMenu( this ); 2137 QPopupMenu *helpMenu = new QPopupMenu( this );
2131 2138
2132 KToolBar* tb = mMainWindow->toolBar(); 2139 KToolBar* tb = mMainWindow->toolBar();
2133 mMainWindow->setToolBarsMovable (false ); 2140 mMainWindow->setToolBarsMovable (false );
2134#ifndef DESKTOP_VERSION 2141#ifndef DESKTOP_VERSION
2135 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2142 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2136#endif 2143#endif
2137 QMenuBar* mb = mMainWindow->menuBar(); 2144 QMenuBar* mb = mMainWindow->menuBar();
2138 2145
2139 //US setup menubar. 2146 //US setup menubar.
2140 //Disable the following block if you do not want to have a menubar. 2147 //Disable the following block if you do not want to have a menubar.
2141 mb->insertItem( i18n("&File"), fileMenu ); 2148 mb->insertItem( i18n("&File"), fileMenu );
2142 mb->insertItem( i18n("&Edit"), editMenu ); 2149 mb->insertItem( i18n("&Edit"), editMenu );
2143 mb->insertItem( i18n("&View"), viewMenu ); 2150 mb->insertItem( i18n("&View"), viewMenu );
2144 mb->insertItem( i18n("&Settings"), settingsMenu ); 2151 mb->insertItem( i18n("&Settings"), settingsMenu );
2145#ifdef DESKTOP_VERSION 2152#ifdef DESKTOP_VERSION
2146 mb->insertItem( i18n("Synchronize"), syncMenu ); 2153 mb->insertItem( i18n("Synchronize"), syncMenu );
2147#else 2154#else
2148 mb->insertItem( i18n("Sync"), syncMenu ); 2155 mb->insertItem( i18n("Sync"), syncMenu );
2149#endif 2156#endif
2150 //mb->insertItem( i18n("&Change"), changeMenu ); 2157 //mb->insertItem( i18n("&Change"), changeMenu );
2151 mb->insertItem( i18n("&Help"), helpMenu ); 2158 mb->insertItem( i18n("&Help"), helpMenu );
2152 mIncSearchWidget = new IncSearchWidget( tb ); 2159 mIncSearchWidget = new IncSearchWidget( tb );
2153 // tb->insertWidget(-1, 0, mIncSearchWidget); 2160 // tb->insertWidget(-1, 0, mIncSearchWidget);
2154#ifndef DESKTOP_VERSION 2161#ifndef DESKTOP_VERSION
2155 } else { 2162 } else {
2156 //US setup toolbar 2163 //US setup toolbar
2157 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2164 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2158 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2165 QPopupMenu *popupBarTB = new QPopupMenu( this );
2159 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); 2166 menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB);
2160 tb->insertWidget(-1, 0, menuBarTB); 2167 tb->insertWidget(-1, 0, menuBarTB);
2161 mIncSearchWidget = new IncSearchWidget( tb ); 2168 mIncSearchWidget = new IncSearchWidget( tb );
2162 tb->enableMoving(false); 2169 tb->enableMoving(false);
2163 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2170 popupBarTB->insertItem( i18n("&File"), fileMenu );
2164 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2171 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2165 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2172 popupBarTB->insertItem( i18n("&View"), viewMenu );
2166 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2173 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2167 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2174 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2168 mViewManager->getFilterAction()->plug ( popupBarTB); 2175 mViewManager->getFilterAction()->plug ( popupBarTB);
2169 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2176 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2170 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2177 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2171 if (QApplication::desktop()->width() > 320 ) { 2178 if (QApplication::desktop()->width() > 320 ) {
2172 // mViewManager->getFilterAction()->plug ( tb); 2179 // mViewManager->getFilterAction()->plug ( tb);
2173 } 2180 }
2174 } 2181 }
2175#endif 2182#endif
2176 mIncSearchWidget->setSize(); 2183 mIncSearchWidget->setSize();
2177 // mActionQuit->plug ( mMainWindow->toolBar()); 2184 // mActionQuit->plug ( mMainWindow->toolBar());
2178 2185
2179 2186
2180 2187
2181 //US Now connect the actions with the menue entries. 2188 //US Now connect the actions with the menue entries.
2182#ifdef DESKTOP_VERSION 2189#ifdef DESKTOP_VERSION
2183 mActionPrint->plug( fileMenu ); 2190 mActionPrint->plug( fileMenu );
2184 mActionPrintDetails->plug( fileMenu ); 2191 mActionPrintDetails->plug( fileMenu );
2185 fileMenu->insertSeparator(); 2192 fileMenu->insertSeparator();
2186#endif 2193#endif
2187 mActionMail->plug( fileMenu ); 2194 mActionMail->plug( fileMenu );
2188 fileMenu->insertSeparator(); 2195 fileMenu->insertSeparator();
2189 2196
2190 mActionNewContact->plug( editMenu ); 2197 mActionNewContact->plug( editMenu );
2191 mActionNewContact->plug( tb ); 2198 mActionNewContact->plug( tb );
2192 2199
2193 mActionEditAddressee->plug( editMenu ); 2200 mActionEditAddressee->plug( editMenu );
2194 editMenu->insertSeparator(); 2201 editMenu->insertSeparator();
2195 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2202 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2196 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2203 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2197 mActionEditAddressee->plug( tb ); 2204 mActionEditAddressee->plug( tb );
2198 2205
2199 // fileMenu->insertSeparator(); 2206 // fileMenu->insertSeparator();
2200 mActionSave->plug( fileMenu ); 2207 mActionSave->plug( fileMenu );
2201 fileMenu->insertItem( "&Import", ImportMenu ); 2208 fileMenu->insertItem( "&Import", ImportMenu );
2202 fileMenu->insertItem( "&Export", ExportMenu ); 2209 fileMenu->insertItem( "&Export", ExportMenu );
2203 editMenu->insertItem( i18n("&Change"), changeMenu ); 2210 editMenu->insertItem( i18n("&Change"), changeMenu );
2204 editMenu->insertSeparator(); 2211 editMenu->insertSeparator();
2205#ifndef DESKTOP_VERSION 2212#ifndef DESKTOP_VERSION
2206 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2213 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2207#endif 2214#endif
2208#if 0 2215#if 0
2209 // PENDING fix MailVCard 2216 // PENDING fix MailVCard
2210 fileMenu->insertSeparator(); 2217 fileMenu->insertSeparator();
2211 mActionMailVCard->plug( fileMenu ); 2218 mActionMailVCard->plug( fileMenu );
2212#endif 2219#endif
2213#ifndef DESKTOP_VERSION 2220#ifndef DESKTOP_VERSION
2214 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2221 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2215 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2222 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2216 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2223 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2217#endif 2224#endif
2218 fileMenu->insertSeparator(); 2225 fileMenu->insertSeparator();
2219 mActionQuit->plug( fileMenu ); 2226 mActionQuit->plug( fileMenu );
2220#ifdef _OL_IMPORT_ 2227#ifdef _OL_IMPORT_
2221 mActionImportOL->plug( ImportMenu ); 2228 mActionImportOL->plug( ImportMenu );
2222#endif 2229#endif
2223 // edit menu 2230 // edit menu
2224 mActionUndo->plug( editMenu ); 2231 mActionUndo->plug( editMenu );
2225 mActionRedo->plug( editMenu ); 2232 mActionRedo->plug( editMenu );
2226 editMenu->insertSeparator(); 2233 editMenu->insertSeparator();
2227 mActionCut->plug( editMenu ); 2234 mActionCut->plug( editMenu );
2228 mActionCopy->plug( editMenu ); 2235 mActionCopy->plug( editMenu );
2229 mActionPaste->plug( editMenu ); 2236 mActionPaste->plug( editMenu );
2230 mActionDelete->plug( editMenu ); 2237 mActionDelete->plug( editMenu );
2231 editMenu->insertSeparator(); 2238 editMenu->insertSeparator();
2232 mActionSelectAll->plug( editMenu ); 2239 mActionSelectAll->plug( editMenu );
2233 2240
2234 mActionSetFormattedName->plug( changeMenu ); 2241 mActionSetFormattedName->plug( changeMenu );
2235 mActionRemoveVoice->plug( changeMenu ); 2242 mActionRemoveVoice->plug( changeMenu );
2236 // settingsmings menu 2243 // settingsmings menu
2237//US special menuentry to configure the addressbook resources. On KDE 2244//US special menuentry to configure the addressbook resources. On KDE
2238// you do that through the control center !!! 2245// you do that through the control center !!!
2239 // settingsMenu->insertSeparator(); 2246 // settingsMenu->insertSeparator();
2240 2247
2241 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2248 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2242 mActionConfigResources->plug( settingsMenu,1 ); 2249 mActionConfigResources->plug( settingsMenu,1 );
2243 settingsMenu->insertSeparator(2); 2250 settingsMenu->insertSeparator(2);
2244 2251
2245 if ( mIsPart ) { 2252 if ( mIsPart ) {
2246 //US not implemented yet 2253 //US not implemented yet
2247 //mActionConfigShortcuts->plug( settingsMenu ); 2254 //mActionConfigShortcuts->plug( settingsMenu );
2248 //mActionConfigureToolbars->plug( settingsMenu ); 2255 //mActionConfigureToolbars->plug( settingsMenu );
2249 2256
2250 } else { 2257 } else {
2251 //US not implemented yet 2258 //US not implemented yet
2252 //mActionKeyBindings->plug( settingsMenu ); 2259 //mActionKeyBindings->plug( settingsMenu );
2253 } 2260 }
2254 2261
2255 mActionEditCategories->plug( settingsMenu ); 2262 mActionEditCategories->plug( settingsMenu );
2256 mActionManageCategories->plug( settingsMenu ); 2263 mActionManageCategories->plug( settingsMenu );
2257 mActionJumpBar->plug( viewMenu,0 ); 2264 mActionJumpBar->plug( viewMenu,0 );
2258 mActionDetails->plug( viewMenu,0 ); 2265 mActionDetails->plug( viewMenu,0 );
2259 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2266 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2260 mActionDetails->plug( tb ); 2267 mActionDetails->plug( tb );
2261 settingsMenu->insertSeparator(); 2268 settingsMenu->insertSeparator();
2262#ifndef DESKTOP_VERSION 2269#ifndef DESKTOP_VERSION
2263 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2270 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2264 settingsMenu->insertSeparator(); 2271 settingsMenu->insertSeparator();
2265#endif 2272#endif
2266 2273
2267 mActionWhoAmI->plug( settingsMenu ); 2274 mActionWhoAmI->plug( settingsMenu );
2268 //mActionEditCategories->plug( changeMenu ); 2275 //mActionEditCategories->plug( changeMenu );
2269 mActionCategories->plug( changeMenu ); 2276 mActionCategories->plug( changeMenu );
2270 //mActionManageCategories->plug( changeMenu ); 2277 //mActionManageCategories->plug( changeMenu );
2271 2278
2272 //mActionCategories->plug( settingsMenu ); 2279 //mActionCategories->plug( settingsMenu );
2273 2280
2274 2281
2275 mActionWN->plug( helpMenu ); 2282 mActionWN->plug( helpMenu );
2283 mActionStorageHowto->plug( helpMenu );
2276 mActionSyncHowto->plug( helpMenu ); 2284 mActionSyncHowto->plug( helpMenu );
2277 mActionKdeSyncHowto->plug( helpMenu ); 2285 mActionKdeSyncHowto->plug( helpMenu );
2278 mActionMultiSyncHowto->plug( helpMenu ); 2286 mActionMultiSyncHowto->plug( helpMenu );
2279 mActionFaq->plug( helpMenu ); 2287 mActionFaq->plug( helpMenu );
2280 mActionLicence->plug( helpMenu ); 2288 mActionLicence->plug( helpMenu );
2281 mActionAboutKAddressbook->plug( helpMenu ); 2289 mActionAboutKAddressbook->plug( helpMenu );
2282 2290
2283 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2291 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2284 2292
2285 mActionSave->plug( tb ); 2293 mActionSave->plug( tb );
2286 mViewManager->getFilterAction()->plug ( tb); 2294 mViewManager->getFilterAction()->plug ( tb);
2287 //LR hide filteraction on started in 480x640 2295 //LR hide filteraction on started in 480x640
2288 if (QApplication::desktop()->width() == 480 ) { 2296 if (QApplication::desktop()->width() == 480 ) {
2289 mViewManager->getFilterAction()->setComboWidth( 0 ); 2297 mViewManager->getFilterAction()->setComboWidth( 0 );
2290 } 2298 }
2291 mActionUndo->plug( tb ); 2299 mActionUndo->plug( tb );
2292 mActionDelete->plug( tb ); 2300 mActionDelete->plug( tb );
2293 mActionRedo->plug( tb ); 2301 mActionRedo->plug( tb );
2294 } else { 2302 } else {
2295 mActionSave->plug( tb ); 2303 mActionSave->plug( tb );
2296 tb->enableMoving(false); 2304 tb->enableMoving(false);
2297 } 2305 }
2298 //mActionQuit->plug ( tb ); 2306 //mActionQuit->plug ( tb );
2299 //tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2307 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2300 2308
2301 //US link the searchwidget first to this. 2309 //US link the searchwidget first to this.
2302 // The real linkage to the toolbar happens later. 2310 // The real linkage to the toolbar happens later.
2303//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2311//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2304//US tb->insertItem( mIncSearchWidget ); 2312//US tb->insertItem( mIncSearchWidget );
2305/*US 2313/*US
2306 mIncSearchWidget = new IncSearchWidget( tb ); 2314 mIncSearchWidget = new IncSearchWidget( tb );
2307 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2315 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2308 SLOT( incrementalSearch( const QString& ) ) ); 2316 SLOT( incrementalSearch( const QString& ) ) );
2309 2317
2310 mJumpButtonBar = new JumpButtonBar( this, this ); 2318 mJumpButtonBar = new JumpButtonBar( this, this );
2311 2319
2312//US topLayout->addWidget( mJumpButtonBar ); 2320//US topLayout->addWidget( mJumpButtonBar );
2313 this->layout()->add( mJumpButtonBar ); 2321 this->layout()->add( mJumpButtonBar );
2314*/ 2322*/
2315 2323
2316#endif //KAB_EMBEDDED 2324#endif //KAB_EMBEDDED
2317 2325
2318 mActionExport2phone->plug( ExportMenu ); 2326 mActionExport2phone->plug( ExportMenu );
2319 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2327 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2320 syncManager->fillSyncMenu(); 2328 syncManager->fillSyncMenu();
2321 2329
2322} 2330}
2323void KABCore::showLicence() 2331void KABCore::showLicence()
2324{ 2332{
2325 KApplication::showLicence(); 2333 KApplication::showLicence();
2326} 2334}
2327 2335
2328void KABCore::manageCategories( ) 2336void KABCore::manageCategories( )
2329{ 2337{
2330 KABCatPrefs* cp = new KABCatPrefs(); 2338 KABCatPrefs* cp = new KABCatPrefs();
2331 cp->show(); 2339 cp->show();
2332 int w =cp->sizeHint().width() ; 2340 int w =cp->sizeHint().width() ;
2333 int h = cp->sizeHint().height() ; 2341 int h = cp->sizeHint().height() ;
2334 int dw = QApplication::desktop()->width(); 2342 int dw = QApplication::desktop()->width();
2335 int dh = QApplication::desktop()->height(); 2343 int dh = QApplication::desktop()->height();
2336 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2344 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2337 if ( !cp->exec() ) { 2345 if ( !cp->exec() ) {
2338 delete cp; 2346 delete cp;
2339 return; 2347 return;
2340 } 2348 }
2341 int count = 0; 2349 int count = 0;
2342 int cc = 0; 2350 int cc = 0;
2343 message( i18n("Please wait, processing categories...")); 2351 message( i18n("Please wait, processing categories..."));
2344 if ( cp->addCat() ) { 2352 if ( cp->addCat() ) {
2345 KABC::AddressBook::Iterator it; 2353 KABC::AddressBook::Iterator it;
2346 QStringList catList = KABPrefs::instance()->mCustomCategories; 2354 QStringList catList = KABPrefs::instance()->mCustomCategories;
2347 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2355 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2348 ++cc; 2356 ++cc;
2349 if ( cc %10 == 0) 2357 if ( cc %10 == 0)
2350 message(i18n("Processing contact #%1").arg(cc)); 2358 message(i18n("Processing contact #%1").arg(cc));
2351 QStringList catIncList = (*it).categories(); 2359 QStringList catIncList = (*it).categories();
2352 int i; 2360 int i;
2353 for( i = 0; i< catIncList.count(); ++i ) { 2361 for( i = 0; i< catIncList.count(); ++i ) {
2354 if ( !catList.contains (catIncList[i])) { 2362 if ( !catList.contains (catIncList[i])) {
2355 catList.append( catIncList[i] ); 2363 catList.append( catIncList[i] );
2356 //qDebug("add cat %s ", catIncList[i].latin1()); 2364 //qDebug("add cat %s ", catIncList[i].latin1());
2357 ++count; 2365 ++count;
2358 } 2366 }
2359 } 2367 }
2360 } 2368 }
2361 catList.sort(); 2369 catList.sort();
2362 KABPrefs::instance()->mCustomCategories = catList; 2370 KABPrefs::instance()->mCustomCategories = catList;
2363 KABPrefs::instance()->writeConfig(); 2371 KABPrefs::instance()->writeConfig();
2364 message(QString::number( count )+ i18n(" categories added to list! ")); 2372 message(QString::number( count )+ i18n(" categories added to list! "));
2365 } else { 2373 } else {
2366 QStringList catList = KABPrefs::instance()->mCustomCategories; 2374 QStringList catList = KABPrefs::instance()->mCustomCategories;
2367 QStringList catIncList; 2375 QStringList catIncList;
2368 QStringList newCatList; 2376 QStringList newCatList;
2369 KABC::AddressBook::Iterator it; 2377 KABC::AddressBook::Iterator it;
2370 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2378 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2371 ++cc; 2379 ++cc;
2372 if ( cc %10 == 0) 2380 if ( cc %10 == 0)
2373 message(i18n("Processing contact #%1").arg(cc)); 2381 message(i18n("Processing contact #%1").arg(cc));
2374 QStringList catIncList = (*it).categories(); 2382 QStringList catIncList = (*it).categories();
2375 int i; 2383 int i;
2376 if ( catIncList.count() ) { 2384 if ( catIncList.count() ) {
2377 newCatList.clear(); 2385 newCatList.clear();
2378 for( i = 0; i< catIncList.count(); ++i ) { 2386 for( i = 0; i< catIncList.count(); ++i ) {
2379 if ( catList.contains (catIncList[i])) { 2387 if ( catList.contains (catIncList[i])) {
2380 newCatList.append( catIncList[i] ); 2388 newCatList.append( catIncList[i] );
2381 } 2389 }
2382 } 2390 }
2383 newCatList.sort(); 2391 newCatList.sort();
2384 (*it).setCategories( newCatList ); 2392 (*it).setCategories( newCatList );
2385 mAddressBook->insertAddressee( (*it) ); 2393 mAddressBook->insertAddressee( (*it) );
2386 } 2394 }
2387 } 2395 }
2388 setModified( true ); 2396 setModified( true );
2389 mViewManager->refreshView(); 2397 mViewManager->refreshView();
2390 message( i18n("Removing categories done!")); 2398 message( i18n("Removing categories done!"));
2391 } 2399 }
2392 delete cp; 2400 delete cp;
2393} 2401}
2394void KABCore::removeVoice() 2402void KABCore::removeVoice()
2395{ 2403{
2396 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2404 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2397 return; 2405 return;
2398 XXPortSelectDialog dlg( this, false, this ); 2406 XXPortSelectDialog dlg( this, false, this );
2399 if ( !dlg.exec() ) 2407 if ( !dlg.exec() )
2400 return; 2408 return;
2401 mAddressBook->setUntagged(); 2409 mAddressBook->setUntagged();
2402 dlg.tagSelected(); 2410 dlg.tagSelected();
2403 message(i18n("Removing voice..."), false ); 2411 message(i18n("Removing voice..."), false );
2404 KABC::AddressBook::Iterator it; 2412 KABC::AddressBook::Iterator it;
2405 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2413 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2406 if ( (*it).tagged() ) { 2414 if ( (*it).tagged() ) {
2407 (*it).removeVoice(); 2415 (*it).removeVoice();
2408 } 2416 }
2409 } 2417 }
2410 message(i18n("Refreshing view...") ); 2418 message(i18n("Refreshing view...") );
2411 qApp->processEvents(); 2419 qApp->processEvents();
2412 mViewManager->refreshView( "" ); 2420 mViewManager->refreshView( "" );
2413 Addressee add; 2421 Addressee add;
2414 mDetails->setAddressee( add ); 2422 mDetails->setAddressee( add );
2415 message(i18n("Remove voice completed!") ); 2423 message(i18n("Remove voice completed!") );
2416 2424
2417 2425
2418 2426
2419} 2427}
2420 2428
2421void KABCore::setFormattedName() 2429void KABCore::setFormattedName()
2422{ 2430{
2423 KABFormatPrefs setpref; 2431 KABFormatPrefs setpref;
2424 if ( !setpref.exec() ) { 2432 if ( !setpref.exec() ) {
2425 return; 2433 return;
2426 } 2434 }
2427 XXPortSelectDialog dlg( this, false, this ); 2435 XXPortSelectDialog dlg( this, false, this );
2428 if ( !dlg.exec() ) 2436 if ( !dlg.exec() )
2429 return; 2437 return;
2430 mAddressBook->setUntagged(); 2438 mAddressBook->setUntagged();
2431 dlg.tagSelected(); 2439 dlg.tagSelected();
2432 int count = 0; 2440 int count = 0;
2433 KABC::AddressBook::Iterator it; 2441 KABC::AddressBook::Iterator it;
2434 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2442 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2435 if ( (*it).tagged() ) { 2443 if ( (*it).tagged() ) {
2436 ++count; 2444 ++count;
2437 if ( count %10 == 0 ) 2445 if ( count %10 == 0 )
2438 message(i18n("Changing contact #%1").arg( count ) ); 2446 message(i18n("Changing contact #%1").arg( count ) );
2439 qApp->processEvents(); 2447 qApp->processEvents();
2440 QString fName; 2448 QString fName;
2441 if ( setpref.simple->isChecked() ) 2449 if ( setpref.simple->isChecked() )
2442 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2450 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2443 else if ( setpref.full->isChecked() ) 2451 else if ( setpref.full->isChecked() )
2444 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2452 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2445 else if ( setpref.reverse->isChecked() ) 2453 else if ( setpref.reverse->isChecked() )
2446 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2454 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2447 else 2455 else
2448 fName = (*it).organization(); 2456 fName = (*it).organization();
2449 if ( setpref.setCompany->isChecked() ) 2457 if ( setpref.setCompany->isChecked() )
2450 if ( fName.isEmpty() || fName =="," ) 2458 if ( fName.isEmpty() || fName =="," )
2451 fName = (*it).organization(); 2459 fName = (*it).organization();
2452 (*it).setFormattedName( fName ); 2460 (*it).setFormattedName( fName );
2453 } 2461 }
2454 } 2462 }
2455 message(i18n("Refreshing view...") ); 2463 message(i18n("Refreshing view...") );
2456 qApp->processEvents(); 2464 qApp->processEvents();
2457 mViewManager->refreshView( "" ); 2465 mViewManager->refreshView( "" );
2458 Addressee add; 2466 Addressee add;
2459 mDetails->setAddressee( add ); 2467 mDetails->setAddressee( add );
2460 message(i18n("Setting formatted name completed!") ); 2468 message(i18n("Setting formatted name completed!") );
2461} 2469}
2462 2470
2463void KABCore::clipboardDataChanged() 2471void KABCore::clipboardDataChanged()
2464{ 2472{
2465 2473
2466 if ( mReadWrite ) 2474 if ( mReadWrite )
2467 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2475 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2468 2476
2469} 2477}
2470 2478
2471void KABCore::updateActionMenu() 2479void KABCore::updateActionMenu()
2472{ 2480{
2473 UndoStack *undo = UndoStack::instance(); 2481 UndoStack *undo = UndoStack::instance();
2474 RedoStack *redo = RedoStack::instance(); 2482 RedoStack *redo = RedoStack::instance();
2475 2483
2476 if ( undo->isEmpty() ) 2484 if ( undo->isEmpty() )
2477 mActionUndo->setText( i18n( "Undo" ) ); 2485 mActionUndo->setText( i18n( "Undo" ) );
2478 else 2486 else
2479 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2487 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2480 2488
2481 mActionUndo->setEnabled( !undo->isEmpty() ); 2489 mActionUndo->setEnabled( !undo->isEmpty() );
2482 2490
2483 if ( !redo->top() ) 2491 if ( !redo->top() )
2484 mActionRedo->setText( i18n( "Redo" ) ); 2492 mActionRedo->setText( i18n( "Redo" ) );
2485 else 2493 else
2486 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2494 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2487 2495
2488 mActionRedo->setEnabled( !redo->isEmpty() ); 2496 mActionRedo->setEnabled( !redo->isEmpty() );
2489} 2497}
2490 2498
2491void KABCore::configureKeyBindings() 2499void KABCore::configureKeyBindings()
2492{ 2500{
2493#ifndef KAB_EMBEDDED 2501#ifndef KAB_EMBEDDED
2494 KKeyDialog::configure( actionCollection(), true ); 2502 KKeyDialog::configure( actionCollection(), true );
2495#else //KAB_EMBEDDED 2503#else //KAB_EMBEDDED
2496 qDebug("KABCore::configureKeyBindings() not implemented"); 2504 qDebug("KABCore::configureKeyBindings() not implemented");
2497#endif //KAB_EMBEDDED 2505#endif //KAB_EMBEDDED
2498} 2506}
2499 2507
2500#ifdef KAB_EMBEDDED 2508#ifdef KAB_EMBEDDED
2501void KABCore::configureResources() 2509void KABCore::configureResources()
2502{ 2510{
2503 KRES::KCMKResources dlg( this, "" , 0 ); 2511 KRES::KCMKResources dlg( this, "" , 0 );
2504 2512
2505 if ( !dlg.exec() ) 2513 if ( !dlg.exec() )
2506 return; 2514 return;
2507 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2515 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2508} 2516}
2509#endif //KAB_EMBEDDED 2517#endif //KAB_EMBEDDED
2510 2518
2511 2519
2512/* this method will be called through the QCop interface from Ko/Pi to select addresses 2520/* this method will be called through the QCop interface from Ko/Pi to select addresses
2513 * for the attendees list of an event. 2521 * for the attendees list of an event.
2514 */ 2522 */
2515void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2523void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2516{ 2524{
2517 2525
2518 bool ok = false; 2526 bool ok = false;
2519 mEmailSourceChannel = sourceChannel; 2527 mEmailSourceChannel = sourceChannel;
2520 mEmailSourceUID = uid; 2528 mEmailSourceUID = uid;
2521 callContactdialog(); 2529 callContactdialog();
2522#if 0 2530#if 0
2523 int wid = uid.toInt( &ok ); 2531 int wid = uid.toInt( &ok );
2524 qDebug("UID %s ", uid.latin1()); 2532 qDebug("UID %s ", uid.latin1());
2525 if ( ok ) { 2533 if ( ok ) {
2526 if ( wid != QApplication::desktop()->width() ) { 2534 if ( wid != QApplication::desktop()->width() ) {
2527 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2535 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2528 message( i18n("Resizing, please wait...") ); 2536 message( i18n("Resizing, please wait...") );
2529 mMainWindow->showMinimized(); 2537 mMainWindow->showMinimized();
2530 /* 2538 /*
2531 { 2539 {
2532 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2540 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2533 } 2541 }
2534 */ 2542 */
2535 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); 2543 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2536 return; 2544 return;
2537 } 2545 }
2538 2546
2539 } else { 2547 } else {
2540 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2548 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2541 } 2549 }
2542 callContactdialog(); 2550 callContactdialog();
2543 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2551 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2544#endif 2552#endif
2545} 2553}
2546void KABCore::resizeAndCallContactdialog() 2554void KABCore::resizeAndCallContactdialog()
2547{ 2555{
2548 updateMainWindow(); 2556 updateMainWindow();
2549 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); 2557 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) );
2550} 2558}
2551 2559
2552void KABCore::callContactdialog() 2560void KABCore::callContactdialog()
2553{ 2561{
2554 QStringList nameList; 2562 QStringList nameList;
2555 QStringList emailList; 2563 QStringList emailList;
2556 QStringList uidList; 2564 QStringList uidList;
2557 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); 2565 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() );
2558 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2566 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2559 uint i=0; 2567 uint i=0;
2560 for (i=0; i < list.count(); i++) 2568 for (i=0; i < list.count(); i++)
2561 { 2569 {
2562 nameList.append(list[i].realName()); 2570 nameList.append(list[i].realName());
2563 emailList.append(list[i].preferredEmail()); 2571 emailList.append(list[i].preferredEmail());
2564 uidList.append(list[i].uid()); 2572 uidList.append(list[i].uid());
2565 } 2573 }
2566 QString uid = mEmailSourceUID; 2574 QString uid = mEmailSourceUID;
2567 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2575 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2568 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); 2576 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2569 2577
2570} 2578}
2571/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2579/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2572 * to put them into the calendar. 2580 * to put them into the calendar.
2573 */ 2581 */
2574void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2582void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2575{ 2583{
2576 // qDebug("KABCore::requestForBirthdayList"); 2584 // qDebug("KABCore::requestForBirthdayList");
2577 QStringList birthdayList; 2585 QStringList birthdayList;
2578 QStringList anniversaryList; 2586 QStringList anniversaryList;
2579 QStringList realNameList; 2587 QStringList realNameList;
2580 QStringList preferredEmailList; 2588 QStringList preferredEmailList;
2581 QStringList assembledNameList; 2589 QStringList assembledNameList;
2582 QStringList uidList; 2590 QStringList uidList;
2583 2591
2584 KABC::AddressBook::Iterator it; 2592 KABC::AddressBook::Iterator it;
2585 2593
2586 int count = 0; 2594 int count = 0;
2587 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2595 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2588 ++count; 2596 ++count;
2589 } 2597 }
2590 QProgressBar bar(count,0 ); 2598 QProgressBar bar(count,0 );
2591 int w = 300; 2599 int w = 300;
2592 if ( QApplication::desktop()->width() < 320 ) 2600 if ( QApplication::desktop()->width() < 320 )
2593 w = 220; 2601 w = 220;
2594 int h = bar.sizeHint().height() ; 2602 int h = bar.sizeHint().height() ;
2595 int dw = QApplication::desktop()->width(); 2603 int dw = QApplication::desktop()->width();
2596 int dh = QApplication::desktop()->height(); 2604 int dh = QApplication::desktop()->height();
2597 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2605 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2598 bar.show(); 2606 bar.show();
2599 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2607 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2600 qApp->processEvents(); 2608 qApp->processEvents();
2601 2609
2602 QDate bday; 2610 QDate bday;
2603 QString anni; 2611 QString anni;
2604 QString formattedbday; 2612 QString formattedbday;
2605 2613
2606 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2614 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2607 { 2615 {
2608 if ( ! bar.isVisible() ) 2616 if ( ! bar.isVisible() )
2609 return; 2617 return;
2610 bar.setProgress( count++ ); 2618 bar.setProgress( count++ );
2611 qApp->processEvents(); 2619 qApp->processEvents();
2612 bday = (*it).birthday().date(); 2620 bday = (*it).birthday().date();
2613 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2621 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2614 2622
2615 if ( bday.isValid() || !anni.isEmpty()) 2623 if ( bday.isValid() || !anni.isEmpty())
2616 { 2624 {
2617 if (bday.isValid()) 2625 if (bday.isValid())
2618 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2626 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2619 else 2627 else
2620 formattedbday = "NOTVALID"; 2628 formattedbday = "NOTVALID";
2621 if (anni.isEmpty()) 2629 if (anni.isEmpty())
2622 anni = "INVALID"; 2630 anni = "INVALID";
2623 2631
2624 birthdayList.append(formattedbday); 2632 birthdayList.append(formattedbday);
2625 anniversaryList.append(anni); //should be ISODate 2633 anniversaryList.append(anni); //should be ISODate
2626 realNameList.append((*it).realName()); 2634 realNameList.append((*it).realName());
2627 preferredEmailList.append((*it).preferredEmail()); 2635 preferredEmailList.append((*it).preferredEmail());
2628 assembledNameList.append((*it).assembledName()); 2636 assembledNameList.append((*it).assembledName());
2629 uidList.append((*it).uid()); 2637 uidList.append((*it).uid());
2630 2638
2631 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); 2639 //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2632 } 2640 }
2633 } 2641 }
2634 2642
2635 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2643 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2636 2644
2637} 2645}
2638 2646
2639/* this method will be called through the QCop interface from other apps to show details of a contact. 2647/* this method will be called through the QCop interface from other apps to show details of a contact.
2640 */ 2648 */
2641void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2649void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2642{ 2650{
2643 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2651 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2644 2652
2645 QString foundUid = QString::null; 2653 QString foundUid = QString::null;
2646 if ( ! uid.isEmpty() ) { 2654 if ( ! uid.isEmpty() ) {
2647 Addressee adrr = mAddressBook->findByUid( uid ); 2655 Addressee adrr = mAddressBook->findByUid( uid );
2648 if ( !adrr.isEmpty() ) { 2656 if ( !adrr.isEmpty() ) {
2649 foundUid = uid; 2657 foundUid = uid;
2650 } 2658 }
2651 if ( email == "sendbacklist" ) { 2659 if ( email == "sendbacklist" ) {
2652 //qDebug("ssssssssssssssssssssssend "); 2660 //qDebug("ssssssssssssssssssssssend ");
2653 QStringList nameList; 2661 QStringList nameList;
2654 QStringList emailList; 2662 QStringList emailList;
2655 QStringList uidList; 2663 QStringList uidList;
2656 nameList.append(adrr.realName()); 2664 nameList.append(adrr.realName());
2657 emailList = adrr.emails(); 2665 emailList = adrr.emails();
2658 uidList.append( adrr.preferredEmail()); 2666 uidList.append( adrr.preferredEmail());
2659 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2667 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2660 return; 2668 return;
2661 } 2669 }
2662 2670
2663 } 2671 }
2664 2672
2665 if ( email == "sendbacklist" ) 2673 if ( email == "sendbacklist" )
2666 return; 2674 return;
2667 if (foundUid.isEmpty()) 2675 if (foundUid.isEmpty())
2668 { 2676 {
2669 //find the uid of the person first 2677 //find the uid of the person first
2670 Addressee::List namelist; 2678 Addressee::List namelist;
2671 Addressee::List emaillist; 2679 Addressee::List emaillist;
2672 2680
2673 if (!name.isEmpty()) 2681 if (!name.isEmpty())
2674 namelist = mAddressBook->findByName( name ); 2682 namelist = mAddressBook->findByName( name );
2675 2683
2676 if (!email.isEmpty()) 2684 if (!email.isEmpty())
2677 emaillist = mAddressBook->findByEmail( email ); 2685 emaillist = mAddressBook->findByEmail( email );
2678 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2686 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2679 //check if we have a match in Namelist and Emaillist 2687 //check if we have a match in Namelist and Emaillist
2680 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2688 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2681 foundUid = emaillist[0].uid(); 2689 foundUid = emaillist[0].uid();
2682 } 2690 }
2683 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2691 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2684 foundUid = namelist[0].uid(); 2692 foundUid = namelist[0].uid();
2685 else 2693 else
2686 { 2694 {
2687 for (int i = 0; i < namelist.count(); i++) 2695 for (int i = 0; i < namelist.count(); i++)
2688 { 2696 {
2689 for (int j = 0; j < emaillist.count(); j++) 2697 for (int j = 0; j < emaillist.count(); j++)
2690 { 2698 {
2691 if (namelist[i] == emaillist[j]) 2699 if (namelist[i] == emaillist[j])
2692 { 2700 {
2693 foundUid = namelist[i].uid(); 2701 foundUid = namelist[i].uid();
2694 } 2702 }
2695 } 2703 }
2696 } 2704 }
2697 } 2705 }
2698 } 2706 }
2699 else 2707 else
2700 { 2708 {
2701 foundUid = uid; 2709 foundUid = uid;
2702 } 2710 }
2703 2711
2704 if (!foundUid.isEmpty()) 2712 if (!foundUid.isEmpty())
2705 { 2713 {
2706 2714
2707 // raise Ka/Pi if it is in the background 2715 // raise Ka/Pi if it is in the background
2708#ifndef DESKTOP_VERSION 2716#ifndef DESKTOP_VERSION
2709#ifndef KORG_NODCOP 2717#ifndef KORG_NODCOP
2710 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2718 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2711#endif 2719#endif
2712#endif 2720#endif
2713 2721
2714 mMainWindow->showMaximized(); 2722 mMainWindow->showMaximized();
2715 mMainWindow-> raise(); 2723 mMainWindow-> raise();
2716 2724
2717 mViewManager->setSelected( "", false); 2725 mViewManager->setSelected( "", false);
2718 mViewManager->refreshView( "" ); 2726 mViewManager->refreshView( "" );
2719 mViewManager->setSelected( foundUid, true ); 2727 mViewManager->setSelected( foundUid, true );
2720 mViewManager->refreshView( foundUid ); 2728 mViewManager->refreshView( foundUid );
2721 2729
2722 if ( !mMultipleViewsAtOnce ) 2730 if ( !mMultipleViewsAtOnce )
2723 { 2731 {
2724 setDetailsVisible( true ); 2732 setDetailsVisible( true );
2725 mActionDetails->setChecked(true); 2733 mActionDetails->setChecked(true);
2726 } 2734 }
2727 } 2735 }
2728} 2736}
2729 2737void KABCore::storagehowto()
2738{
2739 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
2740}
2730void KABCore::whatsnew() 2741void KABCore::whatsnew()
2731{ 2742{
2732 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2743 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2733} 2744}
2734void KABCore::synchowto() 2745void KABCore::synchowto()
2735{ 2746{
2736 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2747 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2737} 2748}
2738void KABCore::kdesynchowto() 2749void KABCore::kdesynchowto()
2739{ 2750{
2740 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2751 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2741} 2752}
2742void KABCore::multisynchowto() 2753void KABCore::multisynchowto()
2743{ 2754{
2744 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2755 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2745} 2756}
2746void KABCore::faq() 2757void KABCore::faq()
2747{ 2758{
2748 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2759 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2749} 2760}
2750 2761
2751#include <libkcal/syncdefines.h> 2762#include <libkcal/syncdefines.h>
2752 2763
2753KABC::Addressee KABCore::getLastSyncAddressee() 2764KABC::Addressee KABCore::getLastSyncAddressee()
2754{ 2765{
2755 Addressee lse; 2766 Addressee lse;
2756 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2767 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2757 2768
2758 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2769 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2759 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2770 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2760 if (lse.isEmpty()) { 2771 if (lse.isEmpty()) {
2761 qDebug("KA: Creating new last-syncAddressee "); 2772 qDebug("KA: Creating new last-syncAddressee ");
2762 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2773 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2763 QString sum = ""; 2774 QString sum = "";
2764 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2775 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2765 sum = "E: "; 2776 sum = "E: ";
2766 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2777 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2767 lse.setRevision( mLastAddressbookSync ); 2778 lse.setRevision( mLastAddressbookSync );
2768 lse.setCategories( i18n("SyncEvent") ); 2779 lse.setCategories( i18n("SyncEvent") );
2769 mAddressBook->insertAddressee( lse ); 2780 mAddressBook->insertAddressee( lse );
2770 } 2781 }
2771 return lse; 2782 return lse;
2772} 2783}
2773int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2784int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2774{ 2785{
2775 2786
2776 //void setZaurusId(int id); 2787 //void setZaurusId(int id);
2777 // int zaurusId() const; 2788 // int zaurusId() const;
2778 // void setZaurusUid(int id); 2789 // void setZaurusUid(int id);
2779 // int zaurusUid() const; 2790 // int zaurusUid() const;
2780 // void setZaurusStat(int id); 2791 // void setZaurusStat(int id);
2781 // int zaurusStat() const; 2792 // int zaurusStat() const;
2782 // 0 equal 2793 // 0 equal
2783 // 1 take local 2794 // 1 take local
2784 // 2 take remote 2795 // 2 take remote
2785 // 3 cancel 2796 // 3 cancel
2786 QDateTime lastSync = mLastAddressbookSync; 2797 QDateTime lastSync = mLastAddressbookSync;
2787 QDateTime localMod = local->revision(); 2798 QDateTime localMod = local->revision();
2788 QDateTime remoteMod = remote->revision(); 2799 QDateTime remoteMod = remote->revision();
2789 2800
2790 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2801 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2791 2802
2792 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2803 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2793 bool remCh, locCh; 2804 bool remCh, locCh;
2794 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2805 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2795 //if ( remCh ) 2806 //if ( remCh )
2796 // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2807 // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2797 locCh = ( localMod > mLastAddressbookSync ); 2808 locCh = ( localMod > mLastAddressbookSync );
2798 //qDebug("cahnged rem %d loc %d",remCh, locCh ); 2809 //qDebug("cahnged rem %d loc %d",remCh, locCh );
2799 if ( !remCh && ! locCh ) { 2810 if ( !remCh && ! locCh ) {
2800 //qDebug("both not changed "); 2811 //qDebug("both not changed ");
2801 lastSync = localMod.addDays(1); 2812 lastSync = localMod.addDays(1);
2802 if ( mode <= SYNC_PREF_ASK ) 2813 if ( mode <= SYNC_PREF_ASK )
2803 return 0; 2814 return 0;
2804 } else { 2815 } else {
2805 if ( locCh ) { 2816 if ( locCh ) {
2806 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2817 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2807 lastSync = localMod.addDays( -1 ); 2818 lastSync = localMod.addDays( -1 );
2808 if ( !remCh ) 2819 if ( !remCh )
2809 remoteMod =( lastSync.addDays( -1 ) ); 2820 remoteMod =( lastSync.addDays( -1 ) );
2810 } else { 2821 } else {
2811 //qDebug(" not loc changed "); 2822 //qDebug(" not loc changed ");
2812 lastSync = localMod.addDays( 1 ); 2823 lastSync = localMod.addDays( 1 );
2813 if ( remCh ) { 2824 if ( remCh ) {
2814 //qDebug("rem changed "); 2825 //qDebug("rem changed ");
2815 remoteMod =( lastSync.addDays( 1 ) ); 2826 remoteMod =( lastSync.addDays( 1 ) );
2816 } 2827 }
2817 2828
2818 } 2829 }
2819 } 2830 }
2820 full = true; 2831 full = true;
2821 if ( mode < SYNC_PREF_ASK ) 2832 if ( mode < SYNC_PREF_ASK )
2822 mode = SYNC_PREF_ASK; 2833 mode = SYNC_PREF_ASK;
2823 } else { 2834 } else {
2824 if ( localMod == remoteMod ) 2835 if ( localMod == remoteMod )
2825 return 0; 2836 return 0;
2826 2837
2827 } 2838 }
2828 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); 2839 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2829 //qDebug("lastsync %s ", lastSync.toString().latin1() ); 2840 //qDebug("lastsync %s ", lastSync.toString().latin1() );
2830 //full = true; //debug only 2841 //full = true; //debug only
2831 if ( full ) { 2842 if ( full ) {
2832 bool equ = ( (*local) == (*remote) ); 2843 bool equ = ( (*local) == (*remote) );
2833 if ( equ ) { 2844 if ( equ ) {
2834 //qDebug("equal "); 2845 //qDebug("equal ");
2835 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2846 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2836 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2847 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2837 } 2848 }
2838 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2849 if ( mode < SYNC_PREF_FORCE_LOCAL )
2839 return 0; 2850 return 0;
2840 2851
2841 }//else //debug only 2852 }//else //debug only
2842 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2853 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2843 } 2854 }
2844 int result; 2855 int result;
2845 bool localIsNew; 2856 bool localIsNew;
2846 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2857 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
2847 2858
2848 if ( full && mode < SYNC_PREF_NEWEST ) 2859 if ( full && mode < SYNC_PREF_NEWEST )
2849 mode = SYNC_PREF_ASK; 2860 mode = SYNC_PREF_ASK;
2850 2861
2851 switch( mode ) { 2862 switch( mode ) {
2852 case SYNC_PREF_LOCAL: 2863 case SYNC_PREF_LOCAL:
2853 if ( lastSync > remoteMod ) 2864 if ( lastSync > remoteMod )
2854 return 1; 2865 return 1;
2855 if ( lastSync > localMod ) 2866 if ( lastSync > localMod )
2856 return 2; 2867 return 2;
2857 return 1; 2868 return 1;
2858 break; 2869 break;
2859 case SYNC_PREF_REMOTE: 2870 case SYNC_PREF_REMOTE:
2860 if ( lastSync > remoteMod ) 2871 if ( lastSync > remoteMod )
2861 return 1; 2872 return 1;
2862 if ( lastSync > localMod ) 2873 if ( lastSync > localMod )
2863 return 2; 2874 return 2;
2864 return 2; 2875 return 2;
2865 break; 2876 break;
2866 case SYNC_PREF_NEWEST: 2877 case SYNC_PREF_NEWEST:
2867 if ( localMod > remoteMod ) 2878 if ( localMod > remoteMod )
2868 return 1; 2879 return 1;
2869 else 2880 else
2870 return 2; 2881 return 2;
2871 break; 2882 break;
2872 case SYNC_PREF_ASK: 2883 case SYNC_PREF_ASK:
2873 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2884 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2874 if ( lastSync > remoteMod ) 2885 if ( lastSync > remoteMod )
2875 return 1; 2886 return 1;
2876 if ( lastSync > localMod ) { 2887 if ( lastSync > localMod ) {
2877 return 2; 2888 return 2;
2878 } 2889 }
2879 localIsNew = localMod >= remoteMod; 2890 localIsNew = localMod >= remoteMod;
2880 //qDebug("conflict! ************************************** "); 2891 //qDebug("conflict! ************************************** ");
2881 { 2892 {
2882 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2893 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2883 result = acd.executeD(localIsNew); 2894 result = acd.executeD(localIsNew);
2884 return result; 2895 return result;
2885 } 2896 }
2886 break; 2897 break;
2887 case SYNC_PREF_FORCE_LOCAL: 2898 case SYNC_PREF_FORCE_LOCAL:
2888 return 1; 2899 return 1;
2889 break; 2900 break;
2890 case SYNC_PREF_FORCE_REMOTE: 2901 case SYNC_PREF_FORCE_REMOTE:
2891 return 2; 2902 return 2;
2892 break; 2903 break;
2893 2904
2894 default: 2905 default:
2895 // SYNC_PREF_TAKE_BOTH not implemented 2906 // SYNC_PREF_TAKE_BOTH not implemented
2896 break; 2907 break;
2897 } 2908 }
2898 return 0; 2909 return 0;
2899} 2910}
2900 2911
2901 2912
2902bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2913bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2903{ 2914{
2904 bool syncOK = true; 2915 bool syncOK = true;
2905 int addedAddressee = 0; 2916 int addedAddressee = 0;
2906 int addedAddresseeR = 0; 2917 int addedAddresseeR = 0;
2907 int deletedAddresseeR = 0; 2918 int deletedAddresseeR = 0;
2908 int deletedAddresseeL = 0; 2919 int deletedAddresseeL = 0;
2909 int changedLocal = 0; 2920 int changedLocal = 0;
2910 int changedRemote = 0; 2921 int changedRemote = 0;
2911 int filteredIN = 0; 2922 int filteredIN = 0;
2912 int filteredOUT = 0; 2923 int filteredOUT = 0;
2913 2924
2914 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2925 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2915 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2926 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2916 2927
2917 //QPtrList<Addressee> el = local->rawAddressees(); 2928 //QPtrList<Addressee> el = local->rawAddressees();
2918 Addressee addresseeR; 2929 Addressee addresseeR;
2919 QString uid; 2930 QString uid;
2920 int take; 2931 int take;
2921 Addressee addresseeL; 2932 Addressee addresseeL;
2922 Addressee addresseeRSync; 2933 Addressee addresseeRSync;
2923 Addressee addresseeLSync; 2934 Addressee addresseeLSync;
2924 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2935 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2925 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2936 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2926 bool fullDateRange = false; 2937 bool fullDateRange = false;
2927 local->resetTempSyncStat(); 2938 local->resetTempSyncStat();
2928 mLastAddressbookSync = QDateTime::currentDateTime(); 2939 mLastAddressbookSync = QDateTime::currentDateTime();
2929 if ( syncManager->syncWithDesktop() ) { 2940 if ( syncManager->syncWithDesktop() ) {
2930 // remote->removeSyncInfo( QString());//remove all info 2941 // remote->removeSyncInfo( QString());//remove all info
2931 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2942 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2932 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2943 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2933 qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2944 qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2934 } else { 2945 } else {
2935 qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); 2946 qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime ");
2936 } 2947 }
2937 } 2948 }
2938 QDateTime modifiedCalendar = mLastAddressbookSync; 2949 QDateTime modifiedCalendar = mLastAddressbookSync;
2939 addresseeLSync = getLastSyncAddressee(); 2950 addresseeLSync = getLastSyncAddressee();
2940 qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2951 qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1());
2941 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2952 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2942 if ( !addresseeR.isEmpty() ) { 2953 if ( !addresseeR.isEmpty() ) {
2943 addresseeRSync = addresseeR; 2954 addresseeRSync = addresseeR;
2944 remote->removeAddressee(addresseeR ); 2955 remote->removeAddressee(addresseeR );
2945 2956
2946 } else { 2957 } else {
2947 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2958 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2948 addresseeRSync = addresseeLSync ; 2959 addresseeRSync = addresseeLSync ;
2949 } else { 2960 } else {
2950 //qDebug("FULLDATE 1"); 2961 //qDebug("FULLDATE 1");
2951 fullDateRange = true; 2962 fullDateRange = true;
2952 Addressee newAdd; 2963 Addressee newAdd;
2953 addresseeRSync = newAdd; 2964 addresseeRSync = newAdd;
2954 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2965 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2955 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2966 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2956 addresseeRSync.setRevision( mLastAddressbookSync ); 2967 addresseeRSync.setRevision( mLastAddressbookSync );
2957 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2968 addresseeRSync.setCategories( i18n("SyncAddressee") );
2958 } 2969 }
2959 } 2970 }
2960 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2971 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2961 // qDebug("FULLDATE 2"); 2972 // qDebug("FULLDATE 2");
2962 fullDateRange = true; 2973 fullDateRange = true;
2963 } 2974 }
2964 if ( ! fullDateRange ) { 2975 if ( ! fullDateRange ) {
2965 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2976 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2966 2977
2967 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2978 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2968 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2979 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2969 fullDateRange = true; 2980 fullDateRange = true;
2970 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2981 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2971 } 2982 }
2972 } 2983 }
2973 // fullDateRange = true; // debug only! 2984 // fullDateRange = true; // debug only!
2974 if ( fullDateRange ) 2985 if ( fullDateRange )
2975 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2986 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2976 else 2987 else
2977 mLastAddressbookSync = addresseeLSync.revision(); 2988 mLastAddressbookSync = addresseeLSync.revision();
2978 // for resyncing if own file has changed 2989 // for resyncing if own file has changed
2979 // PENDING fixme later when implemented 2990 // PENDING fixme later when implemented
2980#if 0 2991#if 0
2981 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2992 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2982 mLastAddressbookSync = loadedFileVersion; 2993 mLastAddressbookSync = loadedFileVersion;
2983 qDebug("setting mLastAddressbookSync "); 2994 qDebug("setting mLastAddressbookSync ");
2984 } 2995 }
2985#endif 2996#endif
2986 2997
2987 2998
2988 // ********** setting filters **************** 2999 // ********** setting filters ****************
2989 Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); 3000 Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB );
2990 Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); 3001 Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB );
2991 3002
2992 //qDebug("*************************** "); 3003 //qDebug("*************************** ");
2993 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 3004 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2994 QStringList er = remote->uidList(); 3005 QStringList er = remote->uidList();
2995 Addressee inR ;//= er.first(); 3006 Addressee inR ;//= er.first();
2996 Addressee inL; 3007 Addressee inL;
2997 3008
2998 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 3009 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2999 3010
3000 int modulo = (er.count()/10)+1; 3011 int modulo = (er.count()/10)+1;
3001 int incCounter = 0; 3012 int incCounter = 0;
3002 while ( incCounter < er.count()) { 3013 while ( incCounter < er.count()) {
3003 if (syncManager->isProgressBarCanceled()) 3014 if (syncManager->isProgressBarCanceled())
3004 return false; 3015 return false;
3005 if ( incCounter % modulo == 0 ) 3016 if ( incCounter % modulo == 0 )
3006 syncManager->showProgressBar(incCounter); 3017 syncManager->showProgressBar(incCounter);
3007 3018
3008 uid = er[ incCounter ]; 3019 uid = er[ incCounter ];
3009 bool skipIncidence = false; 3020 bool skipIncidence = false;
3010 if ( uid.left(19) == QString("last-syncAddressee-") ) 3021 if ( uid.left(19) == QString("last-syncAddressee-") )
3011 skipIncidence = true; 3022 skipIncidence = true;
3012 QString idS,OidS; 3023 QString idS,OidS;
3013 qApp->processEvents(); 3024 qApp->processEvents();
3014 if ( !skipIncidence ) { 3025 if ( !skipIncidence ) {
3015 inL = local->findByUid( uid ); 3026 inL = local->findByUid( uid );
3016 inR = remote->findByUid( uid ); 3027 inR = remote->findByUid( uid );
3017 //inL.setResource( 0 ); 3028 //inL.setResource( 0 );
3018 //inR.setResource( 0 ); 3029 //inR.setResource( 0 );
3019 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 3030 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
3020 if ( !inL.resource() || inL.resource()->includeInSync() ) { 3031 if ( !inL.resource() || inL.resource()->includeInSync() ) {
3021 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { 3032 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) {
3022 //qDebug("take %d %s ", take, inL.summary().latin1()); 3033 //qDebug("take %d %s ", take, inL.summary().latin1());
3023 if ( take == 3 ) 3034 if ( take == 3 )
3024 return false; 3035 return false;
3025 if ( take == 1 ) {// take local ********************** 3036 if ( take == 1 ) {// take local **********************
3026 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3037 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3027 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 3038 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
3028 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 3039 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
3029 local->insertAddressee( inL, false ); 3040 local->insertAddressee( inL, false );
3030 idS = inR.externalUID(); 3041 idS = inR.externalUID();
3031 OidS = inR.originalExternalUID(); 3042 OidS = inR.originalExternalUID();
3032 } 3043 }
3033 else 3044 else
3034 idS = inR.IDStr(); 3045 idS = inR.IDStr();
3035 remote->removeAddressee( inR ); 3046 remote->removeAddressee( inR );
3036 inR = inL; 3047 inR = inL;
3037 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 3048 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
3038 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3049 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3039 inR.setOriginalExternalUID( OidS ); 3050 inR.setOriginalExternalUID( OidS );
3040 inR.setExternalUID( idS ); 3051 inR.setExternalUID( idS );
3041 if ( syncManager->syncWithDesktop() ) { 3052 if ( syncManager->syncWithDesktop() ) {
3042 inR.setIDStr("changed" ); 3053 inR.setIDStr("changed" );
3043 } 3054 }
3044 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); 3055 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
3045 } else { 3056 } else {
3046 inR.setIDStr( idS ); 3057 inR.setIDStr( idS );
3047 } 3058 }
3048 inR.setResource( 0 ); 3059 inR.setResource( 0 );
3049 remote->insertAddressee( inR , false); 3060 remote->insertAddressee( inR , false);
3050 ++changedRemote; 3061 ++changedRemote;
3051 } else { // take == 2 take remote ********************** 3062 } else { // take == 2 take remote **********************
3052 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3063 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3053 if ( inR.revision().date().year() < 2004 ) 3064 if ( inR.revision().date().year() < 2004 )
3054 inR.setRevision( modifiedCalendar ); 3065 inR.setRevision( modifiedCalendar );
3055 } 3066 }
3056 idS = inL.IDStr(); 3067 idS = inL.IDStr();
3057 local->removeAddressee( inL ); 3068 local->removeAddressee( inL );
3058 inL = inR; 3069 inL = inR;
3059 inL.setIDStr( idS ); 3070 inL.setIDStr( idS );
3060 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3071 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3061 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 3072 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
3062 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 3073 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
3063 } 3074 }
3064 inL.setResource( 0 ); 3075 inL.setResource( 0 );
3065 local->insertAddressee( inL , false ); 3076 local->insertAddressee( inL , false );
3066 ++changedLocal; 3077 ++changedLocal;
3067 } 3078 }
3068 } 3079 }
3069 } 3080 }
3070 } else { // no conflict ********** add or delete remote 3081 } else { // no conflict ********** add or delete remote
3071 if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { 3082 if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) {
3072 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3083 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3073 QString des = addresseeLSync.note(); 3084 QString des = addresseeLSync.note();
3074 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 3085 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
3075 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 3086 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
3076 remote->insertAddressee( inR, false ); 3087 remote->insertAddressee( inR, false );
3077 ++deletedAddresseeR; 3088 ++deletedAddresseeR;
3078 } else { 3089 } else {
3079 inR.setRevision( modifiedCalendar ); 3090 inR.setRevision( modifiedCalendar );
3080 remote->insertAddressee( inR, false ); 3091 remote->insertAddressee( inR, false );
3081 inL = inR; 3092 inL = inR;
3082 inL.setIDStr( ":" ); 3093 inL.setIDStr( ":" );
3083 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 3094 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
3084 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 3095 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
3085 inL.setResource( 0 ); 3096 inL.setResource( 0 );
3086 local->insertAddressee( inL , false); 3097 local->insertAddressee( inL , false);
3087 ++addedAddressee; 3098 ++addedAddressee;
3088 } 3099 }
3089 } else { 3100 } else {
3090 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 3101 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
3091 inR.setRevision( modifiedCalendar ); 3102 inR.setRevision( modifiedCalendar );
3092 remote->insertAddressee( inR, false ); 3103 remote->insertAddressee( inR, false );
3093 inR.setResource( 0 ); 3104 inR.setResource( 0 );
3094 local->insertAddressee( inR, false ); 3105 local->insertAddressee( inR, false );
3095 ++addedAddressee; 3106 ++addedAddressee;
3096 } else { 3107 } else {
3097 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 3108 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
3098 remote->removeAddressee( inR ); 3109 remote->removeAddressee( inR );
3099 ++deletedAddresseeR; 3110 ++deletedAddresseeR;
3100 } 3111 }
3101 } 3112 }
3102 } else { 3113 } else {
3103 ++filteredIN; 3114 ++filteredIN;
3104 } 3115 }
3105 } 3116 }
3106 } 3117 }
3107 ++incCounter; 3118 ++incCounter;
3108 } 3119 }
3109 er.clear(); 3120 er.clear();
3110 QStringList el = local->uidList(); 3121 QStringList el = local->uidList();
3111 modulo = (el.count()/10)+1; 3122 modulo = (el.count()/10)+1;
3112 3123
3113 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 3124 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
3114 incCounter = 0; 3125 incCounter = 0;
3115 while ( incCounter < el.count()) { 3126 while ( incCounter < el.count()) {
3116 qApp->processEvents(); 3127 qApp->processEvents();
3117 if (syncManager->isProgressBarCanceled()) 3128 if (syncManager->isProgressBarCanceled())
3118 return false; 3129 return false;
3119 if ( incCounter % modulo == 0 ) 3130 if ( incCounter % modulo == 0 )
3120 syncManager->showProgressBar(incCounter); 3131 syncManager->showProgressBar(incCounter);
3121 uid = el[ incCounter ]; 3132 uid = el[ incCounter ];
3122 bool skipIncidence = false; 3133 bool skipIncidence = false;
3123 if ( uid.left(19) == QString("last-syncAddressee-") ) 3134 if ( uid.left(19) == QString("last-syncAddressee-") )
3124 skipIncidence = true; 3135 skipIncidence = true;
3125 if ( !skipIncidence ) { 3136 if ( !skipIncidence ) {
3126 inL = local->findByUid( uid ); 3137 inL = local->findByUid( uid );
3127 if ( !inL.resource() || inL.resource()->includeInSync() ) { 3138 if ( !inL.resource() || inL.resource()->includeInSync() ) {
3128 inR = remote->findByUid( uid ); 3139 inR = remote->findByUid( uid );
3129 if ( inR.isEmpty() ){ 3140 if ( inR.isEmpty() ){
3130 if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { 3141 if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) {
3131 // no conflict ********** add or delete local 3142 // no conflict ********** add or delete local
3132 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3143 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3133 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 3144 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
3134 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 3145 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
3135 local->removeAddressee( inL ); 3146 local->removeAddressee( inL );
3136 ++deletedAddresseeL; 3147 ++deletedAddresseeL;
3137 } else { 3148 } else {
3138 if ( ! syncManager->mWriteBackExistingOnly ) { 3149 if ( ! syncManager->mWriteBackExistingOnly ) {
3139 inL.removeID(mCurrentSyncDevice ); 3150 inL.removeID(mCurrentSyncDevice );
3140 ++addedAddresseeR; 3151 ++addedAddresseeR;
3141 inL.setRevision( modifiedCalendar ); 3152 inL.setRevision( modifiedCalendar );
3142 local->insertAddressee( inL, false ); 3153 local->insertAddressee( inL, false );
3143 inR = inL; 3154 inR = inL;
3144 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 3155 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
3145 inR.setResource( 0 ); 3156 inR.setResource( 0 );
3146 remote->insertAddressee( inR, false ); 3157 remote->insertAddressee( inR, false );
3147 } 3158 }
3148 } 3159 }
3149 } else { 3160 } else {
3150 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 3161 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
3151 //qDebug("data %s ", inL.revision().toString().latin1()); 3162 //qDebug("data %s ", inL.revision().toString().latin1());
3152 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 3163 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
3153 local->removeAddressee( inL ); 3164 local->removeAddressee( inL );
3154 ++deletedAddresseeL; 3165 ++deletedAddresseeL;
3155 } else { 3166 } else {
3156 if ( ! syncManager->mWriteBackExistingOnly ) { 3167 if ( ! syncManager->mWriteBackExistingOnly ) {
3157 ++addedAddresseeR; 3168 ++addedAddresseeR;
3158 inL.setRevision( modifiedCalendar ); 3169 inL.setRevision( modifiedCalendar );
3159 local->insertAddressee( inL, false ); 3170 local->insertAddressee( inL, false );
3160 inR = inL; 3171 inR = inL;
3161 inR.setIDStr( ":" ); 3172 inR.setIDStr( ":" );
3162 inR.setResource( 0 ); 3173 inR.setResource( 0 );
3163 remote->insertAddressee( inR, false ); 3174 remote->insertAddressee( inR, false );
3164 } 3175 }
3165 } 3176 }
3166 } 3177 }
3167 } else { 3178 } else {
3168 ++filteredOUT; 3179 ++filteredOUT;
3169 } 3180 }
3170 } 3181 }
3171 } 3182 }
3172 } 3183 }
3173 ++incCounter; 3184 ++incCounter;
3174 } 3185 }
3175 el.clear(); 3186 el.clear();
3176 syncManager->hideProgressBar(); 3187 syncManager->hideProgressBar();
3177 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 3188 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
3178 // get rid of micro seconds 3189 // get rid of micro seconds
3179 QTime t = mLastAddressbookSync.time(); 3190 QTime t = mLastAddressbookSync.time();
3180 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 3191 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
3181 addresseeLSync.setRevision( mLastAddressbookSync ); 3192 addresseeLSync.setRevision( mLastAddressbookSync );
3182 addresseeRSync.setRevision( mLastAddressbookSync ); 3193 addresseeRSync.setRevision( mLastAddressbookSync );
3183 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 3194 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
3184 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 3195 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
3185 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 3196 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
3186 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 3197 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
3187 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 3198 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
3188 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 3199 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
3189 addresseeRSync.setNote( "" ) ; 3200 addresseeRSync.setNote( "" ) ;
3190 addresseeLSync.setNote( "" ); 3201 addresseeLSync.setNote( "" );
3191 3202
3192 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 3203 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
3193 remote->insertAddressee( addresseeRSync, false ); 3204 remote->insertAddressee( addresseeRSync, false );
3194 local->insertAddressee( addresseeLSync, false ); 3205 local->insertAddressee( addresseeLSync, false );
3195 QString mes; 3206 QString mes;
3196 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); 3207 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT );
3197 qDebug( mes ); 3208 qDebug( mes );
3198 mes = i18n("Local addressbook changed!\n") +mes; 3209 mes = i18n("Local addressbook changed!\n") +mes;
3199 if ( syncManager->mShowSyncSummary ) { 3210 if ( syncManager->mShowSyncSummary ) {
3200 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 3211 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
3201 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 3212 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
3202 qDebug("KA: WB cancelled "); 3213 qDebug("KA: WB cancelled ");
3203 syncManager->mWriteBackFile = false; 3214 syncManager->mWriteBackFile = false;
3204 return syncOK; 3215 return syncOK;
3205 } 3216 }
3206 } 3217 }
3207 return syncOK; 3218 return syncOK;
3208} 3219}
3209 3220
3210 3221
3211//this is a overwritten callbackmethods from the syncinterface 3222//this is a overwritten callbackmethods from the syncinterface
3212bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 3223bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
3213{ 3224{
3214 3225
3215 //pending prepare addresseeview for output 3226 //pending prepare addresseeview for output
3216 //pending detect, if remote file has REV field. if not switch to external sync 3227 //pending detect, if remote file has REV field. if not switch to external sync
3217 mGlobalSyncMode = SYNC_MODE_NORMAL; 3228 mGlobalSyncMode = SYNC_MODE_NORMAL;
3218 if ( manager != syncManager ) 3229 if ( manager != syncManager )
3219 qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); 3230 qDebug("KABCore::sync:: ERROR! :: manager != syncManager ");
3220 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3231 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3221 3232
3222 AddressBook abLocal(filename,"syncContact"); 3233 AddressBook abLocal(filename,"syncContact");
3223 bool syncOK = false; 3234 bool syncOK = false;
3224 if ( abLocal.load() ) { 3235 if ( abLocal.load() ) {
3225 qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); 3236 qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode );
3226 bool external = false; 3237 bool external = false;
3227 bool isXML = false; 3238 bool isXML = false;
3228 if ( filename.right(4) == ".xml") { 3239 if ( filename.right(4) == ".xml") {
3229 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3240 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3230 isXML = true; 3241 isXML = true;
3231 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3242 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3232 } else { 3243 } else {
3233 external = !manager->mIsKapiFile; 3244 external = !manager->mIsKapiFile;
3234 if ( external ) { 3245 if ( external ) {
3235 qDebug("KA: Sync::Setting vcf mode to external "); 3246 qDebug("KA: Sync::Setting vcf mode to external ");
3236 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3247 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3237 AddressBook::Iterator it; 3248 AddressBook::Iterator it;
3238 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3249 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3239 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 3250 (*it).setID( mCurrentSyncDevice, (*it).uid() );
3240 (*it).computeCsum( mCurrentSyncDevice ); 3251 (*it).computeCsum( mCurrentSyncDevice );
3241 } 3252 }
3242 } 3253 }
3243 } 3254 }
3244 //AddressBook::Iterator it; 3255 //AddressBook::Iterator it;
3245 //QStringList vcards; 3256 //QStringList vcards;
3246 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3257 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3247 // qDebug("Name %s ", (*it).familyName().latin1()); 3258 // qDebug("Name %s ", (*it).familyName().latin1());
3248 //} 3259 //}
3249 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 3260 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
3250 syncManager->hideProgressBar(); 3261 syncManager->hideProgressBar();
3251 if ( syncOK ) { 3262 if ( syncOK ) {
3252 if ( syncManager->mWriteBackFile ) 3263 if ( syncManager->mWriteBackFile )
3253 { 3264 {
3254 if ( external ) 3265 if ( external )
3255 abLocal.removeSyncAddressees( !isXML); 3266 abLocal.removeSyncAddressees( !isXML);
3256 qDebug("KA: Sync::Saving remote AB "); 3267 qDebug("KA: Sync::Saving remote AB ");
3257 if ( ! abLocal.saveAB()) 3268 if ( ! abLocal.saveAB())
3258 qDebug("KA: sync::Error writing back AB to file "); 3269 qDebug("KA: sync::Error writing back AB to file ");
3259 if ( external ) { 3270 if ( external ) {
3260 // afterwrite processing 3271 // afterwrite processing
3261 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 3272 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
3262 } 3273 }
3263 } 3274 }
3264 } 3275 }
3265 setModified(); 3276 setModified();
3266 3277
3267 } 3278 }
3268 abLocal.removeResources(); 3279 abLocal.removeResources();
3269 if ( syncOK ) 3280 if ( syncOK )
3270 mViewManager->refreshView(); 3281 mViewManager->refreshView();
3271 return syncOK; 3282 return syncOK;
3272 3283
3273} 3284}
3274void KABCore::removeSyncInfo( QString syncProfile) 3285void KABCore::removeSyncInfo( QString syncProfile)
3275{ 3286{
3276 qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 3287 qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1());
3277 mAddressBook->removeSyncInfo( syncProfile ); 3288 mAddressBook->removeSyncInfo( syncProfile );
3278 setModified(); 3289 setModified();
3279} 3290}
3280 3291
3281 3292
3282//this is a overwritten callbackmethods from the syncinterface 3293//this is a overwritten callbackmethods from the syncinterface
3283bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3294bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3284{ 3295{
3285 if ( resource == "phone" ) 3296 if ( resource == "phone" )
3286 return syncPhone(); 3297 return syncPhone();
3287 disableBR( true ); 3298 disableBR( true );
3288 if ( manager != syncManager ) 3299 if ( manager != syncManager )
3289 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); 3300 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3290 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3301 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3291 3302
3292 AddressBook abLocal( resource,"syncContact"); 3303 AddressBook abLocal( resource,"syncContact");
3293 bool syncOK = false; 3304 bool syncOK = false;
3294 message(i18n("Loading DTM address data..."), false); 3305 message(i18n("Loading DTM address data..."), false);
3295 if ( abLocal.load() ) { 3306 if ( abLocal.load() ) {
3296 qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3307 qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3297 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3308 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3298 message(i18n("Sync preprocessing..."),false); 3309 message(i18n("Sync preprocessing..."),false);
3299 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3310 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3300 message(i18n("Synchronizing..."),false); 3311 message(i18n("Synchronizing..."),false);
3301 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3312 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3302 syncManager->hideProgressBar(); 3313 syncManager->hideProgressBar();
3303 if ( syncOK ) { 3314 if ( syncOK ) {
3304 if ( syncManager->mWriteBackFile ) { 3315 if ( syncManager->mWriteBackFile ) {
3305 abLocal.removeSyncAddressees( false ); 3316 abLocal.removeSyncAddressees( false );
3306 message(i18n("Saving DTM address data..."),false); 3317 message(i18n("Saving DTM address data..."),false);
3307 abLocal.saveAB(); 3318 abLocal.saveAB();
3308 message(i18n("Sync postprocessing..."),false); 3319 message(i18n("Sync postprocessing..."),false);
3309 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3320 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3310 } 3321 }
3311 } else 3322 } else
3312 message( i18n("Sync cancelled or failed.") ); 3323 message( i18n("Sync cancelled or failed.") );
3313 setModified(); 3324 setModified();
3314 } 3325 }
3315 abLocal.removeResources(); 3326 abLocal.removeResources();
3316 if ( syncOK ) { 3327 if ( syncOK ) {
3317 mViewManager->refreshView(); 3328 mViewManager->refreshView();
3318 message(i18n("DTM syncing finished.")); 3329 message(i18n("DTM syncing finished."));
3319 } 3330 }
3320 disableBR( false ); 3331 disableBR( false );
3321 return syncOK; 3332 return syncOK;
3322 3333
3323} 3334}
3324void KABCore::message( QString m, bool startTimer) 3335void KABCore::message( QString m, bool startTimer)
3325{ 3336{
3326 topLevelWidget()->setCaption( m ); 3337 topLevelWidget()->setCaption( m );
3327 qApp->processEvents(); 3338 qApp->processEvents();
3328 if ( startTimer ) 3339 if ( startTimer )
3329 mMessageTimer->start( 15000, true ); 3340 mMessageTimer->start( 15000, true );
3330 else 3341 else
3331 mMessageTimer->stop(); 3342 mMessageTimer->stop();
3332} 3343}
3333bool KABCore::syncPhone() 3344bool KABCore::syncPhone()
3334{ 3345{
3335 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3346 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3336 QString fileName = getPhoneFile(); 3347 QString fileName = getPhoneFile();
3337 if ( !PhoneAccess::readFromPhone( fileName) ) { 3348 if ( !PhoneAccess::readFromPhone( fileName) ) {
3338 message(i18n("Phone access failed!")); 3349 message(i18n("Phone access failed!"));
3339 return false; 3350 return false;
3340 } 3351 }
3341 AddressBook abLocal( fileName,"syncContact"); 3352 AddressBook abLocal( fileName,"syncContact");
3342 bool syncOK = false; 3353 bool syncOK = false;
3343 { 3354 {
3344 abLocal.importFromFile( fileName ); 3355 abLocal.importFromFile( fileName );
3345 qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3356 qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3346 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3357 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3347 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3358 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3348 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3359 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3349 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3360 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3350 syncManager->hideProgressBar(); 3361 syncManager->hideProgressBar();
3351 if ( syncOK ) { 3362 if ( syncOK ) {
3352 if ( syncManager->mWriteBackFile ) { 3363 if ( syncManager->mWriteBackFile ) {
3353 abLocal.removeSyncAddressees( true ); 3364 abLocal.removeSyncAddressees( true );
3354 abLocal.saveABphone( fileName ); 3365 abLocal.saveABphone( fileName );
3355 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3366 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3356 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3367 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
3357 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3368 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3358 } 3369 }
3359 } 3370 }
3360 setModified(); 3371 setModified();
3361 } 3372 }
3362 abLocal.removeResources(); 3373 abLocal.removeResources();
3363 if ( syncOK ) 3374 if ( syncOK )
3364 mViewManager->refreshView(); 3375 mViewManager->refreshView();
3365 return syncOK; 3376 return syncOK;
3366} 3377}
3367void KABCore::getFile( bool success ) 3378void KABCore::getFile( bool success )
3368{ 3379{
3369 if ( ! success ) { 3380 if ( ! success ) {
3370 message( i18n("Error receiving file. Nothing changed!") ); 3381 message( i18n("Error receiving file. Nothing changed!") );
3371 return; 3382 return;
3372 } 3383 }
3373 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 3384 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
3374 if ( count ) 3385 if ( count )
3375 setModified( true ); 3386 setModified( true );
3376 message( i18n("Pi-Sync successful!") ); 3387 message( i18n("Pi-Sync successful!") );
3377 mViewManager->refreshView(); 3388 mViewManager->refreshView();
3378} 3389}
3379void KABCore::syncFileRequest() 3390void KABCore::syncFileRequest()
3380{ 3391{
3381 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 3392 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
3382 syncManager->slotSyncMenu( 999 ); 3393 syncManager->slotSyncMenu( 999 );
3383 } 3394 }
3384 mAddressBook->export2File( sentSyncFile() ); 3395 mAddressBook->export2File( sentSyncFile() );
3385} 3396}
3386QString KABCore::sentSyncFile() 3397QString KABCore::sentSyncFile()
3387{ 3398{
3388#ifdef DESKTOP_VERSION 3399#ifdef DESKTOP_VERSION
3389 return locateLocal( "tmp", "copysyncab.vcf" ); 3400 return locateLocal( "tmp", "copysyncab.vcf" );
3390#else 3401#else
3391 return QString( "/tmp/copysyncab.vcf" ); 3402 return QString( "/tmp/copysyncab.vcf" );
3392#endif 3403#endif
3393} 3404}
3394 3405
3395void KABCore::setCaptionBack() 3406void KABCore::setCaptionBack()
3396{ 3407{
3397 mMessageTimer->stop(); 3408 mMessageTimer->stop();
3398 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 3409 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
3399} 3410}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 4cef73a..80dbf08 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -1,526 +1,528 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> 3 Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef KABCORE_H 24#ifndef KABCORE_H
25#define KABCORE_H 25#define KABCORE_H
26 26
27#include <kabc/field.h> 27#include <kabc/field.h>
28 28
29#ifndef KAB_EMBEDDED 29#ifndef KAB_EMBEDDED
30#endif //KAB_EMBEDDED 30#endif //KAB_EMBEDDED
31#include <qdict.h> 31#include <qdict.h>
32#include <qtimer.h> 32#include <qtimer.h>
33 33
34#include <qwidget.h> 34#include <qwidget.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <ksyncmanager.h> 36#include <ksyncmanager.h>
37#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
38#include <qcopchannel_qws.h> 38#include <qcopchannel_qws.h>
39#endif 39#endif
40 40
41namespace KABC { 41namespace KABC {
42class AddressBook; 42class AddressBook;
43} 43}
44 44
45#ifndef KAB_EMBEDDED 45#ifndef KAB_EMBEDDED
46class KAboutData; 46class KAboutData;
47class KConfig; 47class KConfig;
48 48
49class KAddressBookService; 49class KAddressBookService;
50class LDAPSearchDialog; 50class LDAPSearchDialog;
51#else //KAB_EMBEDDED 51#else //KAB_EMBEDDED
52class KAddressBookMain; 52class KAddressBookMain;
53//US class QAction; 53//US class QAction;
54#endif //KAB_EMBEDDED 54#endif //KAB_EMBEDDED
55class KCMultiDialog; 55class KCMultiDialog;
56class KXMLGUIClient; 56class KXMLGUIClient;
57class ExtensionManager; 57class ExtensionManager;
58class XXPortManager; 58class XXPortManager;
59class JumpButtonBar; 59class JumpButtonBar;
60class IncSearchWidget; 60class IncSearchWidget;
61class KDGanttMinimizeSplitter; 61class KDGanttMinimizeSplitter;
62class KAction; 62class KAction;
63class KActionCollection; 63class KActionCollection;
64class KToggleAction; 64class KToggleAction;
65class KSyncProfile; 65class KSyncProfile;
66 66
67class QAction; 67class QAction;
68class QMenuBar; 68class QMenuBar;
69class QSplitter; 69class QSplitter;
70class ViewContainer; 70class ViewContainer;
71class ViewManager; 71class ViewManager;
72class AddresseeEditorDialog; 72class AddresseeEditorDialog;
73class Ir; 73class Ir;
74 74
75class KABCore : public QWidget, public KSyncInterface 75class KABCore : public QWidget, public KSyncInterface
76{ 76{
77 Q_OBJECT 77 Q_OBJECT
78 78
79 public: 79 public:
80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); 80 KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 );
81 81
82 82
83 ~KABCore(); 83 ~KABCore();
84 84
85 85
86#ifdef KAB_EMBEDDED 86#ifdef KAB_EMBEDDED
87 //US added functionality 87 //US added functionality
88 QPopupMenu* getViewMenu() {return viewMenu;} 88 QPopupMenu* getViewMenu() {return viewMenu;}
89 QPopupMenu* getFilterMenu() {return filterMenu;} 89 QPopupMenu* getFilterMenu() {return filterMenu;}
90 QPopupMenu* getSettingsMenu() {return settingsMenu;} 90 QPopupMenu* getSettingsMenu() {return settingsMenu;}
91 void addActionsManually(); 91 void addActionsManually();
92#endif //KAB_EMBEDDED 92#endif //KAB_EMBEDDED
93 /** 93 /**
94 Restores the global settings. 94 Restores the global settings.
95 */ 95 */
96 void restoreSettings(); 96 void restoreSettings();
97 97
98 98
99 99
100 /** 100 /**
101 Returns a pointer to the StdAddressBook of the application. 101 Returns a pointer to the StdAddressBook of the application.
102 */ 102 */
103 KABC::AddressBook *addressBook() const; 103 KABC::AddressBook *addressBook() const;
104 104
105 /** 105 /**
106 Returns a pointer to the KConfig object of the application. 106 Returns a pointer to the KConfig object of the application.
107 */ 107 */
108 static KConfig *config(); 108 static KConfig *config();
109 109
110 /** 110 /**
111 Returns a pointer to the global KActionCollection object. So 111 Returns a pointer to the global KActionCollection object. So
112 other classes can register their actions easily. 112 other classes can register their actions easily.
113 */ 113 */
114 KActionCollection *actionCollection() const; 114 KActionCollection *actionCollection() const;
115 115
116 /** 116 /**
117 Returns the current search field of the Incremental Search Widget. 117 Returns the current search field of the Incremental Search Widget.
118 */ 118 */
119 KABC::Field *currentSearchField() const; 119 KABC::Field *currentSearchField() const;
120 120
121 /** 121 /**
122 Returns the uid list of the currently selected contacts. 122 Returns the uid list of the currently selected contacts.
123 */ 123 */
124 QStringList selectedUIDs() const; 124 QStringList selectedUIDs() const;
125 125
126 /** 126 /**
127 Displays the ResourceSelectDialog and returns the selected 127 Displays the ResourceSelectDialog and returns the selected
128 resource or a null pointer if no resource was selected by 128 resource or a null pointer if no resource was selected by
129 the user. 129 the user.
130 */ 130 */
131 KABC::Resource *requestResource( QWidget *parent ); 131 KABC::Resource *requestResource( QWidget *parent );
132 132
133#ifndef KAB_EMBEDDED 133#ifndef KAB_EMBEDDED
134 static KAboutData *createAboutData(); 134 static KAboutData *createAboutData();
135#endif //KAB_EMBEDDED 135#endif //KAB_EMBEDDED
136 136
137#ifdef KAB_EMBEDDED 137#ifdef KAB_EMBEDDED
138 inline QPopupMenu* getImportMenu() { return ImportMenu;} 138 inline QPopupMenu* getImportMenu() { return ImportMenu;}
139 inline QPopupMenu* getExportMenu() { return ExportMenu;} 139 inline QPopupMenu* getExportMenu() { return ExportMenu;}
140#endif //KAB_EMBEDDED 140#endif //KAB_EMBEDDED
141 141
142 public slots: 142 public slots:
143#ifdef KAB_EMBEDDED 143#ifdef KAB_EMBEDDED
144 void createAboutData(); 144 void createAboutData();
145#endif //KAB_EMBEDDED 145#endif //KAB_EMBEDDED
146 void setDetailsToggle(); 146 void setDetailsToggle();
147 147
148 void showLicence(); 148 void showLicence();
149 void faq(); 149 void faq();
150 void whatsnew() ; 150 void whatsnew() ;
151 void synchowto() ; 151 void synchowto() ;
152 void storagehowto() ;
152 void multisynchowto() ; 153 void multisynchowto() ;
153 void kdesynchowto() ; 154 void kdesynchowto() ;
154 void writeToPhone(); 155 void writeToPhone();
155 156
156 /** 157 /**
157 Is called whenever a contact is selected in the view. 158 Is called whenever a contact is selected in the view.
158 */ 159 */
159 void setContactSelected( const QString &uid ); 160 void setContactSelected( const QString &uid );
160 161
161 /** 162 /**
162 Opens the preferred mail composer with all selected contacts as 163 Opens the preferred mail composer with all selected contacts as
163 arguments. 164 arguments.
164 */ 165 */
165 void sendMail(); 166 void sendMail();
166 167
167 /** 168 /**
168 Opens the preferred mail composer with the given contacts as 169 Opens the preferred mail composer with the given contacts as
169 arguments. 170 arguments.
170 */ 171 */
171 void sendMail( const QString& email ); 172 void sendMail( const QString& email );
172 173
173 174
174 void mailVCard(); 175 void mailVCard();
175 void mailVCard(const QStringList& uids); 176 void mailVCard(const QStringList& uids);
176 177
177 /** 178 /**
178 Beams the "WhoAmI contact. 179 Beams the "WhoAmI contact.
179 */ 180 */
180 void beamMySelf(); 181 void beamMySelf();
181 182
182 void beamVCard(); 183 void beamVCard();
183 void export2phone(); 184 void export2phone();
184 void beamVCard(const QStringList& uids); 185 void beamVCard(const QStringList& uids);
185 void beamDone( Ir *ir ); 186 void beamDone( Ir *ir );
186 187
187 188
188 /** 189 /**
189 Starts the preferred web browser with the given URL as argument. 190 Starts the preferred web browser with the given URL as argument.
190 */ 191 */
191 void browse( const QString& url ); 192 void browse( const QString& url );
192 193
193 /** 194 /**
194 Select all contacts in the view. 195 Select all contacts in the view.
195 */ 196 */
196 void selectAllContacts(); 197 void selectAllContacts();
197 198
198 /** 199 /**
199 Deletes all selected contacts from the address book. 200 Deletes all selected contacts from the address book.
200 */ 201 */
201 void deleteContacts(); 202 void deleteContacts();
202 203
203 /** 204 /**
204 Deletes given contacts from the address book. 205 Deletes given contacts from the address book.
205 206
206 @param uids The uids of the contacts, which shall be deleted. 207 @param uids The uids of the contacts, which shall be deleted.
207 */ 208 */
208 void deleteContacts( const QStringList &uids ); 209 void deleteContacts( const QStringList &uids );
209 210
210 /** 211 /**
211 Copys the selected contacts into clipboard for later pasting. 212 Copys the selected contacts into clipboard for later pasting.
212 */ 213 */
213 void copyContacts(); 214 void copyContacts();
214 215
215 /** 216 /**
216 Cuts the selected contacts and stores them for later pasting. 217 Cuts the selected contacts and stores them for later pasting.
217 */ 218 */
218 void cutContacts(); 219 void cutContacts();
219 220
220 /** 221 /**
221 Paste contacts from clipboard into the address book. 222 Paste contacts from clipboard into the address book.
222 */ 223 */
223 void pasteContacts(); 224 void pasteContacts();
224 225
225 /** 226 /**
226 Paste given contacts into the address book. 227 Paste given contacts into the address book.
227 228
228 @param list The list of addressee, which shall be pasted. 229 @param list The list of addressee, which shall be pasted.
229 */ 230 */
230 void pasteContacts( KABC::Addressee::List &list ); 231 void pasteContacts( KABC::Addressee::List &list );
231 232
232 /** 233 /**
233 Sets the whoAmI contact, that is used by many other programs to 234 Sets the whoAmI contact, that is used by many other programs to
234 get personal information about the current user. 235 get personal information about the current user.
235 */ 236 */
236 void setWhoAmI(); 237 void setWhoAmI();
237 238
238 /** 239 /**
239 Displays the category dialog and applies the result to all 240 Displays the category dialog and applies the result to all
240 selected contacts. 241 selected contacts.
241 */ 242 */
242 void setCategories(); 243 void setCategories();
243 void manageCategories(); 244 void manageCategories();
244 void editCategories(); 245 void editCategories();
245 246
246 /** 247 /**
247 Sets the field list of the Incremental Search Widget. 248 Sets the field list of the Incremental Search Widget.
248 */ 249 */
249 void setSearchFields( const KABC::Field::List &fields ); 250 void setSearchFields( const KABC::Field::List &fields );
250 251
251 /** 252 /**
252 Search with the current search field for a contact, that matches 253 Search with the current search field for a contact, that matches
253 the given text, and selects it in the view. 254 the given text, and selects it in the view.
254 */ 255 */
255 void incrementalSearch( const QString& text ); 256 void incrementalSearch( const QString& text );
256 void incrementalSearchJump( const QString& text ); 257 void incrementalSearchJump( const QString& text );
257 258
258 /** 259 /**
259 Marks the address book as modified. 260 Marks the address book as modified.
260 */ 261 */
261 void setModified(); 262 void setModified();
262 /** 263 /**
263 Marks the address book as modified without refreshing the view. 264 Marks the address book as modified without refreshing the view.
264 */ 265 */
265 void setModifiedWOrefresh(); 266 void setModifiedWOrefresh();
266 267
267 /** 268 /**
268 Marks the address book as modified concerning the argument. 269 Marks the address book as modified concerning the argument.
269 */ 270 */
270 void setModified( bool modified ); 271 void setModified( bool modified );
271 272
272 /** 273 /**
273 Returns whether the address book is modified. 274 Returns whether the address book is modified.
274 */ 275 */
275 bool modified() const; 276 bool modified() const;
276 277
277 /** 278 /**
278 Called whenever an contact is modified in the contact editor 279 Called whenever an contact is modified in the contact editor
279 dialog or the quick edit. 280 dialog or the quick edit.
280 */ 281 */
281 void contactModified( const KABC::Addressee &addr ); 282 void contactModified( const KABC::Addressee &addr );
282 void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); 283 void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
283 284
284 /** 285 /**
285 DCOP METHODS. 286 DCOP METHODS.
286 */ 287 */
287 void addEmail( QString addr ); 288 void addEmail( QString addr );
288 void importVCard( const KURL& url, bool showPreview ); 289 void importVCard( const KURL& url, bool showPreview );
289 void importVCard( const QString& vCard, bool showPreview ); 290 void importVCard( const QString& vCard, bool showPreview );
290 void newContact(); 291 void newContact();
291 QString getNameByPhone( const QString& phone ); 292 QString getNameByPhone( const QString& phone );
292 /** 293 /**
293 END DCOP METHODS 294 END DCOP METHODS
294 */ 295 */
295 296
296 /** 297 /**
297 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
298 */ 299 */
299 void save(); 300 void save();
300 301
301 /** 302 /**
302 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
303 */ 304 */
304 void undo(); 305 void undo();
305 306
306 /** 307 /**
307 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
308 */ 309 */
309 void redo(); 310 void redo();
310 311
311 /** 312 /**
312 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
313 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
314 */ 315 */
315 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
316//US added a second method without defaultparameter 317//US added a second method without defaultparameter
317 void editContact2(); 318 void editContact2();
318 319
319 /** 320 /**
320 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
321 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
322 */ 323 */
323 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
324 325
325 /** 326 /**
326 Launches the configuration dialog. 327 Launches the configuration dialog.
327 */ 328 */
328 void openConfigDialog(); 329 void openConfigDialog();
329 330
330 /** 331 /**
331 Launches the ldap search dialog. 332 Launches the ldap search dialog.
332 */ 333 */
333 void openLDAPDialog(); 334 void openLDAPDialog();
334 335
335 /** 336 /**
336 Creates a KAddressBookPrinter, which will display the print 337 Creates a KAddressBookPrinter, which will display the print
337 dialog and do the printing. 338 dialog and do the printing.
338 */ 339 */
339 void print(); 340 void print();
340 341
341 /** 342 /**
342 Registers a new GUI client, so plugins can register its actions. 343 Registers a new GUI client, so plugins can register its actions.
343 */ 344 */
344 void addGUIClient( KXMLGUIClient *client ); 345 void addGUIClient( KXMLGUIClient *client );
345 346
346 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
347 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 348 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
348 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 349 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
349 350
350 351
351 signals: 352 signals:
352 void contactSelected( const QString &name ); 353 void contactSelected( const QString &name );
353 void contactSelected( const QPixmap &pixmap ); 354 void contactSelected( const QPixmap &pixmap );
354 public slots: 355 public slots:
355 void recieve(QString cmsg ); 356 void recieve(QString cmsg );
356 void getFile( bool success ); 357 void getFile( bool success );
357 void syncFileRequest(); 358 void syncFileRequest();
358 void setDetailsVisible( bool visible ); 359 void setDetailsVisible( bool visible );
359 void setDetailsToState(); 360 void setDetailsToState();
360 361
361 void saveSettings(); 362 void saveSettings();
362 363
363 private slots: 364 private slots:
364 void updateToolBar(); 365 void updateToolBar();
365 void updateMainWindow(); 366 void updateMainWindow();
366 void receive( const QCString& cmsg, const QByteArray& data ); 367 void receive( const QCString& cmsg, const QByteArray& data );
367 void toggleBeamReceive( ); 368 void toggleBeamReceive( );
368 void disableBR(bool); 369 void disableBR(bool);
369 void setJumpButtonBarVisible( bool visible ); 370 void setJumpButtonBarVisible( bool visible );
370 void setJumpButtonBar( bool visible ); 371 void setJumpButtonBar( bool visible );
371 void setCaptionBack(); 372 void setCaptionBack();
372 void resizeAndCallContactdialog(); 373 void resizeAndCallContactdialog();
373 void callContactdialog(); 374 void callContactdialog();
374 375
375 void importFromOL(); 376 void importFromOL();
376 void extensionModified( const KABC::Addressee::List &list ); 377 void extensionModified( const KABC::Addressee::List &list );
377 void extensionChanged( int id ); 378 void extensionChanged( int id );
378 void clipboardDataChanged(); 379 void clipboardDataChanged();
379 void updateActionMenu(); 380 void updateActionMenu();
380 void configureKeyBindings(); 381 void configureKeyBindings();
381 void removeVoice(); 382 void removeVoice();
382 void setFormattedName(); 383 void setFormattedName();
383#ifdef KAB_EMBEDDED 384#ifdef KAB_EMBEDDED
384 void configureResources(); 385 void configureResources();
385#endif //KAB_EMBEDDED 386#endif //KAB_EMBEDDED
386 387
387 void slotEditorDestroyed( const QString &uid ); 388 void slotEditorDestroyed( const QString &uid );
388 void configurationChanged(); 389 void configurationChanged();
389 void addressBookChanged(); 390 void addressBookChanged();
390 391
391 private: 392 private:
392 QString mEmailSourceChannel; 393 QString mEmailSourceChannel;
393 QString mEmailSourceUID; 394 QString mEmailSourceUID;
394 void resizeEvent(QResizeEvent* e ); 395 void resizeEvent(QResizeEvent* e );
395 bool mBRdisabled; 396 bool mBRdisabled;
396#ifndef DESKTOP_VERSION 397#ifndef DESKTOP_VERSION
397 QCopChannel* infrared; 398 QCopChannel* infrared;
398#endif 399#endif
399 QTimer *mMessageTimer; 400 QTimer *mMessageTimer;
400 void initGUI(); 401 void initGUI();
401 void initActions(); 402 void initActions();
402 QString getPhoneFile(); 403 QString getPhoneFile();
403 404
404 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 405 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
405 const char *name = 0 ); 406 const char *name = 0 );
406 407
407 KXMLGUIClient *mGUIClient; 408 KXMLGUIClient *mGUIClient;
408 409
409 KABC::AddressBook *mAddressBook; 410 KABC::AddressBook *mAddressBook;
410 411
411 ViewManager *mViewManager; 412 ViewManager *mViewManager;
412 // QSplitter *mDetailsSplitter; 413 // QSplitter *mDetailsSplitter;
413 KDGanttMinimizeSplitter *mExtensionBarSplitter; 414 KDGanttMinimizeSplitter *mExtensionBarSplitter;
414 ViewContainer *mDetails; 415 ViewContainer *mDetails;
415 KDGanttMinimizeSplitter* mMiniSplitter; 416 KDGanttMinimizeSplitter* mMiniSplitter;
416 XXPortManager *mXXPortManager; 417 XXPortManager *mXXPortManager;
417 JumpButtonBar *mJumpButtonBar; 418 JumpButtonBar *mJumpButtonBar;
418 IncSearchWidget *mIncSearchWidget; 419 IncSearchWidget *mIncSearchWidget;
419 ExtensionManager *mExtensionManager; 420 ExtensionManager *mExtensionManager;
420 421
421 KCMultiDialog *mConfigureDialog; 422 KCMultiDialog *mConfigureDialog;
422 423
423#ifndef KAB_EMBEDDED 424#ifndef KAB_EMBEDDED
424 LDAPSearchDialog *mLdapSearchDialog; 425 LDAPSearchDialog *mLdapSearchDialog;
425#endif //KAB_EMBEDDED 426#endif //KAB_EMBEDDED
426 // QDict<AddresseeEditorDialog> mEditorDict; 427 // QDict<AddresseeEditorDialog> mEditorDict;
427 AddresseeEditorDialog *mEditorDialog; 428 AddresseeEditorDialog *mEditorDialog;
428 bool mReadWrite; 429 bool mReadWrite;
429 bool mModified; 430 bool mModified;
430 bool mIsPart; 431 bool mIsPart;
431 bool mMultipleViewsAtOnce; 432 bool mMultipleViewsAtOnce;
432 433
433 434
434 //US file menu 435 //US file menu
435 KAction *mActionMail; 436 KAction *mActionMail;
436 KAction *mActionBeam; 437 KAction *mActionBeam;
437 KToggleAction *mActionBR; 438 KToggleAction *mActionBR;
438 KAction *mActionExport2phone; 439 KAction *mActionExport2phone;
439 KAction* mActionPrint; 440 KAction* mActionPrint;
440 KAction* mActionPrintDetails; 441 KAction* mActionPrintDetails;
441 KAction* mActionNewContact; 442 KAction* mActionNewContact;
442 KAction *mActionSave; 443 KAction *mActionSave;
443 KAction *mActionEditAddressee; 444 KAction *mActionEditAddressee;
444 KAction *mActionMailVCard; 445 KAction *mActionMailVCard;
445 KAction *mActionBeamVCard; 446 KAction *mActionBeamVCard;
446 447
447 KAction *mActionQuit; 448 KAction *mActionQuit;
448 449
449 //US edit menu 450 //US edit menu
450 KAction *mActionCopy; 451 KAction *mActionCopy;
451 KAction *mActionCut; 452 KAction *mActionCut;
452 KAction *mActionPaste; 453 KAction *mActionPaste;
453 KAction *mActionSelectAll; 454 KAction *mActionSelectAll;
454 KAction *mActionUndo; 455 KAction *mActionUndo;
455 KAction *mActionRedo; 456 KAction *mActionRedo;
456 KAction *mActionDelete; 457 KAction *mActionDelete;
457 458
458 //US settings menu 459 //US settings menu
459 KAction *mActionConfigResources; 460 KAction *mActionConfigResources;
460 KAction *mActionConfigKAddressbook; 461 KAction *mActionConfigKAddressbook;
461 KAction *mActionConfigShortcuts; 462 KAction *mActionConfigShortcuts;
462 KAction *mActionConfigureToolbars; 463 KAction *mActionConfigureToolbars;
463 KAction *mActionKeyBindings; 464 KAction *mActionKeyBindings;
464 KToggleAction *mActionJumpBar; 465 KToggleAction *mActionJumpBar;
465 KToggleAction *mActionDetails; 466 KToggleAction *mActionDetails;
466 KAction *mActionWhoAmI; 467 KAction *mActionWhoAmI;
467 KAction *mActionCategories; 468 KAction *mActionCategories;
468 KAction *mActionEditCategories; 469 KAction *mActionEditCategories;
469 KAction *mActionManageCategories; 470 KAction *mActionManageCategories;
470 KAction *mActionAboutKAddressbook; 471 KAction *mActionAboutKAddressbook;
471 KAction *mActionLicence; 472 KAction *mActionLicence;
472 KAction *mActionFaq; 473 KAction *mActionFaq;
473 KAction *mActionWN; 474 KAction *mActionWN;
474 KAction *mActionSyncHowto; 475 KAction *mActionSyncHowto;
476 KAction *mActionStorageHowto;
475 KAction *mActionKdeSyncHowto; 477 KAction *mActionKdeSyncHowto;
476 KAction *mActionMultiSyncHowto; 478 KAction *mActionMultiSyncHowto;
477 479
478 KAction *mActionDeleteView; 480 KAction *mActionDeleteView;
479 481
480 QPopupMenu *viewMenu; 482 QPopupMenu *viewMenu;
481 QPopupMenu *filterMenu; 483 QPopupMenu *filterMenu;
482 QPopupMenu *settingsMenu; 484 QPopupMenu *settingsMenu;
483 QPopupMenu *changeMenu; 485 QPopupMenu *changeMenu;
484 QPopupMenu *beamMenu; 486 QPopupMenu *beamMenu;
485//US QAction *mActionSave; 487//US QAction *mActionSave;
486 QPopupMenu *ImportMenu; 488 QPopupMenu *ImportMenu;
487 QPopupMenu *ExportMenu; 489 QPopupMenu *ExportMenu;
488 //LR additional methods 490 //LR additional methods
489 KAction *mActionRemoveVoice; 491 KAction *mActionRemoveVoice;
490 KAction *mActionSetFormattedName; 492 KAction *mActionSetFormattedName;
491 KAction * mActionImportOL; 493 KAction * mActionImportOL;
492 494
493#ifndef KAB_EMBEDDED 495#ifndef KAB_EMBEDDED
494 KAddressBookService *mAddressBookService; 496 KAddressBookService *mAddressBookService;
495#endif //KAB_EMBEDDED 497#endif //KAB_EMBEDDED
496 498
497 class KABCorePrivate; 499 class KABCorePrivate;
498 KABCorePrivate *d; 500 KABCorePrivate *d;
499 //US bool mBlockSaveFlag; 501 //US bool mBlockSaveFlag;
500 502
501#ifdef KAB_EMBEDDED 503#ifdef KAB_EMBEDDED
502 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 504 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
503#endif //KAB_EMBEDDED 505#endif //KAB_EMBEDDED
504 506
505 //this are the overwritten callbackmethods from the syncinterface 507 //this are the overwritten callbackmethods from the syncinterface
506 virtual bool sync(KSyncManager* manager, QString filename, int mode); 508 virtual bool sync(KSyncManager* manager, QString filename, int mode);
507 virtual bool syncExternal(KSyncManager* manager, QString resource); 509 virtual bool syncExternal(KSyncManager* manager, QString resource);
508 virtual void removeSyncInfo( QString syncProfile); 510 virtual void removeSyncInfo( QString syncProfile);
509 bool syncPhone(); 511 bool syncPhone();
510 void message( QString m , bool startTimer = true); 512 void message( QString m , bool startTimer = true);
511 513
512 // LR ******************************* 514 // LR *******************************
513 // sync stuff! 515 // sync stuff!
514 QString sentSyncFile(); 516 QString sentSyncFile();
515 QPopupMenu *syncMenu; 517 QPopupMenu *syncMenu;
516 KSyncManager* syncManager; 518 KSyncManager* syncManager;
517 int mGlobalSyncMode; 519 int mGlobalSyncMode;
518 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 520 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
519 KABC::Addressee getLastSyncAddressee(); 521 KABC::Addressee getLastSyncAddressee();
520 QDateTime mLastAddressbookSync; 522 QDateTime mLastAddressbookSync;
521 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 523 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
522 // ********************* 524 // *********************
523 525
524}; 526};
525 527
526#endif 528#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 357154e..7aa3b60 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2439 +1,2447 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "simplealarmclient.h" 63#include "simplealarmclient.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65 65
66using namespace KCal; 66using namespace KCal;
67#ifndef _WIN32_ 67#ifndef _WIN32_
68#include <unistd.h> 68#include <unistd.h>
69#else 69#else
70#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 71#include "koimportoldialog.h"
72#endif 72#endif
73#endif 73#endif
74#include "mainwindow.h" 74#include "mainwindow.h"
75 75
76 76
77class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
78{ 78{
79 public: 79 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
82 { 82 {
83 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
87 QLabel *lab; 87 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 90 QHBox* temphb;
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132int globalFlagBlockStartup; 132int globalFlagBlockStartup;
133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
134 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
135{ 135{
136 136
137 mClosed = false; 137 mClosed = false;
138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
139 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
140 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
141 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
142 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
143 mBlockAtStartup = true; 143 mBlockAtStartup = true;
144 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 p->mCurrentDisplayedView = 0; 148 p->mCurrentDisplayedView = 0;
149 if ( p->mHourSize > 22 ) 149 if ( p->mHourSize > 22 )
150 p->mHourSize = 22; 150 p->mHourSize = 22;
151 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
152 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
153 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
154 tbd = Bottom; 154 tbd = Bottom;
155 else 155 else
156 tbd = Top; 156 tbd = Top;
157 } 157 }
158 else { 158 else {
159 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
160 tbd = Right; 160 tbd = Right;
161 else 161 else
162 tbd = Left; 162 tbd = Left;
163 } 163 }
164 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
166 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
167 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
168 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
169 169
170#ifdef DESKTOP_VERSION 170#ifdef DESKTOP_VERSION
171 if ( KOPrefs::instance()->mShowIconFilter ) 171 if ( KOPrefs::instance()->mShowIconFilter )
172#else 172#else
173 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) 173 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
174#endif 174#endif
175 175
176{ 176{
177 if ( p->mToolBarHorF ) { 177 if ( p->mToolBarHorF ) {
178 if ( p->mToolBarUpF ) 178 if ( p->mToolBarUpF )
179 tbd = Bottom; 179 tbd = Bottom;
180 else 180 else
181 tbd = Top; 181 tbd = Top;
182 } 182 }
183 else { 183 else {
184 if ( p->mToolBarUpF ) 184 if ( p->mToolBarUpF )
185 tbd = Right; 185 tbd = Right;
186 else 186 else
187 tbd = Left; 187 tbd = Left;
188 } 188 }
189 filterToolBar = new QPEToolBar ( this ); 189 filterToolBar = new QPEToolBar ( this );
190 filterMenubar = new QPEMenuBar( filterToolBar ); 190 filterMenubar = new QPEMenuBar( filterToolBar );
191 QFontMetrics fm ( filterMenubar->font() ); 191 QFontMetrics fm ( filterMenubar->font() );
192 192
193 filterPopupMenu = new QPopupMenu( this ); 193 filterPopupMenu = new QPopupMenu( this );
194 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 194 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
195 QString addTest = "Ax"; 195 QString addTest = "Ax";
196#ifdef DESKTOP_VERSION 196#ifdef DESKTOP_VERSION
197 addTest = "AAAx"; 197 addTest = "AAAx";
198#endif 198#endif
199 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); 199 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) );
200 addToolBar (filterToolBar , tbd ); 200 addToolBar (filterToolBar , tbd );
201 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 201 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
202 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 202 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
203 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) 203 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
204 filterToolBar->hide(); 204 filterToolBar->hide();
205 } else { 205 } else {
206 filterToolBar = 0; 206 filterToolBar = 0;
207 filterMenubar = 0; 207 filterMenubar = 0;
208 filterPopupMenu = 0; 208 filterPopupMenu = 0;
209 } 209 }
210 if ( p->mShowIconOnetoolbar ) { 210 if ( p->mShowIconOnetoolbar ) {
211 viewToolBar = iconToolBar ; 211 viewToolBar = iconToolBar ;
212 navigatorToolBar = iconToolBar ; 212 navigatorToolBar = iconToolBar ;
213 } else { 213 } else {
214#ifndef DESKTOP_VERSION 214#ifndef DESKTOP_VERSION
215 setToolBarsMovable( false ); 215 setToolBarsMovable( false );
216#endif 216#endif
217 if ( p->mToolBarHorV ) { 217 if ( p->mToolBarHorV ) {
218 if ( p->mToolBarUpV ) 218 if ( p->mToolBarUpV )
219 tbd = Bottom; 219 tbd = Bottom;
220 else 220 else
221 tbd = Top; 221 tbd = Top;
222 } 222 }
223 else { 223 else {
224 if ( p->mToolBarUpV ) 224 if ( p->mToolBarUpV )
225 tbd = Right; 225 tbd = Right;
226 else 226 else
227 tbd = Left; 227 tbd = Left;
228 } 228 }
229 viewToolBar = new QPEToolBar( this ); 229 viewToolBar = new QPEToolBar( this );
230 addToolBar (viewToolBar , tbd ); 230 addToolBar (viewToolBar , tbd );
231 if ( p->mToolBarHorN ) { 231 if ( p->mToolBarHorN ) {
232 if ( p->mToolBarUpN ) 232 if ( p->mToolBarUpN )
233 tbd = Bottom; 233 tbd = Bottom;
234 else 234 else
235 tbd = Top; 235 tbd = Top;
236 } 236 }
237 else { 237 else {
238 if ( p->mToolBarUpN ) 238 if ( p->mToolBarUpN )
239 tbd = Right; 239 tbd = Right;
240 else 240 else
241 tbd = Left; 241 tbd = Left;
242 } 242 }
243 navigatorToolBar = new QPEToolBar( this ); 243 navigatorToolBar = new QPEToolBar( this );
244 addToolBar (navigatorToolBar , tbd ); 244 addToolBar (navigatorToolBar , tbd );
245 } 245 }
246 246
247 247
248 248
249 mCalendarModifiedFlag = false; 249 mCalendarModifiedFlag = false;
250 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 250 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
251 splash->setAlignment ( AlignCenter ); 251 splash->setAlignment ( AlignCenter );
252 setCentralWidget( splash ); 252 setCentralWidget( splash );
253#ifndef DESKTOP_VERSION 253#ifndef DESKTOP_VERSION
254 showMaximized(); 254 showMaximized();
255#endif 255#endif
256 256
257 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 257 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
258 setDefaultPreferences(); 258 setDefaultPreferences();
259 mCalendar = new CalendarLocal(); 259 mCalendar = new CalendarLocal();
260 mView = new CalendarView( mCalendar, this,"mCalendar " ); 260 mView = new CalendarView( mCalendar, this,"mCalendar " );
261 mView->hide(); 261 mView->hide();
262 //mView->resize(splash->size() ); 262 //mView->resize(splash->size() );
263 initActions(); 263 initActions();
264 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 264 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
265 mSyncManager->setBlockSave(false); 265 mSyncManager->setBlockSave(false);
266 mView->setSyncManager(mSyncManager); 266 mView->setSyncManager(mSyncManager);
267#ifndef DESKTOP_VERSION 267#ifndef DESKTOP_VERSION
268 iconToolBar->show(); 268 iconToolBar->show();
269 qApp->processEvents(); 269 qApp->processEvents();
270#endif 270#endif
271 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 271 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
272 int vh = height() ; 272 int vh = height() ;
273 int vw = width(); 273 int vw = width();
274 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 274 //qDebug("Toolbar hei %d ",iconToolBar->height() );
275 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 275 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
276 vh -= iconToolBar->height(); 276 vh -= iconToolBar->height();
277 } else { 277 } else {
278 vw -= iconToolBar->height(); 278 vw -= iconToolBar->height();
279 } 279 }
280 //mView->setMaximumSize( splash->size() ); 280 //mView->setMaximumSize( splash->size() );
281 //mView->resize( splash->size() ); 281 //mView->resize( splash->size() );
282 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 282 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
283 mView->readSettings(); 283 mView->readSettings();
284 bool newFile = false; 284 bool newFile = false;
285 if( !QFile::exists( defaultFileName() ) ) { 285 if( !QFile::exists( defaultFileName() ) ) {
286 QFileInfo finfo ( defaultFileName() ); 286 QFileInfo finfo ( defaultFileName() );
287 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 287 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
288 qDebug("oldfile %s ", oldFile.latin1()); 288 qDebug("oldfile %s ", oldFile.latin1());
289 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"; 289 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";
290 finfo.setFile( oldFile ); 290 finfo.setFile( oldFile );
291 if (finfo.exists() ) { 291 if (finfo.exists() ) {
292 KMessageBox::information( this, message); 292 KMessageBox::information( this, message);
293 mView->openCalendar( oldFile ); 293 mView->openCalendar( oldFile );
294 qApp->processEvents(); 294 qApp->processEvents();
295 } else { 295 } else {
296 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 296 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
297 finfo.setFile( oldFile ); 297 finfo.setFile( oldFile );
298 if (finfo.exists() ) { 298 if (finfo.exists() ) {
299 KMessageBox::information( this, message); 299 KMessageBox::information( this, message);
300 mView->openCalendar( oldFile ); 300 mView->openCalendar( oldFile );
301 qApp->processEvents(); 301 qApp->processEvents();
302 } 302 }
303 } 303 }
304 mView->saveCalendar( defaultFileName() ); 304 mView->saveCalendar( defaultFileName() );
305 newFile = true; 305 newFile = true;
306 } 306 }
307 307
308 QTime neededSaveTime = QDateTime::currentDateTime().time(); 308 QTime neededSaveTime = QDateTime::currentDateTime().time();
309 mView->openCalendar( defaultFileName() ); 309 mView->openCalendar( defaultFileName() );
310 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 310 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
311 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 311 qDebug("KO: Calendar loading time: %d ms",msNeeded );
312 312
313 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 313 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
314 KOPrefs::instance()->setAllDefaults(); 314 KOPrefs::instance()->setAllDefaults();
315 int count = mView->addCategories(); 315 int count = mView->addCategories();
316 } 316 }
317 processIncidenceSelection( 0 ); 317 processIncidenceSelection( 0 );
318 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 318 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
319 SLOT( processIncidenceSelection( Incidence * ) ) ); 319 SLOT( processIncidenceSelection( Incidence * ) ) );
320 connect( mView, SIGNAL( modifiedChanged( bool ) ), 320 connect( mView, SIGNAL( modifiedChanged( bool ) ),
321 SLOT( slotModifiedChanged( bool ) ) ); 321 SLOT( slotModifiedChanged( bool ) ) );
322 322
323 323
324 connect( mView, SIGNAL( tempDisableBR(bool) ), 324 connect( mView, SIGNAL( tempDisableBR(bool) ),
325 SLOT( disableBR(bool) ) ); 325 SLOT( disableBR(bool) ) );
326 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 326 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
327 mView->setModified( false ); 327 mView->setModified( false );
328 mBlockAtStartup = false; 328 mBlockAtStartup = false;
329 mView->setModified( false ); 329 mView->setModified( false );
330 setCentralWidget( mView ); 330 setCentralWidget( mView );
331 globalFlagBlockStartup = 0; 331 globalFlagBlockStartup = 0;
332 mView->show(); 332 mView->show();
333 delete splash; 333 delete splash;
334 if ( newFile ) 334 if ( newFile )
335 mView->updateConfig(); 335 mView->updateConfig();
336 // qApp->processEvents(); 336 // qApp->processEvents();
337 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 337 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
338 //fillSyncMenu(); 338 //fillSyncMenu();
339 339
340 340
341 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 341 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
342 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 342 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
343 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 343 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
344 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 344 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
345 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 345 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
346 mSyncManager->setDefaultFileName( sentSyncFile()); 346 mSyncManager->setDefaultFileName( sentSyncFile());
347 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 347 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
348 mSyncManager->fillSyncMenu(); 348 mSyncManager->fillSyncMenu();
349 349
350 350
351 351
352 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 352 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
353 if ( showWarning ) { 353 if ( showWarning ) {
354 KMessageBox::information( this, 354 KMessageBox::information( this,
355 "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"); 355 "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");
356 qApp->processEvents(); 356 qApp->processEvents();
357 mView->dialogManager()->showSyncOptions(); 357 mView->dialogManager()->showSyncOptions();
358 } 358 }
359 359
360 //US listen for result adressed from Ka/Pi 360 //US listen for result adressed from Ka/Pi
361#ifndef DESKTOP_VERSION 361#ifndef DESKTOP_VERSION
362 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 362 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
363#endif 363#endif
364#ifndef DESKTOP_VERSION 364#ifndef DESKTOP_VERSION
365 infrared = 0; 365 infrared = 0;
366#endif 366#endif
367 updateFilterToolbar(); 367 updateFilterToolbar();
368 updateWeek( mView->startDate() ); 368 updateWeek( mView->startDate() );
369 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 369 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
370 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 370 SLOT( updateWeekNum( const KCal::DateList & ) ) );
371 mBRdisabled = false; 371 mBRdisabled = false;
372 //toggleBeamReceive(); 372 //toggleBeamReceive();
373} 373}
374MainWindow::~MainWindow() 374MainWindow::~MainWindow()
375{ 375{
376 //qDebug("MainWindow::~MainWindow() "); 376 //qDebug("MainWindow::~MainWindow() ");
377 //save toolbar location 377 //save toolbar location
378 delete mCalendar; 378 delete mCalendar;
379 delete mSyncManager; 379 delete mSyncManager;
380#ifndef DESKTOP_VERSION 380#ifndef DESKTOP_VERSION
381 if ( infrared ) 381 if ( infrared )
382 delete infrared; 382 delete infrared;
383#endif 383#endif
384 384
385 385
386} 386}
387 387
388void MainWindow::disableBR(bool b) 388void MainWindow::disableBR(bool b)
389{ 389{
390#ifndef DESKTOP_VERSION 390#ifndef DESKTOP_VERSION
391 if ( b ) { 391 if ( b ) {
392 if ( infrared ) { 392 if ( infrared ) {
393 toggleBeamReceive(); 393 toggleBeamReceive();
394 mBRdisabled = true; 394 mBRdisabled = true;
395 } 395 }
396 mBRdisabled = true; 396 mBRdisabled = true;
397 } else { 397 } else {
398 if ( mBRdisabled ) { 398 if ( mBRdisabled ) {
399 mBRdisabled = false; 399 mBRdisabled = false;
400 //makes no sense,because other cal ap is probably running 400 //makes no sense,because other cal ap is probably running
401 // toggleBeamReceive(); 401 // toggleBeamReceive();
402 } 402 }
403 } 403 }
404#endif 404#endif
405 405
406} 406}
407bool MainWindow::beamReceiveEnabled() 407bool MainWindow::beamReceiveEnabled()
408{ 408{
409#ifndef DESKTOP_VERSION 409#ifndef DESKTOP_VERSION
410 return ( infrared != 0 ); 410 return ( infrared != 0 );
411#endif 411#endif
412 return false; 412 return false;
413} 413}
414 414
415void MainWindow::toggleBeamReceive() 415void MainWindow::toggleBeamReceive()
416{ 416{
417 if ( mBRdisabled ) 417 if ( mBRdisabled )
418 return; 418 return;
419#ifndef DESKTOP_VERSION 419#ifndef DESKTOP_VERSION
420 if ( infrared ) { 420 if ( infrared ) {
421 qDebug("disable BeamReceive "); 421 qDebug("disable BeamReceive ");
422 delete infrared; 422 delete infrared;
423 infrared = 0; 423 infrared = 0;
424 brAction->setOn(false); 424 brAction->setOn(false);
425 return; 425 return;
426 } 426 }
427 qDebug("enable BeamReceive "); 427 qDebug("enable BeamReceive ");
428 brAction->setOn(true); 428 brAction->setOn(true);
429 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 429 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
430 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 430 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
431#endif 431#endif
432} 432}
433void MainWindow::showMaximized () 433void MainWindow::showMaximized ()
434{ 434{
435#ifndef DESKTOP_VERSION 435#ifndef DESKTOP_VERSION
436 if ( ! globalFlagBlockStartup ) 436 if ( ! globalFlagBlockStartup )
437 if ( mClosed ) 437 if ( mClosed )
438 mView->goToday(); 438 mView->goToday();
439#endif 439#endif
440 QWidget::showMaximized () ; 440 QWidget::showMaximized () ;
441 mClosed = false; 441 mClosed = false;
442} 442}
443void MainWindow::closeEvent( QCloseEvent* ce ) 443void MainWindow::closeEvent( QCloseEvent* ce )
444{ 444{
445 445
446 446
447 447
448 if ( ! KOPrefs::instance()->mAskForQuit ) { 448 if ( ! KOPrefs::instance()->mAskForQuit ) {
449 saveOnClose(); 449 saveOnClose();
450 mClosed = true; 450 mClosed = true;
451 ce->accept(); 451 ce->accept();
452 return; 452 return;
453 453
454 } 454 }
455 455
456 switch( QMessageBox::information( this, "KO/Pi", 456 switch( QMessageBox::information( this, "KO/Pi",
457 i18n("Do you really want\nto close KO/Pi?"), 457 i18n("Do you really want\nto close KO/Pi?"),
458 i18n("Close"), i18n("No"), 458 i18n("Close"), i18n("No"),
459 0, 0 ) ) { 459 0, 0 ) ) {
460 case 0: 460 case 0:
461 saveOnClose(); 461 saveOnClose();
462 mClosed = true; 462 mClosed = true;
463 ce->accept(); 463 ce->accept();
464 break; 464 break;
465 case 1: 465 case 1:
466 ce->ignore(); 466 ce->ignore();
467 break; 467 break;
468 case 2: 468 case 2:
469 469
470 default: 470 default:
471 break; 471 break;
472 } 472 }
473 473
474 474
475} 475}
476 476
477void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 477void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
478{ 478{
479 QDataStream stream( data, IO_ReadOnly ); 479 QDataStream stream( data, IO_ReadOnly );
480 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 480 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
481 //QString datamess; 481 //QString datamess;
482 //qDebug("message "); 482 //qDebug("message ");
483 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 483 qDebug("KO: QCOP message received: %s ", cmsg.data() );
484 484
485 if ( cmsg == "setDocument(QString)" ) { 485 if ( cmsg == "setDocument(QString)" ) {
486 QDataStream stream( data, IO_ReadOnly ); 486 QDataStream stream( data, IO_ReadOnly );
487 QString fileName; 487 QString fileName;
488 stream >> fileName; 488 stream >> fileName;
489 //qDebug("filename %s ", fileName.latin1()); 489 //qDebug("filename %s ", fileName.latin1());
490 showMaximized(); 490 showMaximized();
491 raise(); 491 raise();
492 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 492 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
493 mSyncManager->slotSyncMenu( 1002 ); 493 mSyncManager->slotSyncMenu( 1002 );
494 return; 494 return;
495 } 495 }
496 496
497 if ( cmsg == "-writeFile" ) { 497 if ( cmsg == "-writeFile" ) {
498 // I made from the "-writeFile" an "-writeAlarm" 498 // I made from the "-writeFile" an "-writeAlarm"
499 mView->viewManager()->showWhatsNextView(); 499 mView->viewManager()->showWhatsNextView();
500 mCalendar->checkAlarmForIncidence( 0, true); 500 mCalendar->checkAlarmForIncidence( 0, true);
501 showMaximized(); 501 showMaximized();
502 raise(); 502 raise();
503 return; 503 return;
504 504
505 } 505 }
506 if ( cmsg == "-writeFileSilent" ) { 506 if ( cmsg == "-writeFileSilent" ) {
507 // I made from the "-writeFile" an "-writeAlarm" 507 // I made from the "-writeFile" an "-writeAlarm"
508 // mView->viewManager()->showWhatsNextView(); 508 // mView->viewManager()->showWhatsNextView();
509 mCalendar->checkAlarmForIncidence( 0, true); 509 mCalendar->checkAlarmForIncidence( 0, true);
510 //showMaximized(); 510 //showMaximized();
511 //raise(); 511 //raise();
512 hide(); 512 hide();
513 return; 513 return;
514 } 514 }
515 if ( cmsg == "-newCountdown" ) { 515 if ( cmsg == "-newCountdown" ) {
516 qDebug("newCountdown "); 516 qDebug("newCountdown ");
517 517
518 } 518 }
519 QString msg ; 519 QString msg ;
520 QString allmsg = cmsg; 520 QString allmsg = cmsg;
521 while ( allmsg.length() > 0 ) { 521 while ( allmsg.length() > 0 ) {
522 int nextC = allmsg.find( "-", 1 ); 522 int nextC = allmsg.find( "-", 1 );
523 if ( nextC == -1 ) { 523 if ( nextC == -1 ) {
524 msg = allmsg; 524 msg = allmsg;
525 allmsg = ""; 525 allmsg = "";
526 } else{ 526 } else{
527 msg = allmsg.left( nextC ); 527 msg = allmsg.left( nextC );
528 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 528 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
529 } 529 }
530 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 530 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
531 if ( msg == "-newEvent" ) { 531 if ( msg == "-newEvent" ) {
532 mView->newEvent(); 532 mView->newEvent();
533 } 533 }
534 if ( msg == "-newTodo" ) { 534 if ( msg == "-newTodo" ) {
535 mView->newTodo(); 535 mView->newTodo();
536 536
537 } 537 }
538 if ( msg == "-showWN" ) { 538 if ( msg == "-showWN" ) {
539 mView->viewManager()->showWhatsNextView(); 539 mView->viewManager()->showWhatsNextView();
540 } 540 }
541 if ( msg == "-showTodo" ) { 541 if ( msg == "-showTodo" ) {
542 mView->viewManager()->showTodoView(); 542 mView->viewManager()->showTodoView();
543 } 543 }
544 if ( msg == "-showList" ) { 544 if ( msg == "-showList" ) {
545 mView->viewManager()->showListView(); 545 mView->viewManager()->showListView();
546 } 546 }
547 else if ( msg == "-showDay" ) { 547 else if ( msg == "-showDay" ) {
548 mView->viewManager()->showDayView(); 548 mView->viewManager()->showDayView();
549 } 549 }
550 else if ( msg == "-showWWeek" ) { 550 else if ( msg == "-showWWeek" ) {
551 mView->viewManager()->showWorkWeekView(); 551 mView->viewManager()->showWorkWeekView();
552 } 552 }
553 else if ( msg == "-ringSync" ) { 553 else if ( msg == "-ringSync" ) {
554 mSyncManager->multiSync( false ); 554 mSyncManager->multiSync( false );
555 } 555 }
556 else if ( msg == "-showWeek" ) { 556 else if ( msg == "-showWeek" ) {
557 mView->viewManager()->showWeekView(); 557 mView->viewManager()->showWeekView();
558 } 558 }
559 else if ( msg == "-showTodo" ) { 559 else if ( msg == "-showTodo" ) {
560 mView->viewManager()->showTodoView(); 560 mView->viewManager()->showTodoView();
561 } 561 }
562 else if ( msg == "-showJournal" ) { 562 else if ( msg == "-showJournal" ) {
563 mView->dateNavigator()->selectDates( 1 ); 563 mView->dateNavigator()->selectDates( 1 );
564 mView->dateNavigator()->selectToday(); 564 mView->dateNavigator()->selectToday();
565 mView->viewManager()->showJournalView(); 565 mView->viewManager()->showJournalView();
566 } 566 }
567 else if ( msg == "-showKO" ) { 567 else if ( msg == "-showKO" ) {
568 mView->viewManager()->showNextXView(); 568 mView->viewManager()->showNextXView();
569 } 569 }
570 else if ( msg == "-showWNext" ) { 570 else if ( msg == "-showWNext" ) {
571 mView->viewManager()->showWhatsNextView(); 571 mView->viewManager()->showWhatsNextView();
572 } 572 }
573 else if ( msg == "nextView()" ) { 573 else if ( msg == "nextView()" ) {
574 mView->viewManager()->showNextView(); 574 mView->viewManager()->showNextView();
575 } 575 }
576 else if ( msg == "-showNextXView" ) { 576 else if ( msg == "-showNextXView" ) {
577 mView->viewManager()->showNextXView(); 577 mView->viewManager()->showNextXView();
578 } 578 }
579 579
580 580
581 } 581 }
582 582
583 showMaximized(); 583 showMaximized();
584 raise(); 584 raise();
585} 585}
586 586
587QPixmap MainWindow::loadPixmap( QString name ) 587QPixmap MainWindow::loadPixmap( QString name )
588{ 588{
589 return SmallIcon( name ); 589 return SmallIcon( name );
590 590
591} 591}
592void MainWindow::initActions() 592void MainWindow::initActions()
593{ 593{
594 //KOPrefs::instance()->mShowFullMenu 594 //KOPrefs::instance()->mShowFullMenu
595 iconToolBar->clear(); 595 iconToolBar->clear();
596 KOPrefs *p = KOPrefs::instance(); 596 KOPrefs *p = KOPrefs::instance();
597 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 597 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
598 598
599 QPopupMenu *viewMenu = new QPopupMenu( this ); 599 QPopupMenu *viewMenu = new QPopupMenu( this );
600 QPopupMenu *actionMenu = new QPopupMenu( this ); 600 QPopupMenu *actionMenu = new QPopupMenu( this );
601 QPopupMenu *importMenu = new QPopupMenu( this ); 601 QPopupMenu *importMenu = new QPopupMenu( this );
602 QPopupMenu *importMenu_X = new QPopupMenu( this ); 602 QPopupMenu *importMenu_X = new QPopupMenu( this );
603 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 603 QPopupMenu *exportMenu_X = new QPopupMenu( this );
604 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 604 QPopupMenu *beamMenu_X = new QPopupMenu( this );
605 selectFilterMenu = new QPopupMenu( this ); 605 selectFilterMenu = new QPopupMenu( this );
606 selectFilterMenu->setCheckable( true ); 606 selectFilterMenu->setCheckable( true );
607 syncMenu = new QPopupMenu( this ); 607 syncMenu = new QPopupMenu( this );
608 configureAgendaMenu = new QPopupMenu( this ); 608 configureAgendaMenu = new QPopupMenu( this );
609 configureToolBarMenu = new QPopupMenu( this ); 609 configureToolBarMenu = new QPopupMenu( this );
610 QPopupMenu *helpMenu = new QPopupMenu( this ); 610 QPopupMenu *helpMenu = new QPopupMenu( this );
611 QIconSet icon; 611 QIconSet icon;
612 int pixWid = 22, pixHei = 22; 612 int pixWid = 22, pixHei = 22;
613 QString pathString = ""; 613 QString pathString = "";
614 if ( !p->mToolBarMiniIcons ) { 614 if ( !p->mToolBarMiniIcons ) {
615 if ( QApplication::desktop()->width() < 480 ) { 615 if ( QApplication::desktop()->width() < 480 ) {
616 pathString += "icons16/"; 616 pathString += "icons16/";
617 pixWid = 18; pixHei = 16; 617 pixWid = 18; pixHei = 16;
618 } 618 }
619 } else { 619 } else {
620 pathString += "iconsmini/"; 620 pathString += "iconsmini/";
621 pixWid = 18; pixHei = 16; 621 pixWid = 18; pixHei = 16;
622 } 622 }
623 if ( KOPrefs::instance()->mShowFullMenu ) { 623 if ( KOPrefs::instance()->mShowFullMenu ) {
624 QMenuBar *menuBar1; 624 QMenuBar *menuBar1;
625 menuBar1 = menuBar(); 625 menuBar1 = menuBar();
626 menuBar1->insertItem( i18n("File"), importMenu ); 626 menuBar1->insertItem( i18n("File"), importMenu );
627 menuBar1->insertItem( i18n("View"), viewMenu ); 627 menuBar1->insertItem( i18n("View"), viewMenu );
628 menuBar1->insertItem( i18n("Actions"), actionMenu ); 628 menuBar1->insertItem( i18n("Actions"), actionMenu );
629#ifdef DESKTOP_VERSION 629#ifdef DESKTOP_VERSION
630 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 630 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
631 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 631 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
632#else 632#else
633 menuBar1->insertItem( i18n("Sync"), syncMenu ); 633 menuBar1->insertItem( i18n("Sync"), syncMenu );
634 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 634 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
635#endif 635#endif
636 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 636 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
637 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 637 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
638 menuBar1->insertItem( i18n("Help"), helpMenu ); 638 menuBar1->insertItem( i18n("Help"), helpMenu );
639 } else { 639 } else {
640 QPEMenuBar *menuBar1; 640 QPEMenuBar *menuBar1;
641 menuBar1 = new QPEMenuBar( iconToolBar ); 641 menuBar1 = new QPEMenuBar( iconToolBar );
642 QPopupMenu *menuBar = new QPopupMenu( this ); 642 QPopupMenu *menuBar = new QPopupMenu( this );
643 icon = loadPixmap( pathString + "z_menu" ); 643 icon = loadPixmap( pathString + "z_menu" );
644 menuBar1->insertItem( icon.pixmap(), menuBar); 644 menuBar1->insertItem( icon.pixmap(), menuBar);
645 //menuBar1->insertItem( i18n("ME"), menuBar); 645 //menuBar1->insertItem( i18n("ME"), menuBar);
646 menuBar->insertItem( i18n("File"), importMenu ); 646 menuBar->insertItem( i18n("File"), importMenu );
647 menuBar->insertItem( i18n("View"), viewMenu ); 647 menuBar->insertItem( i18n("View"), viewMenu );
648 menuBar->insertItem( i18n("Actions"), actionMenu ); 648 menuBar->insertItem( i18n("Actions"), actionMenu );
649 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 649 menuBar->insertItem( i18n("Synchronize"), syncMenu );
650 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 650 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
651 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 651 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
652 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 652 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
653 menuBar->insertItem( i18n("Help"), helpMenu ); 653 menuBar->insertItem( i18n("Help"), helpMenu );
654 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 654 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
655 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 655 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
656 } 656 }
657 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 657 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
658 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 658 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
659 659
660 660
661 mWeekBgColor = iconToolBar->backgroundColor(); 661 mWeekBgColor = iconToolBar->backgroundColor();
662 mWeekPixmap.resize( pixWid , pixHei ); 662 mWeekPixmap.resize( pixWid , pixHei );
663 mWeekPixmap.fill( mWeekBgColor ); 663 mWeekPixmap.fill( mWeekBgColor );
664 icon = mWeekPixmap; 664 icon = mWeekPixmap;
665 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 665 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
666 if ( p-> mShowIconWeekNum ) 666 if ( p-> mShowIconWeekNum )
667 mWeekAction->addTo( iconToolBar ); 667 mWeekAction->addTo( iconToolBar );
668 mWeekFont = font(); 668 mWeekFont = font();
669 669
670 int fontPoint = mWeekFont.pointSize(); 670 int fontPoint = mWeekFont.pointSize();
671 QFontMetrics f( mWeekFont ); 671 QFontMetrics f( mWeekFont );
672 int fontWid = f.width( "30" ); 672 int fontWid = f.width( "30" );
673 while ( fontWid > pixWid ) { 673 while ( fontWid > pixWid ) {
674 --fontPoint; 674 --fontPoint;
675 mWeekFont.setPointSize( fontPoint ); 675 mWeekFont.setPointSize( fontPoint );
676 QFontMetrics f( mWeekFont ); 676 QFontMetrics f( mWeekFont );
677 fontWid = f.width( "30" ); 677 fontWid = f.width( "30" );
678 //qDebug("dec-- "); 678 //qDebug("dec-- ");
679 } 679 }
680 680
681 connect( mWeekAction, SIGNAL( activated() ), 681 connect( mWeekAction, SIGNAL( activated() ),
682 this, SLOT( weekAction() ) ); 682 this, SLOT( weekAction() ) );
683 683
684 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 684 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
685 if ( p->mShowIconFilterview ) { 685 if ( p->mShowIconFilterview ) {
686 icon = loadPixmap( pathString + "filter" ); 686 icon = loadPixmap( pathString + "filter" );
687 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 687 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
688 connect( actionFilterMenuTB, SIGNAL( activated() ), 688 connect( actionFilterMenuTB, SIGNAL( activated() ),
689 this, SLOT( fillFilterMenuTB() ) ); 689 this, SLOT( fillFilterMenuTB() ) );
690 actionFilterMenuTB->addTo( iconToolBar ); 690 actionFilterMenuTB->addTo( iconToolBar );
691 selectFilterMenuTB = new QPopupMenu( this ); 691 selectFilterMenuTB = new QPopupMenu( this );
692 selectFilterMenuTB->setCheckable( true ); 692 selectFilterMenuTB->setCheckable( true );
693 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 693 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
694 } 694 }
695 695
696 //#endif 696 //#endif
697 // ****************** 697 // ******************
698 QAction *action; 698 QAction *action;
699 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 699 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
700 configureToolBarMenu->setCheckable( true ); 700 configureToolBarMenu->setCheckable( true );
701 701
702 702
703 configureAgendaMenu->setCheckable( true ); 703 configureAgendaMenu->setCheckable( true );
704 int iii ; 704 int iii ;
705 for ( iii = 1;iii<= 10 ;++iii ){ 705 for ( iii = 1;iii<= 10 ;++iii ){
706 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 706 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
707 } 707 }
708 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 708 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
709 709
710 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 710 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
711 this, SLOT( showConfigureAgenda( ) ) ); 711 this, SLOT( showConfigureAgenda( ) ) );
712 712
713 icon = loadPixmap( pathString + "configure" ); 713 icon = loadPixmap( pathString + "configure" );
714 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 714 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
715 action->addTo( actionMenu ); 715 action->addTo( actionMenu );
716 connect( action, SIGNAL( activated() ), 716 connect( action, SIGNAL( activated() ),
717 mView, SLOT( edit_options() ) ); 717 mView, SLOT( edit_options() ) );
718 actionMenu->insertSeparator(); 718 actionMenu->insertSeparator();
719 719
720 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 720 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
721 action->addTo( actionMenu ); 721 action->addTo( actionMenu );
722 connect( action, SIGNAL( activated() ), 722 connect( action, SIGNAL( activated() ),
723 mView, SLOT( undo_delete() ) ); 723 mView, SLOT( undo_delete() ) );
724 actionMenu->insertSeparator(); 724 actionMenu->insertSeparator();
725 725
726 icon = loadPixmap( pathString + "newevent" ); 726 icon = loadPixmap( pathString + "newevent" );
727 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 727 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
728 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 728 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
729 configureToolBarMenu->insertSeparator(); 729 configureToolBarMenu->insertSeparator();
730 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 730 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
731 configureToolBarMenu->insertSeparator(); 731 configureToolBarMenu->insertSeparator();
732 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 732 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
733 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 733 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
734 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 734 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
735 ne_action->addTo( actionMenu ); 735 ne_action->addTo( actionMenu );
736 connect( ne_action, SIGNAL( activated() ), 736 connect( ne_action, SIGNAL( activated() ),
737 mView, SLOT( newEvent() ) ); 737 mView, SLOT( newEvent() ) );
738 icon = loadPixmap( pathString + "newtodo" ); 738 icon = loadPixmap( pathString + "newtodo" );
739 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 739 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
740 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 740 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
741 nt_action->addTo( actionMenu ); 741 nt_action->addTo( actionMenu );
742 connect( nt_action, SIGNAL( activated() ), 742 connect( nt_action, SIGNAL( activated() ),
743 mView, SLOT( newTodo() ) ); 743 mView, SLOT( newTodo() ) );
744 744
745 icon = loadPixmap( pathString + "today" ); 745 icon = loadPixmap( pathString + "today" );
746 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 746 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
747 today_action->addTo( viewMenu ); 747 today_action->addTo( viewMenu );
748 connect( today_action, SIGNAL( activated() ), 748 connect( today_action, SIGNAL( activated() ),
749 mView, SLOT( goToday() ) ); 749 mView, SLOT( goToday() ) );
750 viewMenu->insertSeparator(); 750 viewMenu->insertSeparator();
751 751
752 // *********************** 752 // ***********************
753 if ( KOPrefs::instance()->mVerticalScreen ) { 753 if ( KOPrefs::instance()->mVerticalScreen ) {
754 icon = SmallIcon( "1updownarrow" ); 754 icon = SmallIcon( "1updownarrow" );
755 } else { 755 } else {
756 icon = SmallIcon("1leftrightarrow" ); 756 icon = SmallIcon("1leftrightarrow" );
757 } 757 }
758 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 758 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
759 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 759 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
760 FSaction->addTo( viewMenu ); 760 FSaction->addTo( viewMenu );
761 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 761 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
762 762
763 icon = loadPixmap( pathString + "navi" ); 763 icon = loadPixmap( pathString + "navi" );
764 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); 764 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
765 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 765 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
766 action->addTo( viewMenu ); 766 action->addTo( viewMenu );
767 connect( action, SIGNAL( activated() ), 767 connect( action, SIGNAL( activated() ),
768 mView, SLOT( toggleDateNavigatorWidget() ) ); 768 mView, SLOT( toggleDateNavigatorWidget() ) );
769 mToggleNav = action ; 769 mToggleNav = action ;
770 icon = loadPixmap( pathString + "filter" ); 770 icon = loadPixmap( pathString + "filter" );
771 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 771 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
772 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 772 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
773 action->addTo( viewMenu ); 773 action->addTo( viewMenu );
774 connect( action, SIGNAL( activated() ), 774 connect( action, SIGNAL( activated() ),
775 mView, SLOT( toggleFilter() ) ); 775 mView, SLOT( toggleFilter() ) );
776 mToggleFilter = action; 776 mToggleFilter = action;
777 icon = loadPixmap( pathString + "allday" ); 777 icon = loadPixmap( pathString + "allday" );
778 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 778 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
779 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 779 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
780 action->addTo( viewMenu ); 780 action->addTo( viewMenu );
781 connect( action, SIGNAL( activated() ), 781 connect( action, SIGNAL( activated() ),
782 mView, SLOT( toggleAllDaySize() ) ); 782 mView, SLOT( toggleAllDaySize() ) );
783 mToggleAllday = action; 783 mToggleAllday = action;
784 784
785 785
786 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 786 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
787 mToggleNav, SLOT( setEnabled ( bool ) ) ); 787 mToggleNav, SLOT( setEnabled ( bool ) ) );
788 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 788 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
789 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 789 mToggleFilter, SLOT( setEnabled ( bool ) ) );
790 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 790 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
791 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 791 mToggleAllday, SLOT( setEnabled ( bool ) ) );
792 792
793 viewMenu->insertSeparator(); 793 viewMenu->insertSeparator();
794 icon = loadPixmap( pathString + "picker" ); 794 icon = loadPixmap( pathString + "picker" );
795 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 795 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
796 action->addTo( viewMenu ); 796 action->addTo( viewMenu );
797 connect( action, SIGNAL( activated() ), 797 connect( action, SIGNAL( activated() ),
798 mView, SLOT( showDatePicker() ) ); 798 mView, SLOT( showDatePicker() ) );
799 action->addTo( iconToolBar ); 799 action->addTo( iconToolBar );
800 viewMenu->insertSeparator(); 800 viewMenu->insertSeparator();
801 801
802 if ( p-> mShowIconToggleFull ) 802 if ( p-> mShowIconToggleFull )
803 FSaction->addTo( iconToolBar ); 803 FSaction->addTo( iconToolBar );
804 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 804 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
805 805
806 //******************** 806 //********************
807 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 807 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
808 808
809 809
810 icon = loadPixmap( pathString + "whatsnext" ); 810 icon = loadPixmap( pathString + "whatsnext" );
811 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 811 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
812 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 812 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
813 whatsnext_action->addTo( viewMenu ); 813 whatsnext_action->addTo( viewMenu );
814 connect( whatsnext_action, SIGNAL( activated() ), 814 connect( whatsnext_action, SIGNAL( activated() ),
815 mView->viewManager(), SLOT( showWhatsNextView() ) ); 815 mView->viewManager(), SLOT( showWhatsNextView() ) );
816 816
817 icon = loadPixmap( pathString + "xdays" ); 817 icon = loadPixmap( pathString + "xdays" );
818 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 818 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
819 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 819 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
820 xdays_action->addTo( viewMenu ); 820 xdays_action->addTo( viewMenu );
821 connect( xdays_action, SIGNAL( activated() ), 821 connect( xdays_action, SIGNAL( activated() ),
822 mView->viewManager(), SLOT( showNextXView() ) ); 822 mView->viewManager(), SLOT( showNextXView() ) );
823 823
824 824
825 icon = loadPixmap( pathString + "journal" ); 825 icon = loadPixmap( pathString + "journal" );
826 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 826 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
827 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 827 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
828 viewjournal_action->addTo( viewMenu ); 828 viewjournal_action->addTo( viewMenu );
829 connect( viewjournal_action, SIGNAL( activated() ), 829 connect( viewjournal_action, SIGNAL( activated() ),
830 mView->viewManager(), SLOT( showJournalView() ) ); 830 mView->viewManager(), SLOT( showJournalView() ) );
831 831
832 832
833 icon = loadPixmap( pathString + "day" ); 833 icon = loadPixmap( pathString + "day" );
834 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 834 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
835 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 835 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
836 day1_action->addTo( viewMenu ); 836 day1_action->addTo( viewMenu );
837 // action->addTo( toolBar ); 837 // action->addTo( toolBar );
838 connect( day1_action, SIGNAL( activated() ), 838 connect( day1_action, SIGNAL( activated() ),
839 mView->viewManager(), SLOT( showDayView() ) ); 839 mView->viewManager(), SLOT( showDayView() ) );
840 840
841 icon = loadPixmap( pathString + "workweek" ); 841 icon = loadPixmap( pathString + "workweek" );
842 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 842 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
843 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 843 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
844 day5_action->addTo( viewMenu ); 844 day5_action->addTo( viewMenu );
845 connect( day5_action, SIGNAL( activated() ), 845 connect( day5_action, SIGNAL( activated() ),
846 mView->viewManager(), SLOT( showWorkWeekView() ) ); 846 mView->viewManager(), SLOT( showWorkWeekView() ) );
847 847
848 icon = loadPixmap( pathString + "week" ); 848 icon = loadPixmap( pathString + "week" );
849 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 849 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
850 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 850 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
851 day7_action->addTo( viewMenu ); 851 day7_action->addTo( viewMenu );
852 connect( day7_action, SIGNAL( activated() ), 852 connect( day7_action, SIGNAL( activated() ),
853 mView->viewManager(), SLOT( showWeekView() ) ); 853 mView->viewManager(), SLOT( showWeekView() ) );
854 854
855 icon = loadPixmap( pathString + "workweek2" ); 855 icon = loadPixmap( pathString + "workweek2" );
856 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 856 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
857 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 857 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
858 day6_action->addTo( viewMenu ); 858 day6_action->addTo( viewMenu );
859 connect( day6_action, SIGNAL( activated() ), 859 connect( day6_action, SIGNAL( activated() ),
860 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 860 mView->viewManager(), SLOT( showMonthViewWeek() ) );
861 861
862 icon = loadPixmap( pathString + "month" ); 862 icon = loadPixmap( pathString + "month" );
863 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 863 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
864 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 864 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
865 month_action->addTo( viewMenu ); 865 month_action->addTo( viewMenu );
866 connect( month_action, SIGNAL( activated() ), 866 connect( month_action, SIGNAL( activated() ),
867 mView->viewManager(), SLOT( showMonthView() ) ); 867 mView->viewManager(), SLOT( showMonthView() ) );
868 868
869 icon = loadPixmap( pathString + "list" ); 869 icon = loadPixmap( pathString + "list" );
870 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 870 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
871 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 871 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
872 showlist_action->addTo( viewMenu ); 872 showlist_action->addTo( viewMenu );
873 connect( showlist_action, SIGNAL( activated() ), 873 connect( showlist_action, SIGNAL( activated() ),
874 mView->viewManager(), SLOT( showListView() ) ); 874 mView->viewManager(), SLOT( showListView() ) );
875 875
876 icon = loadPixmap( pathString + "todo" ); 876 icon = loadPixmap( pathString + "todo" );
877 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 877 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
878 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 878 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
879 todoview_action->addTo( viewMenu ); 879 todoview_action->addTo( viewMenu );
880 connect( todoview_action, SIGNAL( activated() ), 880 connect( todoview_action, SIGNAL( activated() ),
881 mView->viewManager(), SLOT( showTodoView() ) ); 881 mView->viewManager(), SLOT( showTodoView() ) );
882 882
883 883
884 884
885#if 0 885#if 0
886 action = new QAction( "view_timespan", "Time Span", 0, this ); 886 action = new QAction( "view_timespan", "Time Span", 0, this );
887 action->addTo( viewMenu ); 887 action->addTo( viewMenu );
888 connect( action, SIGNAL( activated() ), 888 connect( action, SIGNAL( activated() ),
889 mView->viewManager(), SLOT( showTimeSpanView() ) ); 889 mView->viewManager(), SLOT( showTimeSpanView() ) );
890#endif 890#endif
891 891
892 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 892 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
893 this ); 893 this );
894 mNewSubTodoAction->addTo( actionMenu ); 894 mNewSubTodoAction->addTo( actionMenu );
895 connect( mNewSubTodoAction, SIGNAL( activated() ), 895 connect( mNewSubTodoAction, SIGNAL( activated() ),
896 mView, SLOT( newSubTodo() ) ); 896 mView, SLOT( newSubTodo() ) );
897 897
898 actionMenu->insertSeparator(); 898 actionMenu->insertSeparator();
899 899
900 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 900 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
901 mShowAction->addTo( actionMenu ); 901 mShowAction->addTo( actionMenu );
902 connect( mShowAction, SIGNAL( activated() ), 902 connect( mShowAction, SIGNAL( activated() ),
903 mView, SLOT( showIncidence() ) ); 903 mView, SLOT( showIncidence() ) );
904 904
905 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 905 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
906 mEditAction->addTo( actionMenu ); 906 mEditAction->addTo( actionMenu );
907 connect( mEditAction, SIGNAL( activated() ), 907 connect( mEditAction, SIGNAL( activated() ),
908 mView, SLOT( editIncidence() ) ); 908 mView, SLOT( editIncidence() ) );
909 909
910 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 910 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
911 mDeleteAction->addTo( actionMenu ); 911 mDeleteAction->addTo( actionMenu );
912 connect( mDeleteAction, SIGNAL( activated() ), 912 connect( mDeleteAction, SIGNAL( activated() ),
913 mView, SLOT( deleteIncidence() ) ); 913 mView, SLOT( deleteIncidence() ) );
914 914
915 915
916 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 916 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
917 mCloneAction->addTo( actionMenu ); 917 mCloneAction->addTo( actionMenu );
918 connect( mCloneAction, SIGNAL( activated() ), 918 connect( mCloneAction, SIGNAL( activated() ),
919 mView, SLOT( cloneIncidence() ) ); 919 mView, SLOT( cloneIncidence() ) );
920 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 920 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
921 mMoveAction->addTo( actionMenu ); 921 mMoveAction->addTo( actionMenu );
922 connect( mMoveAction, SIGNAL( activated() ), 922 connect( mMoveAction, SIGNAL( activated() ),
923 mView, SLOT( moveIncidence() ) ); 923 mView, SLOT( moveIncidence() ) );
924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 924 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
925 mBeamAction->addTo( actionMenu ); 925 mBeamAction->addTo( actionMenu );
926 connect( mBeamAction, SIGNAL( activated() ), 926 connect( mBeamAction, SIGNAL( activated() ),
927 mView, SLOT( beamIncidence() ) ); 927 mView, SLOT( beamIncidence() ) );
928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 928 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
929 mCancelAction->addTo( actionMenu ); 929 mCancelAction->addTo( actionMenu );
930 connect( mCancelAction, SIGNAL( activated() ), 930 connect( mCancelAction, SIGNAL( activated() ),
931 mView, SLOT( toggleCancelIncidence() ) ); 931 mView, SLOT( toggleCancelIncidence() ) );
932 932
933 actionMenu->insertSeparator(); 933 actionMenu->insertSeparator();
934 934
935 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 935 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
936 this ); 936 this );
937 action->addTo( actionMenu ); 937 action->addTo( actionMenu );
938 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 938 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
939 939
940 icon = loadPixmap( pathString + "search" ); 940 icon = loadPixmap( pathString + "search" );
941 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 941 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
942 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); 942 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
943 search_action->addTo( actionMenu ); 943 search_action->addTo( actionMenu );
944 connect( search_action, SIGNAL( activated() ), 944 connect( search_action, SIGNAL( activated() ),
945 mView->dialogManager(), SLOT( showSearchDialog() ) ); 945 mView->dialogManager(), SLOT( showSearchDialog() ) );
946 946
947 947
948 948
949 if ( KOPrefs::instance()->mShowFullMenu ) { 949 if ( KOPrefs::instance()->mShowFullMenu ) {
950 actionMenu->insertSeparator(); 950 actionMenu->insertSeparator();
951 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 951 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
952 952
953 } 953 }
954 // actionMenu->insertSeparator(); 954 // actionMenu->insertSeparator();
955 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 955 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
956 this ); 956 this );
957 action->addTo( importMenu_X ); 957 action->addTo( importMenu_X );
958 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 958 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
959 action = new QAction( "import_quick", i18n("Import last file"), 0, 959 action = new QAction( "import_quick", i18n("Import last file"), 0,
960 this ); 960 this );
961 action->addTo( importMenu_X ); 961 action->addTo( importMenu_X );
962 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 962 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
963 importMenu_X->insertSeparator(); 963 importMenu_X->insertSeparator();
964 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 964 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
965 this ); 965 this );
966 action->addTo( importMenu_X ); 966 action->addTo( importMenu_X );
967 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 967 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
968 //#ifndef DESKTOP_VERSION 968 //#ifndef DESKTOP_VERSION
969 importMenu_X->insertSeparator(); 969 importMenu_X->insertSeparator();
970 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 970 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
971 this ); 971 this );
972 action->addTo( importMenu_X ); 972 action->addTo( importMenu_X );
973 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 973 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
974 //#else 974 //#else
975#ifdef _OL_IMPORT_ 975#ifdef _OL_IMPORT_
976 importMenu_X->insertSeparator(); 976 importMenu_X->insertSeparator();
977 action = new QAction( "import_ol", i18n("Import from OL"), 0, 977 action = new QAction( "import_ol", i18n("Import from OL"), 0,
978 this ); 978 this );
979 action->addTo( importMenu_X ); 979 action->addTo( importMenu_X );
980 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 980 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
981#endif 981#endif
982 //#endif 982 //#endif
983 983
984 //importMenu->insertSeparator(); 984 //importMenu->insertSeparator();
985 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 985 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
986 this ); 986 this );
987 action->addTo( importMenu ); 987 action->addTo( importMenu );
988 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 988 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
989 989
990 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 990 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
991 this ); 991 this );
992 action->addTo( importMenu ); 992 action->addTo( importMenu );
993 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 993 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
994 importMenu->insertSeparator(); 994 importMenu->insertSeparator();
995 importMenu->insertItem( i18n("Import"), importMenu_X ); 995 importMenu->insertItem( i18n("Import"), importMenu_X );
996 //importMenu->insertSeparator(); 996 //importMenu->insertSeparator();
997 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 997 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
998 this ); 998 this );
999 action->addTo( exportMenu_X ); 999 action->addTo( exportMenu_X );
1000 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 1000 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
1001 1001
1002 1002
1003 //LR 1003 //LR
1004 QPopupMenu *ex2phone = new QPopupMenu( this ); 1004 QPopupMenu *ex2phone = new QPopupMenu( this );
1005 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1005 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1006 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1006 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1007 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 1007 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
1008 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 1008 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
1009 1009
1010 importMenu->insertItem( i18n("Export"), exportMenu_X ); 1010 importMenu->insertItem( i18n("Export"), exportMenu_X );
1011#ifndef DESKTOP_VERSION 1011#ifndef DESKTOP_VERSION
1012 //importMenu->insertSeparator(); 1012 //importMenu->insertSeparator();
1013 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 1013 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
1014 this ); 1014 this );
1015 brAction->addTo( beamMenu_X ); 1015 brAction->addTo( beamMenu_X );
1016 brAction->setToggleAction (true ) ; 1016 brAction->setToggleAction (true ) ;
1017 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 1017 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
1018 1018
1019 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 1019 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
1020 this ); 1020 this );
1021 action->addTo( beamMenu_X ); 1021 action->addTo( beamMenu_X );
1022 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 1022 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
1023 1023
1024 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 1024 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
1025 this ); 1025 this );
1026 action->addTo( beamMenu_X ); 1026 action->addTo( beamMenu_X );
1027 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 1027 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
1028 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 1028 importMenu->insertItem( i18n("Beam"), beamMenu_X );
1029#else 1029#else
1030 //importMenu->insertSeparator(); 1030 //importMenu->insertSeparator();
1031 icon = loadPixmap( pathString + "print" ); 1031 icon = loadPixmap( pathString + "print" );
1032 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 1032 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
1033 action->addTo( beamMenu_X ); 1033 action->addTo( beamMenu_X );
1034 connect( action, SIGNAL( activated() ), 1034 connect( action, SIGNAL( activated() ),
1035 this, SLOT( printCal() ) ); 1035 this, SLOT( printCal() ) );
1036 1036
1037 icon = loadPixmap( pathString + "print" ); 1037 icon = loadPixmap( pathString + "print" );
1038 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 1038 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
1039 action->addTo( beamMenu_X ); 1039 action->addTo( beamMenu_X );
1040 connect( action, SIGNAL( activated() ), 1040 connect( action, SIGNAL( activated() ),
1041 this, SLOT( printSel() ) ); 1041 this, SLOT( printSel() ) );
1042 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 1042 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
1043 action->addTo( beamMenu_X ); 1043 action->addTo( beamMenu_X );
1044 connect( action, SIGNAL( activated() ), 1044 connect( action, SIGNAL( activated() ),
1045 mView->viewManager(), SLOT( slotprintWNV() ) ); 1045 mView->viewManager(), SLOT( slotprintWNV() ) );
1046 1046
1047 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); 1047 action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this );
1048 action->addTo( beamMenu_X ); 1048 action->addTo( beamMenu_X );
1049 connect( action, SIGNAL( activated() ), 1049 connect( action, SIGNAL( activated() ),
1050 mView, SLOT( slotprintSelInc() ) ); 1050 mView, SLOT( slotprintSelInc() ) );
1051 1051
1052 1052
1053 importMenu->insertItem( i18n("Print"), beamMenu_X ); 1053 importMenu->insertItem( i18n("Print"), beamMenu_X );
1054#endif 1054#endif
1055 importMenu->insertSeparator(); 1055 importMenu->insertSeparator();
1056 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 1056 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
1057 this ); 1057 this );
1058 action->addTo( importMenu ); 1058 action->addTo( importMenu );
1059 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 1059 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
1060 importMenu->insertSeparator(); 1060 importMenu->insertSeparator();
1061 action = new QAction( "beam all", i18n("Save"), 0, 1061 action = new QAction( "beam all", i18n("Save"), 0,
1062 this ); 1062 this );
1063 action->addTo( importMenu ); 1063 action->addTo( importMenu );
1064 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 1064 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
1065 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 1065 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
1066 this ); 1066 this );
1067 action->addTo( importMenu ); 1067 action->addTo( importMenu );
1068 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 1068 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
1069 1069
1070 //menuBar->insertItem( "Configure",configureMenu ); 1070 //menuBar->insertItem( "Configure",configureMenu );
1071 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 1071 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
1072 icon = loadPixmap( "korganizer/korganizer" ); 1072 icon = loadPixmap( "korganizer/korganizer" );
1073 1073
1074 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 1074 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
1075 action->addTo( helpMenu ); 1075 action->addTo( helpMenu );
1076 connect( action, SIGNAL( activated() ), 1076 connect( action, SIGNAL( activated() ),
1077 SLOT( whatsNew() ) ); 1077 SLOT( whatsNew() ) );
1078 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 1078 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
1079 action->addTo( helpMenu ); 1079 action->addTo( helpMenu );
1080 connect( action, SIGNAL( activated() ), 1080 connect( action, SIGNAL( activated() ),
1081 SLOT( features() ) ); 1081 SLOT( features() ) );
1082 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 1082 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
1083 action->addTo( helpMenu ); 1083 action->addTo( helpMenu );
1084 connect( action, SIGNAL( activated() ), 1084 connect( action, SIGNAL( activated() ),
1085 SLOT( keyBindings() ) ); 1085 SLOT( keyBindings() ) );
1086 action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this );
1087 action->addTo( helpMenu );
1088 connect( action, SIGNAL( activated() ),
1089 SLOT( storagehowto() ) );
1086 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 1090 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
1087 action->addTo( helpMenu ); 1091 action->addTo( helpMenu );
1088 connect( action, SIGNAL( activated() ), 1092 connect( action, SIGNAL( activated() ),
1089 SLOT( synchowto() ) ); 1093 SLOT( synchowto() ) );
1090 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 1094 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
1091 action->addTo( helpMenu ); 1095 action->addTo( helpMenu );
1092 connect( action, SIGNAL( activated() ), 1096 connect( action, SIGNAL( activated() ),
1093 SLOT( kdesynchowto() ) ); 1097 SLOT( kdesynchowto() ) );
1094 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 1098 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
1095 action->addTo( helpMenu ); 1099 action->addTo( helpMenu );
1096 connect( action, SIGNAL( activated() ), 1100 connect( action, SIGNAL( activated() ),
1097 SLOT( multisynchowto() ) ); 1101 SLOT( multisynchowto() ) );
1098 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 1102 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
1099 action->addTo( helpMenu ); 1103 action->addTo( helpMenu );
1100 connect( action, SIGNAL( activated() ), 1104 connect( action, SIGNAL( activated() ),
1101 SLOT( aboutAutoSaving() ) ); 1105 SLOT( aboutAutoSaving() ) );
1102 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 1106 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
1103 action->addTo( helpMenu ); 1107 action->addTo( helpMenu );
1104 connect( action, SIGNAL( activated() ), 1108 connect( action, SIGNAL( activated() ),
1105 SLOT( aboutKnownBugs() ) ); 1109 SLOT( aboutKnownBugs() ) );
1106 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 1110 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
1107 action->addTo( helpMenu ); 1111 action->addTo( helpMenu );
1108 connect( action, SIGNAL( activated() ), 1112 connect( action, SIGNAL( activated() ),
1109 SLOT( usertrans() ) ); 1113 SLOT( usertrans() ) );
1110 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 1114 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
1111 action->addTo( helpMenu ); 1115 action->addTo( helpMenu );
1112 connect( action, SIGNAL( activated() ), 1116 connect( action, SIGNAL( activated() ),
1113 SLOT( faq() ) ); 1117 SLOT( faq() ) );
1114 action = new QAction( "licence", i18n("Licence..."), 0, this ); 1118 action = new QAction( "licence", i18n("Licence..."), 0, this );
1115 action->addTo( helpMenu ); 1119 action->addTo( helpMenu );
1116 connect( action, SIGNAL( activated() ), 1120 connect( action, SIGNAL( activated() ),
1117 SLOT( licence() ) ); 1121 SLOT( licence() ) );
1118 action = new QAction( "about", i18n("About..."), 0, this ); 1122 action = new QAction( "about", i18n("About..."), 0, this );
1119 action->addTo( helpMenu ); 1123 action->addTo( helpMenu );
1120 connect( action, SIGNAL( activated() ), 1124 connect( action, SIGNAL( activated() ),
1121 SLOT( about() ) ); 1125 SLOT( about() ) );
1122 //menuBar->insertSeparator(); 1126 //menuBar->insertSeparator();
1123 1127
1124 // ****************************************************** 1128 // ******************************************************
1125 // menubar icons 1129 // menubar icons
1126 1130
1127 1131
1128 1132
1129 //menuBar->insertItem( iconToolBar ); 1133 //menuBar->insertItem( iconToolBar );
1130 //xdays_action 1134 //xdays_action
1131 if (p-> mShowIconNewEvent) 1135 if (p-> mShowIconNewEvent)
1132 ne_action->addTo( iconToolBar ); 1136 ne_action->addTo( iconToolBar );
1133 if (p->mShowIconNewTodo ) 1137 if (p->mShowIconNewTodo )
1134 nt_action->addTo( iconToolBar ); 1138 nt_action->addTo( iconToolBar );
1135 if (p-> mShowIconSearch) 1139 if (p-> mShowIconSearch)
1136 search_action->addTo( iconToolBar ); 1140 search_action->addTo( iconToolBar );
1137 if (p-> mShowIconWhatsThis) 1141 if (p-> mShowIconWhatsThis)
1138 QWhatsThis::whatsThisButton ( iconToolBar ); 1142 QWhatsThis::whatsThisButton ( iconToolBar );
1139 if (p-> mShowIconNext) 1143 if (p-> mShowIconNext)
1140 whatsnext_action->addTo( viewToolBar ); 1144 whatsnext_action->addTo( viewToolBar );
1141 if (p-> mShowIconNextDays) 1145 if (p-> mShowIconNextDays)
1142 xdays_action->addTo( viewToolBar ); 1146 xdays_action->addTo( viewToolBar );
1143 if (p-> mShowIconJournal) 1147 if (p-> mShowIconJournal)
1144 viewjournal_action->addTo( viewToolBar ); 1148 viewjournal_action->addTo( viewToolBar );
1145 if (p-> mShowIconDay1) 1149 if (p-> mShowIconDay1)
1146 day1_action->addTo( viewToolBar ); 1150 day1_action->addTo( viewToolBar );
1147 if (p-> mShowIconDay5) 1151 if (p-> mShowIconDay5)
1148 day5_action->addTo( viewToolBar ); 1152 day5_action->addTo( viewToolBar );
1149 if (p-> mShowIconDay7) 1153 if (p-> mShowIconDay7)
1150 day7_action->addTo( viewToolBar ); 1154 day7_action->addTo( viewToolBar );
1151 if (p-> mShowIconDay6) 1155 if (p-> mShowIconDay6)
1152 day6_action->addTo( viewToolBar ); 1156 day6_action->addTo( viewToolBar );
1153 if (p-> mShowIconMonth) 1157 if (p-> mShowIconMonth)
1154 month_action->addTo( viewToolBar ); 1158 month_action->addTo( viewToolBar );
1155 if (p-> mShowIconList) 1159 if (p-> mShowIconList)
1156 showlist_action->addTo( viewToolBar ); 1160 showlist_action->addTo( viewToolBar );
1157 if (p-> mShowIconTodoview) 1161 if (p-> mShowIconTodoview)
1158 todoview_action->addTo( viewToolBar ); 1162 todoview_action->addTo( viewToolBar );
1159 1163
1160 icon = loadPixmap( pathString + "2leftarrowB" ); 1164 icon = loadPixmap( pathString + "2leftarrowB" );
1161 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); 1165 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1162 if (p-> mShowIconBackFast) { 1166 if (p-> mShowIconBackFast) {
1163 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1167 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1164 connect( action, SIGNAL( activated() ), 1168 connect( action, SIGNAL( activated() ),
1165 mView, SLOT( goPreviousMonth() ) ); 1169 mView, SLOT( goPreviousMonth() ) );
1166 action->addTo( navigatorToolBar ); 1170 action->addTo( navigatorToolBar );
1167 } 1171 }
1168 icon = loadPixmap( pathString + "1leftarrowB" ); 1172 icon = loadPixmap( pathString + "1leftarrowB" );
1169 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); 1173 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1170 if (p-> mShowIconBack) { 1174 if (p-> mShowIconBack) {
1171 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1175 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1172 connect( action, SIGNAL( activated() ), 1176 connect( action, SIGNAL( activated() ),
1173 mView, SLOT( goPrevious() ) ); 1177 mView, SLOT( goPrevious() ) );
1174 action->addTo( navigatorToolBar ); 1178 action->addTo( navigatorToolBar );
1175 } 1179 }
1176 icon = loadPixmap( pathString + "today" ); 1180 icon = loadPixmap( pathString + "today" );
1177 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1181 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1178 if (p-> mShowIconToday) 1182 if (p-> mShowIconToday)
1179 today_action->addTo( navigatorToolBar ); 1183 today_action->addTo( navigatorToolBar );
1180 icon = loadPixmap( pathString + "1rightarrowB" ); 1184 icon = loadPixmap( pathString + "1rightarrowB" );
1181 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1185 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1182 if (p-> mShowIconForward) { 1186 if (p-> mShowIconForward) {
1183 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1187 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1184 connect( action, SIGNAL( activated() ), 1188 connect( action, SIGNAL( activated() ),
1185 mView, SLOT( goNext() ) ); 1189 mView, SLOT( goNext() ) );
1186 action->addTo( navigatorToolBar ); 1190 action->addTo( navigatorToolBar );
1187 } 1191 }
1188 icon = loadPixmap( pathString + "2rightarrowB" ); 1192 icon = loadPixmap( pathString + "2rightarrowB" );
1189 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1193 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1190 if (p-> mShowIconForwardFast) { 1194 if (p-> mShowIconForwardFast) {
1191 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1195 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1192 connect( action, SIGNAL( activated() ), 1196 connect( action, SIGNAL( activated() ),
1193 mView, SLOT( goNextMonth() ) ); 1197 mView, SLOT( goNextMonth() ) );
1194 action->addTo( navigatorToolBar ); 1198 action->addTo( navigatorToolBar );
1195 } 1199 }
1196 1200
1197 1201
1198 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); 1202 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1199 1203
1200 1204
1201 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); 1205 if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true);
1202 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); 1206 if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true);
1203 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); 1207 if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true);
1204 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); 1208 if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true);
1205 1209
1206 if (p-> mShowIconNewEvent) 1210 if (p-> mShowIconNewEvent)
1207 configureToolBarMenu->setItemChecked( 10, true ); 1211 configureToolBarMenu->setItemChecked( 10, true );
1208 if (p->mShowIconNewTodo ) 1212 if (p->mShowIconNewTodo )
1209 configureToolBarMenu->setItemChecked( 20, true ); 1213 configureToolBarMenu->setItemChecked( 20, true );
1210 if (p-> mShowIconSearch) 1214 if (p-> mShowIconSearch)
1211 configureToolBarMenu->setItemChecked( 120, true ); 1215 configureToolBarMenu->setItemChecked( 120, true );
1212 if (p-> mShowIconList) 1216 if (p-> mShowIconList)
1213 configureToolBarMenu->setItemChecked( 30, true ); 1217 configureToolBarMenu->setItemChecked( 30, true );
1214 if (p-> mShowIconDay1) 1218 if (p-> mShowIconDay1)
1215 configureToolBarMenu->setItemChecked( 40, true ); 1219 configureToolBarMenu->setItemChecked( 40, true );
1216 if (p-> mShowIconDay5) 1220 if (p-> mShowIconDay5)
1217 configureToolBarMenu->setItemChecked( 50, true ); 1221 configureToolBarMenu->setItemChecked( 50, true );
1218 if (p-> mShowIconDay6) 1222 if (p-> mShowIconDay6)
1219 configureToolBarMenu->setItemChecked( 75, true ); 1223 configureToolBarMenu->setItemChecked( 75, true );
1220 if (p-> mShowIconDay7) 1224 if (p-> mShowIconDay7)
1221 configureToolBarMenu->setItemChecked( 60, true ); 1225 configureToolBarMenu->setItemChecked( 60, true );
1222 if (p-> mShowIconMonth) 1226 if (p-> mShowIconMonth)
1223 configureToolBarMenu->setItemChecked( 70, true ); 1227 configureToolBarMenu->setItemChecked( 70, true );
1224 if (p-> mShowIconTodoview) 1228 if (p-> mShowIconTodoview)
1225 configureToolBarMenu->setItemChecked( 80, true ); 1229 configureToolBarMenu->setItemChecked( 80, true );
1226 if (p-> mShowIconBackFast) 1230 if (p-> mShowIconBackFast)
1227 configureToolBarMenu->setItemChecked( 200, true ); 1231 configureToolBarMenu->setItemChecked( 200, true );
1228 if (p-> mShowIconBack) 1232 if (p-> mShowIconBack)
1229 configureToolBarMenu->setItemChecked( 210, true ); 1233 configureToolBarMenu->setItemChecked( 210, true );
1230 if (p-> mShowIconToday) 1234 if (p-> mShowIconToday)
1231 configureToolBarMenu->setItemChecked( 130, true ); 1235 configureToolBarMenu->setItemChecked( 130, true );
1232 if (p-> mShowIconForward) 1236 if (p-> mShowIconForward)
1233 configureToolBarMenu->setItemChecked( 220, true ); 1237 configureToolBarMenu->setItemChecked( 220, true );
1234 if (p-> mShowIconForwardFast) 1238 if (p-> mShowIconForwardFast)
1235 configureToolBarMenu->setItemChecked( 230, true ); 1239 configureToolBarMenu->setItemChecked( 230, true );
1236 if (p-> mShowIconNextDays) 1240 if (p-> mShowIconNextDays)
1237 configureToolBarMenu->setItemChecked( 100, true ); 1241 configureToolBarMenu->setItemChecked( 100, true );
1238 if (p-> mShowIconNext) 1242 if (p-> mShowIconNext)
1239 configureToolBarMenu->setItemChecked( 110, true ); 1243 configureToolBarMenu->setItemChecked( 110, true );
1240 if (p-> mShowIconJournal) 1244 if (p-> mShowIconJournal)
1241 configureToolBarMenu->setItemChecked( 90, true ); 1245 configureToolBarMenu->setItemChecked( 90, true );
1242 if (p-> mShowIconWhatsThis) 1246 if (p-> mShowIconWhatsThis)
1243 configureToolBarMenu->setItemChecked( 300, true ); 1247 configureToolBarMenu->setItemChecked( 300, true );
1244 if (p-> mShowIconWeekNum) 1248 if (p-> mShowIconWeekNum)
1245 configureToolBarMenu->setItemChecked( 400, true ); 1249 configureToolBarMenu->setItemChecked( 400, true );
1246 if (!p-> mShowIconStretch) { 1250 if (!p-> mShowIconStretch) {
1247 QLabel* dummy = new QLabel( iconToolBar ); 1251 QLabel* dummy = new QLabel( iconToolBar );
1248 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1252 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1249 dummy->setMinimumWidth( 0 ); 1253 dummy->setMinimumWidth( 0 );
1250 iconToolBar->setStretchableWidget ( dummy ) ; 1254 iconToolBar->setStretchableWidget ( dummy ) ;
1251 } 1255 }
1252 else { 1256 else {
1253 iconToolBar->setHorizontalStretchable (true ); 1257 iconToolBar->setHorizontalStretchable (true );
1254 viewToolBar->setHorizontalStretchable (true ); 1258 viewToolBar->setHorizontalStretchable (true );
1255 navigatorToolBar->setHorizontalStretchable (true ); 1259 navigatorToolBar->setHorizontalStretchable (true );
1256 iconToolBar->setVerticalStretchable (true ); 1260 iconToolBar->setVerticalStretchable (true );
1257 viewToolBar->setVerticalStretchable (true ); 1261 viewToolBar->setVerticalStretchable (true );
1258 navigatorToolBar->setVerticalStretchable (true ); 1262 navigatorToolBar->setVerticalStretchable (true );
1259 configureToolBarMenu->setItemChecked( 5, true ); 1263 configureToolBarMenu->setItemChecked( 5, true );
1260 } 1264 }
1261 if (p-> mShowIconFilter) 1265 if (p-> mShowIconFilter)
1262 configureToolBarMenu->setItemChecked( 7, true ); 1266 configureToolBarMenu->setItemChecked( 7, true );
1263 if (p-> mShowIconOnetoolbar) 1267 if (p-> mShowIconOnetoolbar)
1264 configureToolBarMenu->setItemChecked( 6, true ); 1268 configureToolBarMenu->setItemChecked( 6, true );
1265 1269
1266 1270
1267 if ( filterMenubar ) 1271 if ( filterMenubar )
1268 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); 1272 connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) );
1269 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1273 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1270 configureAgenda( p->mHourSize ); 1274 configureAgenda( p->mHourSize );
1271 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1275 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1272} 1276}
1273 1277
1274void MainWindow::exportToPhone( int mode ) 1278void MainWindow::exportToPhone( int mode )
1275{ 1279{
1276 1280
1277 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1281 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1278 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1282 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1279 KOex2phonePrefs ex2phone; 1283 KOex2phonePrefs ex2phone;
1280 1284
1281 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1285 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1282 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1286 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1283 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1287 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1284 if ( mode == 1 ) 1288 if ( mode == 1 )
1285 ex2phone.setCaption(i18n("Export complete calendar")); 1289 ex2phone.setCaption(i18n("Export complete calendar"));
1286 if ( mode == 2 ) 1290 if ( mode == 2 )
1287 ex2phone.setCaption(i18n("Export filtered calendar")); 1291 ex2phone.setCaption(i18n("Export filtered calendar"));
1288 1292
1289 if ( !ex2phone.exec() ) { 1293 if ( !ex2phone.exec() ) {
1290 return; 1294 return;
1291 } 1295 }
1292 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1296 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1293 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1297 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1294 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1298 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1295 1299
1296 int inFuture = 0; 1300 int inFuture = 0;
1297 if ( ex2phone.mWriteBackFuture->isChecked() ) 1301 if ( ex2phone.mWriteBackFuture->isChecked() )
1298 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1302 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1299 QPtrList<Incidence> delSel; 1303 QPtrList<Incidence> delSel;
1300 if ( mode == 1 ) 1304 if ( mode == 1 )
1301 delSel = mCalendar->rawIncidences(); 1305 delSel = mCalendar->rawIncidences();
1302 if ( mode == 2 ) 1306 if ( mode == 2 )
1303 delSel = mCalendar->incidences(); 1307 delSel = mCalendar->incidences();
1304 CalendarLocal* cal = new CalendarLocal(); 1308 CalendarLocal* cal = new CalendarLocal();
1305 cal->setLocalTime(); 1309 cal->setLocalTime();
1306 Incidence *incidence = delSel.first(); 1310 Incidence *incidence = delSel.first();
1307 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1311 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1308 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1312 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1309 while ( incidence ) { 1313 while ( incidence ) {
1310 if ( incidence->type() != "Journal" ) { 1314 if ( incidence->type() != "Journal" ) {
1311 bool add = true; 1315 bool add = true;
1312 if ( inFuture ) { 1316 if ( inFuture ) {
1313 QDateTime dt; 1317 QDateTime dt;
1314 if ( incidence->type() == "Todo" ) { 1318 if ( incidence->type() == "Todo" ) {
1315 Todo * t = (Todo*)incidence; 1319 Todo * t = (Todo*)incidence;
1316 if ( t->hasDueDate() ) 1320 if ( t->hasDueDate() )
1317 dt = t->dtDue(); 1321 dt = t->dtDue();
1318 else 1322 else
1319 dt = cur.addSecs( 62 ); 1323 dt = cur.addSecs( 62 );
1320 } 1324 }
1321 else { 1325 else {
1322 bool ok; 1326 bool ok;
1323 dt = incidence->getNextOccurence( cur, &ok ); 1327 dt = incidence->getNextOccurence( cur, &ok );
1324 if ( !ok ) 1328 if ( !ok )
1325 dt = cur.addSecs( -62 ); 1329 dt = cur.addSecs( -62 );
1326 } 1330 }
1327 if ( dt < cur || dt > end ) { 1331 if ( dt < cur || dt > end ) {
1328 add = false; 1332 add = false;
1329 } 1333 }
1330 } 1334 }
1331 if ( add ) { 1335 if ( add ) {
1332 Incidence *in = incidence->clone(); 1336 Incidence *in = incidence->clone();
1333 cal->addIncidence( in ); 1337 cal->addIncidence( in );
1334 } 1338 }
1335 } 1339 }
1336 incidence = delSel.next(); 1340 incidence = delSel.next();
1337 } 1341 }
1338 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1342 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1339 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1343 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1340 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1344 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1341 1345
1342 setCaption( i18n("Writing to phone...")); 1346 setCaption( i18n("Writing to phone..."));
1343 if ( PhoneFormat::writeToPhone( cal ) ) 1347 if ( PhoneFormat::writeToPhone( cal ) )
1344 setCaption( i18n("Export to phone successful!")); 1348 setCaption( i18n("Export to phone successful!"));
1345 else 1349 else
1346 setCaption( i18n("Error exporting to phone!")); 1350 setCaption( i18n("Error exporting to phone!"));
1347 delete cal; 1351 delete cal;
1348} 1352}
1349 1353
1350 1354
1351void MainWindow::setDefaultPreferences() 1355void MainWindow::setDefaultPreferences()
1352{ 1356{
1353 KOPrefs *p = KOPrefs::instance(); 1357 KOPrefs *p = KOPrefs::instance();
1354 1358
1355 p->mCompactDialogs = true; 1359 p->mCompactDialogs = true;
1356 p->mConfirm = true; 1360 p->mConfirm = true;
1357 // p->mEnableQuickTodo = false; 1361 // p->mEnableQuickTodo = false;
1358 1362
1359} 1363}
1360 1364
1361QString MainWindow::resourcePath() 1365QString MainWindow::resourcePath()
1362{ 1366{
1363 return KGlobal::iconLoader()->iconPath(); 1367 return KGlobal::iconLoader()->iconPath();
1364} 1368}
1365 1369
1366void MainWindow::displayText( QString text ,QString cap ) 1370void MainWindow::displayText( QString text ,QString cap )
1367{ 1371{
1368 QDialog dia( this, "name", true ); ; 1372 QDialog dia( this, "name", true ); ;
1369 dia.setCaption( cap ); 1373 dia.setCaption( cap );
1370 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1374 QVBoxLayout* lay = new QVBoxLayout( &dia );
1371 lay->setSpacing( 3 ); 1375 lay->setSpacing( 3 );
1372 lay->setMargin( 3 ); 1376 lay->setMargin( 3 );
1373 QTextBrowser tb ( &dia ); 1377 QTextBrowser tb ( &dia );
1374 lay->addWidget( &tb ); 1378 lay->addWidget( &tb );
1375 tb.setText( text ); 1379 tb.setText( text );
1376#ifdef DESKTOP_VERSION 1380#ifdef DESKTOP_VERSION
1377 dia.resize( 640, 480); 1381 dia.resize( 640, 480);
1378#else 1382#else
1379 dia.showMaximized(); 1383 dia.showMaximized();
1380#endif 1384#endif
1381 dia.exec(); 1385 dia.exec();
1382} 1386}
1383 1387
1384void MainWindow::features() 1388void MainWindow::features()
1385{ 1389{
1386 1390
1387 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1391 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1388} 1392}
1389 1393
1390void MainWindow::usertrans() 1394void MainWindow::usertrans()
1391{ 1395{
1392 1396
1393 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1397 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1394} 1398}
1395 1399
1400void MainWindow::storagehowto()
1401{
1402 KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" );
1403}
1396void MainWindow::kdesynchowto() 1404void MainWindow::kdesynchowto()
1397{ 1405{
1398 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1406 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1399} 1407}
1400void MainWindow::multisynchowto() 1408void MainWindow::multisynchowto()
1401{ 1409{
1402 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1410 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1403} 1411}
1404void MainWindow::synchowto() 1412void MainWindow::synchowto()
1405{ 1413{
1406 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1414 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1407} 1415}
1408void MainWindow::faq() 1416void MainWindow::faq()
1409{ 1417{
1410 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1418 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1411 1419
1412} 1420}
1413void MainWindow::whatsNew() 1421void MainWindow::whatsNew()
1414{ 1422{
1415 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1423 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1416 1424
1417} 1425}
1418void MainWindow::licence() 1426void MainWindow::licence()
1419{ 1427{
1420 KApplication::showLicence(); 1428 KApplication::showLicence();
1421 1429
1422} 1430}
1423void MainWindow::about() 1431void MainWindow::about()
1424{ 1432{
1425 QString version; 1433 QString version;
1426#include <../version> 1434#include <../version>
1427 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1435 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1428 i18n("KOrganizer/Platform-independent\n") + 1436 i18n("KOrganizer/Platform-independent\n") +
1429 "(KO/Pi) " + version + " - " + 1437 "(KO/Pi) " + version + " - " +
1430 1438
1431#ifdef DESKTOP_VERSION 1439#ifdef DESKTOP_VERSION
1432 i18n("Desktop Edition\n") + 1440 i18n("Desktop Edition\n") +
1433#else 1441#else
1434 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1442 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1435#endif 1443#endif
1436 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); 1444 i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") );
1437} 1445}
1438void MainWindow::keyBindings() 1446void MainWindow::keyBindings()
1439{ 1447{
1440 QString cap = i18n("KO/Pi Keys + Colors"); 1448 QString cap = i18n("KO/Pi Keys + Colors");
1441 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1449 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1442 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1450 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1443 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + 1451 i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") +
1444 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + 1452 i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") +
1445 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1453 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1446 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1454 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1447 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1455 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1448 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1456 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1449 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1457 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1450 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ 1458 i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+
1451 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1459 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1452 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1460 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1453 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1461 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1454 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1462 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1455 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1463 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1456 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1464 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1457 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ 1465 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+
1458 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1466 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1459 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1467 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1460 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1468 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1461 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1469 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1462 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1470 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1463 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1471 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1464 i18n("<p><h3>In agenda view:</h3></p>\n") + 1472 i18n("<p><h3>In agenda view:</h3></p>\n") +
1465 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1473 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1466 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1474 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1467 i18n("<p><h3>In todo view:</h3></p>\n") + 1475 i18n("<p><h3>In todo view:</h3></p>\n") +
1468 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1476 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1469 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1477 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1470 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1478 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1471 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1479 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1472 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1480 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1473 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1481 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1474 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1482 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1475 i18n("<p><h3>In list view:</h3></p>\n") + 1483 i18n("<p><h3>In list view:</h3></p>\n") +
1476 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1484 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1477 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1485 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1478 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1486 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1479 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1487 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1480 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1488 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1481 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1489 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1482 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1490 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1483 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1491 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1484 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1492 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1485 i18n("<p><b>E</b>: Edit item</p>\n") + 1493 i18n("<p><b>E</b>: Edit item</p>\n") +
1486 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1494 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1487 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1495 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1488 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1496 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1489 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1497 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1490 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1498 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1491 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1499 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1492 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1500 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1493 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1501 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1494 i18n("<p><b>White</b>: Item readonly</p>\n"); 1502 i18n("<p><b>White</b>: Item readonly</p>\n");
1495 displayText( text, cap); 1503 displayText( text, cap);
1496} 1504}
1497void MainWindow::aboutAutoSaving() 1505void MainWindow::aboutAutoSaving()
1498{ 1506{
1499 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1507 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1500 1508
1501 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1509 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1502 1510
1503} 1511}
1504void MainWindow::aboutKnownBugs() 1512void MainWindow::aboutKnownBugs()
1505{ 1513{
1506 QMessageBox* msg; 1514 QMessageBox* msg;
1507 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1515 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1508 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1516 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1509 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1517 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1510 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1518 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1511 i18n("\nor report them in the bugtracker on\n") + 1519 i18n("\nor report them in the bugtracker on\n") +
1512 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1520 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1513 QMessageBox::NoIcon, 1521 QMessageBox::NoIcon,
1514 QMessageBox::Ok, 1522 QMessageBox::Ok,
1515 QMessageBox::NoButton, 1523 QMessageBox::NoButton,
1516 QMessageBox::NoButton); 1524 QMessageBox::NoButton);
1517 msg->exec(); 1525 msg->exec();
1518 delete msg; 1526 delete msg;
1519 1527
1520} 1528}
1521 1529
1522QString MainWindow::defaultFileName() 1530QString MainWindow::defaultFileName()
1523{ 1531{
1524 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1532 return locateLocal( "data", "korganizer/mycalendar.ics" );
1525} 1533}
1526QString MainWindow::syncFileName() 1534QString MainWindow::syncFileName()
1527{ 1535{
1528#ifdef DESKTOP_VERSION 1536#ifdef DESKTOP_VERSION
1529 return locateLocal( "tmp", "synccalendar.ics" ); 1537 return locateLocal( "tmp", "synccalendar.ics" );
1530#else 1538#else
1531 return QString( "/tmp/synccalendar.ics" ); 1539 return QString( "/tmp/synccalendar.ics" );
1532#endif 1540#endif
1533} 1541}
1534#include "koglobals.h" 1542#include "koglobals.h"
1535#include <kcalendarsystem.h> 1543#include <kcalendarsystem.h>
1536void MainWindow::updateWeek(QDate seda) 1544void MainWindow::updateWeek(QDate seda)
1537{ 1545{
1538 int weekNum = KGlobal::locale()->weekNum ( seda ); 1546 int weekNum = KGlobal::locale()->weekNum ( seda );
1539 mWeekPixmap.fill( mWeekBgColor ); 1547 mWeekPixmap.fill( mWeekBgColor );
1540 QPainter p ( &mWeekPixmap ); 1548 QPainter p ( &mWeekPixmap );
1541 p.setFont( mWeekFont ); 1549 p.setFont( mWeekFont );
1542 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1550 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1543 p.end(); 1551 p.end();
1544 QIconSet icon3 ( mWeekPixmap ); 1552 QIconSet icon3 ( mWeekPixmap );
1545 mWeekAction->setIconSet ( icon3 ); 1553 mWeekAction->setIconSet ( icon3 );
1546 1554
1547} 1555}
1548void MainWindow::updateWeekNum(const DateList &selectedDates) 1556void MainWindow::updateWeekNum(const DateList &selectedDates)
1549{ 1557{
1550 updateWeek( selectedDates.first() ); 1558 updateWeek( selectedDates.first() );
1551} 1559}
1552void MainWindow::processIncidenceSelection( Incidence *incidence ) 1560void MainWindow::processIncidenceSelection( Incidence *incidence )
1553{ 1561{
1554 1562
1555 if ( !incidence ) { 1563 if ( !incidence ) {
1556 enableIncidenceActions( false ); 1564 enableIncidenceActions( false );
1557 1565
1558 mNewSubTodoAction->setEnabled( false ); 1566 mNewSubTodoAction->setEnabled( false );
1559 setCaptionToDates(); 1567 setCaptionToDates();
1560 return; 1568 return;
1561 1569
1562 } 1570 }
1563 1571
1564 //KGlobal::locale()->formatDateTime(nextA, true); 1572 //KGlobal::locale()->formatDateTime(nextA, true);
1565 QString startString = ""; 1573 QString startString = "";
1566 if ( incidence->type() != "Todo" ) { 1574 if ( incidence->type() != "Todo" ) {
1567 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1575 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1568 if ( incidence->doesFloat() ) { 1576 if ( incidence->doesFloat() ) {
1569 startString += ": "+incidence->dtStartDateStr( true ); 1577 startString += ": "+incidence->dtStartDateStr( true );
1570 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1578 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1571 1579
1572 } else { 1580 } else {
1573 startString = ": "+incidence->dtStartStr(true); 1581 startString = ": "+incidence->dtStartStr(true);
1574 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1582 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1575 1583
1576 } 1584 }
1577 1585
1578 } else { 1586 } else {
1579 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1587 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1580 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1588 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1581 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1589 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1582 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1590 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1583 bool ok; 1591 bool ok;
1584 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1592 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1585 if ( ok ) { 1593 if ( ok ) {
1586 int years = noc.date().year() - incidence->dtStart().date().year(); 1594 int years = noc.date().year() - incidence->dtStart().date().year();
1587 startString += i18n(" (%1 y.)"). arg( years ); 1595 startString += i18n(" (%1 y.)"). arg( years );
1588 } 1596 }
1589 } 1597 }
1590 else 1598 else
1591 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1599 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1592 } 1600 }
1593 1601
1594 } 1602 }
1595 else 1603 else
1596 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1604 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1597 if ( !incidence->location().isEmpty() ) 1605 if ( !incidence->location().isEmpty() )
1598 startString += " (" +incidence->location()+")"; 1606 startString += " (" +incidence->location()+")";
1599 setCaption( incidence->summary()+startString); 1607 setCaption( incidence->summary()+startString);
1600 1608
1601 enableIncidenceActions( true ); 1609 enableIncidenceActions( true );
1602 1610
1603 if ( incidence->type() == "Event" ) { 1611 if ( incidence->type() == "Event" ) {
1604 mShowAction->setText( i18n("Show Event...") ); 1612 mShowAction->setText( i18n("Show Event...") );
1605 mEditAction->setText( i18n("Edit Event...") ); 1613 mEditAction->setText( i18n("Edit Event...") );
1606 mDeleteAction->setText( i18n("Delete Event...") ); 1614 mDeleteAction->setText( i18n("Delete Event...") );
1607 1615
1608 mNewSubTodoAction->setEnabled( false ); 1616 mNewSubTodoAction->setEnabled( false );
1609 } else if ( incidence->type() == "Todo" ) { 1617 } else if ( incidence->type() == "Todo" ) {
1610 mShowAction->setText( i18n("Show Todo...") ); 1618 mShowAction->setText( i18n("Show Todo...") );
1611 mEditAction->setText( i18n("Edit Todo...") ); 1619 mEditAction->setText( i18n("Edit Todo...") );
1612 mDeleteAction->setText( i18n("Delete Todo...") ); 1620 mDeleteAction->setText( i18n("Delete Todo...") );
1613 1621
1614 mNewSubTodoAction->setEnabled( true ); 1622 mNewSubTodoAction->setEnabled( true );
1615 } else { 1623 } else {
1616 mShowAction->setText( i18n("Show...") ); 1624 mShowAction->setText( i18n("Show...") );
1617 mShowAction->setText( i18n("Edit...") ); 1625 mShowAction->setText( i18n("Edit...") );
1618 mShowAction->setText( i18n("Delete...") ); 1626 mShowAction->setText( i18n("Delete...") );
1619 1627
1620 mNewSubTodoAction->setEnabled( false ); 1628 mNewSubTodoAction->setEnabled( false );
1621 } 1629 }
1622} 1630}
1623 1631
1624void MainWindow::enableIncidenceActions( bool enabled ) 1632void MainWindow::enableIncidenceActions( bool enabled )
1625{ 1633{
1626 mShowAction->setEnabled( enabled ); 1634 mShowAction->setEnabled( enabled );
1627 mEditAction->setEnabled( enabled ); 1635 mEditAction->setEnabled( enabled );
1628 mDeleteAction->setEnabled( enabled ); 1636 mDeleteAction->setEnabled( enabled );
1629 1637
1630 mCloneAction->setEnabled( enabled ); 1638 mCloneAction->setEnabled( enabled );
1631 mMoveAction->setEnabled( enabled ); 1639 mMoveAction->setEnabled( enabled );
1632 mBeamAction->setEnabled( enabled ); 1640 mBeamAction->setEnabled( enabled );
1633 mCancelAction->setEnabled( enabled ); 1641 mCancelAction->setEnabled( enabled );
1634} 1642}
1635 1643
1636void MainWindow::importOL() 1644void MainWindow::importOL()
1637{ 1645{
1638#ifdef _OL_IMPORT_ 1646#ifdef _OL_IMPORT_
1639 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1647 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1640 id->exec(); 1648 id->exec();
1641 delete id; 1649 delete id;
1642 mView->updateView(); 1650 mView->updateView();
1643#endif 1651#endif
1644} 1652}
1645void MainWindow::importBday() 1653void MainWindow::importBday()
1646{ 1654{
1647 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1655 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1648 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1656 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1649 i18n("Import!"), i18n("Cancel"), 0, 1657 i18n("Import!"), i18n("Cancel"), 0,
1650 0, 1 ); 1658 0, 1 );
1651 if ( result == 0 ) { 1659 if ( result == 0 ) {
1652 mView->importBday(); 1660 mView->importBday();
1653 1661
1654 } 1662 }
1655 1663
1656 1664
1657} 1665}
1658void MainWindow::importQtopia() 1666void MainWindow::importQtopia()
1659{ 1667{
1660 //#ifndef DESKTOP_VERSION 1668 //#ifndef DESKTOP_VERSION
1661 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"); 1669 QString mess = i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing");
1662#ifdef DESKTOP_VERSION 1670#ifdef DESKTOP_VERSION
1663 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); 1671 mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml");
1664#endif 1672#endif
1665 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1673 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1666 i18n("Import!"), i18n("Cancel"), 0, 1674 i18n("Import!"), i18n("Cancel"), 0,
1667 0, 1 ); 1675 0, 1 );
1668 if ( result == 0 ) { 1676 if ( result == 0 ) {
1669#ifndef DESKTOP_VERSION 1677#ifndef DESKTOP_VERSION
1670 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1678 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1671 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1679 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1672 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1680 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1673#else 1681#else
1674 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1682 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1675 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1683 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1676 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1684 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1677#endif 1685#endif
1678 mView->importQtopia( categories, datebook, todolist ); 1686 mView->importQtopia( categories, datebook, todolist );
1679 } 1687 }
1680#if 0 1688#if 0
1681 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1689 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1682 i18n("Not supported \non desktop!\n"), 1690 i18n("Not supported \non desktop!\n"),
1683 i18n("Ok"), i18n("Cancel"), 0, 1691 i18n("Ok"), i18n("Cancel"), 0,
1684 0, 1 ); 1692 0, 1 );
1685 1693
1686#endif 1694#endif
1687} 1695}
1688 1696
1689void MainWindow::saveOnClose() 1697void MainWindow::saveOnClose()
1690{ 1698{
1691 KOPrefs *p = KOPrefs::instance(); 1699 KOPrefs *p = KOPrefs::instance();
1692 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1700 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1693 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); 1701 p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
1694 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); 1702 p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
1695 if ( filterToolBar ) { 1703 if ( filterToolBar ) {
1696 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); 1704 p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
1697 } 1705 }
1698#ifdef DESKTOP_VERSION 1706#ifdef DESKTOP_VERSION
1699 1707
1700 QPoint myP; 1708 QPoint myP;
1701 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); 1709 myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
1702 if ( p->mToolBarHor ) 1710 if ( p->mToolBarHor )
1703 p->mToolBarUp = myP.y() > height()/2; 1711 p->mToolBarUp = myP.y() > height()/2;
1704 else 1712 else
1705 p->mToolBarUp = myP.x() > width()/2; 1713 p->mToolBarUp = myP.x() > width()/2;
1706 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); 1714 myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
1707 if ( p->mToolBarHorV ) 1715 if ( p->mToolBarHorV )
1708 p->mToolBarUpV = myP.y() > height()/2; 1716 p->mToolBarUpV = myP.y() > height()/2;
1709 else 1717 else
1710 p->mToolBarUpV = myP.x() > width()/2 ; 1718 p->mToolBarUpV = myP.x() > width()/2 ;
1711 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); 1719 myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
1712 if ( p->mToolBarHorN ) 1720 if ( p->mToolBarHorN )
1713 p->mToolBarUpN = myP.y() > height()/2; 1721 p->mToolBarUpN = myP.y() > height()/2;
1714 else 1722 else
1715 p->mToolBarUpN = myP.x() > width()/2 ; 1723 p->mToolBarUpN = myP.x() > width()/2 ;
1716 if ( filterToolBar ) { 1724 if ( filterToolBar ) {
1717 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); 1725 myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
1718 if ( p->mToolBarHorF ) 1726 if ( p->mToolBarHorF )
1719 p->mToolBarUpF = myP.y() > height()/2; 1727 p->mToolBarUpF = myP.y() > height()/2;
1720 else 1728 else
1721 p->mToolBarUpF = myP.x() > width()/2 ; 1729 p->mToolBarUpF = myP.x() > width()/2 ;
1722 } 1730 }
1723#else 1731#else
1724 if ( p->mToolBarHor ) 1732 if ( p->mToolBarHor )
1725 p->mToolBarUp = iconToolBar->y() > height()/2; 1733 p->mToolBarUp = iconToolBar->y() > height()/2;
1726 else 1734 else
1727 p->mToolBarUp = iconToolBar->x() > width()/2; 1735 p->mToolBarUp = iconToolBar->x() > width()/2;
1728 if ( p->mToolBarHorV ) 1736 if ( p->mToolBarHorV )
1729 p->mToolBarUpV = viewToolBar->y() > height()/2; 1737 p->mToolBarUpV = viewToolBar->y() > height()/2;
1730 else 1738 else
1731 p->mToolBarUpV = viewToolBar->x() > width()/2 ; 1739 p->mToolBarUpV = viewToolBar->x() > width()/2 ;
1732 1740
1733 if ( p->mToolBarHorN ) 1741 if ( p->mToolBarHorN )
1734 p->mToolBarUpN = navigatorToolBar->y() > height()/2; 1742 p->mToolBarUpN = navigatorToolBar->y() > height()/2;
1735 else 1743 else
1736 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; 1744 p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
1737 if ( filterToolBar ) { 1745 if ( filterToolBar ) {
1738 if ( p->mToolBarHorF ) 1746 if ( p->mToolBarHorF )
1739 p->mToolBarUpF = filterToolBar->y() > height()/2; 1747 p->mToolBarUpF = filterToolBar->y() > height()/2;
1740 else 1748 else
1741 p->mToolBarUpF = filterToolBar->x() > width()/2 ; 1749 p->mToolBarUpF = filterToolBar->x() > width()/2 ;
1742 } 1750 }
1743#endif 1751#endif
1744 1752
1745 1753
1746 mView->writeSettings(); 1754 mView->writeSettings();
1747 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1755 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1748 save(); 1756 save();
1749} 1757}
1750void MainWindow::slotModifiedChanged( bool changed ) 1758void MainWindow::slotModifiedChanged( bool changed )
1751{ 1759{
1752 if ( mBlockAtStartup ) 1760 if ( mBlockAtStartup )
1753 return; 1761 return;
1754 1762
1755 int msec; 1763 int msec;
1756 // we store the changes after 1 minute, 1764 // we store the changes after 1 minute,
1757 // and for safety reasons after 10 minutes again 1765 // and for safety reasons after 10 minutes again
1758 if ( !mSyncManager->blockSave() ) 1766 if ( !mSyncManager->blockSave() )
1759 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1767 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1760 else 1768 else
1761 msec = 1000 * 600; 1769 msec = 1000 * 600;
1762 mSaveTimer.start( msec, true ); // 1 minute 1770 mSaveTimer.start( msec, true ); // 1 minute
1763 qDebug("KO: Saving File in %d secs!", msec/1000); 1771 qDebug("KO: Saving File in %d secs!", msec/1000);
1764 mCalendarModifiedFlag = true; 1772 mCalendarModifiedFlag = true;
1765} 1773}
1766void MainWindow::saveStopTimer() 1774void MainWindow::saveStopTimer()
1767{ 1775{
1768 mSaveTimer.stop(); 1776 mSaveTimer.stop();
1769 if (mSaveTimer.isActive() ) 1777 if (mSaveTimer.isActive() )
1770 qDebug("ti active "); 1778 qDebug("ti active ");
1771 else 1779 else
1772 qDebug("KO: Save timer stopped"); 1780 qDebug("KO: Save timer stopped");
1773} 1781}
1774void MainWindow::save() 1782void MainWindow::save()
1775{ 1783{
1776 if ( !mCalendarModifiedFlag ) { 1784 if ( !mCalendarModifiedFlag ) {
1777 qDebug("KO: Calendar not modified. Nothing saved."); 1785 qDebug("KO: Calendar not modified. Nothing saved.");
1778 return; 1786 return;
1779 } 1787 }
1780 if ( mSyncManager->blockSave() ) 1788 if ( mSyncManager->blockSave() )
1781 return; 1789 return;
1782 mSyncManager->setBlockSave(true); 1790 mSyncManager->setBlockSave(true);
1783 if ( mView->checkFileVersion( defaultFileName()) ) { 1791 if ( mView->checkFileVersion( defaultFileName()) ) {
1784 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1792 QTime neededSaveTime = QDateTime::currentDateTime().time();
1785 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1793 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1786 qDebug("KO: Start saving data to file!"); 1794 qDebug("KO: Start saving data to file!");
1787 mView->saveCalendar( defaultFileName() ); 1795 mView->saveCalendar( defaultFileName() );
1788 mCalendarModifiedFlag = false; 1796 mCalendarModifiedFlag = false;
1789 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1797 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1790 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1798 qDebug("KO: Needed %d ms for saving.",msNeeded );
1791 QString savemes; 1799 QString savemes;
1792 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1800 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1793 setCaption(savemes); 1801 setCaption(savemes);
1794 } else 1802 } else
1795 setCaption(i18n("Saving cancelled!")); 1803 setCaption(i18n("Saving cancelled!"));
1796 mSyncManager->setBlockSave( false ); 1804 mSyncManager->setBlockSave( false );
1797} 1805}
1798 1806
1799void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1807void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1800{ 1808{
1801 if ( !e->isAutoRepeat() ) { 1809 if ( !e->isAutoRepeat() ) {
1802 mFlagKeyPressed = false; 1810 mFlagKeyPressed = false;
1803 } 1811 }
1804} 1812}
1805void MainWindow::keyPressEvent ( QKeyEvent * e ) 1813void MainWindow::keyPressEvent ( QKeyEvent * e )
1806{ 1814{
1807 qApp->processEvents(); 1815 qApp->processEvents();
1808 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1816 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1809 e->ignore(); 1817 e->ignore();
1810 // qDebug(" ignore %d",e->isAutoRepeat() ); 1818 // qDebug(" ignore %d",e->isAutoRepeat() );
1811 return; 1819 return;
1812 } 1820 }
1813 if (! e->isAutoRepeat() ) 1821 if (! e->isAutoRepeat() )
1814 mFlagKeyPressed = true; 1822 mFlagKeyPressed = true;
1815 KOPrefs *p = KOPrefs::instance(); 1823 KOPrefs *p = KOPrefs::instance();
1816 bool showSelectedDates = false; 1824 bool showSelectedDates = false;
1817 int size; 1825 int size;
1818 int pro = 0; 1826 int pro = 0;
1819 //qDebug("MainWindow::keyPressEvent "); 1827 //qDebug("MainWindow::keyPressEvent ");
1820 switch ( e->key() ) { 1828 switch ( e->key() ) {
1821 case Qt::Key_Right: 1829 case Qt::Key_Right:
1822 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1830 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1823 mView->goNextMonth(); 1831 mView->goNextMonth();
1824 else 1832 else
1825 mView->goNext(); 1833 mView->goNext();
1826 showSelectedDates = true; 1834 showSelectedDates = true;
1827 break; 1835 break;
1828 case Qt::Key_Left: 1836 case Qt::Key_Left:
1829 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1837 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1830 mView->goPreviousMonth(); 1838 mView->goPreviousMonth();
1831 else 1839 else
1832 mView->goPrevious(); 1840 mView->goPrevious();
1833 showSelectedDates = true; 1841 showSelectedDates = true;
1834 break; 1842 break;
1835 case Qt::Key_Down: 1843 case Qt::Key_Down:
1836 mView->viewManager()->agendaView()->scrollOneHourDown(); 1844 mView->viewManager()->agendaView()->scrollOneHourDown();
1837 break; 1845 break;
1838 case Qt::Key_Up: 1846 case Qt::Key_Up:
1839 mView->viewManager()->agendaView()->scrollOneHourUp(); 1847 mView->viewManager()->agendaView()->scrollOneHourUp();
1840 break; 1848 break;
1841 case Qt::Key_K: 1849 case Qt::Key_K:
1842 mView->viewManager()->showMonthViewWeek(); 1850 mView->viewManager()->showMonthViewWeek();
1843 break; 1851 break;
1844 case Qt::Key_I: 1852 case Qt::Key_I:
1845 mView->showIncidence(); 1853 mView->showIncidence();
1846 break; 1854 break;
1847 case Qt::Key_Delete: 1855 case Qt::Key_Delete:
1848 case Qt::Key_Backspace: 1856 case Qt::Key_Backspace:
1849 mView->deleteIncidence(); 1857 mView->deleteIncidence();
1850 break; 1858 break;
1851 case Qt::Key_D: 1859 case Qt::Key_D:
1852 mView->viewManager()->showDayView(); 1860 mView->viewManager()->showDayView();
1853 showSelectedDates = true; 1861 showSelectedDates = true;
1854 break; 1862 break;
1855 case Qt::Key_O: 1863 case Qt::Key_O:
1856 mView->toggleFilerEnabled( ); 1864 mView->toggleFilerEnabled( );
1857 break; 1865 break;
1858 case Qt::Key_0: 1866 case Qt::Key_0:
1859 case Qt::Key_1: 1867 case Qt::Key_1:
1860 case Qt::Key_2: 1868 case Qt::Key_2:
1861 case Qt::Key_3: 1869 case Qt::Key_3:
1862 case Qt::Key_4: 1870 case Qt::Key_4:
1863 case Qt::Key_5: 1871 case Qt::Key_5:
1864 case Qt::Key_6: 1872 case Qt::Key_6:
1865 case Qt::Key_7: 1873 case Qt::Key_7:
1866 case Qt::Key_8: 1874 case Qt::Key_8:
1867 case Qt::Key_9: 1875 case Qt::Key_9:
1868 pro = e->key()-48; 1876 pro = e->key()-48;
1869 if ( pro == 0 ) 1877 if ( pro == 0 )
1870 pro = 10; 1878 pro = 10;
1871 if ( e->state() == Qt::ControlButton) 1879 if ( e->state() == Qt::ControlButton)
1872 pro += 10; 1880 pro += 10;
1873 break; 1881 break;
1874 case Qt::Key_M: 1882 case Qt::Key_M:
1875 mView->viewManager()->showMonthView(); 1883 mView->viewManager()->showMonthView();
1876 showSelectedDates = true; 1884 showSelectedDates = true;
1877 break; 1885 break;
1878 case Qt::Key_Insert: 1886 case Qt::Key_Insert:
1879 mView->newEvent(); 1887 mView->newEvent();
1880 break; 1888 break;
1881 case Qt::Key_S : 1889 case Qt::Key_S :
1882 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1890 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1883 mView->newSubTodo(); 1891 mView->newSubTodo();
1884 else 1892 else
1885 mView->dialogManager()->showSearchDialog(); 1893 mView->dialogManager()->showSearchDialog();
1886 break; 1894 break;
1887 case Qt::Key_Y : 1895 case Qt::Key_Y :
1888 case Qt::Key_Z : 1896 case Qt::Key_Z :
1889 mView->viewManager()->showWorkWeekView(); 1897 mView->viewManager()->showWorkWeekView();
1890 showSelectedDates = true; 1898 showSelectedDates = true;
1891 break; 1899 break;
1892 case Qt::Key_U : 1900 case Qt::Key_U :
1893 mView->viewManager()->showWeekView(); 1901 mView->viewManager()->showWeekView();
1894 showSelectedDates = true; 1902 showSelectedDates = true;
1895 break; 1903 break;
1896 case Qt::Key_H : 1904 case Qt::Key_H :
1897 keyBindings(); 1905 keyBindings();
1898 break; 1906 break;
1899 case Qt::Key_W: 1907 case Qt::Key_W:
1900 mView->viewManager()->showWhatsNextView(); 1908 mView->viewManager()->showWhatsNextView();
1901 break; 1909 break;
1902 case Qt::Key_L: 1910 case Qt::Key_L:
1903 mView->viewManager()->showListView(); 1911 mView->viewManager()->showListView();
1904 break; 1912 break;
1905 case Qt::Key_N: 1913 case Qt::Key_N:
1906 mView->viewManager()->showNextView(); 1914 mView->viewManager()->showNextView();
1907 break; 1915 break;
1908 case Qt::Key_V: 1916 case Qt::Key_V:
1909 mView->viewManager()->showTodoView(); 1917 mView->viewManager()->showTodoView();
1910 break; 1918 break;
1911 case Qt::Key_C: 1919 case Qt::Key_C:
1912 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1920 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1913 break; 1921 break;
1914 case Qt::Key_P: 1922 case Qt::Key_P:
1915 mView->showDatePicker( ); 1923 mView->showDatePicker( );
1916 break; 1924 break;
1917 case Qt::Key_F: 1925 case Qt::Key_F:
1918 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1926 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1919 mView->editFilters(); 1927 mView->editFilters();
1920 else 1928 else
1921 mView->toggleFilter(); 1929 mView->toggleFilter();
1922 break; 1930 break;
1923 case Qt::Key_X: 1931 case Qt::Key_X:
1924 if ( e->state() == Qt::ControlButton ) 1932 if ( e->state() == Qt::ControlButton )
1925 mView->toggleDateNavigatorWidget(); 1933 mView->toggleDateNavigatorWidget();
1926 else { 1934 else {
1927 mView->viewManager()->showNextXView(); 1935 mView->viewManager()->showNextXView();
1928 showSelectedDates = true; 1936 showSelectedDates = true;
1929 } 1937 }
1930 break; 1938 break;
1931 case Qt::Key_Space: 1939 case Qt::Key_Space:
1932 mView->toggleExpand(); 1940 mView->toggleExpand();
1933 break; 1941 break;
1934 case Qt::Key_A: 1942 case Qt::Key_A:
1935 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) 1943 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton )
1936 mView->showNextAlarms(); 1944 mView->showNextAlarms();
1937 else 1945 else
1938 mView->toggleAllDaySize(); 1946 mView->toggleAllDaySize();
1939 break; 1947 break;
1940 case Qt::Key_T: 1948 case Qt::Key_T:
1941 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1949 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1942 mView->newTodo(); 1950 mView->newTodo();
1943 else { 1951 else {
1944 mView->goToday(); 1952 mView->goToday();
1945 showSelectedDates = true; 1953 showSelectedDates = true;
1946 } 1954 }
1947 break; 1955 break;
1948 case Qt::Key_J: 1956 case Qt::Key_J:
1949 mView->viewManager()->showJournalView(); 1957 mView->viewManager()->showJournalView();
1950 break; 1958 break;
1951 case Qt::Key_B: 1959 case Qt::Key_B:
1952 mView->editIncidenceDescription();; 1960 mView->editIncidenceDescription();;
1953 break; 1961 break;
1954 // case Qt::Key_Return: 1962 // case Qt::Key_Return:
1955 case Qt::Key_E: 1963 case Qt::Key_E:
1956 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1964 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1957 mView->newEvent(); 1965 mView->newEvent();
1958 else 1966 else
1959 mView->editIncidence(); 1967 mView->editIncidence();
1960 break; 1968 break;
1961 case Qt::Key_Plus: 1969 case Qt::Key_Plus:
1962 size = p->mHourSize +2; 1970 size = p->mHourSize +2;
1963 if ( size <= 22 ) 1971 if ( size <= 22 )
1964 configureAgenda( size ); 1972 configureAgenda( size );
1965 break; 1973 break;
1966 case Qt::Key_Minus: 1974 case Qt::Key_Minus:
1967 size = p->mHourSize - 2; 1975 size = p->mHourSize - 2;
1968 if ( size >= 4 ) 1976 if ( size >= 4 )
1969 configureAgenda( size ); 1977 configureAgenda( size );
1970 break; 1978 break;
1971 1979
1972 1980
1973 default: 1981 default:
1974 e->ignore(); 1982 e->ignore();
1975 } 1983 }
1976 if ( pro > 0 ) { 1984 if ( pro > 0 ) {
1977 mView->selectFilter( pro-1 ); 1985 mView->selectFilter( pro-1 );
1978 } 1986 }
1979 if ( showSelectedDates ) { 1987 if ( showSelectedDates ) {
1980 ;// setCaptionToDates(); 1988 ;// setCaptionToDates();
1981 } 1989 }
1982 1990
1983} 1991}
1984void MainWindow::fillFilterMenuTB() 1992void MainWindow::fillFilterMenuTB()
1985{ 1993{
1986 selectFilterMenuTB->clear(); 1994 selectFilterMenuTB->clear();
1987 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); 1995 selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 );
1988 selectFilterMenuTB->insertSeparator(); 1996 selectFilterMenuTB->insertSeparator();
1989 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); 1997 selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 );
1990 1998
1991 selectFilterMenuTB->insertSeparator(); 1999 selectFilterMenuTB->insertSeparator();
1992 QPtrList<CalFilter> fili = mView->filters(); 2000 QPtrList<CalFilter> fili = mView->filters();
1993 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2001 CalFilter *curfilter = mView->filterView()->selectedFilter();
1994 CalFilter *filter = fili.first(); 2002 CalFilter *filter = fili.first();
1995 int iii = 2; 2003 int iii = 2;
1996 bool checkitem = mView->filterView()->filtersEnabled(); 2004 bool checkitem = mView->filterView()->filtersEnabled();
1997 while(filter) { 2005 while(filter) {
1998 selectFilterMenuTB->insertItem( filter->name(), iii ); 2006 selectFilterMenuTB->insertItem( filter->name(), iii );
1999 if ( filter == curfilter) 2007 if ( filter == curfilter)
2000 selectFilterMenuTB->setItemChecked( iii, checkitem ); 2008 selectFilterMenuTB->setItemChecked( iii, checkitem );
2001 filter = fili.next(); 2009 filter = fili.next();
2002 ++iii; 2010 ++iii;
2003 } 2011 }
2004 if ( !checkitem ) 2012 if ( !checkitem )
2005 selectFilterMenuTB->setItemChecked( 1, true ); 2013 selectFilterMenuTB->setItemChecked( 1, true );
2006 2014
2007 int x = 0; 2015 int x = 0;
2008 int y = iconToolBar->height(); 2016 int y = iconToolBar->height();
2009 int dX = 0; 2017 int dX = 0;
2010 int dY = 0; 2018 int dY = 0;
2011 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2019 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2012 if ( iconToolBar->y() > height()/2 ) { 2020 if ( iconToolBar->y() > height()/2 ) {
2013 dY = selectFilterMenuTB->sizeHint().height()+8; 2021 dY = selectFilterMenuTB->sizeHint().height()+8;
2014 y = 0; 2022 y = 0;
2015 } 2023 }
2016 } else { 2024 } else {
2017 if ( iconToolBar->x() > width()/2 ) { // right side 2025 if ( iconToolBar->x() > width()/2 ) { // right side
2018 x=0; 2026 x=0;
2019 dX= selectFilterMenuTB->sizeHint().width()+8; 2027 dX= selectFilterMenuTB->sizeHint().width()+8;
2020 y = 0; 2028 y = 0;
2021 } else { 2029 } else {
2022 x= iconToolBar->width(); 2030 x= iconToolBar->width();
2023 y = 0; 2031 y = 0;
2024 } 2032 }
2025 } 2033 }
2026 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2034 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2027 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); 2035 selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)));
2028} 2036}
2029void MainWindow::fillFilterMenu() 2037void MainWindow::fillFilterMenu()
2030{ 2038{
2031 selectFilterMenu->clear(); 2039 selectFilterMenu->clear();
2032 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 2040 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
2033 selectFilterMenu->insertSeparator(); 2041 selectFilterMenu->insertSeparator();
2034 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); 2042 selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 );
2035 2043
2036 selectFilterMenu->insertSeparator(); 2044 selectFilterMenu->insertSeparator();
2037 QPtrList<CalFilter> fili = mView->filters(); 2045 QPtrList<CalFilter> fili = mView->filters();
2038 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2046 CalFilter *curfilter = mView->filterView()->selectedFilter();
2039 CalFilter *filter = fili.first(); 2047 CalFilter *filter = fili.first();
2040 int iii = 2; 2048 int iii = 2;
2041 bool checkitem = mView->filterView()->filtersEnabled(); 2049 bool checkitem = mView->filterView()->filtersEnabled();
2042 while(filter) { 2050 while(filter) {
2043 selectFilterMenu->insertItem( filter->name(), iii ); 2051 selectFilterMenu->insertItem( filter->name(), iii );
2044 if ( filter == curfilter) 2052 if ( filter == curfilter)
2045 selectFilterMenu->setItemChecked( iii, checkitem ); 2053 selectFilterMenu->setItemChecked( iii, checkitem );
2046 filter = fili.next(); 2054 filter = fili.next();
2047 ++iii; 2055 ++iii;
2048 } 2056 }
2049 if ( !checkitem ) 2057 if ( !checkitem )
2050 selectFilterMenu->setItemChecked( 1, true ); 2058 selectFilterMenu->setItemChecked( 1, true );
2051} 2059}
2052void MainWindow::fillFilterMenuPopup() 2060void MainWindow::fillFilterMenuPopup()
2053{ 2061{
2054 filterPopupMenu->clear(); 2062 filterPopupMenu->clear();
2055 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2063 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2056 2064
2057 filterPopupMenu->insertSeparator(); 2065 filterPopupMenu->insertSeparator();
2058 QPtrList<CalFilter> fili = mView->filters(); 2066 QPtrList<CalFilter> fili = mView->filters();
2059 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2067 CalFilter *curfilter = mView->filterView()->selectedFilter();
2060 CalFilter *filter = fili.first(); 2068 CalFilter *filter = fili.first();
2061 int iii = 1; 2069 int iii = 1;
2062 bool checkitem = mView->filterView()->filtersEnabled(); 2070 bool checkitem = mView->filterView()->filtersEnabled();
2063 while(filter) { 2071 while(filter) {
2064 filterPopupMenu->insertItem( filter->name(), iii ); 2072 filterPopupMenu->insertItem( filter->name(), iii );
2065 if ( filter == curfilter) 2073 if ( filter == curfilter)
2066 filterPopupMenu->setItemChecked( iii, checkitem ); 2074 filterPopupMenu->setItemChecked( iii, checkitem );
2067 filter = fili.next(); 2075 filter = fili.next();
2068 ++iii; 2076 ++iii;
2069 } 2077 }
2070 if ( !checkitem ) 2078 if ( !checkitem )
2071 filterPopupMenu->setItemChecked( 0, true ); 2079 filterPopupMenu->setItemChecked( 0, true );
2072} 2080}
2073void MainWindow::selectFilter( int fil ) 2081void MainWindow::selectFilter( int fil )
2074{ 2082{
2075 2083
2076 if ( fil == 0 ) { 2084 if ( fil == 0 ) {
2077 mView->editFilters( ); 2085 mView->editFilters( );
2078 } else if ( fil == 1 ){ 2086 } else if ( fil == 1 ){
2079 if ( mView->filterView()->filtersEnabled() ) 2087 if ( mView->filterView()->filtersEnabled() )
2080 mView->toggleFilerEnabled( ); 2088 mView->toggleFilerEnabled( );
2081 } else { 2089 } else {
2082 if ( !mView->filterView()->filtersEnabled() ) { 2090 if ( !mView->filterView()->filtersEnabled() ) {
2083 mView->filterView()->blockSignals( true ); 2091 mView->filterView()->blockSignals( true );
2084 mView->toggleFilerEnabled( ); 2092 mView->toggleFilerEnabled( );
2085 mView->filterView()->blockSignals( false ); 2093 mView->filterView()->blockSignals( false );
2086 } 2094 }
2087 mView->selectFilter( fil-2 ); 2095 mView->selectFilter( fil-2 );
2088 } 2096 }
2089} 2097}
2090void MainWindow::updateFilterToolbar() 2098void MainWindow::updateFilterToolbar()
2091{ 2099{
2092 if ( filterMenubar ) { 2100 if ( filterMenubar ) {
2093 if ( !mView->filterView()->filtersEnabled() ) { 2101 if ( !mView->filterView()->filtersEnabled() ) {
2094 filterMenubar->changeItem( 0, i18n("No Filter") ); 2102 filterMenubar->changeItem( 0, i18n("No Filter") );
2095 } else { 2103 } else {
2096 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2104 CalFilter *curfilter = mView->filterView()->selectedFilter();
2097 if ( curfilter ) { 2105 if ( curfilter ) {
2098 filterMenubar->changeItem( 0, curfilter->name() ); 2106 filterMenubar->changeItem( 0, curfilter->name() );
2099 } 2107 }
2100 } 2108 }
2101 } 2109 }
2102} 2110}
2103void MainWindow::selectFilterPopup( int fil ) 2111void MainWindow::selectFilterPopup( int fil )
2104{ 2112{
2105 selectFilter( fil + 1 ); 2113 selectFilter( fil + 1 );
2106 2114
2107} 2115}
2108void MainWindow::configureToolBar( int item ) 2116void MainWindow::configureToolBar( int item )
2109{ 2117{
2110 2118
2111 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2119 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2112 KOPrefs *p = KOPrefs::instance(); 2120 KOPrefs *p = KOPrefs::instance();
2113 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2121 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2114 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2122 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2115 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2123 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2116 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2124 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2117 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2125 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2118 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2126 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2119 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2127 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2120 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2128 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2121 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2129 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2122 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2130 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2123 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2131 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2124 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2132 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2125 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2133 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2126 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2134 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2127 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2135 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2128 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2136 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2129 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2137 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2130 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2138 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2131 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2139 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2132 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2140 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2133 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2141 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2134 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2142 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2135 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2143 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2136 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2144 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2137 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2145 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2138 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2146 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2139 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2147 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2140 // initActions(); 2148 // initActions();
2141} 2149}
2142void MainWindow::setCaption ( const QString & c ) 2150void MainWindow::setCaption ( const QString & c )
2143{ 2151{
2144 QString cap = c; 2152 QString cap = c;
2145 cap.replace( QRegExp("\n"), " " ); 2153 cap.replace( QRegExp("\n"), " " );
2146 cap = cap.stripWhiteSpace(); 2154 cap = cap.stripWhiteSpace();
2147 if ( cap.isEmpty() ) 2155 if ( cap.isEmpty() )
2148 cap = "KO/Pi"; 2156 cap = "KO/Pi";
2149 QWidget::setCaption( cap ); 2157 QWidget::setCaption( cap );
2150} 2158}
2151void MainWindow::setCaptionToDates() 2159void MainWindow::setCaptionToDates()
2152{ 2160{
2153 QString selDates; 2161 QString selDates;
2154 QDate date = mView->startDate(); 2162 QDate date = mView->startDate();
2155 if ( ! date.isValid() ) { 2163 if ( ! date.isValid() ) {
2156 setCaption(""); 2164 setCaption("");
2157 return; 2165 return;
2158 } 2166 }
2159 selDates = KGlobal::locale()->formatDate( date, true); 2167 selDates = KGlobal::locale()->formatDate( date, true);
2160 if (mView->startDate() < mView->endDate() ) 2168 if (mView->startDate() < mView->endDate() )
2161 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2169 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2162 else { 2170 else {
2163 QString addString; 2171 QString addString;
2164 if ( date == QDateTime::currentDateTime().date() ) 2172 if ( date == QDateTime::currentDateTime().date() )
2165 addString = i18n("Today"); 2173 addString = i18n("Today");
2166 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2174 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2167 addString = i18n("Tomorrow"); 2175 addString = i18n("Tomorrow");
2168 if ( !addString.isEmpty() ) 2176 if ( !addString.isEmpty() )
2169 selDates = addString+", "+selDates ; 2177 selDates = addString+", "+selDates ;
2170 } 2178 }
2171 setCaption( i18n("Dates: ") + selDates ); 2179 setCaption( i18n("Dates: ") + selDates );
2172 2180
2173} 2181}
2174void MainWindow::showConfigureAgenda( ) 2182void MainWindow::showConfigureAgenda( )
2175{ 2183{
2176 int iii; 2184 int iii;
2177 for ( iii = 1;iii<= 10 ;++iii ){ 2185 for ( iii = 1;iii<= 10 ;++iii ){
2178 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2186 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2179 } 2187 }
2180 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2188 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2181} 2189}
2182void MainWindow::configureAgenda( int item ) 2190void MainWindow::configureAgenda( int item )
2183{ 2191{
2184 if ( KOPrefs::instance()->mHourSize == item ) 2192 if ( KOPrefs::instance()->mHourSize == item )
2185 return; 2193 return;
2186 KOPrefs::instance()->mHourSize=item; 2194 KOPrefs::instance()->mHourSize=item;
2187 mView->viewManager()->agendaView()->updateConfig(); 2195 mView->viewManager()->agendaView()->updateConfig();
2188} 2196}
2189 2197
2190void MainWindow::saveCalendar() 2198void MainWindow::saveCalendar()
2191{ 2199{
2192 QString fn = KOPrefs::instance()->mLastSaveFile; 2200 QString fn = KOPrefs::instance()->mLastSaveFile;
2193 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2201 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2194 2202
2195 if ( fn == "" ) 2203 if ( fn == "" )
2196 return; 2204 return;
2197 QFileInfo info; 2205 QFileInfo info;
2198 info.setFile( fn ); 2206 info.setFile( fn );
2199 QString mes; 2207 QString mes;
2200 bool createbup = true; 2208 bool createbup = true;
2201 if ( info. exists() ) { 2209 if ( info. exists() ) {
2202 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2210 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2203 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2211 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2204 i18n("Overwrite!"), i18n("Cancel"), 0, 2212 i18n("Overwrite!"), i18n("Cancel"), 0,
2205 0, 1 ); 2213 0, 1 );
2206 if ( result != 0 ) { 2214 if ( result != 0 ) {
2207 createbup = false; 2215 createbup = false;
2208 } 2216 }
2209 } 2217 }
2210 if ( createbup ) { 2218 if ( createbup ) {
2211 mView->saveCalendar( fn ); 2219 mView->saveCalendar( fn );
2212 mes = i18n("KO/Pi:Saved %1").arg(fn); 2220 mes = i18n("KO/Pi:Saved %1").arg(fn);
2213 KOPrefs::instance()->mLastSaveFile = fn; 2221 KOPrefs::instance()->mLastSaveFile = fn;
2214 setCaption(mes); 2222 setCaption(mes);
2215 } 2223 }
2216} 2224}
2217void MainWindow::loadCalendar() 2225void MainWindow::loadCalendar()
2218{ 2226{
2219 2227
2220 QString fn = KOPrefs::instance()->mLastLoadFile; 2228 QString fn = KOPrefs::instance()->mLastLoadFile;
2221 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2229 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2222 2230
2223 if ( fn == "" ) 2231 if ( fn == "" )
2224 return; 2232 return;
2225 QFileInfo info; 2233 QFileInfo info;
2226 info.setFile( fn ); 2234 info.setFile( fn );
2227 QString mess; 2235 QString mess;
2228 bool loadbup = true; 2236 bool loadbup = true;
2229 if ( info. exists() ) { 2237 if ( info. exists() ) {
2230 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2238 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2231 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2239 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2232 mess, 2240 mess,
2233 i18n("Load!"), i18n("Cancel"), 0, 2241 i18n("Load!"), i18n("Cancel"), 0,
2234 0, 1 ); 2242 0, 1 );
2235 if ( result != 0 ) { 2243 if ( result != 0 ) {
2236 loadbup = false; 2244 loadbup = false;
2237 } 2245 }
2238 } else { 2246 } else {
2239 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2247 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2240 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2248 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2241 0, 1 ); 2249 0, 1 );
2242 2250
2243 return; 2251 return;
2244 } 2252 }
2245 if ( loadbup ) { 2253 if ( loadbup ) {
2246 mView->openCalendar( fn ); 2254 mView->openCalendar( fn );
2247 KOPrefs::instance()->mLastLoadFile = fn; 2255 KOPrefs::instance()->mLastLoadFile = fn;
2248 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2256 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2249 setCaption(mess); 2257 setCaption(mess);
2250 } 2258 }
2251 2259
2252} 2260}
2253void MainWindow::quickImportIcal() 2261void MainWindow::quickImportIcal()
2254{ 2262{
2255 importFile( KOPrefs::instance()->mLastImportFile, false ); 2263 importFile( KOPrefs::instance()->mLastImportFile, false );
2256} 2264}
2257void MainWindow::importFile( QString fn, bool quick ) 2265void MainWindow::importFile( QString fn, bool quick )
2258{ 2266{
2259 QFileInfo info; 2267 QFileInfo info;
2260 info.setFile( fn ); 2268 info.setFile( fn );
2261 QString mess; 2269 QString mess;
2262 bool loadbup = true; 2270 bool loadbup = true;
2263 if ( !info. exists() ) { 2271 if ( !info. exists() ) {
2264 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2272 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2265 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2273 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2266 mess ); 2274 mess );
2267 return; 2275 return;
2268 } 2276 }
2269 int result = 0; 2277 int result = 0;
2270 if ( !quick ) { 2278 if ( !quick ) {
2271 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2279 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2272 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2280 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2273 mess, 2281 mess,
2274 "Import", "Cancel", 0, 2282 "Import", "Cancel", 0,
2275 0, 1 ); 2283 0, 1 );
2276 } 2284 }
2277 if ( result == 0 ) { 2285 if ( result == 0 ) {
2278 if ( mView->openCalendar( fn, true )) { 2286 if ( mView->openCalendar( fn, true )) {
2279 KOPrefs::instance()->mLastImportFile = fn; 2287 KOPrefs::instance()->mLastImportFile = fn;
2280 setCaption(i18n("Imported file successfully")); 2288 setCaption(i18n("Imported file successfully"));
2281 } else { 2289 } else {
2282 setCaption(i18n("Error importing file")); 2290 setCaption(i18n("Error importing file"));
2283 } 2291 }
2284 } 2292 }
2285} 2293}
2286 2294
2287void MainWindow::importIcal() 2295void MainWindow::importIcal()
2288{ 2296{
2289 2297
2290 QString fn =KOPrefs::instance()->mLastImportFile; 2298 QString fn =KOPrefs::instance()->mLastImportFile;
2291 2299
2292 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2300 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2293 if ( fn == "" ) 2301 if ( fn == "" )
2294 return; 2302 return;
2295 importFile( fn, true ); 2303 importFile( fn, true );
2296 2304
2297} 2305}
2298 2306
2299void MainWindow::exportVCalendar() 2307void MainWindow::exportVCalendar()
2300{ 2308{
2301 QString fn = KOPrefs::instance()->mLastVcalFile; 2309 QString fn = KOPrefs::instance()->mLastVcalFile;
2302 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2310 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2303 if ( fn == "" ) 2311 if ( fn == "" )
2304 return; 2312 return;
2305 QFileInfo info; 2313 QFileInfo info;
2306 info.setFile( fn ); 2314 info.setFile( fn );
2307 QString mes; 2315 QString mes;
2308 bool createbup = true; 2316 bool createbup = true;
2309 if ( info. exists() ) { 2317 if ( info. exists() ) {
2310 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2318 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2311 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2319 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2312 i18n("Overwrite!"), i18n("Cancel"), 0, 2320 i18n("Overwrite!"), i18n("Cancel"), 0,
2313 0, 1 ); 2321 0, 1 );
2314 if ( result != 0 ) { 2322 if ( result != 0 ) {
2315 createbup = false; 2323 createbup = false;
2316 } 2324 }
2317 } 2325 }
2318 if ( createbup ) { 2326 if ( createbup ) {
2319 if ( mView->exportVCalendar( fn ) ) { 2327 if ( mView->exportVCalendar( fn ) ) {
2320 KOPrefs::instance()->mLastVcalFile = fn; 2328 KOPrefs::instance()->mLastVcalFile = fn;
2321 if ( fn.length() > 20 ) 2329 if ( fn.length() > 20 )
2322 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2330 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2323 else 2331 else
2324 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2332 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2325 setCaption(mes); 2333 setCaption(mes);
2326 } 2334 }
2327 } 2335 }
2328 2336
2329} 2337}
2330QString MainWindow::sentSyncFile() 2338QString MainWindow::sentSyncFile()
2331{ 2339{
2332#ifdef DESKTOP_VERSION 2340#ifdef DESKTOP_VERSION
2333 return locateLocal( "tmp", "copysynccal.ics" ); 2341 return locateLocal( "tmp", "copysynccal.ics" );
2334#else 2342#else
2335 return QString( "/tmp/copysynccal.ics" ); 2343 return QString( "/tmp/copysynccal.ics" );
2336#endif 2344#endif
2337} 2345}
2338 2346
2339void MainWindow::syncFileRequest() 2347void MainWindow::syncFileRequest()
2340{ 2348{
2341 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2349 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2342 mSyncManager->slotSyncMenu( 999 ); 2350 mSyncManager->slotSyncMenu( 999 );
2343 } 2351 }
2344 2352
2345 setCaption(i18n("Saving Data to temp file ..." )); 2353 setCaption(i18n("Saving Data to temp file ..." ));
2346 mView->saveCalendar( sentSyncFile() ); 2354 mView->saveCalendar( sentSyncFile() );
2347 setCaption(i18n("Data saved to temp file!" )); 2355 setCaption(i18n("Data saved to temp file!" ));
2348 2356
2349} 2357}
2350void MainWindow::getFile( bool success ) 2358void MainWindow::getFile( bool success )
2351{ 2359{
2352 if ( ! success ) { 2360 if ( ! success ) {
2353 setCaption( i18n("Error receiving file. Nothing changed!") ); 2361 setCaption( i18n("Error receiving file. Nothing changed!") );
2354 return; 2362 return;
2355 } 2363 }
2356 mView->openCalendar( sentSyncFile() ); 2364 mView->openCalendar( sentSyncFile() );
2357 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2365 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2358 mSyncManager->slotSyncMenu( 999 ); 2366 mSyncManager->slotSyncMenu( 999 );
2359 } 2367 }
2360 setCaption( i18n("Pi-Sync successful!") ); 2368 setCaption( i18n("Pi-Sync successful!") );
2361} 2369}
2362 2370
2363void MainWindow::printSel( ) 2371void MainWindow::printSel( )
2364{ 2372{
2365 mView->viewManager()->agendaView()->agenda()->printSelection(); 2373 mView->viewManager()->agendaView()->agenda()->printSelection();
2366} 2374}
2367 2375
2368void MainWindow::printCal() 2376void MainWindow::printCal()
2369{ 2377{
2370 mView->print();//mCp->showDialog(); 2378 mView->print();//mCp->showDialog();
2371} 2379}
2372 2380
2373 2381
2374#include "libkdepim/kdatepicker.h" 2382#include "libkdepim/kdatepicker.h"
2375#include <kdatetbl.h> 2383#include <kdatetbl.h>
2376 2384
2377void MainWindow::weekAction() 2385void MainWindow::weekAction()
2378{ 2386{
2379 int month; 2387 int month;
2380 KPopupFrame* popup = new KPopupFrame(this); 2388 KPopupFrame* popup = new KPopupFrame(this);
2381 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2389 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2382 // ----- 2390 // -----
2383 picker->resize(picker->sizeHint()); 2391 picker->resize(picker->sizeHint());
2384 popup->setMainWidget(picker); 2392 popup->setMainWidget(picker);
2385 picker->setFocus(); 2393 picker->setFocus();
2386 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2394 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2387 int x = 0; 2395 int x = 0;
2388 int y = iconToolBar->height(); 2396 int y = iconToolBar->height();
2389 int dX = 0; 2397 int dX = 0;
2390 int dY = 0; 2398 int dY = 0;
2391 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2399 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2392 if ( iconToolBar->y() > height()/2 ) { 2400 if ( iconToolBar->y() > height()/2 ) {
2393 dY = picker->sizeHint().height()+8; 2401 dY = picker->sizeHint().height()+8;
2394 y = 0; 2402 y = 0;
2395 } 2403 }
2396 } else { 2404 } else {
2397 if ( iconToolBar->x() > width()/2 ) { // right side 2405 if ( iconToolBar->x() > width()/2 ) { // right side
2398 x=0; 2406 x=0;
2399 dX= picker->sizeHint().width()+8; 2407 dX= picker->sizeHint().width()+8;
2400 y = 0; 2408 y = 0;
2401 } else { 2409 } else {
2402 x= iconToolBar->width(); 2410 x= iconToolBar->width();
2403 y = 0; 2411 y = 0;
2404 } 2412 }
2405 } 2413 }
2406 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2414 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2407 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2415 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2408 { 2416 {
2409 month = picker->getResult(); 2417 month = picker->getResult();
2410 emit selectWeek ( month ); 2418 emit selectWeek ( month );
2411 //qDebug("weekSelected %d ", month); 2419 //qDebug("weekSelected %d ", month);
2412 } 2420 }
2413 delete popup; 2421 delete popup;
2414} 2422}
2415 2423
2416void MainWindow::hideEvent ( QHideEvent * ) 2424void MainWindow::hideEvent ( QHideEvent * )
2417{ 2425{
2418 QString message; 2426 QString message;
2419 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2427 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2420 if ( nextA.isValid() ) { 2428 if ( nextA.isValid() ) {
2421 QString sum = mCalendar->nextSummary(); 2429 QString sum = mCalendar->nextSummary();
2422 2430
2423 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2431 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2424 setCaption( message ); 2432 setCaption( message );
2425 } 2433 }
2426} 2434}
2427 2435
2428void MainWindow::resizeEvent( QResizeEvent* e) 2436void MainWindow::resizeEvent( QResizeEvent* e)
2429{ 2437{
2430#ifndef DESKTOP_VERSION 2438#ifndef DESKTOP_VERSION
2431 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) { 2439 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) {
2432 if (QApplication::desktop()->width() > QApplication::desktop()->height() ) 2440 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2433 filterToolBar->hide(); 2441 filterToolBar->hide();
2434 else 2442 else
2435 filterToolBar->show(); 2443 filterToolBar->show();
2436 } 2444 }
2437#endif 2445#endif
2438 QMainWindow::resizeEvent( e); 2446 QMainWindow::resizeEvent( e);
2439} 2447}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 4d1753f..3151f50 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,173 +1,174 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 14#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 24#define QPEMenuBar QMenuBar
25#endif 25#endif
26class QPEToolBar; 26class QPEToolBar;
27class QPEMenuBar; 27class QPEMenuBar;
28 28
29 29
30namespace KCal { 30namespace KCal {
31class CalendarLocal; 31class CalendarLocal;
32} 32}
33 33
34class KOMenuBar : public QMenuBar 34class KOMenuBar : public QMenuBar
35{ 35{
36 public: 36 public:
37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} 37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} 38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
39}; 39};
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43class MainWindow : public QMainWindow 43class MainWindow : public QMainWindow
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 public: 46 public:
47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
48 ~MainWindow(); 48 ~MainWindow();
49 bool beamReceiveEnabled(); 49 bool beamReceiveEnabled();
50 static QString defaultFileName(); 50 static QString defaultFileName();
51 static QString syncFileName(); 51 static QString syncFileName();
52 static QString resourcePath(); 52 static QString resourcePath();
53 public slots: 53 public slots:
54 void setCaption ( const QString & ); 54 void setCaption ( const QString & );
55 void updateWeekNum(const KCal::DateList &); 55 void updateWeekNum(const KCal::DateList &);
56 void updateWeek(QDate); 56 void updateWeek(QDate);
57 void updateFilterToolbar(); 57 void updateFilterToolbar();
58 virtual void showMaximized (); 58 virtual void showMaximized ();
59 void configureAgenda( int ); 59 void configureAgenda( int );
60 void recieve( const QCString& msg, const QByteArray& data ); 60 void recieve( const QCString& msg, const QByteArray& data );
61 protected slots: 61 protected slots:
62 void setCaptionToDates(); 62 void setCaptionToDates();
63 void weekAction(); 63 void weekAction();
64 void about(); 64 void about();
65 void licence(); 65 void licence();
66 void faq(); 66 void faq();
67 void usertrans(); 67 void usertrans();
68 void features(); 68 void features();
69 void synchowto(); 69 void synchowto();
70 void storagehowto();
70 void kdesynchowto(); 71 void kdesynchowto();
71 void multisynchowto(); 72 void multisynchowto();
72 void whatsNew(); 73 void whatsNew();
73 void keyBindings(); 74 void keyBindings();
74 void aboutAutoSaving();; 75 void aboutAutoSaving();;
75 void aboutKnownBugs(); 76 void aboutKnownBugs();
76 77
77 void processIncidenceSelection( Incidence * ); 78 void processIncidenceSelection( Incidence * );
78 79
79 void importQtopia(); 80 void importQtopia();
80 void importBday(); 81 void importBday();
81 void importOL(); 82 void importOL();
82 void importIcal(); 83 void importIcal();
83 void importFile( QString, bool ); 84 void importFile( QString, bool );
84 void quickImportIcal(); 85 void quickImportIcal();
85 86
86 void slotModifiedChanged( bool ); 87 void slotModifiedChanged( bool );
87 88
88 void save(); 89 void save();
89 void saveStopTimer(); 90 void saveStopTimer();
90 void configureToolBar( int ); 91 void configureToolBar( int );
91 void printSel(); 92 void printSel();
92 void printCal(); 93 void printCal();
93 void saveCalendar(); 94 void saveCalendar();
94 void loadCalendar(); 95 void loadCalendar();
95 void exportVCalendar(); 96 void exportVCalendar();
96 void fillFilterMenu(); 97 void fillFilterMenu();
97 void fillFilterMenuTB(); 98 void fillFilterMenuTB();
98 void selectFilter( int ); 99 void selectFilter( int );
99 void fillFilterMenuPopup(); 100 void fillFilterMenuPopup();
100 void selectFilterPopup( int ); 101 void selectFilterPopup( int );
101 void exportToPhone( int ); 102 void exportToPhone( int );
102 void toggleBeamReceive(); 103 void toggleBeamReceive();
103 void disableBR(bool); 104 void disableBR(bool);
104 signals: 105 signals:
105 void selectWeek ( int ); 106 void selectWeek ( int );
106 private slots: 107 private slots:
107 void showConfigureAgenda(); 108 void showConfigureAgenda();
108 void getFile( bool ); 109 void getFile( bool );
109 void syncFileRequest(); 110 void syncFileRequest();
110 111
111 protected: 112 protected:
112 void hideEvent ( QHideEvent * ); 113 void hideEvent ( QHideEvent * );
113 QString sentSyncFile(); 114 QString sentSyncFile();
114 void displayText( QString, QString); 115 void displayText( QString, QString);
115 void enableIncidenceActions( bool ); 116 void enableIncidenceActions( bool );
116 117
117 private: 118 private:
118 bool mBRdisabled; 119 bool mBRdisabled;
119#ifndef DESKTOP_VERSION 120#ifndef DESKTOP_VERSION
120 QCopChannel* infrared; 121 QCopChannel* infrared;
121#endif 122#endif
122 QAction* brAction; 123 QAction* brAction;
123 KSyncManager* mSyncManager; 124 KSyncManager* mSyncManager;
124 bool mClosed; 125 bool mClosed;
125 void saveOnClose(); 126 void saveOnClose();
126 bool mFlagKeyPressed; 127 bool mFlagKeyPressed;
127 bool mBlockAtStartup; 128 bool mBlockAtStartup;
128 QPEToolBar *iconToolBar; 129 QPEToolBar *iconToolBar;
129 QPEToolBar *viewToolBar; 130 QPEToolBar *viewToolBar;
130 QPEToolBar *navigatorToolBar; 131 QPEToolBar *navigatorToolBar;
131 QPEToolBar *filterToolBar; 132 QPEToolBar *filterToolBar;
132 QPEMenuBar *filterMenubar; 133 QPEMenuBar *filterMenubar;
133 QPopupMenu * filterPopupMenu; 134 QPopupMenu * filterPopupMenu;
134 void initActions(); 135 void initActions();
135 void setDefaultPreferences(); 136 void setDefaultPreferences();
136 void resizeEvent( QResizeEvent* e); 137 void resizeEvent( QResizeEvent* e);
137 void keyPressEvent ( QKeyEvent * ) ; 138 void keyPressEvent ( QKeyEvent * ) ;
138 void keyReleaseEvent ( QKeyEvent * ) ; 139 void keyReleaseEvent ( QKeyEvent * ) ;
139 QPopupMenu *configureToolBarMenu; 140 QPopupMenu *configureToolBarMenu;
140 QPopupMenu *selectFilterMenu; 141 QPopupMenu *selectFilterMenu;
141 QPopupMenu *selectFilterMenuTB; 142 QPopupMenu *selectFilterMenuTB;
142 QPopupMenu *configureAgendaMenu, *syncMenu; 143 QPopupMenu *configureAgendaMenu, *syncMenu;
143 CalendarLocal *mCalendar; 144 CalendarLocal *mCalendar;
144 CalendarView *mView; 145 CalendarView *mView;
145 QAction *mNewSubTodoAction; 146 QAction *mNewSubTodoAction;
146 QAction *mWeekAction; 147 QAction *mWeekAction;
147 QFont mWeekFont; 148 QFont mWeekFont;
148 QPixmap mWeekPixmap; 149 QPixmap mWeekPixmap;
149 QColor mWeekBgColor; 150 QColor mWeekBgColor;
150 151
151 QAction *mShowAction; 152 QAction *mShowAction;
152 QAction *mEditAction; 153 QAction *mEditAction;
153 QAction *mDeleteAction; 154 QAction *mDeleteAction;
154 QAction *mCloneAction; 155 QAction *mCloneAction;
155 QAction *mMoveAction; 156 QAction *mMoveAction;
156 QAction *mBeamAction; 157 QAction *mBeamAction;
157 QAction *mCancelAction; 158 QAction *mCancelAction;
158 159
159 QAction *mToggleNav; 160 QAction *mToggleNav;
160 QAction *mToggleFilter; 161 QAction *mToggleFilter;
161 QAction *mToggleAllday; 162 QAction *mToggleAllday;
162 QAction *actionFilterMenuTB; 163 QAction *actionFilterMenuTB;
163 164
164 void closeEvent( QCloseEvent* ce ); 165 void closeEvent( QCloseEvent* ce );
165 SimpleAlarmClient mAlarmClient; 166 SimpleAlarmClient mAlarmClient;
166 QTimer mSaveTimer; 167 QTimer mSaveTimer;
167 //bool mBlockSaveFlag; 168 //bool mBlockSaveFlag;
168 bool mCalendarModifiedFlag; 169 bool mCalendarModifiedFlag;
169 QPixmap loadPixmap( QString ); 170 QPixmap loadPixmap( QString );
170}; 171};
171 172
172 173
173#endif 174#endif
diff --git a/version b/version
index 662668e..f601af0 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "2.0.23"; version = "2.0.24";