Ticket #208: exp.patch
| File exp.patch, 9.4 kB (added by pmarat, 2 years ago) |
|---|
-
configure.in
old new 39 39 AC_SUBST(OPENSYNC_HEADERDIR) 40 40 AC_SUBST(OPENSYNC_INCLUDEDIR) 41 41 AC_SUBST(OPENSYNC_LIBDIR) 42 AC_SUBST(XML_CFLAGS) 43 AC_SUBST(XML_LIBS) 42 44 43 45 ## AC_CHECK_HEADER(${$ac_kde_includes}/libkcal/resourcecalendar.h) 44 46 -
src/kdepim-sync
old new -
src/kdepim_sync.cpp
old new 183 183 /*FIXME: i18n */ 184 184 info->longname = "KDE Desktop"; 185 185 info->description = "Plugin for the KDE 3.5 Desktop"; 186 info->config_type = NO_CONFIGURATION;187 186 188 187 info->functions.initialize = kde_initialize; 189 188 info->functions.connect = kde_connect; -
src/kdepim_impl.cpp
old new 33 33 #include <kapplication.h> 34 34 #include <kcmdlineargs.h> 35 35 #include <kaboutdata.h> 36 #include <libxml/xmlmemory.h> 37 #include <libxml/parser.h> 36 38 37 39 #include <qsignal.h> 38 40 … … 54 56 mApplication( 0 ), 55 57 mNewApplication( false ) 56 58 { 59 isKcal=false; isKaddrbook=false; isKnotes=false; isTodo=false; 60 mKcal = 0; mKnotes = 0; mKaddrbook=0; 57 61 } 58 62 59 63 void initKDE() … … 91 95 initKDE(); 92 96 93 97 mHashtable = osync_hashtable_new(); 98 char *configData = NULL; 99 int configSize = 0; 94 100 95 mKcal = new KCalDataSource(mMember, mHashtable); 96 mKnotes = new KNotesDataSource(mMember, mHashtable); 97 mKaddrbook = new KContactDataSource(mMember, mHashtable); 101 //now get the config file for this plugin 102 if (!osync_member_get_config(mMember, &configData, &configSize, error)) { 103 osync_error_update(error, "Unable to get config data: %s", osync_error_print(error)); 104 isKcal=true; isKaddrbook=true; isKnotes=true; 105 } 106 xmlDocPtr doc = xmlParseMemory(configData, configSize); 107 xmlNodePtr cur; 108 if (doc) { 109 if ( (cur=xmlDocGetRootElement(doc)) && 110 (!xmlStrcmp(cur->name, (xmlChar*)"config")) ) { 111 cur = cur->xmlChildrenNode; 112 while (cur != NULL) { 113 xmlChar *str = xmlNodeGetContent(cur); 114 if (str) { 115 if (!xmlStrcmp(cur->name, (const xmlChar *)"contacts")) { 116 isKaddrbook = ( !xmlStrcmp(str, (const xmlChar *)"true") ? 117 (true): (false) ); 118 } 119 if (!xmlStrcmp(cur->name, (const xmlChar *)"calendar")) { 120 isKcal = ( !xmlStrcmp(str, (const xmlChar *)"true") ? 121 (true): (false) ); 122 } 123 if (!xmlStrcmp(cur->name, (const xmlChar *)"notes")) { 124 isKnotes = ( !xmlStrcmp(str, (const xmlChar *)"true") ? 125 (true): (false) ); 126 } 127 if (!xmlStrcmp(cur->name, (const xmlChar *)"todo")) { 128 isTodo = ( !xmlStrcmp(str, (const xmlChar *)"true") ? 129 (true): (false) ); 130 } 131 xmlFree(str); 132 } 133 cur = cur->next; 134 } 135 } 136 xmlFreeDoc(doc); 137 } 98 138 139 if (isKcal) { 140 mKcal = new KCalDataSource(mMember, mHashtable); 141 } 142 if (isKnotes) { 143 mKnotes = new KNotesDataSource(mMember, mHashtable); 144 } 145 if (isKaddrbook) { 146 mKaddrbook = new KContactDataSource(mMember, mHashtable); 147 } 148 99 149 osync_trace(TRACE_EXIT, "%s", __func__); 100 150 return true; 101 151 } 102 152 103 153 virtual ~KdePluginImplementation() 104 154 { 105 delete mKcal; 106 mKcal = 0; 107 108 delete mKnotes; 109 mKnotes = 0; 110 155 if (isKcal) { 156 delete mKcal; 157 mKcal = 0; 158 } 159 if (isKnotes) { 160 delete mKnotes; 161 mKnotes = 0; 162 } 163 if (isKaddrbook) { 164 delete mKaddrbook; 165 mKaddrbook=0; 166 } 111 167 if ( mNewApplication ) { 112 168 delete mApplication; 113 169 mApplication = 0; … … 130 186 } 131 187 132 188 133 if ( mKcal && (osync_member_objtype_enabled(mMember, "todo") ||189 if (isKcal && ( ((isTodo) && osync_member_objtype_enabled(mMember, "todo")) || 134 190 osync_member_objtype_enabled(mMember, "event")) && !mKcal->connect(ctx)) { 135 191 osync_trace(TRACE_EXIT_ERROR, "%s: Unable to open calendar", __func__); 136 192 return; 137 193 } 138 194 139 if ( mKnotes && osync_member_objtype_enabled(mMember, "note") && \195 if (isKnotes && osync_member_objtype_enabled(mMember, "note") && \ 140 196 !mKnotes->connect(ctx)) { 141 197 osync_trace(TRACE_EXIT_ERROR, "%s: Unable to open notes", __func__); 142 198 return; 143 199 } 144 200 145 if ( mKaddrbook && osync_member_objtype_enabled(mMember, "contact") && \201 if (isKaddrbook && osync_member_objtype_enabled(mMember, "contact") && \ 146 202 !mKaddrbook->connect(ctx)) { 147 203 osync_trace(TRACE_EXIT_ERROR, "%s: Unable to open addressbook", __func__); 148 204 return; … … 156 212 { 157 213 osync_hashtable_close(mHashtable); 158 214 159 if ( mKcal && mKcal->connected && !mKcal->disconnect(ctx))215 if (isKcal && mKcal->connected && !mKcal->disconnect(ctx)) 160 216 return; 161 if ( mKnotes && mKnotes->connected && !mKnotes->disconnect(ctx))217 if (isKnotes && mKnotes->connected && !mKnotes->disconnect(ctx)) 162 218 return; 163 if ( mKaddrbook && mKaddrbook->connected && !mKaddrbook->disconnect(ctx))219 if (isKaddrbook && mKaddrbook->connected && !mKaddrbook->disconnect(ctx)) 164 220 return; 165 221 166 222 osync_context_report_success(ctx); … … 168 224 169 225 virtual void get_changeinfo(OSyncContext *ctx) 170 226 { 171 if ( mKaddrbook && mKaddrbook->connected && !mKaddrbook->contact_get_changeinfo(ctx))227 if (isKaddrbook && mKaddrbook->connected && !mKaddrbook->contact_get_changeinfo(ctx)) 172 228 return; 173 229 174 if ( mKcal && mKcal->connected && !mKcal->get_changeinfo_events(ctx))230 if (isKcal && mKcal->connected && !mKcal->get_changeinfo_events(ctx)) 175 231 return; 176 232 177 if ( mKcal&& mKcal->connected && !mKcal->get_changeinfo_todos(ctx))233 if (isKcal && isTodo && mKcal->connected && !mKcal->get_changeinfo_todos(ctx)) 178 234 return; 179 235 180 if ( mKnotes && mKnotes->connected && !mKnotes->get_changeinfo(ctx))236 if (isKnotes && mKnotes->connected && !mKnotes->get_changeinfo(ctx)) 181 237 return; 182 238 183 239 osync_context_report_success(ctx); … … 185 241 186 242 virtual bool vcard_access(OSyncContext *ctx, OSyncChange *chg) 187 243 { 188 if ( mKaddrbook)244 if (isKaddrbook && mKaddrbook) 189 245 return mKaddrbook->vcard_access(ctx, chg); 190 246 else { 191 247 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No addressbook loaded"); … … 196 252 197 253 virtual bool vcard_commit_change(OSyncContext *ctx, OSyncChange *chg) 198 254 { 199 if ( mKaddrbook)255 if (isKaddrbook && mKaddrbook) 200 256 return mKaddrbook->vcard_commit_change(ctx, chg); 201 257 else { 202 258 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No addressbook loaded"); … … 207 263 208 264 virtual bool event_access(OSyncContext *ctx, OSyncChange *chg) 209 265 { 210 if ( mKcal)266 if (isKcal && mKcal) 211 267 return mKcal->event_access(ctx, chg); 212 268 else { 213 269 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No calendar loaded"); … … 218 274 219 275 virtual bool event_commit_change(OSyncContext *ctx, OSyncChange *chg) 220 276 { 221 if ( mKcal)277 if (isKcal && mKcal) 222 278 return mKcal->event_commit_change(ctx, chg); 223 279 else { 224 280 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No calendar loaded"); … … 229 285 230 286 virtual bool todo_access(OSyncContext *ctx, OSyncChange *chg) 231 287 { 232 if ( mKcal)288 if (isKcal && isTodo && mKcal) 233 289 return mKcal->todo_access(ctx, chg); 234 290 else { 235 291 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No calendar loaded"); … … 240 296 241 297 virtual bool todo_commit_change(OSyncContext *ctx, OSyncChange *chg) 242 298 { 243 if ( mKcal)299 if (isKcal && isTodo && mKcal) 244 300 return mKcal->todo_commit_change(ctx, chg); 245 301 else { 246 302 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No calendar loaded"); … … 251 307 252 308 virtual bool note_access(OSyncContext *ctx, OSyncChange *chg) 253 309 { 254 if ( mKnotes)310 if (isKnotes && mKnotes) 255 311 return mKnotes->access(ctx, chg); 256 312 else { 257 313 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No notes loaded"); … … 262 318 263 319 virtual bool note_commit_change(OSyncContext *ctx, OSyncChange *chg) 264 320 { 265 if ( mKnotes)321 if (isKnotes && mKnotes) 266 322 return mKnotes->commit_change(ctx, chg); 267 323 else { 268 324 osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "No notes loaded"); … … 281 337 282 338 KApplication *mApplication; 283 339 bool mNewApplication; 340 bool isKcal; 341 bool isKnotes; 342 bool isKaddrbook; 343 bool isTodo; 284 344 }; 285 345 286 346
