-rw-r--r-- | kabc/resource.cpp | 4 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 16 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.cpp | 15 | ||||
-rw-r--r-- | libkdepim/ksyncprofile.h | 5 |
8 files changed, 32 insertions, 17 deletions
diff --git a/kabc/resource.cpp b/kabc/resource.cpp index d39fd6a..7b91239 100644 --- a/kabc/resource.cpp +++ b/kabc/resource.cpp | |||
@@ -1,144 +1,144 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include <ksyncprofile.h> | 30 | #include <ksyncprofile.h> |
31 | 31 | ||
32 | #include "resource.h" | 32 | #include "resource.h" |
33 | 33 | ||
34 | using namespace KABC; | 34 | using namespace KABC; |
35 | 35 | ||
36 | Resource::Resource( const KConfig *config, bool syncable ) | 36 | Resource::Resource( const KConfig *config, bool syncable ) |
37 | : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) | 37 | : KRES::Resource( config ), mAddressBook( 0 ), mSyncProfile( 0 ) |
38 | { | 38 | { |
39 | if(syncable == true) { | 39 | if(syncable == true) { |
40 | mSyncProfile = new KSyncProfile( identifier() ); | 40 | mSyncProfile = new KSyncProfile( ); |
41 | mSyncProfile->setName(resourceName()); | 41 | mSyncProfile->setName("pending" /*resourceName()*/); |
42 | mSyncProfile->readConfig( (KConfig *)config ); | 42 | mSyncProfile->readConfig( (KConfig *)config ); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | Resource::~Resource() | 46 | Resource::~Resource() |
47 | { | 47 | { |
48 | if (mSyncProfile != 0) { | 48 | if (mSyncProfile != 0) { |
49 | delete mSyncProfile; | 49 | delete mSyncProfile; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | void Resource::writeConfig( KConfig *config ) | 53 | void Resource::writeConfig( KConfig *config ) |
54 | { | 54 | { |
55 | KRES::Resource::writeConfig( config ); | 55 | KRES::Resource::writeConfig( config ); |
56 | 56 | ||
57 | if(mSyncProfile != 0) | 57 | if(mSyncProfile != 0) |
58 | mSyncProfile->writeConfig( config ); | 58 | mSyncProfile->writeConfig( config ); |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void Resource::setAddressBook( AddressBook *ab ) | 62 | void Resource::setAddressBook( AddressBook *ab ) |
63 | { | 63 | { |
64 | mAddressBook = ab; | 64 | mAddressBook = ab; |
65 | } | 65 | } |
66 | 66 | ||
67 | AddressBook *Resource::addressBook() | 67 | AddressBook *Resource::addressBook() |
68 | { | 68 | { |
69 | return mAddressBook; | 69 | return mAddressBook; |
70 | } | 70 | } |
71 | 71 | ||
72 | bool Resource::doOpen() | 72 | bool Resource::doOpen() |
73 | { | 73 | { |
74 | return true; | 74 | return true; |
75 | } | 75 | } |
76 | 76 | ||
77 | void Resource::doClose() | 77 | void Resource::doClose() |
78 | { | 78 | { |
79 | } | 79 | } |
80 | 80 | ||
81 | Ticket *Resource::requestSaveTicket() | 81 | Ticket *Resource::requestSaveTicket() |
82 | { | 82 | { |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | bool Resource::load() | 86 | bool Resource::load() |
87 | { | 87 | { |
88 | return true; | 88 | return true; |
89 | } | 89 | } |
90 | 90 | ||
91 | bool Resource::save( Ticket * ) | 91 | bool Resource::save( Ticket * ) |
92 | { | 92 | { |
93 | return false; | 93 | return false; |
94 | } | 94 | } |
95 | 95 | ||
96 | Ticket *Resource::createTicket( Resource *resource ) | 96 | Ticket *Resource::createTicket( Resource *resource ) |
97 | { | 97 | { |
98 | return new Ticket( resource ); | 98 | return new Ticket( resource ); |
99 | } | 99 | } |
100 | 100 | ||
101 | void Resource::removeAddressee( const Addressee& ) | 101 | void Resource::removeAddressee( const Addressee& ) |
102 | { | 102 | { |
103 | // do nothing | 103 | // do nothing |
104 | } | 104 | } |
105 | 105 | ||
106 | void Resource::cleanUp() | 106 | void Resource::cleanUp() |
107 | { | 107 | { |
108 | // do nothing | 108 | // do nothing |
109 | } | 109 | } |
110 | 110 | ||
111 | bool Resource::isSyncable() const | 111 | bool Resource::isSyncable() const |
112 | { | 112 | { |
113 | return (mSyncProfile != 0); | 113 | return (mSyncProfile != 0); |
114 | } | 114 | } |
115 | 115 | ||
116 | KSyncProfile* Resource::getSyncProfile() | 116 | KSyncProfile* Resource::getSyncProfile() |
117 | { | 117 | { |
118 | return mSyncProfile; | 118 | return mSyncProfile; |
119 | } | 119 | } |
120 | 120 | ||
121 | 121 | ||
122 | QString Resource::fileName() const | 122 | QString Resource::fileName() const |
123 | { | 123 | { |
124 | return mFileName; | 124 | return mFileName; |
125 | } | 125 | } |
126 | 126 | ||
127 | void Resource::setFileName( const QString &fileName ) | 127 | void Resource::setFileName( const QString &fileName ) |
128 | { | 128 | { |
129 | mFileName = fileName; | 129 | mFileName = fileName; |
130 | } | 130 | } |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Set the name of resource.You can override this method, | 133 | * Set the name of resource.You can override this method, |
134 | * but also remember to call Resource::setResourceName(). | 134 | * but also remember to call Resource::setResourceName(). |
135 | */ | 135 | */ |
136 | void Resource::setResourceName( const QString &name ) | 136 | void Resource::setResourceName( const QString &name ) |
137 | { | 137 | { |
138 | KRES::Resource::setResourceName(name); | 138 | KRES::Resource::setResourceName(name); |
139 | if(mSyncProfile != 0) { | 139 | if(mSyncProfile != 0) { |
140 | mSyncProfile->setName( name ); | 140 | mSyncProfile->setName( name ); |
141 | } | 141 | } |
142 | 142 | ||
143 | } | 143 | } |
144 | 144 | ||
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index f859b90..689618d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -792,768 +792,772 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
792 | return 1; | 792 | return 1; |
793 | if ( lastSync > local->lastModified() ) | 793 | if ( lastSync > local->lastModified() ) |
794 | return 2; | 794 | return 2; |
795 | return 1; | 795 | return 1; |
796 | break; | 796 | break; |
797 | case SYNC_PREF_REMOTE: | 797 | case SYNC_PREF_REMOTE: |
798 | if ( lastSync > remote->lastModified() ) | 798 | if ( lastSync > remote->lastModified() ) |
799 | return 1; | 799 | return 1; |
800 | if ( lastSync > local->lastModified() ) | 800 | if ( lastSync > local->lastModified() ) |
801 | return 2; | 801 | return 2; |
802 | return 2; | 802 | return 2; |
803 | break; | 803 | break; |
804 | case SYNC_PREF_NEWEST: | 804 | case SYNC_PREF_NEWEST: |
805 | if ( local->lastModified() > remote->lastModified() ) | 805 | if ( local->lastModified() > remote->lastModified() ) |
806 | return 1; | 806 | return 1; |
807 | else | 807 | else |
808 | return 2; | 808 | return 2; |
809 | break; | 809 | break; |
810 | case SYNC_PREF_ASK: | 810 | case SYNC_PREF_ASK: |
811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 811 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
812 | if ( lastSync > remote->lastModified() ) | 812 | if ( lastSync > remote->lastModified() ) |
813 | return 1; | 813 | return 1; |
814 | if ( lastSync > local->lastModified() ) | 814 | if ( lastSync > local->lastModified() ) |
815 | return 2; | 815 | return 2; |
816 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); | 816 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); |
817 | localIsNew = local->lastModified() > remote->lastModified(); | 817 | localIsNew = local->lastModified() > remote->lastModified(); |
818 | if ( localIsNew ) | 818 | if ( localIsNew ) |
819 | getEventViewerDialog()->setColorMode( 1 ); | 819 | getEventViewerDialog()->setColorMode( 1 ); |
820 | else | 820 | else |
821 | getEventViewerDialog()->setColorMode( 2 ); | 821 | getEventViewerDialog()->setColorMode( 2 ); |
822 | getEventViewerDialog()->setIncidence(local); | 822 | getEventViewerDialog()->setIncidence(local); |
823 | if ( localIsNew ) | 823 | if ( localIsNew ) |
824 | getEventViewerDialog()->setColorMode( 2 ); | 824 | getEventViewerDialog()->setColorMode( 2 ); |
825 | else | 825 | else |
826 | getEventViewerDialog()->setColorMode( 1 ); | 826 | getEventViewerDialog()->setColorMode( 1 ); |
827 | getEventViewerDialog()->addIncidence(remote); | 827 | getEventViewerDialog()->addIncidence(remote); |
828 | getEventViewerDialog()->setColorMode( 0 ); | 828 | getEventViewerDialog()->setColorMode( 0 ); |
829 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 829 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
830 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 830 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
831 | getEventViewerDialog()->showMe(); | 831 | getEventViewerDialog()->showMe(); |
832 | result = getEventViewerDialog()->executeS( localIsNew ); | 832 | result = getEventViewerDialog()->executeS( localIsNew ); |
833 | return result; | 833 | return result; |
834 | 834 | ||
835 | break; | 835 | break; |
836 | case SYNC_PREF_FORCE_LOCAL: | 836 | case SYNC_PREF_FORCE_LOCAL: |
837 | return 1; | 837 | return 1; |
838 | break; | 838 | break; |
839 | case SYNC_PREF_FORCE_REMOTE: | 839 | case SYNC_PREF_FORCE_REMOTE: |
840 | return 2; | 840 | return 2; |
841 | break; | 841 | break; |
842 | 842 | ||
843 | default: | 843 | default: |
844 | // SYNC_PREF_TAKE_BOTH not implemented | 844 | // SYNC_PREF_TAKE_BOTH not implemented |
845 | break; | 845 | break; |
846 | } | 846 | } |
847 | return 0; | 847 | return 0; |
848 | } | 848 | } |
849 | Event* CalendarView::getLastSyncEvent() | 849 | Event* CalendarView::getLastSyncEvent() |
850 | { | 850 | { |
851 | Event* lse; | 851 | Event* lse; |
852 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 852 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
853 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 853 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
854 | if (!lse) { | 854 | if (!lse) { |
855 | lse = new Event(); | 855 | lse = new Event(); |
856 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 856 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
857 | QString sum = ""; | 857 | QString sum = ""; |
858 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 858 | if ( KOPrefs::instance()->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
859 | sum = "E: "; | 859 | sum = "E: "; |
860 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 860 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
861 | lse->setDtStart( mLastCalendarSync ); | 861 | lse->setDtStart( mLastCalendarSync ); |
862 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 862 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
863 | lse->setCategories( i18n("SyncEvent") ); | 863 | lse->setCategories( i18n("SyncEvent") ); |
864 | lse->setReadOnly( true ); | 864 | lse->setReadOnly( true ); |
865 | mCalendar->addEvent( lse ); | 865 | mCalendar->addEvent( lse ); |
866 | } | 866 | } |
867 | 867 | ||
868 | return lse; | 868 | return lse; |
869 | 869 | ||
870 | } | 870 | } |
871 | // probaly useless | 871 | // probaly useless |
872 | void CalendarView::setupExternSyncProfiles() | 872 | void CalendarView::setupExternSyncProfiles() |
873 | { | 873 | { |
874 | Event* lse; | 874 | Event* lse; |
875 | mExternLastSyncEvent.clear(); | 875 | mExternLastSyncEvent.clear(); |
876 | int i; | 876 | int i; |
877 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { | 877 | for ( i = 0; i < KOPrefs::instance()->mExternSyncProfiles.count(); ++i ) { |
878 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); | 878 | lse = mCalendar->event( "last-syncEvent-"+ KOPrefs::instance()->mExternSyncProfiles[i] ); |
879 | if ( lse ) | 879 | if ( lse ) |
880 | mExternLastSyncEvent.append( lse ); | 880 | mExternLastSyncEvent.append( lse ); |
881 | else | 881 | else |
882 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); | 882 | qDebug("Last Sync event not found for %s ", KOPrefs::instance()->mExternSyncProfiles[i].latin1()); |
883 | } | 883 | } |
884 | 884 | ||
885 | } | 885 | } |
886 | // we check, if the to delete event has a id for a profile | 886 | // we check, if the to delete event has a id for a profile |
887 | // if yes, we set this id in the profile to delete | 887 | // if yes, we set this id in the profile to delete |
888 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 888 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
889 | { | 889 | { |
890 | if ( lastSync.count() == 0 ) { | 890 | if ( lastSync.count() == 0 ) { |
891 | //qDebug(" lastSync.count() == 0"); | 891 | //qDebug(" lastSync.count() == 0"); |
892 | return; | 892 | return; |
893 | } | 893 | } |
894 | if ( toDelete->type() == "Journal" ) | 894 | if ( toDelete->type() == "Journal" ) |
895 | return; | 895 | return; |
896 | 896 | ||
897 | Event* eve = lastSync.first(); | 897 | Event* eve = lastSync.first(); |
898 | 898 | ||
899 | while ( eve ) { | 899 | while ( eve ) { |
900 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 900 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
901 | if ( !id.isEmpty() ) { | 901 | if ( !id.isEmpty() ) { |
902 | QString des = eve->description(); | 902 | QString des = eve->description(); |
903 | QString pref = "e"; | 903 | QString pref = "e"; |
904 | if ( toDelete->type() == "Todo" ) | 904 | if ( toDelete->type() == "Todo" ) |
905 | pref = "t"; | 905 | pref = "t"; |
906 | des += pref+ id + ","; | 906 | des += pref+ id + ","; |
907 | eve->setReadOnly( false ); | 907 | eve->setReadOnly( false ); |
908 | eve->setDescription( des ); | 908 | eve->setDescription( des ); |
909 | //qDebug("setdes %s ", des.latin1()); | 909 | //qDebug("setdes %s ", des.latin1()); |
910 | eve->setReadOnly( true ); | 910 | eve->setReadOnly( true ); |
911 | } | 911 | } |
912 | eve = lastSync.next(); | 912 | eve = lastSync.next(); |
913 | } | 913 | } |
914 | 914 | ||
915 | } | 915 | } |
916 | void CalendarView::checkExternalId( Incidence * inc ) | 916 | void CalendarView::checkExternalId( Incidence * inc ) |
917 | { | 917 | { |
918 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 918 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
919 | checkExternSyncEvent( lastSync, inc ); | 919 | checkExternSyncEvent( lastSync, inc ); |
920 | 920 | ||
921 | } | 921 | } |
922 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 922 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
923 | { | 923 | { |
924 | bool syncOK = true; | 924 | bool syncOK = true; |
925 | int addedEvent = 0; | 925 | int addedEvent = 0; |
926 | int addedEventR = 0; | 926 | int addedEventR = 0; |
927 | int deletedEventR = 0; | 927 | int deletedEventR = 0; |
928 | int deletedEventL = 0; | 928 | int deletedEventL = 0; |
929 | int changedLocal = 0; | 929 | int changedLocal = 0; |
930 | int changedRemote = 0; | 930 | int changedRemote = 0; |
931 | //QPtrList<Event> el = local->rawEvents(); | 931 | //QPtrList<Event> el = local->rawEvents(); |
932 | Event* eventR; | 932 | Event* eventR; |
933 | QString uid; | 933 | QString uid; |
934 | int take; | 934 | int take; |
935 | Event* eventL; | 935 | Event* eventL; |
936 | Event* eventRSync; | 936 | Event* eventRSync; |
937 | Event* eventLSync; | 937 | Event* eventLSync; |
938 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 938 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
939 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 939 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
940 | bool fullDateRange = false; | 940 | bool fullDateRange = false; |
941 | mLastCalendarSync = QDateTime::currentDateTime(); | 941 | mLastCalendarSync = QDateTime::currentDateTime(); |
942 | QDateTime modifiedCalendar = mLastCalendarSync;; | 942 | QDateTime modifiedCalendar = mLastCalendarSync;; |
943 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 943 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
944 | if ( eventR ) { | 944 | if ( eventR ) { |
945 | eventRSync = (Event*) eventR->clone(); | 945 | eventRSync = (Event*) eventR->clone(); |
946 | remote->deleteEvent(eventR ); | 946 | remote->deleteEvent(eventR ); |
947 | 947 | ||
948 | } else { | 948 | } else { |
949 | fullDateRange = true; | 949 | fullDateRange = true; |
950 | eventRSync = new Event(); | 950 | eventRSync = new Event(); |
951 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 951 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
952 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 952 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
953 | eventRSync->setDtStart( mLastCalendarSync ); | 953 | eventRSync->setDtStart( mLastCalendarSync ); |
954 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 954 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
955 | eventRSync->setCategories( i18n("SyncEvent") ); | 955 | eventRSync->setCategories( i18n("SyncEvent") ); |
956 | } | 956 | } |
957 | eventLSync = getLastSyncEvent(); | 957 | eventLSync = getLastSyncEvent(); |
958 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 958 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
959 | fullDateRange = true; | 959 | fullDateRange = true; |
960 | 960 | ||
961 | if ( ! fullDateRange ) { | 961 | if ( ! fullDateRange ) { |
962 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 962 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
963 | 963 | ||
964 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 964 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
965 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 965 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
966 | fullDateRange = true; | 966 | fullDateRange = true; |
967 | } | 967 | } |
968 | } | 968 | } |
969 | if ( fullDateRange ) | 969 | if ( fullDateRange ) |
970 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 970 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
971 | else | 971 | else |
972 | mLastCalendarSync = eventLSync->dtStart(); | 972 | mLastCalendarSync = eventLSync->dtStart(); |
973 | // for resyncing if own file has changed | 973 | // for resyncing if own file has changed |
974 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 974 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
975 | mLastCalendarSync = loadedFileVersion; | 975 | mLastCalendarSync = loadedFileVersion; |
976 | qDebug("setting mLastCalendarSync "); | 976 | qDebug("setting mLastCalendarSync "); |
977 | } | 977 | } |
978 | //qDebug("*************************** "); | 978 | //qDebug("*************************** "); |
979 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); | 979 | qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); |
980 | QPtrList<Incidence> er = remote->rawIncidences(); | 980 | QPtrList<Incidence> er = remote->rawIncidences(); |
981 | Incidence* inR = er.first(); | 981 | Incidence* inR = er.first(); |
982 | Incidence* inL; | 982 | Incidence* inL; |
983 | QProgressBar bar( er.count(),0 ); | 983 | QProgressBar bar( er.count(),0 ); |
984 | bar.setCaption (i18n("Syncing - close to abort!") ); | 984 | bar.setCaption (i18n("Syncing - close to abort!") ); |
985 | 985 | ||
986 | int w = 300; | 986 | int w = 300; |
987 | if ( QApplication::desktop()->width() < 320 ) | 987 | if ( QApplication::desktop()->width() < 320 ) |
988 | w = 220; | 988 | w = 220; |
989 | int h = bar.sizeHint().height() ; | 989 | int h = bar.sizeHint().height() ; |
990 | int dw = QApplication::desktop()->width(); | 990 | int dw = QApplication::desktop()->width(); |
991 | int dh = QApplication::desktop()->height(); | 991 | int dh = QApplication::desktop()->height(); |
992 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 992 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
993 | bar.show(); | 993 | bar.show(); |
994 | int modulo = (er.count()/10)+1; | 994 | int modulo = (er.count()/10)+1; |
995 | int incCounter = 0; | 995 | int incCounter = 0; |
996 | while ( inR ) { | 996 | while ( inR ) { |
997 | if ( ! bar.isVisible() ) | 997 | if ( ! bar.isVisible() ) |
998 | return false; | 998 | return false; |
999 | if ( incCounter % modulo == 0 ) | 999 | if ( incCounter % modulo == 0 ) |
1000 | bar.setProgress( incCounter ); | 1000 | bar.setProgress( incCounter ); |
1001 | ++incCounter; | 1001 | ++incCounter; |
1002 | uid = inR->uid(); | 1002 | uid = inR->uid(); |
1003 | bool skipIncidence = false; | 1003 | bool skipIncidence = false; |
1004 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1004 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1005 | skipIncidence = true; | 1005 | skipIncidence = true; |
1006 | 1006 | ||
1007 | qApp->processEvents(); | 1007 | qApp->processEvents(); |
1008 | if ( !skipIncidence ) { | 1008 | if ( !skipIncidence ) { |
1009 | inL = local->incidence( uid ); | 1009 | inL = local->incidence( uid ); |
1010 | if ( inL ) { // maybe conflict - same uid in both calendars | 1010 | if ( inL ) { // maybe conflict - same uid in both calendars |
1011 | int maxrev = inL->revision(); | 1011 | int maxrev = inL->revision(); |
1012 | if ( maxrev < inR->revision() ) | 1012 | if ( maxrev < inR->revision() ) |
1013 | maxrev = inR->revision(); | 1013 | maxrev = inR->revision(); |
1014 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1014 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1015 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1015 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1016 | if ( take == 3 ) | 1016 | if ( take == 3 ) |
1017 | return false; | 1017 | return false; |
1018 | if ( take == 1 ) {// take local | 1018 | if ( take == 1 ) {// take local |
1019 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1019 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1020 | remote->deleteIncidence( inR ); | 1020 | remote->deleteIncidence( inR ); |
1021 | if ( inL->revision() < maxrev ) | 1021 | if ( inL->revision() < maxrev ) |
1022 | inL->setRevision( maxrev ); | 1022 | inL->setRevision( maxrev ); |
1023 | remote->addIncidence( inL->clone() ); | 1023 | remote->addIncidence( inL->clone() ); |
1024 | ++changedRemote; | 1024 | ++changedRemote; |
1025 | } else { | 1025 | } else { |
1026 | if ( inR->revision() < maxrev ) | 1026 | if ( inR->revision() < maxrev ) |
1027 | inR->setRevision( maxrev ); | 1027 | inR->setRevision( maxrev ); |
1028 | local->deleteIncidence( inL ); | 1028 | local->deleteIncidence( inL ); |
1029 | local->addIncidence( inR->clone() ); | 1029 | local->addIncidence( inR->clone() ); |
1030 | ++changedLocal; | 1030 | ++changedLocal; |
1031 | } | 1031 | } |
1032 | } | 1032 | } |
1033 | } else { // no conflict | 1033 | } else { // no conflict |
1034 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1034 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1035 | QString des = eventLSync->description(); | 1035 | QString des = eventLSync->description(); |
1036 | QString pref = "e"; | 1036 | QString pref = "e"; |
1037 | if ( inR->type() == "Todo" ) | 1037 | if ( inR->type() == "Todo" ) |
1038 | pref = "t"; | 1038 | pref = "t"; |
1039 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1039 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1040 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1040 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1041 | //remote->deleteIncidence( inR ); | 1041 | //remote->deleteIncidence( inR ); |
1042 | ++deletedEventR; | 1042 | ++deletedEventR; |
1043 | } else { | 1043 | } else { |
1044 | inR->setLastModified( modifiedCalendar ); | 1044 | inR->setLastModified( modifiedCalendar ); |
1045 | local->addIncidence( inR->clone() ); | 1045 | local->addIncidence( inR->clone() ); |
1046 | ++addedEvent; | 1046 | ++addedEvent; |
1047 | } | 1047 | } |
1048 | } else { | 1048 | } else { |
1049 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1049 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1050 | inR->setLastModified( modifiedCalendar ); | 1050 | inR->setLastModified( modifiedCalendar ); |
1051 | local->addIncidence( inR->clone() ); | 1051 | local->addIncidence( inR->clone() ); |
1052 | ++addedEvent; | 1052 | ++addedEvent; |
1053 | } else { | 1053 | } else { |
1054 | checkExternSyncEvent(eventRSyncSharp, inR); | 1054 | checkExternSyncEvent(eventRSyncSharp, inR); |
1055 | remote->deleteIncidence( inR ); | 1055 | remote->deleteIncidence( inR ); |
1056 | ++deletedEventR; | 1056 | ++deletedEventR; |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | } | 1060 | } |
1061 | inR = er.next(); | 1061 | inR = er.next(); |
1062 | } | 1062 | } |
1063 | QPtrList<Incidence> el = local->rawIncidences(); | 1063 | QPtrList<Incidence> el = local->rawIncidences(); |
1064 | inL = el.first(); | 1064 | inL = el.first(); |
1065 | modulo = (el.count()/10)+1; | 1065 | modulo = (el.count()/10)+1; |
1066 | bar.setCaption (i18n("Add / remove events") ); | 1066 | bar.setCaption (i18n("Add / remove events") ); |
1067 | bar.setTotalSteps ( el.count() ) ; | 1067 | bar.setTotalSteps ( el.count() ) ; |
1068 | bar.show(); | 1068 | bar.show(); |
1069 | incCounter = 0; | 1069 | incCounter = 0; |
1070 | 1070 | ||
1071 | while ( inL ) { | 1071 | while ( inL ) { |
1072 | 1072 | ||
1073 | qApp->processEvents(); | 1073 | qApp->processEvents(); |
1074 | if ( ! bar.isVisible() ) | 1074 | if ( ! bar.isVisible() ) |
1075 | return false; | 1075 | return false; |
1076 | if ( incCounter % modulo == 0 ) | 1076 | if ( incCounter % modulo == 0 ) |
1077 | bar.setProgress( incCounter ); | 1077 | bar.setProgress( incCounter ); |
1078 | ++incCounter; | 1078 | ++incCounter; |
1079 | uid = inL->uid(); | 1079 | uid = inL->uid(); |
1080 | bool skipIncidence = false; | 1080 | bool skipIncidence = false; |
1081 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1081 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1082 | skipIncidence = true; | 1082 | skipIncidence = true; |
1083 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) | 1083 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) |
1084 | skipIncidence = true; | 1084 | skipIncidence = true; |
1085 | if ( !skipIncidence ) { | 1085 | if ( !skipIncidence ) { |
1086 | inR = remote->incidence( uid ); | 1086 | inR = remote->incidence( uid ); |
1087 | if ( ! inR ) { | 1087 | if ( ! inR ) { |
1088 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1088 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1089 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1089 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1090 | local->deleteIncidence( inL ); | 1090 | local->deleteIncidence( inL ); |
1091 | ++deletedEventL; | 1091 | ++deletedEventL; |
1092 | } else { | 1092 | } else { |
1093 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1093 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1094 | inL->removeID(mCurrentSyncDevice ); | 1094 | inL->removeID(mCurrentSyncDevice ); |
1095 | ++addedEventR; | 1095 | ++addedEventR; |
1096 | inL->setLastModified( modifiedCalendar ); | 1096 | inL->setLastModified( modifiedCalendar ); |
1097 | remote->addIncidence( inL->clone() ); | 1097 | remote->addIncidence( inL->clone() ); |
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | } else { | 1100 | } else { |
1101 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1101 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1102 | checkExternSyncEvent(eventLSyncSharp, inL); | 1102 | checkExternSyncEvent(eventLSyncSharp, inL); |
1103 | local->deleteIncidence( inL ); | 1103 | local->deleteIncidence( inL ); |
1104 | ++deletedEventL; | 1104 | ++deletedEventL; |
1105 | } else { | 1105 | } else { |
1106 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { | 1106 | if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { |
1107 | ++addedEventR; | 1107 | ++addedEventR; |
1108 | inL->setLastModified( modifiedCalendar ); | 1108 | inL->setLastModified( modifiedCalendar ); |
1109 | remote->addIncidence( inL->clone() ); | 1109 | remote->addIncidence( inL->clone() ); |
1110 | } | 1110 | } |
1111 | } | 1111 | } |
1112 | } | 1112 | } |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
1115 | inL = el.next(); | 1115 | inL = el.next(); |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | bar.hide(); | 1118 | bar.hide(); |
1119 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1119 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1120 | eventLSync->setReadOnly( false ); | 1120 | eventLSync->setReadOnly( false ); |
1121 | eventLSync->setDtStart( mLastCalendarSync ); | 1121 | eventLSync->setDtStart( mLastCalendarSync ); |
1122 | eventRSync->setDtStart( mLastCalendarSync ); | 1122 | eventRSync->setDtStart( mLastCalendarSync ); |
1123 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1123 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1124 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1124 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1125 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1125 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1126 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1126 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1127 | eventLSync->setReadOnly( true ); | 1127 | eventLSync->setReadOnly( true ); |
1128 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 1128 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
1129 | remote->addEvent( eventRSync ); | 1129 | remote->addEvent( eventRSync ); |
1130 | QString mes; | 1130 | QString mes; |
1131 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); | 1131 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); |
1132 | if ( KOPrefs::instance()->mShowSyncSummary ) { | 1132 | if ( KOPrefs::instance()->mShowSyncSummary ) { |
1133 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); | 1133 | KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); |
1134 | } | 1134 | } |
1135 | qDebug( mes ); | 1135 | qDebug( mes ); |
1136 | mCalendar->checkAlarmForIncidence( 0, true ); | 1136 | mCalendar->checkAlarmForIncidence( 0, true ); |
1137 | return syncOK; | 1137 | return syncOK; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | void CalendarView::setSyncDevice( QString s ) | 1140 | void CalendarView::setSyncDevice( QString s ) |
1141 | { | 1141 | { |
1142 | mCurrentSyncDevice= s; | 1142 | mCurrentSyncDevice= s; |
1143 | } | 1143 | } |
1144 | void CalendarView::setSyncName( QString s ) | 1144 | void CalendarView::setSyncName( QString s ) |
1145 | { | 1145 | { |
1146 | mCurrentSyncName= s; | 1146 | mCurrentSyncName= s; |
1147 | } | 1147 | } |
1148 | bool CalendarView::syncCalendar(QString filename, int mode) | 1148 | bool CalendarView::syncCalendar(QString filename, int mode) |
1149 | { | 1149 | { |
1150 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1150 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1151 | CalendarLocal* calendar = new CalendarLocal(); | 1151 | CalendarLocal* calendar = new CalendarLocal(); |
1152 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1152 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1153 | FileStorage* storage = new FileStorage( calendar ); | 1153 | FileStorage* storage = new FileStorage( calendar ); |
1154 | bool syncOK = false; | 1154 | bool syncOK = false; |
1155 | storage->setFileName( filename ); | 1155 | storage->setFileName( filename ); |
1156 | // qDebug("loading ... "); | 1156 | // qDebug("loading ... "); |
1157 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1157 | if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1158 | getEventViewerDialog()->setSyncMode( true ); | 1158 | getEventViewerDialog()->setSyncMode( true ); |
1159 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1159 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1160 | getEventViewerDialog()->setSyncMode( false ); | 1160 | getEventViewerDialog()->setSyncMode( false ); |
1161 | if ( syncOK ) { | 1161 | if ( syncOK ) { |
1162 | if ( KOPrefs::instance()->mWriteBackFile ) | 1162 | if ( KOPrefs::instance()->mWriteBackFile ) |
1163 | { | 1163 | { |
1164 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1164 | storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1165 | storage->save(); | 1165 | storage->save(); |
1166 | } | 1166 | } |
1167 | } | 1167 | } |
1168 | setModified( true ); | 1168 | setModified( true ); |
1169 | } | 1169 | } |
1170 | delete storage; | 1170 | delete storage; |
1171 | delete calendar; | 1171 | delete calendar; |
1172 | if ( syncOK ) | 1172 | if ( syncOK ) |
1173 | updateView(); | 1173 | updateView(); |
1174 | return syncOK; | 1174 | return syncOK; |
1175 | } | 1175 | } |
1176 | void CalendarView::syncPhone() | ||
1177 | { | ||
1178 | qDebug("CalendarView::syncPhone() "); | ||
1179 | } | ||
1176 | void CalendarView::syncSharp() | 1180 | void CalendarView::syncSharp() |
1177 | { | 1181 | { |
1178 | #ifndef DESKTOP_VERSION | 1182 | #ifndef DESKTOP_VERSION |
1179 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1183 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1180 | //mCurrentSyncDevice = "sharp-DTM"; | 1184 | //mCurrentSyncDevice = "sharp-DTM"; |
1181 | if ( KOPrefs::instance()->mAskForPreferences ) | 1185 | if ( KOPrefs::instance()->mAskForPreferences ) |
1182 | edit_sync_options(); | 1186 | edit_sync_options(); |
1183 | qApp->processEvents(); | 1187 | qApp->processEvents(); |
1184 | CalendarLocal* calendar = new CalendarLocal(); | 1188 | CalendarLocal* calendar = new CalendarLocal(); |
1185 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1189 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1186 | bool syncOK = false; | 1190 | bool syncOK = false; |
1187 | SharpFormat sharpFormat; | 1191 | SharpFormat sharpFormat; |
1188 | if ( sharpFormat.load( calendar, mCalendar ) ) { | 1192 | if ( sharpFormat.load( calendar, mCalendar ) ) { |
1189 | getEventViewerDialog()->setSyncMode( true ); | 1193 | getEventViewerDialog()->setSyncMode( true ); |
1190 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1194 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1191 | getEventViewerDialog()->setSyncMode( false ); | 1195 | getEventViewerDialog()->setSyncMode( false ); |
1192 | qApp->processEvents(); | 1196 | qApp->processEvents(); |
1193 | if ( syncOK ) { | 1197 | if ( syncOK ) { |
1194 | if ( KOPrefs::instance()->mWriteBackFile ) | 1198 | if ( KOPrefs::instance()->mWriteBackFile ) |
1195 | { | 1199 | { |
1196 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1200 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1197 | Incidence* inc = iL.first(); | 1201 | Incidence* inc = iL.first(); |
1198 | /* obsolete | 1202 | /* obsolete |
1199 | while ( inc ) { | 1203 | while ( inc ) { |
1200 | inc->setZaurusStat( inc->revision () ); | 1204 | inc->setZaurusStat( inc->revision () ); |
1201 | inc = iL.next(); | 1205 | inc = iL.next(); |
1202 | } | 1206 | } |
1203 | */ | 1207 | */ |
1204 | // pending: clean last sync event description | 1208 | // pending: clean last sync event description |
1205 | sharpFormat.save(calendar); | 1209 | sharpFormat.save(calendar); |
1206 | iL = calendar->rawIncidences(); | 1210 | iL = calendar->rawIncidences(); |
1207 | inc = iL.first(); | 1211 | inc = iL.first(); |
1208 | Incidence* loc; | 1212 | Incidence* loc; |
1209 | while ( inc ) { | 1213 | while ( inc ) { |
1210 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1214 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1211 | loc = mCalendar->incidence(inc->uid() ); | 1215 | loc = mCalendar->incidence(inc->uid() ); |
1212 | if ( loc ) { | 1216 | if ( loc ) { |
1213 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1217 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1214 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1218 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1215 | } | 1219 | } |
1216 | } | 1220 | } |
1217 | inc = iL.next(); | 1221 | inc = iL.next(); |
1218 | } | 1222 | } |
1219 | Incidence* lse = getLastSyncEvent(); | 1223 | Incidence* lse = getLastSyncEvent(); |
1220 | if ( lse ) { | 1224 | if ( lse ) { |
1221 | lse->setReadOnly( false ); | 1225 | lse->setReadOnly( false ); |
1222 | lse->setDescription( "" ); | 1226 | lse->setDescription( "" ); |
1223 | lse->setReadOnly( true ); | 1227 | lse->setReadOnly( true ); |
1224 | } | 1228 | } |
1225 | } | 1229 | } |
1226 | } | 1230 | } |
1227 | setModified( true ); | 1231 | setModified( true ); |
1228 | } else { | 1232 | } else { |
1229 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1233 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1230 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1234 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1231 | question, i18n("Ok")) ; | 1235 | question, i18n("Ok")) ; |
1232 | 1236 | ||
1233 | } | 1237 | } |
1234 | delete calendar; | 1238 | delete calendar; |
1235 | updateView(); | 1239 | updateView(); |
1236 | return ;//syncOK; | 1240 | return ;//syncOK; |
1237 | #endif | 1241 | #endif |
1238 | } | 1242 | } |
1239 | 1243 | ||
1240 | 1244 | ||
1241 | #include <kabc/stdaddressbook.h> | 1245 | #include <kabc/stdaddressbook.h> |
1242 | bool CalendarView::importBday() | 1246 | bool CalendarView::importBday() |
1243 | { | 1247 | { |
1244 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1248 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1245 | KABC::AddressBook::Iterator it; | 1249 | KABC::AddressBook::Iterator it; |
1246 | int count = 0; | 1250 | int count = 0; |
1247 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1251 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1248 | ++count; | 1252 | ++count; |
1249 | } | 1253 | } |
1250 | QProgressBar bar(count,0 ); | 1254 | QProgressBar bar(count,0 ); |
1251 | int w = 300; | 1255 | int w = 300; |
1252 | if ( QApplication::desktop()->width() < 320 ) | 1256 | if ( QApplication::desktop()->width() < 320 ) |
1253 | w = 220; | 1257 | w = 220; |
1254 | int h = bar.sizeHint().height() ; | 1258 | int h = bar.sizeHint().height() ; |
1255 | int dw = QApplication::desktop()->width(); | 1259 | int dw = QApplication::desktop()->width(); |
1256 | int dh = QApplication::desktop()->height(); | 1260 | int dh = QApplication::desktop()->height(); |
1257 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1261 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1258 | bar.show(); | 1262 | bar.show(); |
1259 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1263 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1260 | qApp->processEvents(); | 1264 | qApp->processEvents(); |
1261 | count = 0; | 1265 | count = 0; |
1262 | int addCount = 0; | 1266 | int addCount = 0; |
1263 | KCal::Attendee* a = 0; | 1267 | KCal::Attendee* a = 0; |
1264 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1268 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1265 | if ( ! bar.isVisible() ) | 1269 | if ( ! bar.isVisible() ) |
1266 | return false; | 1270 | return false; |
1267 | bar.setProgress( count++ ); | 1271 | bar.setProgress( count++ ); |
1268 | qApp->processEvents(); | 1272 | qApp->processEvents(); |
1269 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1273 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1270 | if ( (*it).birthday().date().isValid() ){ | 1274 | if ( (*it).birthday().date().isValid() ){ |
1271 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1275 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1272 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1276 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1273 | ++addCount; | 1277 | ++addCount; |
1274 | } | 1278 | } |
1275 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1279 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1276 | if ( anni.isValid() ){ | 1280 | if ( anni.isValid() ){ |
1277 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1281 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1278 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1282 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1279 | ++addCount; | 1283 | ++addCount; |
1280 | } | 1284 | } |
1281 | } | 1285 | } |
1282 | updateView(); | 1286 | updateView(); |
1283 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1287 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1284 | return true; | 1288 | return true; |
1285 | } | 1289 | } |
1286 | 1290 | ||
1287 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1291 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1288 | { | 1292 | { |
1289 | //qDebug("addAnni "); | 1293 | //qDebug("addAnni "); |
1290 | Event * ev = new Event(); | 1294 | Event * ev = new Event(); |
1291 | if ( a ) { | 1295 | if ( a ) { |
1292 | ev->addAttendee( a ); | 1296 | ev->addAttendee( a ); |
1293 | } | 1297 | } |
1294 | QString kind; | 1298 | QString kind; |
1295 | if ( birthday ) | 1299 | if ( birthday ) |
1296 | kind = i18n( "Birthday" ); | 1300 | kind = i18n( "Birthday" ); |
1297 | else | 1301 | else |
1298 | kind = i18n( "Anniversary" ); | 1302 | kind = i18n( "Anniversary" ); |
1299 | ev->setSummary( name + " - " + kind ); | 1303 | ev->setSummary( name + " - " + kind ); |
1300 | ev->setOrganizer( "nobody@nowhere" ); | 1304 | ev->setOrganizer( "nobody@nowhere" ); |
1301 | ev->setCategories( kind ); | 1305 | ev->setCategories( kind ); |
1302 | ev->setDtStart( QDateTime(date) ); | 1306 | ev->setDtStart( QDateTime(date) ); |
1303 | ev->setDtEnd( QDateTime(date) ); | 1307 | ev->setDtEnd( QDateTime(date) ); |
1304 | ev->setFloats( true ); | 1308 | ev->setFloats( true ); |
1305 | Recurrence * rec = ev->recurrence(); | 1309 | Recurrence * rec = ev->recurrence(); |
1306 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1310 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1307 | rec->addYearlyNum( date.month() ); | 1311 | rec->addYearlyNum( date.month() ); |
1308 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1312 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1309 | delete ev; | 1313 | delete ev; |
1310 | return false; | 1314 | return false; |
1311 | } | 1315 | } |
1312 | return true; | 1316 | return true; |
1313 | 1317 | ||
1314 | } | 1318 | } |
1315 | bool CalendarView::importQtopia( const QString &categories, | 1319 | bool CalendarView::importQtopia( const QString &categories, |
1316 | const QString &datebook, | 1320 | const QString &datebook, |
1317 | const QString &todolist ) | 1321 | const QString &todolist ) |
1318 | { | 1322 | { |
1319 | 1323 | ||
1320 | QtopiaFormat qtopiaFormat; | 1324 | QtopiaFormat qtopiaFormat; |
1321 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1325 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1322 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1326 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1323 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1327 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1324 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1328 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1325 | 1329 | ||
1326 | updateView(); | 1330 | updateView(); |
1327 | return true; | 1331 | return true; |
1328 | 1332 | ||
1329 | #if 0 | 1333 | #if 0 |
1330 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1334 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1331 | mCurrentSyncDevice = "qtopia-XML"; | 1335 | mCurrentSyncDevice = "qtopia-XML"; |
1332 | if ( KOPrefs::instance()->mAskForPreferences ) | 1336 | if ( KOPrefs::instance()->mAskForPreferences ) |
1333 | edit_sync_options(); | 1337 | edit_sync_options(); |
1334 | qApp->processEvents(); | 1338 | qApp->processEvents(); |
1335 | CalendarLocal* calendar = new CalendarLocal(); | 1339 | CalendarLocal* calendar = new CalendarLocal(); |
1336 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); | 1340 | calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); |
1337 | bool syncOK = false; | 1341 | bool syncOK = false; |
1338 | QtopiaFormat qtopiaFormat; | 1342 | QtopiaFormat qtopiaFormat; |
1339 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1343 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1340 | bool loadOk = true; | 1344 | bool loadOk = true; |
1341 | if ( !categories.isEmpty() ) | 1345 | if ( !categories.isEmpty() ) |
1342 | loadOk = qtopiaFormat.load( calendar, categories ); | 1346 | loadOk = qtopiaFormat.load( calendar, categories ); |
1343 | if ( loadOk && !datebook.isEmpty() ) | 1347 | if ( loadOk && !datebook.isEmpty() ) |
1344 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1348 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1345 | if ( loadOk && !todolist.isEmpty() ) | 1349 | if ( loadOk && !todolist.isEmpty() ) |
1346 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1350 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1347 | 1351 | ||
1348 | if ( loadOk ) { | 1352 | if ( loadOk ) { |
1349 | getEventViewerDialog()->setSyncMode( true ); | 1353 | getEventViewerDialog()->setSyncMode( true ); |
1350 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); | 1354 | syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); |
1351 | getEventViewerDialog()->setSyncMode( false ); | 1355 | getEventViewerDialog()->setSyncMode( false ); |
1352 | qApp->processEvents(); | 1356 | qApp->processEvents(); |
1353 | if ( syncOK ) { | 1357 | if ( syncOK ) { |
1354 | if ( KOPrefs::instance()->mWriteBackFile ) | 1358 | if ( KOPrefs::instance()->mWriteBackFile ) |
1355 | { | 1359 | { |
1356 | // write back XML file | 1360 | // write back XML file |
1357 | 1361 | ||
1358 | } | 1362 | } |
1359 | setModified( true ); | 1363 | setModified( true ); |
1360 | } | 1364 | } |
1361 | } else { | 1365 | } else { |
1362 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1366 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1363 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1367 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1364 | question, i18n("Ok")) ; | 1368 | question, i18n("Ok")) ; |
1365 | } | 1369 | } |
1366 | delete calendar; | 1370 | delete calendar; |
1367 | updateView(); | 1371 | updateView(); |
1368 | return syncOK; | 1372 | return syncOK; |
1369 | 1373 | ||
1370 | 1374 | ||
1371 | #endif | 1375 | #endif |
1372 | 1376 | ||
1373 | } | 1377 | } |
1374 | 1378 | ||
1375 | void CalendarView::setSyncEventsReadOnly() | 1379 | void CalendarView::setSyncEventsReadOnly() |
1376 | { | 1380 | { |
1377 | Event * ev; | 1381 | Event * ev; |
1378 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1382 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1379 | ev = eL.first(); | 1383 | ev = eL.first(); |
1380 | while ( ev ) { | 1384 | while ( ev ) { |
1381 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1385 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1382 | ev->setReadOnly( true ); | 1386 | ev->setReadOnly( true ); |
1383 | ev = eL.next(); | 1387 | ev = eL.next(); |
1384 | } | 1388 | } |
1385 | } | 1389 | } |
1386 | bool CalendarView::openCalendar(QString filename, bool merge) | 1390 | bool CalendarView::openCalendar(QString filename, bool merge) |
1387 | { | 1391 | { |
1388 | 1392 | ||
1389 | if (filename.isEmpty()) { | 1393 | if (filename.isEmpty()) { |
1390 | return false; | 1394 | return false; |
1391 | } | 1395 | } |
1392 | 1396 | ||
1393 | if (!QFile::exists(filename)) { | 1397 | if (!QFile::exists(filename)) { |
1394 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1398 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1395 | return false; | 1399 | return false; |
1396 | } | 1400 | } |
1397 | 1401 | ||
1398 | globalFlagBlockAgenda = 1; | 1402 | globalFlagBlockAgenda = 1; |
1399 | if (!merge) mCalendar->close(); | 1403 | if (!merge) mCalendar->close(); |
1400 | 1404 | ||
1401 | mStorage->setFileName( filename ); | 1405 | mStorage->setFileName( filename ); |
1402 | 1406 | ||
1403 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { | 1407 | if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { |
1404 | if ( merge ) ;//setModified( true ); | 1408 | if ( merge ) ;//setModified( true ); |
1405 | else { | 1409 | else { |
1406 | //setModified( true ); | 1410 | //setModified( true ); |
1407 | mViewManager->setDocumentId( filename ); | 1411 | mViewManager->setDocumentId( filename ); |
1408 | mDialogManager->setDocumentId( filename ); | 1412 | mDialogManager->setDocumentId( filename ); |
1409 | mTodoList->setDocumentId( filename ); | 1413 | mTodoList->setDocumentId( filename ); |
1410 | } | 1414 | } |
1411 | globalFlagBlockAgenda = 2; | 1415 | globalFlagBlockAgenda = 2; |
1412 | // if ( getLastSyncEvent() ) | 1416 | // if ( getLastSyncEvent() ) |
1413 | // getLastSyncEvent()->setReadOnly( true ); | 1417 | // getLastSyncEvent()->setReadOnly( true ); |
1414 | mCalendar->reInitAlarmSettings(); | 1418 | mCalendar->reInitAlarmSettings(); |
1415 | setSyncEventsReadOnly(); | 1419 | setSyncEventsReadOnly(); |
1416 | updateUnmanagedViews(); | 1420 | updateUnmanagedViews(); |
1417 | updateView(); | 1421 | updateView(); |
1418 | if ( filename != MainWindow::defaultFileName() ) | 1422 | if ( filename != MainWindow::defaultFileName() ) |
1419 | saveCalendar( MainWindow::defaultFileName() ); | 1423 | saveCalendar( MainWindow::defaultFileName() ); |
1420 | loadedFileVersion = QDateTime::currentDateTime(); | 1424 | loadedFileVersion = QDateTime::currentDateTime(); |
1421 | return true; | 1425 | return true; |
1422 | } else { | 1426 | } else { |
1423 | // while failing to load, the calendar object could | 1427 | // while failing to load, the calendar object could |
1424 | // have become partially populated. Clear it out. | 1428 | // have become partially populated. Clear it out. |
1425 | if ( !merge ) mCalendar->close(); | 1429 | if ( !merge ) mCalendar->close(); |
1426 | 1430 | ||
1427 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1431 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1428 | 1432 | ||
1429 | globalFlagBlockAgenda = 2; | 1433 | globalFlagBlockAgenda = 2; |
1430 | updateView(); | 1434 | updateView(); |
1431 | } | 1435 | } |
1432 | return false; | 1436 | return false; |
1433 | } | 1437 | } |
1434 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1438 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1435 | { | 1439 | { |
1436 | loadedFileVersion = dt; | 1440 | loadedFileVersion = dt; |
1437 | } | 1441 | } |
1438 | bool CalendarView::checkFileChanged(QString fn) | 1442 | bool CalendarView::checkFileChanged(QString fn) |
1439 | { | 1443 | { |
1440 | QFileInfo finf ( fn ); | 1444 | QFileInfo finf ( fn ); |
1441 | if ( !finf.exists() ) | 1445 | if ( !finf.exists() ) |
1442 | return true; | 1446 | return true; |
1443 | QDateTime dt = finf.lastModified (); | 1447 | QDateTime dt = finf.lastModified (); |
1444 | if ( dt <= loadedFileVersion ) | 1448 | if ( dt <= loadedFileVersion ) |
1445 | return false; | 1449 | return false; |
1446 | return true; | 1450 | return true; |
1447 | 1451 | ||
1448 | } | 1452 | } |
1449 | bool CalendarView::checkFileVersion(QString fn) | 1453 | bool CalendarView::checkFileVersion(QString fn) |
1450 | { | 1454 | { |
1451 | QFileInfo finf ( fn ); | 1455 | QFileInfo finf ( fn ); |
1452 | if ( !finf.exists() ) | 1456 | if ( !finf.exists() ) |
1453 | return true; | 1457 | return true; |
1454 | QDateTime dt = finf.lastModified (); | 1458 | QDateTime dt = finf.lastModified (); |
1455 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1459 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1456 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1460 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1457 | if ( dt <= loadedFileVersion ) | 1461 | if ( dt <= loadedFileVersion ) |
1458 | return true; | 1462 | return true; |
1459 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , | 1463 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , |
1460 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1464 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1461 | i18n("Sync+save")); | 1465 | i18n("Sync+save")); |
1462 | 1466 | ||
1463 | if ( km == KMessageBox::Cancel ) | 1467 | if ( km == KMessageBox::Cancel ) |
1464 | return false; | 1468 | return false; |
1465 | if ( km == KMessageBox::Yes ) | 1469 | if ( km == KMessageBox::Yes ) |
1466 | return true; | 1470 | return true; |
1467 | 1471 | ||
1468 | setSyncDevice("deleteaftersync" ); | 1472 | setSyncDevice("deleteaftersync" ); |
1469 | KOPrefs::instance()->mAskForPreferences = true; | 1473 | KOPrefs::instance()->mAskForPreferences = true; |
1470 | KOPrefs::instance()->mSyncAlgoPrefs = 3; | 1474 | KOPrefs::instance()->mSyncAlgoPrefs = 3; |
1471 | KOPrefs::instance()->mWriteBackFile = false; | 1475 | KOPrefs::instance()->mWriteBackFile = false; |
1472 | KOPrefs::instance()->mWriteBackExistingOnly = false; | 1476 | KOPrefs::instance()->mWriteBackExistingOnly = false; |
1473 | KOPrefs::instance()->mShowSyncSummary = false; | 1477 | KOPrefs::instance()->mShowSyncSummary = false; |
1474 | syncCalendar( fn, 3 ); | 1478 | syncCalendar( fn, 3 ); |
1475 | Event * e = getLastSyncEvent(); | 1479 | Event * e = getLastSyncEvent(); |
1476 | mCalendar->deleteEvent ( e ); | 1480 | mCalendar->deleteEvent ( e ); |
1477 | updateView(); | 1481 | updateView(); |
1478 | return true; | 1482 | return true; |
1479 | } | 1483 | } |
1480 | 1484 | ||
1481 | bool CalendarView::saveCalendar( QString filename ) | 1485 | bool CalendarView::saveCalendar( QString filename ) |
1482 | { | 1486 | { |
1483 | 1487 | ||
1484 | // Store back all unsaved data into calendar object | 1488 | // Store back all unsaved data into calendar object |
1485 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1489 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1486 | if ( mViewManager->currentView() ) | 1490 | if ( mViewManager->currentView() ) |
1487 | mViewManager->currentView()->flushView(); | 1491 | mViewManager->currentView()->flushView(); |
1488 | 1492 | ||
1489 | //mStorage->setFileName( filename ); | 1493 | //mStorage->setFileName( filename ); |
1490 | 1494 | ||
1491 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); | 1495 | mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); |
1492 | mStorage->setFileName( filename ); | 1496 | mStorage->setFileName( filename ); |
1493 | bool success; | 1497 | bool success; |
1494 | success = mStorage->save(); | 1498 | success = mStorage->save(); |
1495 | if ( !success ) { | 1499 | if ( !success ) { |
1496 | return false; | 1500 | return false; |
1497 | } | 1501 | } |
1498 | 1502 | ||
1499 | return true; | 1503 | return true; |
1500 | } | 1504 | } |
1501 | 1505 | ||
1502 | void CalendarView::closeCalendar() | 1506 | void CalendarView::closeCalendar() |
1503 | { | 1507 | { |
1504 | 1508 | ||
1505 | // child windows no longer valid | 1509 | // child windows no longer valid |
1506 | emit closingDown(); | 1510 | emit closingDown(); |
1507 | 1511 | ||
1508 | mCalendar->close(); | 1512 | mCalendar->close(); |
1509 | setModified(false); | 1513 | setModified(false); |
1510 | updateView(); | 1514 | updateView(); |
1511 | } | 1515 | } |
1512 | 1516 | ||
1513 | void CalendarView::archiveCalendar() | 1517 | void CalendarView::archiveCalendar() |
1514 | { | 1518 | { |
1515 | mDialogManager->showArchiveDialog(); | 1519 | mDialogManager->showArchiveDialog(); |
1516 | } | 1520 | } |
1517 | 1521 | ||
1518 | 1522 | ||
1519 | void CalendarView::readSettings() | 1523 | void CalendarView::readSettings() |
1520 | { | 1524 | { |
1521 | 1525 | ||
1522 | 1526 | ||
1523 | // mViewManager->showAgendaView(); | 1527 | // mViewManager->showAgendaView(); |
1524 | QString str; | 1528 | QString str; |
1525 | //qDebug("CalendarView::readSettings() "); | 1529 | //qDebug("CalendarView::readSettings() "); |
1526 | // read settings from the KConfig, supplying reasonable | 1530 | // read settings from the KConfig, supplying reasonable |
1527 | // defaults where none are to be found | 1531 | // defaults where none are to be found |
1528 | KConfig *config = KOGlobals::config(); | 1532 | KConfig *config = KOGlobals::config(); |
1529 | #ifndef KORG_NOSPLITTER | 1533 | #ifndef KORG_NOSPLITTER |
1530 | config->setGroup("KOrganizer Geometry"); | 1534 | config->setGroup("KOrganizer Geometry"); |
1531 | 1535 | ||
1532 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 1536 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
1533 | if (sizes.count() != 2) { | 1537 | if (sizes.count() != 2) { |
1534 | sizes << mDateNavigator->minimumSizeHint().width(); | 1538 | sizes << mDateNavigator->minimumSizeHint().width(); |
1535 | sizes << 300; | 1539 | sizes << 300; |
1536 | } | 1540 | } |
1537 | mPanner->setSizes(sizes); | 1541 | mPanner->setSizes(sizes); |
1538 | 1542 | ||
1539 | sizes = config->readIntListEntry("Separator2"); | 1543 | sizes = config->readIntListEntry("Separator2"); |
1540 | if ( ( mResourceView && sizes.count() == 4 ) || | 1544 | if ( ( mResourceView && sizes.count() == 4 ) || |
1541 | ( !mResourceView && sizes.count() == 3 ) ) { | 1545 | ( !mResourceView && sizes.count() == 3 ) ) { |
1542 | mLeftSplitter->setSizes(sizes); | 1546 | mLeftSplitter->setSizes(sizes); |
1543 | } | 1547 | } |
1544 | #endif | 1548 | #endif |
1545 | globalFlagBlockAgenda = 1; | 1549 | globalFlagBlockAgenda = 1; |
1546 | mViewManager->showAgendaView(); | 1550 | mViewManager->showAgendaView(); |
1547 | //mViewManager->readSettings( config ); | 1551 | //mViewManager->readSettings( config ); |
1548 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 1552 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
1549 | readFilterSettings(config); | 1553 | readFilterSettings(config); |
1550 | config->setGroup( "Views" ); | 1554 | config->setGroup( "Views" ); |
1551 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 1555 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
1552 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 1556 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
1553 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 1557 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
1554 | else mNavigator->selectDates( dateCount ); | 1558 | else mNavigator->selectDates( dateCount ); |
1555 | // mViewManager->readSettings( config ); | 1559 | // mViewManager->readSettings( config ); |
1556 | updateConfig(); | 1560 | updateConfig(); |
1557 | globalFlagBlockAgenda = 2; | 1561 | globalFlagBlockAgenda = 2; |
1558 | mViewManager->readSettings( config ); | 1562 | mViewManager->readSettings( config ); |
1559 | #ifdef DESKTOP_VERSION | 1563 | #ifdef DESKTOP_VERSION |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index d564473..b2838db 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -44,545 +44,546 @@ | |||
44 | 44 | ||
45 | class QWidgetStack; | 45 | class QWidgetStack; |
46 | class QSplitter; | 46 | class QSplitter; |
47 | 47 | ||
48 | class CalPrinter; | 48 | class CalPrinter; |
49 | class KOFilterView; | 49 | class KOFilterView; |
50 | class KOViewManager; | 50 | class KOViewManager; |
51 | class KODialogManager; | 51 | class KODialogManager; |
52 | class KOTodoView; | 52 | class KOTodoView; |
53 | class KDateNavigator; | 53 | class KDateNavigator; |
54 | class DateNavigator; | 54 | class DateNavigator; |
55 | class KOIncidenceEditor; | 55 | class KOIncidenceEditor; |
56 | class KDatePicker; | 56 | class KDatePicker; |
57 | class ResourceView; | 57 | class ResourceView; |
58 | class NavigatorBar; | 58 | class NavigatorBar; |
59 | class KOEventEditor; | 59 | class KOEventEditor; |
60 | class KOTodoEditor ; | 60 | class KOTodoEditor ; |
61 | class KOEventViewerDialog; | 61 | class KOEventViewerDialog; |
62 | class KOBeamPrefs; | 62 | class KOBeamPrefs; |
63 | class KSyncProfile; | 63 | class KSyncProfile; |
64 | class AlarmDialog; | 64 | class AlarmDialog; |
65 | class KCal::Attendee; | 65 | class KCal::Attendee; |
66 | 66 | ||
67 | namespace KCal { class FileStorage; } | 67 | namespace KCal { class FileStorage; } |
68 | 68 | ||
69 | using namespace KCal; | 69 | using namespace KCal; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | This is the main calendar widget. It provides the different vies on t he | 72 | This is the main calendar widget. It provides the different vies on t he |
73 | calendar data as well as the date navigator. It also handles synchronisation | 73 | calendar data as well as the date navigator. It also handles synchronisation |
74 | of the different views and controls the different dialogs like preferences, | 74 | of the different views and controls the different dialogs like preferences, |
75 | event editor, search dialog etc. | 75 | event editor, search dialog etc. |
76 | 76 | ||
77 | @short main calendar view widget | 77 | @short main calendar view widget |
78 | @author Cornelius Schumacher | 78 | @author Cornelius Schumacher |
79 | */ | 79 | */ |
80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer | 80 | class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer |
81 | { | 81 | { |
82 | Q_OBJECT | 82 | Q_OBJECT |
83 | public: | 83 | public: |
84 | /** | 84 | /** |
85 | Constructs a new calendar view widget. | 85 | Constructs a new calendar view widget. |
86 | 86 | ||
87 | @param calendar calendar document | 87 | @param calendar calendar document |
88 | @param parent parent window | 88 | @param parent parent window |
89 | @param name Qt internal widget object name | 89 | @param name Qt internal widget object name |
90 | */ | 90 | */ |
91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, | 91 | CalendarView( CalendarResources *calendar, QWidget *parent = 0, |
92 | const char *name = 0 ); | 92 | const char *name = 0 ); |
93 | CalendarView( Calendar *calendar, QWidget *parent = 0, | 93 | CalendarView( Calendar *calendar, QWidget *parent = 0, |
94 | const char *name = 0 ); | 94 | const char *name = 0 ); |
95 | virtual ~CalendarView(); | 95 | virtual ~CalendarView(); |
96 | 96 | ||
97 | Calendar *calendar() { return mCalendar; } | 97 | Calendar *calendar() { return mCalendar; } |
98 | 98 | ||
99 | KOViewManager *viewManager(); | 99 | KOViewManager *viewManager(); |
100 | KODialogManager *dialogManager(); | 100 | KODialogManager *dialogManager(); |
101 | 101 | ||
102 | QDate startDate(); | 102 | QDate startDate(); |
103 | QDate endDate(); | 103 | QDate endDate(); |
104 | 104 | ||
105 | QWidgetStack *viewStack(); | 105 | QWidgetStack *viewStack(); |
106 | QWidget *leftFrame(); | 106 | QWidget *leftFrame(); |
107 | NavigatorBar *navigatorBar(); | 107 | NavigatorBar *navigatorBar(); |
108 | 108 | ||
109 | DateNavigator *dateNavigator(); | 109 | DateNavigator *dateNavigator(); |
110 | KDateNavigator *dateNavigatorWidget(); | 110 | KDateNavigator *dateNavigatorWidget(); |
111 | 111 | ||
112 | void addView(KOrg::BaseView *); | 112 | void addView(KOrg::BaseView *); |
113 | void showView(KOrg::BaseView *); | 113 | void showView(KOrg::BaseView *); |
114 | KOEventViewerDialog* getEventViewerDialog(); | 114 | KOEventViewerDialog* getEventViewerDialog(); |
115 | Incidence *currentSelection(); | 115 | Incidence *currentSelection(); |
116 | void setupExternSyncProfiles(); | 116 | void setupExternSyncProfiles(); |
117 | 117 | ||
118 | signals: | 118 | signals: |
119 | /** This todo has been modified */ | 119 | /** This todo has been modified */ |
120 | void todoModified(Todo *, int); | 120 | void todoModified(Todo *, int); |
121 | 121 | ||
122 | /** when change is made to options dialog, the topwidget will catch this | 122 | /** when change is made to options dialog, the topwidget will catch this |
123 | * and emit this signal which notifies all widgets which have registered | 123 | * and emit this signal which notifies all widgets which have registered |
124 | * for notification to update their settings. */ | 124 | * for notification to update their settings. */ |
125 | void configChanged(); | 125 | void configChanged(); |
126 | /** emitted when the topwidget is closing down, so that any attached | 126 | /** emitted when the topwidget is closing down, so that any attached |
127 | child windows can also close. */ | 127 | child windows can also close. */ |
128 | void closingDown(); | 128 | void closingDown(); |
129 | /** emitted right before we die */ | 129 | /** emitted right before we die */ |
130 | void closed(QWidget *); | 130 | void closed(QWidget *); |
131 | 131 | ||
132 | /** Emitted when state of modified flag changes */ | 132 | /** Emitted when state of modified flag changes */ |
133 | void modifiedChanged(bool); | 133 | void modifiedChanged(bool); |
134 | void signalmodified(); | 134 | void signalmodified(); |
135 | 135 | ||
136 | /** Emitted when state of read-only flag changes */ | 136 | /** Emitted when state of read-only flag changes */ |
137 | void readOnlyChanged(bool); | 137 | void readOnlyChanged(bool); |
138 | 138 | ||
139 | /** Emitted when the unit of navigation changes */ | 139 | /** Emitted when the unit of navigation changes */ |
140 | void changeNavStringPrev(const QString &); | 140 | void changeNavStringPrev(const QString &); |
141 | void changeNavStringNext(const QString &); | 141 | void changeNavStringNext(const QString &); |
142 | 142 | ||
143 | /** Emitted when state of events selection has changed and user is organizer*/ | 143 | /** Emitted when state of events selection has changed and user is organizer*/ |
144 | void organizerEventsSelected(bool); | 144 | void organizerEventsSelected(bool); |
145 | /** Emitted when state of events selection has changed and user is attendee*/ | 145 | /** Emitted when state of events selection has changed and user is attendee*/ |
146 | void groupEventsSelected(bool); | 146 | void groupEventsSelected(bool); |
147 | /** | 147 | /** |
148 | Emitted when an incidence gets selected. If the selection is cleared the | 148 | Emitted when an incidence gets selected. If the selection is cleared the |
149 | signal is emitted with 0 as argument. | 149 | signal is emitted with 0 as argument. |
150 | */ | 150 | */ |
151 | void incidenceSelected( Incidence * ); | 151 | void incidenceSelected( Incidence * ); |
152 | /** Emitted, when a todoitem is selected or deselected. */ | 152 | /** Emitted, when a todoitem is selected or deselected. */ |
153 | void todoSelected( bool ); | 153 | void todoSelected( bool ); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Emitted, when clipboard content changes. Parameter indicates if paste | 156 | Emitted, when clipboard content changes. Parameter indicates if paste |
157 | is possible or not. | 157 | is possible or not. |
158 | */ | 158 | */ |
159 | void pasteEnabled(bool); | 159 | void pasteEnabled(bool); |
160 | 160 | ||
161 | /** Emitted, when the number of incoming messages has changed. */ | 161 | /** Emitted, when the number of incoming messages has changed. */ |
162 | void numIncomingChanged(int); | 162 | void numIncomingChanged(int); |
163 | 163 | ||
164 | /** Emitted, when the number of outgoing messages has changed. */ | 164 | /** Emitted, when the number of outgoing messages has changed. */ |
165 | void numOutgoingChanged(int); | 165 | void numOutgoingChanged(int); |
166 | 166 | ||
167 | /** Send status message, which can e.g. be displayed in the status bar. */ | 167 | /** Send status message, which can e.g. be displayed in the status bar. */ |
168 | void statusMessage(const QString &); | 168 | void statusMessage(const QString &); |
169 | 169 | ||
170 | void calendarViewExpanded( bool ); | 170 | void calendarViewExpanded( bool ); |
171 | void updateSearchDialog(); | 171 | void updateSearchDialog(); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void recheckTimerAlarm(); | 175 | void recheckTimerAlarm(); |
176 | void checkNextTimerAlarm(); | 176 | void checkNextTimerAlarm(); |
177 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 177 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
178 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 178 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
179 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | 180 | ||
181 | /** options dialog made a changed to the configuration. we catch this | 181 | /** options dialog made a changed to the configuration. we catch this |
182 | * and notify all widgets which need to update their configuration. */ | 182 | * and notify all widgets which need to update their configuration. */ |
183 | void updateConfig(); | 183 | void updateConfig(); |
184 | 184 | ||
185 | /** | 185 | /** |
186 | Load calendar from file \a filename. If \a merge is true, load | 186 | Load calendar from file \a filename. If \a merge is true, load |
187 | calendar into existing one, if it is false, clear calendar, before | 187 | calendar into existing one, if it is false, clear calendar, before |
188 | loading. Return true, if calendar could be successfully loaded. | 188 | loading. Return true, if calendar could be successfully loaded. |
189 | */ | 189 | */ |
190 | bool openCalendar(QString filename, bool merge=false); | 190 | bool openCalendar(QString filename, bool merge=false); |
191 | bool syncCalendar(QString filename,int mode = 0 ); | 191 | bool syncCalendar(QString filename,int mode = 0 ); |
192 | 192 | ||
193 | /** | 193 | /** |
194 | Save calendar data to file. Return true if calendar could be | 194 | Save calendar data to file. Return true if calendar could be |
195 | successfully saved. | 195 | successfully saved. |
196 | */ | 196 | */ |
197 | bool saveCalendar(QString filename); | 197 | bool saveCalendar(QString filename); |
198 | 198 | ||
199 | /** | 199 | /** |
200 | Close calendar. Clear calendar data and reset views to display an empty | 200 | Close calendar. Clear calendar data and reset views to display an empty |
201 | calendar. | 201 | calendar. |
202 | */ | 202 | */ |
203 | void closeCalendar(); | 203 | void closeCalendar(); |
204 | 204 | ||
205 | /** Archive old events of calendar */ | 205 | /** Archive old events of calendar */ |
206 | void archiveCalendar(); | 206 | void archiveCalendar(); |
207 | 207 | ||
208 | void showIncidence(); | 208 | void showIncidence(); |
209 | void editIncidence(); | 209 | void editIncidence(); |
210 | void editIncidenceDescription(); | 210 | void editIncidenceDescription(); |
211 | void deleteIncidence(); | 211 | void deleteIncidence(); |
212 | 212 | ||
213 | /** create an editeventwin with supplied date/time, and if bool is true, | 213 | /** create an editeventwin with supplied date/time, and if bool is true, |
214 | * make the event take all day. */ | 214 | * make the event take all day. */ |
215 | void newEvent(QDateTime, QDateTime, bool allDay = false); | 215 | void newEvent(QDateTime, QDateTime, bool allDay = false); |
216 | void newEvent(QDateTime fh); | 216 | void newEvent(QDateTime fh); |
217 | void newEvent(QDate dt); | 217 | void newEvent(QDate dt); |
218 | /** create new event without having a date hint. Takes current date as | 218 | /** create new event without having a date hint. Takes current date as |
219 | default hint. */ | 219 | default hint. */ |
220 | void newEvent(); | 220 | void newEvent(); |
221 | void newFloatingEvent(); | 221 | void newFloatingEvent(); |
222 | 222 | ||
223 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ | 223 | /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ |
224 | void showIncidence(Incidence *); | 224 | void showIncidence(Incidence *); |
225 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ | 225 | /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ |
226 | void editIncidence(Incidence *); | 226 | void editIncidence(Incidence *); |
227 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ | 227 | /** Delete the supplied incidence. It calls the correct deleteXXX method*/ |
228 | void deleteIncidence(Incidence *); | 228 | void deleteIncidence(Incidence *); |
229 | void cloneIncidence(Incidence *); | 229 | void cloneIncidence(Incidence *); |
230 | void cancelIncidence(Incidence *); | 230 | void cancelIncidence(Incidence *); |
231 | /** Create an editor for the supplied event. */ | 231 | /** Create an editor for the supplied event. */ |
232 | void editEvent(Event *); | 232 | void editEvent(Event *); |
233 | /** Delete the supplied event. */ | 233 | /** Delete the supplied event. */ |
234 | void deleteEvent(Event *); | 234 | void deleteEvent(Event *); |
235 | /** Delete the event with the given unique ID. Returns false, if event wasn't | 235 | /** Delete the event with the given unique ID. Returns false, if event wasn't |
236 | found. */ | 236 | found. */ |
237 | bool deleteEvent(const QString &uid); | 237 | bool deleteEvent(const QString &uid); |
238 | /** Create a read-only viewer dialog for the supplied event. */ | 238 | /** Create a read-only viewer dialog for the supplied event. */ |
239 | void showEvent(Event *); | 239 | void showEvent(Event *); |
240 | 240 | ||
241 | void editJournal(Journal *); | 241 | void editJournal(Journal *); |
242 | void showJournal(Journal *); | 242 | void showJournal(Journal *); |
243 | void deleteJournal(Journal *); | 243 | void deleteJournal(Journal *); |
244 | /** Create an editor dialog for a todo */ | 244 | /** Create an editor dialog for a todo */ |
245 | void editTodo(Todo *); | 245 | void editTodo(Todo *); |
246 | /** Create a read-only viewer dialog for the supplied todo */ | 246 | /** Create a read-only viewer dialog for the supplied todo */ |
247 | void showTodo(Todo *); | 247 | void showTodo(Todo *); |
248 | /** create new todo */ | 248 | /** create new todo */ |
249 | void newTodo(); | 249 | void newTodo(); |
250 | /** create new todo with a parent todo */ | 250 | /** create new todo with a parent todo */ |
251 | void newSubTodo(); | 251 | void newSubTodo(); |
252 | /** create new todo with a parent todo */ | 252 | /** create new todo with a parent todo */ |
253 | void newSubTodo(Todo *); | 253 | void newSubTodo(Todo *); |
254 | /** Delete todo */ | 254 | /** Delete todo */ |
255 | void deleteTodo(Todo *); | 255 | void deleteTodo(Todo *); |
256 | 256 | ||
257 | 257 | ||
258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is | 258 | /** Check if clipboard contains vCalendar event. The signal pasteEnabled() is |
259 | * emitted as result. */ | 259 | * emitted as result. */ |
260 | void checkClipboard(); | 260 | void checkClipboard(); |
261 | 261 | ||
262 | /** using the KConfig associated with the kapp variable, read in the | 262 | /** using the KConfig associated with the kapp variable, read in the |
263 | * settings from the config file. | 263 | * settings from the config file. |
264 | */ | 264 | */ |
265 | void readSettings(); | 265 | void readSettings(); |
266 | 266 | ||
267 | /** write current state to config file. */ | 267 | /** write current state to config file. */ |
268 | void writeSettings(); | 268 | void writeSettings(); |
269 | 269 | ||
270 | /** read settings for calendar filters */ | 270 | /** read settings for calendar filters */ |
271 | void readFilterSettings(KConfig *config); | 271 | void readFilterSettings(KConfig *config); |
272 | 272 | ||
273 | /** write settings for calendar filters */ | 273 | /** write settings for calendar filters */ |
274 | void writeFilterSettings(KConfig *config); | 274 | void writeFilterSettings(KConfig *config); |
275 | 275 | ||
276 | /** passes on the message that an event has changed to the currently | 276 | /** passes on the message that an event has changed to the currently |
277 | * activated view so that it can make appropriate display changes. */ | 277 | * activated view so that it can make appropriate display changes. */ |
278 | void changeEventDisplay(Event *, int); | 278 | void changeEventDisplay(Event *, int); |
279 | void changeIncidenceDisplay(Incidence *, int); | 279 | void changeIncidenceDisplay(Incidence *, int); |
280 | void changeTodoDisplay(Todo *, int); | 280 | void changeTodoDisplay(Todo *, int); |
281 | 281 | ||
282 | void eventAdded(Event *); | 282 | void eventAdded(Event *); |
283 | void eventChanged(Event *); | 283 | void eventChanged(Event *); |
284 | void eventToBeDeleted(Event *); | 284 | void eventToBeDeleted(Event *); |
285 | void eventDeleted(); | 285 | void eventDeleted(); |
286 | 286 | ||
287 | void todoAdded(Todo *); | 287 | void todoAdded(Todo *); |
288 | void todoChanged(Todo *); | 288 | void todoChanged(Todo *); |
289 | void todoToBeDeleted(Todo *); | 289 | void todoToBeDeleted(Todo *); |
290 | void todoDeleted(); | 290 | void todoDeleted(); |
291 | 291 | ||
292 | void updateView(const QDate &start, const QDate &end); | 292 | void updateView(const QDate &start, const QDate &end); |
293 | void updateView(); | 293 | void updateView(); |
294 | 294 | ||
295 | /** Full update of visible todo views */ | 295 | /** Full update of visible todo views */ |
296 | void updateTodoViews(); | 296 | void updateTodoViews(); |
297 | 297 | ||
298 | void updateUnmanagedViews(); | 298 | void updateUnmanagedViews(); |
299 | 299 | ||
300 | /** cut the current appointment to the clipboard */ | 300 | /** cut the current appointment to the clipboard */ |
301 | void edit_cut(); | 301 | void edit_cut(); |
302 | 302 | ||
303 | /** copy the current appointment(s) to the clipboard */ | 303 | /** copy the current appointment(s) to the clipboard */ |
304 | void edit_copy(); | 304 | void edit_copy(); |
305 | 305 | ||
306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ | 306 | /** paste the current vobject(s) in the clipboard buffer into calendar */ |
307 | void edit_paste(); | 307 | void edit_paste(); |
308 | 308 | ||
309 | /** edit viewing and configuration options. */ | 309 | /** edit viewing and configuration options. */ |
310 | void edit_options(); | 310 | void edit_options(); |
311 | void edit_sync_options(); | 311 | void edit_sync_options(); |
312 | /** | 312 | /** |
313 | Functions for printing, previewing a print, and setting up printing | 313 | Functions for printing, previewing a print, and setting up printing |
314 | parameters. | 314 | parameters. |
315 | */ | 315 | */ |
316 | void print(); | 316 | void print(); |
317 | void printSetup(); | 317 | void printSetup(); |
318 | void printPreview(); | 318 | void printPreview(); |
319 | 319 | ||
320 | /** Export as iCalendar file */ | 320 | /** Export as iCalendar file */ |
321 | void exportICalendar(); | 321 | void exportICalendar(); |
322 | 322 | ||
323 | /** Export as vCalendar file */ | 323 | /** Export as vCalendar file */ |
324 | bool exportVCalendar( QString fn); | 324 | bool exportVCalendar( QString fn); |
325 | 325 | ||
326 | /** pop up a dialog to show an existing appointment. */ | 326 | /** pop up a dialog to show an existing appointment. */ |
327 | void appointment_show(); | 327 | void appointment_show(); |
328 | /** | 328 | /** |
329 | * pop up an Appointment Dialog to edit an existing appointment.Get | 329 | * pop up an Appointment Dialog to edit an existing appointment.Get |
330 | * information on the appointment from the list of unique IDs that is | 330 | * information on the appointment from the list of unique IDs that is |
331 | * currently in the View, called currIds. | 331 | * currently in the View, called currIds. |
332 | */ | 332 | */ |
333 | void appointment_edit(); | 333 | void appointment_edit(); |
334 | /** | 334 | /** |
335 | * pop up dialog confirming deletion of currently selected event in the | 335 | * pop up dialog confirming deletion of currently selected event in the |
336 | * View. | 336 | * View. |
337 | */ | 337 | */ |
338 | void appointment_delete(); | 338 | void appointment_delete(); |
339 | 339 | ||
340 | /** mails the currently selected event to a particular user as a vCalendar | 340 | /** mails the currently selected event to a particular user as a vCalendar |
341 | attachment. */ | 341 | attachment. */ |
342 | void action_mail(); | 342 | void action_mail(); |
343 | 343 | ||
344 | /* frees a subtodo from it's relation */ | 344 | /* frees a subtodo from it's relation */ |
345 | void todo_unsub( Todo * ); | 345 | void todo_unsub( Todo * ); |
346 | 346 | ||
347 | /** Take ownership of selected event. */ | 347 | /** Take ownership of selected event. */ |
348 | void takeOverEvent(); | 348 | void takeOverEvent(); |
349 | 349 | ||
350 | /** Take ownership of all events in calendar. */ | 350 | /** Take ownership of all events in calendar. */ |
351 | void takeOverCalendar(); | 351 | void takeOverCalendar(); |
352 | 352 | ||
353 | /** query whether or not the calendar is "dirty". */ | 353 | /** query whether or not the calendar is "dirty". */ |
354 | bool isModified(); | 354 | bool isModified(); |
355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ | 355 | /** set the state of calendar. Modified means "dirty", i.e. needing a save. */ |
356 | void setModified(bool modified=true); | 356 | void setModified(bool modified=true); |
357 | 357 | ||
358 | /** query if the calendar is read-only. */ | 358 | /** query if the calendar is read-only. */ |
359 | bool isReadOnly(); | 359 | bool isReadOnly(); |
360 | /** set state of calendar to read-only */ | 360 | /** set state of calendar to read-only */ |
361 | void setReadOnly(bool readOnly=true); | 361 | void setReadOnly(bool readOnly=true); |
362 | 362 | ||
363 | void eventUpdated(Incidence *); | 363 | void eventUpdated(Incidence *); |
364 | 364 | ||
365 | /* iTIP scheduling actions */ | 365 | /* iTIP scheduling actions */ |
366 | void schedule_publish(Incidence *incidence = 0); | 366 | void schedule_publish(Incidence *incidence = 0); |
367 | void schedule_request(Incidence *incidence = 0); | 367 | void schedule_request(Incidence *incidence = 0); |
368 | void schedule_refresh(Incidence *incidence = 0); | 368 | void schedule_refresh(Incidence *incidence = 0); |
369 | void schedule_cancel(Incidence *incidence = 0); | 369 | void schedule_cancel(Incidence *incidence = 0); |
370 | void schedule_add(Incidence *incidence = 0); | 370 | void schedule_add(Incidence *incidence = 0); |
371 | void schedule_reply(Incidence *incidence = 0); | 371 | void schedule_reply(Incidence *incidence = 0); |
372 | void schedule_counter(Incidence *incidence = 0); | 372 | void schedule_counter(Incidence *incidence = 0); |
373 | void schedule_declinecounter(Incidence *incidence = 0); | 373 | void schedule_declinecounter(Incidence *incidence = 0); |
374 | void schedule_publish_freebusy(int daysToPublish = 30); | 374 | void schedule_publish_freebusy(int daysToPublish = 30); |
375 | 375 | ||
376 | void openAddressbook(); | 376 | void openAddressbook(); |
377 | 377 | ||
378 | void editFilters(); | 378 | void editFilters(); |
379 | void toggleFilerEnabled(); | 379 | void toggleFilerEnabled(); |
380 | QPtrList<CalFilter> filters(); | 380 | QPtrList<CalFilter> filters(); |
381 | void toggleFilter(); | 381 | void toggleFilter(); |
382 | void showFilter(bool visible); | 382 | void showFilter(bool visible); |
383 | void updateFilter(); | 383 | void updateFilter(); |
384 | void filterEdited(); | 384 | void filterEdited(); |
385 | void selectFilter( int ); | 385 | void selectFilter( int ); |
386 | KOFilterView *filterView(); | 386 | KOFilterView *filterView(); |
387 | 387 | ||
388 | void showIntro(); | 388 | void showIntro(); |
389 | 389 | ||
390 | /** Move the curdatepient view date to today */ | 390 | /** Move the curdatepient view date to today */ |
391 | void goToday(); | 391 | void goToday(); |
392 | 392 | ||
393 | /** Move to the next date(s) in the current view */ | 393 | /** Move to the next date(s) in the current view */ |
394 | void goNext(); | 394 | void goNext(); |
395 | 395 | ||
396 | /** Move to the previous date(s) in the current view */ | 396 | /** Move to the previous date(s) in the current view */ |
397 | void goPrevious(); | 397 | void goPrevious(); |
398 | /** Move to the next date(s) in the current view */ | 398 | /** Move to the next date(s) in the current view */ |
399 | void goNextMonth(); | 399 | void goNextMonth(); |
400 | 400 | ||
401 | /** Move to the previous date(s) in the current view */ | 401 | /** Move to the previous date(s) in the current view */ |
402 | void goPreviousMonth(); | 402 | void goPreviousMonth(); |
403 | 403 | ||
404 | void toggleExpand(); | 404 | void toggleExpand(); |
405 | void toggleDateNavigatorWidget(); | 405 | void toggleDateNavigatorWidget(); |
406 | void toggleAllDaySize(); | 406 | void toggleAllDaySize(); |
407 | void dialogClosing(Incidence *); | 407 | void dialogClosing(Incidence *); |
408 | 408 | ||
409 | /** Look for new messages in the inbox */ | 409 | /** Look for new messages in the inbox */ |
410 | void lookForIncomingMessages(); | 410 | void lookForIncomingMessages(); |
411 | /** Look for new messages in the outbox */ | 411 | /** Look for new messages in the outbox */ |
412 | void lookForOutgoingMessages(); | 412 | void lookForOutgoingMessages(); |
413 | 413 | ||
414 | void processMainViewSelection( Incidence * ); | 414 | void processMainViewSelection( Incidence * ); |
415 | void processTodoListSelection( Incidence * ); | 415 | void processTodoListSelection( Incidence * ); |
416 | 416 | ||
417 | void processIncidenceSelection( Incidence * ); | 417 | void processIncidenceSelection( Incidence * ); |
418 | 418 | ||
419 | void purgeCompleted(); | 419 | void purgeCompleted(); |
420 | bool removeCompletedSubTodos( Todo* ); | 420 | bool removeCompletedSubTodos( Todo* ); |
421 | void slotCalendarChanged(); | 421 | void slotCalendarChanged(); |
422 | bool importBday(); | 422 | bool importBday(); |
423 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); | 423 | bool addAnniversary( QDate data, QString name, KCal::Attendee* a , bool birthday ); |
424 | bool importQtopia( const QString &categoriesFile, | 424 | bool importQtopia( const QString &categoriesFile, |
425 | const QString &datebookFile, | 425 | const QString &datebookFile, |
426 | const QString &tasklistFile ); | 426 | const QString &tasklistFile ); |
427 | void syncSharp( ); | 427 | void syncSharp( ); |
428 | void syncPhone( ); | ||
428 | void slotSelectPickerDate( QDate ) ; | 429 | void slotSelectPickerDate( QDate ) ; |
429 | void showDatePicker( ) ; | 430 | void showDatePicker( ) ; |
430 | void moveIncidence(Incidence *) ; | 431 | void moveIncidence(Incidence *) ; |
431 | void beamIncidence(Incidence *) ; | 432 | void beamIncidence(Incidence *) ; |
432 | void beamCalendar() ; | 433 | void beamCalendar() ; |
433 | void beamFilteredCalendar() ; | 434 | void beamFilteredCalendar() ; |
434 | void beamIncidenceList(QPtrList<Incidence>) ; | 435 | void beamIncidenceList(QPtrList<Incidence>) ; |
435 | void manageCategories(); | 436 | void manageCategories(); |
436 | int addCategories(); | 437 | int addCategories(); |
437 | void removeCategories(); | 438 | void removeCategories(); |
438 | void setSyncDevice( QString ); | 439 | void setSyncDevice( QString ); |
439 | void setSyncName( QString ); | 440 | void setSyncName( QString ); |
440 | protected slots: | 441 | protected slots: |
441 | void timerAlarm(); | 442 | void timerAlarm(); |
442 | void suspendAlarm(); | 443 | void suspendAlarm(); |
443 | void beamDone( Ir *ir ); | 444 | void beamDone( Ir *ir ); |
444 | /** Select a view or adapt the current view to display the specified dates. */ | 445 | /** Select a view or adapt the current view to display the specified dates. */ |
445 | void showDates( const KCal::DateList & ); | 446 | void showDates( const KCal::DateList & ); |
446 | void selectWeekNum ( int ); | 447 | void selectWeekNum ( int ); |
447 | 448 | ||
448 | public: | 449 | public: |
449 | // show a standard warning | 450 | // show a standard warning |
450 | // returns KMsgBox::yesNoCancel() | 451 | // returns KMsgBox::yesNoCancel() |
451 | int msgCalModified(); | 452 | int msgCalModified(); |
452 | void confSync(); | 453 | void confSync(); |
453 | void setLoadedFileVersion(QDateTime); | 454 | void setLoadedFileVersion(QDateTime); |
454 | bool checkFileVersion(QString fn); | 455 | bool checkFileVersion(QString fn); |
455 | bool checkFileChanged(QString fn); | 456 | bool checkFileChanged(QString fn); |
456 | Event* getLastSyncEvent(); | 457 | Event* getLastSyncEvent(); |
457 | /** Adapt navigation units correpsonding to step size of navigation of the | 458 | /** Adapt navigation units correpsonding to step size of navigation of the |
458 | * current view. | 459 | * current view. |
459 | */ | 460 | */ |
460 | void adaptNavigationUnits(); | 461 | void adaptNavigationUnits(); |
461 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); | 462 | bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); |
462 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); | 463 | int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); |
463 | //Attendee* getYourAttendee(Event *event); | 464 | //Attendee* getYourAttendee(Event *event); |
464 | protected: | 465 | protected: |
465 | void schedule(Scheduler::Method, Incidence *incidence = 0); | 466 | void schedule(Scheduler::Method, Incidence *incidence = 0); |
466 | 467 | ||
467 | // returns KMsgBox::OKCandel() | 468 | // returns KMsgBox::OKCandel() |
468 | int msgItemDelete(); | 469 | int msgItemDelete(); |
469 | void showEventEditor(); | 470 | void showEventEditor(); |
470 | void showTodoEditor(); | 471 | void showTodoEditor(); |
471 | void writeLocale(); | 472 | void writeLocale(); |
472 | Todo *selectedTodo(); | 473 | Todo *selectedTodo(); |
473 | 474 | ||
474 | private: | 475 | private: |
475 | AlarmDialog * mAlarmDialog; | 476 | AlarmDialog * mAlarmDialog; |
476 | QString mAlarmNotification; | 477 | QString mAlarmNotification; |
477 | QString mSuspendAlarmNotification; | 478 | QString mSuspendAlarmNotification; |
478 | QTimer* mSuspendTimer; | 479 | QTimer* mSuspendTimer; |
479 | QTimer* mAlarmTimer; | 480 | QTimer* mAlarmTimer; |
480 | QTimer* mRecheckAlarmTimer; | 481 | QTimer* mRecheckAlarmTimer; |
481 | void computeAlarm( QString ); | 482 | void computeAlarm( QString ); |
482 | void startAlarm( QString, QString ); | 483 | void startAlarm( QString, QString ); |
483 | void setSyncEventsReadOnly(); | 484 | void setSyncEventsReadOnly(); |
484 | 485 | ||
485 | QDateTime loadedFileVersion; | 486 | QDateTime loadedFileVersion; |
486 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); | 487 | void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); |
487 | void checkExternalId( Incidence * inc ); | 488 | void checkExternalId( Incidence * inc ); |
488 | int mGlobalSyncMode; | 489 | int mGlobalSyncMode; |
489 | QString mCurrentSyncDevice; | 490 | QString mCurrentSyncDevice; |
490 | QString mCurrentSyncName; | 491 | QString mCurrentSyncName; |
491 | KOBeamPrefs* beamDialog; | 492 | KOBeamPrefs* beamDialog; |
492 | void init(); | 493 | void init(); |
493 | int mDatePickerMode; | 494 | int mDatePickerMode; |
494 | bool mFlagEditDescription; | 495 | bool mFlagEditDescription; |
495 | QDateTime mLastCalendarSync; | 496 | QDateTime mLastCalendarSync; |
496 | void createPrinter(); | 497 | void createPrinter(); |
497 | 498 | ||
498 | void calendarModified( bool, Calendar * ); | 499 | void calendarModified( bool, Calendar * ); |
499 | 500 | ||
500 | CalPrinter *mCalPrinter; | 501 | CalPrinter *mCalPrinter; |
501 | 502 | ||
502 | QSplitter *mPanner; | 503 | QSplitter *mPanner; |
503 | QSplitter *mLeftSplitter; | 504 | QSplitter *mLeftSplitter; |
504 | QWidget *mLeftFrame; | 505 | QWidget *mLeftFrame; |
505 | QWidgetStack *mRightFrame; | 506 | QWidgetStack *mRightFrame; |
506 | 507 | ||
507 | KDatePicker* mDatePicker; | 508 | KDatePicker* mDatePicker; |
508 | QVBox* mDateFrame; | 509 | QVBox* mDateFrame; |
509 | NavigatorBar *mNavigatorBar; | 510 | NavigatorBar *mNavigatorBar; |
510 | 511 | ||
511 | KDateNavigator *mDateNavigator; // widget showing small month view. | 512 | KDateNavigator *mDateNavigator; // widget showing small month view. |
512 | 513 | ||
513 | KOFilterView *mFilterView; | 514 | KOFilterView *mFilterView; |
514 | 515 | ||
515 | ResourceView *mResourceView; | 516 | ResourceView *mResourceView; |
516 | 517 | ||
517 | // calendar object for this viewing instance | 518 | // calendar object for this viewing instance |
518 | Calendar *mCalendar; | 519 | Calendar *mCalendar; |
519 | 520 | ||
520 | CalendarResourceManager *mResourceManager; | 521 | CalendarResourceManager *mResourceManager; |
521 | 522 | ||
522 | FileStorage *mStorage; | 523 | FileStorage *mStorage; |
523 | 524 | ||
524 | DateNavigator *mNavigator; | 525 | DateNavigator *mNavigator; |
525 | 526 | ||
526 | KOViewManager *mViewManager; | 527 | KOViewManager *mViewManager; |
527 | KODialogManager *mDialogManager; | 528 | KODialogManager *mDialogManager; |
528 | 529 | ||
529 | // Calendar filters | 530 | // Calendar filters |
530 | QPtrList<CalFilter> mFilters; | 531 | QPtrList<CalFilter> mFilters; |
531 | 532 | ||
532 | // various housekeeping variables. | 533 | // various housekeeping variables. |
533 | bool mModified; // flag indicating if calendar is modified | 534 | bool mModified; // flag indicating if calendar is modified |
534 | bool mReadOnly; // flag indicating if calendar is read-only | 535 | bool mReadOnly; // flag indicating if calendar is read-only |
535 | QDate mSaveSingleDate; | 536 | QDate mSaveSingleDate; |
536 | 537 | ||
537 | Incidence *mSelectedIncidence; | 538 | Incidence *mSelectedIncidence; |
538 | Incidence *mMoveIncidence; | 539 | Incidence *mMoveIncidence; |
539 | QPtrList<Event> mExternLastSyncEvent; | 540 | QPtrList<Event> mExternLastSyncEvent; |
540 | KOTodoView *mTodoList; | 541 | KOTodoView *mTodoList; |
541 | KOEventEditor * mEventEditor; | 542 | KOEventEditor * mEventEditor; |
542 | KOTodoEditor * mTodoEditor; | 543 | KOTodoEditor * mTodoEditor; |
543 | KOEventViewerDialog * mEventViewerDialog; | 544 | KOEventViewerDialog * mEventViewerDialog; |
544 | void keyPressEvent ( QKeyEvent *e) ; | 545 | void keyPressEvent ( QKeyEvent *e) ; |
545 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; | 546 | //QMap<Incidence*,KOIncidenceEditor*> mDialogList; |
546 | }; | 547 | }; |
547 | 548 | ||
548 | 549 | ||
549 | class CalendarViewVisitor : public Incidence::Visitor | 550 | class CalendarViewVisitor : public Incidence::Visitor |
550 | { | 551 | { |
551 | public: | 552 | public: |
552 | CalendarViewVisitor() : mView( 0 ) {} | 553 | CalendarViewVisitor() : mView( 0 ) {} |
553 | 554 | ||
554 | bool act( Incidence *incidence, CalendarView *view ) | 555 | bool act( Incidence *incidence, CalendarView *view ) |
555 | { | 556 | { |
556 | mView = view; | 557 | mView = view; |
557 | return incidence->accept( *this ); | 558 | return incidence->accept( *this ); |
558 | } | 559 | } |
559 | 560 | ||
560 | protected: | 561 | protected: |
561 | CalendarView *mView; | 562 | CalendarView *mView; |
562 | }; | 563 | }; |
563 | 564 | ||
564 | class ShowIncidenceVisitor : public CalendarViewVisitor | 565 | class ShowIncidenceVisitor : public CalendarViewVisitor |
565 | { | 566 | { |
566 | protected: | 567 | protected: |
567 | bool visit( Event *event ) { mView->showEvent( event ); return true; } | 568 | bool visit( Event *event ) { mView->showEvent( event ); return true; } |
568 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } | 569 | bool visit( Todo *todo ) { mView->showTodo( todo ); return true; } |
569 | bool visit( Journal * j ) { mView->showJournal( j );return true; } | 570 | bool visit( Journal * j ) { mView->showJournal( j );return true; } |
570 | }; | 571 | }; |
571 | 572 | ||
572 | class EditIncidenceVisitor : public CalendarViewVisitor | 573 | class EditIncidenceVisitor : public CalendarViewVisitor |
573 | { | 574 | { |
574 | protected: | 575 | protected: |
575 | bool visit( Event *event ) { mView->editEvent( event ); return true; } | 576 | bool visit( Event *event ) { mView->editEvent( event ); return true; } |
576 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } | 577 | bool visit( Todo *todo ) { mView->editTodo( todo ); return true; } |
577 | bool visit( Journal *j ) { mView->editJournal( j); return true; } | 578 | bool visit( Journal *j ) { mView->editJournal( j); return true; } |
578 | }; | 579 | }; |
579 | 580 | ||
580 | class DeleteIncidenceVisitor : public CalendarViewVisitor | 581 | class DeleteIncidenceVisitor : public CalendarViewVisitor |
581 | { | 582 | { |
582 | protected: | 583 | protected: |
583 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } | 584 | bool visit( Event *event ) { mView->deleteEvent( event ); return true; } |
584 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } | 585 | bool visit( Todo *todo ) { mView->deleteTodo( todo ); return true; } |
585 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } | 586 | bool visit( Journal * j) {mView->deleteJournal( j ); return true; } |
586 | }; | 587 | }; |
587 | 588 | ||
588 | #endif | 589 | #endif |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 424fa98..446fe2e 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,300 +1,303 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@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 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | #include <qdict.h> | 26 | #include <qdict.h> |
27 | 27 | ||
28 | #include <libkdepim/kpimprefs.h> | 28 | #include <libkdepim/kpimprefs.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | class KOPrefs : public KPimPrefs | 35 | class KOPrefs : public KPimPrefs |
36 | { | 36 | { |
37 | public: | 37 | public: |
38 | enum { FormatVCalendar, FormatICalendar }; | 38 | enum { FormatVCalendar, FormatICalendar }; |
39 | enum { MailClientKMail, MailClientSendmail }; | 39 | enum { MailClientKMail, MailClientSendmail }; |
40 | enum { IMIPDummy, IMIPKMail }; | 40 | enum { IMIPDummy, IMIPKMail }; |
41 | enum { IMIPOutbox, IMIPdirectsend }; | 41 | enum { IMIPOutbox, IMIPdirectsend }; |
42 | enum { neverAuto, addressbookAuto, selectedAuto }; | 42 | enum { neverAuto, addressbookAuto, selectedAuto }; |
43 | enum { standardDestination, askDestination }; | 43 | enum { standardDestination, askDestination }; |
44 | 44 | ||
45 | virtual ~KOPrefs(); | 45 | virtual ~KOPrefs(); |
46 | 46 | ||
47 | /** Get instance of KOPrefs. It is made sure that there is only one | 47 | /** Get instance of KOPrefs. It is made sure that there is only one |
48 | instance. */ | 48 | instance. */ |
49 | static KOPrefs *instance(); | 49 | static KOPrefs *instance(); |
50 | 50 | ||
51 | /** Set preferences to default values */ | 51 | /** Set preferences to default values */ |
52 | void usrSetDefaults(); | 52 | void usrSetDefaults(); |
53 | 53 | ||
54 | /** Read preferences from config file */ | 54 | /** Read preferences from config file */ |
55 | void usrReadConfig(); | 55 | void usrReadConfig(); |
56 | 56 | ||
57 | /** Write preferences to config file */ | 57 | /** Write preferences to config file */ |
58 | void usrWriteConfig(); | 58 | void usrWriteConfig(); |
59 | void setCategoryDefaults(); | 59 | void setCategoryDefaults(); |
60 | 60 | ||
61 | protected: | 61 | protected: |
62 | void setTimeZoneIdDefault(); | 62 | void setTimeZoneIdDefault(); |
63 | 63 | ||
64 | /** Fill empty mail fields with default values. */ | 64 | /** Fill empty mail fields with default values. */ |
65 | void fillMailDefaults(); | 65 | void fillMailDefaults(); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 68 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
69 | object. */ | 69 | object. */ |
70 | KOPrefs(); | 70 | KOPrefs(); |
71 | 71 | ||
72 | static KOPrefs *mInstance; | 72 | static KOPrefs *mInstance; |
73 | QDict<QString> *mLocaleDict; | 73 | QDict<QString> *mLocaleDict; |
74 | QStringList getDefaultList(); | 74 | QStringList getDefaultList(); |
75 | public: | 75 | public: |
76 | // preferences data | 76 | // preferences data |
77 | KConfig* getConfig(); | 77 | KConfig* getConfig(); |
78 | void setFullName(const QString &); | 78 | void setFullName(const QString &); |
79 | QString fullName(); | 79 | QString fullName(); |
80 | void setEmail(const QString &); | 80 | void setEmail(const QString &); |
81 | QString email(); | 81 | QString email(); |
82 | 82 | ||
83 | QString mAdditional; | 83 | QString mAdditional; |
84 | 84 | ||
85 | bool mEmailControlCenter; | 85 | bool mEmailControlCenter; |
86 | 86 | ||
87 | bool mBcc; | 87 | bool mBcc; |
88 | bool mAutoSave; | 88 | bool mAutoSave; |
89 | int mAutoSaveInterval; | 89 | int mAutoSaveInterval; |
90 | bool mConfirm; | 90 | bool mConfirm; |
91 | 91 | ||
92 | bool mEnableGroupScheduling; | 92 | bool mEnableGroupScheduling; |
93 | bool mEnableProjectView; | 93 | bool mEnableProjectView; |
94 | 94 | ||
95 | int mDefaultFormat; | 95 | int mDefaultFormat; |
96 | int mMailClient; | 96 | int mMailClient; |
97 | 97 | ||
98 | QString mTimeZone; | 98 | QString mTimeZone; |
99 | QString mTimeZoneId; | 99 | QString mTimeZoneId; |
100 | //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius | 100 | //QString mTimeZoneName; // e.g. +00:04:00 Indian/Mauritius |
101 | //int mTimeZoneOffset; // e.g. -240 min | 101 | //int mTimeZoneOffset; // e.g. -240 min |
102 | bool mUseDaylightsaving; | 102 | bool mUseDaylightsaving; |
103 | int mDaylightsavingStart; | 103 | int mDaylightsavingStart; |
104 | int mDaylightsavingEnd; | 104 | int mDaylightsavingEnd; |
105 | int mStartTime; | 105 | int mStartTime; |
106 | int mDefaultDuration; | 106 | int mDefaultDuration; |
107 | int mAlarmTime; | 107 | int mAlarmTime; |
108 | int mDaylightSavings; | 108 | int mDaylightSavings; |
109 | 109 | ||
110 | int mWorkingHoursStart; | 110 | int mWorkingHoursStart; |
111 | int mWorkingHoursEnd; | 111 | int mWorkingHoursEnd; |
112 | bool mExcludeHolidays; | 112 | bool mExcludeHolidays; |
113 | bool mExcludeSaturdays; | 113 | bool mExcludeSaturdays; |
114 | bool mMarcusBainsShowSeconds; | 114 | bool mMarcusBainsShowSeconds; |
115 | 115 | ||
116 | QFont mTimeBarFont; | 116 | QFont mTimeBarFont; |
117 | QFont mMonthViewFont; | 117 | QFont mMonthViewFont; |
118 | QFont mAgendaViewFont; | 118 | QFont mAgendaViewFont; |
119 | QFont mMarcusBainsFont; | 119 | QFont mMarcusBainsFont; |
120 | QFont mTimeLabelsFont; | 120 | QFont mTimeLabelsFont; |
121 | QFont mTodoViewFont; | 121 | QFont mTodoViewFont; |
122 | QFont mListViewFont; | 122 | QFont mListViewFont; |
123 | QFont mDateNavigatorFont; | 123 | QFont mDateNavigatorFont; |
124 | QFont mEditBoxFont; | 124 | QFont mEditBoxFont; |
125 | QFont mJornalViewFont; | 125 | QFont mJornalViewFont; |
126 | QFont mWhatsNextFont; | 126 | QFont mWhatsNextFont; |
127 | QFont mEventViewFont; | 127 | QFont mEventViewFont; |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | QColor mHolidayColor; | 132 | QColor mHolidayColor; |
133 | QColor mHighlightColor; | 133 | QColor mHighlightColor; |
134 | QColor mEventColor; | 134 | QColor mEventColor; |
135 | QColor mAgendaBgColor; | 135 | QColor mAgendaBgColor; |
136 | QColor mWorkingHoursColor; | 136 | QColor mWorkingHoursColor; |
137 | QColor mTodoDueTodayColor; | 137 | QColor mTodoDueTodayColor; |
138 | QColor mTodoOverdueColor; | 138 | QColor mTodoOverdueColor; |
139 | QColor mMonthViewEvenColor; | 139 | QColor mMonthViewEvenColor; |
140 | QColor mMonthViewOddColor; | 140 | QColor mMonthViewOddColor; |
141 | QColor mMonthViewHolidayColor; | 141 | QColor mMonthViewHolidayColor; |
142 | bool mMonthViewUsesDayColors; | 142 | bool mMonthViewUsesDayColors; |
143 | bool mMonthViewSatSunTog; | 143 | bool mMonthViewSatSunTog; |
144 | QColor mAppColor1; | 144 | QColor mAppColor1; |
145 | QColor mAppColor2; | 145 | QColor mAppColor2; |
146 | bool mUseAppColors; | 146 | bool mUseAppColors; |
147 | 147 | ||
148 | int mDayBegins; | 148 | int mDayBegins; |
149 | int mHourSize; | 149 | int mHourSize; |
150 | int mAllDaySize; | 150 | int mAllDaySize; |
151 | bool mShowFullMenu; | 151 | bool mShowFullMenu; |
152 | bool mDailyRecur; | 152 | bool mDailyRecur; |
153 | bool mWeeklyRecur; | 153 | bool mWeeklyRecur; |
154 | bool mMonthDailyRecur; | 154 | bool mMonthDailyRecur; |
155 | bool mMonthWeeklyRecur; | 155 | bool mMonthWeeklyRecur; |
156 | bool mMonthShowIcons; | 156 | bool mMonthShowIcons; |
157 | bool mMonthShowShort; | 157 | bool mMonthShowShort; |
158 | bool mEnableToolTips; | 158 | bool mEnableToolTips; |
159 | bool mEnableMonthScroll; | 159 | bool mEnableMonthScroll; |
160 | bool mFullViewMonth; | 160 | bool mFullViewMonth; |
161 | bool mMonthViewUsesCategoryColor; | 161 | bool mMonthViewUsesCategoryColor; |
162 | bool mFullViewTodo; | 162 | bool mFullViewTodo; |
163 | bool mShowCompletedTodo; | 163 | bool mShowCompletedTodo; |
164 | bool mMarcusBainsEnabled; | 164 | bool mMarcusBainsEnabled; |
165 | int mNextXDays; | 165 | int mNextXDays; |
166 | int mWhatsNextDays; | 166 | int mWhatsNextDays; |
167 | int mWhatsNextPrios; | 167 | int mWhatsNextPrios; |
168 | bool mEnableQuickTodo; | 168 | bool mEnableQuickTodo; |
169 | bool mLanguageChanged; | 169 | bool mLanguageChanged; |
170 | 170 | ||
171 | bool mCompactDialogs; | 171 | bool mCompactDialogs; |
172 | bool mVerticalScreen; | 172 | bool mVerticalScreen; |
173 | 173 | ||
174 | bool mShowIconNewTodo; | 174 | bool mShowIconNewTodo; |
175 | bool mShowIconNewEvent; | 175 | bool mShowIconNewEvent; |
176 | bool mShowIconSearch; | 176 | bool mShowIconSearch; |
177 | bool mShowIconList; | 177 | bool mShowIconList; |
178 | bool mShowIconDay1; | 178 | bool mShowIconDay1; |
179 | bool mShowIconDay5; | 179 | bool mShowIconDay5; |
180 | bool mShowIconDay7; | 180 | bool mShowIconDay7; |
181 | bool mShowIconMonth; | 181 | bool mShowIconMonth; |
182 | bool mShowIconTodoview; | 182 | bool mShowIconTodoview; |
183 | bool mShowIconBackFast; | 183 | bool mShowIconBackFast; |
184 | bool mShowIconBack; | 184 | bool mShowIconBack; |
185 | bool mShowIconToday; | 185 | bool mShowIconToday; |
186 | bool mShowIconForward; | 186 | bool mShowIconForward; |
187 | bool mShowIconForwardFast; | 187 | bool mShowIconForwardFast; |
188 | bool mShowIconWhatsThis; | 188 | bool mShowIconWhatsThis; |
189 | bool mShowIconNextDays; | 189 | bool mShowIconNextDays; |
190 | bool mShowIconNext; | 190 | bool mShowIconNext; |
191 | bool mShowIconJournal; | 191 | bool mShowIconJournal; |
192 | 192 | ||
193 | bool mShowIconStretch; | 193 | bool mShowIconStretch; |
194 | 194 | ||
195 | bool mToolBarHor; | 195 | bool mToolBarHor; |
196 | bool mToolBarUp; | 196 | bool mToolBarUp; |
197 | bool mToolBarMiniIcons; | 197 | bool mToolBarMiniIcons; |
198 | 198 | ||
199 | bool mAskForQuit; | 199 | bool mAskForQuit; |
200 | bool mUsePassWd; | 200 | bool mUsePassWd; |
201 | bool mWriteBackFile; | 201 | bool mWriteBackFile; |
202 | bool mAskForPreferences; | 202 | bool mAskForPreferences; |
203 | bool mShowSyncSummary; | 203 | bool mShowSyncSummary; |
204 | bool mShowSyncEvents; | 204 | bool mShowSyncEvents; |
205 | bool mShowTodoInAgenda; | 205 | bool mShowTodoInAgenda; |
206 | bool mWriteBackExistingOnly; | 206 | bool mWriteBackExistingOnly; |
207 | 207 | ||
208 | QString mRemoteIP; | 208 | QString mRemoteIP; |
209 | QString mRemoteUser; | 209 | QString mRemoteUser; |
210 | QString mRemotePassWd; | 210 | QString mRemotePassWd; |
211 | QString mRemoteFile; | 211 | QString mRemoteFile; |
212 | QString mLocalTempFile; | 212 | QString mLocalTempFile; |
213 | QString mPhoneDevice; | ||
214 | QString mPhoneConnection; | ||
215 | QString mPhoneModel; | ||
213 | 216 | ||
214 | int mLastSyncTime; | 217 | int mLastSyncTime; |
215 | int mSyncAlgoPrefs; | 218 | int mSyncAlgoPrefs; |
216 | int mRingSyncAlgoPrefs; | 219 | int mRingSyncAlgoPrefs; |
217 | QStringList mSyncProfileNames; | 220 | QStringList mSyncProfileNames; |
218 | QStringList mExternSyncProfiles; | 221 | QStringList mExternSyncProfiles; |
219 | QString mLocalMachineName; | 222 | QString mLocalMachineName; |
220 | void setCategoryColor(QString cat,const QColor & color); | 223 | void setCategoryColor(QString cat,const QColor & color); |
221 | QColor *categoryColor(QString cat); | 224 | QColor *categoryColor(QString cat); |
222 | 225 | ||
223 | QString mArchiveFile; | 226 | QString mArchiveFile; |
224 | QString mHtmlExportFile; | 227 | QString mHtmlExportFile; |
225 | bool mHtmlWithSave; | 228 | bool mHtmlWithSave; |
226 | 229 | ||
227 | QStringList mSelectedPlugins; | 230 | QStringList mSelectedPlugins; |
228 | 231 | ||
229 | QString mLastImportFile; | 232 | QString mLastImportFile; |
230 | QString mLastVcalFile; | 233 | QString mLastVcalFile; |
231 | QString mLastSaveFile; | 234 | QString mLastSaveFile; |
232 | QString mLastLoadFile; | 235 | QString mLastLoadFile; |
233 | QString mLastSyncedLocalFile; | 236 | QString mLastSyncedLocalFile; |
234 | 237 | ||
235 | 238 | ||
236 | QString mDefaultAlarmFile; | 239 | QString mDefaultAlarmFile; |
237 | int mIMIPScheduler; | 240 | int mIMIPScheduler; |
238 | int mIMIPSend; | 241 | int mIMIPSend; |
239 | QStringList mAdditionalMails; | 242 | QStringList mAdditionalMails; |
240 | int mIMIPAutoRefresh; | 243 | int mIMIPAutoRefresh; |
241 | int mIMIPAutoInsertReply; | 244 | int mIMIPAutoInsertReply; |
242 | int mIMIPAutoInsertRequest; | 245 | int mIMIPAutoInsertRequest; |
243 | int mIMIPAutoFreeBusy; | 246 | int mIMIPAutoFreeBusy; |
244 | int mIMIPAutoFreeBusyReply; | 247 | int mIMIPAutoFreeBusyReply; |
245 | 248 | ||
246 | QStringList mTodoTemplates; | 249 | QStringList mTodoTemplates; |
247 | QStringList mEventTemplates; | 250 | QStringList mEventTemplates; |
248 | 251 | ||
249 | int mDestination; | 252 | int mDestination; |
250 | 253 | ||
251 | 254 | ||
252 | bool mEditOnDoubleClick; | 255 | bool mEditOnDoubleClick; |
253 | bool mViewChangeHoldFullscreen; | 256 | bool mViewChangeHoldFullscreen; |
254 | bool mViewChangeHoldNonFullscreen; | 257 | bool mViewChangeHoldNonFullscreen; |
255 | bool mCenterOnCurrentTime; | 258 | bool mCenterOnCurrentTime; |
256 | bool mSetTimeToDayStartAt; | 259 | bool mSetTimeToDayStartAt; |
257 | bool mHighlightCurrentDay; | 260 | bool mHighlightCurrentDay; |
258 | bool mUseHighlightLightColor; | 261 | bool mUseHighlightLightColor; |
259 | bool mListViewMonthTimespan; | 262 | bool mListViewMonthTimespan; |
260 | bool mWNViewShowsParents; | 263 | bool mWNViewShowsParents; |
261 | bool mWNViewShowLocation; | 264 | bool mWNViewShowLocation; |
262 | bool mTodoViewShowsPercentage; | 265 | bool mTodoViewShowsPercentage; |
263 | bool mTodoViewUsesCatColors; | 266 | bool mTodoViewUsesCatColors; |
264 | bool mTodoViewUsesSmallFont; | 267 | bool mTodoViewUsesSmallFont; |
265 | bool mTodoViewUsesForegroundColor; | 268 | bool mTodoViewUsesForegroundColor; |
266 | bool mMonthViewUsesForegroundColor; | 269 | bool mMonthViewUsesForegroundColor; |
267 | 270 | ||
268 | bool mHightlightDateTimeEdit; | 271 | bool mHightlightDateTimeEdit; |
269 | int mPreferredLanguage; | 272 | int mPreferredLanguage; |
270 | bool mUseQuicksave; | 273 | bool mUseQuicksave; |
271 | int mPreferredTime; | 274 | int mPreferredTime; |
272 | int mPreferredDate; | 275 | int mPreferredDate; |
273 | bool mWeekStartsOnSunday; | 276 | bool mWeekStartsOnSunday; |
274 | bool mShortDateInViewer; | 277 | bool mShortDateInViewer; |
275 | QString mUserDateFormatLong; | 278 | QString mUserDateFormatLong; |
276 | QString mUserDateFormatShort; | 279 | QString mUserDateFormatShort; |
277 | 280 | ||
278 | QStringList mLocationDefaults; | 281 | QStringList mLocationDefaults; |
279 | QStringList mEventSummaryUser; | 282 | QStringList mEventSummaryUser; |
280 | QStringList mTodoSummaryUser; | 283 | QStringList mTodoSummaryUser; |
281 | 284 | ||
282 | bool mUseInternalAlarmNotification; | 285 | bool mUseInternalAlarmNotification; |
283 | int mAlarmPlayBeeps; | 286 | int mAlarmPlayBeeps; |
284 | int mAlarmSuspendTime; | 287 | int mAlarmSuspendTime; |
285 | int mAlarmSuspendCount; | 288 | int mAlarmSuspendCount; |
286 | int mAlarmBeepInterval; | 289 | int mAlarmBeepInterval; |
287 | 290 | ||
288 | private: | 291 | private: |
289 | QDict<QColor> mCategoryColors; | 292 | QDict<QColor> mCategoryColors; |
290 | QColor mDefaultCategoryColor; | 293 | QColor mDefaultCategoryColor; |
291 | 294 | ||
292 | QFont mDefaultTimeBarFont; | 295 | QFont mDefaultTimeBarFont; |
293 | QFont mDefaultViewFont; | 296 | QFont mDefaultViewFont; |
294 | QFont mDefaultMonthViewFont; | 297 | QFont mDefaultMonthViewFont; |
295 | 298 | ||
296 | QString mName; | 299 | QString mName; |
297 | QString mEmail; | 300 | QString mEmail; |
298 | }; | 301 | }; |
299 | 302 | ||
300 | #endif | 303 | #endif |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index c3c4c26..062c95f 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -516,769 +516,775 @@ void MainWindow::initActions() | |||
516 | whatsnext_action->addTo( viewMenu ); | 516 | whatsnext_action->addTo( viewMenu ); |
517 | connect( whatsnext_action, SIGNAL( activated() ), | 517 | connect( whatsnext_action, SIGNAL( activated() ), |
518 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 518 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
519 | 519 | ||
520 | #if 0 | 520 | #if 0 |
521 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 521 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
522 | action->addTo( viewMenu ); | 522 | action->addTo( viewMenu ); |
523 | connect( action, SIGNAL( activated() ), | 523 | connect( action, SIGNAL( activated() ), |
524 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 524 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
525 | #endif | 525 | #endif |
526 | 526 | ||
527 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 527 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
528 | this ); | 528 | this ); |
529 | mNewSubTodoAction->addTo( actionMenu ); | 529 | mNewSubTodoAction->addTo( actionMenu ); |
530 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 530 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
531 | mView, SLOT( newSubTodo() ) ); | 531 | mView, SLOT( newSubTodo() ) ); |
532 | 532 | ||
533 | actionMenu->insertSeparator(); | 533 | actionMenu->insertSeparator(); |
534 | 534 | ||
535 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 535 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
536 | mShowAction->addTo( actionMenu ); | 536 | mShowAction->addTo( actionMenu ); |
537 | connect( mShowAction, SIGNAL( activated() ), | 537 | connect( mShowAction, SIGNAL( activated() ), |
538 | mView, SLOT( showIncidence() ) ); | 538 | mView, SLOT( showIncidence() ) ); |
539 | 539 | ||
540 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 540 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
541 | mEditAction->addTo( actionMenu ); | 541 | mEditAction->addTo( actionMenu ); |
542 | connect( mEditAction, SIGNAL( activated() ), | 542 | connect( mEditAction, SIGNAL( activated() ), |
543 | mView, SLOT( editIncidence() ) ); | 543 | mView, SLOT( editIncidence() ) ); |
544 | 544 | ||
545 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 545 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
546 | mDeleteAction->addTo( actionMenu ); | 546 | mDeleteAction->addTo( actionMenu ); |
547 | connect( mDeleteAction, SIGNAL( activated() ), | 547 | connect( mDeleteAction, SIGNAL( activated() ), |
548 | mView, SLOT( deleteIncidence() ) ); | 548 | mView, SLOT( deleteIncidence() ) ); |
549 | 549 | ||
550 | actionMenu->insertSeparator(); | 550 | actionMenu->insertSeparator(); |
551 | 551 | ||
552 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 552 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
553 | this ); | 553 | this ); |
554 | action->addTo( actionMenu ); | 554 | action->addTo( actionMenu ); |
555 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 555 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
556 | 556 | ||
557 | icon = loadPixmap( pathString + "search" ); | 557 | icon = loadPixmap( pathString + "search" ); |
558 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 558 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
559 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 559 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
560 | search_action->addTo( actionMenu ); | 560 | search_action->addTo( actionMenu ); |
561 | connect( search_action, SIGNAL( activated() ), | 561 | connect( search_action, SIGNAL( activated() ), |
562 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 562 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
563 | 563 | ||
564 | icon = loadPixmap( pathString + "today" ); | 564 | icon = loadPixmap( pathString + "today" ); |
565 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 565 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
566 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 566 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
567 | today_action->addTo( actionMenu ); | 567 | today_action->addTo( actionMenu ); |
568 | connect( today_action, SIGNAL( activated() ), | 568 | connect( today_action, SIGNAL( activated() ), |
569 | mView, SLOT( goToday() ) ); | 569 | mView, SLOT( goToday() ) ); |
570 | 570 | ||
571 | if ( KOPrefs::instance()->mShowFullMenu ) { | 571 | if ( KOPrefs::instance()->mShowFullMenu ) { |
572 | actionMenu->insertSeparator(); | 572 | actionMenu->insertSeparator(); |
573 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 573 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
574 | 574 | ||
575 | } | 575 | } |
576 | // actionMenu->insertSeparator(); | 576 | // actionMenu->insertSeparator(); |
577 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 577 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
578 | this ); | 578 | this ); |
579 | action->addTo( importMenu ); | 579 | action->addTo( importMenu ); |
580 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 580 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
581 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 581 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
582 | this ); | 582 | this ); |
583 | action->addTo( importMenu ); | 583 | action->addTo( importMenu ); |
584 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 584 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
585 | importMenu->insertSeparator(); | 585 | importMenu->insertSeparator(); |
586 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 586 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
587 | this ); | 587 | this ); |
588 | action->addTo( importMenu ); | 588 | action->addTo( importMenu ); |
589 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 589 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
590 | #ifndef DESKTOP_VERSION | 590 | #ifndef DESKTOP_VERSION |
591 | importMenu->insertSeparator(); | 591 | importMenu->insertSeparator(); |
592 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 592 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
593 | this ); | 593 | this ); |
594 | action->addTo( importMenu ); | 594 | action->addTo( importMenu ); |
595 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 595 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
596 | #else | 596 | #else |
597 | #ifdef _WIN32_ | 597 | #ifdef _WIN32_ |
598 | importMenu->insertSeparator(); | 598 | importMenu->insertSeparator(); |
599 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 599 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
600 | this ); | 600 | this ); |
601 | action->addTo( importMenu ); | 601 | action->addTo( importMenu ); |
602 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 602 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
603 | #endif | 603 | #endif |
604 | #endif | 604 | #endif |
605 | 605 | ||
606 | importMenu->insertSeparator(); | 606 | importMenu->insertSeparator(); |
607 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 607 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
608 | this ); | 608 | this ); |
609 | action->addTo( importMenu ); | 609 | action->addTo( importMenu ); |
610 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 610 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
611 | 611 | ||
612 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 612 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
613 | this ); | 613 | this ); |
614 | action->addTo( importMenu ); | 614 | action->addTo( importMenu ); |
615 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 615 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
616 | 616 | ||
617 | importMenu->insertSeparator(); | 617 | importMenu->insertSeparator(); |
618 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 618 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
619 | this ); | 619 | this ); |
620 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 620 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
621 | importMenu->insertSeparator(); | 621 | importMenu->insertSeparator(); |
622 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 622 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
623 | this ); | 623 | this ); |
624 | action->addTo( importMenu ); | 624 | action->addTo( importMenu ); |
625 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 625 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
626 | #ifndef DESKTOP_VERSION | 626 | #ifndef DESKTOP_VERSION |
627 | importMenu->insertSeparator(); | 627 | importMenu->insertSeparator(); |
628 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 628 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
629 | this ); | 629 | this ); |
630 | action->addTo( importMenu ); | 630 | action->addTo( importMenu ); |
631 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 631 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
632 | 632 | ||
633 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 633 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
634 | this ); | 634 | this ); |
635 | action->addTo( importMenu ); | 635 | action->addTo( importMenu ); |
636 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 636 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
637 | #else | 637 | #else |
638 | importMenu->insertSeparator(); | 638 | importMenu->insertSeparator(); |
639 | icon = loadPixmap( pathString + "print" ); | 639 | icon = loadPixmap( pathString + "print" ); |
640 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 640 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
641 | action->addTo( importMenu ); | 641 | action->addTo( importMenu ); |
642 | connect( action, SIGNAL( activated() ), | 642 | connect( action, SIGNAL( activated() ), |
643 | this, SLOT( printCal() ) ); | 643 | this, SLOT( printCal() ) ); |
644 | 644 | ||
645 | icon = loadPixmap( pathString + "print" ); | 645 | icon = loadPixmap( pathString + "print" ); |
646 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 646 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
647 | action->addTo( importMenu ); | 647 | action->addTo( importMenu ); |
648 | connect( action, SIGNAL( activated() ), | 648 | connect( action, SIGNAL( activated() ), |
649 | this, SLOT( printSel() ) ); | 649 | this, SLOT( printSel() ) ); |
650 | #endif | 650 | #endif |
651 | importMenu->insertSeparator(); | 651 | importMenu->insertSeparator(); |
652 | action = new QAction( "beam all", i18n("Save"), 0, | 652 | action = new QAction( "beam all", i18n("Save"), 0, |
653 | this ); | 653 | this ); |
654 | action->addTo( importMenu ); | 654 | action->addTo( importMenu ); |
655 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 655 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
656 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 656 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
657 | this ); | 657 | this ); |
658 | action->addTo( importMenu ); | 658 | action->addTo( importMenu ); |
659 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 659 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
660 | 660 | ||
661 | //menuBar->insertItem( "Configure",configureMenu ); | 661 | //menuBar->insertItem( "Configure",configureMenu ); |
662 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 662 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
663 | icon = loadPixmap( "korganizer/korganizer" ); | 663 | icon = loadPixmap( "korganizer/korganizer" ); |
664 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 664 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
665 | action->addTo( helpMenu ); | 665 | action->addTo( helpMenu ); |
666 | connect( action, SIGNAL( activated() ), | 666 | connect( action, SIGNAL( activated() ), |
667 | SLOT( keyBindings() ) ); | 667 | SLOT( keyBindings() ) ); |
668 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 668 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
669 | action->addTo( helpMenu ); | 669 | action->addTo( helpMenu ); |
670 | connect( action, SIGNAL( activated() ), | 670 | connect( action, SIGNAL( activated() ), |
671 | SLOT( features() ) ); | 671 | SLOT( features() ) ); |
672 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 672 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
673 | action->addTo( helpMenu ); | 673 | action->addTo( helpMenu ); |
674 | connect( action, SIGNAL( activated() ), | 674 | connect( action, SIGNAL( activated() ), |
675 | SLOT( aboutAutoSaving() ) ); | 675 | SLOT( aboutAutoSaving() ) ); |
676 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 676 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
677 | action->addTo( helpMenu ); | 677 | action->addTo( helpMenu ); |
678 | connect( action, SIGNAL( activated() ), | 678 | connect( action, SIGNAL( activated() ), |
679 | SLOT( aboutKnownBugs() ) ); | 679 | SLOT( aboutKnownBugs() ) ); |
680 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 680 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
681 | action->addTo( helpMenu ); | 681 | action->addTo( helpMenu ); |
682 | connect( action, SIGNAL( activated() ), | 682 | connect( action, SIGNAL( activated() ), |
683 | SLOT( usertrans() ) ); | 683 | SLOT( usertrans() ) ); |
684 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 684 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
685 | action->addTo( helpMenu ); | 685 | action->addTo( helpMenu ); |
686 | connect( action, SIGNAL( activated() ), | 686 | connect( action, SIGNAL( activated() ), |
687 | SLOT( synchowto() ) ); | 687 | SLOT( synchowto() ) ); |
688 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 688 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
689 | action->addTo( helpMenu ); | 689 | action->addTo( helpMenu ); |
690 | connect( action, SIGNAL( activated() ), | 690 | connect( action, SIGNAL( activated() ), |
691 | SLOT( whatsNew() ) ); | 691 | SLOT( whatsNew() ) ); |
692 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 692 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
693 | action->addTo( helpMenu ); | 693 | action->addTo( helpMenu ); |
694 | connect( action, SIGNAL( activated() ), | 694 | connect( action, SIGNAL( activated() ), |
695 | SLOT( faq() ) ); | 695 | SLOT( faq() ) ); |
696 | 696 | ||
697 | 697 | ||
698 | action = new QAction( "about", i18n("About..."), 0, this ); | 698 | action = new QAction( "about", i18n("About..."), 0, this ); |
699 | action->addTo( helpMenu ); | 699 | action->addTo( helpMenu ); |
700 | connect( action, SIGNAL( activated() ), | 700 | connect( action, SIGNAL( activated() ), |
701 | SLOT( about() ) ); | 701 | SLOT( about() ) ); |
702 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 702 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
703 | action->addTo( helpMenu ); | 703 | action->addTo( helpMenu ); |
704 | connect( action, SIGNAL( activated() ), | 704 | connect( action, SIGNAL( activated() ), |
705 | SLOT( licence() ) ); | 705 | SLOT( licence() ) ); |
706 | //menuBar->insertSeparator(); | 706 | //menuBar->insertSeparator(); |
707 | 707 | ||
708 | // ****************************************************** | 708 | // ****************************************************** |
709 | // menubar icons | 709 | // menubar icons |
710 | 710 | ||
711 | 711 | ||
712 | iconToolBar->setHorizontalStretchable (true ); | 712 | iconToolBar->setHorizontalStretchable (true ); |
713 | //menuBar->insertItem( iconToolBar ); | 713 | //menuBar->insertItem( iconToolBar ); |
714 | //xdays_action | 714 | //xdays_action |
715 | if (p-> mShowIconNewEvent) | 715 | if (p-> mShowIconNewEvent) |
716 | ne_action->addTo( iconToolBar ); | 716 | ne_action->addTo( iconToolBar ); |
717 | if (p->mShowIconNewTodo ) | 717 | if (p->mShowIconNewTodo ) |
718 | nt_action->addTo( iconToolBar ); | 718 | nt_action->addTo( iconToolBar ); |
719 | if (p-> mShowIconSearch) | 719 | if (p-> mShowIconSearch) |
720 | search_action->addTo( iconToolBar ); | 720 | search_action->addTo( iconToolBar ); |
721 | if (p-> mShowIconNext) | 721 | if (p-> mShowIconNext) |
722 | whatsnext_action->addTo( iconToolBar ); | 722 | whatsnext_action->addTo( iconToolBar ); |
723 | if (p-> mShowIconNextDays) | 723 | if (p-> mShowIconNextDays) |
724 | xdays_action->addTo( iconToolBar ); | 724 | xdays_action->addTo( iconToolBar ); |
725 | if (p-> mShowIconList) | 725 | if (p-> mShowIconList) |
726 | showlist_action->addTo( iconToolBar ); | 726 | showlist_action->addTo( iconToolBar ); |
727 | if (p-> mShowIconDay1) | 727 | if (p-> mShowIconDay1) |
728 | day1_action->addTo( iconToolBar ); | 728 | day1_action->addTo( iconToolBar ); |
729 | if (p-> mShowIconDay5) | 729 | if (p-> mShowIconDay5) |
730 | day5_action->addTo( iconToolBar ); | 730 | day5_action->addTo( iconToolBar ); |
731 | if (p-> mShowIconDay7) | 731 | if (p-> mShowIconDay7) |
732 | day7_action->addTo( iconToolBar ); | 732 | day7_action->addTo( iconToolBar ); |
733 | if (p-> mShowIconMonth) | 733 | if (p-> mShowIconMonth) |
734 | month_action->addTo( iconToolBar ); | 734 | month_action->addTo( iconToolBar ); |
735 | if (p-> mShowIconTodoview) | 735 | if (p-> mShowIconTodoview) |
736 | todoview_action->addTo( iconToolBar ); | 736 | todoview_action->addTo( iconToolBar ); |
737 | if (p-> mShowIconJournal) | 737 | if (p-> mShowIconJournal) |
738 | viewjournal_action->addTo( iconToolBar ); | 738 | viewjournal_action->addTo( iconToolBar ); |
739 | icon = loadPixmap( pathString + "2leftarrowB" ); | 739 | icon = loadPixmap( pathString + "2leftarrowB" ); |
740 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); | 740 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); |
741 | if (p-> mShowIconBackFast) { | 741 | if (p-> mShowIconBackFast) { |
742 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 742 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
743 | connect( action, SIGNAL( activated() ), | 743 | connect( action, SIGNAL( activated() ), |
744 | mView, SLOT( goPreviousMonth() ) ); | 744 | mView, SLOT( goPreviousMonth() ) ); |
745 | action->addTo( iconToolBar ); | 745 | action->addTo( iconToolBar ); |
746 | } | 746 | } |
747 | icon = loadPixmap( pathString + "1leftarrowB" ); | 747 | icon = loadPixmap( pathString + "1leftarrowB" ); |
748 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); | 748 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); |
749 | if (p-> mShowIconBack) { | 749 | if (p-> mShowIconBack) { |
750 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 750 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
751 | connect( action, SIGNAL( activated() ), | 751 | connect( action, SIGNAL( activated() ), |
752 | mView, SLOT( goPrevious() ) ); | 752 | mView, SLOT( goPrevious() ) ); |
753 | action->addTo( iconToolBar ); | 753 | action->addTo( iconToolBar ); |
754 | } | 754 | } |
755 | if (p-> mShowIconToday) | 755 | if (p-> mShowIconToday) |
756 | today_action->addTo( iconToolBar ); | 756 | today_action->addTo( iconToolBar ); |
757 | icon = loadPixmap( pathString + "1rightarrowB" ); | 757 | icon = loadPixmap( pathString + "1rightarrowB" ); |
758 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 758 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
759 | if (p-> mShowIconForward) { | 759 | if (p-> mShowIconForward) { |
760 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 760 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
761 | connect( action, SIGNAL( activated() ), | 761 | connect( action, SIGNAL( activated() ), |
762 | mView, SLOT( goNext() ) ); | 762 | mView, SLOT( goNext() ) ); |
763 | action->addTo( iconToolBar ); | 763 | action->addTo( iconToolBar ); |
764 | } | 764 | } |
765 | icon = loadPixmap( pathString + "2rightarrowB" ); | 765 | icon = loadPixmap( pathString + "2rightarrowB" ); |
766 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 766 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
767 | if (p-> mShowIconForwardFast) { | 767 | if (p-> mShowIconForwardFast) { |
768 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 768 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
769 | connect( action, SIGNAL( activated() ), | 769 | connect( action, SIGNAL( activated() ), |
770 | mView, SLOT( goNextMonth() ) ); | 770 | mView, SLOT( goNextMonth() ) ); |
771 | action->addTo( iconToolBar ); | 771 | action->addTo( iconToolBar ); |
772 | } | 772 | } |
773 | 773 | ||
774 | 774 | ||
775 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); | 775 | configureToolBarMenu->insertItem(i18n("What's This?"), 300); |
776 | 776 | ||
777 | if (p-> mShowIconNewEvent) | 777 | if (p-> mShowIconNewEvent) |
778 | configureToolBarMenu->setItemChecked( 10, true ); | 778 | configureToolBarMenu->setItemChecked( 10, true ); |
779 | if (p->mShowIconNewTodo ) | 779 | if (p->mShowIconNewTodo ) |
780 | configureToolBarMenu->setItemChecked( 20, true ); | 780 | configureToolBarMenu->setItemChecked( 20, true ); |
781 | if (p-> mShowIconSearch) | 781 | if (p-> mShowIconSearch) |
782 | configureToolBarMenu->setItemChecked( 120, true ); | 782 | configureToolBarMenu->setItemChecked( 120, true ); |
783 | if (p-> mShowIconList) | 783 | if (p-> mShowIconList) |
784 | configureToolBarMenu->setItemChecked( 30, true ); | 784 | configureToolBarMenu->setItemChecked( 30, true ); |
785 | if (p-> mShowIconDay1) | 785 | if (p-> mShowIconDay1) |
786 | configureToolBarMenu->setItemChecked( 40, true ); | 786 | configureToolBarMenu->setItemChecked( 40, true ); |
787 | if (p-> mShowIconDay5) | 787 | if (p-> mShowIconDay5) |
788 | configureToolBarMenu->setItemChecked( 50, true ); | 788 | configureToolBarMenu->setItemChecked( 50, true ); |
789 | if (p-> mShowIconDay7) | 789 | if (p-> mShowIconDay7) |
790 | configureToolBarMenu->setItemChecked( 60, true ); | 790 | configureToolBarMenu->setItemChecked( 60, true ); |
791 | if (p-> mShowIconMonth) | 791 | if (p-> mShowIconMonth) |
792 | configureToolBarMenu->setItemChecked( 70, true ); | 792 | configureToolBarMenu->setItemChecked( 70, true ); |
793 | if (p-> mShowIconTodoview) | 793 | if (p-> mShowIconTodoview) |
794 | configureToolBarMenu->setItemChecked( 80, true ); | 794 | configureToolBarMenu->setItemChecked( 80, true ); |
795 | if (p-> mShowIconBackFast) | 795 | if (p-> mShowIconBackFast) |
796 | configureToolBarMenu->setItemChecked( 200, true ); | 796 | configureToolBarMenu->setItemChecked( 200, true ); |
797 | if (p-> mShowIconBack) | 797 | if (p-> mShowIconBack) |
798 | configureToolBarMenu->setItemChecked( 210, true ); | 798 | configureToolBarMenu->setItemChecked( 210, true ); |
799 | if (p-> mShowIconToday) | 799 | if (p-> mShowIconToday) |
800 | configureToolBarMenu->setItemChecked( 130, true ); | 800 | configureToolBarMenu->setItemChecked( 130, true ); |
801 | if (p-> mShowIconForward) | 801 | if (p-> mShowIconForward) |
802 | configureToolBarMenu->setItemChecked( 220, true ); | 802 | configureToolBarMenu->setItemChecked( 220, true ); |
803 | if (p-> mShowIconForwardFast) | 803 | if (p-> mShowIconForwardFast) |
804 | configureToolBarMenu->setItemChecked( 230, true ); | 804 | configureToolBarMenu->setItemChecked( 230, true ); |
805 | if (p-> mShowIconNextDays) | 805 | if (p-> mShowIconNextDays) |
806 | configureToolBarMenu->setItemChecked( 100, true ); | 806 | configureToolBarMenu->setItemChecked( 100, true ); |
807 | if (p-> mShowIconNext) | 807 | if (p-> mShowIconNext) |
808 | configureToolBarMenu->setItemChecked( 110, true ); | 808 | configureToolBarMenu->setItemChecked( 110, true ); |
809 | if (p-> mShowIconJournal) | 809 | if (p-> mShowIconJournal) |
810 | configureToolBarMenu->setItemChecked( 90, true ); | 810 | configureToolBarMenu->setItemChecked( 90, true ); |
811 | if (p-> mShowIconWhatsThis) | 811 | if (p-> mShowIconWhatsThis) |
812 | configureToolBarMenu->setItemChecked( 300, true ); | 812 | configureToolBarMenu->setItemChecked( 300, true ); |
813 | 813 | ||
814 | QLabel* dummy = new QLabel( iconToolBar ); | 814 | QLabel* dummy = new QLabel( iconToolBar ); |
815 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 815 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
816 | if (!p-> mShowIconStretch) | 816 | if (!p-> mShowIconStretch) |
817 | iconToolBar->setStretchableWidget ( dummy ) ; | 817 | iconToolBar->setStretchableWidget ( dummy ) ; |
818 | else | 818 | else |
819 | configureToolBarMenu->setItemChecked( 5, true ); | 819 | configureToolBarMenu->setItemChecked( 5, true ); |
820 | if (p-> mShowIconWhatsThis) | 820 | if (p-> mShowIconWhatsThis) |
821 | QWhatsThis::whatsThisButton ( iconToolBar ); | 821 | QWhatsThis::whatsThisButton ( iconToolBar ); |
822 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 822 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
823 | configureAgenda( p->mHourSize ); | 823 | configureAgenda( p->mHourSize ); |
824 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 824 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
825 | } | 825 | } |
826 | void MainWindow::fillSyncMenu() | 826 | void MainWindow::fillSyncMenu() |
827 | { | 827 | { |
828 | syncMenu->clear(); | 828 | syncMenu->clear(); |
829 | syncMenu->insertItem( i18n("Configure..."), 0 ); | 829 | syncMenu->insertItem( i18n("Configure..."), 0 ); |
830 | syncMenu->insertSeparator(); | 830 | syncMenu->insertSeparator(); |
831 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); | 831 | syncMenu->insertItem( i18n("Multiple sync"), 1 ); |
832 | syncMenu->insertSeparator(); | 832 | syncMenu->insertSeparator(); |
833 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 833 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
834 | config.setGroup("General"); | 834 | config.setGroup("General"); |
835 | QStringList prof = config.readListEntry("SyncProfileNames"); | 835 | QStringList prof = config.readListEntry("SyncProfileNames"); |
836 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); | 836 | KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); |
837 | if ( prof.count() < 3 ) { | 837 | if ( prof.count() < 3 ) { |
838 | prof.clear(); | 838 | prof.clear(); |
839 | prof << i18n("Sharp_DTM"); | 839 | prof << i18n("Sharp_DTM"); |
840 | prof << i18n("Local_file"); | 840 | prof << i18n("Local_file"); |
841 | prof << i18n("Last_file"); | 841 | prof << i18n("Last_file"); |
842 | KSyncProfile* temp = new KSyncProfile (); | 842 | KSyncProfile* temp = new KSyncProfile (); |
843 | temp->setName( prof[0] ); | 843 | temp->setName( prof[0] ); |
844 | temp->writeConfig(&config); | 844 | temp->writeConfig(&config); |
845 | temp->setName( prof[1] ); | 845 | temp->setName( prof[1] ); |
846 | temp->writeConfig(&config); | 846 | temp->writeConfig(&config); |
847 | temp->setName( prof[2] ); | 847 | temp->setName( prof[2] ); |
848 | temp->writeConfig(&config); | 848 | temp->writeConfig(&config); |
849 | config.setGroup("General"); | 849 | config.setGroup("General"); |
850 | config.writeEntry("SyncProfileNames",prof); | 850 | config.writeEntry("SyncProfileNames",prof); |
851 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); | 851 | config.writeEntry("ExternSyncProfiles","Sharp_DTM"); |
852 | config.sync(); | 852 | config.sync(); |
853 | delete temp; | 853 | delete temp; |
854 | } | 854 | } |
855 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); | 855 | KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); |
856 | KOPrefs::instance()->mSyncProfileNames = prof; | 856 | KOPrefs::instance()->mSyncProfileNames = prof; |
857 | int i; | 857 | int i; |
858 | for ( i = 0; i < prof.count(); ++i ) { | 858 | for ( i = 0; i < prof.count(); ++i ) { |
859 | 859 | ||
860 | syncMenu->insertItem( prof[i], 1000+i ); | 860 | syncMenu->insertItem( prof[i], 1000+i ); |
861 | if ( i == 2 ) | 861 | if ( i == 2 ) |
862 | syncMenu->insertSeparator(); | 862 | syncMenu->insertSeparator(); |
863 | } | 863 | } |
864 | QDir app_dir; | 864 | QDir app_dir; |
865 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { | 865 | if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { |
866 | syncMenu->setItemEnabled( false , 1000 ); | 866 | syncMenu->setItemEnabled( false , 1000 ); |
867 | } | 867 | } |
868 | mView->setupExternSyncProfiles(); | 868 | mView->setupExternSyncProfiles(); |
869 | } | 869 | } |
870 | 870 | ||
871 | int MainWindow::ringSync() | 871 | int MainWindow::ringSync() |
872 | { | 872 | { |
873 | int syncedProfiles = 0; | 873 | int syncedProfiles = 0; |
874 | int i; | 874 | int i; |
875 | QTime timer; | 875 | QTime timer; |
876 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 876 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
877 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; | 877 | QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; |
878 | KSyncProfile* temp = new KSyncProfile (); | 878 | KSyncProfile* temp = new KSyncProfile (); |
879 | KOPrefs::instance()->mAskForPreferences = false; | 879 | KOPrefs::instance()->mAskForPreferences = false; |
880 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 880 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
881 | mCurrentSyncProfile = i; | 881 | mCurrentSyncProfile = i; |
882 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 882 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
883 | temp->readConfig(&config); | 883 | temp->readConfig(&config); |
884 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { | 884 | if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { |
885 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 885 | setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
886 | ++syncedProfiles; | 886 | ++syncedProfiles; |
887 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 887 | // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
888 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 888 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
889 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 889 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
890 | KOPrefs::instance()->mShowSyncSummary = false; | 890 | KOPrefs::instance()->mShowSyncSummary = false; |
891 | mView->setSyncDevice(syncProfileNames[i] ); | 891 | mView->setSyncDevice(syncProfileNames[i] ); |
892 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 892 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
893 | if ( i == 0 ) { | 893 | if ( i == 0 ) { |
894 | syncSharp(); | 894 | syncSharp(); |
895 | } else { | 895 | } else { |
896 | if ( temp->getIsLocalFileSync() ) { | 896 | if ( temp->getIsLocalFileSync() ) { |
897 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) | 897 | if ( syncWithFile( temp->getRemoteFileName( ), true ) ) |
898 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 898 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
899 | } else { | 899 | } else { |
900 | syncRemote( temp, false ); | 900 | if ( temp->getIsPhoneSync() ) { |
901 | KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; | ||
902 | KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); | ||
903 | KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); | ||
904 | syncPhone(); | ||
905 | } else | ||
906 | syncRemote( temp, false ); | ||
901 | 907 | ||
902 | } | 908 | } |
903 | } | 909 | } |
904 | timer.start(); | 910 | timer.start(); |
905 | setCaption(i18n("Multiple sync in progress ... please wait!") ); | 911 | setCaption(i18n("Multiple sync in progress ... please wait!") ); |
906 | while ( timer.elapsed () < 2000 ) { | 912 | while ( timer.elapsed () < 2000 ) { |
907 | qApp->processEvents(); | 913 | qApp->processEvents(); |
908 | #ifndef _WIN32_ | 914 | #ifndef _WIN32_ |
909 | sleep (1); | 915 | sleep (1); |
910 | #endif | 916 | #endif |
911 | } | 917 | } |
912 | 918 | ||
913 | } | 919 | } |
914 | 920 | ||
915 | } | 921 | } |
916 | delete temp; | 922 | delete temp; |
917 | return syncedProfiles; | 923 | return syncedProfiles; |
918 | } | 924 | } |
919 | 925 | ||
920 | void MainWindow::multiSync( bool askforPrefs ) | 926 | void MainWindow::multiSync( bool askforPrefs ) |
921 | { | 927 | { |
922 | if (mBlockSaveFlag) | 928 | if (mBlockSaveFlag) |
923 | return; | 929 | return; |
924 | mBlockSaveFlag = true; | 930 | mBlockSaveFlag = true; |
925 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 931 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
926 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 932 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
927 | question, | 933 | question, |
928 | i18n("Yes"), i18n("No"), | 934 | i18n("Yes"), i18n("No"), |
929 | 0, 0 ) != 0 ) { | 935 | 0, 0 ) != 0 ) { |
930 | mBlockSaveFlag = false; | 936 | mBlockSaveFlag = false; |
931 | setCaption(i18n("Aborted! Nothing synced!")); | 937 | setCaption(i18n("Aborted! Nothing synced!")); |
932 | return; | 938 | return; |
933 | } | 939 | } |
934 | mView->setSyncDevice(i18n("Multiple profiles") ); | 940 | mView->setSyncDevice(i18n("Multiple profiles") ); |
935 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 941 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
936 | if ( askforPrefs ) { | 942 | if ( askforPrefs ) { |
937 | mView->edit_sync_options(); | 943 | mView->edit_sync_options(); |
938 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 944 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
939 | } | 945 | } |
940 | setCaption(i18n("Multiple sync started.") ); | 946 | setCaption(i18n("Multiple sync started.") ); |
941 | qApp->processEvents(); | 947 | qApp->processEvents(); |
942 | int num = ringSync() ; | 948 | int num = ringSync() ; |
943 | if ( num > 1 ) | 949 | if ( num > 1 ) |
944 | ringSync(); | 950 | ringSync(); |
945 | mBlockSaveFlag = false; | 951 | mBlockSaveFlag = false; |
946 | if ( num ) | 952 | if ( num ) |
947 | save(); | 953 | save(); |
948 | if ( num ) | 954 | if ( num ) |
949 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 955 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
950 | else | 956 | else |
951 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 957 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
952 | return; | 958 | return; |
953 | } | 959 | } |
954 | void MainWindow::slotSyncMenu( int action ) | 960 | void MainWindow::slotSyncMenu( int action ) |
955 | { | 961 | { |
956 | //qDebug("syncaction %d ", action); | 962 | //qDebug("syncaction %d ", action); |
957 | if ( action == 0 ) { | 963 | if ( action == 0 ) { |
958 | 964 | ||
959 | confSync(); | 965 | confSync(); |
960 | 966 | ||
961 | return; | 967 | return; |
962 | } | 968 | } |
963 | if ( action == 1 ) { | 969 | if ( action == 1 ) { |
964 | multiSync( true ); | 970 | multiSync( true ); |
965 | return; | 971 | return; |
966 | } | 972 | } |
967 | 973 | ||
968 | if (mBlockSaveFlag) | 974 | if (mBlockSaveFlag) |
969 | return; | 975 | return; |
970 | mBlockSaveFlag = true; | 976 | mBlockSaveFlag = true; |
971 | mCurrentSyncProfile = action - 1000 ; | 977 | mCurrentSyncProfile = action - 1000 ; |
972 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 978 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
973 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 979 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
974 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); | 980 | KConfig config ( locateLocal( "config","syncprofilesrc" ) ); |
975 | KSyncProfile* temp = new KSyncProfile (); | 981 | KSyncProfile* temp = new KSyncProfile (); |
976 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 982 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
977 | temp->readConfig(&config); | 983 | temp->readConfig(&config); |
978 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 984 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
979 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 985 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
980 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 986 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
981 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 987 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
982 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 988 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
983 | if ( action == 1000 ) { | 989 | if ( action == 1000 ) { |
984 | syncSharp(); | 990 | syncSharp(); |
985 | 991 | ||
986 | } else if ( action == 1001 ) { | 992 | } else if ( action == 1001 ) { |
987 | syncLocalFile(); | 993 | syncLocalFile(); |
988 | 994 | ||
989 | } else if ( action == 1002 ) { | 995 | } else if ( action == 1002 ) { |
990 | quickSyncLocalFile(); | 996 | quickSyncLocalFile(); |
991 | 997 | ||
992 | } else if ( action >= 1003 ) { | 998 | } else if ( action >= 1003 ) { |
993 | if ( temp->getIsLocalFileSync() ) { | 999 | if ( temp->getIsLocalFileSync() ) { |
994 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 1000 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
995 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 1001 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
996 | } else { | 1002 | } else { |
997 | syncRemote( temp ); | 1003 | syncRemote( temp ); |
998 | 1004 | ||
999 | } | 1005 | } |
1000 | } | 1006 | } |
1001 | delete temp; | 1007 | delete temp; |
1002 | mBlockSaveFlag = false; | 1008 | mBlockSaveFlag = false; |
1003 | } | 1009 | } |
1004 | void MainWindow::setDefaultPreferences() | 1010 | void MainWindow::setDefaultPreferences() |
1005 | { | 1011 | { |
1006 | KOPrefs *p = KOPrefs::instance(); | 1012 | KOPrefs *p = KOPrefs::instance(); |
1007 | 1013 | ||
1008 | p->mCompactDialogs = true; | 1014 | p->mCompactDialogs = true; |
1009 | p->mConfirm = true; | 1015 | p->mConfirm = true; |
1010 | // p->mEnableQuickTodo = false; | 1016 | // p->mEnableQuickTodo = false; |
1011 | } | 1017 | } |
1012 | 1018 | ||
1013 | QString MainWindow::resourcePath() | 1019 | QString MainWindow::resourcePath() |
1014 | { | 1020 | { |
1015 | return KGlobal::iconLoader()->iconPath(); | 1021 | return KGlobal::iconLoader()->iconPath(); |
1016 | } | 1022 | } |
1017 | 1023 | ||
1018 | void MainWindow::displayText( QString text ,QString cap ) | 1024 | void MainWindow::displayText( QString text ,QString cap ) |
1019 | { | 1025 | { |
1020 | QDialog dia( this, "name", true ); ; | 1026 | QDialog dia( this, "name", true ); ; |
1021 | dia.setCaption( cap ); | 1027 | dia.setCaption( cap ); |
1022 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1028 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1023 | lay->setSpacing( 3 ); | 1029 | lay->setSpacing( 3 ); |
1024 | lay->setMargin( 3 ); | 1030 | lay->setMargin( 3 ); |
1025 | QTextBrowser tb ( &dia ); | 1031 | QTextBrowser tb ( &dia ); |
1026 | lay->addWidget( &tb ); | 1032 | lay->addWidget( &tb ); |
1027 | tb.setText( text ); | 1033 | tb.setText( text ); |
1028 | #ifdef DESKTOP_VERSION | 1034 | #ifdef DESKTOP_VERSION |
1029 | dia.resize( 640, 480); | 1035 | dia.resize( 640, 480); |
1030 | #else | 1036 | #else |
1031 | dia.showMaximized(); | 1037 | dia.showMaximized(); |
1032 | #endif | 1038 | #endif |
1033 | dia.exec(); | 1039 | dia.exec(); |
1034 | } | 1040 | } |
1035 | void MainWindow::displayFile( QString fn, QString cap ) | 1041 | void MainWindow::displayFile( QString fn, QString cap ) |
1036 | { | 1042 | { |
1037 | QString fileName = resourcePath() + fn; | 1043 | QString fileName = resourcePath() + fn; |
1038 | QString text; | 1044 | QString text; |
1039 | QFile file( fileName ); | 1045 | QFile file( fileName ); |
1040 | if (!file.open( IO_ReadOnly ) ) { | 1046 | if (!file.open( IO_ReadOnly ) ) { |
1041 | return ; | 1047 | return ; |
1042 | 1048 | ||
1043 | } | 1049 | } |
1044 | QTextStream ts( &file ); | 1050 | QTextStream ts( &file ); |
1045 | text = ts.read(); | 1051 | text = ts.read(); |
1046 | file.close(); | 1052 | file.close(); |
1047 | displayText( text, cap); | 1053 | displayText( text, cap); |
1048 | } | 1054 | } |
1049 | void MainWindow::features() | 1055 | void MainWindow::features() |
1050 | { | 1056 | { |
1051 | 1057 | ||
1052 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); | 1058 | displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); |
1053 | } | 1059 | } |
1054 | 1060 | ||
1055 | void MainWindow::usertrans() | 1061 | void MainWindow::usertrans() |
1056 | { | 1062 | { |
1057 | 1063 | ||
1058 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); | 1064 | displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); |
1059 | } | 1065 | } |
1060 | void MainWindow::synchowto() | 1066 | void MainWindow::synchowto() |
1061 | { | 1067 | { |
1062 | 1068 | ||
1063 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); | 1069 | displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); |
1064 | } | 1070 | } |
1065 | void MainWindow::faq() | 1071 | void MainWindow::faq() |
1066 | { | 1072 | { |
1067 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); | 1073 | displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); |
1068 | 1074 | ||
1069 | } | 1075 | } |
1070 | void MainWindow::whatsNew() | 1076 | void MainWindow::whatsNew() |
1071 | { | 1077 | { |
1072 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); | 1078 | displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); |
1073 | 1079 | ||
1074 | } | 1080 | } |
1075 | void MainWindow::licence() | 1081 | void MainWindow::licence() |
1076 | { | 1082 | { |
1077 | KApplication::showLicence(); | 1083 | KApplication::showLicence(); |
1078 | 1084 | ||
1079 | } | 1085 | } |
1080 | void MainWindow::about() | 1086 | void MainWindow::about() |
1081 | { | 1087 | { |
1082 | QString version; | 1088 | QString version; |
1083 | #include <../version> | 1089 | #include <../version> |
1084 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1090 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1085 | i18n("KOrganizer/Platform-independent\n") + | 1091 | i18n("KOrganizer/Platform-independent\n") + |
1086 | "(KO/Pi) " + version + " - " + | 1092 | "(KO/Pi) " + version + " - " + |
1087 | 1093 | ||
1088 | #ifdef DESKTOP_VERSION | 1094 | #ifdef DESKTOP_VERSION |
1089 | i18n("Desktop Edition\n") + | 1095 | i18n("Desktop Edition\n") + |
1090 | #else | 1096 | #else |
1091 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + | 1097 | i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + |
1092 | #endif | 1098 | #endif |
1093 | 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") ); | 1099 | 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") ); |
1094 | } | 1100 | } |
1095 | void MainWindow::keyBindings() | 1101 | void MainWindow::keyBindings() |
1096 | { | 1102 | { |
1097 | QString cap = i18n("Key bindings KOrganizer/Pi"); | 1103 | QString cap = i18n("Key bindings KOrganizer/Pi"); |
1098 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1104 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1099 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1105 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1100 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1106 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1101 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1107 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1102 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1108 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1103 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1109 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1104 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1110 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1105 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ | 1111 | i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ |
1106 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1112 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1107 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1113 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1108 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1114 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1109 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1115 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1110 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1116 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1111 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ | 1117 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ |
1112 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1118 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1113 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1119 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1114 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1120 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1115 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1121 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1116 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1122 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1117 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1123 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1118 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1124 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1119 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1125 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1120 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1126 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1121 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1127 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1122 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1128 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1123 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1129 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1124 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1130 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1125 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1131 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1126 | i18n("<p><h3>In list view:</h3></p>\n") + | 1132 | i18n("<p><h3>In list view:</h3></p>\n") + |
1127 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1133 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1128 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1134 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1129 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1135 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1130 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1136 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1131 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1137 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1132 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1138 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1133 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1139 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1134 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1140 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1135 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1141 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1136 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1142 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1137 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1143 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1138 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1144 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1139 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1145 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1140 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1146 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1141 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1147 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1142 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1148 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1143 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1149 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1144 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1150 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1145 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1151 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1146 | displayText( text, cap); | 1152 | displayText( text, cap); |
1147 | 1153 | ||
1148 | } | 1154 | } |
1149 | void MainWindow::aboutAutoSaving() | 1155 | void MainWindow::aboutAutoSaving() |
1150 | { | 1156 | { |
1151 | QMessageBox* msg; | 1157 | QMessageBox* msg; |
1152 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), | 1158 | msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), |
1153 | 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, | 1159 | 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, |
1154 | QMessageBox::Ok, | 1160 | QMessageBox::Ok, |
1155 | QMessageBox::NoButton, | 1161 | QMessageBox::NoButton, |
1156 | QMessageBox::NoButton); | 1162 | QMessageBox::NoButton); |
1157 | msg->exec(); | 1163 | msg->exec(); |
1158 | delete msg; | 1164 | delete msg; |
1159 | 1165 | ||
1160 | 1166 | ||
1161 | } | 1167 | } |
1162 | void MainWindow::aboutKnownBugs() | 1168 | void MainWindow::aboutKnownBugs() |
1163 | { | 1169 | { |
1164 | QMessageBox* msg; | 1170 | QMessageBox* msg; |
1165 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1171 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1166 | 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")+ | 1172 | 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")+ |
1167 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1173 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1168 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + | 1174 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + |
1169 | i18n("\nor report them in the bugtracker on\n") + | 1175 | i18n("\nor report them in the bugtracker on\n") + |
1170 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1176 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1171 | QMessageBox::NoIcon, | 1177 | QMessageBox::NoIcon, |
1172 | QMessageBox::Ok, | 1178 | QMessageBox::Ok, |
1173 | QMessageBox::NoButton, | 1179 | QMessageBox::NoButton, |
1174 | QMessageBox::NoButton); | 1180 | QMessageBox::NoButton); |
1175 | msg->exec(); | 1181 | msg->exec(); |
1176 | delete msg; | 1182 | delete msg; |
1177 | 1183 | ||
1178 | } | 1184 | } |
1179 | 1185 | ||
1180 | QString MainWindow::defaultFileName() | 1186 | QString MainWindow::defaultFileName() |
1181 | { | 1187 | { |
1182 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1188 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1183 | } | 1189 | } |
1184 | 1190 | ||
1185 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1191 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1186 | { | 1192 | { |
1187 | if ( !incidence ) { | 1193 | if ( !incidence ) { |
1188 | enableIncidenceActions( false ); | 1194 | enableIncidenceActions( false ); |
1189 | 1195 | ||
1190 | mNewSubTodoAction->setEnabled( false ); | 1196 | mNewSubTodoAction->setEnabled( false ); |
1191 | setCaptionToDates(); | 1197 | setCaptionToDates(); |
1192 | return; | 1198 | return; |
1193 | 1199 | ||
1194 | } | 1200 | } |
1195 | 1201 | ||
1196 | //KGlobal::locale()->formatDateTime(nextA, true); | 1202 | //KGlobal::locale()->formatDateTime(nextA, true); |
1197 | QString startString = ""; | 1203 | QString startString = ""; |
1198 | if ( incidence->type() != "Todo" ) { | 1204 | if ( incidence->type() != "Todo" ) { |
1199 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1205 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1200 | if ( incidence->doesFloat() ) { | 1206 | if ( incidence->doesFloat() ) { |
1201 | startString += ": "+incidence->dtStartDateStr( true ); | 1207 | startString += ": "+incidence->dtStartDateStr( true ); |
1202 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1208 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1203 | 1209 | ||
1204 | } else { | 1210 | } else { |
1205 | startString = ": "+incidence->dtStartStr(true); | 1211 | startString = ": "+incidence->dtStartStr(true); |
1206 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1212 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1207 | 1213 | ||
1208 | } | 1214 | } |
1209 | 1215 | ||
1210 | } else { | 1216 | } else { |
1211 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1217 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1212 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1218 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1213 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1219 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1214 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1220 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1215 | } | 1221 | } |
1216 | 1222 | ||
1217 | } | 1223 | } |
1218 | else | 1224 | else |
1219 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1225 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1220 | if ( !incidence->location().isEmpty() ) | 1226 | if ( !incidence->location().isEmpty() ) |
1221 | startString += " (" +incidence->location()+")"; | 1227 | startString += " (" +incidence->location()+")"; |
1222 | setCaption( incidence->summary()+startString); | 1228 | setCaption( incidence->summary()+startString); |
1223 | 1229 | ||
1224 | enableIncidenceActions( true ); | 1230 | enableIncidenceActions( true ); |
1225 | 1231 | ||
1226 | if ( incidence->type() == "Event" ) { | 1232 | if ( incidence->type() == "Event" ) { |
1227 | mShowAction->setText( i18n("Show Event...") ); | 1233 | mShowAction->setText( i18n("Show Event...") ); |
1228 | mEditAction->setText( i18n("Edit Event...") ); | 1234 | mEditAction->setText( i18n("Edit Event...") ); |
1229 | mDeleteAction->setText( i18n("Delete Event...") ); | 1235 | mDeleteAction->setText( i18n("Delete Event...") ); |
1230 | 1236 | ||
1231 | mNewSubTodoAction->setEnabled( false ); | 1237 | mNewSubTodoAction->setEnabled( false ); |
1232 | } else if ( incidence->type() == "Todo" ) { | 1238 | } else if ( incidence->type() == "Todo" ) { |
1233 | mShowAction->setText( i18n("Show Todo...") ); | 1239 | mShowAction->setText( i18n("Show Todo...") ); |
1234 | mEditAction->setText( i18n("Edit Todo...") ); | 1240 | mEditAction->setText( i18n("Edit Todo...") ); |
1235 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1241 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1236 | 1242 | ||
1237 | mNewSubTodoAction->setEnabled( true ); | 1243 | mNewSubTodoAction->setEnabled( true ); |
1238 | } else { | 1244 | } else { |
1239 | mShowAction->setText( i18n("Show...") ); | 1245 | mShowAction->setText( i18n("Show...") ); |
1240 | mShowAction->setText( i18n("Edit...") ); | 1246 | mShowAction->setText( i18n("Edit...") ); |
1241 | mShowAction->setText( i18n("Delete...") ); | 1247 | mShowAction->setText( i18n("Delete...") ); |
1242 | 1248 | ||
1243 | mNewSubTodoAction->setEnabled( false ); | 1249 | mNewSubTodoAction->setEnabled( false ); |
1244 | } | 1250 | } |
1245 | } | 1251 | } |
1246 | 1252 | ||
1247 | void MainWindow::enableIncidenceActions( bool enabled ) | 1253 | void MainWindow::enableIncidenceActions( bool enabled ) |
1248 | { | 1254 | { |
1249 | mShowAction->setEnabled( enabled ); | 1255 | mShowAction->setEnabled( enabled ); |
1250 | mEditAction->setEnabled( enabled ); | 1256 | mEditAction->setEnabled( enabled ); |
1251 | mDeleteAction->setEnabled( enabled ); | 1257 | mDeleteAction->setEnabled( enabled ); |
1252 | } | 1258 | } |
1253 | 1259 | ||
1254 | void MainWindow::importOL() | 1260 | void MainWindow::importOL() |
1255 | { | 1261 | { |
1256 | #ifdef _WIN32_ | 1262 | #ifdef _WIN32_ |
1257 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1263 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1258 | id->exec(); | 1264 | id->exec(); |
1259 | delete id; | 1265 | delete id; |
1260 | mView->updateView(); | 1266 | mView->updateView(); |
1261 | #endif | 1267 | #endif |
1262 | } | 1268 | } |
1263 | void MainWindow::importBday() | 1269 | void MainWindow::importBday() |
1264 | { | 1270 | { |
1265 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1271 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1266 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1272 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1267 | i18n("Import!"), i18n("Cancel"), 0, | 1273 | i18n("Import!"), i18n("Cancel"), 0, |
1268 | 0, 1 ); | 1274 | 0, 1 ); |
1269 | if ( result == 0 ) { | 1275 | if ( result == 0 ) { |
1270 | mView->importBday(); | 1276 | mView->importBday(); |
1271 | 1277 | ||
1272 | } | 1278 | } |
1273 | 1279 | ||
1274 | 1280 | ||
1275 | } | 1281 | } |
1276 | void MainWindow::importQtopia() | 1282 | void MainWindow::importQtopia() |
1277 | { | 1283 | { |
1278 | #ifndef DESKTOP_VERSION | 1284 | #ifndef DESKTOP_VERSION |
1279 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1285 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1280 | 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"), | 1286 | 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"), |
1281 | i18n("Import!"), i18n("Cancel"), 0, | 1287 | i18n("Import!"), i18n("Cancel"), 0, |
1282 | 0, 1 ); | 1288 | 0, 1 ); |
1283 | if ( result == 0 ) { | 1289 | if ( result == 0 ) { |
1284 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1290 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
@@ -1656,394 +1662,402 @@ void MainWindow::loadCalendar() | |||
1656 | info.setFile( fn ); | 1662 | info.setFile( fn ); |
1657 | QString mess; | 1663 | QString mess; |
1658 | bool loadbup = true; | 1664 | bool loadbup = true; |
1659 | if ( info. exists() ) { | 1665 | if ( info. exists() ) { |
1660 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1666 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1661 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1667 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1662 | mess, | 1668 | mess, |
1663 | i18n("Load!"), i18n("Cancel"), 0, | 1669 | i18n("Load!"), i18n("Cancel"), 0, |
1664 | 0, 1 ); | 1670 | 0, 1 ); |
1665 | if ( result != 0 ) { | 1671 | if ( result != 0 ) { |
1666 | loadbup = false; | 1672 | loadbup = false; |
1667 | } | 1673 | } |
1668 | } else { | 1674 | } else { |
1669 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1675 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1670 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 1676 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
1671 | 0, 1 ); | 1677 | 0, 1 ); |
1672 | 1678 | ||
1673 | return; | 1679 | return; |
1674 | } | 1680 | } |
1675 | if ( loadbup ) { | 1681 | if ( loadbup ) { |
1676 | mView->openCalendar( fn ); | 1682 | mView->openCalendar( fn ); |
1677 | KOPrefs::instance()->mLastLoadFile = fn; | 1683 | KOPrefs::instance()->mLastLoadFile = fn; |
1678 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 1684 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
1679 | setCaption(mess); | 1685 | setCaption(mess); |
1680 | } | 1686 | } |
1681 | 1687 | ||
1682 | } | 1688 | } |
1683 | void MainWindow::quickImportIcal() | 1689 | void MainWindow::quickImportIcal() |
1684 | { | 1690 | { |
1685 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 1691 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
1686 | } | 1692 | } |
1687 | void MainWindow::importFile( QString fn, bool quick ) | 1693 | void MainWindow::importFile( QString fn, bool quick ) |
1688 | { | 1694 | { |
1689 | QFileInfo info; | 1695 | QFileInfo info; |
1690 | info.setFile( fn ); | 1696 | info.setFile( fn ); |
1691 | QString mess; | 1697 | QString mess; |
1692 | bool loadbup = true; | 1698 | bool loadbup = true; |
1693 | if ( !info. exists() ) { | 1699 | if ( !info. exists() ) { |
1694 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 1700 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
1695 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1701 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1696 | mess ); | 1702 | mess ); |
1697 | return; | 1703 | return; |
1698 | } | 1704 | } |
1699 | int result = 0; | 1705 | int result = 0; |
1700 | if ( !quick ) { | 1706 | if ( !quick ) { |
1701 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1707 | mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1702 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 1708 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
1703 | mess, | 1709 | mess, |
1704 | "Import", "Cancel", 0, | 1710 | "Import", "Cancel", 0, |
1705 | 0, 1 ); | 1711 | 0, 1 ); |
1706 | } | 1712 | } |
1707 | if ( result == 0 ) { | 1713 | if ( result == 0 ) { |
1708 | if ( mView->openCalendar( fn, true )) { | 1714 | if ( mView->openCalendar( fn, true )) { |
1709 | KOPrefs::instance()->mLastImportFile = fn; | 1715 | KOPrefs::instance()->mLastImportFile = fn; |
1710 | setCaption(i18n("Imported file successfully")); | 1716 | setCaption(i18n("Imported file successfully")); |
1711 | } else { | 1717 | } else { |
1712 | setCaption(i18n("Error importing file")); | 1718 | setCaption(i18n("Error importing file")); |
1713 | } | 1719 | } |
1714 | } | 1720 | } |
1715 | } | 1721 | } |
1716 | 1722 | ||
1717 | void MainWindow::importIcal() | 1723 | void MainWindow::importIcal() |
1718 | { | 1724 | { |
1719 | 1725 | ||
1720 | QString fn =KOPrefs::instance()->mLastImportFile; | 1726 | QString fn =KOPrefs::instance()->mLastImportFile; |
1721 | 1727 | ||
1722 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 1728 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
1723 | if ( fn == "" ) | 1729 | if ( fn == "" ) |
1724 | return; | 1730 | return; |
1725 | importFile( fn, true ); | 1731 | importFile( fn, true ); |
1726 | 1732 | ||
1727 | } | 1733 | } |
1728 | 1734 | ||
1729 | void MainWindow::exportVCalendar() | 1735 | void MainWindow::exportVCalendar() |
1730 | { | 1736 | { |
1731 | QString fn = KOPrefs::instance()->mLastVcalFile; | 1737 | QString fn = KOPrefs::instance()->mLastVcalFile; |
1732 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 1738 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
1733 | if ( fn == "" ) | 1739 | if ( fn == "" ) |
1734 | return; | 1740 | return; |
1735 | QFileInfo info; | 1741 | QFileInfo info; |
1736 | info.setFile( fn ); | 1742 | info.setFile( fn ); |
1737 | QString mes; | 1743 | QString mes; |
1738 | bool createbup = true; | 1744 | bool createbup = true; |
1739 | if ( info. exists() ) { | 1745 | if ( info. exists() ) { |
1740 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 1746 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
1741 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 1747 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
1742 | i18n("Overwrite!"), i18n("Cancel"), 0, | 1748 | i18n("Overwrite!"), i18n("Cancel"), 0, |
1743 | 0, 1 ); | 1749 | 0, 1 ); |
1744 | if ( result != 0 ) { | 1750 | if ( result != 0 ) { |
1745 | createbup = false; | 1751 | createbup = false; |
1746 | } | 1752 | } |
1747 | } | 1753 | } |
1748 | if ( createbup ) { | 1754 | if ( createbup ) { |
1749 | if ( mView->exportVCalendar( fn ) ) { | 1755 | if ( mView->exportVCalendar( fn ) ) { |
1750 | KOPrefs::instance()->mLastVcalFile = fn; | 1756 | KOPrefs::instance()->mLastVcalFile = fn; |
1751 | if ( fn.length() > 20 ) | 1757 | if ( fn.length() > 20 ) |
1752 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 1758 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
1753 | else | 1759 | else |
1754 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 1760 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
1755 | setCaption(mes); | 1761 | setCaption(mes); |
1756 | } | 1762 | } |
1757 | } | 1763 | } |
1758 | 1764 | ||
1759 | } | 1765 | } |
1760 | #include <qpushbutton.h> | 1766 | #include <qpushbutton.h> |
1761 | QString MainWindow::getPassword( ) | 1767 | QString MainWindow::getPassword( ) |
1762 | { | 1768 | { |
1763 | QString retfile = ""; | 1769 | QString retfile = ""; |
1764 | QDialog dia ( this, "input-dialog", true ); | 1770 | QDialog dia ( this, "input-dialog", true ); |
1765 | QLineEdit lab ( &dia ); | 1771 | QLineEdit lab ( &dia ); |
1766 | lab.setEchoMode( QLineEdit::Password ); | 1772 | lab.setEchoMode( QLineEdit::Password ); |
1767 | QVBoxLayout lay( &dia ); | 1773 | QVBoxLayout lay( &dia ); |
1768 | lay.setMargin(7); | 1774 | lay.setMargin(7); |
1769 | lay.setSpacing(7); | 1775 | lay.setSpacing(7); |
1770 | lay.addWidget( &lab); | 1776 | lay.addWidget( &lab); |
1771 | dia.setFixedSize( 230,50 ); | 1777 | dia.setFixedSize( 230,50 ); |
1772 | dia.setCaption( i18n("Enter password") ); | 1778 | dia.setCaption( i18n("Enter password") ); |
1773 | QPushButton pb ( "OK", &dia); | 1779 | QPushButton pb ( "OK", &dia); |
1774 | lay.addWidget( &pb ); | 1780 | lay.addWidget( &pb ); |
1775 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1781 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1776 | dia.show(); | 1782 | dia.show(); |
1777 | int res = dia.exec(); | 1783 | int res = dia.exec(); |
1778 | if ( res ) | 1784 | if ( res ) |
1779 | retfile = lab.text(); | 1785 | retfile = lab.text(); |
1780 | dia.hide(); | 1786 | dia.hide(); |
1781 | qApp->processEvents(); | 1787 | qApp->processEvents(); |
1782 | return retfile; | 1788 | return retfile; |
1783 | 1789 | ||
1784 | } | 1790 | } |
1785 | 1791 | ||
1786 | void MainWindow::syncLocalFile() | 1792 | void MainWindow::syncLocalFile() |
1787 | { | 1793 | { |
1788 | 1794 | ||
1789 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; | 1795 | QString fn =KOPrefs::instance()->mLastSyncedLocalFile; |
1790 | 1796 | ||
1791 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); | 1797 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); |
1792 | if ( fn == "" ) | 1798 | if ( fn == "" ) |
1793 | return; | 1799 | return; |
1794 | //mView->setSyncDevice("local-file" ); | 1800 | //mView->setSyncDevice("local-file" ); |
1795 | if ( syncWithFile( fn, false ) ) { | 1801 | if ( syncWithFile( fn, false ) ) { |
1796 | // Event* e = mView->getLastSyncEvent(); | 1802 | // Event* e = mView->getLastSyncEvent(); |
1797 | // e->setReadOnly( false ); | 1803 | // e->setReadOnly( false ); |
1798 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1804 | // e->setLocation( i18n("Local file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1799 | // e->setReadOnly( true ); | 1805 | // e->setReadOnly( true ); |
1800 | } | 1806 | } |
1801 | 1807 | ||
1802 | } | 1808 | } |
1803 | 1809 | ||
1804 | bool MainWindow::syncWithFile( QString fn , bool quick ) | 1810 | bool MainWindow::syncWithFile( QString fn , bool quick ) |
1805 | { | 1811 | { |
1806 | bool ret = false; | 1812 | bool ret = false; |
1807 | QFileInfo info; | 1813 | QFileInfo info; |
1808 | info.setFile( fn ); | 1814 | info.setFile( fn ); |
1809 | QString mess; | 1815 | QString mess; |
1810 | bool loadbup = true; | 1816 | bool loadbup = true; |
1811 | if ( !info. exists() ) { | 1817 | if ( !info. exists() ) { |
1812 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 1818 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
1813 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1819 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1814 | mess ); | 1820 | mess ); |
1815 | return ret; | 1821 | return ret; |
1816 | } | 1822 | } |
1817 | int result = 0; | 1823 | int result = 0; |
1818 | if ( !quick ) { | 1824 | if ( !quick ) { |
1819 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 1825 | mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
1820 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1826 | result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1821 | mess, | 1827 | mess, |
1822 | i18n("Sync"), i18n("Cancel"), 0, | 1828 | i18n("Sync"), i18n("Cancel"), 0, |
1823 | 0, 1 ); | 1829 | 0, 1 ); |
1824 | if ( result ) | 1830 | if ( result ) |
1825 | return false; | 1831 | return false; |
1826 | } | 1832 | } |
1827 | if ( KOPrefs::instance()->mAskForPreferences ) | 1833 | if ( KOPrefs::instance()->mAskForPreferences ) |
1828 | mView->edit_sync_options(); | 1834 | mView->edit_sync_options(); |
1829 | if ( result == 0 ) { | 1835 | if ( result == 0 ) { |
1830 | //qDebug("Now sycing ... "); | 1836 | //qDebug("Now sycing ... "); |
1831 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) | 1837 | if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) |
1832 | setCaption( i18n("Synchronization successful") ); | 1838 | setCaption( i18n("Synchronization successful") ); |
1833 | else | 1839 | else |
1834 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 1840 | setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
1835 | if ( ! quick ) | 1841 | if ( ! quick ) |
1836 | KOPrefs::instance()->mLastSyncedLocalFile = fn; | 1842 | KOPrefs::instance()->mLastSyncedLocalFile = fn; |
1837 | slotModifiedChanged( true ); | 1843 | slotModifiedChanged( true ); |
1838 | } | 1844 | } |
1839 | return ret; | 1845 | return ret; |
1840 | } | 1846 | } |
1841 | void MainWindow::quickSyncLocalFile() | 1847 | void MainWindow::quickSyncLocalFile() |
1842 | { | 1848 | { |
1843 | //mView->setSyncDevice("local-file" ); | 1849 | //mView->setSyncDevice("local-file" ); |
1844 | //qDebug("quickSyncLocalFile() "); | 1850 | //qDebug("quickSyncLocalFile() "); |
1845 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { | 1851 | if ( syncWithFile( KOPrefs::instance()->mLastSyncedLocalFile, false ) ) { |
1846 | // Event* e = mView->getLastSyncEvent(); | 1852 | // Event* e = mView->getLastSyncEvent(); |
1847 | // e->setReadOnly( false ); | 1853 | // e->setReadOnly( false ); |
1848 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); | 1854 | // e->setLocation( i18n("Quick with file: ")+ KOPrefs::instance()->mLastSyncedLocalFile); |
1849 | // e->setReadOnly( true ); | 1855 | // e->setReadOnly( true ); |
1850 | 1856 | ||
1851 | } | 1857 | } |
1852 | } | 1858 | } |
1853 | 1859 | ||
1854 | void MainWindow::confSync() | 1860 | void MainWindow::confSync() |
1855 | { | 1861 | { |
1856 | mView->confSync(); | 1862 | mView->confSync(); |
1857 | fillSyncMenu(); | 1863 | fillSyncMenu(); |
1858 | //mView->writeSettings(); | 1864 | //mView->writeSettings(); |
1859 | 1865 | ||
1860 | 1866 | ||
1861 | } | 1867 | } |
1862 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) | 1868 | void MainWindow::syncRemote( KSyncProfile* prof, bool ask) |
1863 | { | 1869 | { |
1864 | QString question; | 1870 | QString question; |
1865 | if ( ask ) { | 1871 | if ( ask ) { |
1866 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; | 1872 | question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; |
1867 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1873 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1868 | question, | 1874 | question, |
1869 | i18n("Yes"), i18n("No"), | 1875 | i18n("Yes"), i18n("No"), |
1870 | 0, 0 ) != 0 ) | 1876 | 0, 0 ) != 0 ) |
1871 | return; | 1877 | return; |
1872 | } | 1878 | } |
1873 | QString command = prof->getPreSyncCommand(); | 1879 | QString command = prof->getPreSyncCommand(); |
1874 | int fi; | 1880 | int fi; |
1875 | if ( (fi = command.find("$PWD$")) > 0 ) { | 1881 | if ( (fi = command.find("$PWD$")) > 0 ) { |
1876 | QString pwd = getPassword(); | 1882 | QString pwd = getPassword(); |
1877 | command = command.left( fi )+ pwd + command.mid( fi+5 ); | 1883 | command = command.left( fi )+ pwd + command.mid( fi+5 ); |
1878 | 1884 | ||
1879 | } | 1885 | } |
1880 | int maxlen = 30; | 1886 | int maxlen = 30; |
1881 | if ( QApplication::desktop()->width() > 320 ) | 1887 | if ( QApplication::desktop()->width() > 320 ) |
1882 | maxlen += 25; | 1888 | maxlen += 25; |
1883 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1889 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1884 | int fileSize = 0; | 1890 | int fileSize = 0; |
1885 | int result = system ( command ); | 1891 | int result = system ( command ); |
1886 | // 0 : okay | 1892 | // 0 : okay |
1887 | // 256: no such file or dir | 1893 | // 256: no such file or dir |
1888 | // | 1894 | // |
1889 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1895 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1890 | if ( result != 0 ) { | 1896 | if ( result != 0 ) { |
1891 | int len = maxlen; | 1897 | int len = maxlen; |
1892 | while ( len < command.length() ) { | 1898 | while ( len < command.length() ) { |
1893 | command.insert( len , "\n" ); | 1899 | command.insert( len , "\n" ); |
1894 | len += maxlen +2; | 1900 | len += maxlen +2; |
1895 | } | 1901 | } |
1896 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1902 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1897 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1903 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1898 | question, | 1904 | question, |
1899 | i18n("Okay!")) ; | 1905 | i18n("Okay!")) ; |
1900 | setCaption ("KO/Pi"); | 1906 | setCaption ("KO/Pi"); |
1901 | return; | 1907 | return; |
1902 | } | 1908 | } |
1903 | setCaption ( i18n( "Copying succeed." ) ); | 1909 | setCaption ( i18n( "Copying succeed." ) ); |
1904 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 1910 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
1905 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { | 1911 | if ( syncWithFile( prof->getLocalTempFile(), true ) ) { |
1906 | // Event* e = mView->getLastSyncEvent(); | 1912 | // Event* e = mView->getLastSyncEvent(); |
1907 | // e->setReadOnly( false ); | 1913 | // e->setReadOnly( false ); |
1908 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1914 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1909 | // e->setReadOnly( true ); | 1915 | // e->setReadOnly( true ); |
1910 | if ( KOPrefs::instance()->mWriteBackFile ) { | 1916 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1911 | command = prof->getPostSyncCommand(); | 1917 | command = prof->getPostSyncCommand(); |
1912 | setCaption ( i18n( "Writing back file ..." ) ); | 1918 | setCaption ( i18n( "Writing back file ..." ) ); |
1913 | result = system ( command ); | 1919 | result = system ( command ); |
1914 | qDebug("KO: Writing back file result: %d ", result); | 1920 | qDebug("KO: Writing back file result: %d ", result); |
1915 | if ( result != 0 ) { | 1921 | if ( result != 0 ) { |
1916 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); | 1922 | setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); |
1917 | return; | 1923 | return; |
1918 | } else { | 1924 | } else { |
1919 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 1925 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
1920 | } | 1926 | } |
1921 | } | 1927 | } |
1922 | } | 1928 | } |
1923 | return; | 1929 | return; |
1924 | } | 1930 | } |
1925 | void MainWindow::syncSSH() | 1931 | void MainWindow::syncSSH() |
1926 | { | 1932 | { |
1927 | // not used anymore | 1933 | // not used anymore |
1928 | QTime timer; | 1934 | QTime timer; |
1929 | timer.start(); | 1935 | timer.start(); |
1930 | //qDebug("MainWindow::syncssh() "); | 1936 | //qDebug("MainWindow::syncssh() "); |
1931 | KOPrefs *p = KOPrefs::instance(); | 1937 | KOPrefs *p = KOPrefs::instance(); |
1932 | QString localFile = p->mLocalTempFile; | 1938 | QString localFile = p->mLocalTempFile; |
1933 | QString remoteIP = p->mRemoteIP; | 1939 | QString remoteIP = p->mRemoteIP; |
1934 | QString remoteUser = p->mRemoteUser; | 1940 | QString remoteUser = p->mRemoteUser; |
1935 | QString remoteFile = p->mRemoteFile; | 1941 | QString remoteFile = p->mRemoteFile; |
1936 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) | 1942 | if ( p->mUsePassWd && p->mRemotePassWd.length() > 0 ) |
1937 | remoteUser += ":" + p->mRemotePassWd; | 1943 | remoteUser += ":" + p->mRemotePassWd; |
1938 | 1944 | ||
1939 | QString question = i18n("Do you really want\nto remote sync?\n \n") + | 1945 | QString question = i18n("Do you really want\nto remote sync?\n \n") + |
1940 | i18n("IP: " ) +remoteIP +"\n" + | 1946 | i18n("IP: " ) +remoteIP +"\n" + |
1941 | i18n("User: " ) + remoteUser +"\n" ; | 1947 | i18n("User: " ) + remoteUser +"\n" ; |
1942 | int maxlen = 30; | 1948 | int maxlen = 30; |
1943 | if ( QApplication::desktop()->width() > 320 ) | 1949 | if ( QApplication::desktop()->width() > 320 ) |
1944 | maxlen += 25; | 1950 | maxlen += 25; |
1945 | if ( remoteFile.length() > maxlen ) | 1951 | if ( remoteFile.length() > maxlen ) |
1946 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; | 1952 | question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; |
1947 | else | 1953 | else |
1948 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; | 1954 | question += i18n("Remote file:\n " ) + remoteFile +"\n"; |
1949 | if ( localFile.length() > maxlen ) | 1955 | if ( localFile.length() > maxlen ) |
1950 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; | 1956 | question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; |
1951 | else | 1957 | else |
1952 | question += i18n("Local temp file:\n " ) + localFile +"\n"; | 1958 | question += i18n("Local temp file:\n " ) + localFile +"\n"; |
1953 | 1959 | ||
1954 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 1960 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
1955 | question, | 1961 | question, |
1956 | i18n("Yes"), i18n("No"), | 1962 | i18n("Yes"), i18n("No"), |
1957 | 0, 0 ) != 0 ) | 1963 | 0, 0 ) != 0 ) |
1958 | return; | 1964 | return; |
1959 | // if ( !p->mUsePassWd ) { | 1965 | // if ( !p->mUsePassWd ) { |
1960 | // QString pass = getPassword(); | 1966 | // QString pass = getPassword(); |
1961 | // if ( pass.length() > 0 ) | 1967 | // if ( pass.length() > 0 ) |
1962 | // remoteUser += ":" + pass; | 1968 | // remoteUser += ":" + pass; |
1963 | // } | 1969 | // } |
1964 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; | 1970 | QString command = "scp " + remoteUser + "@" + remoteIP +":" + remoteFile +" " +localFile; |
1965 | setCaption ( i18n( "Copy remote file to local machine..." ) ); | 1971 | setCaption ( i18n( "Copy remote file to local machine..." ) ); |
1966 | int fileSize = 0; | 1972 | int fileSize = 0; |
1967 | int result = system ( command ); | 1973 | int result = system ( command ); |
1968 | // 0 : okay | 1974 | // 0 : okay |
1969 | // 256: no such file or dir | 1975 | // 256: no such file or dir |
1970 | // | 1976 | // |
1971 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); | 1977 | qDebug("KO: Remote copy result(0 = okay): %d ",result ); |
1972 | if ( result != 0 ) { | 1978 | if ( result != 0 ) { |
1973 | int len = maxlen; | 1979 | int len = maxlen; |
1974 | while ( len < command.length() ) { | 1980 | while ( len < command.length() ) { |
1975 | command.insert( len , "\n" ); | 1981 | command.insert( len , "\n" ); |
1976 | len += maxlen +2; | 1982 | len += maxlen +2; |
1977 | } | 1983 | } |
1978 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 1984 | question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
1979 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 1985 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
1980 | question, | 1986 | question, |
1981 | i18n("Okay!")) ; | 1987 | i18n("Okay!")) ; |
1982 | setCaption ("KO/Pi"); | 1988 | setCaption ("KO/Pi"); |
1983 | return; | 1989 | return; |
1984 | } | 1990 | } |
1985 | 1991 | ||
1986 | 1992 | ||
1987 | setCaption ( i18n( "Copying succeed." ) ); | 1993 | setCaption ( i18n( "Copying succeed." ) ); |
1988 | //mView->setSyncDevice("ssh-scp" ); | 1994 | //mView->setSyncDevice("ssh-scp" ); |
1989 | if ( syncWithFile(localFile , true ) ) { | 1995 | if ( syncWithFile(localFile , true ) ) { |
1990 | // Event* e = mView->getLastSyncEvent(); | 1996 | // Event* e = mView->getLastSyncEvent(); |
1991 | // e->setReadOnly( false ); | 1997 | // e->setReadOnly( false ); |
1992 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 1998 | // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
1993 | // e->setReadOnly( true ); | 1999 | // e->setReadOnly( true ); |
1994 | if ( KOPrefs::instance()->mWriteBackFile ) { | 2000 | if ( KOPrefs::instance()->mWriteBackFile ) { |
1995 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; | 2001 | command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; |
1996 | setCaption ( i18n( "Writing back file ..." ) ); | 2002 | setCaption ( i18n( "Writing back file ..." ) ); |
1997 | result = system ( command ); | 2003 | result = system ( command ); |
1998 | if ( result != 0 ) { | 2004 | if ( result != 0 ) { |
1999 | int len = maxlen; | 2005 | int len = maxlen; |
2000 | while ( len < command.length() ) { | 2006 | while ( len < command.length() ) { |
2001 | command.insert( len , "\n" ); | 2007 | command.insert( len , "\n" ); |
2002 | len += maxlen +2; | 2008 | len += maxlen +2; |
2003 | } | 2009 | } |
2004 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; | 2010 | question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; |
2005 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), | 2011 | QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), |
2006 | question, | 2012 | question, |
2007 | i18n("Okay!")) ; | 2013 | i18n("Okay!")) ; |
2008 | setCaption ("KO/Pi"); | 2014 | setCaption ("KO/Pi"); |
2009 | return; | 2015 | return; |
2010 | } else { | 2016 | } else { |
2011 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); | 2017 | setCaption ( i18n( "Syncronization sucessfully completed" ) ); |
2012 | } | 2018 | } |
2013 | } | 2019 | } |
2014 | } | 2020 | } |
2015 | return; | 2021 | return; |
2016 | #if 0 | 2022 | #if 0 |
2017 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); | 2023 | system ("scp zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics /home/polo/Applications/korganizer/z_sync.ics"); |
2018 | while ( timer.elapsed() < 5000 ) | 2024 | while ( timer.elapsed() < 5000 ) |
2019 | qApp->processEvents(); | 2025 | qApp->processEvents(); |
2020 | 2026 | ||
2021 | qDebug("MainWindow::merging) "); | 2027 | qDebug("MainWindow::merging) "); |
2022 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); | 2028 | mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); |
2023 | while ( mBlockSaveFlag ) | 2029 | while ( mBlockSaveFlag ) |
2024 | qApp->processEvents(); | 2030 | qApp->processEvents(); |
2025 | save(); | 2031 | save(); |
2026 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); | 2032 | system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); |
2027 | #endif | 2033 | #endif |
2028 | 2034 | ||
2029 | } | 2035 | } |
2030 | 2036 | ||
2031 | 2037 | ||
2032 | void MainWindow::syncSharp() | 2038 | void MainWindow::syncSharp() |
2033 | { | 2039 | { |
2034 | if ( mCalendarModifiedFlag ) | 2040 | if ( mCalendarModifiedFlag ) |
2035 | save(); | 2041 | save(); |
2036 | mView->syncSharp(); | 2042 | mView->syncSharp(); |
2037 | slotModifiedChanged( true ); | 2043 | slotModifiedChanged( true ); |
2038 | 2044 | ||
2039 | } | 2045 | } |
2046 | void MainWindow::syncPhone() | ||
2047 | { | ||
2048 | if ( mCalendarModifiedFlag ) | ||
2049 | save(); | ||
2050 | mView->syncPhone(); | ||
2051 | slotModifiedChanged( true ); | ||
2052 | |||
2053 | } | ||
2040 | 2054 | ||
2041 | void MainWindow::printSel( ) | 2055 | void MainWindow::printSel( ) |
2042 | { | 2056 | { |
2043 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2057 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2044 | } | 2058 | } |
2045 | 2059 | ||
2046 | void MainWindow::printCal() | 2060 | void MainWindow::printCal() |
2047 | { | 2061 | { |
2048 | mView->print();//mCp->showDialog(); | 2062 | mView->print();//mCp->showDialog(); |
2049 | } | 2063 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index fba8c52..1d87db0 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -1,120 +1,121 @@ | |||
1 | #ifndef KORGE_MAINWINDOW_H | 1 | #ifndef KORGE_MAINWINDOW_H |
2 | #define KORGE_MAINWINDOW_H | 2 | #define KORGE_MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qtimer.h> | 5 | #include <qtimer.h> |
6 | #include <qdict.h> | 6 | #include <qdict.h> |
7 | 7 | ||
8 | #include <libkcal/incidence.h> | 8 | #include <libkcal/incidence.h> |
9 | #include "simplealarmclient.h" | 9 | #include "simplealarmclient.h" |
10 | 10 | ||
11 | class QAction; | 11 | class QAction; |
12 | class CalendarView; | 12 | class CalendarView; |
13 | class KSyncProfile; | 13 | class KSyncProfile; |
14 | #ifdef DESKTOP_VERSION | 14 | #ifdef DESKTOP_VERSION |
15 | 15 | ||
16 | #define QPEToolBar QToolBar | 16 | #define QPEToolBar QToolBar |
17 | #define QPEMenuBar QMenuBar | 17 | #define QPEMenuBar QMenuBar |
18 | #endif | 18 | #endif |
19 | class QPEToolBar; | 19 | class QPEToolBar; |
20 | 20 | ||
21 | namespace KCal { | 21 | namespace KCal { |
22 | class CalendarLocal; | 22 | class CalendarLocal; |
23 | } | 23 | } |
24 | 24 | ||
25 | using namespace KCal; | 25 | using namespace KCal; |
26 | 26 | ||
27 | class MainWindow : public QMainWindow | 27 | class MainWindow : public QMainWindow |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); | 31 | MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); |
32 | ~MainWindow(); | 32 | ~MainWindow(); |
33 | public slots: | 33 | public slots: |
34 | void configureAgenda( int ); | 34 | void configureAgenda( int ); |
35 | void recieve( const QCString& msg, const QByteArray& data ); | 35 | void recieve( const QCString& msg, const QByteArray& data ); |
36 | static QString defaultFileName(); | 36 | static QString defaultFileName(); |
37 | static QString resourcePath(); | 37 | static QString resourcePath(); |
38 | protected slots: | 38 | protected slots: |
39 | void setCaptionToDates(); | 39 | void setCaptionToDates(); |
40 | int ringSync(); | 40 | int ringSync(); |
41 | void multiSync( bool askforPrefs = false ); | 41 | void multiSync( bool askforPrefs = false ); |
42 | void about(); | 42 | void about(); |
43 | void licence(); | 43 | void licence(); |
44 | void faq(); | 44 | void faq(); |
45 | void usertrans(); | 45 | void usertrans(); |
46 | void features(); | 46 | void features(); |
47 | void synchowto(); | 47 | void synchowto(); |
48 | void whatsNew(); | 48 | void whatsNew(); |
49 | void keyBindings(); | 49 | void keyBindings(); |
50 | void aboutAutoSaving();; | 50 | void aboutAutoSaving();; |
51 | void aboutKnownBugs(); | 51 | void aboutKnownBugs(); |
52 | 52 | ||
53 | void processIncidenceSelection( Incidence * ); | 53 | void processIncidenceSelection( Incidence * ); |
54 | 54 | ||
55 | void importQtopia(); | 55 | void importQtopia(); |
56 | void importBday(); | 56 | void importBday(); |
57 | void importOL(); | 57 | void importOL(); |
58 | void importIcal(); | 58 | void importIcal(); |
59 | void importFile( QString, bool ); | 59 | void importFile( QString, bool ); |
60 | void quickImportIcal(); | 60 | void quickImportIcal(); |
61 | 61 | ||
62 | void slotModifiedChanged( bool ); | 62 | void slotModifiedChanged( bool ); |
63 | 63 | ||
64 | void save(); | 64 | void save(); |
65 | void configureToolBar( int ); | 65 | void configureToolBar( int ); |
66 | void printSel(); | 66 | void printSel(); |
67 | void printCal(); | 67 | void printCal(); |
68 | void saveCalendar(); | 68 | void saveCalendar(); |
69 | void loadCalendar(); | 69 | void loadCalendar(); |
70 | void exportVCalendar(); | 70 | void exportVCalendar(); |
71 | void fillFilterMenu(); | 71 | void fillFilterMenu(); |
72 | void selectFilter( int ); | 72 | void selectFilter( int ); |
73 | 73 | ||
74 | void slotSyncMenu( int ); | 74 | void slotSyncMenu( int ); |
75 | void syncSSH(); | 75 | void syncSSH(); |
76 | void confSync(); | 76 | void confSync(); |
77 | void syncSharp(); | 77 | void syncSharp(); |
78 | void syncPhone(); | ||
78 | void syncLocalFile(); | 79 | void syncLocalFile(); |
79 | bool syncWithFile( QString, bool ); | 80 | bool syncWithFile( QString, bool ); |
80 | void quickSyncLocalFile(); | 81 | void quickSyncLocalFile(); |
81 | 82 | ||
82 | 83 | ||
83 | protected: | 84 | protected: |
84 | void displayText( QString, QString); | 85 | void displayText( QString, QString); |
85 | void displayFile( QString, QString); | 86 | void displayFile( QString, QString); |
86 | 87 | ||
87 | void enableIncidenceActions( bool ); | 88 | void enableIncidenceActions( bool ); |
88 | 89 | ||
89 | private: | 90 | private: |
90 | void saveOnClose(); | 91 | void saveOnClose(); |
91 | int mCurrentSyncProfile; | 92 | int mCurrentSyncProfile; |
92 | void syncRemote( KSyncProfile* , bool ask = true); | 93 | void syncRemote( KSyncProfile* , bool ask = true); |
93 | void fillSyncMenu(); | 94 | void fillSyncMenu(); |
94 | bool mFlagKeyPressed; | 95 | bool mFlagKeyPressed; |
95 | bool mBlockAtStartup; | 96 | bool mBlockAtStartup; |
96 | QPEToolBar *iconToolBar; | 97 | QPEToolBar *iconToolBar; |
97 | void initActions(); | 98 | void initActions(); |
98 | void setDefaultPreferences(); | 99 | void setDefaultPreferences(); |
99 | void keyPressEvent ( QKeyEvent * ) ; | 100 | void keyPressEvent ( QKeyEvent * ) ; |
100 | void keyReleaseEvent ( QKeyEvent * ) ; | 101 | void keyReleaseEvent ( QKeyEvent * ) ; |
101 | QPopupMenu *configureToolBarMenu; | 102 | QPopupMenu *configureToolBarMenu; |
102 | QPopupMenu *selectFilterMenu; | 103 | QPopupMenu *selectFilterMenu; |
103 | QPopupMenu *configureAgendaMenu, *syncMenu; | 104 | QPopupMenu *configureAgendaMenu, *syncMenu; |
104 | CalendarLocal *mCalendar; | 105 | CalendarLocal *mCalendar; |
105 | CalendarView *mView; | 106 | CalendarView *mView; |
106 | QString getPassword(); | 107 | QString getPassword(); |
107 | QAction *mNewSubTodoAction; | 108 | QAction *mNewSubTodoAction; |
108 | 109 | ||
109 | QAction *mShowAction; | 110 | QAction *mShowAction; |
110 | QAction *mEditAction; | 111 | QAction *mEditAction; |
111 | QAction *mDeleteAction; | 112 | QAction *mDeleteAction; |
112 | void closeEvent( QCloseEvent* ce ); | 113 | void closeEvent( QCloseEvent* ce ); |
113 | SimpleAlarmClient mAlarmClient; | 114 | SimpleAlarmClient mAlarmClient; |
114 | QTimer mSaveTimer; | 115 | QTimer mSaveTimer; |
115 | bool mBlockSaveFlag; | 116 | bool mBlockSaveFlag; |
116 | bool mCalendarModifiedFlag; | 117 | bool mCalendarModifiedFlag; |
117 | QPixmap loadPixmap( QString ); | 118 | QPixmap loadPixmap( QString ); |
118 | }; | 119 | }; |
119 | 120 | ||
120 | #endif | 121 | #endif |
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index 15dc152..e7c35fb 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp | |||
@@ -1,191 +1,186 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | // $Id$ | 21 | // $Id$ |
22 | 22 | ||
23 | #include <qcolor.h> | 23 | #include <qcolor.h> |
24 | 24 | ||
25 | #include <kconfig.h> | 25 | #include <kconfig.h> |
26 | #include <kstandarddirs.h> | 26 | #include <kstandarddirs.h> |
27 | #include <kglobal.h> | 27 | #include <kglobal.h> |
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include "ksyncprofile.h" | 30 | #include "ksyncprofile.h" |
31 | 31 | ||
32 | 32 | ||
33 | KSyncProfile::KSyncProfile( const char * identifier): QObject (0, identifier ) | 33 | KSyncProfile::KSyncProfile(): QObject () |
34 | { | 34 | { |
35 | setIdentifier( identifier ); | ||
36 | |||
37 | if (getIdentifier().isEmpty()) | ||
38 | setIdentifier( "noID" ); | ||
39 | |||
40 | setDefault(); | 35 | setDefault(); |
41 | } | 36 | } |
42 | KSyncProfile::~KSyncProfile() | 37 | KSyncProfile::~KSyncProfile() |
43 | { | 38 | { |
44 | 39 | ||
45 | } | 40 | } |
46 | 41 | ||
47 | 42 | ||
48 | KSyncProfile* KSyncProfile::clone() | 43 | KSyncProfile* KSyncProfile::clone() |
49 | { | 44 | { |
50 | KSyncProfile* myClone = new KSyncProfile(); | 45 | KSyncProfile* myClone = new KSyncProfile(); |
51 | myClone->setPreSyncCommand( mPreSyncCommand ); | 46 | myClone->setPreSyncCommand( mPreSyncCommand ); |
52 | myClone->setPostSyncCommand( mPostSyncCommand ); | 47 | myClone->setPostSyncCommand( mPostSyncCommand ); |
53 | myClone->setLocalTempFile( mLocalTempFile); | 48 | myClone->setLocalTempFile( mLocalTempFile); |
54 | myClone->setRemoteFileName( mRemoteFileName ); | 49 | myClone->setRemoteFileName( mRemoteFileName ); |
55 | myClone->setPreSyncCommandAB( mPreSyncCommandAB ); | 50 | myClone->setPreSyncCommandAB( mPreSyncCommandAB ); |
56 | myClone->setPostSyncCommandAB( mPostSyncCommandAB ); | 51 | myClone->setPostSyncCommandAB( mPostSyncCommandAB ); |
57 | myClone->setLocalTempFileAB( mLocalTempFileAB); | 52 | myClone->setLocalTempFileAB( mLocalTempFileAB); |
58 | myClone->setRemoteFileNameAB( mRemoteFileNameAB ); | 53 | myClone->setRemoteFileNameAB( mRemoteFileNameAB ); |
59 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); | 54 | myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); |
60 | myClone->setAskForPreferences( mAskForPreferences); | 55 | myClone->setAskForPreferences( mAskForPreferences); |
61 | myClone->setWriteBackExisting(mWriteBackExisting ); | 56 | myClone->setWriteBackExisting(mWriteBackExisting ); |
62 | myClone->setWriteBackFile( mWriteBackFile); | 57 | myClone->setWriteBackFile( mWriteBackFile); |
63 | myClone->setWriteBackFuture( mWriteBackFuture ); | 58 | myClone->setWriteBackFuture( mWriteBackFuture ); |
64 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); | 59 | myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); |
65 | myClone->setIncludeInRingSync( mIncludeInRingSync ); | 60 | myClone->setIncludeInRingSync( mIncludeInRingSync ); |
66 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); | 61 | myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); |
67 | myClone->setSyncPrefs( mSyncPrefs); | 62 | myClone->setSyncPrefs( mSyncPrefs); |
68 | myClone->setIsLocalFileSync( mIsLocalFileSync ); | 63 | myClone->setIsLocalFileSync( mIsLocalFileSync ); |
69 | myClone->setIsPhoneSync( mIsPhoneSync ); | 64 | myClone->setIsPhoneSync( mIsPhoneSync ); |
70 | myClone->setName( "noName" ); | 65 | myClone->setName( "noName" ); |
71 | myClone->setIdentifier( "noID" ); | 66 | //myClone->setIdentifier( "noID" ); |
72 | return myClone; | 67 | return myClone; |
73 | } | 68 | } |
74 | 69 | ||
75 | 70 | ||
76 | void KSyncProfile::setDefault() | 71 | void KSyncProfile::setDefault() |
77 | { | 72 | { |
78 | mPreSyncCommand = i18n("command for downloading remote file to local device"); | 73 | mPreSyncCommand = i18n("command for downloading remote file to local device"); |
79 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); | 74 | mPostSyncCommand = i18n("command for uploading local temp file to remote device"); |
80 | mLocalTempFile = "/tmp/mycalendar.ics"; | 75 | mLocalTempFile = "/tmp/mycalendar.ics"; |
81 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; | 76 | mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; |
82 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); | 77 | mPreSyncCommandAB = i18n("command for downloading remote file to local device"); |
83 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); | 78 | mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); |
84 | mLocalTempFileAB = "/tmp/std.vcf"; | 79 | mLocalTempFileAB = "/tmp/std.vcf"; |
85 | mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; | 80 | mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; |
86 | mShowSummaryAfterSync = true; | 81 | mShowSummaryAfterSync = true; |
87 | mAskForPreferences = true; | 82 | mAskForPreferences = true; |
88 | mWriteBackExisting = false; | 83 | mWriteBackExisting = false; |
89 | mWriteBackFuture = false; | 84 | mWriteBackFuture = false; |
90 | mWriteBackFutureWeeks = 12; | 85 | mWriteBackFutureWeeks = 12; |
91 | mWriteBackFile = true; | 86 | mWriteBackFile = true; |
92 | mIncludeInRingSync = false; | 87 | mIncludeInRingSync = false; |
93 | mIncludeInRingSyncAB = false; | 88 | mIncludeInRingSyncAB = false; |
94 | mSyncPrefs = SYNC_PREF_ASK; | 89 | mSyncPrefs = SYNC_PREF_ASK; |
95 | mIsLocalFileSync = true; | 90 | mIsLocalFileSync = true; |
96 | mName = "noName"; | 91 | mName = "noName"; |
97 | mIsPhoneSync = false; | 92 | mIsPhoneSync = false; |
98 | mPhoneDevice = "/dev/ircomm"; | 93 | mPhoneDevice = "/dev/ircomm"; |
99 | mPhoneConnection = "irda"; | 94 | mPhoneConnection = "irda"; |
100 | mPhoneModel = "6310i"; | 95 | mPhoneModel = "6310i"; |
101 | } | 96 | } |
102 | void KSyncProfile::readConfig(KConfig *config ) | 97 | void KSyncProfile::readConfig(KConfig *config ) |
103 | { | 98 | { |
104 | if (config) | 99 | if (config) |
105 | { | 100 | { |
106 | 101 | ||
107 | config->setGroup("SyncProfile_" + mIdentifier); | 102 | config->setGroup( mName ); |
108 | 103 | ||
109 | mName = config->readEntry( "Name", mName ); | 104 | mName = config->readEntry( "Name", mName ); |
110 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); | 105 | mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); |
111 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); | 106 | mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); |
112 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); | 107 | mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); |
113 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); | 108 | mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); |
114 | 109 | ||
115 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); | 110 | mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
116 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | 111 | mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
117 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); | 112 | mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); |
118 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); | 113 | mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
119 | 114 | ||
120 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); | 115 | mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); |
121 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); | 116 | mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); |
122 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); | 117 | mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); |
123 | 118 | ||
124 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); | 119 | mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); |
125 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 120 | mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
126 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 121 | mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
127 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); | 122 | mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); |
128 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); | 123 | mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); |
129 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); | 124 | mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); |
130 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); | 125 | mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); |
131 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); | 126 | mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); |
132 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); | 127 | mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); |
133 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); | 128 | mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); |
134 | } | 129 | } |
135 | else | 130 | else |
136 | { | 131 | { |
137 | setDefault(); | 132 | setDefault(); |
138 | } | 133 | } |
139 | } | 134 | } |
140 | 135 | ||
141 | void KSyncProfile::deleteConfig(KConfig *config ) | 136 | void KSyncProfile::deleteConfig(KConfig *config ) |
142 | { | 137 | { |
143 | config->deleteGroup( "SyncProfile_" + mIdentifier ); | 138 | config->deleteGroup( mName ); |
144 | } | 139 | } |
145 | 140 | ||
146 | void KSyncProfile::writeConfig( KConfig * config ) | 141 | void KSyncProfile::writeConfig( KConfig * config ) |
147 | { | 142 | { |
148 | config->setGroup("SyncProfile_" + mIdentifier); | 143 | config->setGroup(mName); |
149 | 144 | ||
150 | config->writeEntry( "Name", mName ); | 145 | config->writeEntry( "Name", mName ); |
151 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); | 146 | config->writeEntry( "PreSyncCommand",mPreSyncCommand ); |
152 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); | 147 | config->writeEntry( "PostSyncCommand", mPostSyncCommand ); |
153 | config->writeEntry( "LocalTempFile", mLocalTempFile ); | 148 | config->writeEntry( "LocalTempFile", mLocalTempFile ); |
154 | config->writeEntry( "RemoteFileName", mRemoteFileName ); | 149 | config->writeEntry( "RemoteFileName", mRemoteFileName ); |
155 | 150 | ||
156 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); | 151 | config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); |
157 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); | 152 | config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); |
158 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); | 153 | config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); |
159 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); | 154 | config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); |
160 | 155 | ||
161 | config->writeEntry( "PhoneDevice", mPhoneDevice ); | 156 | config->writeEntry( "PhoneDevice", mPhoneDevice ); |
162 | config->writeEntry( "PhoneConnection", mPhoneConnection ); | 157 | config->writeEntry( "PhoneConnection", mPhoneConnection ); |
163 | config->writeEntry( "PhoneModel", mPhoneModel ); | 158 | config->writeEntry( "PhoneModel", mPhoneModel ); |
164 | 159 | ||
165 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); | 160 | config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); |
166 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); | 161 | config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); |
167 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); | 162 | config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); |
168 | config->writeEntry( "AskForPreferences",mAskForPreferences ); | 163 | config->writeEntry( "AskForPreferences",mAskForPreferences ); |
169 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); | 164 | config->writeEntry( "WriteBackExisting",mWriteBackExisting ); |
170 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); | 165 | config->writeEntry( "WriteBackFuture",mWriteBackFuture ); |
171 | config->writeEntry( "SyncPrefs", mSyncPrefs ); | 166 | config->writeEntry( "SyncPrefs", mSyncPrefs ); |
172 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); | 167 | config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); |
173 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); | 168 | config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); |
174 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); | 169 | config->writeEntry( "IsPhoneSync", mIsPhoneSync ); |
175 | } | 170 | } |
176 | 171 | ||
177 | /* | 172 | /* |
178 | class KPrefsItemInt : public KPrefsItem { | 173 | class KPrefsItemInt : public KPrefsItem { |
179 | public: | 174 | public: |
180 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); | 175 | KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); |
181 | virtual ~KPrefsItemInt() {} | 176 | virtual ~KPrefsItemInt() {} |
182 | 177 | ||
183 | void setDefault(); | 178 | void setDefault(); |
184 | void readConfig(KConfig *); | 179 | void readConfig(KConfig *); |
185 | void writeConfig(KConfig *); | 180 | void writeConfig(KConfig *); |
186 | 181 | ||
187 | private: | 182 | private: |
188 | int *mReference; | 183 | int *mReference; |
189 | int mDefault; | 184 | int mDefault; |
190 | }; | 185 | }; |
191 | */ | 186 | */ |
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h index 8995def..a0cfb71 100644 --- a/libkdepim/ksyncprofile.h +++ b/libkdepim/ksyncprofile.h | |||
@@ -1,142 +1,139 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> | 3 | Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef _KSYNCPROFILE_H | 20 | #ifndef _KSYNCPROFILE_H |
21 | #define _KSYNCPROFILE_H | 21 | #define _KSYNCPROFILE_H |
22 | 22 | ||
23 | #include <qptrlist.h> | 23 | #include <qptrlist.h> |
24 | #include <qcolor.h> | 24 | #include <qcolor.h> |
25 | #include <qfont.h> | 25 | #include <qfont.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qobject.h> | 27 | #include <qobject.h> |
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | 29 | ||
30 | #include <libkcal/syncdefines.h> | 30 | #include <libkcal/syncdefines.h> |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | class KConfig; | 34 | class KConfig; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | @short Class for storing a preferences setting | 37 | @short Class for storing a preferences setting |
38 | @author Cornelius Schumacher | 38 | @author Cornelius Schumacher |
39 | @see KPref | 39 | @see KPref |
40 | 40 | ||
41 | This class represents one preferences setting as used by @ref KPrefs. | 41 | This class represents one preferences setting as used by @ref KPrefs. |
42 | Subclasses of KPrefsItem implement storage functions for a certain type of | 42 | Subclasses of KPrefsItem implement storage functions for a certain type of |
43 | setting. Normally you don't have to use this class directly. Use the special | 43 | setting. Normally you don't have to use this class directly. Use the special |
44 | addItem() functions of KPrefs instead. If you subclass this class you will | 44 | addItem() functions of KPrefs instead. If you subclass this class you will |
45 | have to register instances with the function KPrefs::addItem(). | 45 | have to register instances with the function KPrefs::addItem(). |
46 | */ | 46 | */ |
47 | class KSyncProfile : public QObject { | 47 | class KSyncProfile : public QObject { |
48 | public: | 48 | public: |
49 | KSyncProfile( const char * identifier = 0); | 49 | KSyncProfile(); |
50 | ~KSyncProfile() ; | 50 | ~KSyncProfile() ; |
51 | 51 | ||
52 | KSyncProfile* clone(); | 52 | KSyncProfile* clone(); |
53 | void setDefault(); | 53 | void setDefault(); |
54 | void readConfig(KConfig *); | 54 | void readConfig(KConfig *); |
55 | void writeConfig(KConfig *); | 55 | void writeConfig(KConfig *); |
56 | void deleteConfig(KConfig *); | 56 | void deleteConfig(KConfig *); |
57 | 57 | ||
58 | void setIdentifier( const QString& i ) {mIdentifier = i;} | ||
59 | QString getIdentifier( ) { return mIdentifier;} | ||
60 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} | 58 | void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} |
61 | QString getPreSyncCommand( ) { return mPreSyncCommand; } | 59 | QString getPreSyncCommand( ) { return mPreSyncCommand; } |
62 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} | 60 | void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} |
63 | QString getPostSyncCommand( ) { return mPostSyncCommand;} | 61 | QString getPostSyncCommand( ) { return mPostSyncCommand;} |
64 | void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} | 62 | void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} |
65 | QString getLocalTempFile( ) { return mLocalTempFile;} | 63 | QString getLocalTempFile( ) { return mLocalTempFile;} |
66 | void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} | 64 | void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} |
67 | QString getRemoteFileName( ) { return mRemoteFileName;} | 65 | QString getRemoteFileName( ) { return mRemoteFileName;} |
68 | 66 | ||
69 | void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} | 67 | void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;} |
70 | QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } | 68 | QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; } |
71 | void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} | 69 | void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;} |
72 | QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} | 70 | QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;} |
73 | void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} | 71 | void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;} |
74 | QString getLocalTempFileAB( ) { return mLocalTempFileAB;} | 72 | QString getLocalTempFileAB( ) { return mLocalTempFileAB;} |
75 | void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} | 73 | void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;} |
76 | QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} | 74 | QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;} |
77 | 75 | ||
78 | void setPhoneDevice( const QString& n ) { mPhoneDevice = n;} | 76 | void setPhoneDevice( const QString& n ) { mPhoneDevice = n;} |
79 | QString getPhoneDevice( ) { return mPhoneDevice;} | 77 | QString getPhoneDevice( ) { return mPhoneDevice;} |
80 | void setPhoneConnection( const QString& n ) { mPhoneConnection = n;} | 78 | void setPhoneConnection( const QString& n ) { mPhoneConnection = n;} |
81 | QString getPhoneConnection( ) { return mPhoneConnection;} | 79 | QString getPhoneConnection( ) { return mPhoneConnection;} |
82 | void setPhoneModel( const QString& n ) { mPhoneModel = n;} | 80 | void setPhoneModel( const QString& n ) { mPhoneModel = n;} |
83 | QString getPhoneModel( ) { return mPhoneModel;} | 81 | QString getPhoneModel( ) { return mPhoneModel;} |
84 | /* | 82 | /* |
85 | void set( const QString& n ) { = n;} | 83 | void set( const QString& n ) { = n;} |
86 | QString get( ) { return ;} | 84 | QString get( ) { return ;} |
87 | */ | 85 | */ |
88 | 86 | ||
89 | void setName( const QString& n ) {mName = n;} | 87 | void setName( const QString& n ) {mName = n;} |
90 | QString getName( ) { return mName;} | 88 | QString getName( ) { return mName;} |
91 | void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} | 89 | void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} |
92 | bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} | 90 | bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} |
93 | void setAskForPreferences( bool b ) { mAskForPreferences= b;} | 91 | void setAskForPreferences( bool b ) { mAskForPreferences= b;} |
94 | bool getAskForPreferences( ) { return mAskForPreferences;} | 92 | bool getAskForPreferences( ) { return mAskForPreferences;} |
95 | void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} | 93 | void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} |
96 | bool getWriteBackExisting( ) { return mWriteBackExisting;} | 94 | bool getWriteBackExisting( ) { return mWriteBackExisting;} |
97 | void setWriteBackFuture( bool b ) { mWriteBackFuture = b;} | 95 | void setWriteBackFuture( bool b ) { mWriteBackFuture = b;} |
98 | bool getWriteBackFuture( ) { return mWriteBackFuture;} | 96 | bool getWriteBackFuture( ) { return mWriteBackFuture;} |
99 | void setWriteBackFile( bool b ) { mWriteBackFile= b;} | 97 | void setWriteBackFile( bool b ) { mWriteBackFile= b;} |
100 | bool getWriteBackFile( ) { return mWriteBackFile;} | 98 | bool getWriteBackFile( ) { return mWriteBackFile;} |
101 | void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} | 99 | void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} |
102 | bool getIncludeInRingSync( ) { return mIncludeInRingSync;} | 100 | bool getIncludeInRingSync( ) { return mIncludeInRingSync;} |
103 | void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} | 101 | void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} |
104 | bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} | 102 | bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} |
105 | void setSyncPrefs( int n ) { mSyncPrefs= n;} | 103 | void setSyncPrefs( int n ) { mSyncPrefs= n;} |
106 | int getSyncPrefs( ) { return mSyncPrefs;} | 104 | int getSyncPrefs( ) { return mSyncPrefs;} |
107 | void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} | 105 | void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} |
108 | int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} | 106 | int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} |
109 | void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} | 107 | void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} |
110 | bool getIsLocalFileSync( ) { return mIsLocalFileSync;} | 108 | bool getIsLocalFileSync( ) { return mIsLocalFileSync;} |
111 | void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} | 109 | void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} |
112 | bool getIsPhoneSync( ) { return mIsPhoneSync;} | 110 | bool getIsPhoneSync( ) { return mIsPhoneSync;} |
113 | private: | 111 | private: |
114 | QString mName; | 112 | QString mName; |
115 | QString mIdentifier; | ||
116 | QString mPreSyncCommand; | 113 | QString mPreSyncCommand; |
117 | QString mPostSyncCommand; | 114 | QString mPostSyncCommand; |
118 | QString mLocalTempFile; | 115 | QString mLocalTempFile; |
119 | QString mRemoteFileName; | 116 | QString mRemoteFileName; |
120 | QString mPreSyncCommandAB; | 117 | QString mPreSyncCommandAB; |
121 | QString mPostSyncCommandAB; | 118 | QString mPostSyncCommandAB; |
122 | QString mLocalTempFileAB; | 119 | QString mLocalTempFileAB; |
123 | QString mRemoteFileNameAB; | 120 | QString mRemoteFileNameAB; |
124 | 121 | ||
125 | QString mPhoneDevice; | 122 | QString mPhoneDevice; |
126 | QString mPhoneConnection; | 123 | QString mPhoneConnection; |
127 | QString mPhoneModel; | 124 | QString mPhoneModel; |
128 | 125 | ||
129 | bool mIncludeInRingSync; | 126 | bool mIncludeInRingSync; |
130 | bool mIncludeInRingSyncAB; | 127 | bool mIncludeInRingSyncAB; |
131 | int mSyncPrefs; | 128 | int mSyncPrefs; |
132 | bool mWriteBackFile; | 129 | bool mWriteBackFile; |
133 | bool mWriteBackExisting; | 130 | bool mWriteBackExisting; |
134 | bool mWriteBackFuture; | 131 | bool mWriteBackFuture; |
135 | int mWriteBackFutureWeeks; | 132 | int mWriteBackFutureWeeks; |
136 | bool mAskForPreferences; | 133 | bool mAskForPreferences; |
137 | bool mShowSummaryAfterSync; | 134 | bool mShowSummaryAfterSync; |
138 | bool mIsLocalFileSync; | 135 | bool mIsLocalFileSync; |
139 | bool mIsPhoneSync; | 136 | bool mIsPhoneSync; |
140 | }; | 137 | }; |
141 | 138 | ||
142 | #endif | 139 | #endif |