summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-18 09:08:13 (UTC)
committer zautrix <zautrix>2004-10-18 09:08:13 (UTC)
commit56990d318b15eacf7d3cc7425ab62f68da099ddf (patch) (unidiff)
treeb2f021bd75bc6a08fa8fc51a07ce1755b8e4a95e
parent1712d92ea25b220273859d985bc7211fa7a97a39 (diff)
downloadkdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.zip
kdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.tar.gz
kdepimpi-56990d318b15eacf7d3cc7425ab62f68da099ddf.tar.bz2
fix of tmp file path for desktop version
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp57
-rw-r--r--kmicromail/viewmail.cpp4
-rw-r--r--korganizer/calendarview.cpp5
-rw-r--r--korganizer/koprefs.cpp6
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--libkcal/phoneformat.cpp4
-rw-r--r--version2
7 files changed, 22 insertions, 60 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 2e408b7..11eeabc 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -583,329 +583,290 @@ void KABCore::sendMail()
583{ 583{
584 sendMail( mViewManager->selectedEmails().join( ", " ) ); 584 sendMail( mViewManager->selectedEmails().join( ", " ) );
585} 585}
586 586
587void KABCore::sendMail( const QString& emaillist ) 587void KABCore::sendMail( const QString& emaillist )
588{ 588{
589 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 589 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
590 if (emaillist.contains(",") > 0) 590 if (emaillist.contains(",") > 0)
591 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 591 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
592 else 592 else
593 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 593 ExternalAppHandler::instance()->mailToOneContact( emaillist );
594} 594}
595 595
596 596
597 597
598void KABCore::mailVCard() 598void KABCore::mailVCard()
599{ 599{
600 QStringList uids = mViewManager->selectedUids(); 600 QStringList uids = mViewManager->selectedUids();
601 if ( !uids.isEmpty() ) 601 if ( !uids.isEmpty() )
602 mailVCard( uids ); 602 mailVCard( uids );
603} 603}
604 604
605void KABCore::mailVCard( const QStringList& uids ) 605void KABCore::mailVCard( const QStringList& uids )
606{ 606{
607 QStringList urls; 607 QStringList urls;
608 608
609// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 609// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
610 610
611 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 611 QString dirName = "/tmp/" + KApplication::randomString( 8 );
612 612
613 613
614 614
615 QDir().mkdir( dirName, true ); 615 QDir().mkdir( dirName, true );
616 616
617 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 617 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
618 KABC::Addressee a = mAddressBook->findByUid( *it ); 618 KABC::Addressee a = mAddressBook->findByUid( *it );
619 619
620 if ( a.isEmpty() ) 620 if ( a.isEmpty() )
621 continue; 621 continue;
622 622
623 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 623 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
624 624
625 QString fileName = dirName + "/" + name; 625 QString fileName = dirName + "/" + name;
626 626
627 QFile outFile(fileName); 627 QFile outFile(fileName);
628 628
629 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 629 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
630 KABC::VCardConverter converter; 630 KABC::VCardConverter converter;
631 QString vcard; 631 QString vcard;
632 632
633 converter.addresseeToVCard( a, vcard ); 633 converter.addresseeToVCard( a, vcard );
634 634
635 QTextStream t( &outFile ); // use a text stream 635 QTextStream t( &outFile ); // use a text stream
636 t.setEncoding( QTextStream::UnicodeUTF8 ); 636 t.setEncoding( QTextStream::UnicodeUTF8 );
637 t << vcard; 637 t << vcard;
638 638
639 outFile.close(); 639 outFile.close();
640 640
641 urls.append( fileName ); 641 urls.append( fileName );
642 } 642 }
643 } 643 }
644 644
645 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 645 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
646 646
647 647
648/*US 648/*US
649 kapp->invokeMailer( QString::null, QString::null, QString::null, 649 kapp->invokeMailer( QString::null, QString::null, QString::null,
650 QString::null, // subject 650 QString::null, // subject
651 QString::null, // body 651 QString::null, // body
652 QString::null, 652 QString::null,
653 urls ); // attachments 653 urls ); // attachments
654*/ 654*/
655 655
656} 656}
657 657
658/** 658/**
659 Beams the "WhoAmI contact. 659 Beams the "WhoAmI contact.
660*/ 660*/
661void KABCore::beamMySelf() 661void KABCore::beamMySelf()
662{ 662{
663 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 663 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
664 if (!a.isEmpty()) 664 if (!a.isEmpty())
665 { 665 {
666 QStringList uids; 666 QStringList uids;
667 uids << a.uid(); 667 uids << a.uid();
668 668
669 beamVCard(uids); 669 beamVCard(uids);
670 } else { 670 } else {
671 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 671 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
672 672
673 673
674 } 674 }
675} 675}
676 676
677void KABCore::export2phone() 677void KABCore::export2phone()
678{ 678{
679 679
680 KAex2phonePrefs ex2phone; 680 KAex2phonePrefs ex2phone;
681 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 681 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
682 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 682 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
683 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 683 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
684 684
685 if ( !ex2phone.exec() ) { 685 if ( !ex2phone.exec() ) {
686 return; 686 return;
687 } 687 }
688 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 688 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
689 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 689 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
690 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 690 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
691 691
692 692
693 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 693 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
694 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 694 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
695 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 695 KPimGlobalPrefs::instance()->mEx2PhoneModel );
696 696
697 QStringList uids = mViewManager->selectedUids(); 697 QStringList uids = mViewManager->selectedUids();
698 if ( uids.isEmpty() ) 698 if ( uids.isEmpty() )
699 return; 699 return;
700 700
701 QString fileName = getPhoneFile(); 701 QString fileName = getPhoneFile();
702 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 702 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
703 return; 703 return;
704 704
705 message(i18n("Exporting to phone...")); 705 message(i18n("Exporting to phone..."));
706 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 706 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
707 707
708} 708}
709QString KABCore::getPhoneFile() 709QString KABCore::getPhoneFile()
710{ 710{
711#ifdef _WIN32_ 711#ifdef DESKTOP_VERSION
712 return locateLocal("tmp", "phonefile.vcf"); 712 return locateLocal("tmp", "phonefile.vcf");
713#else 713#else
714 return "/tmp/phonefile.vcf"; 714 return "/tmp/phonefile.vcf";
715#endif 715#endif
716 716
717} 717}
718void KABCore::writeToPhone( ) 718void KABCore::writeToPhone( )
719{ 719{
720 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 720 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
721 message(i18n("Export to phone finished!")); 721 message(i18n("Export to phone finished!"));
722 else 722 else
723 qDebug(i18n("Error exporting to phone")); 723 qDebug(i18n("Error exporting to phone"));
724} 724}
725void KABCore::beamVCard() 725void KABCore::beamVCard()
726{ 726{
727 QStringList uids = mViewManager->selectedUids(); 727 QStringList uids = mViewManager->selectedUids();
728 if ( !uids.isEmpty() ) 728 if ( !uids.isEmpty() )
729 beamVCard( uids ); 729 beamVCard( uids );
730} 730}
731 731
732 732
733void KABCore::beamVCard(const QStringList& uids) 733void KABCore::beamVCard(const QStringList& uids)
734{ 734{
735/*US
736 QString beamFilename;
737 Opie::OPimContact c;
738 if ( actionPersonal->isOn() ) {
739 beamFilename = addressbookPersonalVCardName();
740 if ( !QFile::exists( beamFilename ) )
741 return; // can't beam a non-existent file
742 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
743 beamFilename );
744 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
745 Opie::OPimContactAccess::List allList = access->allRecords();
746 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
747 c = *it;
748
749 delete access;
750 } else {
751 unlink( beamfile ); // delete if exists
752 mkdir("/tmp/obex/", 0755);
753 c = m_abView -> currentEntry();
754 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
755 beamfile );
756 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
757 access->add( c );
758 access->save();
759 delete access;
760
761 beamFilename = beamfile;
762 }
763
764 owarn << "Beaming: " << beamFilename << oendl;
765*/
766
767#if 0
768 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
769
770 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
771
772 QString name = "contact.vcf";
773 735
774 QString fileName = dirName + "/" + name; 736 // LR: we should use the /tmp dir on the Zaurus,
775#endif 737 // because: /tmp = RAM, (HOME)/kdepim = flash memory
776 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 738
777 // 739#ifdef DESKTOP_VERSION
740 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
741#else
778 QString fileName = "/tmp/kapibeamfile.vcf"; 742 QString fileName = "/tmp/kapibeamfile.vcf";
743#endif
779 744
780
781 //QDir().mkdir( dirName, true );
782
783
784 KABC::VCardConverter converter; 745 KABC::VCardConverter converter;
785 QString description; 746 QString description;
786 QString datastream; 747 QString datastream;
787 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 748 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
788 KABC::Addressee a = mAddressBook->findByUid( *it ); 749 KABC::Addressee a = mAddressBook->findByUid( *it );
789 750
790 if ( a.isEmpty() ) 751 if ( a.isEmpty() )
791 continue; 752 continue;
792 753
793 if (description.isEmpty()) 754 if (description.isEmpty())
794 description = a.formattedName(); 755 description = a.formattedName();
795 756
796 QString vcard; 757 QString vcard;
797 converter.addresseeToVCard( a, vcard ); 758 converter.addresseeToVCard( a, vcard );
798 int start = 0; 759 int start = 0;
799 int next; 760 int next;
800 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 761 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
801 int semi = vcard.find(";", next); 762 int semi = vcard.find(";", next);
802 int dopp = vcard.find(":", next); 763 int dopp = vcard.find(":", next);
803 int sep; 764 int sep;
804 if ( semi < dopp && semi >= 0 ) 765 if ( semi < dopp && semi >= 0 )
805 sep = semi ; 766 sep = semi ;
806 else 767 else
807 sep = dopp; 768 sep = dopp;
808 datastream +=vcard.mid( start, next - start); 769 datastream +=vcard.mid( start, next - start);
809 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 770 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
810 start = sep; 771 start = sep;
811 } 772 }
812 datastream += vcard.mid( start,vcard.length() ); 773 datastream += vcard.mid( start,vcard.length() );
813 } 774 }
814#ifndef DESKTOP_VERSION 775#ifndef DESKTOP_VERSION
815 QFile outFile(fileName); 776 QFile outFile(fileName);
816 if ( outFile.open(IO_WriteOnly) ) { 777 if ( outFile.open(IO_WriteOnly) ) {
817 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 778 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
818 QTextStream t( &outFile ); // use a text stream 779 QTextStream t( &outFile ); // use a text stream
819 //t.setEncoding( QTextStream::UnicodeUTF8 ); 780 //t.setEncoding( QTextStream::UnicodeUTF8 );
820 t.setEncoding( QTextStream::Latin1 ); 781 t.setEncoding( QTextStream::Latin1 );
821 t <<datastream.latin1(); 782 t <<datastream.latin1();
822 outFile.close(); 783 outFile.close();
823 Ir *ir = new Ir( this ); 784 Ir *ir = new Ir( this );
824 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 785 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
825 ir->send( fileName, description, "text/x-vCard" ); 786 ir->send( fileName, description, "text/x-vCard" );
826 } else { 787 } else {
827 qDebug("Error open temp beam file "); 788 qDebug("Error open temp beam file ");
828 return; 789 return;
829 } 790 }
830#endif 791#endif
831 792
832} 793}
833 794
834void KABCore::beamDone( Ir *ir ) 795void KABCore::beamDone( Ir *ir )
835{ 796{
836#ifndef DESKTOP_VERSION 797#ifndef DESKTOP_VERSION
837 delete ir; 798 delete ir;
838#endif 799#endif
839 topLevelWidget()->raise(); 800 topLevelWidget()->raise();
840 message( i18n("Beaming finished!") ); 801 message( i18n("Beaming finished!") );
841} 802}
842 803
843 804
844void KABCore::browse( const QString& url ) 805void KABCore::browse( const QString& url )
845{ 806{
846#ifndef KAB_EMBEDDED 807#ifndef KAB_EMBEDDED
847 kapp->invokeBrowser( url ); 808 kapp->invokeBrowser( url );
848#else //KAB_EMBEDDED 809#else //KAB_EMBEDDED
849 qDebug("KABCore::browse must be fixed"); 810 qDebug("KABCore::browse must be fixed");
850#endif //KAB_EMBEDDED 811#endif //KAB_EMBEDDED
851} 812}
852 813
853void KABCore::selectAllContacts() 814void KABCore::selectAllContacts()
854{ 815{
855 mViewManager->setSelected( QString::null, true ); 816 mViewManager->setSelected( QString::null, true );
856} 817}
857 818
858void KABCore::deleteContacts() 819void KABCore::deleteContacts()
859{ 820{
860 QStringList uidList = mViewManager->selectedUids(); 821 QStringList uidList = mViewManager->selectedUids();
861 deleteContacts( uidList ); 822 deleteContacts( uidList );
862} 823}
863 824
864void KABCore::deleteContacts( const QStringList &uids ) 825void KABCore::deleteContacts( const QStringList &uids )
865{ 826{
866 if ( uids.count() > 0 ) { 827 if ( uids.count() > 0 ) {
867 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 828 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
868 UndoStack::instance()->push( command ); 829 UndoStack::instance()->push( command );
869 RedoStack::instance()->clear(); 830 RedoStack::instance()->clear();
870 831
871 // now if we deleted anything, refresh 832 // now if we deleted anything, refresh
872 setContactSelected( QString::null ); 833 setContactSelected( QString::null );
873 setModified( true ); 834 setModified( true );
874 } 835 }
875} 836}
876 837
877void KABCore::copyContacts() 838void KABCore::copyContacts()
878{ 839{
879 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 840 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
880 841
881 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 842 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
882 843
883 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 844 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
884 845
885 QClipboard *cb = QApplication::clipboard(); 846 QClipboard *cb = QApplication::clipboard();
886 cb->setText( clipText ); 847 cb->setText( clipText );
887} 848}
888 849
889void KABCore::cutContacts() 850void KABCore::cutContacts()
890{ 851{
891 QStringList uidList = mViewManager->selectedUids(); 852 QStringList uidList = mViewManager->selectedUids();
892 853
893//US if ( uidList.size() > 0 ) { 854//US if ( uidList.size() > 0 ) {
894 if ( uidList.count() > 0 ) { 855 if ( uidList.count() > 0 ) {
895 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 856 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
896 UndoStack::instance()->push( command ); 857 UndoStack::instance()->push( command );
897 RedoStack::instance()->clear(); 858 RedoStack::instance()->clear();
898 859
899 setModified( true ); 860 setModified( true );
900 } 861 }
901} 862}
902 863
903void KABCore::pasteContacts() 864void KABCore::pasteContacts()
904{ 865{
905 QClipboard *cb = QApplication::clipboard(); 866 QClipboard *cb = QApplication::clipboard();
906 867
907 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 868 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
908 869
909 pasteContacts( list ); 870 pasteContacts( list );
910} 871}
911 872
@@ -2737,140 +2698,140 @@ bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2737 bool isXML = false; 2698 bool isXML = false;
2738 if ( filename.right(4) == ".xml") { 2699 if ( filename.right(4) == ".xml") {
2739 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2700 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2740 isXML = true; 2701 isXML = true;
2741 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2702 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2742 } else { 2703 } else {
2743 external = !manager->mIsKapiFile; 2704 external = !manager->mIsKapiFile;
2744 if ( external ) { 2705 if ( external ) {
2745 qDebug("Setting vcf mode to external "); 2706 qDebug("Setting vcf mode to external ");
2746 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2707 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2747 AddressBook::Iterator it; 2708 AddressBook::Iterator it;
2748 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2709 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2749 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2710 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2750 (*it).computeCsum( mCurrentSyncDevice ); 2711 (*it).computeCsum( mCurrentSyncDevice );
2751 } 2712 }
2752 } 2713 }
2753 } 2714 }
2754 //AddressBook::Iterator it; 2715 //AddressBook::Iterator it;
2755 //QStringList vcards; 2716 //QStringList vcards;
2756 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2717 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2757 // qDebug("Name %s ", (*it).familyName().latin1()); 2718 // qDebug("Name %s ", (*it).familyName().latin1());
2758 //} 2719 //}
2759 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2720 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2760 if ( syncOK ) { 2721 if ( syncOK ) {
2761 if ( syncManager->mWriteBackFile ) 2722 if ( syncManager->mWriteBackFile )
2762 { 2723 {
2763 if ( external ) 2724 if ( external )
2764 abLocal.removeSyncAddressees( !isXML); 2725 abLocal.removeSyncAddressees( !isXML);
2765 qDebug("Saving remote AB "); 2726 qDebug("Saving remote AB ");
2766 if ( ! abLocal.saveAB()) 2727 if ( ! abLocal.saveAB())
2767 qDebug("Error writing back AB to file "); 2728 qDebug("Error writing back AB to file ");
2768 if ( isXML ) { 2729 if ( isXML ) {
2769 // afterwrite processing 2730 // afterwrite processing
2770 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2731 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2771 } 2732 }
2772 } 2733 }
2773 } 2734 }
2774 setModified(); 2735 setModified();
2775 2736
2776 } 2737 }
2777 if ( syncOK ) 2738 if ( syncOK )
2778 mViewManager->refreshView(); 2739 mViewManager->refreshView();
2779 return syncOK; 2740 return syncOK;
2780 2741
2781} 2742}
2782 2743
2783 2744
2784//this is a overwritten callbackmethods from the syncinterface 2745//this is a overwritten callbackmethods from the syncinterface
2785bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2746bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2786{ 2747{
2787 if ( resource == "phone" ) 2748 if ( resource == "phone" )
2788 return syncPhone(); 2749 return syncPhone();
2789 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2750 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2790 2751
2791 AddressBook abLocal( resource,"syncContact"); 2752 AddressBook abLocal( resource,"syncContact");
2792 bool syncOK = false; 2753 bool syncOK = false;
2793 if ( abLocal.load() ) { 2754 if ( abLocal.load() ) {
2794 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2755 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2795 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2756 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2796 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 2757 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
2797 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2758 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2798 if ( syncOK ) { 2759 if ( syncOK ) {
2799 if ( syncManager->mWriteBackFile ) { 2760 if ( syncManager->mWriteBackFile ) {
2800 abLocal.removeSyncAddressees( false ); 2761 abLocal.removeSyncAddressees( false );
2801 abLocal.saveAB(); 2762 abLocal.saveAB();
2802 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2763 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2803 } 2764 }
2804 } 2765 }
2805 setModified(); 2766 setModified();
2806 } 2767 }
2807 if ( syncOK ) 2768 if ( syncOK )
2808 mViewManager->refreshView(); 2769 mViewManager->refreshView();
2809 return syncOK; 2770 return syncOK;
2810 2771
2811} 2772}
2812void KABCore::message( QString m ) 2773void KABCore::message( QString m )
2813{ 2774{
2814 topLevelWidget()->setCaption( m ); 2775 topLevelWidget()->setCaption( m );
2815 mMessageTimer->start( 15000, true ); 2776 mMessageTimer->start( 15000, true );
2816} 2777}
2817bool KABCore::syncPhone() 2778bool KABCore::syncPhone()
2818{ 2779{
2819 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2780 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2820 QString fileName = getPhoneFile(); 2781 QString fileName = getPhoneFile();
2821 if ( !PhoneAccess::readFromPhone( fileName) ) { 2782 if ( !PhoneAccess::readFromPhone( fileName) ) {
2822 message(i18n("Phone access failed!")); 2783 message(i18n("Phone access failed!"));
2823 return false; 2784 return false;
2824 } 2785 }
2825 AddressBook abLocal( fileName,"syncContact"); 2786 AddressBook abLocal( fileName,"syncContact");
2826 bool syncOK = false; 2787 bool syncOK = false;
2827 { 2788 {
2828 abLocal.importFromFile( fileName ); 2789 abLocal.importFromFile( fileName );
2829 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2790 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2830 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2791 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2831 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2792 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2832 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2793 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
2833 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2794 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2834 if ( syncOK ) { 2795 if ( syncOK ) {
2835 if ( syncManager->mWriteBackFile ) { 2796 if ( syncManager->mWriteBackFile ) {
2836 abLocal.removeSyncAddressees( true ); 2797 abLocal.removeSyncAddressees( true );
2837 abLocal.saveABphone( fileName ); 2798 abLocal.saveABphone( fileName );
2838 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 2799 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
2839 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 2800 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2840 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2801 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2841 } 2802 }
2842 } 2803 }
2843 setModified(); 2804 setModified();
2844 } 2805 }
2845 if ( syncOK ) 2806 if ( syncOK )
2846 mViewManager->refreshView(); 2807 mViewManager->refreshView();
2847 return syncOK; 2808 return syncOK;
2848} 2809}
2849void KABCore::getFile( bool success ) 2810void KABCore::getFile( bool success )
2850{ 2811{
2851 if ( ! success ) { 2812 if ( ! success ) {
2852 message( i18n("Error receiving file. Nothing changed!") ); 2813 message( i18n("Error receiving file. Nothing changed!") );
2853 return; 2814 return;
2854 } 2815 }
2855 mAddressBook->importFromFile( sentSyncFile() , false, true ); 2816 mAddressBook->importFromFile( sentSyncFile() , false, true );
2856 message( i18n("Pi-Sync successful!") ); 2817 message( i18n("Pi-Sync successful!") );
2857 mViewManager->refreshView(); 2818 mViewManager->refreshView();
2858} 2819}
2859void KABCore::syncFileRequest() 2820void KABCore::syncFileRequest()
2860{ 2821{
2861 mAddressBook->export2File( sentSyncFile() ); 2822 mAddressBook->export2File( sentSyncFile() );
2862} 2823}
2863QString KABCore::sentSyncFile() 2824QString KABCore::sentSyncFile()
2864{ 2825{
2865#ifdef _WIN32_ 2826#ifdef DESKTOP_VERSION
2866 return locateLocal( "tmp", "copysyncab.vcf" ); 2827 return locateLocal( "tmp", "copysyncab.vcf" );
2867#else 2828#else
2868 return QString( "/tmp/copysyncab.vcf" ); 2829 return QString( "/tmp/copysyncab.vcf" );
2869#endif 2830#endif
2870} 2831}
2871 2832
2872void KABCore::setCaptionBack() 2833void KABCore::setCaptionBack()
2873{ 2834{
2874 mMessageTimer->stop(); 2835 mMessageTimer->stop();
2875 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2836 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2876} 2837}
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 6e560d7..32a3b7c 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -128,257 +128,261 @@ void ViewMail::setBody(const RecBodyP&body )
128 break; 128 break;
129 } 129 }
130 130
131 { 131 {
132 /* I did not found a method to make a CONTENT reset on a QTextStream 132 /* I did not found a method to make a CONTENT reset on a QTextStream
133 so I use this construct that the stream will re-constructed in each 133 so I use this construct that the stream will re-constructed in each
134 loop. To let it work, the textstream is packed into a own area of 134 loop. To let it work, the textstream is packed into a own area of
135 code is it will be destructed after finishing its small job. 135 code is it will be destructed after finishing its small job.
136 */ 136 */
137 QTextOStream o(&fsize); 137 QTextOStream o(&fsize);
138 if (w>0) o.precision(2); else o.precision(0); 138 if (w>0) o.precision(2); else o.precision(0);
139 o.setf(QTextStream::fixed); 139 o.setf(QTextStream::fixed);
140 o << s << " " << q << "Byte"; 140 o << s << " " << q << "Byte";
141 } 141 }
142 142
143 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 143 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
144 QString filename = ""; 144 QString filename = "";
145 145
146 for (unsigned int i = 0; i < body->Parts().count();++i) 146 for (unsigned int i = 0; i < body->Parts().count();++i)
147 { 147 {
148 filename = ""; 148 filename = "";
149 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 149 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
150 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 150 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
151 for (;it!=body->Parts()[i]->Parameters().end();++it) 151 for (;it!=body->Parts()[i]->Parameters().end();++it)
152 { 152 {
153 if (it.key().lower()=="name") 153 if (it.key().lower()=="name")
154 { 154 {
155 filename=it.data(); 155 filename=it.data();
156 } 156 }
157 } 157 }
158 s = body->Parts()[i]->Size(); 158 s = body->Parts()[i]->Size();
159 w = 0; 159 w = 0;
160 while (s>1024) 160 while (s>1024)
161 { 161 {
162 s/=1024; 162 s/=1024;
163 ++w; 163 ++w;
164 if (w>=2) break; 164 if (w>=2) break;
165 } 165 }
166 switch(w) 166 switch(w)
167 { 167 {
168 case 1: 168 case 1:
169 q="k"; 169 q="k";
170 break; 170 break;
171 case 2: 171 case 2:
172 q="M"; 172 q="M";
173 break; 173 break;
174 default: 174 default:
175 q=""; 175 q="";
176 break; 176 break;
177 } 177 }
178 QTextOStream o(&fsize); 178 QTextOStream o(&fsize);
179 if (w>0) o.precision(2); else o.precision(0); 179 if (w>0) o.precision(2); else o.precision(0);
180 o.setf(QTextStream::fixed); 180 o.setf(QTextStream::fixed);
181 o << s << " " << q << "Byte"; 181 o << s << " " << q << "Byte";
182 desc = body->Parts()[i]->Description(); 182 desc = body->Parts()[i]->Description();
183 parentItem = searchParent(body->Parts()[i]->Positionlist()); 183 parentItem = searchParent(body->Parts()[i]->Positionlist());
184 if (parentItem) 184 if (parentItem)
185 { 185 {
186 AttachItem*temp = lastChild(parentItem); 186 AttachItem*temp = lastChild(parentItem);
187 if (temp) curItem = temp; 187 if (temp) curItem = temp;
188 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 188 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
189 attachments->setRootIsDecorated(true); 189 attachments->setRootIsDecorated(true);
190 curItem = parentItem; 190 curItem = parentItem;
191 } 191 }
192 else 192 else
193 { 193 {
194 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 194 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
195 } 195 }
196 } 196 }
197} 197}
198 198
199 199
200void ViewMail::slotShowHtml( bool state ) 200void ViewMail::slotShowHtml( bool state )
201{ 201{
202 m_showHtml = state; 202 m_showHtml = state;
203 setText(); 203 setText();
204} 204}
205 205
206void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 206void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
207{ 207{
208 if (!item ) 208 if (!item )
209 return; 209 return;
210 210
211 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 211 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
212 { 212 {
213 setText(); 213 setText();
214 return; 214 return;
215 } 215 }
216 QPopupMenu *menu = new QPopupMenu(); 216 QPopupMenu *menu = new QPopupMenu();
217 int ret=0; 217 int ret=0;
218 218
219 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 219 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
220 { 220 {
221 menu->insertItem( tr( "Show Text" ), 1 ); 221 menu->insertItem( tr( "Show Text" ), 1 );
222 } 222 }
223 if (item->text(0).left(6)=="image/") { 223 if (item->text(0).left(6)=="image/") {
224 menu->insertItem(tr("Display image preview"),2); 224 menu->insertItem(tr("Display image preview"),2);
225 } 225 }
226 menu->insertItem( tr( "Save Attachment" ), 0 ); 226 menu->insertItem( tr( "Save Attachment" ), 0 );
227 menu->insertSeparator(1); 227 menu->insertSeparator(1);
228 228
229 ret = menu->exec( point, 0 ); 229 ret = menu->exec( point, 0 );
230 230
231 switch(ret) 231 switch(ret)
232 { 232 {
233 case 0: 233 case 0:
234 { 234 {
235 //MimeTypes types; 235 //MimeTypes types;
236 //types.insert( "all", "*" ); 236 //types.insert( "all", "*" );
237 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); 237 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
238 238
239 if( !str.isEmpty() ) 239 if( !str.isEmpty() )
240 { 240 {
241 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 241 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
242 if (content) 242 if (content)
243 { 243 {
244 QFile output(str); 244 QFile output(str);
245 output.open(IO_WriteOnly); 245 output.open(IO_WriteOnly);
246 output.writeBlock(content->Content(),content->Length()); 246 output.writeBlock(content->Content(),content->Length());
247 output.close(); 247 output.close();
248 delete content; 248 delete content;
249 } 249 }
250 } 250 }
251 } 251 }
252 break ; 252 break ;
253 253
254 case 2: 254 case 2:
255 { 255 {
256#ifdef DESKTOP_VERSION
257 QString tmpfile = locateLocal( "tmp", "opiemail-image");
258#else
256 QString tmpfile = "/tmp/opiemail-image"; 259 QString tmpfile = "/tmp/opiemail-image";
260#endif
257 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 261 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
258 if (content) { 262 if (content) {
259 QFile output(tmpfile); 263 QFile output(tmpfile);
260 output.open(IO_WriteOnly); 264 output.open(IO_WriteOnly);
261 output.writeBlock(content->Content(),content->Length()); 265 output.writeBlock(content->Content(),content->Length());
262 output.close(); 266 output.close();
263 delete content; 267 delete content;
264 MailImageDlg iview(""); 268 MailImageDlg iview("");
265 iview.setName(tmpfile); 269 iview.setName(tmpfile);
266 KApplication::execDialog(&iview); 270 KApplication::execDialog(&iview);
267 output.remove(); 271 output.remove();
268 } 272 }
269 } 273 }
270 break; 274 break;
271 case 1: 275 case 1:
272 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 276 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
273 { 277 {
274 setText(); 278 setText();
275 } 279 }
276 else 280 else
277 { 281 {
278 if ( m_recMail->Wrapper() != 0l ) 282 if ( m_recMail->Wrapper() != 0l )
279 { // make sure that there is a wrapper , even after delete or simular actions 283 { // make sure that there is a wrapper , even after delete or simular actions
280 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 284 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
281 } 285 }
282 } 286 }
283 break; 287 break;
284 } 288 }
285 delete menu; 289 delete menu;
286} 290}
287 291
288 292
289void ViewMail::setMail(const RecMailP&mail ) 293void ViewMail::setMail(const RecMailP&mail )
290{ 294{
291 295
292 m_recMail = mail; 296 m_recMail = mail;
293 297
294 m_mail[0] = mail->getFrom(); 298 m_mail[0] = mail->getFrom();
295 m_mail[1] = mail->getSubject(); 299 m_mail[1] = mail->getSubject();
296 m_mail[3] = mail->getDate(); 300 m_mail[3] = mail->getDate();
297 m_mail[4] = mail->Msgid(); 301 m_mail[4] = mail->Msgid();
298 302
299 m_mail2[0] = mail->To(); 303 m_mail2[0] = mail->To();
300 m_mail2[1] = mail->CC(); 304 m_mail2[1] = mail->CC();
301 m_mail2[2] = mail->Bcc(); 305 m_mail2[2] = mail->Bcc();
302 306
303 setText(); 307 setText();
304} 308}
305 309
306 310
307 311
308ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 312ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
309 : ViewMailBase(parent, name, fl), _inLoop(false) 313 : ViewMailBase(parent, name, fl), _inLoop(false)
310{ 314{
311 m_gotBody = false; 315 m_gotBody = false;
312 deleted = false; 316 deleted = false;
313 317
314 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 318 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
315 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 319 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
316 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 320 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
317 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 321 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
318 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 322 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
319 323
320 attachments->setEnabled(m_gotBody); 324 attachments->setEnabled(m_gotBody);
321 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 325 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
322 326
323 readConfig(); 327 readConfig();
324 attachments->setSorting(-1); 328 attachments->setSorting(-1);
325} 329}
326 330
327void ViewMail::readConfig() 331void ViewMail::readConfig()
328{ 332{
329 333
330 setFont ( KOPrefs::instance()->mReadFont ); 334 setFont ( KOPrefs::instance()->mReadFont );
331 m_showHtml = KOPrefs::instance()->mViewAsHtml; 335 m_showHtml = KOPrefs::instance()->mViewAsHtml;
332 showHtml->setOn( m_showHtml ); 336 showHtml->setOn( m_showHtml );
333} 337}
334 338
335void ViewMail::setText() 339void ViewMail::setText()
336{ 340{
337 341
338 QString toString; 342 QString toString;
339 QString ccString; 343 QString ccString;
340 QString bccString; 344 QString bccString;
341 345
342 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 346 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
343 { 347 {
344 toString += (*it); 348 toString += (*it);
345 } 349 }
346 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 350 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
347 { 351 {
348 ccString += (*it); 352 ccString += (*it);
349 } 353 }
350 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) 354 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
351 { 355 {
352 bccString += (*it); 356 bccString += (*it);
353 } 357 }
354 358
355 setCaption( tr("E-Mail by %1").arg( m_mail[0] ) ); 359 setCaption( tr("E-Mail by %1").arg( m_mail[0] ) );
356 360
357 m_mailHtml = "<html><body>" 361 m_mailHtml = "<html><body>"
358 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 362 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
359 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 363 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
360 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 364 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
361 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 365 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
362 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 366 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
363 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 367 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
364 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + 368 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
365 "</td></tr></table><font>"; 369 "</td></tr></table><font>";
366 370
367 if ( !m_showHtml ) 371 if ( !m_showHtml )
368 { 372 {
369 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 373 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
370 } 374 }
371 else 375 else
372 { 376 {
373 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 377 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
374 } 378 }
375 // remove later in favor of a real handling 379 // remove later in favor of a real handling
376 m_gotBody = true; 380 m_gotBody = true;
377} 381}
378 382
379 383
380ViewMail::~ViewMail() 384ViewMail::~ViewMail()
381{ 385{
382 m_recMail->Wrapper()->cleanMimeCache(); 386 m_recMail->Wrapper()->cleanMimeCache();
383 hide(); 387 hide();
384} 388}
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 290c0b9..884c61a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2178,258 +2178,261 @@ void CalendarView::edit_options()
2178 2178
2179void CalendarView::slotSelectPickerDate( QDate d) 2179void CalendarView::slotSelectPickerDate( QDate d)
2180{ 2180{
2181 mDateFrame->hide(); 2181 mDateFrame->hide();
2182 if ( mDatePickerMode == 1 ) { 2182 if ( mDatePickerMode == 1 ) {
2183 mNavigator->slotDaySelect( d ); 2183 mNavigator->slotDaySelect( d );
2184 } else if ( mDatePickerMode == 2 ) { 2184 } else if ( mDatePickerMode == 2 ) {
2185 if ( mMoveIncidence->type() == "Todo" ) { 2185 if ( mMoveIncidence->type() == "Todo" ) {
2186 Todo * to = (Todo *) mMoveIncidence; 2186 Todo * to = (Todo *) mMoveIncidence;
2187 QTime tim; 2187 QTime tim;
2188 if ( to->hasDueDate() ) 2188 if ( to->hasDueDate() )
2189 tim = to->dtDue().time(); 2189 tim = to->dtDue().time();
2190 else { 2190 else {
2191 tim = QTime ( 0,0,0 ); 2191 tim = QTime ( 0,0,0 );
2192 to->setFloats( true ); 2192 to->setFloats( true );
2193 to->setHasDueDate( true ); 2193 to->setHasDueDate( true );
2194 } 2194 }
2195 QDateTime dt ( d,tim ); 2195 QDateTime dt ( d,tim );
2196 to->setDtDue( dt ); 2196 to->setDtDue( dt );
2197 todoChanged( to ); 2197 todoChanged( to );
2198 } else { 2198 } else {
2199 QTime tim = mMoveIncidence->dtStart().time(); 2199 QTime tim = mMoveIncidence->dtStart().time();
2200 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); 2200 int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd());
2201 QDateTime dt ( d,tim ); 2201 QDateTime dt ( d,tim );
2202 mMoveIncidence->setDtStart( dt ); 2202 mMoveIncidence->setDtStart( dt );
2203 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); 2203 ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) );
2204 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); 2204 changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED);
2205 } 2205 }
2206 2206
2207 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); 2207 mMoveIncidence->setRevision( mMoveIncidence->revision()+1 );
2208 } 2208 }
2209} 2209}
2210 2210
2211void CalendarView::removeCategories() 2211void CalendarView::removeCategories()
2212{ 2212{
2213 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2213 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2214 QStringList catList = KOPrefs::instance()->mCustomCategories; 2214 QStringList catList = KOPrefs::instance()->mCustomCategories;
2215 QStringList catIncList; 2215 QStringList catIncList;
2216 QStringList newCatList; 2216 QStringList newCatList;
2217 Incidence* inc = incList.first(); 2217 Incidence* inc = incList.first();
2218 int i; 2218 int i;
2219 int count = 0; 2219 int count = 0;
2220 while ( inc ) { 2220 while ( inc ) {
2221 newCatList.clear(); 2221 newCatList.clear();
2222 catIncList = inc->categories() ; 2222 catIncList = inc->categories() ;
2223 for( i = 0; i< catIncList.count(); ++i ) { 2223 for( i = 0; i< catIncList.count(); ++i ) {
2224 if ( catList.contains (catIncList[i])) 2224 if ( catList.contains (catIncList[i]))
2225 newCatList.append( catIncList[i] ); 2225 newCatList.append( catIncList[i] );
2226 } 2226 }
2227 newCatList.sort(); 2227 newCatList.sort();
2228 inc->setCategories( newCatList.join(",") ); 2228 inc->setCategories( newCatList.join(",") );
2229 inc = incList.next(); 2229 inc = incList.next();
2230 } 2230 }
2231} 2231}
2232 2232
2233int CalendarView::addCategories() 2233int CalendarView::addCategories()
2234{ 2234{
2235 QPtrList<Incidence> incList = mCalendar->rawIncidences(); 2235 QPtrList<Incidence> incList = mCalendar->rawIncidences();
2236 QStringList catList = KOPrefs::instance()->mCustomCategories; 2236 QStringList catList = KOPrefs::instance()->mCustomCategories;
2237 QStringList catIncList; 2237 QStringList catIncList;
2238 Incidence* inc = incList.first(); 2238 Incidence* inc = incList.first();
2239 int i; 2239 int i;
2240 int count = 0; 2240 int count = 0;
2241 while ( inc ) { 2241 while ( inc ) {
2242 catIncList = inc->categories() ; 2242 catIncList = inc->categories() ;
2243 for( i = 0; i< catIncList.count(); ++i ) { 2243 for( i = 0; i< catIncList.count(); ++i ) {
2244 if ( !catList.contains (catIncList[i])) { 2244 if ( !catList.contains (catIncList[i])) {
2245 catList.append( catIncList[i] ); 2245 catList.append( catIncList[i] );
2246 //qDebug("add cat %s ", catIncList[i].latin1()); 2246 //qDebug("add cat %s ", catIncList[i].latin1());
2247 ++count; 2247 ++count;
2248 } 2248 }
2249 } 2249 }
2250 inc = incList.next(); 2250 inc = incList.next();
2251 } 2251 }
2252 catList.sort(); 2252 catList.sort();
2253 KOPrefs::instance()->mCustomCategories = catList; 2253 KOPrefs::instance()->mCustomCategories = catList;
2254 return count; 2254 return count;
2255} 2255}
2256 2256
2257void CalendarView::manageCategories() 2257void CalendarView::manageCategories()
2258{ 2258{
2259 KOCatPrefs* cp = new KOCatPrefs(); 2259 KOCatPrefs* cp = new KOCatPrefs();
2260 cp->show(); 2260 cp->show();
2261 int w =cp->sizeHint().width() ; 2261 int w =cp->sizeHint().width() ;
2262 int h = cp->sizeHint().height() ; 2262 int h = cp->sizeHint().height() ;
2263 int dw = QApplication::desktop()->width(); 2263 int dw = QApplication::desktop()->width();
2264 int dh = QApplication::desktop()->height(); 2264 int dh = QApplication::desktop()->height();
2265 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2265 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2266 if ( !cp->exec() ) { 2266 if ( !cp->exec() ) {
2267 delete cp; 2267 delete cp;
2268 return; 2268 return;
2269 } 2269 }
2270 int count = 0; 2270 int count = 0;
2271 if ( cp->addCat() ) { 2271 if ( cp->addCat() ) {
2272 count = addCategories(); 2272 count = addCategories();
2273 if ( count ) { 2273 if ( count ) {
2274 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); 2274 topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! "));
2275 writeSettings(); 2275 writeSettings();
2276 } 2276 }
2277 } else { 2277 } else {
2278 removeCategories(); 2278 removeCategories();
2279 updateView(); 2279 updateView();
2280 } 2280 }
2281 delete cp; 2281 delete cp;
2282} 2282}
2283 2283
2284void CalendarView::beamIncidence(Incidence * Inc) 2284void CalendarView::beamIncidence(Incidence * Inc)
2285{ 2285{
2286 QPtrList<Incidence> delSel ; 2286 QPtrList<Incidence> delSel ;
2287 delSel.append(Inc); 2287 delSel.append(Inc);
2288 beamIncidenceList( delSel ); 2288 beamIncidenceList( delSel );
2289} 2289}
2290void CalendarView::beamCalendar() 2290void CalendarView::beamCalendar()
2291{ 2291{
2292 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2292 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2293 //qDebug("beamCalendar() "); 2293 //qDebug("beamCalendar() ");
2294 beamIncidenceList( delSel ); 2294 beamIncidenceList( delSel );
2295} 2295}
2296void CalendarView::beamFilteredCalendar() 2296void CalendarView::beamFilteredCalendar()
2297{ 2297{
2298 QPtrList<Incidence> delSel = mCalendar->incidences(); 2298 QPtrList<Incidence> delSel = mCalendar->incidences();
2299 //qDebug("beamFilteredCalendar() "); 2299 //qDebug("beamFilteredCalendar() ");
2300 beamIncidenceList( delSel ); 2300 beamIncidenceList( delSel );
2301} 2301}
2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2302void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2303{ 2303{
2304 if ( beamDialog->exec () == QDialog::Rejected ) 2304 if ( beamDialog->exec () == QDialog::Rejected )
2305 return; 2305 return;
2306 2306#ifdef DESKTOP_VERSION
2307 QString fn = locateLocal( "tmp", "kopibeamfile" );
2308#else
2307 QString fn = "/tmp/kopibeamfile"; 2309 QString fn = "/tmp/kopibeamfile";
2310#endif
2308 QString mes; 2311 QString mes;
2309 bool createbup = true; 2312 bool createbup = true;
2310 if ( createbup ) { 2313 if ( createbup ) {
2311 QString description = "\n"; 2314 QString description = "\n";
2312 CalendarLocal* cal = new CalendarLocal(); 2315 CalendarLocal* cal = new CalendarLocal();
2313 if ( beamDialog->beamLocal() ) 2316 if ( beamDialog->beamLocal() )
2314 cal->setLocalTime(); 2317 cal->setLocalTime();
2315 else 2318 else
2316 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 2319 cal->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
2317 Incidence *incidence = delSel.first(); 2320 Incidence *incidence = delSel.first();
2318 bool addText = false; 2321 bool addText = false;
2319 if ( delSel.count() < 10 ) 2322 if ( delSel.count() < 10 )
2320 addText = true; 2323 addText = true;
2321 else { 2324 else {
2322 description.sprintf(i18n(" %d items?"),delSel.count() ); 2325 description.sprintf(i18n(" %d items?"),delSel.count() );
2323 } 2326 }
2324 while ( incidence ) { 2327 while ( incidence ) {
2325 Incidence *in = incidence->clone(); 2328 Incidence *in = incidence->clone();
2326 if ( ! in->summary().isEmpty() ) { 2329 if ( ! in->summary().isEmpty() ) {
2327 in->setDescription(""); 2330 in->setDescription("");
2328 } else { 2331 } else {
2329 in->setSummary( in->description().left(20)); 2332 in->setSummary( in->description().left(20));
2330 in->setDescription(""); 2333 in->setDescription("");
2331 } 2334 }
2332 if ( addText ) 2335 if ( addText )
2333 description += in->summary() + "\n"; 2336 description += in->summary() + "\n";
2334 cal->addIncidence( in ); 2337 cal->addIncidence( in );
2335 incidence = delSel.next(); 2338 incidence = delSel.next();
2336 } 2339 }
2337 if ( beamDialog->beamVcal() ) { 2340 if ( beamDialog->beamVcal() ) {
2338 fn += ".vcs"; 2341 fn += ".vcs";
2339 FileStorage storage( cal, fn, new VCalFormat ); 2342 FileStorage storage( cal, fn, new VCalFormat );
2340 storage.save(); 2343 storage.save();
2341 } else { 2344 } else {
2342 fn += ".ics"; 2345 fn += ".ics";
2343 FileStorage storage( cal, fn, new ICalFormat( ) ); 2346 FileStorage storage( cal, fn, new ICalFormat( ) );
2344 storage.save(); 2347 storage.save();
2345 } 2348 }
2346 delete cal; 2349 delete cal;
2347 mes = i18n("KO/Pi: Ready for beaming"); 2350 mes = i18n("KO/Pi: Ready for beaming");
2348 topLevelWidget()->setCaption(mes); 2351 topLevelWidget()->setCaption(mes);
2349 KApplication::convert2latin1( fn ); 2352 KApplication::convert2latin1( fn );
2350#ifndef DESKTOP_VERSION 2353#ifndef DESKTOP_VERSION
2351 Ir *ir = new Ir( this ); 2354 Ir *ir = new Ir( this );
2352 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2355 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2353 ir->send( fn, description, "text/x-vCalendar" ); 2356 ir->send( fn, description, "text/x-vCalendar" );
2354#endif 2357#endif
2355 } 2358 }
2356} 2359}
2357void CalendarView::beamDone( Ir *ir ) 2360void CalendarView::beamDone( Ir *ir )
2358{ 2361{
2359#ifndef DESKTOP_VERSION 2362#ifndef DESKTOP_VERSION
2360 delete ir; 2363 delete ir;
2361#endif 2364#endif
2362 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); 2365 topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") );
2363 topLevelWidget()->raise(); 2366 topLevelWidget()->raise();
2364} 2367}
2365 2368
2366void CalendarView::moveIncidence(Incidence * inc ) 2369void CalendarView::moveIncidence(Incidence * inc )
2367{ 2370{
2368 if ( !inc ) return; 2371 if ( !inc ) return;
2369 // qDebug("showDatePickerForIncidence( ) "); 2372 // qDebug("showDatePickerForIncidence( ) ");
2370 if ( mDateFrame->isVisible() ) 2373 if ( mDateFrame->isVisible() )
2371 mDateFrame->hide(); 2374 mDateFrame->hide();
2372 else { 2375 else {
2373 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; 2376 int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ;
2374 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; 2377 int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ;
2375 int dw = QApplication::desktop()->width(); 2378 int dw = QApplication::desktop()->width();
2376 int dh = QApplication::desktop()->height(); 2379 int dh = QApplication::desktop()->height();
2377 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2380 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2378 mDateFrame->show(); 2381 mDateFrame->show();
2379 } 2382 }
2380 mDatePickerMode = 2; 2383 mDatePickerMode = 2;
2381 mMoveIncidence = inc ; 2384 mMoveIncidence = inc ;
2382 QDate da; 2385 QDate da;
2383 if ( mMoveIncidence->type() == "Todo" ) { 2386 if ( mMoveIncidence->type() == "Todo" ) {
2384 Todo * to = (Todo *) mMoveIncidence; 2387 Todo * to = (Todo *) mMoveIncidence;
2385 if ( to->hasDueDate() ) 2388 if ( to->hasDueDate() )
2386 da = to->dtDue().date(); 2389 da = to->dtDue().date();
2387 else 2390 else
2388 da = QDate::currentDate(); 2391 da = QDate::currentDate();
2389 } else { 2392 } else {
2390 da = mMoveIncidence->dtStart().date(); 2393 da = mMoveIncidence->dtStart().date();
2391 } 2394 }
2392 mDatePicker->setDate( da ); 2395 mDatePicker->setDate( da );
2393} 2396}
2394void CalendarView::showDatePicker( ) 2397void CalendarView::showDatePicker( )
2395{ 2398{
2396 //qDebug("CalendarView::showDatePicker( ) "); 2399 //qDebug("CalendarView::showDatePicker( ) ");
2397 if ( mDateFrame->isVisible() ) 2400 if ( mDateFrame->isVisible() )
2398 mDateFrame->hide(); 2401 mDateFrame->hide();
2399 else { 2402 else {
2400 int w =mDatePicker->sizeHint().width() ; 2403 int w =mDatePicker->sizeHint().width() ;
2401 int h = mDatePicker->sizeHint().height() ; 2404 int h = mDatePicker->sizeHint().height() ;
2402 int dw = QApplication::desktop()->width(); 2405 int dw = QApplication::desktop()->width();
2403 int dh = QApplication::desktop()->height(); 2406 int dh = QApplication::desktop()->height();
2404 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2407 mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2405 mDateFrame->show(); 2408 mDateFrame->show();
2406 } 2409 }
2407 mDatePickerMode = 1; 2410 mDatePickerMode = 1;
2408 mDatePicker->setDate( mNavigator->selectedDates().first() ); 2411 mDatePicker->setDate( mNavigator->selectedDates().first() );
2409} 2412}
2410 2413
2411void CalendarView::showEventEditor() 2414void CalendarView::showEventEditor()
2412{ 2415{
2413#ifdef DESKTOP_VERSION 2416#ifdef DESKTOP_VERSION
2414 mEventEditor->show(); 2417 mEventEditor->show();
2415#else 2418#else
2416 mEventEditor->showMaximized(); 2419 mEventEditor->showMaximized();
2417#endif 2420#endif
2418} 2421}
2419void CalendarView::showTodoEditor() 2422void CalendarView::showTodoEditor()
2420{ 2423{
2421#ifdef DESKTOP_VERSION 2424#ifdef DESKTOP_VERSION
2422 mTodoEditor->show(); 2425 mTodoEditor->show();
2423#else 2426#else
2424 mTodoEditor->showMaximized(); 2427 mTodoEditor->showMaximized();
2425#endif 2428#endif
2426} 2429}
2427 2430
2428void CalendarView::cloneIncidence() 2431void CalendarView::cloneIncidence()
2429{ 2432{
2430 Incidence *incidence = currentSelection(); 2433 Incidence *incidence = currentSelection();
2431 if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); 2434 if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
2432 if ( incidence ) { 2435 if ( incidence ) {
2433 cloneIncidence(incidence); 2436 cloneIncidence(incidence);
2434 } 2437 }
2435} 2438}
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 651442b..258f738 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -77,262 +77,256 @@ KOPrefs::KOPrefs() :
77 mJornalViewFont = QFont("helvetica",12); 77 mJornalViewFont = QFont("helvetica",12);
78 78
79 KPrefs::setCurrentGroup("General"); 79 KPrefs::setCurrentGroup("General");
80 80
81 81
82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 82 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
83 83
84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 84 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 85 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
86 addItemBool("ShowIconSearch",&mShowIconSearch,true); 86 addItemBool("ShowIconSearch",&mShowIconSearch,true);
87 addItemBool("ShowIconList",&mShowIconList,true); 87 addItemBool("ShowIconList",&mShowIconList,true);
88 addItemBool("ShowIconDay1",&mShowIconDay1,true); 88 addItemBool("ShowIconDay1",&mShowIconDay1,true);
89 addItemBool("ShowIconDay5",&mShowIconDay5,true); 89 addItemBool("ShowIconDay5",&mShowIconDay5,true);
90 addItemBool("ShowIconDay7",&mShowIconDay7,true); 90 addItemBool("ShowIconDay7",&mShowIconDay7,true);
91 addItemBool("ShowIconMonth",&mShowIconMonth,true); 91 addItemBool("ShowIconMonth",&mShowIconMonth,true);
92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 92 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 93 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
94 addItemBool("ShowIconBack",&mShowIconBack,true); 94 addItemBool("ShowIconBack",&mShowIconBack,true);
95 addItemBool("ShowIconToday",&mShowIconToday,true); 95 addItemBool("ShowIconToday",&mShowIconToday,true);
96 addItemBool("ShowIconForward",&mShowIconForward,true); 96 addItemBool("ShowIconForward",&mShowIconForward,true);
97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); 97 addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true);
98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); 98 addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false);
99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true); 99 addItemBool("ShowIconNextDays",&mShowIconNextDays,true);
100 addItemBool("ShowIconNext",&mShowIconNext,true); 100 addItemBool("ShowIconNext",&mShowIconNext,true);
101 addItemBool("ShowIconJournal",&mShowIconJournal,true); 101 addItemBool("ShowIconJournal",&mShowIconJournal,true);
102 addItemBool("ShowIconStretch",&mShowIconStretch,true); 102 addItemBool("ShowIconStretch",&mShowIconStretch,true);
103 addItemBool("LanguageChanged",&mLanguageChanged,false); 103 addItemBool("LanguageChanged",&mLanguageChanged,false);
104 104
105 addItemBool("AskForQuit",&mAskForQuit,false); 105 addItemBool("AskForQuit",&mAskForQuit,false);
106 106
107#ifndef DESKTOP_VERSION 107#ifndef DESKTOP_VERSION
108 addItemBool("ShowFullMenu",&mShowFullMenu,false); 108 addItemBool("ShowFullMenu",&mShowFullMenu,false);
109#else 109#else
110 addItemBool("ShowFullMenu",&mShowFullMenu,true); 110 addItemBool("ShowFullMenu",&mShowFullMenu,true);
111#endif 111#endif
112 addItemBool("ToolBarHor",&mToolBarHor, true ); 112 addItemBool("ToolBarHor",&mToolBarHor, true );
113 addItemBool("ToolBarUp",&mToolBarUp, false ); 113 addItemBool("ToolBarUp",&mToolBarUp, false );
114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); 114 addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false );
115 addItemInt("Whats Next Days",&mWhatsNextDays,3); 115 addItemInt("Whats Next Days",&mWhatsNextDays,3);
116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1); 116 addItemInt("Whats Next Prios",&mWhatsNextPrios,1);
117 117
118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); 118 addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true);
119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); 119 addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
120 addItemInt("AllDay Size",&mAllDaySize,28); 120 addItemInt("AllDay Size",&mAllDaySize,28);
121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; 121 QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); 122 addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
123 123
124 addItemStringList("LocationDefaults",&mLocationDefaults ); 124 addItemStringList("LocationDefaults",&mLocationDefaults );
125 addItemStringList("EventSummary User",&mEventSummaryUser); 125 addItemStringList("EventSummary User",&mEventSummaryUser);
126 addItemStringList("TodoSummary User",&mTodoSummaryUser); 126 addItemStringList("TodoSummary User",&mTodoSummaryUser);
127 127
128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 128 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
129 addItemBool("Enable Project View",&mEnableProjectView,false); 129 addItemBool("Enable Project View",&mEnableProjectView,false);
130 addItemBool("Auto Save",&mAutoSave,false); 130 addItemBool("Auto Save",&mAutoSave,false);
131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3); 131 addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
132 addItemBool("Confirm Deletes",&mConfirm,true); 132 addItemBool("Confirm Deletes",&mConfirm,true);
133 addItemString("Archive File",&mArchiveFile); 133 addItemString("Archive File",&mArchiveFile);
134 addItemString("Html Export File",&mHtmlExportFile, 134 addItemString("Html Export File",&mHtmlExportFile,
135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); 135 QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html"));
136 addItemBool("Html With Save",&mHtmlWithSave,false); 136 addItemBool("Html With Save",&mHtmlWithSave,false);
137 137
138 KPrefs::setCurrentGroup("Personal Settings"); 138 KPrefs::setCurrentGroup("Personal Settings");
139 139
140 addItemInt("Mail Client",&mMailClient,MailClientKMail); 140 addItemInt("Mail Client",&mMailClient,MailClientKMail);
141 addItemBool("Use Control Center Email",&mEmailControlCenter,false); 141 addItemBool("Use Control Center Email",&mEmailControlCenter,false);
142 addItemBool("Bcc",&mBcc,false); 142 addItemBool("Bcc",&mBcc,false);
143 143
144 KPrefs::setCurrentGroup("Time & Date"); 144 KPrefs::setCurrentGroup("Time & Date");
145 145
146 // addItemString("Time Zone",&mTimeZone,"+0100"); 146 // addItemString("Time Zone",&mTimeZone,"+0100");
147 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") ); 147 addItemString("TimeZoneName",&mTimeZoneId,i18n ("+01:00 Europe/Oslo(CET)") );
148 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60); 148 // addItemInt("TimeZoneOffset",&mTimeZoneOffset,60);
149 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 149 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
150 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 150 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
151 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 151 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
152 152
153 153
154 addItemInt("Default Start Time",&mStartTime,10); 154 addItemInt("Default Start Time",&mStartTime,10);
155 addItemInt("Default Duration",&mDefaultDuration,2); 155 addItemInt("Default Duration",&mDefaultDuration,2);
156 addItemInt("Default Alarm Time",&mAlarmTime,3); 156 addItemInt("Default Alarm Time",&mAlarmTime,3);
157 addItemInt("Daylight Savings",&mDaylightSavings,0); 157 addItemInt("Daylight Savings",&mDaylightSavings,0);
158 KPrefs::setCurrentGroup("AlarmSettings"); 158 KPrefs::setCurrentGroup("AlarmSettings");
159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); 159 addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20);
160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); 160 addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7);
161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); 161 addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5);
162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); 162 addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3);
163 163
164 164
165 KPrefs::setCurrentGroup("Calendar"); 165 KPrefs::setCurrentGroup("Calendar");
166 166
167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); 167 addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar);
168 168
169 KPrefs::setCurrentGroup("Fonts"); 169 KPrefs::setCurrentGroup("Fonts");
170 // qDebug(" KPrefs::setCurrentGroup(Fonts); "); 170 // qDebug(" KPrefs::setCurrentGroup(Fonts); ");
171 addItemFont("TimeBar Font",&mTimeBarFont); 171 addItemFont("TimeBar Font",&mTimeBarFont);
172 addItemFont("MonthView Font",&mMonthViewFont); 172 addItemFont("MonthView Font",&mMonthViewFont);
173 addItemFont("AgendaView Font",&mAgendaViewFont); 173 addItemFont("AgendaView Font",&mAgendaViewFont);
174 addItemFont("MarcusBains Font",&mMarcusBainsFont); 174 addItemFont("MarcusBains Font",&mMarcusBainsFont);
175 addItemFont("TimeLabels Font",&mTimeLabelsFont); 175 addItemFont("TimeLabels Font",&mTimeLabelsFont);
176 addItemFont("TodoView Font",&mTodoViewFont); 176 addItemFont("TodoView Font",&mTodoViewFont);
177 addItemFont("ListView Font",&mListViewFont); 177 addItemFont("ListView Font",&mListViewFont);
178 addItemFont("DateNavigator Font",&mDateNavigatorFont); 178 addItemFont("DateNavigator Font",&mDateNavigatorFont);
179 addItemFont("EditBox Font",&mEditBoxFont); 179 addItemFont("EditBox Font",&mEditBoxFont);
180 addItemFont("JournalView Font",&mJornalViewFont); 180 addItemFont("JournalView Font",&mJornalViewFont);
181 addItemFont("WhatsNextView Font",&mWhatsNextFont); 181 addItemFont("WhatsNextView Font",&mWhatsNextFont);
182 addItemFont("EventView Font",&mEventViewFont); 182 addItemFont("EventView Font",&mEventViewFont);
183 183
184// KPrefs::setCurrentGroup("SyncProfiles"); 184// KPrefs::setCurrentGroup("SyncProfiles");
185// addItemString("LocalMachineName",&mLocalMachineName, "undefined"); 185// addItemString("LocalMachineName",&mLocalMachineName, "undefined");
186// addItemStringList("SyncProfileNames",&mSyncProfileNames); 186// addItemStringList("SyncProfileNames",&mSyncProfileNames);
187// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); 187// addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames);
188 188
189 KPrefs::setCurrentGroup("RemoteSyncing"); 189 KPrefs::setCurrentGroup("RemoteSyncing");
190// addItemBool("UsePasswd",&mUsePassWd,false); 190// addItemBool("UsePasswd",&mUsePassWd,false);
191// addItemBool("WriteBackFile",&mWriteBackFile,true); 191// addItemBool("WriteBackFile",&mWriteBackFile,true);
192// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); 192// addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false);
193// addItemBool("AskForPreferences",&mAskForPreferences,true); 193// addItemBool("AskForPreferences",&mAskForPreferences,true);
194// addItemBool("ShowSyncSummary",&mShowSyncSummary,true); 194// addItemBool("ShowSyncSummary",&mShowSyncSummary,true);
195 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); 195 addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" );
196 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); 196 addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" );
197 addItemBool("ShowSyncEvents",&mShowSyncEvents,false); 197 addItemBool("ShowSyncEvents",&mShowSyncEvents,false);
198 addItemInt("LastSyncTime",&mLastSyncTime,0); 198 addItemInt("LastSyncTime",&mLastSyncTime,0);
199 199
200#ifdef _WIN32_ 200#ifdef _WIN32_
201 QString hdp= locateLocal("data","korganizer")+"\\\\"; 201 QString hdp= locateLocal("data","korganizer")+"\\\\";
202#else 202#else
203 QString hdp= locateLocal("data","korganizer")+"/"; 203 QString hdp= locateLocal("data","korganizer")+"/";
204#endif 204#endif
205// addItemString("RemoteIP",&mRemoteIP, "192.168.0.65");
206// addItemString("RemoteUser",&mRemoteUser, "zaurus");
207// addItemString("RemotePassWd",&mRemotePassWd, "");
208// addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics");
209// addItemString("LocalTempFile",&mLocalTempFile, "/tmp/tempsyncfile.ics" );
210
211 205
212 KPrefs::setCurrentGroup("LoadSaveFileNames"); 206 KPrefs::setCurrentGroup("LoadSaveFileNames");
213 207
214 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); 208 addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" );
215 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); 209 addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" );
216 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); 210 addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" );
217 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); 211 addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" );
218 212
219 213
220 KPrefs::setCurrentGroup("Locale"); 214 KPrefs::setCurrentGroup("Locale");
221 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 215 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
222 addItemInt("PreferredTime",&mPreferredTime,0); 216 addItemInt("PreferredTime",&mPreferredTime,0);
223 addItemInt("PreferredDate",&mPreferredDate,0); 217 addItemInt("PreferredDate",&mPreferredDate,0);
224 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 218 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
225 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 219 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
226 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 220 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
227 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 221 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
228 222
229 223
230 KPrefs::setCurrentGroup("Colors"); 224 KPrefs::setCurrentGroup("Colors");
231 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 225 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
232 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 226 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
233 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 227 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
234 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 228 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
235 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 229 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
236 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 230 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
237 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 231 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
238 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 232 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
239 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 233 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
240 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 234 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
241 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 235 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
242 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 236 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
243 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 237 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
244 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 238 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
245 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 239 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
246 addItemBool("UseAppColors",&mUseAppColors,false); 240 addItemBool("UseAppColors",&mUseAppColors,false);
247 241
248 242
249 243
250 KPrefs::setCurrentGroup("Views"); 244 KPrefs::setCurrentGroup("Views");
251 addItemInt("Hour Size",&mHourSize,8); 245 addItemInt("Hour Size",&mHourSize,8);
252 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 246 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
253 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 247 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
254 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 248 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
255 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 249 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
256 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 250 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
257 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 251 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
258 addItemBool("Enable ToolTips",&mEnableToolTips,false); 252 addItemBool("Enable ToolTips",&mEnableToolTips,false);
259 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 253 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
260 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 254 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
261 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 255 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
262 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 256 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
263 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); 257 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false);
264 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); 258 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
265 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 259 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
266 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 260 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
267 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 261 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
268 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); 262 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);
269 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 263 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
270 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 264 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
271 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 265 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
272 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 266 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
273 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 267 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
274 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 268 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
275 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 269 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
276 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 270 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
277#ifdef DESKTOP_VERSION 271#ifdef DESKTOP_VERSION
278 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 272 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
279#else 273#else
280 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 274 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
281#endif 275#endif
282 addItemInt("Day Begins",&mDayBegins,7); 276 addItemInt("Day Begins",&mDayBegins,7);
283 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 277 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
284 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 278 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
285 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 279 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
286 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 280 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
287 281
288 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); 282 addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false);
289 addItemBool("Full View Month",&mFullViewMonth,true); 283 addItemBool("Full View Month",&mFullViewMonth,true);
290 addItemBool("Full View Todo",&mFullViewTodo,true); 284 addItemBool("Full View Todo",&mFullViewTodo,true);
291 addItemBool("Quick Todo",&mEnableQuickTodo,false); 285 addItemBool("Quick Todo",&mEnableQuickTodo,false);
292 286
293 addItemInt("Next X Days",&mNextXDays,3); 287 addItemInt("Next X Days",&mNextXDays,3);
294 288
295 KPrefs::setCurrentGroup("Printer"); 289 KPrefs::setCurrentGroup("Printer");
296 290
297 KPrefs::setCurrentGroup("Layout"); 291 KPrefs::setCurrentGroup("Layout");
298 292
299 addItemBool("CompactDialogs",&mCompactDialogs,false); 293 addItemBool("CompactDialogs",&mCompactDialogs,false);
300 addItemBool("VerticalScreen",&mVerticalScreen,true); 294 addItemBool("VerticalScreen",&mVerticalScreen,true);
301 295
302 KPrefs::setCurrentGroup("KOrganizer Plugins"); 296 KPrefs::setCurrentGroup("KOrganizer Plugins");
303 297
304 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); 298 addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays");
305 299
306 KPrefs::setCurrentGroup("Group Scheduling"); 300 KPrefs::setCurrentGroup("Group Scheduling");
307 301
308 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); 302 addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail);
309 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); 303 addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend);
310 addItemStringList("AdditionalMails",&mAdditionalMails,""); 304 addItemStringList("AdditionalMails",&mAdditionalMails,"");
311 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); 305 addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto);
312 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); 306 addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto);
313 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); 307 addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto);
314 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); 308 addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto);
315 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); 309 addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto);
316 310
317 KPrefs::setCurrentGroup( "Editors" ); 311 KPrefs::setCurrentGroup( "Editors" );
318 312
319 addItemStringList( "EventTemplates", &mEventTemplates ); 313 addItemStringList( "EventTemplates", &mEventTemplates );
320 addItemStringList( "TodoTemplates", &mTodoTemplates ); 314 addItemStringList( "TodoTemplates", &mTodoTemplates );
321 315
322 addItemInt("DestinationPolicy",&mDestination,standardDestination); 316 addItemInt("DestinationPolicy",&mDestination,standardDestination);
323 317
324 318
325 319
326} 320}
327 321
328 322
329KOPrefs::~KOPrefs() 323KOPrefs::~KOPrefs()
330{ 324{
331 if (mInstance == this) 325 if (mInstance == this)
332 mInstance = insd.setObject(0); 326 mInstance = insd.setObject(0);
333 setLocaleDict( 0 ); 327 setLocaleDict( 0 );
334 if ( mLocaleDict ) 328 if ( mLocaleDict )
335 delete mLocaleDict; 329 delete mLocaleDict;
336 //qDebug("KOPrefs::~KOPrefs() "); 330 //qDebug("KOPrefs::~KOPrefs() ");
337} 331}
338 332
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 06470b8..c3e9f75 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1089,260 +1089,260 @@ void MainWindow::synchowto()
1089{ 1089{
1090 1090
1091 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1091 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1092} 1092}
1093void MainWindow::faq() 1093void MainWindow::faq()
1094{ 1094{
1095 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1095 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1096 1096
1097} 1097}
1098void MainWindow::whatsNew() 1098void MainWindow::whatsNew()
1099{ 1099{
1100 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1100 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1101 1101
1102} 1102}
1103void MainWindow::licence() 1103void MainWindow::licence()
1104{ 1104{
1105 KApplication::showLicence(); 1105 KApplication::showLicence();
1106 1106
1107} 1107}
1108void MainWindow::about() 1108void MainWindow::about()
1109{ 1109{
1110 QString version; 1110 QString version;
1111#include <../version> 1111#include <../version>
1112 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1112 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1113 i18n("KOrganizer/Platform-independent\n") + 1113 i18n("KOrganizer/Platform-independent\n") +
1114 "(KO/Pi) " + version + " - " + 1114 "(KO/Pi) " + version + " - " +
1115 1115
1116#ifdef DESKTOP_VERSION 1116#ifdef DESKTOP_VERSION
1117 i18n("Desktop Edition\n") + 1117 i18n("Desktop Edition\n") +
1118#else 1118#else
1119 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1119 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1120#endif 1120#endif
1121 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1121 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1122} 1122}
1123void MainWindow::keyBindings() 1123void MainWindow::keyBindings()
1124{ 1124{
1125 QString cap = i18n("Key bindings KOrganizer/Pi"); 1125 QString cap = i18n("Key bindings KOrganizer/Pi");
1126 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1126 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1127 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1127 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1128 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1128 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1129 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1129 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1130 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1130 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1131 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1131 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1132 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1132 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1133 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1133 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1134 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1134 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1135 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1135 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1136 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1136 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1137 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1137 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1138 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1139 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1140 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1141 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1142 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1143 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1144 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1145 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1146 i18n("<p><h3>In agenda view:</h3></p>\n") + 1146 i18n("<p><h3>In agenda view:</h3></p>\n") +
1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1147 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1148 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1149 i18n("<p><h3>In todo view:</h3></p>\n") + 1149 i18n("<p><h3>In todo view:</h3></p>\n") +
1150 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1150 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1151 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1151 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1152 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1152 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1153 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1153 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1155 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1155 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1156 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1156 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1157 i18n("<p><h3>In list view:</h3></p>\n") + 1157 i18n("<p><h3>In list view:</h3></p>\n") +
1158 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1158 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1159 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1159 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1160 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1160 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1161 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1161 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1162 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1162 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1163 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1163 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1164 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1164 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1165 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1165 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1166 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1166 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1167 i18n("<p><b>E</b>: Edit item</p>\n") + 1167 i18n("<p><b>E</b>: Edit item</p>\n") +
1168 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1168 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1169 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1169 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1170 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1170 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1171 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1171 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1172 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1172 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1173 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1173 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1174 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1174 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1175 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1175 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1176 i18n("<p><b>White</b>: Item readonly</p>\n"); 1176 i18n("<p><b>White</b>: Item readonly</p>\n");
1177 displayText( text, cap); 1177 displayText( text, cap);
1178 1178
1179} 1179}
1180void MainWindow::aboutAutoSaving() 1180void MainWindow::aboutAutoSaving()
1181{ 1181{
1182 QMessageBox* msg; 1182 QMessageBox* msg;
1183 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1183 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1184 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon, 1184 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon,
1185 QMessageBox::Ok, 1185 QMessageBox::Ok,
1186 QMessageBox::NoButton, 1186 QMessageBox::NoButton,
1187 QMessageBox::NoButton); 1187 QMessageBox::NoButton);
1188 msg->exec(); 1188 msg->exec();
1189 delete msg; 1189 delete msg;
1190 1190
1191 1191
1192} 1192}
1193void MainWindow::aboutKnownBugs() 1193void MainWindow::aboutKnownBugs()
1194{ 1194{
1195 QMessageBox* msg; 1195 QMessageBox* msg;
1196 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1196 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1197 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")+ 1197 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")+
1198 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1198 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1199 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1199 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1200 i18n("\nor report them in the bugtracker on\n") + 1200 i18n("\nor report them in the bugtracker on\n") +
1201 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1201 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1202 QMessageBox::NoIcon, 1202 QMessageBox::NoIcon,
1203 QMessageBox::Ok, 1203 QMessageBox::Ok,
1204 QMessageBox::NoButton, 1204 QMessageBox::NoButton,
1205 QMessageBox::NoButton); 1205 QMessageBox::NoButton);
1206 msg->exec(); 1206 msg->exec();
1207 delete msg; 1207 delete msg;
1208 1208
1209} 1209}
1210 1210
1211QString MainWindow::defaultFileName() 1211QString MainWindow::defaultFileName()
1212{ 1212{
1213 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1213 return locateLocal( "data", "korganizer/mycalendar.ics" );
1214} 1214}
1215QString MainWindow::syncFileName() 1215QString MainWindow::syncFileName()
1216{ 1216{
1217#ifdef _WIN32_ 1217#ifdef DESKTOP_VERSION
1218 return locateLocal( "tmp", "synccalendar.ics" ); 1218 return locateLocal( "tmp", "synccalendar.ics" );
1219#else 1219#else
1220 return QString( "/tmp/kopitempfile.ics" ); 1220 return QString( "/tmp/synccalendar.ics" );
1221#endif 1221#endif
1222} 1222}
1223 1223
1224void MainWindow::processIncidenceSelection( Incidence *incidence ) 1224void MainWindow::processIncidenceSelection( Incidence *incidence )
1225{ 1225{
1226 if ( !incidence ) { 1226 if ( !incidence ) {
1227 enableIncidenceActions( false ); 1227 enableIncidenceActions( false );
1228 1228
1229 mNewSubTodoAction->setEnabled( false ); 1229 mNewSubTodoAction->setEnabled( false );
1230 setCaptionToDates(); 1230 setCaptionToDates();
1231 return; 1231 return;
1232 1232
1233 } 1233 }
1234 1234
1235 //KGlobal::locale()->formatDateTime(nextA, true); 1235 //KGlobal::locale()->formatDateTime(nextA, true);
1236 QString startString = ""; 1236 QString startString = "";
1237 if ( incidence->type() != "Todo" ) { 1237 if ( incidence->type() != "Todo" ) {
1238 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1238 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1239 if ( incidence->doesFloat() ) { 1239 if ( incidence->doesFloat() ) {
1240 startString += ": "+incidence->dtStartDateStr( true ); 1240 startString += ": "+incidence->dtStartDateStr( true );
1241 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1241 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1242 1242
1243 } else { 1243 } else {
1244 startString = ": "+incidence->dtStartStr(true); 1244 startString = ": "+incidence->dtStartStr(true);
1245 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1245 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1246 1246
1247 } 1247 }
1248 1248
1249 } else { 1249 } else {
1250 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1250 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1251 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1251 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1252 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1252 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1253 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1253 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1254 } 1254 }
1255 1255
1256 } 1256 }
1257 else 1257 else
1258 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1258 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1259 if ( !incidence->location().isEmpty() ) 1259 if ( !incidence->location().isEmpty() )
1260 startString += " (" +incidence->location()+")"; 1260 startString += " (" +incidence->location()+")";
1261 setCaption( incidence->summary()+startString); 1261 setCaption( incidence->summary()+startString);
1262 1262
1263 enableIncidenceActions( true ); 1263 enableIncidenceActions( true );
1264 1264
1265 if ( incidence->type() == "Event" ) { 1265 if ( incidence->type() == "Event" ) {
1266 mShowAction->setText( i18n("Show Event...") ); 1266 mShowAction->setText( i18n("Show Event...") );
1267 mEditAction->setText( i18n("Edit Event...") ); 1267 mEditAction->setText( i18n("Edit Event...") );
1268 mDeleteAction->setText( i18n("Delete Event...") ); 1268 mDeleteAction->setText( i18n("Delete Event...") );
1269 1269
1270 mNewSubTodoAction->setEnabled( false ); 1270 mNewSubTodoAction->setEnabled( false );
1271 } else if ( incidence->type() == "Todo" ) { 1271 } else if ( incidence->type() == "Todo" ) {
1272 mShowAction->setText( i18n("Show Todo...") ); 1272 mShowAction->setText( i18n("Show Todo...") );
1273 mEditAction->setText( i18n("Edit Todo...") ); 1273 mEditAction->setText( i18n("Edit Todo...") );
1274 mDeleteAction->setText( i18n("Delete Todo...") ); 1274 mDeleteAction->setText( i18n("Delete Todo...") );
1275 1275
1276 mNewSubTodoAction->setEnabled( true ); 1276 mNewSubTodoAction->setEnabled( true );
1277 } else { 1277 } else {
1278 mShowAction->setText( i18n("Show...") ); 1278 mShowAction->setText( i18n("Show...") );
1279 mShowAction->setText( i18n("Edit...") ); 1279 mShowAction->setText( i18n("Edit...") );
1280 mShowAction->setText( i18n("Delete...") ); 1280 mShowAction->setText( i18n("Delete...") );
1281 1281
1282 mNewSubTodoAction->setEnabled( false ); 1282 mNewSubTodoAction->setEnabled( false );
1283 } 1283 }
1284} 1284}
1285 1285
1286void MainWindow::enableIncidenceActions( bool enabled ) 1286void MainWindow::enableIncidenceActions( bool enabled )
1287{ 1287{
1288 mShowAction->setEnabled( enabled ); 1288 mShowAction->setEnabled( enabled );
1289 mEditAction->setEnabled( enabled ); 1289 mEditAction->setEnabled( enabled );
1290 mDeleteAction->setEnabled( enabled ); 1290 mDeleteAction->setEnabled( enabled );
1291 1291
1292 mCloneAction->setEnabled( enabled ); 1292 mCloneAction->setEnabled( enabled );
1293 mMoveAction->setEnabled( enabled ); 1293 mMoveAction->setEnabled( enabled );
1294 mBeamAction->setEnabled( enabled ); 1294 mBeamAction->setEnabled( enabled );
1295 mCancelAction->setEnabled( enabled ); 1295 mCancelAction->setEnabled( enabled );
1296} 1296}
1297 1297
1298void MainWindow::importOL() 1298void MainWindow::importOL()
1299{ 1299{
1300#ifdef _WIN32_ 1300#ifdef _WIN32_
1301 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1301 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1302 id->exec(); 1302 id->exec();
1303 delete id; 1303 delete id;
1304 mView->updateView(); 1304 mView->updateView();
1305#endif 1305#endif
1306} 1306}
1307void MainWindow::importBday() 1307void MainWindow::importBday()
1308{ 1308{
1309 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1309 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1310 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1310 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1311 i18n("Import!"), i18n("Cancel"), 0, 1311 i18n("Import!"), i18n("Cancel"), 0,
1312 0, 1 ); 1312 0, 1 );
1313 if ( result == 0 ) { 1313 if ( result == 0 ) {
1314 mView->importBday(); 1314 mView->importBday();
1315 1315
1316 } 1316 }
1317 1317
1318 1318
1319} 1319}
1320void MainWindow::importQtopia() 1320void MainWindow::importQtopia()
1321{ 1321{
1322#ifndef DESKTOP_VERSION 1322#ifndef DESKTOP_VERSION
1323 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1323 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1324 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"), 1324 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"),
1325 i18n("Import!"), i18n("Cancel"), 0, 1325 i18n("Import!"), i18n("Cancel"), 0,
1326 0, 1 ); 1326 0, 1 );
1327 if ( result == 0 ) { 1327 if ( result == 0 ) {
1328 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1328 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1329 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1329 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1330 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1330 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1331 mView->importQtopia( categories, datebook, todolist ); 1331 mView->importQtopia( categories, datebook, todolist );
1332 } 1332 }
1333#else 1333#else
1334 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1334 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1335 i18n("Not supported \non desktop!\n"), 1335 i18n("Not supported \non desktop!\n"),
1336 i18n("Ok"), i18n("Cancel"), 0, 1336 i18n("Ok"), i18n("Cancel"), 0,
1337 0, 1 ); 1337 0, 1 );
1338 1338
1339#endif 1339#endif
1340} 1340}
1341 1341
1342void MainWindow::saveOnClose() 1342void MainWindow::saveOnClose()
1343{ 1343{
1344 KOPrefs *p = KOPrefs::instance(); 1344 KOPrefs *p = KOPrefs::instance();
1345 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1345 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1346 p->mToolBarUp = iconToolBar->x() > width()/2 || 1346 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1347 iconToolBar->y() > height()/2; 1347 iconToolBar->y() > height()/2;
1348 mView->writeSettings(); 1348 mView->writeSettings();
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp
index 101db57..900fc04 100644
--- a/libkcal/phoneformat.cpp
+++ b/libkcal/phoneformat.cpp
@@ -165,444 +165,444 @@ ulong PhoneFormat::getCsumEvent( Event* event )
165 attList << alarmString; 165 attList << alarmString;
166 Recurrence* rec = event->recurrence(); 166 Recurrence* rec = event->recurrence();
167 QStringList list; 167 QStringList list;
168 bool writeEndDate = false; 168 bool writeEndDate = false;
169 switch ( rec->doesRecur() ) 169 switch ( rec->doesRecur() )
170 { 170 {
171 case Recurrence::rDaily: // 0 171 case Recurrence::rDaily: // 0
172 list.append( "0" ); 172 list.append( "0" );
173 list.append( QString::number( rec->frequency() ));//12 173 list.append( QString::number( rec->frequency() ));//12
174 list.append( "0" ); 174 list.append( "0" );
175 list.append( "0" ); 175 list.append( "0" );
176 writeEndDate = true; 176 writeEndDate = true;
177 break; 177 break;
178 case Recurrence::rWeekly:// 1 178 case Recurrence::rWeekly:// 1
179 list.append( "1" ); 179 list.append( "1" );
180 list.append( QString::number( rec->frequency()) );//12 180 list.append( QString::number( rec->frequency()) );//12
181 list.append( "0" ); 181 list.append( "0" );
182 { 182 {
183 int days = 0; 183 int days = 0;
184 QBitArray weekDays = rec->days(); 184 QBitArray weekDays = rec->days();
185 int i; 185 int i;
186 for( i = 1; i <= 7; ++i ) { 186 for( i = 1; i <= 7; ++i ) {
187 if ( weekDays[i-1] ) { 187 if ( weekDays[i-1] ) {
188 days += 1 << (i-1); 188 days += 1 << (i-1);
189 } 189 }
190 } 190 }
191 list.append( QString::number( days ) ); 191 list.append( QString::number( days ) );
192 } 192 }
193 //pending weekdays 193 //pending weekdays
194 writeEndDate = true; 194 writeEndDate = true;
195 195
196 break; 196 break;
197 case Recurrence::rMonthlyPos:// 2 197 case Recurrence::rMonthlyPos:// 2
198 list.append( "2" ); 198 list.append( "2" );
199 list.append( QString::number( rec->frequency()) );//12 199 list.append( QString::number( rec->frequency()) );//12
200 200
201 writeEndDate = true; 201 writeEndDate = true;
202 { 202 {
203 int count = 1; 203 int count = 1;
204 QPtrList<Recurrence::rMonthPos> rmp; 204 QPtrList<Recurrence::rMonthPos> rmp;
205 rmp = rec->monthPositions(); 205 rmp = rec->monthPositions();
206 if ( rmp.first()->negative ) 206 if ( rmp.first()->negative )
207 count = 5 - rmp.first()->rPos - 1; 207 count = 5 - rmp.first()->rPos - 1;
208 else 208 else
209 count = rmp.first()->rPos - 1; 209 count = rmp.first()->rPos - 1;
210 list.append( QString::number( count ) ); 210 list.append( QString::number( count ) );
211 211
212 } 212 }
213 213
214 list.append( "0" ); 214 list.append( "0" );
215 break; 215 break;
216 case Recurrence::rMonthlyDay:// 3 216 case Recurrence::rMonthlyDay:// 3
217 list.append( "3" ); 217 list.append( "3" );
218 list.append( QString::number( rec->frequency()) );//12 218 list.append( QString::number( rec->frequency()) );//12
219 list.append( "0" ); 219 list.append( "0" );
220 list.append( "0" ); 220 list.append( "0" );
221 writeEndDate = true; 221 writeEndDate = true;
222 break; 222 break;
223 case Recurrence::rYearlyMonth://4 223 case Recurrence::rYearlyMonth://4
224 list.append( "4" ); 224 list.append( "4" );
225 list.append( QString::number( rec->frequency()) );//12 225 list.append( QString::number( rec->frequency()) );//12
226 list.append( "0" ); 226 list.append( "0" );
227 list.append( "0" ); 227 list.append( "0" );
228 writeEndDate = true; 228 writeEndDate = true;
229 break; 229 break;
230 230
231 default: 231 default:
232 list.append( "255" ); 232 list.append( "255" );
233 list.append( QString() ); 233 list.append( QString() );
234 list.append( "0" ); 234 list.append( "0" );
235 list.append( QString() ); 235 list.append( QString() );
236 list.append( "0" ); 236 list.append( "0" );
237 list.append( "20991231T000000" ); 237 list.append( "20991231T000000" );
238 break; 238 break;
239 } 239 }
240 if ( writeEndDate ) { 240 if ( writeEndDate ) {
241 241
242 if ( rec->endDate().isValid() ) { // 15 + 16 242 if ( rec->endDate().isValid() ) { // 15 + 16
243 list.append( "1" ); 243 list.append( "1" );
244 list.append( PhoneParser::dtToString( rec->endDate()) ); 244 list.append( PhoneParser::dtToString( rec->endDate()) );
245 } else { 245 } else {
246 list.append( "0" ); 246 list.append( "0" );
247 list.append( "20991231T000000" ); 247 list.append( "20991231T000000" );
248 } 248 }
249 249
250 } 250 }
251 attList << list.join(""); 251 attList << list.join("");
252 attList << event->categoriesStr(); 252 attList << event->categoriesStr();
253 //qDebug("csum cat %s", event->categoriesStr().latin1()); 253 //qDebug("csum cat %s", event->categoriesStr().latin1());
254 254
255 attList << event->secrecyStr(); 255 attList << event->secrecyStr();
256 return PhoneFormat::getCsum(attList ); 256 return PhoneFormat::getCsum(attList );
257} 257}
258ulong PhoneFormat::getCsum( const QStringList & attList) 258ulong PhoneFormat::getCsum( const QStringList & attList)
259{ 259{
260 int max = attList.count(); 260 int max = attList.count();
261 ulong cSum = 0; 261 ulong cSum = 0;
262 int j,k,i; 262 int j,k,i;
263 int add; 263 int add;
264 for ( i = 0; i < max ; ++i ) { 264 for ( i = 0; i < max ; ++i ) {
265 QString s = attList[i]; 265 QString s = attList[i];
266 if ( ! s.isEmpty() ){ 266 if ( ! s.isEmpty() ){
267 j = s.length(); 267 j = s.length();
268 for ( k = 0; k < j; ++k ) { 268 for ( k = 0; k < j; ++k ) {
269 int mul = k +1; 269 int mul = k +1;
270 add = s[k].unicode (); 270 add = s[k].unicode ();
271 if ( k < 16 ) 271 if ( k < 16 )
272 mul = mul * mul; 272 mul = mul * mul;
273 int ii = i+1; 273 int ii = i+1;
274 add = add * mul *ii*ii*ii; 274 add = add * mul *ii*ii*ii;
275 cSum += add; 275 cSum += add;
276 } 276 }
277 } 277 }
278 278
279 } 279 }
280 //QString dump = attList.join(","); 280 //QString dump = attList.join(",");
281 //qDebug("csum: %d %s", cSum,dump.latin1()); 281 //qDebug("csum: %d %s", cSum,dump.latin1());
282 282
283 return cSum; 283 return cSum;
284 284
285} 285}
286//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum); 286//extern "C" GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum);
287#include <stdlib.h> 287#include <stdlib.h>
288#define DEBUGMODE false 288#define DEBUGMODE false
289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal) 289bool PhoneFormat::load( Calendar *calendar, Calendar *existingCal)
290{ 290{
291 291
292 QString fileName; 292 QString fileName;
293#ifdef _WIN32_ 293#ifdef DESKTOP_VERSION
294 fileName = locateLocal("tmp", "phonefile.vcs"); 294 fileName = locateLocal("tmp", "phonefile.vcs");
295#else 295#else
296 fileName = "/tmp/phonefile.vcs"; 296 fileName = "/tmp/phonefile.vcs";
297#endif 297#endif
298 QString command; 298 QString command;
299 if ( ! PhoneAccess::readFromPhone( fileName )) { 299 if ( ! PhoneAccess::readFromPhone( fileName )) {
300 return false; 300 return false;
301 } 301 }
302 VCalFormat vfload; 302 VCalFormat vfload;
303 vfload.setLocalTime ( true ); 303 vfload.setLocalTime ( true );
304 qDebug("loading file ..."); 304 qDebug("loading file ...");
305 305
306 if ( ! vfload.load( calendar, fileName ) ) 306 if ( ! vfload.load( calendar, fileName ) )
307 return false; 307 return false;
308 QPtrList<Event> er = calendar->rawEvents(); 308 QPtrList<Event> er = calendar->rawEvents();
309 Event* ev = er.first(); 309 Event* ev = er.first();
310 qDebug("reading events... "); 310 qDebug("reading events... ");
311 while ( ev ) { 311 while ( ev ) {
312 QStringList cat = ev->categories(); 312 QStringList cat = ev->categories();
313 if ( cat.contains( "MeetingDEF" )) { 313 if ( cat.contains( "MeetingDEF" )) {
314 ev->setCategories( QStringList() ); 314 ev->setCategories( QStringList() );
315 } else 315 } else
316 if ( cat.contains( "Birthday" )) { 316 if ( cat.contains( "Birthday" )) {
317 ev->setFloats( true ); 317 ev->setFloats( true );
318 QDate da = ev->dtStart().date(); 318 QDate da = ev->dtStart().date();
319 ev->setDtStart( QDateTime( da) ); 319 ev->setDtStart( QDateTime( da) );
320 ev->setDtEnd( QDateTime( da.addDays(1)) ); 320 ev->setDtEnd( QDateTime( da.addDays(1)) );
321 321
322 } 322 }
323 uint cSum; 323 uint cSum;
324 cSum = PhoneFormat::getCsumEvent( ev ); 324 cSum = PhoneFormat::getCsumEvent( ev );
325 int id = ev->pilotId(); 325 int id = ev->pilotId();
326 Event *event; 326 Event *event;
327 event = existingCal->event( mProfileName ,QString::number( id ) ); 327 event = existingCal->event( mProfileName ,QString::number( id ) );
328 if ( event ) { 328 if ( event ) {
329 event = (Event*)event->clone(); 329 event = (Event*)event->clone();
330 copyEvent( event, ev ); 330 copyEvent( event, ev );
331 calendar->deleteEvent( ev ); 331 calendar->deleteEvent( ev );
332 calendar->addEvent( event); 332 calendar->addEvent( event);
333 } 333 }
334 else 334 else
335 event = ev; 335 event = ev;
336 event->setCsum( mProfileName, QString::number( cSum )); 336 event->setCsum( mProfileName, QString::number( cSum ));
337 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 337 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
338 event->setID( mProfileName,QString::number( id ) ); 338 event->setID( mProfileName,QString::number( id ) );
339 ev = er.next(); 339 ev = er.next();
340 } 340 }
341 { 341 {
342 qDebug("reading todos... "); 342 qDebug("reading todos... ");
343 QPtrList<Todo> tr = calendar->rawTodos(); 343 QPtrList<Todo> tr = calendar->rawTodos();
344 Todo* ev = tr.first(); 344 Todo* ev = tr.first();
345 while ( ev ) { 345 while ( ev ) {
346 346
347 QStringList cat = ev->categories(); 347 QStringList cat = ev->categories();
348 if ( cat.contains( "MeetingDEF" )) { 348 if ( cat.contains( "MeetingDEF" )) {
349 ev->setCategories( QStringList() ); 349 ev->setCategories( QStringList() );
350 } 350 }
351 int id = ev->pilotId(); 351 int id = ev->pilotId();
352 uint cSum; 352 uint cSum;
353 cSum = PhoneFormat::getCsumTodo( ev ); 353 cSum = PhoneFormat::getCsumTodo( ev );
354 Todo *event; 354 Todo *event;
355 event = existingCal->todo( mProfileName ,QString::number( id ) ); 355 event = existingCal->todo( mProfileName ,QString::number( id ) );
356 if ( event ) { 356 if ( event ) {
357 //qDebug("copy todo %s ", event->summary().latin1()); 357 //qDebug("copy todo %s ", event->summary().latin1());
358 358
359 event = (Todo*)event->clone(); 359 event = (Todo*)event->clone();
360 copyTodo( event, ev ); 360 copyTodo( event, ev );
361 calendar->deleteTodo( ev ); 361 calendar->deleteTodo( ev );
362 calendar->addTodo( event); 362 calendar->addTodo( event);
363 } 363 }
364 else 364 else
365 event = ev; 365 event = ev;
366 event->setCsum( mProfileName, QString::number( cSum )); 366 event->setCsum( mProfileName, QString::number( cSum ));
367 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); 367 event->setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
368 event->setID( mProfileName,QString::number( id ) ); 368 event->setID( mProfileName,QString::number( id ) );
369 ev = tr.next(); 369 ev = tr.next();
370 } 370 }
371 } 371 }
372 return true; 372 return true;
373} 373}
374void PhoneFormat::copyEvent( Event* to, Event* from ) 374void PhoneFormat::copyEvent( Event* to, Event* from )
375{ 375{
376 if ( from->dtStart().isValid() ) 376 if ( from->dtStart().isValid() )
377 to->setDtStart( from->dtStart() ); 377 to->setDtStart( from->dtStart() );
378 if ( from->dtEnd().isValid() ) 378 if ( from->dtEnd().isValid() )
379 to->setDtEnd( from->dtEnd() ); 379 to->setDtEnd( from->dtEnd() );
380 if ( !from->location().isEmpty() ) 380 if ( !from->location().isEmpty() )
381 to->setLocation( from->location() ); 381 to->setLocation( from->location() );
382 if ( !from->description().isEmpty() ) 382 if ( !from->description().isEmpty() )
383 to->setDescription( from->description() ); 383 to->setDescription( from->description() );
384 if ( !from->summary().isEmpty() ) 384 if ( !from->summary().isEmpty() )
385 to->setSummary( from->summary() ); 385 to->setSummary( from->summary() );
386 386
387 if ( from->alarms().count() ) { 387 if ( from->alarms().count() ) {
388 to->clearAlarms(); 388 to->clearAlarms();
389 Alarm *a = from->alarms().first(); 389 Alarm *a = from->alarms().first();
390 Alarm *b = to->newAlarm( ); 390 Alarm *b = to->newAlarm( );
391 b->setEnabled( a->enabled() ); 391 b->setEnabled( a->enabled() );
392 b->setStartOffset(Duration( a->offset() ) ); 392 b->setStartOffset(Duration( a->offset() ) );
393 393
394 } 394 }
395 QStringList cat = to->categories(); 395 QStringList cat = to->categories();
396 QStringList catFrom = from->categories(); 396 QStringList catFrom = from->categories();
397 QString nCat; 397 QString nCat;
398 int iii; 398 int iii;
399 for ( iii = 0; iii < catFrom.count();++iii ) { 399 for ( iii = 0; iii < catFrom.count();++iii ) {
400 nCat = catFrom[iii]; 400 nCat = catFrom[iii];
401 if ( !nCat.isEmpty() ) 401 if ( !nCat.isEmpty() )
402 if ( !cat.contains( nCat )) { 402 if ( !cat.contains( nCat )) {
403 cat << nCat; 403 cat << nCat;
404 } 404 }
405 } 405 }
406 to->setCategories( cat ); 406 to->setCategories( cat );
407 if ( from->doesRecur() ) { 407 if ( from->doesRecur() ) {
408 Recurrence * r = new Recurrence( *from->recurrence(),to); 408 Recurrence * r = new Recurrence( *from->recurrence(),to);
409 to->setRecurrence( r ) ; 409 to->setRecurrence( r ) ;
410 } 410 }
411 411
412 412
413} 413}
414void PhoneFormat::copyTodo( Todo* to, Todo* from ) 414void PhoneFormat::copyTodo( Todo* to, Todo* from )
415{ 415{
416 if ( from->hasStartDate() ) { 416 if ( from->hasStartDate() ) {
417 to->setHasStartDate( true ); 417 to->setHasStartDate( true );
418 to->setDtStart( from->dtStart() ); 418 to->setDtStart( from->dtStart() );
419 } 419 }
420 if ( from->hasDueDate() ){ 420 if ( from->hasDueDate() ){
421 to->setHasDueDate( true ); 421 to->setHasDueDate( true );
422 to->setDtDue( from->dtDue() ); 422 to->setDtDue( from->dtDue() );
423 } 423 }
424 if ( !from->location().isEmpty() ) 424 if ( !from->location().isEmpty() )
425 to->setLocation( from->location() ); 425 to->setLocation( from->location() );
426 if ( !from->description().isEmpty() ) 426 if ( !from->description().isEmpty() )
427 to->setDescription( from->description() ); 427 to->setDescription( from->description() );
428 if ( !from->summary().isEmpty() ) 428 if ( !from->summary().isEmpty() )
429 to->setSummary( from->summary() ); 429 to->setSummary( from->summary() );
430 430
431 if ( from->alarms().count() ) { 431 if ( from->alarms().count() ) {
432 to->clearAlarms(); 432 to->clearAlarms();
433 Alarm *a = from->alarms().first(); 433 Alarm *a = from->alarms().first();
434 Alarm *b = to->newAlarm( ); 434 Alarm *b = to->newAlarm( );
435 b->setEnabled( a->enabled() ); 435 b->setEnabled( a->enabled() );
436 b->setStartOffset(Duration( a->offset() ) ); 436 b->setStartOffset(Duration( a->offset() ) );
437 } 437 }
438 438
439 QStringList cat = to->categories(); 439 QStringList cat = to->categories();
440 QStringList catFrom = from->categories(); 440 QStringList catFrom = from->categories();
441 QString nCat; 441 QString nCat;
442 int iii; 442 int iii;
443 for ( iii = 0; iii < catFrom.count();++iii ) { 443 for ( iii = 0; iii < catFrom.count();++iii ) {
444 nCat = catFrom[iii]; 444 nCat = catFrom[iii];
445 if ( !nCat.isEmpty() ) 445 if ( !nCat.isEmpty() )
446 if ( !cat.contains( nCat )) { 446 if ( !cat.contains( nCat )) {
447 cat << nCat; 447 cat << nCat;
448 } 448 }
449 } 449 }
450 to->setCategories( cat ); 450 to->setCategories( cat );
451 if ( from->isCompleted() ) { 451 if ( from->isCompleted() ) {
452 to->setCompleted( true ); 452 to->setCompleted( true );
453 if( from->completed().isValid() ) 453 if( from->completed().isValid() )
454 to->setCompleted( from->completed() ); 454 to->setCompleted( from->completed() );
455 } else { 455 } else {
456 // set percentcomplete only, if to->isCompleted() 456 // set percentcomplete only, if to->isCompleted()
457 if ( to->isCompleted() ) 457 if ( to->isCompleted() )
458 to->setPercentComplete(from->percentComplete()); 458 to->setPercentComplete(from->percentComplete());
459 } 459 }
460 if( to->priority() == 2 && from->priority() == 1 ) 460 if( to->priority() == 2 && from->priority() == 1 )
461 ; //skip 461 ; //skip
462 else if (to->priority() == 4 && from->priority() == 5 ) 462 else if (to->priority() == 4 && from->priority() == 5 )
463 ; 463 ;
464 else 464 else
465 to->setPriority(from->priority()); 465 to->setPriority(from->priority());
466 466
467} 467}
468#include <qcstring.h> 468#include <qcstring.h>
469 469
470void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum) 470void PhoneFormat::afterSave( Incidence* inc,const QString& id ,const QString& csum)
471{ 471{
472 inc->setID( mProfileName, id ); 472 inc->setID( mProfileName, id );
473 inc->setCsum( mProfileName, csum); 473 inc->setCsum( mProfileName, csum);
474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); 474 inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID );
475 475
476} 476}
477 477
478bool PhoneFormat::writeToPhone( Calendar * calendar) 478bool PhoneFormat::writeToPhone( Calendar * calendar)
479{ 479{
480#ifdef _WIN32_ 480#ifdef DESKTOP_VERSION
481 QString fileName = locateLocal("tmp", "phonefile.vcs"); 481 QString fileName = locateLocal("tmp", "phonefile.vcs");
482#else 482#else
483 QString fileName = "/tmp/phonefile.vcs"; 483 QString fileName = "/tmp/phonefile.vcs";
484#endif 484#endif
485 485
486 VCalFormat vfsave; 486 VCalFormat vfsave;
487 vfsave.setLocalTime ( true ); 487 vfsave.setLocalTime ( true );
488 QString id = calendar->timeZoneId(); 488 QString id = calendar->timeZoneId();
489 calendar->setLocalTime(); 489 calendar->setLocalTime();
490 if ( ! vfsave.save( calendar, fileName ) ) 490 if ( ! vfsave.save( calendar, fileName ) )
491 return false; 491 return false;
492 calendar->setTimeZoneId( id ); 492 calendar->setTimeZoneId( id );
493 return PhoneAccess::writeToPhone( fileName ); 493 return PhoneAccess::writeToPhone( fileName );
494} 494}
495bool PhoneFormat::save( Calendar *calendar) 495bool PhoneFormat::save( Calendar *calendar)
496{ 496{
497 497
498 498
499 // 1 remove events which should be deleted 499 // 1 remove events which should be deleted
500 QPtrList<Event> er = calendar->rawEvents(); 500 QPtrList<Event> er = calendar->rawEvents();
501 Event* ev = er.first(); 501 Event* ev = er.first();
502 while ( ev ) { 502 while ( ev ) {
503 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 503 if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
504 calendar->deleteEvent( ev ); 504 calendar->deleteEvent( ev );
505 } else { 505 } else {
506 506
507 } 507 }
508 ev = er.next(); 508 ev = er.next();
509 } 509 }
510 // 2 remove todos which should be deleted 510 // 2 remove todos which should be deleted
511 QPtrList<Todo> tl = calendar->rawTodos(); 511 QPtrList<Todo> tl = calendar->rawTodos();
512 Todo* to = tl.first(); 512 Todo* to = tl.first();
513 while ( to ) { 513 while ( to ) {
514 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { 514 if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) {
515 calendar->deleteTodo( to ); 515 calendar->deleteTodo( to );
516 } else { 516 } else {
517 if ( to->isCompleted()) { 517 if ( to->isCompleted()) {
518 calendar->deleteTodo( to ); 518 calendar->deleteTodo( to );
519 } 519 }
520 } 520 }
521 to = tl.next(); 521 to = tl.next();
522 } 522 }
523 // 3 save file 523 // 3 save file
524 if ( !writeToPhone( calendar ) ) 524 if ( !writeToPhone( calendar ) )
525 return false; 525 return false;
526 QLabel status ( i18n(" Opening device ..."), 0 ); 526 QLabel status ( i18n(" Opening device ..."), 0 );
527 int w = status.sizeHint().width()+20 ; 527 int w = status.sizeHint().width()+20 ;
528 if ( w < 200 ) w = 230; 528 if ( w < 200 ) w = 230;
529 int h = status.sizeHint().height()+20 ; 529 int h = status.sizeHint().height()+20 ;
530 int dw = QApplication::desktop()->width(); 530 int dw = QApplication::desktop()->width();
531 int dh = QApplication::desktop()->height(); 531 int dh = QApplication::desktop()->height();
532 status.setCaption(i18n("Writing to phone...") ); 532 status.setCaption(i18n("Writing to phone...") );
533 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 533 status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
534 QString message; 534 QString message;
535 status.show(); 535 status.show();
536 status.raise(); 536 status.raise();
537 qApp->processEvents(); 537 qApp->processEvents();
538 // 5 reread data 538 // 5 reread data
539 message = i18n(" Rereading all data ... "); 539 message = i18n(" Rereading all data ... ");
540 status.setText ( message ); 540 status.setText ( message );
541 qApp->processEvents(); 541 qApp->processEvents();
542 CalendarLocal* calendarTemp = new CalendarLocal(); 542 CalendarLocal* calendarTemp = new CalendarLocal();
543 calendarTemp->setTimeZoneId( calendar->timeZoneId()); 543 calendarTemp->setTimeZoneId( calendar->timeZoneId());
544 if ( ! load( calendarTemp,calendar) ){ 544 if ( ! load( calendarTemp,calendar) ){
545 qDebug("error reloading calendar "); 545 qDebug("error reloading calendar ");
546 delete calendarTemp; 546 delete calendarTemp;
547 return false; 547 return false;
548 } 548 }
549 // 6 compare data 549 // 6 compare data
550 550
551//algo 6 compare event 551//algo 6 compare event
552 er = calendar->rawEvents(); 552 er = calendar->rawEvents();
553 ev = er.first(); 553 ev = er.first();
554 message = i18n(" Comparing event # "); 554 message = i18n(" Comparing event # ");
555 QPtrList<Event> er1 = calendarTemp->rawEvents(); 555 QPtrList<Event> er1 = calendarTemp->rawEvents();
556 Event* ev1; 556 Event* ev1;
557 int procCount = 0; 557 int procCount = 0;
558 while ( ev ) { 558 while ( ev ) {
559 //qDebug("event new ID %s",ev->summary().latin1()); 559 //qDebug("event new ID %s",ev->summary().latin1());
560 status.setText ( message + QString::number ( ++procCount ) ); 560 status.setText ( message + QString::number ( ++procCount ) );
561 qApp->processEvents(); 561 qApp->processEvents();
562 ev1 = er1.first(); 562 ev1 = er1.first();
563 while ( ev1 ) { 563 while ( ev1 ) {
564 if ( ev->contains( ev1 ) ) { 564 if ( ev->contains( ev1 ) ) {
565 afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName)); 565 afterSave( ev ,ev1->getID(mProfileName),ev1->getCsum(mProfileName));
566 er1.remove( ev1 ); 566 er1.remove( ev1 );
567 break; 567 break;
568 } 568 }
569 ev1 = er1.next(); 569 ev1 = er1.next();
570 } 570 }
571 if ( ! ev1 ) { 571 if ( ! ev1 ) {
572 // ev->removeID(mProfileName); 572 // ev->removeID(mProfileName);
573 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1()); 573 qDebug("ERROR: No event found on phone for %s ", ev->summary().latin1());
574 } 574 }
575 575
576 576
577 ev = er.next(); 577 ev = er.next();
578 } 578 }
579 //algo 6 compare todo 579 //algo 6 compare todo
580 tl = calendar->rawTodos(); 580 tl = calendar->rawTodos();
581 to = tl.first(); 581 to = tl.first();
582 procCount = 0; 582 procCount = 0;
583 QPtrList<Todo> tl1 = calendarTemp->rawTodos(); 583 QPtrList<Todo> tl1 = calendarTemp->rawTodos();
584 Todo* to1 ; 584 Todo* to1 ;
585 message = i18n(" Comparing todo # "); 585 message = i18n(" Comparing todo # ");
586 while ( to ) { 586 while ( to ) {
587 status.setText ( message + QString::number ( ++procCount ) ); 587 status.setText ( message + QString::number ( ++procCount ) );
588 qApp->processEvents(); 588 qApp->processEvents();
589 Todo* to1 = tl1.first(); 589 Todo* to1 = tl1.first();
590 while ( to1 ) { 590 while ( to1 ) {
591 if ( to->contains( to1 ) ) { 591 if ( to->contains( to1 ) ) {
592 afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName)); 592 afterSave( to ,to1->getID(mProfileName),to1->getCsum(mProfileName));
593 tl1.remove( to1 ); 593 tl1.remove( to1 );
594 break; 594 break;
595 } 595 }
596 to1 = tl1.next(); 596 to1 = tl1.next();
597 } 597 }
598 if ( ! to1 ) { 598 if ( ! to1 ) {
599 //to->removeID(mProfileName); 599 //to->removeID(mProfileName);
600 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1()); 600 qDebug("ERROR: No todo found on phone for %s ", to->summary().latin1());
601 } 601 }
602 602
603 to = tl.next(); 603 to = tl.next();
604 } 604 }
605 delete calendarTemp; 605 delete calendarTemp;
606 return true; 606 return true;
607 607
608 608
diff --git a/version b/version
index de8a794..0c43deb 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "1.9.8"; version = "1.9.9";