HEAD: rearrange things a bit so we can have a libwvbase.so, which contains
[wvapps.git] / evolution / exchangeitadaptor.cc
blob5c94938e75381ac3bc720d2327e66b3e34cafe4a
1 #include <glib.h>
2 #include "exchangeitadaptor.h"
4 #define EXCHANGEIT_GCONF_DIR "/apps/evolution-exchangeit"
6 ExchangeItAdaptor::ExchangeItAdaptor(WvStringParm _key, WvStringParm _path,
7 const bool _local, const UniConf &parent) :
8 key(_key),
9 state(parent[key]),
10 storage_path(_path),
11 version(0),
12 ready(false),
13 local(_local),
14 may_have_local_only_items(true),
15 log("ExchangeItAdaptor", WvLog::Debug1)
17 version = state["version"].getmeint();
18 log("ExchangeItAdaptor created with key: %s\n and version: %s", key.cstr(), version);
21 void ExchangeItAdaptor::set_version(const uint32_t _version)
23 version = _version;
24 state["version"].setmeint(version);
27 void ExchangeItAdaptor::set_key(WvStringParm _key)
29 key = _key;
30 state = state.parent()[key];
33 const bool ExchangeItAdaptor::sync_local_items()
35 _sync_local_items();
36 may_have_local_only_items = false;
37 return true;
40 WvStringList * ExchangeItAdaptor::get_item_uids(WvStringParm type)
42 if (type == "all")
43 return get_all_uids();
45 WvStringList * item_uids = new WvStringList();
46 UniConf key = state[type];
48 UniConf::Iter i(key);
49 for(i.rewind();i.next();)
51 item_uids->append(i().key().printable());
54 return item_uids;
57 void ExchangeItAdaptor::remove_uid_from_list(WvStringParm uid, WvStringParm list_type)
59 state[list_type][uid].remove();