-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | kde2file/caldump/main.cpp | 97 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 7 |
3 files changed, 73 insertions, 33 deletions
@@ -1,51 +1,51 @@ | |||
1 | ############################################################################# | 1 | ############################################################################# |
2 | # Makefile for building: kdepim-desktop | 2 | # Makefile for building: kdepim-desktop |
3 | # Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Oct 16 22:32:03 2004 | 3 | # Generated by qmake (1.07a) (Qt 3.3.3) on: Sun Oct 17 11:53:22 2004 |
4 | # Project: kdepim-desktop.pro | 4 | # Project: kdepim-desktop.pro |
5 | # Template: subdirs | 5 | # Template: subdirs |
6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro | 6 | # Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro |
7 | ############################################################################# | 7 | ############################################################################# |
8 | 8 | ||
9 | MAKEFILE =Makefile | 9 | MAKEFILE =Makefile |
10 | QMAKE =qmake | 10 | QMAKE =qmake |
11 | DEL_FILE = rm -f | 11 | DEL_FILE = rm -f |
12 | CHK_DIR_EXISTS= test -d | 12 | CHK_DIR_EXISTS= test -d |
13 | MKDIR = mkdir -p | 13 | MKDIR = mkdir -p |
14 | INSTALL_FILE= | 14 | INSTALL_FILE= |
15 | INSTALL_DIR = | 15 | INSTALL_DIR = |
16 | SUBTARGETS = \ | 16 | SUBTARGETS = \ |
17 | sub-gammu-emb-common \ | 17 | sub-gammu-emb-common \ |
18 | sub-gammu-emb-gammu \ | 18 | sub-gammu-emb-gammu \ |
19 | sub-libical \ | 19 | sub-libical \ |
20 | sub-libkcal \ | 20 | sub-libkcal \ |
21 | sub-microkde \ | 21 | sub-microkde \ |
22 | sub-libkdepim \ | 22 | sub-libkdepim \ |
23 | sub-kabc \ | 23 | sub-kabc \ |
24 | sub-korganizer \ | 24 | sub-korganizer \ |
25 | sub-kaddressbook \ | 25 | sub-kaddressbook \ |
26 | sub-kabc-plugins-file \ | 26 | sub-kabc-plugins-file \ |
27 | sub-kabc-plugins-dir | 27 | sub-kabc-plugins-dir |
28 | 28 | ||
29 | first: all | 29 | first: all |
30 | 30 | ||
31 | all: Makefile $(SUBTARGETS) | 31 | all: Makefile $(SUBTARGETS) |
32 | 32 | ||
33 | gammu/emb/common/$(MAKEFILE): | 33 | gammu/emb/common/$(MAKEFILE): |
34 | @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" | 34 | @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" |
35 | cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 35 | cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
36 | sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE | 36 | sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE |
37 | cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) | 37 | cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) |
38 | 38 | ||
39 | gammu/emb/gammu/$(MAKEFILE): | 39 | gammu/emb/gammu/$(MAKEFILE): |
40 | @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu" | 40 | @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu" |
41 | cd gammu/emb/gammu && $(QMAKE) gammu.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 41 | cd gammu/emb/gammu && $(QMAKE) gammu.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
42 | sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE | 42 | sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE |
43 | cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE) | 43 | cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE) |
44 | 44 | ||
45 | libical/$(MAKEFILE): | 45 | libical/$(MAKEFILE): |
46 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" | 46 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" |
47 | cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) | 47 | cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) |
48 | sub-libical: libical/$(MAKEFILE) FORCE | 48 | sub-libical: libical/$(MAKEFILE) FORCE |
49 | cd libical && $(MAKE) -f $(MAKEFILE) | 49 | cd libical && $(MAKE) -f $(MAKEFILE) |
50 | 50 | ||
51 | libkcal/$(MAKEFILE): | 51 | libkcal/$(MAKEFILE): |
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp index 76bfad3..8d81307 100644 --- a/kde2file/caldump/main.cpp +++ b/kde2file/caldump/main.cpp | |||
@@ -9,200 +9,237 @@ | |||
9 | * (at your option) any later version. * | 9 | * (at your option) any later version. * |
10 | * * | 10 | * * |
11 | * This program is distributed in the hope that it will be useful, * | 11 | * This program is distributed in the hope that it will be useful, * |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
14 | * GNU General Public License for more details. * | 14 | * GNU General Public License for more details. * |
15 | * * | 15 | * * |
16 | * You should have received a copy of the GNU General Public License * | 16 | * You should have received a copy of the GNU General Public License * |
17 | * along with this program; if not, write to the Free Software * | 17 | * along with this program; if not, write to the Free Software * |
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * | 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 | * * | 19 | * * |
20 | * As a special exception, permission is given to link this program * | 20 | * As a special exception, permission is given to link this program * |
21 | * with any edition of Qt, and distribute the resulting executable, * | 21 | * with any edition of Qt, and distribute the resulting executable, * |
22 | * without including the source code for Qt in the source distribution. * | 22 | * without including the source code for Qt in the source distribution. * |
23 | * * | 23 | * * |
24 | ******************************************************************************/ | 24 | ******************************************************************************/ |
25 | 25 | ||
26 | #ifdef HAVE_CONFIG_H | 26 | #ifdef HAVE_CONFIG_H |
27 | #include "config.h" | 27 | #include "config.h" |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #if TIME_WITH_SYS_TIME | 30 | #if TIME_WITH_SYS_TIME |
31 | # include <sys/time.h> | 31 | # include <sys/time.h> |
32 | # include <time.h> | 32 | # include <time.h> |
33 | #else | 33 | #else |
34 | # if HAVE_SYS_TIME_H | 34 | # if HAVE_SYS_TIME_H |
35 | # include <sys/time.h> | 35 | # include <sys/time.h> |
36 | # else | 36 | # else |
37 | # include <time.h> | 37 | # include <time.h> |
38 | # endif | 38 | # endif |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include <kcmdlineargs.h> | 41 | #include <kcmdlineargs.h> |
42 | #include <kaboutdata.h> | 42 | #include <kaboutdata.h> |
43 | #include <klocale.h> | 43 | #include <klocale.h> |
44 | #include <kglobal.h> | 44 | #include <kglobal.h> |
45 | #include <kconfig.h> | 45 | #include <kconfig.h> |
46 | #include <kstandarddirs.h> | 46 | #include <kstandarddirs.h> |
47 | #include <kdebug.h> | 47 | #include <kdebug.h> |
48 | 48 | ||
49 | #include <libkcal/calformat.h> | 49 | #include <libkcal/calformat.h> |
50 | #include <libkcal/calendarresources.h> | 50 | #include <libkcal/calendarresources.h> |
51 | #include <libkcal/resourcelocal.h> | 51 | #include <libkcal/resourcelocal.h> |
52 | #include <libkcal/filestorage.h> | 52 | #include <libkcal/filestorage.h> |
53 | #include <libkcal/icalformat.h> | 53 | #include <libkcal/icalformat.h> |
54 | 54 | ||
55 | #include <qdatetime.h> | 55 | #include <qdatetime.h> |
56 | #include <qfile.h> | 56 | #include <qfile.h> |
57 | #include <qdir.h> | ||
57 | 58 | ||
58 | #include <stdlib.h> | 59 | #include <stdlib.h> |
59 | #include <iostream> | 60 | #include <iostream> |
60 | 61 | ||
61 | using namespace KCal; | 62 | using namespace KCal; |
62 | using namespace std; | 63 | using namespace std; |
63 | 64 | ||
64 | static const char progName[] = "kdecalendar"; | 65 | static const char progName[] = "kdecalendar"; |
65 | static const char progDisplay[] = "KDE_Calendar"; | 66 | static const char progDisplay[] = "KDE_Calendar"; |
66 | static const char progVersion[] = "33.1/3"; | 67 | static const char progVersion[] = "33.1/3"; |
67 | static const char progDesc[] = "A command line interface to KDE calendars"; | 68 | static const char progDesc[] = "A command line interface to KDE calendars"; |
68 | 69 | ||
69 | 70 | ||
70 | static KCmdLineOptions options[] = | 71 | static KCmdLineOptions options[] = |
71 | { | 72 | { |
72 | { "dump", | 73 | { "dump", |
73 | I18N_NOOP( "Dumps calendar" ), 0 }, | 74 | I18N_NOOP( "Dumps calendar" ), 0 }, |
74 | { "read", | 75 | { "read", |
75 | I18N_NOOP( "Reads calendar" ), 0 }, | 76 | I18N_NOOP( "Reads calendar" ), 0 }, |
76 | KCmdLineLastOption | 77 | KCmdLineLastOption |
77 | }; | 78 | }; |
78 | 79 | ||
79 | int main( int argc, char *argv[] ) | 80 | int main( int argc, char *argv[] ) |
80 | { | 81 | { |
81 | KAboutData aboutData( | 82 | KAboutData aboutData( |
82 | progName, // internal program name | 83 | progName, // internal program name |
83 | I18N_NOOP( progDisplay ), // displayable program name. | 84 | I18N_NOOP( progDisplay ), // displayable program name. |
84 | progVersion, // version string | 85 | progVersion, // version string |
85 | I18N_NOOP( progDesc ), // short porgram description | 86 | I18N_NOOP( progDesc ), // short porgram description |
86 | KAboutData::License_GPL, // license type | 87 | KAboutData::License_GPL, // license type |
87 | "(c) 2004, Lutz Rogowski", // copyright statement | 88 | "(c) 2004, Lutz Rogowski", // copyright statement |
88 | 0, // any free form text | 89 | 0, // any free form text |
89 | "", // program home page address | 90 | "", // program home page address |
90 | "bugs.kde.org" // bug report email address | 91 | "bugs.kde.org" // bug report email address |
91 | ); | 92 | ); |
92 | 93 | ||
93 | 94 | ||
94 | // KCmdLineArgs::init() final 'true' argument indicates no commandline options | 95 | // KCmdLineArgs::init() final 'true' argument indicates no commandline options |
95 | // for QApplication/KApplication (no KDE or Qt options) | 96 | // for QApplication/KApplication (no KDE or Qt options) |
96 | KCmdLineArgs::init( argc, argv, &aboutData, true ); | 97 | KCmdLineArgs::init( argc, argv, &aboutData, true ); |
97 | KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. | 98 | KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. |
98 | 99 | ||
99 | KInstance ins ( progName ); | 100 | KInstance ins ( progName ); |
100 | 101 | ||
101 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 102 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
102 | 103 | ||
103 | bool read = false; | 104 | bool read = false; |
104 | if ( args->isSet( "read" ) ) { | 105 | if ( args->isSet( "read" ) ) { |
105 | read = true; | 106 | read = true; |
106 | qDebug("read "); | 107 | qDebug("read "); |
107 | } | 108 | } |
109 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | ||
108 | CalendarResources *calendarResource = 0; | 110 | CalendarResources *calendarResource = 0; |
109 | CalendarLocal *localCalendar = 0; | 111 | CalendarLocal *localCalendar = 0; |
110 | 112 | KConfig c( locate( "config", "korganizerrc" ) ); | |
111 | calendarResource = new CalendarResources( "" ); | 113 | c.setGroup( "Time & Date" ); |
114 | QString tz = c.readEntry( "TimeZoneId" ); | ||
115 | calendarResource = new CalendarResources( tz ); | ||
112 | calendarResource->readConfig(); | 116 | calendarResource->readConfig(); |
113 | calendarResource->load(); | 117 | calendarResource->load(); |
114 | qDebug("************************************* "); | 118 | qDebug("************************************* "); |
115 | qDebug("************************************* "); | 119 | qDebug("**************kdecaldump************* "); |
116 | qDebug("************************************* "); | 120 | qDebug("************************************* "); |
117 | qDebug("Using timezone id: %s", calendarResource->timeZoneId().latin1()); | 121 | qDebug("Using timezone id: %s", calendarResource->timeZoneId().latin1()); |
118 | 122 | ||
119 | if ( !read ) { | 123 | if ( !read ) { |
120 | localCalendar = new CalendarLocal(); | 124 | localCalendar = new CalendarLocal(); |
121 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); | 125 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); |
122 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); | 126 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); |
123 | Incidence::List::ConstIterator it; | 127 | Incidence::List::ConstIterator it; |
124 | int num = 0; | 128 | int num = 0; |
125 | for( it = allInc.begin(); it != allInc.end(); ++it ) { | 129 | for( it = allInc.begin(); it != allInc.end(); ++it ) { |
126 | ResourceCalendar * re = calendarResource->resource( (*it) ); | 130 | ResourceCalendar * re = calendarResource->resource( (*it) ); |
127 | if ( re && !re->readOnly() ) { | 131 | if ( re && !re->readOnly() ) { |
128 | ++num; | 132 | ++num; |
129 | Incidence* cl = (*it)->clone(); | 133 | Incidence* cl = (*it)->clone(); |
130 | cl->setLastModified( (*it)->lastModified() ); | 134 | cl->setLastModified( (*it)->lastModified() ); |
131 | if ( cl->type() == "Journal" ) | 135 | if ( cl->type() == "Journal" ) |
132 | localCalendar->addJournal( (Journal *) cl ); | 136 | localCalendar->addJournal( (Journal *) cl ); |
133 | else if ( cl->type() == "Todo" ) | 137 | else if ( cl->type() == "Todo" ) |
134 | localCalendar->addTodo( (Todo *) cl ); | 138 | localCalendar->addTodo( (Todo *) cl ); |
135 | else if ( cl->type() == "Event" ) | 139 | else if ( cl->type() == "Event" ) |
136 | localCalendar->addEvent( (Event *) cl ); | 140 | localCalendar->addEvent( (Event *) cl ); |
137 | } | 141 | } |
138 | } | 142 | } |
139 | 143 | ||
140 | FileStorage* storage = new FileStorage( calendarResource ); | 144 | FileStorage* storage = new FileStorage( calendarResource ); |
141 | storage->setFileName( "/tmp/kdedumpall.ics" ); | 145 | storage->setFileName( fileName ); |
142 | storage->setSaveFormat( new ICalFormat() ); | 146 | storage->setSaveFormat( new ICalFormat() ); |
143 | storage->save(); | 147 | storage->save(); |
144 | delete storage; | 148 | delete storage; |
145 | qDebug("************************************* "); | 149 | qDebug("************************************* "); |
150 | qDebug("************kdecaldump*************** "); | ||
146 | qDebug("************************************* "); | 151 | qDebug("************************************* "); |
147 | qDebug("************************************* "); | 152 | qDebug("%d calendar entries dumped to file %s", num, fileName.latin1()); |
148 | qDebug("%d calendar entries dumped to file /tmp/kdedumpall.ics", num); | ||
149 | 153 | ||
150 | } else { | 154 | } else { |
151 | localCalendar = new CalendarLocal(); | 155 | localCalendar = new CalendarLocal(); |
152 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); | 156 | localCalendar->setTimeZoneId( calendarResource->timeZoneId()); |
153 | FileStorage* storage = new FileStorage( localCalendar ); | 157 | FileStorage* storage = new FileStorage( localCalendar ); |
154 | storage->setFileName( "/tmp/kdedumpall.ics" ); | 158 | storage->setFileName( fileName ); |
155 | int num = 0; | 159 | int num = 0; |
156 | int del = 0; | 160 | int del = 0; |
161 | int add = 0; | ||
157 | if ( storage->load() ) { | 162 | if ( storage->load() ) { |
158 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); | ||
159 | KCal::Incidence::List newInc = localCalendar->rawIncidences(); | 163 | KCal::Incidence::List newInc = localCalendar->rawIncidences(); |
160 | Incidence::List::ConstIterator it; | 164 | Incidence::List::ConstIterator it; |
161 | for( it = allInc.begin(); it != allInc.end(); ++it ) { | 165 | for( it = newInc.begin(); it != newInc.end(); ++it ) { |
162 | ResourceCalendar * re = calendarResource->resource( (*it) ); | 166 | Incidence* cl = (*it)->clone(); |
163 | if ( re && !re->readOnly() ) { | 167 | Incidence *incOld = calendarResource->incidence( cl->uid() ); |
164 | Incidence* cl = localCalendar->incidence( (*it)->uid() ); | 168 | ResourceCalendar * res = 0; |
165 | if ( cl ) { | 169 | if ( incOld ) |
166 | QDateTime lm = cl->lastModified(); | 170 | res = calendarResource->resource( incOld ); |
167 | cl->setResources( (*it)->resources() ); | 171 | if ( res ) { |
168 | cl->setLastModified(lm); | 172 | ++num; |
169 | } | 173 | if ( incOld->type() == "Journal" ) |
170 | ++del; | 174 | calendarResource->deleteJournal( (Journal *) incOld ); |
171 | cl = (*it); | 175 | else if ( incOld->type() == "Todo" ) |
176 | calendarResource->deleteTodo( (Todo *) incOld ); | ||
177 | else if ( incOld->type() == "Event" ) | ||
178 | calendarResource->deleteEvent( (Event *) incOld ); | ||
179 | |||
172 | if ( cl->type() == "Journal" ) | 180 | if ( cl->type() == "Journal" ) |
173 | calendarResource->deleteJournal( (Journal *) cl ); | 181 | calendarResource->addJournal( (Journal *) cl, res ); |
174 | else if ( cl->type() == "Todo" ) | 182 | else if ( cl->type() == "Todo" ) |
175 | calendarResource->deleteTodo( (Todo *) cl ); | 183 | calendarResource->addTodo( (Todo *) cl, res ); |
176 | else if ( cl->type() == "Event" ) | 184 | else if ( cl->type() == "Event" ) |
177 | calendarResource->deleteEvent( (Event *) cl ); | 185 | calendarResource->addEvent( (Event *) cl, res ); |
186 | |||
187 | } else { | ||
188 | if ( incOld ) { | ||
189 | qDebug("ERROR: no resource found for old incidence "); | ||
190 | if ( incOld->type() == "Journal" ) | ||
191 | calendarResource->deleteJournal( (Journal *) incOld ); | ||
192 | else if ( incOld->type() == "Todo" ) | ||
193 | calendarResource->deleteTodo( (Todo *) incOld ); | ||
194 | else if ( incOld->type() == "Event" ) | ||
195 | calendarResource->deleteEvent( (Event *) incOld ); | ||
196 | |||
197 | } | ||
198 | calendarResource->addIncidence( cl ); | ||
199 | ++add; | ||
200 | } | ||
201 | KCal::Incidence::List allInc = calendarResource->rawIncidences(); | ||
202 | |||
203 | for( it = allInc.begin(); it != allInc.end(); ++it ) { | ||
204 | ResourceCalendar * re = calendarResource->resource( (*it) ); | ||
205 | if ( re && !re->readOnly() ) { | ||
206 | Incidence* cl = localCalendar->incidence( (*it)->uid() ); | ||
207 | if ( !cl ) { | ||
208 | ++del; | ||
209 | cl = (*it); | ||
210 | if ( cl->type() == "Journal" ) | ||
211 | calendarResource->deleteJournal( (Journal *) cl ); | ||
212 | else if ( cl->type() == "Todo" ) | ||
213 | calendarResource->deleteTodo( (Todo *) cl ); | ||
214 | else if ( cl->type() == "Event" ) | ||
215 | calendarResource->deleteEvent( (Event *) cl ); | ||
216 | //QDateTime lm = cl->lastModified(); | ||
217 | //cl->setResources( (*it)->resources() ); | ||
218 | //cl->setLastModified(lm); | ||
219 | } | ||
220 | } | ||
178 | } | 221 | } |
179 | } | ||
180 | for( it = newInc.begin(); it != newInc.end(); ++it ) { | ||
181 | Incidence* cl = (*it)->clone(); | ||
182 | ++num; | ||
183 | calendarResource->addIncidence( cl ); | ||
184 | //cl->setLastModified( (*it)->lastModified() ); | ||
185 | } | 222 | } |
186 | calendarResource->save(); | 223 | calendarResource->save(); |
187 | qDebug("************************************* "); | 224 | qDebug("************************************* "); |
225 | qDebug("************kdecaldump*************** "); | ||
188 | qDebug("************************************* "); | 226 | qDebug("************************************* "); |
189 | qDebug("************************************* "); | 227 | qDebug("Calendar entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", num,del, add, fileName.latin1()); |
190 | qDebug("%d calendar entries deleted/ %d added from file /tmp/kdedumpall.ics", del, num); | ||
191 | 228 | ||
192 | } else | 229 | } else |
193 | qDebug("error loading file /tmp/kdedumpall.ics"); | 230 | qDebug("error loading file /tmp/kdedumpall.ics"); |
194 | 231 | ||
195 | } | 232 | } |
196 | 233 | ||
197 | if ( localCalendar ) { | 234 | if ( localCalendar ) { |
198 | localCalendar->close(); | 235 | localCalendar->close(); |
199 | delete localCalendar; | 236 | delete localCalendar; |
200 | } | 237 | } |
201 | if ( calendarResource ) { | 238 | if ( calendarResource ) { |
202 | calendarResource->close(); | 239 | calendarResource->close(); |
203 | delete calendarResource; | 240 | delete calendarResource; |
204 | } | 241 | } |
205 | 242 | ||
206 | qDebug("ente "); | 243 | qDebug("ente "); |
207 | return 0; | 244 | return 0; |
208 | } | 245 | } |
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index c6e06f8..8851097 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -736,99 +736,102 @@ QString KSyncManager::getPassword( ) | |||
736 | lab.setEchoMode( QLineEdit::Password ); | 736 | lab.setEchoMode( QLineEdit::Password ); |
737 | QVBoxLayout lay( &dia ); | 737 | QVBoxLayout lay( &dia ); |
738 | lay.setMargin(7); | 738 | lay.setMargin(7); |
739 | lay.setSpacing(7); | 739 | lay.setSpacing(7); |
740 | lay.addWidget( &lab); | 740 | lay.addWidget( &lab); |
741 | dia.setFixedSize( 230,50 ); | 741 | dia.setFixedSize( 230,50 ); |
742 | dia.setCaption( i18n("Enter password") ); | 742 | dia.setCaption( i18n("Enter password") ); |
743 | QPushButton pb ( "OK", &dia); | 743 | QPushButton pb ( "OK", &dia); |
744 | lay.addWidget( &pb ); | 744 | lay.addWidget( &pb ); |
745 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 745 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
746 | dia.show(); | 746 | dia.show(); |
747 | int res = dia.exec(); | 747 | int res = dia.exec(); |
748 | if ( res ) | 748 | if ( res ) |
749 | retfile = lab.text(); | 749 | retfile = lab.text(); |
750 | dia.hide(); | 750 | dia.hide(); |
751 | qApp->processEvents(); | 751 | qApp->processEvents(); |
752 | return retfile; | 752 | return retfile; |
753 | 753 | ||
754 | } | 754 | } |
755 | 755 | ||
756 | 756 | ||
757 | void KSyncManager::confSync() | 757 | void KSyncManager::confSync() |
758 | { | 758 | { |
759 | static KSyncPrefsDialog* sp = 0; | 759 | static KSyncPrefsDialog* sp = 0; |
760 | if ( ! sp ) { | 760 | if ( ! sp ) { |
761 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); | 761 | sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); |
762 | } | 762 | } |
763 | sp->usrReadConfig(); | 763 | sp->usrReadConfig(); |
764 | #ifndef DESKTOP_VERSION | 764 | #ifndef DESKTOP_VERSION |
765 | sp->showMaximized(); | 765 | sp->showMaximized(); |
766 | #else | 766 | #else |
767 | sp->show(); | 767 | sp->show(); |
768 | #endif | 768 | #endif |
769 | sp->exec(); | 769 | sp->exec(); |
770 | mSyncProfileNames = sp->getSyncProfileNames(); | 770 | mSyncProfileNames = sp->getSyncProfileNames(); |
771 | mLocalMachineName = sp->getLocalMachineName (); | 771 | mLocalMachineName = sp->getLocalMachineName (); |
772 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); | 772 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
773 | } | 773 | } |
774 | void KSyncManager::syncKDE() | 774 | void KSyncManager::syncKDE() |
775 | { | 775 | { |
776 | emit save(); | 776 | emit save(); |
777 | switch(mTargetApp) | 777 | switch(mTargetApp) |
778 | { | 778 | { |
779 | case (KAPI): | 779 | case (KAPI): |
780 | 780 | ||
781 | break; | 781 | break; |
782 | case (KOPI): | 782 | case (KOPI): |
783 | { | 783 | { |
784 | QString command ="./kdecaldump"; | 784 | QString command = qApp->applicationDirPath () + "/kdecaldump"; |
785 | if ( ! QFile::exists ( command ) ) | ||
786 | command = "kdecaldump"; | ||
787 | QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics"; | ||
785 | system ( command.latin1()); | 788 | system ( command.latin1()); |
786 | if ( syncWithFile( "/tmp/kdedumpall.ics",true ) ) { | 789 | if ( syncWithFile( fileName,true ) ) { |
787 | if ( mWriteBackFile ) { | 790 | if ( mWriteBackFile ) { |
788 | command += " --read"; | 791 | command += " --read"; |
789 | system ( command.latin1()); | 792 | system ( command.latin1()); |
790 | } | 793 | } |
791 | } | 794 | } |
792 | 795 | ||
793 | } | 796 | } |
794 | break; | 797 | break; |
795 | case (PWMPI): | 798 | case (PWMPI): |
796 | 799 | ||
797 | break; | 800 | break; |
798 | default: | 801 | default: |
799 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 802 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
800 | break; | 803 | break; |
801 | 804 | ||
802 | } | 805 | } |
803 | } | 806 | } |
804 | 807 | ||
805 | void KSyncManager::syncSharp() | 808 | void KSyncManager::syncSharp() |
806 | { | 809 | { |
807 | 810 | ||
808 | if ( ! syncExternalApplication("sharp") ) | 811 | if ( ! syncExternalApplication("sharp") ) |
809 | qDebug("ERROR sync sharp "); | 812 | qDebug("ERROR sync sharp "); |
810 | } | 813 | } |
811 | 814 | ||
812 | bool KSyncManager::syncExternalApplication(QString resource) | 815 | bool KSyncManager::syncExternalApplication(QString resource) |
813 | { | 816 | { |
814 | 817 | ||
815 | emit save(); | 818 | emit save(); |
816 | 819 | ||
817 | if ( mAskForPreferences ) | 820 | if ( mAskForPreferences ) |
818 | edit_sync_options(); | 821 | edit_sync_options(); |
819 | 822 | ||
820 | qDebug("Sync extern %s", resource.latin1()); | 823 | qDebug("Sync extern %s", resource.latin1()); |
821 | 824 | ||
822 | bool syncOK = mImplementation->syncExternal(this, resource); | 825 | bool syncOK = mImplementation->syncExternal(this, resource); |
823 | 826 | ||
824 | return syncOK; | 827 | return syncOK; |
825 | 828 | ||
826 | } | 829 | } |
827 | 830 | ||
828 | void KSyncManager::syncPhone() | 831 | void KSyncManager::syncPhone() |
829 | { | 832 | { |
830 | 833 | ||
831 | syncExternalApplication("phone"); | 834 | syncExternalApplication("phone"); |
832 | 835 | ||
833 | } | 836 | } |
834 | 837 | ||