author | zautrix <zautrix> | 2004-10-06 16:20:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-06 16:20:25 (UTC) |
commit | 656636acfb8c607901c97c4f55129e29e1df9913 (patch) (unidiff) | |
tree | 25efd61a6b691822a11f43719efcbf69ce7d5c25 | |
parent | a22de800110d8350a5200a994b041e47d51bf4c6 (diff) | |
download | kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.zip kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.tar.gz kdepimpi-656636acfb8c607901c97c4f55129e29e1df9913.tar.bz2 |
more fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 32 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 5 | ||||
-rw-r--r-- | libkcal/libkcal.pro | 2 | ||||
-rw-r--r-- | libkcal/libkcalE.pro | 2 | ||||
-rw-r--r-- | libkcal/phoneformat.cpp | 117 | ||||
-rw-r--r-- | libkcal/phoneformat.h | 1 |
6 files changed, 22 insertions, 137 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 185cf46..7bec90a 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,105 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /*s |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qprogressbar.h> | 41 | #include <qprogressbar.h> |
42 | #include <libkdepim/phoneaccess.h> | ||
42 | 43 | ||
43 | #ifndef KAB_EMBEDDED | 44 | #ifndef KAB_EMBEDDED |
44 | #include <qclipboard.h> | 45 | #include <qclipboard.h> |
45 | #include <qdir.h> | 46 | #include <qdir.h> |
46 | #include <qfile.h> | 47 | #include <qfile.h> |
47 | #include <qapplicaton.h> | 48 | #include <qapplicaton.h> |
48 | #include <qprogressbar.h> | 49 | #include <qprogressbar.h> |
49 | #include <qlayout.h> | 50 | #include <qlayout.h> |
50 | #include <qregexp.h> | 51 | #include <qregexp.h> |
51 | #include <qvbox.h> | 52 | #include <qvbox.h> |
52 | #include <kabc/addresseelist.h> | 53 | #include <kabc/addresseelist.h> |
53 | #include <kabc/errorhandler.h> | 54 | #include <kabc/errorhandler.h> |
54 | #include <kabc/resource.h> | 55 | #include <kabc/resource.h> |
55 | #include <kabc/vcardconverter.h> | 56 | #include <kabc/vcardconverter.h> |
56 | #include <kapplication.h> | 57 | #include <kapplication.h> |
57 | #include <kactionclasses.h> | 58 | #include <kactionclasses.h> |
58 | #include <kcmultidialog.h> | 59 | #include <kcmultidialog.h> |
59 | #include <kdebug.h> | 60 | #include <kdebug.h> |
60 | #include <kdeversion.h> | 61 | #include <kdeversion.h> |
61 | #include <kkeydialog.h> | 62 | #include <kkeydialog.h> |
62 | #include <kmessagebox.h> | 63 | #include <kmessagebox.h> |
63 | #include <kprinter.h> | 64 | #include <kprinter.h> |
64 | #include <kprotocolinfo.h> | 65 | #include <kprotocolinfo.h> |
65 | #include <kresources/selectdialog.h> | 66 | #include <kresources/selectdialog.h> |
66 | #include <kstandarddirs.h> | 67 | #include <kstandarddirs.h> |
67 | #include <ktempfile.h> | 68 | #include <ktempfile.h> |
68 | #include <kxmlguiclient.h> | 69 | #include <kxmlguiclient.h> |
69 | #include <kaboutdata.h> | 70 | #include <kaboutdata.h> |
70 | #include <libkdepim/categoryselectdialog.h> | 71 | #include <libkdepim/categoryselectdialog.h> |
71 | 72 | ||
72 | #include "addresseeutil.h" | 73 | #include "addresseeutil.h" |
73 | #include "addresseeeditordialog.h" | 74 | #include "addresseeeditordialog.h" |
74 | #include "extensionmanager.h" | 75 | #include "extensionmanager.h" |
75 | #include "kstdaction.h" | 76 | #include "kstdaction.h" |
76 | #include "kaddressbookservice.h" | 77 | #include "kaddressbookservice.h" |
77 | #include "ldapsearchdialog.h" | 78 | #include "ldapsearchdialog.h" |
78 | #include "printing/printingwizard.h" | 79 | #include "printing/printingwizard.h" |
79 | #else // KAB_EMBEDDED | 80 | #else // KAB_EMBEDDED |
80 | 81 | ||
81 | #include <kapplication.h> | 82 | #include <kapplication.h> |
82 | #include "KDGanttMinimizeSplitter.h" | 83 | #include "KDGanttMinimizeSplitter.h" |
83 | #include "kaddressbookmain.h" | 84 | #include "kaddressbookmain.h" |
84 | #include "kactioncollection.h" | 85 | #include "kactioncollection.h" |
85 | #include "addresseedialog.h" | 86 | #include "addresseedialog.h" |
86 | //US | 87 | //US |
87 | #include <addresseeview.h> | 88 | #include <addresseeview.h> |
88 | 89 | ||
89 | #include <qapp.h> | 90 | #include <qapp.h> |
90 | #include <qmenubar.h> | 91 | #include <qmenubar.h> |
91 | //#include <qtoolbar.h> | 92 | //#include <qtoolbar.h> |
92 | #include <qmessagebox.h> | 93 | #include <qmessagebox.h> |
93 | #include <kdebug.h> | 94 | #include <kdebug.h> |
94 | #include <kiconloader.h> // needed for SmallIcon | 95 | #include <kiconloader.h> // needed for SmallIcon |
95 | #include <kresources/kcmkresources.h> | 96 | #include <kresources/kcmkresources.h> |
96 | #include <ktoolbar.h> | 97 | #include <ktoolbar.h> |
97 | 98 | ||
98 | 99 | ||
99 | //#include <qlabel.h> | 100 | //#include <qlabel.h> |
100 | 101 | ||
101 | 102 | ||
102 | #ifndef DESKTOP_VERSION | 103 | #ifndef DESKTOP_VERSION |
103 | #include <qpe/ir.h> | 104 | #include <qpe/ir.h> |
104 | #include <qpe/qpemenubar.h> | 105 | #include <qpe/qpemenubar.h> |
105 | #include <qtopia/qcopenvelope_qws.h> | 106 | #include <qtopia/qcopenvelope_qws.h> |
@@ -612,192 +613,187 @@ void KABCore::mailVCard( const QStringList& uids ) | |||
612 | 613 | ||
613 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 614 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
614 | KABC::VCardConverter converter; | 615 | KABC::VCardConverter converter; |
615 | QString vcard; | 616 | QString vcard; |
616 | 617 | ||
617 | converter.addresseeToVCard( a, vcard ); | 618 | converter.addresseeToVCard( a, vcard ); |
618 | 619 | ||
619 | QTextStream t( &outFile ); // use a text stream | 620 | QTextStream t( &outFile ); // use a text stream |
620 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 621 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
621 | t << vcard; | 622 | t << vcard; |
622 | 623 | ||
623 | outFile.close(); | 624 | outFile.close(); |
624 | 625 | ||
625 | urls.append( fileName ); | 626 | urls.append( fileName ); |
626 | } | 627 | } |
627 | } | 628 | } |
628 | 629 | ||
629 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 630 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
630 | 631 | ||
631 | 632 | ||
632 | /*US | 633 | /*US |
633 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 634 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
634 | QString::null, // subject | 635 | QString::null, // subject |
635 | QString::null, // body | 636 | QString::null, // body |
636 | QString::null, | 637 | QString::null, |
637 | urls ); // attachments | 638 | urls ); // attachments |
638 | */ | 639 | */ |
639 | 640 | ||
640 | } | 641 | } |
641 | 642 | ||
642 | /** | 643 | /** |
643 | Beams the "WhoAmI contact. | 644 | Beams the "WhoAmI contact. |
644 | */ | 645 | */ |
645 | void KABCore::beamMySelf() | 646 | void KABCore::beamMySelf() |
646 | { | 647 | { |
647 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 648 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
648 | if (!a.isEmpty()) | 649 | if (!a.isEmpty()) |
649 | { | 650 | { |
650 | QStringList uids; | 651 | QStringList uids; |
651 | uids << a.uid(); | 652 | uids << a.uid(); |
652 | 653 | ||
653 | beamVCard(uids); | 654 | beamVCard(uids); |
654 | } else { | 655 | } else { |
655 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 656 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
656 | 657 | ||
657 | 658 | ||
658 | } | 659 | } |
659 | } | 660 | } |
660 | 661 | ||
661 | void KABCore::export2phone() | 662 | void KABCore::export2phone() |
662 | { | 663 | { |
663 | 664 | ||
664 | KAex2phonePrefs ex2phone; | 665 | KAex2phonePrefs ex2phone; |
665 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 666 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
666 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 667 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
667 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 668 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
668 | 669 | ||
669 | if ( !ex2phone.exec() ) { | 670 | if ( !ex2phone.exec() ) { |
670 | return; | 671 | return; |
671 | } | 672 | } |
672 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 673 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
673 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 674 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
674 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 675 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
675 | 676 | ||
676 | #if 0 | 677 | |
677 | PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 678 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
678 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 679 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
679 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 680 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
680 | 681 | ||
682 | QStringList uids = mViewManager->selectedUids(); | ||
683 | if ( uids.isEmpty() ) | ||
684 | return; | ||
681 | 685 | ||
686 | #ifdef _WIN32_ | ||
687 | QString fileName = locateLocal("tmp", "tempfile.vcf"); | ||
688 | #else | ||
689 | QString fileName = "/tmp/kdepimtemp.vcf"; | ||
690 | #endif | ||
682 | 691 | ||
683 | |||
684 | |||
685 | QString fileName = "/tmp/kapibeamfile.vcf"; | ||
686 | |||
687 | |||
688 | //QDir().mkdir( dirName, true ); | ||
689 | |||
690 | |||
691 | KABC::VCardConverter converter; | 692 | KABC::VCardConverter converter; |
692 | QString description; | 693 | QString description; |
693 | QString datastream; | 694 | QString datastream; |
694 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 695 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
695 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 696 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
696 | 697 | ||
697 | if ( a.isEmpty() ) | 698 | if ( a.isEmpty() ) |
698 | continue; | 699 | continue; |
699 | 700 | ||
700 | if (description.isEmpty()) | 701 | if (description.isEmpty()) |
701 | description = a.formattedName(); | 702 | description = a.formattedName(); |
702 | 703 | ||
703 | QString vcard; | 704 | QString vcard; |
704 | converter.addresseeToVCard( a, vcard ); | 705 | converter.addresseeToVCard( a, vcard ); |
705 | int start = 0; | 706 | int start = 0; |
706 | int next; | 707 | int next; |
707 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 708 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
708 | int semi = vcard.find(";", next); | 709 | int semi = vcard.find(";", next); |
709 | int dopp = vcard.find(":", next); | 710 | int dopp = vcard.find(":", next); |
710 | int sep; | 711 | int sep; |
711 | if ( semi < dopp && semi >= 0 ) | 712 | if ( semi < dopp && semi >= 0 ) |
712 | sep = semi ; | 713 | sep = semi ; |
713 | else | 714 | else |
714 | sep = dopp; | 715 | sep = dopp; |
715 | datastream +=vcard.mid( start, next - start); | 716 | datastream +=vcard.mid( start, next - start); |
716 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 717 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
717 | start = sep; | 718 | start = sep; |
718 | } | 719 | } |
719 | datastream += vcard.mid( start,vcard.length() ); | 720 | datastream += vcard.mid( start,vcard.length() ); |
720 | } | 721 | } |
721 | #ifndef DESKTOP_VERSION | ||
722 | QFile outFile(fileName); | 722 | QFile outFile(fileName); |
723 | if ( outFile.open(IO_WriteOnly) ) { | 723 | if ( outFile.open(IO_WriteOnly) ) { |
724 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 724 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
725 | QTextStream t( &outFile ); // use a text stream | 725 | QTextStream t( &outFile ); // use a text stream |
726 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 726 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
727 | t <<datastream; | 727 | t <<datastream; |
728 | outFile.close(); | 728 | outFile.close(); |
729 | Ir *ir = new Ir( this ); | ||
730 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | ||
731 | ir->send( fileName, description, "text/x-vCard" ); | ||
732 | } else { | 729 | } else { |
733 | qDebug("Error open temp beam file "); | 730 | qDebug("Error open temp file "); |
734 | return; | 731 | return; |
735 | } | 732 | } |
736 | #endif | ||
737 | |||
738 | 733 | ||
739 | 734 | ||
735 | #if 0 | ||
740 | 736 | ||
741 | setCaption( i18n("Writing to phone...")); | 737 | setCaption( i18n("Writing to phone...")); |
742 | if ( PhoneFormat::writeToPhone( cal ) ) | 738 | if ( PhoneFormat::writeToPhone( cal ) ) |
743 | setCaption( i18n("Export to phone successful!")); | 739 | setCaption( i18n("Export to phone successful!")); |
744 | else | 740 | else |
745 | setCaption( i18n("Error exporting to phone!")); | 741 | setCaption( i18n("Error exporting to phone!")); |
746 | #endif | 742 | #endif |
747 | 743 | ||
748 | 744 | ||
749 | } | 745 | } |
750 | void KABCore::beamVCard() | 746 | void KABCore::beamVCard() |
751 | { | 747 | { |
752 | QStringList uids = mViewManager->selectedUids(); | 748 | QStringList uids = mViewManager->selectedUids(); |
753 | if ( !uids.isEmpty() ) | 749 | if ( !uids.isEmpty() ) |
754 | beamVCard( uids ); | 750 | beamVCard( uids ); |
755 | } | 751 | } |
756 | 752 | ||
757 | 753 | ||
758 | void KABCore::beamVCard(const QStringList& uids) | 754 | void KABCore::beamVCard(const QStringList& uids) |
759 | { | 755 | { |
760 | /*US | 756 | /*US |
761 | QString beamFilename; | 757 | QString beamFilename; |
762 | Opie::OPimContact c; | 758 | Opie::OPimContact c; |
763 | if ( actionPersonal->isOn() ) { | 759 | if ( actionPersonal->isOn() ) { |
764 | beamFilename = addressbookPersonalVCardName(); | 760 | beamFilename = addressbookPersonalVCardName(); |
765 | if ( !QFile::exists( beamFilename ) ) | 761 | if ( !QFile::exists( beamFilename ) ) |
766 | return; // can't beam a non-existent file | 762 | return; // can't beam a non-existent file |
767 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 763 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
768 | beamFilename ); | 764 | beamFilename ); |
769 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 765 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
770 | Opie::OPimContactAccess::List allList = access->allRecords(); | 766 | Opie::OPimContactAccess::List allList = access->allRecords(); |
771 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first | 767 | Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first |
772 | c = *it; | 768 | c = *it; |
773 | 769 | ||
774 | delete access; | 770 | delete access; |
775 | } else { | 771 | } else { |
776 | unlink( beamfile ); // delete if exists | 772 | unlink( beamfile ); // delete if exists |
777 | mkdir("/tmp/obex/", 0755); | 773 | mkdir("/tmp/obex/", 0755); |
778 | c = m_abView -> currentEntry(); | 774 | c = m_abView -> currentEntry(); |
779 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, | 775 | Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, |
780 | beamfile ); | 776 | beamfile ); |
781 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); | 777 | Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); |
782 | access->add( c ); | 778 | access->add( c ); |
783 | access->save(); | 779 | access->save(); |
784 | delete access; | 780 | delete access; |
785 | 781 | ||
786 | beamFilename = beamfile; | 782 | beamFilename = beamfile; |
787 | } | 783 | } |
788 | 784 | ||
789 | owarn << "Beaming: " << beamFilename << oendl; | 785 | owarn << "Beaming: " << beamFilename << oendl; |
790 | */ | 786 | */ |
791 | 787 | ||
792 | #if 0 | 788 | #if 0 |
793 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 789 | QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
794 | 790 | ||
795 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); | 791 | QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); |
796 | 792 | ||
797 | QString name = "contact.vcf"; | 793 | QString name = "contact.vcf"; |
798 | 794 | ||
799 | QString fileName = dirName + "/" + name; | 795 | QString fileName = dirName + "/" + name; |
800 | #endif | 796 | #endif |
801 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory | 797 | // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory |
802 | // | 798 | // |
803 | QString fileName = "/tmp/kapibeamfile.vcf"; | 799 | QString fileName = "/tmp/kapibeamfile.vcf"; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2f286e0..ec69b11 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,105 +1,106 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | ||
42 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
43 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
44 | 45 | ||
45 | #include "calendarview.h" | 46 | #include "calendarview.h" |
46 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
47 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
48 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
49 | #include "koagenda.h" | 50 | #include "koagenda.h" |
50 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
51 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
52 | #include "kapplication.h" | 53 | #include "kapplication.h" |
53 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
54 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
55 | #include "koprefs.h" | 56 | #include "koprefs.h" |
56 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
57 | #include "koglobals.h" | 58 | #include "koglobals.h" |
58 | #include "kglobal.h" | 59 | #include "kglobal.h" |
59 | #include "klocale.h" | 60 | #include "klocale.h" |
60 | #include "kconfig.h" | 61 | #include "kconfig.h" |
61 | #include "simplealarmclient.h" | 62 | #include "simplealarmclient.h" |
62 | #include "externalapphandler.h" | 63 | #include "externalapphandler.h" |
63 | 64 | ||
64 | using namespace KCal; | 65 | using namespace KCal; |
65 | #ifndef _WIN32_ | 66 | #ifndef _WIN32_ |
66 | #include <unistd.h> | 67 | #include <unistd.h> |
67 | #else | 68 | #else |
68 | #include "koimportoldialog.h" | 69 | #include "koimportoldialog.h" |
69 | #endif | 70 | #endif |
70 | #include "mainwindow.h" | 71 | #include "mainwindow.h" |
71 | 72 | ||
72 | class KOex2phonePrefs : public QDialog | 73 | class KOex2phonePrefs : public QDialog |
73 | { | 74 | { |
74 | public: | 75 | public: |
75 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 76 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
76 | QDialog( parent, name, true ) | 77 | QDialog( parent, name, true ) |
77 | { | 78 | { |
78 | setCaption( i18n("Export to phone options") ); | 79 | setCaption( i18n("Export to phone options") ); |
79 | QVBoxLayout* lay = new QVBoxLayout( this ); | 80 | QVBoxLayout* lay = new QVBoxLayout( this ); |
80 | lay->setSpacing( 3 ); | 81 | lay->setSpacing( 3 ); |
81 | lay->setMargin( 3 ); | 82 | lay->setMargin( 3 ); |
82 | QLabel *lab; | 83 | QLabel *lab; |
83 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 84 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
84 | lab->setAlignment (AlignHCenter ); | 85 | lab->setAlignment (AlignHCenter ); |
85 | QHBox* temphb; | 86 | QHBox* temphb; |
86 | temphb = new QHBox( this ); | 87 | temphb = new QHBox( this ); |
87 | new QLabel( i18n("I/O device: "), temphb ); | 88 | new QLabel( i18n("I/O device: "), temphb ); |
88 | mPhoneDevice = new QLineEdit( temphb); | 89 | mPhoneDevice = new QLineEdit( temphb); |
89 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
90 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
91 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
92 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
93 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
94 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
95 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
96 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
97 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
98 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
99 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
100 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
101 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
102 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
103 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
104 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
105 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
@@ -1171,130 +1172,130 @@ void MainWindow::slotSyncMenu( int action ) | |||
1171 | } | 1172 | } |
1172 | void MainWindow::exportToPhone( int mode ) | 1173 | void MainWindow::exportToPhone( int mode ) |
1173 | { | 1174 | { |
1174 | 1175 | ||
1175 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1176 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1176 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1177 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1177 | KOex2phonePrefs ex2phone; | 1178 | KOex2phonePrefs ex2phone; |
1178 | 1179 | ||
1179 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1180 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1180 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1181 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1181 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1182 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1182 | if ( mode == 1 ) | 1183 | if ( mode == 1 ) |
1183 | ex2phone.setCaption(i18n("Export complete calendar")); | 1184 | ex2phone.setCaption(i18n("Export complete calendar")); |
1184 | if ( mode == 2 ) | 1185 | if ( mode == 2 ) |
1185 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1186 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1186 | 1187 | ||
1187 | if ( !ex2phone.exec() ) { | 1188 | if ( !ex2phone.exec() ) { |
1188 | return; | 1189 | return; |
1189 | } | 1190 | } |
1190 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1191 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1191 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1192 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1192 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1193 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1193 | 1194 | ||
1194 | int inFuture = 0; | 1195 | int inFuture = 0; |
1195 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1196 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1196 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1197 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1197 | QPtrList<Incidence> delSel; | 1198 | QPtrList<Incidence> delSel; |
1198 | if ( mode == 1 ) | 1199 | if ( mode == 1 ) |
1199 | delSel = mCalendar->rawIncidences(); | 1200 | delSel = mCalendar->rawIncidences(); |
1200 | if ( mode == 2 ) | 1201 | if ( mode == 2 ) |
1201 | delSel = mCalendar->incidences(); | 1202 | delSel = mCalendar->incidences(); |
1202 | CalendarLocal* cal = new CalendarLocal(); | 1203 | CalendarLocal* cal = new CalendarLocal(); |
1203 | cal->setLocalTime(); | 1204 | cal->setLocalTime(); |
1204 | Incidence *incidence = delSel.first(); | 1205 | Incidence *incidence = delSel.first(); |
1205 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1206 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1206 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1207 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1207 | while ( incidence ) { | 1208 | while ( incidence ) { |
1208 | if ( incidence->type() != "Journal" ) { | 1209 | if ( incidence->type() != "Journal" ) { |
1209 | bool add = true; | 1210 | bool add = true; |
1210 | if ( inFuture ) { | 1211 | if ( inFuture ) { |
1211 | QDateTime dt; | 1212 | QDateTime dt; |
1212 | if ( incidence->type() == "Todo" ) { | 1213 | if ( incidence->type() == "Todo" ) { |
1213 | Todo * t = (Todo*)incidence; | 1214 | Todo * t = (Todo*)incidence; |
1214 | if ( t->hasDueDate() ) | 1215 | if ( t->hasDueDate() ) |
1215 | dt = t->dtDue(); | 1216 | dt = t->dtDue(); |
1216 | else | 1217 | else |
1217 | dt = cur.addSecs( 62 ); | 1218 | dt = cur.addSecs( 62 ); |
1218 | } | 1219 | } |
1219 | else { | 1220 | else { |
1220 | bool ok; | 1221 | bool ok; |
1221 | dt = incidence->getNextOccurence( cur, &ok ); | 1222 | dt = incidence->getNextOccurence( cur, &ok ); |
1222 | if ( !ok ) | 1223 | if ( !ok ) |
1223 | dt = cur.addSecs( -62 ); | 1224 | dt = cur.addSecs( -62 ); |
1224 | } | 1225 | } |
1225 | if ( dt < cur || dt > end ) { | 1226 | if ( dt < cur || dt > end ) { |
1226 | add = false; | 1227 | add = false; |
1227 | } | 1228 | } |
1228 | } | 1229 | } |
1229 | if ( add ) { | 1230 | if ( add ) { |
1230 | Incidence *in = incidence->clone(); | 1231 | Incidence *in = incidence->clone(); |
1231 | cal->addIncidence( in ); | 1232 | cal->addIncidence( in ); |
1232 | } | 1233 | } |
1233 | } | 1234 | } |
1234 | incidence = delSel.next(); | 1235 | incidence = delSel.next(); |
1235 | } | 1236 | } |
1236 | PhoneFormat::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1237 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1237 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1238 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1238 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1239 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1239 | 1240 | ||
1240 | setCaption( i18n("Writing to phone...")); | 1241 | setCaption( i18n("Writing to phone...")); |
1241 | if ( PhoneFormat::writeToPhone( cal ) ) | 1242 | if ( PhoneFormat::writeToPhone( cal ) ) |
1242 | setCaption( i18n("Export to phone successful!")); | 1243 | setCaption( i18n("Export to phone successful!")); |
1243 | else | 1244 | else |
1244 | setCaption( i18n("Error exporting to phone!")); | 1245 | setCaption( i18n("Error exporting to phone!")); |
1245 | delete cal; | 1246 | delete cal; |
1246 | } | 1247 | } |
1247 | 1248 | ||
1248 | 1249 | ||
1249 | void MainWindow::setDefaultPreferences() | 1250 | void MainWindow::setDefaultPreferences() |
1250 | { | 1251 | { |
1251 | KOPrefs *p = KOPrefs::instance(); | 1252 | KOPrefs *p = KOPrefs::instance(); |
1252 | 1253 | ||
1253 | p->mCompactDialogs = true; | 1254 | p->mCompactDialogs = true; |
1254 | p->mConfirm = true; | 1255 | p->mConfirm = true; |
1255 | // p->mEnableQuickTodo = false; | 1256 | // p->mEnableQuickTodo = false; |
1256 | 1257 | ||
1257 | } | 1258 | } |
1258 | 1259 | ||
1259 | QString MainWindow::resourcePath() | 1260 | QString MainWindow::resourcePath() |
1260 | { | 1261 | { |
1261 | return KGlobal::iconLoader()->iconPath(); | 1262 | return KGlobal::iconLoader()->iconPath(); |
1262 | } | 1263 | } |
1263 | 1264 | ||
1264 | void MainWindow::displayText( QString text ,QString cap ) | 1265 | void MainWindow::displayText( QString text ,QString cap ) |
1265 | { | 1266 | { |
1266 | QDialog dia( this, "name", true ); ; | 1267 | QDialog dia( this, "name", true ); ; |
1267 | dia.setCaption( cap ); | 1268 | dia.setCaption( cap ); |
1268 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1269 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1269 | lay->setSpacing( 3 ); | 1270 | lay->setSpacing( 3 ); |
1270 | lay->setMargin( 3 ); | 1271 | lay->setMargin( 3 ); |
1271 | QTextBrowser tb ( &dia ); | 1272 | QTextBrowser tb ( &dia ); |
1272 | lay->addWidget( &tb ); | 1273 | lay->addWidget( &tb ); |
1273 | tb.setText( text ); | 1274 | tb.setText( text ); |
1274 | #ifdef DESKTOP_VERSION | 1275 | #ifdef DESKTOP_VERSION |
1275 | dia.resize( 640, 480); | 1276 | dia.resize( 640, 480); |
1276 | #else | 1277 | #else |
1277 | dia.showMaximized(); | 1278 | dia.showMaximized(); |
1278 | #endif | 1279 | #endif |
1279 | dia.exec(); | 1280 | dia.exec(); |
1280 | } | 1281 | } |
1281 | void MainWindow::displayFile( QString fn, QString cap ) | 1282 | void MainWindow::displayFile( QString fn, QString cap ) |
1282 | { | 1283 | { |
1283 | QString fileName = resourcePath() + fn; | 1284 | QString fileName = resourcePath() + fn; |
1284 | QString text; | 1285 | QString text; |
1285 | QFile file( fileName ); | 1286 | QFile file( fileName ); |
1286 | if (!file.open( IO_ReadOnly ) ) { | 1287 | if (!file.open( IO_ReadOnly ) ) { |
1287 | return ; | 1288 | return ; |
1288 | 1289 | ||
1289 | } | 1290 | } |
1290 | QTextStream ts( &file ); | 1291 | QTextStream ts( &file ); |
1291 | text = ts.read(); | 1292 | text = ts.read(); |
1292 | file.close(); | 1293 | file.close(); |
1293 | displayText( text, cap); | 1294 | displayText( text, cap); |
1294 | } | 1295 | } |
1295 | void MainWindow::features() | 1296 | void MainWindow::features() |
1296 | { | 1297 | { |
1297 | 1298 | ||
1298 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1299 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1299 | } | 1300 | } |
1300 | 1301 | ||
diff --git a/libkcal/libkcal.pro b/libkcal/libkcal.pro index 7a0bd22..171c726 100644 --- a/libkcal/libkcal.pro +++ b/libkcal/libkcal.pro | |||
@@ -1,71 +1,71 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkcal | 3 | TARGET = microkcal |
4 | 4 | ||
5 | include( ../variables.pri ) | 5 | include( ../variables.pri ) |
6 | 6 | ||
7 | INCLUDEPATH += ../microkde versit ../microkde/kdecore | 7 | INCLUDEPATH += ../libkdepim ../microkde versit ../microkde/kdecore |
8 | #../qtcompat | 8 | #../qtcompat |
9 | INCLUDEPATH += ../libical/src/libical | 9 | INCLUDEPATH += ../libical/src/libical |
10 | INCLUDEPATH += ../libical/src/libicalss | 10 | INCLUDEPATH += ../libical/src/libicalss |
11 | DESTDIR = ../bin | 11 | DESTDIR = ../bin |
12 | DEFINES += DESKTOP_VERSION | 12 | DEFINES += DESKTOP_VERSION |
13 | unix: { | 13 | unix: { |
14 | LIBS += ../libical/lib/libical.a | 14 | LIBS += ../libical/lib/libical.a |
15 | LIBS += ../libical/lib/libicalss.a | 15 | LIBS += ../libical/lib/libicalss.a |
16 | OBJECTS_DIR = obj/unix | 16 | OBJECTS_DIR = obj/unix |
17 | MOC_DIR = moc/unix | 17 | MOC_DIR = moc/unix |
18 | } | 18 | } |
19 | win32: { | 19 | win32: { |
20 | DEFINES += _WIN32_ | 20 | DEFINES += _WIN32_ |
21 | 21 | ||
22 | LIBS += ../libical/lib/ical.lib | 22 | LIBS += ../libical/lib/ical.lib |
23 | LIBS += ../libical/lib/icalss.lib | 23 | LIBS += ../libical/lib/icalss.lib |
24 | OBJECTS_DIR = obj/win | 24 | OBJECTS_DIR = obj/win |
25 | MOC_DIR = moc/win | 25 | MOC_DIR = moc/win |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | INTERFACES = \ | 29 | INTERFACES = \ |
30 | 30 | ||
31 | HEADERS = \ | 31 | HEADERS = \ |
32 | alarm.h \ | 32 | alarm.h \ |
33 | attachment.h \ | 33 | attachment.h \ |
34 | attendee.h \ | 34 | attendee.h \ |
35 | calendar.h \ | 35 | calendar.h \ |
36 | calendarlocal.h \ | 36 | calendarlocal.h \ |
37 | calfilter.h \ | 37 | calfilter.h \ |
38 | calformat.h \ | 38 | calformat.h \ |
39 | calstorage.h \ | 39 | calstorage.h \ |
40 | compat.h \ | 40 | compat.h \ |
41 | customproperties.h \ | 41 | customproperties.h \ |
42 | dummyscheduler.h \ | 42 | dummyscheduler.h \ |
43 | kincidenceformatter.h \ | 43 | kincidenceformatter.h \ |
44 | duration.h \ | 44 | duration.h \ |
45 | event.h \ | 45 | event.h \ |
46 | exceptions.h \ | 46 | exceptions.h \ |
47 | filestorage.h \ | 47 | filestorage.h \ |
48 | freebusy.h \ | 48 | freebusy.h \ |
49 | icaldrag.h \ | 49 | icaldrag.h \ |
50 | icalformat.h \ | 50 | icalformat.h \ |
51 | icalformatimpl.h \ | 51 | icalformatimpl.h \ |
52 | imipscheduler.h \ | 52 | imipscheduler.h \ |
53 | incidence.h \ | 53 | incidence.h \ |
54 | incidencebase.h \ | 54 | incidencebase.h \ |
55 | journal.h \ | 55 | journal.h \ |
56 | period.h \ | 56 | period.h \ |
57 | person.h \ | 57 | person.h \ |
58 | qtopiaformat.h \ | 58 | qtopiaformat.h \ |
59 | recurrence.h \ | 59 | recurrence.h \ |
60 | scheduler.h \ | 60 | scheduler.h \ |
61 | todo.h \ | 61 | todo.h \ |
62 | vcaldrag.h \ | 62 | vcaldrag.h \ |
63 | vcalformat.h \ | 63 | vcalformat.h \ |
64 | versit/port.h \ | 64 | versit/port.h \ |
65 | versit/vcc.h \ | 65 | versit/vcc.h \ |
66 | versit/vobject.h \ | 66 | versit/vobject.h \ |
67 | phoneformat.h \ | 67 | phoneformat.h \ |
68 | 68 | ||
69 | 69 | ||
70 | 70 | ||
71 | SOURCES = \ | 71 | SOURCES = \ |
diff --git a/libkcal/libkcalE.pro b/libkcal/libkcalE.pro index e379b95..e42dc9c 100644 --- a/libkcal/libkcalE.pro +++ b/libkcal/libkcalE.pro | |||
@@ -1,69 +1,69 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = komicrokcal | 3 | TARGET = komicrokcal |
4 | 4 | ||
5 | INCLUDEPATH += ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include | 5 | INCLUDEPATH += ../libkdepim ../microkde ../qtcompat versit ../microkde/kdecore $(QPEDIR)/include |
6 | INCLUDEPATH += ../libical/src/libical | 6 | INCLUDEPATH += ../libical/src/libical |
7 | INCLUDEPATH += ../libical/src/libicalss | 7 | INCLUDEPATH += ../libical/src/libicalss |
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR = $(QPEDIR)/lib | 10 | DESTDIR = $(QPEDIR)/lib |
11 | LIBS += ../libical/lib/$(PLATFORM)/libical.a | 11 | LIBS += ../libical/lib/$(PLATFORM)/libical.a |
12 | LIBS += ../libical/lib/$(PLATFORM)/libicalss.a | 12 | LIBS += ../libical/lib/$(PLATFORM)/libicalss.a |
13 | 13 | ||
14 | INTERFACES = \ | 14 | INTERFACES = \ |
15 | 15 | ||
16 | HEADERS = \ | 16 | HEADERS = \ |
17 | alarm.h \ | 17 | alarm.h \ |
18 | attachment.h \ | 18 | attachment.h \ |
19 | attendee.h \ | 19 | attendee.h \ |
20 | calendar.h \ | 20 | calendar.h \ |
21 | calendarlocal.h \ | 21 | calendarlocal.h \ |
22 | calfilter.h \ | 22 | calfilter.h \ |
23 | calformat.h \ | 23 | calformat.h \ |
24 | calstorage.h \ | 24 | calstorage.h \ |
25 | compat.h \ | 25 | compat.h \ |
26 | customproperties.h \ | 26 | customproperties.h \ |
27 | dummyscheduler.h \ | 27 | dummyscheduler.h \ |
28 | duration.h \ | 28 | duration.h \ |
29 | event.h \ | 29 | event.h \ |
30 | exceptions.h \ | 30 | exceptions.h \ |
31 | filestorage.h \ | 31 | filestorage.h \ |
32 | freebusy.h \ | 32 | freebusy.h \ |
33 | icaldrag.h \ | 33 | icaldrag.h \ |
34 | icalformat.h \ | 34 | icalformat.h \ |
35 | icalformatimpl.h \ | 35 | icalformatimpl.h \ |
36 | imipscheduler.h \ | 36 | imipscheduler.h \ |
37 | incidence.h \ | 37 | incidence.h \ |
38 | incidencebase.h \ | 38 | incidencebase.h \ |
39 | kincidenceformatter.h \ | 39 | kincidenceformatter.h \ |
40 | journal.h \ | 40 | journal.h \ |
41 | period.h \ | 41 | period.h \ |
42 | person.h \ | 42 | person.h \ |
43 | qtopiaformat.h \ | 43 | qtopiaformat.h \ |
44 | sharpformat.h \ | 44 | sharpformat.h \ |
45 | phoneformat.h \ | 45 | phoneformat.h \ |
46 | recurrence.h \ | 46 | recurrence.h \ |
47 | scheduler.h \ | 47 | scheduler.h \ |
48 | todo.h \ | 48 | todo.h \ |
49 | vcaldrag.h \ | 49 | vcaldrag.h \ |
50 | vcalformat.h \ | 50 | vcalformat.h \ |
51 | versit/port.h \ | 51 | versit/port.h \ |
52 | versit/vcc.h \ | 52 | versit/vcc.h \ |
53 | versit/vobject.h \ | 53 | versit/vobject.h \ |
54 | 54 | ||
55 | SOURCES = \ | 55 | SOURCES = \ |
56 | alarm.cpp \ | 56 | alarm.cpp \ |
57 | attachment.cpp \ | 57 | attachment.cpp \ |
58 | attendee.cpp \ | 58 | attendee.cpp \ |
59 | calendar.cpp \ | 59 | calendar.cpp \ |
60 | calendarlocal.cpp \ | 60 | calendarlocal.cpp \ |
61 | calfilter.cpp \ | 61 | calfilter.cpp \ |
62 | calformat.cpp \ | 62 | calformat.cpp \ |
63 | compat.cpp \ | 63 | compat.cpp \ |
64 | customproperties.cpp \ | 64 | customproperties.cpp \ |
65 | dummyscheduler.cpp \ | 65 | dummyscheduler.cpp \ |
66 | duration.cpp \ | 66 | duration.cpp \ |
67 | event.cpp \ | 67 | event.cpp \ |
68 | exceptions.cpp \ | 68 | exceptions.cpp \ |
69 | filestorage.cpp \ | 69 | filestorage.cpp \ |
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index b2a62b1..c39413e 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -1,255 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 4 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qdatetime.h> | 22 | #include <qdatetime.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qptrlist.h> | 25 | #include <qptrlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
28 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qtextcodec.h> | 31 | #include <qtextcodec.h> |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | 34 | ||
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | #include <kglobal.h> | 37 | #include <kglobal.h> |
38 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
39 | #include <phoneaccess.h> | ||
39 | 40 | ||
40 | #include "calendar.h" | 41 | #include "calendar.h" |
41 | #include "alarm.h" | 42 | #include "alarm.h" |
42 | #include "recurrence.h" | 43 | #include "recurrence.h" |
43 | #include "calendarlocal.h" | 44 | #include "calendarlocal.h" |
44 | 45 | ||
45 | #include "phoneformat.h" | 46 | #include "phoneformat.h" |
46 | #include "syncdefines.h" | 47 | #include "syncdefines.h" |
47 | 48 | ||
48 | using namespace KCal; | 49 | using namespace KCal; |
49 | class PhoneParser : public QObject | 50 | class PhoneParser : public QObject |
50 | { | 51 | { |
51 | public: | 52 | public: |
52 | PhoneParser( ) { | 53 | PhoneParser( ) { |
53 | ; | 54 | ; |
54 | } | 55 | } |
55 | 56 | ||
56 | static QString dtToString( const QDateTime& dti, bool useTZ = false ) | 57 | static QString dtToString( const QDateTime& dti, bool useTZ = false ) |
57 | { | 58 | { |
58 | QString datestr; | 59 | QString datestr; |
59 | QString timestr; | 60 | QString timestr; |
60 | int offset = KGlobal::locale()->localTimeOffset( dti ); | 61 | int offset = KGlobal::locale()->localTimeOffset( dti ); |
61 | QDateTime dt; | 62 | QDateTime dt; |
62 | if (useTZ) | 63 | if (useTZ) |
63 | dt = dti.addSecs ( -(offset*60)); | 64 | dt = dti.addSecs ( -(offset*60)); |
64 | else | 65 | else |
65 | dt = dti; | 66 | dt = dti; |
66 | if(dt.date().isValid()){ | 67 | if(dt.date().isValid()){ |
67 | const QDate& date = dt.date(); | 68 | const QDate& date = dt.date(); |
68 | datestr.sprintf("%04d%02d%02d", | 69 | datestr.sprintf("%04d%02d%02d", |
69 | date.year(), date.month(), date.day()); | 70 | date.year(), date.month(), date.day()); |
70 | } | 71 | } |
71 | if(dt.time().isValid()){ | 72 | if(dt.time().isValid()){ |
72 | const QTime& time = dt.time(); | 73 | const QTime& time = dt.time(); |
73 | timestr.sprintf("T%02d%02d%02d", | 74 | timestr.sprintf("T%02d%02d%02d", |
74 | time.hour(), time.minute(), time.second()); | 75 | time.hour(), time.minute(), time.second()); |
75 | } | 76 | } |
76 | return datestr + timestr; | 77 | return datestr + timestr; |
77 | } | 78 | } |
78 | 79 | ||
79 | 80 | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | 83 | ||
83 | 84 | ||
84 | PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, QString model ) | 85 | PhoneFormat::PhoneFormat(QString profileName, QString device,QString connection, QString model ) |
85 | { | 86 | { |
86 | mProfileName = profileName; | 87 | mProfileName = profileName; |
87 | writeConfig( device, connection, model ); | 88 | PhoneAccess::writeConfig( device, connection, model ); |
88 | } | 89 | } |
89 | 90 | ||
90 | PhoneFormat::~PhoneFormat() | 91 | PhoneFormat::~PhoneFormat() |
91 | { | 92 | { |
92 | } | 93 | } |
93 | void PhoneFormat::writeConfig( QString device, QString connection, QString model ) | ||
94 | { | ||
95 | #ifdef _WIN32_ | ||
96 | QString fileName = qApp->applicationDirPath () +"\\gammurc"; | ||
97 | #else | ||
98 | QString fileName = QDir::homeDirPath() +"/.gammurc"; | ||
99 | #endif | ||
100 | //qDebug("save %d ", load ); | ||
101 | QString content; | ||
102 | bool write = false; | ||
103 | bool addPort = true, addConnection = true, addModel = true; | ||
104 | QFile file( fileName ); | ||
105 | if ( QFile::exists( fileName) ) { | ||
106 | if (!file.open( IO_ReadOnly ) ) { | ||
107 | qDebug("Error: cannot open %s ", fileName.latin1() ); | ||
108 | return; | ||
109 | } | ||
110 | QString line; | ||
111 | while ( file.readLine( line, 1024 ) > 0 ) { | ||
112 | //qDebug("*%s* ", line.latin1() ); | ||
113 | if ( line.left(7 ) == "[gammu]" ) { | ||
114 | ; | ||
115 | } else | ||
116 | if ( line.left(4 ) == "port" ) { | ||
117 | if ( line == "port = " + device+"\n" ) { | ||
118 | content += line ; | ||
119 | addPort = false; | ||
120 | //qDebug("port found" ); | ||
121 | } | ||
122 | |||
123 | } else if ( line.left(5 ) == "model" ) { | ||
124 | if ( line == "model = " + model +"\n") { | ||
125 | content += line ; | ||
126 | addModel = false; | ||
127 | //qDebug("model found" ); | ||
128 | } | ||
129 | |||
130 | } else if ( line.left( 10 ) == "connection" ) { | ||
131 | if ( line == "connection = " + connection +"\n") { | ||
132 | addConnection = false; | ||
133 | content += line ; | ||
134 | //qDebug("con found" ); | ||
135 | } | ||
136 | |||
137 | } else { | ||
138 | content += line ; | ||
139 | } | ||
140 | } | ||
141 | file.close(); | ||
142 | } else { | ||
143 | if ( ! connection.isEmpty() ) { | ||
144 | addConnection = true; | ||
145 | } | ||
146 | if ( ! device.isEmpty() ) { | ||
147 | addPort = true; | ||
148 | 94 | ||
149 | } | ||
150 | if ( ! model.isEmpty() ) { | ||
151 | addModel = true; | ||
152 | } | ||
153 | } | ||
154 | |||
155 | if ( addConnection ) { | ||
156 | if ( ! write ) | ||
157 | content += "[gammu]\n"; | ||
158 | write = true; | ||
159 | content += "connection = "; | ||
160 | content += connection; | ||
161 | content += "\n"; | ||
162 | } | ||
163 | if ( addPort ) { | ||
164 | if ( ! write ) | ||
165 | content += "[gammu]\n"; | ||
166 | write = true; | ||
167 | content += "port = "; | ||
168 | content += device; | ||
169 | content += "\n"; | ||
170 | |||
171 | } | ||
172 | if ( addModel ) { | ||
173 | if ( ! write ) | ||
174 | content += "[gammu]\n"; | ||
175 | write = true; | ||
176 | content += "model = "; | ||
177 | content += model; | ||
178 | content += "\n"; | ||
179 | } | ||
180 | if ( write ) { | ||
181 | if (!file.open( IO_WriteOnly ) ) { | ||
182 | qDebug("Error: cannot write file %s ", fileName.latin1() ); | ||
183 | return; | ||
184 | } | ||
185 | qDebug("Writing file %s ", fileName.latin1() ); | ||
186 | QTextStream ts( &file ); | ||
187 | ts << content ; | ||
188 | file.close(); | ||
189 | } | ||
190 | |||
191 | } | ||
192 | #if 0 | 95 | #if 0 |
193 | int PhoneFormat::initDevice(GSM_StateMachine *s) | 96 | int PhoneFormat::initDevice(GSM_StateMachine *s) |
194 | { | 97 | { |
195 | GSM_ReadConfig(NULL, &s->Config[0], 0); | 98 | GSM_ReadConfig(NULL, &s->Config[0], 0); |
196 | s->ConfigNum = 1; | 99 | s->ConfigNum = 1; |
197 | GSM_Config *cfg = &s->Config[0]; | 100 | GSM_Config *cfg = &s->Config[0]; |
198 | if ( ! mConnection.isEmpty() ) { | 101 | if ( ! mConnection.isEmpty() ) { |
199 | cfg->Connection = strdup(mConnection.latin1()); | 102 | cfg->Connection = strdup(mConnection.latin1()); |
200 | cfg->DefaultConnection = false; | 103 | cfg->DefaultConnection = false; |
201 | qDebug("Connection set %s ", cfg->Connection ); | 104 | qDebug("Connection set %s ", cfg->Connection ); |
202 | 105 | ||
203 | } | 106 | } |
204 | if ( ! mDevice.isEmpty() ) { | 107 | if ( ! mDevice.isEmpty() ) { |
205 | cfg->Device = strdup(mDevice.latin1()); | 108 | cfg->Device = strdup(mDevice.latin1()); |
206 | cfg->DefaultDevice = false; | 109 | cfg->DefaultDevice = false; |
207 | qDebug("Device set %s ", cfg->Device); | 110 | qDebug("Device set %s ", cfg->Device); |
208 | 111 | ||
209 | } | 112 | } |
210 | if ( ! mModel.isEmpty() ) { | 113 | if ( ! mModel.isEmpty() ) { |
211 | strcpy(cfg->Model,mModel.latin1() ); | 114 | strcpy(cfg->Model,mModel.latin1() ); |
212 | cfg->DefaultModel = false; | 115 | cfg->DefaultModel = false; |
213 | qDebug("Model set %s ",cfg->Model ); | 116 | qDebug("Model set %s ",cfg->Model ); |
214 | } | 117 | } |
215 | int error=GSM_InitConnection(s,3); | 118 | int error=GSM_InitConnection(s,3); |
216 | return error; | 119 | return error; |
217 | } | 120 | } |
218 | #endif | 121 | #endif |
219 | ulong PhoneFormat::getCsumTodo( Todo* todo ) | 122 | ulong PhoneFormat::getCsumTodo( Todo* todo ) |
220 | { | 123 | { |
221 | QStringList attList; | 124 | QStringList attList; |
222 | if ( todo->hasDueDate() ) | 125 | if ( todo->hasDueDate() ) |
223 | attList << PhoneParser::dtToString ( todo->dtDue() ); | 126 | attList << PhoneParser::dtToString ( todo->dtDue() ); |
224 | attList << todo->summary(); | 127 | attList << todo->summary(); |
225 | QString completedString = "no"; | 128 | QString completedString = "no"; |
226 | if ( todo->isCompleted() ) | 129 | if ( todo->isCompleted() ) |
227 | completedString = "yes"; | 130 | completedString = "yes"; |
228 | attList << completedString; | 131 | attList << completedString; |
229 | int prio = todo->priority(); | 132 | int prio = todo->priority(); |
230 | if( prio == 2 ) prio = 1; | 133 | if( prio == 2 ) prio = 1; |
231 | if (prio == 4 ) prio = 5 ; | 134 | if (prio == 4 ) prio = 5 ; |
232 | attList << QString::number( prio ); | 135 | attList << QString::number( prio ); |
233 | QString alarmString = "na"; | 136 | QString alarmString = "na"; |
234 | Alarm *alarm; | 137 | Alarm *alarm; |
235 | if ( todo->alarms().count() > 0 ) { | 138 | if ( todo->alarms().count() > 0 ) { |
236 | alarm = todo->alarms().first(); | 139 | alarm = todo->alarms().first(); |
237 | if ( alarm->enabled() ) { | 140 | if ( alarm->enabled() ) { |
238 | alarmString = QString::number(alarm->offset() ); | 141 | alarmString = QString::number(alarm->offset() ); |
239 | } | 142 | } |
240 | } | 143 | } |
241 | attList << alarmString; | 144 | attList << alarmString; |
242 | attList << todo->categoriesStr(); | 145 | attList << todo->categoriesStr(); |
243 | attList << todo->secrecyStr(); | 146 | attList << todo->secrecyStr(); |
244 | return PhoneFormat::getCsum(attList ); | 147 | return PhoneFormat::getCsum(attList ); |
245 | 148 | ||
246 | } | 149 | } |
247 | ulong PhoneFormat::getCsumEvent( Event* event ) | 150 | ulong PhoneFormat::getCsumEvent( Event* event ) |
248 | { | 151 | { |
249 | QStringList attList; | 152 | QStringList attList; |
250 | attList << PhoneParser::dtToString ( event->dtStart() ); | 153 | attList << PhoneParser::dtToString ( event->dtStart() ); |
251 | attList << PhoneParser::dtToString ( event->dtEnd() ); | 154 | attList << PhoneParser::dtToString ( event->dtEnd() ); |
252 | attList << event->summary(); | 155 | attList << event->summary(); |
253 | attList << event->location(); | 156 | attList << event->location(); |
254 | QString alarmString = "na"; | 157 | QString alarmString = "na"; |
255 | Alarm *alarm; | 158 | Alarm *alarm; |
@@ -529,143 +432,129 @@ void PhoneFormat::copyTodo( Todo* to, Todo* from ) | |||
529 | b->setEnabled( a->enabled() ); | 432 | b->setEnabled( a->enabled() ); |
530 | if ( a->hasStartOffset() ) | 433 | if ( a->hasStartOffset() ) |
531 | b->setStartOffset( a->startOffset() ); | 434 | b->setStartOffset( a->startOffset() ); |
532 | if ( a->hasTime() ) | 435 | if ( a->hasTime() ) |
533 | b->setTime( a->time() ); | 436 | b->setTime( a->time() ); |
534 | } | 437 | } |
535 | 438 | ||
536 | QStringList cat = to->categories(); | 439 | QStringList cat = to->categories(); |
537 | QStringList catFrom = from->categories(); | 440 | QStringList catFrom = from->categories(); |
538 | QString nCat; | 441 | QString nCat; |
539 | int iii; | 442 | int iii; |
540 | for ( iii = 0; iii < catFrom.count();++iii ) { | 443 | for ( iii = 0; iii < catFrom.count();++iii ) { |
541 | nCat = catFrom[iii]; | 444 | nCat = catFrom[iii]; |
542 | if ( !nCat.isEmpty() ) | 445 | if ( !nCat.isEmpty() ) |
543 | if ( !cat.contains( nCat )) { | 446 | if ( !cat.contains( nCat )) { |
544 | cat << nCat; | 447 | cat << nCat; |
545 | } | 448 | } |
546 | } | 449 | } |
547 | to->setCategories( cat ); | 450 | to->setCategories( cat ); |
548 | if ( from->isCompleted() ) { | 451 | if ( from->isCompleted() ) { |
549 | to->setCompleted( true ); | 452 | to->setCompleted( true ); |
550 | if( from->completed().isValid() ) | 453 | if( from->completed().isValid() ) |
551 | to->setCompleted( from->completed() ); | 454 | to->setCompleted( from->completed() ); |
552 | } else { | 455 | } else { |
553 | // set percentcomplete only, if to->isCompleted() | 456 | // set percentcomplete only, if to->isCompleted() |
554 | if ( to->isCompleted() ) | 457 | if ( to->isCompleted() ) |
555 | to->setPercentComplete(from->percentComplete()); | 458 | to->setPercentComplete(from->percentComplete()); |
556 | } | 459 | } |
557 | if( to->priority() == 2 && from->priority() == 1 ) | 460 | if( to->priority() == 2 && from->priority() == 1 ) |
558 | ; //skip | 461 | ; //skip |
559 | else if (to->priority() == 4 && from->priority() == 5 ) | 462 | else if (to->priority() == 4 && from->priority() == 5 ) |
560 | ; | 463 | ; |
561 | else | 464 | else |
562 | to->setPriority(from->priority()); | 465 | to->setPriority(from->priority()); |
563 | 466 | ||
564 | } | 467 | } |
565 | #include <qcstring.h> | 468 | #include <qcstring.h> |
566 | 469 | ||
567 | void PhoneFormat::afterSave( Incidence* inc) | 470 | void PhoneFormat::afterSave( Incidence* inc) |
568 | { | 471 | { |
569 | uint csum; | 472 | uint csum; |
570 | inc->removeID( mProfileName ); | 473 | inc->removeID( mProfileName ); |
571 | if ( inc->type() == "Event") | 474 | if ( inc->type() == "Event") |
572 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); | 475 | csum = PhoneFormat::getCsumEvent( (Event*) inc ); |
573 | else | 476 | else |
574 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); | 477 | csum = PhoneFormat::getCsumTodo( (Todo*) inc ); |
575 | inc->setCsum( mProfileName, QString::number( csum )); | 478 | inc->setCsum( mProfileName, QString::number( csum )); |
576 | 479 | ||
577 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 480 | inc->setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
578 | 481 | ||
579 | } | 482 | } |
580 | 483 | ||
581 | bool PhoneFormat::writeToPhone( Calendar * calendar) | 484 | bool PhoneFormat::writeToPhone( Calendar * calendar) |
582 | { | 485 | { |
583 | #ifdef _WIN32_ | 486 | #ifdef _WIN32_ |
584 | QString fileName = locateLocal("tmp", "tempfile.vcs"); | 487 | QString fileName = locateLocal("tmp", "tempfile.vcs"); |
585 | #else | 488 | #else |
586 | QString fileName = "/tmp/kdepimtemp.vcs"; | 489 | QString fileName = "/tmp/kdepimtemp.vcs"; |
587 | #endif | 490 | #endif |
588 | 491 | ||
589 | VCalFormat vfsave; | 492 | VCalFormat vfsave; |
590 | vfsave.setLocalTime ( true ); | 493 | vfsave.setLocalTime ( true ); |
591 | if ( ! vfsave.save( calendar, fileName ) ) | 494 | if ( ! vfsave.save( calendar, fileName ) ) |
592 | return false; | 495 | return false; |
593 | // 4 call kammu | 496 | return PhoneAccess::writeToPhone( fileName ); |
594 | #ifdef DESKTOP_VERSION | ||
595 | QString command ="./kammu --restore " + fileName ; | ||
596 | #else | ||
597 | QString command ="kammu --restore " + fileName ; | ||
598 | #endif | ||
599 | int ret; | ||
600 | while ( (ret = system ( command.latin1())) != 0 ) { | ||
601 | qDebug("Error S::command returned %d. asking users", ret); | ||
602 | int retval = KMessageBox::warningContinueCancel(0, | ||
603 | i18n("Error accessing device!\nPlease turn on connection\nand retry!"),i18n("KO/Pi phone access"),i18n("Retry"),i18n("Cancel")); | ||
604 | if ( retval != KMessageBox::Continue ) | ||
605 | return false; | ||
606 | } | ||
607 | return true; | ||
608 | } | 497 | } |
609 | bool PhoneFormat::save( Calendar *calendar) | 498 | bool PhoneFormat::save( Calendar *calendar) |
610 | { | 499 | { |
611 | QLabel status ( i18n(" Opening device ..."), 0 ); | 500 | QLabel status ( i18n(" Opening device ..."), 0 ); |
612 | int w = status.sizeHint().width()+20 ; | 501 | int w = status.sizeHint().width()+20 ; |
613 | if ( w < 200 ) w = 230; | 502 | if ( w < 200 ) w = 230; |
614 | int h = status.sizeHint().height()+20 ; | 503 | int h = status.sizeHint().height()+20 ; |
615 | int dw = QApplication::desktop()->width(); | 504 | int dw = QApplication::desktop()->width(); |
616 | int dh = QApplication::desktop()->height(); | 505 | int dh = QApplication::desktop()->height(); |
617 | status.setCaption(i18n("Writing to phone...") ); | 506 | status.setCaption(i18n("Writing to phone...") ); |
618 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 507 | status.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
619 | status.show(); | 508 | status.show(); |
620 | status.raise(); | 509 | status.raise(); |
621 | qApp->processEvents(); | 510 | qApp->processEvents(); |
622 | QString message; | 511 | QString message; |
623 | 512 | ||
624 | // 1 remove events which should be deleted | 513 | // 1 remove events which should be deleted |
625 | QPtrList<Event> er = calendar->rawEvents(); | 514 | QPtrList<Event> er = calendar->rawEvents(); |
626 | Event* ev = er.first(); | 515 | Event* ev = er.first(); |
627 | while ( ev ) { | 516 | while ( ev ) { |
628 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 517 | if ( ev->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
629 | calendar->deleteEvent( ev ); | 518 | calendar->deleteEvent( ev ); |
630 | } else { | 519 | } else { |
631 | 520 | ||
632 | } | 521 | } |
633 | ev = er.next(); | 522 | ev = er.next(); |
634 | } | 523 | } |
635 | // 2 remove todos which should be deleted | 524 | // 2 remove todos which should be deleted |
636 | QPtrList<Todo> tl = calendar->rawTodos(); | 525 | QPtrList<Todo> tl = calendar->rawTodos(); |
637 | Todo* to = tl.first(); | 526 | Todo* to = tl.first(); |
638 | while ( to ) { | 527 | while ( to ) { |
639 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { | 528 | if ( to->tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { |
640 | calendar->deleteTodo( to ); | 529 | calendar->deleteTodo( to ); |
641 | } else { | 530 | } else { |
642 | if ( to->isCompleted()) { | 531 | if ( to->isCompleted()) { |
643 | calendar->deleteTodo( to ); | 532 | calendar->deleteTodo( to ); |
644 | } | 533 | } |
645 | } | 534 | } |
646 | to = tl.next(); | 535 | to = tl.next(); |
647 | } | 536 | } |
648 | // 3 save file | 537 | // 3 save file |
649 | if ( !writeToPhone( calendar ) ) | 538 | if ( !writeToPhone( calendar ) ) |
650 | return false; | 539 | return false; |
651 | 540 | ||
652 | // 5 reread data | 541 | // 5 reread data |
653 | message = i18n(" Rereading all data ... "); | 542 | message = i18n(" Rereading all data ... "); |
654 | status.setText ( message ); | 543 | status.setText ( message ); |
655 | qApp->processEvents(); | 544 | qApp->processEvents(); |
656 | CalendarLocal* calendarTemp = new CalendarLocal(); | 545 | CalendarLocal* calendarTemp = new CalendarLocal(); |
657 | calendarTemp->setTimeZoneId( calendar->timeZoneId()); | 546 | calendarTemp->setTimeZoneId( calendar->timeZoneId()); |
658 | if ( ! load( calendarTemp,calendar) ){ | 547 | if ( ! load( calendarTemp,calendar) ){ |
659 | qDebug("error reloading calendar "); | 548 | qDebug("error reloading calendar "); |
660 | delete calendarTemp; | 549 | delete calendarTemp; |
661 | return false; | 550 | return false; |
662 | } | 551 | } |
663 | // 6 compare data | 552 | // 6 compare data |
664 | 553 | ||
665 | //algo 6 compare event | 554 | //algo 6 compare event |
666 | er = calendar->rawEvents(); | 555 | er = calendar->rawEvents(); |
667 | ev = er.first(); | 556 | ev = er.first(); |
668 | message = i18n(" Comparing event # "); | 557 | message = i18n(" Comparing event # "); |
669 | QPtrList<Event> er1 = calendarTemp->rawEvents(); | 558 | QPtrList<Event> er1 = calendarTemp->rawEvents(); |
670 | Event* ev1; | 559 | Event* ev1; |
671 | int procCount = 0; | 560 | int procCount = 0; |
diff --git a/libkcal/phoneformat.h b/libkcal/phoneformat.h index 61e8160..001fd81 100644 --- a/libkcal/phoneformat.h +++ b/libkcal/phoneformat.h | |||
@@ -1,63 +1,62 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | 3 | ||
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #ifndef PHONEFORMAT_H | 21 | #ifndef PHONEFORMAT_H |
22 | #define PHONEFORMAT_H | 22 | #define PHONEFORMAT_H |
23 | 23 | ||
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | 25 | ||
26 | #include "scheduler.h" | 26 | #include "scheduler.h" |
27 | 27 | ||
28 | #include "vcalformat.h" | 28 | #include "vcalformat.h" |
29 | #include "calformat.h" | 29 | #include "calformat.h" |
30 | 30 | ||
31 | namespace KCal { | 31 | namespace KCal { |
32 | 32 | ||
33 | /** | 33 | /** |
34 | This class implements the calendar format used by Phone. | 34 | This class implements the calendar format used by Phone. |
35 | */ | 35 | */ |
36 | class Event; | 36 | class Event; |
37 | class Todo; | 37 | class Todo; |
38 | class PhoneFormat : public QObject { | 38 | class PhoneFormat : public QObject { |
39 | public: | 39 | public: |
40 | /** Create new iCalendar format. */ | 40 | /** Create new iCalendar format. */ |
41 | PhoneFormat(QString profileName, QString device,QString connection, QString model); | 41 | PhoneFormat(QString profileName, QString device,QString connection, QString model); |
42 | virtual ~PhoneFormat(); | 42 | virtual ~PhoneFormat(); |
43 | 43 | ||
44 | bool load( Calendar * ,Calendar * ); | 44 | bool load( Calendar * ,Calendar * ); |
45 | bool save( Calendar * ); | 45 | bool save( Calendar * ); |
46 | bool fromString( Calendar *, const QString & ); | 46 | bool fromString( Calendar *, const QString & ); |
47 | QString toString( Calendar * ); | 47 | QString toString( Calendar * ); |
48 | static ulong getCsum( const QStringList & ); | 48 | static ulong getCsum( const QStringList & ); |
49 | static ulong getCsumTodo( Todo* to ); | 49 | static ulong getCsumTodo( Todo* to ); |
50 | static ulong getCsumEvent( Event* ev ); | 50 | static ulong getCsumEvent( Event* ev ); |
51 | static void writeConfig( QString device,QString connection, QString model ); | ||
52 | static bool writeToPhone( Calendar * ); | 51 | static bool writeToPhone( Calendar * ); |
53 | private: | 52 | private: |
54 | void copyEvent( Event* to, Event* from ); | 53 | void copyEvent( Event* to, Event* from ); |
55 | void copyTodo( Todo* to, Todo* from ); | 54 | void copyTodo( Todo* to, Todo* from ); |
56 | //int initDevice(GSM_StateMachine *s); | 55 | //int initDevice(GSM_StateMachine *s); |
57 | QString mProfileName; | 56 | QString mProfileName; |
58 | void afterSave( Incidence* ); | 57 | void afterSave( Incidence* ); |
59 | }; | 58 | }; |
60 | 59 | ||
61 | } | 60 | } |
62 | 61 | ||
63 | #endif | 62 | #endif |