Commit graph

2145 commits

Author SHA1 Message Date
Patrick Ohly
79deb4025a dumpData config option: make database backups optional
Database backups used to be created unconditionally, even if not
needed for comparison. Now the new "dumpData" variable is
checked. If change printing is enabled, dumping data is implied.
2010-12-01 12:32:46 +01:00
Patrick Ohly
6b4028275e LocalTransportAgent: fixed parent/child communication
There were some issues:
- not calling waitpid() caused zombies if the parent
  was a long-running process
- not closing the socket on the parent side caused
  the child to get stuck in error cases
- exit() has undesired side effects on the parent,
  use _exit() to just terminate the child without
  additional cleanup (more like fork/exec that way)

This patch also adds some debug output for tracking down
such issues.
2010-12-01 12:32:46 +01:00
Patrick Ohly
78276d4fed local sync: make more sync settings available to client
Temporarily setting --sync-property values only affects the server
side of local sync. This patch extends a hack which copies some
relevant values over into the client:
- do it sooner
- copy additional properties

A better way to set these properties on both sides of local sync is
needed.
2010-12-01 12:32:46 +01:00
Patrick Ohly
1f192f6d76 local sync + BT: changed how credential checking is turned off
Resetting username/password temporarily was a hack which
had undesired side effects for local sync (credentials
were not available for other side of sync).

Changed this so that disabling of credential checking is done
at the point where it is needed: when creating Synthesis XML
config. Username/password settings are left untouched.
2010-12-01 12:32:46 +01:00
Patrick Ohly
b9118498e5 SYNCEVOLUTION_DEBUG: print DEBUG messages during sync if set
The code setting up a sync session disabled printing of DEBUG
messages to the console, even if it was enabled earlier because
of SYNCEVOLUTION_DEBUG.

Now check for SYNCEVOLUTION_DEBUG before making that change.
Not sure whether it is the right solution (perhaps just keep
the old level?), but it is known to have the desired effect.
2010-12-01 12:32:46 +01:00
Patrick Ohly
ffa3f58475 Cmdline: keep report about executed sync
If the operation is to run a sync, then having the report available
afterwards is useful in code which uses Cmdline as a convenience
class.
2010-12-01 12:32:46 +01:00
Patrick Ohly
16cde385d6 Cmdline: added varargs constructor
Passing a NULL terminated list of parameters is sometimes a convenient
way of executing certain complex operations. Cmdline testing already did
it, now this is also in the Cmdline class itself.
2010-12-01 12:32:46 +01:00
Patrick Ohly
a7e24bb667 libical: allow using it without libecal
This patch distinguished between having libecal and having
libical. Previously libical could not be used without libecal.

Whoever detects libecal also must mark libical as available (which is
implied, because libecal uses libical).
2010-12-01 12:32:45 +01:00
Patrick Ohly
5e690aae9c Exception::handle(): added optional retval for exception text
The exception text will be returned to the caller via an optional
std::string pointer. Useful if the caller needs to report the problem
including a text explanation. Also simplifies the exception handling
itself a bit.
2010-12-01 12:32:45 +01:00
Patrick Ohly
e9e3c31ba5 local sync: avoid confusion about what data is changed
In local sync the terms "local" and "remote" (in SyncReport, "Data
modified locally") do not always apply and can be confusing. Replaced
with explicitly mentioning the context.

The source name also no longer is unique. Extended in the local sync
case (and only in that case) by adding a <context>/ prefix to the
source name.

Here is an example of the modified output:

$ syncevolution google
[INFO] @default/itodo20: inactive
[INFO] @default/addressbook: inactive
[INFO] @default/calendar+todo: inactive
[INFO] @default/memo: inactive
[INFO] @default/ical20: inactive
[INFO] @default/todo: inactive
[INFO] @default/file_calendar+todo: inactive
[INFO] @default/file_vcard21: inactive
[INFO] @default/vcard30: inactive
[INFO] @default/text: inactive
[INFO] @default/file_itodo20: inactive
[INFO] @default/vcard21: inactive
[INFO] @default/file_ical20: inactive
[INFO] @default/file_vcard30: inactive
[INFO] @google/addressbook: inactive
[INFO] @google/memo: inactive
[INFO] @google/todo: inactive
[INFO] @google/calendar: starting normal sync, two-way
Local data changes to be applied remotely during synchronization:
*** @google/calendar ***
                       after last sync | current data
               removed since last sync <
                                       > added since last sync
-------------------------------------------------------------------------------
BEGIN:VCALENDAR                          BEGIN:VCALENDAR
...
END:VCALENDAR                            END:VCALENDAR
-------------------------------------------------------------------------------

[INFO] @google/calendar: sent 1/2
[INFO] @google/calendar: sent 2/2
Local data changes to be applied remotely during synchronization:
*** @default/calendar ***
no changes

[INFO] @default/calendar: started
[INFO] @default/calendar: updating "created in Google, online"
[INFO] @default/calendar: updating "created in Google - mod2, online"
[INFO] @google/calendar: started
[INFO] @default/calendar: inactive
[INFO] @google/calendar: normal sync done successfully

Synchronization successful.

Changes applied during synchronization:
+---------------|-----------------------|-----------------------|-CON-+
|               |       @default        |        @google        | FLI |
|        Source | NEW | MOD | DEL | ERR | NEW | MOD | DEL | ERR | CTS |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|      calendar |  0  |  2  |  0  |  0  |  0  |  0  |  0  |  0  |  0  |
|      disabled, 0 KB sent by client, 2 KB received                   |
|      item(s) in database backup: 3 before sync, 3 after it          |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|          start Mon Oct 25 10:03:24 2010, duration 0:13min           |
|               synchronization completed successfully                |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+

Data modified @default during synchronization:
*** @default/calendar ***
                           before sync | after sync
                   removed during sync <
                                       > added during sync
-------------------------------------------------------------------------------
BEGIN:VCALENDAR                          BEGIN:VCALENDAR
VERSION:2.0                              VERSION:2.0
...
END:VCALENDAR                            END:VCALENDAR
-------------------------------------------------------------------------------

pohly@pohly-mobl1:/tmp/syncevolution/src$
Synchronization successful.

Changes applied during synchronization:
+---------------|-----------------------|-----------------------|-CON-+
|               |        @google        |       @default        | FLI |
|        Source | NEW | MOD | DEL | ERR | NEW | MOD | DEL | ERR | CTS |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|      calendar |  0  |  0  |  0  |  0  |  0  |  2  |  0  |  0  |  0  |
|      two-way, 2 KB sent by client, 0 KB received                    |
|      item(s) in database backup: 2 before sync, 2 after it          |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|          start Mon Oct 25 10:03:24 2010, duration 0:13min           |
|               synchronization completed successfully                |
+---------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+

Data modified @google during synchronization:
*** @google/calendar ***
no changes
2010-12-01 12:32:45 +01:00
Patrick Ohly
8258e3d644 SyncContext: use SyncConfig::getContextName() utility function
Simplifies the code.
2010-12-01 12:32:45 +01:00
Patrick Ohly
b15880e861 LocalTransportAgent: use SyncConfig::getContextName() utility function
Simplifies the code.
2010-12-01 12:32:45 +01:00
Patrick Ohly
3ede2de745 SyncReport: added methods for overriding LOCAL/REMOTE strings
The LOCAL resp. REMOTE column headers can be misleading. Added
the possibility to override them. Currently the caller has
to pick strings which are short enough to fit, otherwise the
table will no longer be aligned properly.
2010-12-01 12:32:45 +01:00
Patrick Ohly
c8d6f3ffd0 SyncConfig: added getContextName() helper function
Several places called getConfigName() and the splitConfigName()
to extract the context. This new method combines that. It returns
the name including the leading @ sign because that is the normal
way of writing a context.
2010-12-01 12:32:45 +01:00
Patrick Ohly
d2b71eca65 MapSyncSource: use backup/restore in sub sync source
A sub sync source probably wants to implement its own backup/restore
to avoid the item mapping in MapSyncSource. This patch checks whether
the sub sync source implements backup and then uses these
implementations.
2010-12-01 12:32:45 +01:00
Patrick Ohly
d1cbd174b5 SyncSource: refactored backup utility code
Made ItemCache available as part of SyncSource.h and moved the "add
item to cache" code from SyncSourceRevisions into
ItemCache::backupItem(). The code turned out to be useful when
implementing backup in a backend which couldn't quite use
SyncSourceRevisions directly.
2010-12-01 12:32:45 +01:00
Patrick Ohly
a0210478e5 SyncSource: moved read-only access to operations into SyncSourceBase
This change is necessary for MapSyncSource, which needs to access
the operations via its SubSyncSource pointer, which is derived from
SyncSourceBase instead of SyncSource (to avoid double inheritance
of members).

Together with getOperations(), the definition also had to be moved,
which is such a big change that "diff" shows the change as "moving code
around Operations" instead of "moving Operations".
2010-12-01 12:32:44 +01:00
Patrick Ohly
a9ee4e87ee local sync: disambiguate source names
During local sync names like "addressbook" are no longer unique,
because they may exist in both the local and the remote context. This
patch introduces a "display name" composed from context and source name,
like this: "@<context>/<source>" (@default/addressbook).

The context is only used if needed, which currently is the case during
a local sync.

Changing the SyncSourceBase::getName() result was also considered, but
several places expect this to be the name of the source inside its
context, so an explicit SyncSourceBase::getDisplayName() turned out
to be safer.
2010-12-01 12:32:44 +01:00
Patrick Ohly
783cad557e LocalTransportAgent: fixed interaction with peer config
Local sync with a "source-config" peer config for the sources
did not quite work right yet. This patch fixes several issues:
- double @ sign in source-config@<context>
- sync = disabled must be set explicitly before checking
  activated sources, because source-config@<context> may
  have some of these sources enabled (depends on persistent
  SyncSourceNodes)
- overriding the sync URL is not needed (transport agent already
  set explicitly) and harmful (original value needed by sources)
2010-12-01 12:32:44 +01:00
Patrick Ohly
ea3db56f5a SyncConfig: make temporary changes to SyncSourceNodes properties survive as long as SyncConfig exists
Previously, SyncSourceNodes and the FilterConfigNodes with temporary
property values were created each time getSyncSourceNodes() was
called. This implied that such temporary changes did not survive across
multiple getSyncSourceNodes() calls.

This is an unexpected pitfall, which showed up again in
LocalTransportAgent ("disable all sources, then enable the ones that
are needed" failed because "sync = disabled" them was forgotten).

This patch solves this issue by keeping the full set of nodes around,
including the FilterConfigNodes with temporary changes, and returning
them in getSyncSourceNodes().

The interaction with setConfigFilter() is resolved such that calling
that function invalidates the cached nodes. They will be created
anew with the new filter applied, as before.
2010-12-01 12:32:44 +01:00
Patrick Ohly
6712e8263a MapSyncSource: provide Synthesis API pointer to sub source
Some operations in the sub sync source (like getDescription()) depend
on the Synthesis API pointer. This pointer is maintained in the
wrapping MapSyncSource. This patch makes that pointer available by
deriving SubSyncSource from SyncSourceBase and implementing the
getSynthesisAPI() inherited from it by calling the parent.

SyncSourceBase defines getSynthesisAPI(), so classes derived from
SyncSource and SubSyncSource inherit it. However, the implementation
is ambiguous, so such classes must define that they want the implementation
from SubSyncSource like this:
   SDKInterface *getSynthesisAPI() const { return SubSyncSource::getSynthesisAPI(); }
2010-12-01 12:32:44 +01:00
Patrick Ohly
8244b41b34 LocalTransportAgent: fixed compile error on MeeGo
AF_LOCAL was not found because the right header file
was not included explicitly.
2010-12-01 12:32:44 +01:00
Patrick Ohly
9eb544c0d6 SyncSourceRevisions: delay updating tracking node for MapSyncSource
MapSyncSource uses a MapConfigNode which shares the revision between
multiple uids. Updating the revision once it was seen the first time
broke change detection for the other items sharing that value.
2010-12-01 12:32:44 +01:00
Patrick Ohly
144b4b27b7 MapSyncSource: map from one VEVENT per item to one item per UID
Some storages (like MKCal) and the engine only work with one VEVENT
per item. Other storages (like Exchange or CalDAV) expect all VEVENTs
with the same UID in the same item.

This new class bridges that gap. It is not specific to calendar events;
anything that follows the model of "shared ID" plus "sub ID" can use
this class by implementing the new SubSyncSource interface.
2010-12-01 12:32:44 +01:00
Patrick Ohly
2fd6852d8c nightly testing: improved handling of test data
Previously, test data was modified once when creating the test
configuration. That turned out to be too limited for Google
Calendar, which requires operations like "bump SEQUENCE number"
each time a test case is used.

This patch therefore introduces a "mangleItem" callback. In most
cases, it doesn't do anything. But for iCalendar 2.0, it applies the
transformations previously found in the config setup (simplify UID,
...) and adds some new ones (increase SEQUENCE number, set
LAST-MODIFIED to current time, avoid conflicts between different test
runs by making the UID unique to the run if CLIENT_TEST_UNIQUE_UID is
set).

The patch also fixes time stamps in the test data: they should have been
in UTC, but lacked the Z suffix.
2010-12-01 12:32:44 +01:00
Patrick Ohly
6437ef3bfa StringEscape: added escaping of specific characters
The previous modes used rules to determine which characters had to
be escaped. The new mode uses an explicit list, passed as plain
string and turned into set for more efficient processing.
2010-12-01 12:32:43 +01:00
Patrick Ohly
55ada103c4 SyncSourceParams: introduced context information
Backends like XMLRPC need information about URL, proxy and SSL
settings, etc. This can be done via source specific properties, like
evolutionsource, but this is not how this is normally done. It would
be nicer if the exising per-peer properties could be used. The goal is
that a normal peer configuration can be created from a template with
the necessary information to enable sources using that information.

This patch makes this possible by adding a context parameter to
SyncSourceParams:
     * @param    context     Additional non-source config settings.
     *                       When running as part of a normal sync, these are the
     *                       settings for the peer. When running in a local sync,
     *                       these settings come from the "source-config" peer
     *                       config inside the config context of the source.
     *                       Testing uses "source-config@client-test". On the
     *                       command line, this is the config chosen by the
     *                       user, which may or may not have peer-specific settings!

Note that this still doesn't solve the problem for XMLRPC to SyncML
peer sync, because in that case ("normal sync") the context will be
the one describing the peer. SyncURL is already used and proxy
settings might not match.

The XMLRPC backends therefore was not changed and continues to use
evolutionsource.
2010-12-01 12:32:43 +01:00
Patrick Ohly
c2f57528a0 local sync: added sanity checks for syncURL (BMC #712)
Don't allow sync inside same context, too easy to configure incorrectly.
Also don't allow referencing a peer (leads to incorrect session dirs
in client and cannot override peer files).
2010-12-01 12:32:43 +01:00
Patrick Ohly
eba8a74779 support local sync (BMC #712)
Local sync is configured with a new syncURL = local://<context> where
<context> identifies the set of databases to synchronize with. The
URI of each source in the config identifies the source in that context
to synchronize with.

The databases in that context run a SyncML session as client. The
config itself is for a server. Reversing these roles is possible by
putting the config into the other context.

A sync is started by the server side, via the new LocalTransportAgent.
That agent forks, sets up the client side, then passes messages
back and forth via stream sockets. Stream sockets are useful because
unexpected peer shutdown can be detected.

Running the server side requires a few changes:
- do not send a SAN message, the client will start the
  message exchange based on the config
- wait for that message before doing anything

The client side is more difficult:
- Per-peer config nodes do not exist in the target context.
  They are stored in a hidden .<context> directory inside
  the server config tree. This depends on the new "registering nodes
  in the tree" feature. All nodes are hidden, because users
  are not meant to edit any of them. Their name is intentionally
  chosen like traditional nodes so that removing the config
  also removes the new files.
- All relevant per-peer properties must be copied from the server
  config (log level, printing changes, ...); they cannot be set
  differently.

Because two separate SyncML sessions are used, we end up with
two normal session directories and log files.

The implementation is not complete yet:
- no glib support, so cannot be used in syncevo-dbus-server
- no support for CTRL-C and abort
- no interactive password entry for target sources
- unexpected slow syncs are detected on the client side, but
  not reported properly on the server side
2010-12-01 12:32:43 +01:00
Patrick Ohly
801f831531 ConfigTree: allow user to register ConfigNode instances
This is necessary for local sync, which has to add per-peer file
config nodes in a location which is outside of the non-peer context
accessed by the ConfigTree.

Adding these instances is necessary for two reasons:
- ConfigTree::flush() must also flush these additional nodes.
- Temporary settings made for sources are only found if the
  corresponding nodes can be found via the ConfigTree.
2010-12-01 12:32:43 +01:00
Patrick Ohly
7f25b354a7 SyncContext: avoid crash in sort() with LogDir as binary predicate
LogDir is not copyable when it contains an m_info pointer. std::sort()
inside LogDir::getLogDirs() for a context is called with LogDir as
binary predicate, which causes a crash because sort() copies the
predicate.

This was found when calling getLogDirs() in a LogDir used for local
sync, without a peer. It did not happen before because then the
LogDir instance did not contain an m_info pointer. It was merely
inefficient.

This patch moves the static log dir name methods into a new
LogDirNames class and uses that as binary predicate. LogDir itself
inherits these methods via a private base class, which is similar
to the previous private static methods (avoids touching all of
the calls) and also inherits from boost::copyable to catch future
errors related to copying LogDir.
2010-12-01 12:32:42 +01:00
Patrick Ohly
adecddd1ea command line: increase log level when SYNCEVOLUTION_DEBUG is set
SYNCEVOLUTION_DEBUG was already used to disable output redirection.
But messages at level DEBUG were not printed in many command line
operations, with no way to change that because logLevel is a per-peer
config option.

This patch therefore increases the log level to DEBUG when
SYNCEVOLUTION_DEBUG is set.
2010-12-01 12:32:42 +01:00
Patrick Ohly
f8a0e20887 Flags2String(): convert bit field to string
Useful for debugging.
2010-12-01 12:32:42 +01:00
Patrick Ohly
f2917ecd2e Strncpy(): standard wrapper for strncpy()
strncpy() does not guarantee nul termination in case of
truncation. SyncEvo::Strncpy() in util.h does.
2010-12-01 12:32:42 +01:00
Patrick Ohly
8e5f8dfabf config handling: old-style configs not found anymore (BMC #9381)
Running a sync with SyncEvolution > 1.0.99.6 and a configuration created with
SyncEvolution <1.0 works once, then fails with "No configuration for ... found"
("[SyncEvolution] Problem after upgrade - old-style config not found in 1.1").

The root cause is this commit:

commit 1b62240708
Author: Patrick Ohly <patrick.ohly@intel.com>
Date:   Mon Aug 2 14:27:48 2010 +0200

    command line: allow creating contexts without peers

That patch incorrectly creates the "peers" directory also for configs
without a context. The bug was introduced because FileConfigTree only had
an ambiguously named boolean. Fixed by distinguishing behavior based on
the SyncContext enum.
2010-11-01 12:49:12 +01:00
Patrick Ohly
5e59255b0e KCalExtended: workaround for importing custom time zones
This is an incomplete fix for importing custom time zones (BMC #8895).
It works as long as there is no TZID conflict. When a new time zone
definition uses the same TZID as another time zone, the old definition
is used, which may be incorrect. A full solution should use a new
mKCal API function (BMC #8604), which does not exist yet and still
needs to be discussed.
2010-10-26 11:23:27 +02:00
Patrick Ohly
832510117b KCalExtended: avoid partial loading to work around issues with it
Partial loading can lead to a calendar which is in an inconsistent
state (child event exists in storage, but cannot be loaded to delete
it, BMC #6061).

This patch solves the issue with brute-force: load the complete calendar
once it is opened. This is less efficient, but better than incorrect
operation.
2010-10-26 11:18:25 +02:00
Patrick Ohly
b1f0df2c35 KCalExtended: ignore request to remove non-existant event
This may occur when the master event was removed earlier (BMC #6061).
Another reason could be concurrent editing by another app.
2010-10-26 11:16:37 +02:00
Patrick Ohly
ac9e678ef0 KCalExtended: disable unsupported linked item tests
Currently mKCal removes all items with the same UID when asked
to remove the parent (BMC #6061). This is still under debate,
so instead of implementing a workaround lets disable these tests.
2010-10-26 11:11:37 +02:00
Patrick Ohly
c7e470f3b7 client-test: replaced compile-time LINKED_ITEMS_RELAXED_SEMANTIC with ClientTestConfig::linkedItemsRelaxedSemantic
Several different backends share the code of ClientTest.cpp, so compiling
it differently based on capablities of a backend does not work once multiple
backends are active. Replaced define with config option and enabled the
relevant tests only if the backend supports them.
2010-10-26 11:09:17 +02:00
Patrick Ohly
776c1522b8 command line: --delete-items ... * deletes all items
There was no obvious way of deleting all items. Added * as wildcard
for that. It can be specified in addition to other luids, which
will be ignored if a star is given.
2010-10-26 10:24:48 +02:00
Patrick Ohly
90e390ae16 syncevo-dbus-server: incorrect Presence status after config change (BMC #8453)
This showed up in the sync-ui as "'Sync Now' button active after
creating a config while offline".

The root cause was a logical flaw in the syncevo-dbus-server: on
config change, it invalidated a cache of current
configs. Server::CheckPresence() then rebuilt and used that cache once
needed, but always so that all transports were enabled.

The solution is to rebuild the cache in PresenceStatus::init() so that
it matches the current network
state. PresenceStatus::updatePresenceStatus() does the same thing
before changing that state, which will include sending out the
necessary signals.
2010-10-20 14:23:53 +02:00
Patrick Ohly
22980b3d1f fixed compiler warnings
g++ 4.5.0 on MeeGo complained about NULL being used for integer in
smart pointer templates. Using the literal 0 (can be both integer
and null pointer) solves that.
2010-10-19 10:35:18 +02:00
Patrick Ohly
aa0fbe3a03 KCalExtended: updated mkcal backend description
Split the long "evolutionsource" description into smaller sentences.
2010-10-19 10:33:51 +02:00
Patrick Ohly
e4e7c71a1e KCalExtended: fixed compiler warning
"useTracker" variable was unused. Renamed to "isDefault" and use
it for Database() construction.
2010-10-19 10:33:02 +02:00
Patrick Ohly
eee39a36ac KCalExtended: do not use Tracker for custom database file
When creating an SQLite storage for evolutionsource=file://, do
not enable Tracker. The reason is that a) we don't know whether
the indexing works for anything other than the default storage
and (I have my doubts) b) we don't need it.

Also simplified the code a bit.
2010-10-19 10:32:43 +02:00
Qiankun Miao
13a8d7a1ac KCalExtended: select notebook (BMC #6898)
"evolutionsource" either refers to a notebook name in default storage, or a
database file path.
1) If it starts with file:// prefix, the dbfile will be created if it does
not exist yet. Default notebook in the database file will be selected.
2) If it starts with SyncEvolution_Test_ prefix, it stands for notebook's
name in default storage, the notebook will be created if it does not exist yet.
3) If no special prefix, search notebook in default storage, if found,
select that notebook, else throw an error.
4) If no evolutionsource configured, default notebook named "Default" will
be used.
2010-10-19 10:06:42 +02:00
Patrick Ohly
b85f588c60 KCalExtended: comment clarification for created()/CREATED
KCalExtended authors confirmed that created() corresponds to CREATED,
so the code was correct.
2010-10-04 15:03:05 +02:00
Patrick Ohly
bf6c9ddad8 autotools: fixed QtContacts compilation
QtGUI is needed for QtContacts. Without it, the code didn't compile.
2010-10-01 14:29:44 +02:00
Patrick Ohly
a56fa43d33 command line: split properly at empty line during --import (BMC #7664)
The --import operation was specified as splitting at a blank line and
was meant to work for vCard 3.0 and iCalendar 2.0 files. However, if
the blank line between items used DOS line ends (\r\n) like the items
themselves, then splitting them didn't work because of the literal
match with "\n\n".

This patch introduces a special semantic for the "\n\n" delimiter:
it also matches "\n\r\n" when splitting. This is implemented by
the custom FindDelimiter class.
2010-09-30 17:20:15 +02:00
Patrick Ohly
e6af21a1cb syncevo-dbus-server: keep sessions around after completion (BMC #7766)
Clients like Genesis which display information about sessions started by other
clients have a problem: they see that the session is created, but before they
can get the relevant information (config name, session flags), then session may
already have terminated.

Because the session is removed immediately after termination, the client's
attempt to call methods on that session will fail.

This patch introduces a new state for sessions:
- session completed and no longer active
- not listed anymore by Server.GetSessions()
- read-only methods can still be called for at least a minute

"At least" is intentionally a bit fuzzy. The way how it is implemented
it may happen that it remains accessible longer, but clients cannot
count on it.

The main idea behind the patch is that Client::detach() detects when
removing a session from a client's resources would delete the
session. At that point it triggers the normal cleanup for the session
(new Session::done(), same as previous Session::~Session()) and
creates a Timeout callback which holds a reference to the Session,
thus preventing deletion of it until the timeout fires once and then
gets removed together with the session.

If a client becomes the sole owner of a session before detaching, then
this will repeat. This is considered acceptable and covered by the new
semantic ("at least a minute").

The patch is slightly larger than it needs to be because some code was
moved around. The Client class now needs access to DBusServer and thus
its implementation can no longer be defined inline.

TestDBusSession.testAttachOldSession covers that such a completed
session can be attached to again. It failed before the delayed
deletion was implemented, now it passes. It also verifies that
Attach() keeps the session around. TestDBusSession.testExpireSession
verifies that the session is really removed after a minute.
2010-09-30 14:52:42 +02:00
Patrick Ohly
0594f5aba1 syncevo-dbus-server: introduced timeout utility class
The new Timeout class wraps g_timeout_add_seconds() and
g_source_remove() in a C++ interface. Users of the class no longer
have to worry about callbacks with stale data pointers, because the
Timeout class will automatically remove the timeout when it gets
deleted. Additional parameters for the callback can be tied to the
class via boost::bind(), using either copy semantic, pointers or
references (boost::ref()).

DBusServer extends upon the Timeout class by handling the ownership.
The Timeout class is deleted once the callback indicates that it no
longer wants to be called.

Most of the existing g_timeout_add_seconds() usage should be replaced
with this new class. The main point however is the BMC #7766, delayed
deletion of expired sessions.
2010-09-30 14:51:48 +02:00
Patrick Ohly
320e23e31d D-Bus API: added missing Session.Attach() (BMC #7761)
It was always part of the design that multiple clients can use any session.
Somehow we forgot to implement Session.Attach(), the call that allows a client
which hasn't started a session to register it's interest in the session. In
particular, that session won't go away unless the client exits or detaches.

This patch adds that missing call, a corresponding capability
("SessionAttach") and a unit test. The unit test covers recursive
attach/detach, it does not actually verify that the session remains
around.
2010-09-30 10:32:13 +02:00
Patrick Ohly
cb67e29e0a command line: fixed configuring of context (BMC #7181)
A context holds a set of source settings, without any peer-specific
properties like "sync mode". The code for configuring such a context
tried to set the sync mode and thus failed.

This patch unifies the check for "configuring context" in one place.

It also slightly modifies the set of sources which are configured:
traditionally, all sources were configured, but only the listed ones
were enabled. This makes sense because users then can enable the source
selectively, either during --run or with --configure without access to
the original template.

For a context, there is no concept of a "disabled" source. Adding
those makes no sense and thus is not done anymore.

Configuring a single source in a new context, adding a second source
and adding a peer is now tested in CmdlineTest::testConfigureSources.
Note that this contains a hack to reflect the broken behavior in BMC
fixed.
2010-09-29 15:07:35 +02:00
Patrick Ohly
545c71be68 KCalExtended, QtContacts: fixed initialization of QCoreApplication
As noticed in BMC #7401, a Q[Core]Application is needed before
Qt can be used. There is a global qApp pointer, which we should
use to find the global singleton. Creating a QCoreApplication
instead of a QApplication is good enough for us.
2010-09-29 14:38:11 +02:00
Patrick Ohly
15f3a898f7 KCalExtended: extended error messages
These error messages might be useful to track down BMC #6061.
2010-09-29 14:26:36 +02:00
Patrick Ohly
29717c59de KCalExtended: fixed UTF-8 handling (BMC #7401)
QString("foobar") only works for ASCII strings. const char pointers
which are in UTF-8 must use fromUtf8() explicitly. Same for conversion
back to UTF-8. Previously the code used toLocal8Bit(), which may or
may not be UTF-8 depending on the locale.

On a related note, test code which does not instantiate a QApplication
or QCoreApplication is incorrect and leads to different results than
code with such an instance. Our backends instantiate a QApplication if
necessary (but the exact way of doing it needs some tweaking), so the
result is deterministic.
2010-09-29 14:22:41 +02:00
Patrick Ohly
bff517156c sync-ui: wrong direction of data transfer when talking to device (BMC #7091)
The settings for a device sync shows two checkboxes, one to "Send
changes to MYPHONE" the other to "Receive changes from MYPHONE". The
meaning of these two buttons are interchanged.

The settings are the same as in a web service. They were not mapped
correctly for a device because "refresh/one-way-from-server/client"
implies different data transfer directions depending on whether the
peer is a client or a server.

The solution for this issue is to switch the sync mode depending on
whether the config refers to a client ("PeerIsClient"). Added
an utility function and adapted:
- displaying existing configs
- changing configs
- refresh syncs in the emergency dialog
2010-09-24 17:51:27 -07:00
Patrick Ohly
5285051e3a sync-gtk.desktop.in: fixed syntax in non-MeeGo desktop file
Syntax error introduced in latest release: trailing ; missing.
2010-09-16 13:24:52 +02:00
Patrick Ohly
aded2028f4 documentation: improved explanation of "type"
The trailing exclamation mark for forcing a specific format
wasn't mentioned.
2010-09-13 08:05:26 +02:00
Patrick Ohly
5a8574b7b1 nightly testing: adapted Cmdline test to string changes 2010-09-09 11:38:05 +02:00
Patrick Ohly
9db07a66a7 Nokia phones: avoid data loss in two-way sync due to X-EVOLUTION-UI-SLOT (MBC #2566)
Sending the X-EVOLUTION-UI-SLOT parameter to a Nokia phone when
updating an existing contact confuses the phone such that it drops the
phone number or email that had the parameter; the initial import was
okay. Reported for Nokia N81, E72, root-caused on a N97 mini.

Sending the X-EVOLUTION-UI-SLOT has very little value except when
talking to another SyncEvolution instance. All other SyncML peers
are expected to simply ignore the parameter, so there is no point
in sending it in the first place.

This is the solution implemented in this patch. A "rule" parameter
of the <parameter> element that defines X-EVOLUTION-UI-SLOT declares
that the parameter is to be ignored when parsing or generating vCards,
except when the peer is known to be SyncEvolution.

A remote peer is detected by the new 00_syncevolution.xml remote rule.
Locally, the parameter needs to be enabled when talking to Evolution
(evolution.xml) or to files which can also store the parameter
(all.xml). The later case is important for a SyncEvolution HTTP server
with file storage.

Running "./client-test Client::Sync::vcard30::testItems" against such
a SyncEvolution server confirmed that without all.xml, the
X-EVOLUTION-UI-SLOT got lost, which also confirms that the rule
mechanism works.
2010-09-08 13:44:55 +02:00
Patrick Ohly
4e72438e8f sync-ui (GTK version): updated .desktop file
As commented by Pietro Battiston, the generic "Sync (GTK)" name, "Up
to date" comment and "Internet" category inherited from Moblin/MeeGo
are not quite suitable for a general purpose Linux desktop.

This patch changes the non-Moblin/MeeGo .desktop file. The MeeGo
installation is not modified.

We did not have a good idea for a generic name and thus kept the GTK
part to distinguish this SyncEvolution GUI from future other ones.
Category and comment were easier: "Synchronize PIM data" and
"Office;PDA;GTK", with GTK likely to be ignored.
2010-09-08 13:44:33 +02:00
Patrick Ohly
ce198f75f3 syncevo-dbus-server: fixed compile issue with libsoup disabled (MBC #6367)
Having libsoup disabled is not recommended when initiating HTTP
SyncML sessions in syncevo-dbus-server, although it may work
with libcurl when ignoring that the D-Bus server is unresponsive
while doing HTTP.

Compiling without libsoup and without libcurl is useful when
using syncevo-dbus-server as HTTP server.
2010-09-07 17:03:34 +02:00
Patrick Ohly
3062c42935 documentation: extended description of "sync" property (MBC #6373)
The role of the "sync" property depends on the way how the sync
is started. Added some comments about HTTP server and SAN initiated
syncs.
2010-09-07 17:03:34 +02:00
Patrick Ohly
abd74b72f2 EDS: revised workaround for D-Bus method timeouts (BMC #4026)
Using INT_MAX (= unlimited) as default D-Bus timeout seems
to trigger some untested code paths in system libs (use
of uninitialized memory in poll, increased leaks). Use
a large but finite timeout instead.
2010-09-06 23:48:38 +08:00
Patrick Ohly
9286d914c0 EDS: workaround for D-Bus method timeouts (BMC #4026)
libecal/ebook implementation based on D-Bus (Evolution >= 2.30)
inevitably will run into D-Bus timeouts as the amount of data
increases.

This patch moves an earlier hack written for Maemo into the core
code and enables it by default, if the EDS backends are active.
It works by intercepting dbus_connection_send_with_reply()
and substituting timeout_milliseconds==-1 ("default timeout
of 25 seconds") with timeout_milliseconds=INT_MAX ("no timeout").

Setting SYNCEVOLUTION_DBUS_TIMEOUT to number of milliseconds
allows controlling the final timeout value.
2010-09-03 15:40:05 +02:00
Patrick Ohly
856e291844 Nokia phones: alarm times in UTC, sending PHOTO (BMC #1657, #5860)
Introduced a new remote rule for all devices made by Nokia. In that
rule, we set certain defaults which turned out to be useful for
a variety of existing phones:
- send alarm times in UTC (BMC #1657)
- ignore the incorrect 256 bytes size limit for PHOTOs
  and other properties (BMC #5860)

Should a specific model require different values, then a rule for
it after the initial 00_nokia.xml can override the defaults.
2010-09-01 18:44:02 +02:00
Patrick Ohly
b7d9f26f69 nightly testing: fixed caching of Evolution sources (BMC #5864)
"text" stands for Evolution memos and depends on
EvolutionCalendarSource. Added.

The name lookup differs for local and for sync indices, must do
the name lookup before calling checkEvolutionSource(). Fixed.
2010-09-01 18:05:27 +02:00
Patrick Ohly
19f703588f nightly testing: avoid shutdown issues due to caching Evolution sources (BMC #5864)
Destroying ORBit based Evolution backends at the very end of the
process life time caused assertions in ORBit. Added explicit cleanup
code which is called before triggering the normal library shutdown by
leaving main().
2010-09-01 18:01:19 +02:00
Patrick Ohly
b6e11b7652 KCalExtended: use "mkcal" as generic type name
Follow the KCalExtended -> mkcal rename. KCalExtended is
still accepted as an alias.
2010-09-01 16:06:16 +02:00
Patrick Ohly
815ca3fa98 KCalExtended: adapted "update" code patch to new API
The code had not been updated yet. To get it to compile,
a work around for BMC #6181 (upcasting to IncidenceBase)
was needed.
2010-09-01 16:03:47 +02:00
Patrick Ohly
7071f941cd command line: use % as escape character for luids
The command line, like a lot of other code, used the escape/unescape
code in SafeConfigNode. For historic reasons, that code used ! as
escape character, which is awkward for the command line, because
that is a special character.

Instead of further overloading the SafeConfigNode, this patch moves
the escape/unescape code into its own utility class. This is the
cleaner approach anyway. It also adds unit testing for the code.

All other users of the old code are updated. Care must be taken here
to not accidentally switch to a different escape mechanism, because
the mechanism must remain compatible with the old implementation.
2010-09-01 15:59:48 +02:00
Patrick Ohly
21f76cff07 command line: code clean-up around LUID escaping
Using std::string for both local IDs as respresented by the backend
and encoded as printed by the command line was confusing. It didn't
help that the m_luids member contained encoded strings, instead of
normal luids.

This patch introduces a dedicated class which holds an encoded luid,
and provides the necessary conversion functions. m_luids now really
contains plain luids, so its values can be passed to the backends
directly.
2010-09-01 15:48:29 +02:00
Patrick Ohly
2ab93b301f KCalExtended: fix for invalid memory access
Accessing pointer into temporary instance is only valid inside
the expression. Need to copy into result std::string right away.
2010-08-31 10:02:17 +02:00
Patrick Ohly
9e55780cdc QtContacts: more QtContacts API related fixes (BMC #5710)
First, "query-builder=fetch,save" is obsolete.

Second, the modification time stamp is not updated in
saved contacts. Instead it has to be fetched explicitly
in a second request. This behavior is currently under
debate because it is not quite consistent with some of
the API documentation.
2010-08-27 13:30:05 +02:00
Patrick Ohly
fa9c4c6bb9 phone templates: updated, copied from syncevolution.org Wiki (BMC #5727)
Merged all Nokia templates (S40, S60, Maemo) into one, because the
settings were the same anyway. The rationale is that it reduces the
number of options the user has to choose from.

Added Sony Ericsson, based on K750i.

Added names of working phones based on Wiki entries.
2010-08-27 13:30:05 +02:00
Patrick Ohly
614f0390b0 nightly testing: workaround for Evolution 2.30 storage shutdown (BMC #5864)
The D-Bus based Evolution Data Server calendar and contact daemons
(e-calendar-factory and e-contact-factory) shut down after 10 seconds of
inactivity.

Normally libecal/libebook detect that, but not when the client only uses the
synchronous API ("destroyed" signal not delivered, see e-cal.c). That affects
SyncEvolution.

This patch ensures that a EvolutionContactSource resp. EvolutionCalendarSource
remains open throughout the lifetime of the client-test app. This prevents
the storages from shutting down.

This instances are created on demand and deleted when the process quits.
This might be too late for ORBit based Evolution; there were error messages
after all tests succeeded and an assertion failure in ORBit, leading to
a nonzero return code.
2010-08-27 18:47:16 +08:00
Patrick Ohly
a00cabeafe D-Bus API: fixed type signature
a{s} needs to be a(s); broke compilation of GTK GUI.
2010-08-25 23:09:28 +02:00
Patrick Ohly
1b243b7b83 D-Bus API: added Server.ConfigChanged signal (BMC #3558)
Watching for configuration changes (e.g., for refreshing the list of
servers in the GUI) currently is a bit cumbersome. It requires
watching for SessionChanged, request GetConfigs, and look if
the configs have changed. This is not really a problem, but it
might be more convenient to get notifications about config
changes directly.

This patch introduces a Server.ConfigChanged signal which is at the
end of a session if and only if it modified (removed, updated, added)
a config. This includes the Session.SetConfig() as well as command
line operations executed inside the server.

Testing the signal can only proof that it is emitted. Checking that it
is not emitted would have to block waiting for something, and it is
uncertain what that should be. SessionChanged may be emitted before
the ConfigChange signal and thus isn't suitable.
2010-08-25 23:09:28 +02:00
Patrick Ohly
a9e7a49705 D-Bus API: added Session.GetConfigName() (BMC #3559)
This call is useful for clients which haven't started the session
and need to know what peer it relates to, and also fo clients which
use non-normalized config name and need to know the normalized name.
2010-08-25 23:09:22 +02:00
Patrick Ohly
e30ae98e57 D-Bus API: added suppression of libnotify notifications (BMC #3560)
Genesis is already providing feedback about running syncs and thus
wants to suppress the notifications generated by syncevo-dbus-server
for it. With this patch it is possible.

This patch removes the m_attachedClients member and moves the attach
count into the Client class. The reason is two-fold:
a) m_attachedClients was simply redundant
b) entries were not removed (bug in the control flow of clientGone:
   if the client was found, which is always the case for any attached
   client, it returned without calling detachClientRefs())

The other new entry in Client is the boolean setting whether that
client wants to suppress notifications. If any client disables them,
they are disabled globally.
2010-08-25 23:09:14 +02:00
Patrick Ohly
4fad1303ae command line: start D-Bus session with "no-sync" flag unless running a sync (BMC #3562)
The main goal of the new D-Bus API is to avoid unnecessary (and incorrect)
updates in Genesis when running non-sync sessions with the command line.
This patch sets the flag accordingly to achieve this.

Note that the modified command line now fails with
org.freedesktop.DBus.Error.UnknownMethod when running against an old
syncevo-dbus-server. There's no fallback to the older StartSession
method. This shouldn't be necessary because the command line is shipped
with the server.

Just in case an INFO message is printed when the method is found to
be missing.
2010-08-25 11:07:51 +02:00
Patrick Ohly
5e219fedef D-Bus API: added Server.StartSessionWithFlags() and Session.GetFlags()
Clients like Genesis would like to know for which purpose a session
was created. If it was for changing the configuration, they can ignore
the session.  If it was for sync, then progress and result should be
displayed.

Starting a session with the new "no-sync" flag in the new
StartSessionWithFlags() achieves that. Note that it is up to the
clients to provide that hint; currently none of the clients do that.
2010-08-25 10:37:58 +02:00
Patrick Ohly
502cdec73a gdbus C++: fixed cut-and-paste error
Found this one when adding a method with five parameters. The
boost::bind() call had the wrong number of parameters for that case
and thus compilation failed.
2010-08-25 10:26:49 +02:00
Patrick Ohly
a28eefa300 command line: do sanity version check when running as D-Bus client
One common mistake among developers is that they recompile SyncEvolution
and then run with the system's D-Bus server. This patch adds an INFO
message about such a version mismatch, but does not abort because such
a combination may be intentional.

It is implemented as part of the attach process: as soon as attaching
was successful, fire of another asynchronous method call to the new
Server.GetVersions() instead of returning from the main loop. Once
that completes, check the version and return.
2010-08-25 08:52:54 +02:00
Patrick Ohly
067397a9f2 D-Bus: added Server.GetCapabilities and Server.GetVersions (BMC #3563)
We are about to extend the D-Bus API. Clients need some way of determining
whether the new features are available. A strict numbering of the API is
inflexible, so let's use "capability" strings instead. Also add flexible
version querying, for debugging.
2010-08-25 08:52:54 +02:00
Zhu, Yongsheng
c8b1f3a07d client-test: avoid duplicate sources in m_localSource2Config
do checking to avoid duplicate before pushing back a source
into m_localSource2Config for TestEvolution.
Virtual sources may contain many sub-sources, which might duplicate
other sources.
2010-08-25 08:41:18 +02:00
Patrick Ohly
1b62240708 command line: allow creating contexts without peers
When configuring a context for local sync, no peer is needed
inside that context. Therefore "--configure" without "--template"
is valid, because the templates only differ in peer-specific
properties.

This patch uses the "SyncEvolution" template as automatic fallback
for context configs. A change to FileConfigTree ensures that the
"peers" directory is created, as expected by the code which checks
for new-style configs.
2010-08-24 09:36:15 +02:00
Patrick Ohly
abbfc49676 SyncConfig: do not mistake "foo" context for old-style "foo" client config
A existing context configuration could accidentially be access without
the @ sign and then was treated like an old-style config with default
context. During --configure, invalid properties from the @default
context were written into the other context.

The fix makes the check for old-style configs more strict: it assumes
that all new-style contexts have a "peers" sub directory and checks
for that.
2010-08-24 09:36:05 +02:00
Patrick Ohly
a3eaf3138b command line: fixed --delete-items/--import for KCalExtended
The --delete-items/--import options did not work with the KCalExtended
backend. The reason was that saving changes is only done in
KCalExtendedSource::endWrite(), which wasn't called because the command
line did not invoke endDataWrite().

That used to be intentional to avoid updating change tracking state in
other backends, but clearly was a hack. Because the sources are now
instantiated without change tracking, endDataWrite() is safe to call,
which fixes the issue with KCalExtended.
2010-08-23 18:20:01 +02:00
Patrick Ohly
bf36c6b7e6 KCalExtended: further adaptions to KCalExtended API change
Must use MemoryCalendar because ExtendedCalendar can no longer
hold incidences without a Notebook UID, which does not exist
without a storage.

Removed a redundant smart pointer copying.

Added return code checking of iCalendar 2.0 parser.
2010-08-23 18:17:24 +02:00
Patrick Ohly
b504bf9f1f KCalExtended: workaround for incomplete libmkcal.pc
libmkcal.pc did not depend on libkcalcoren and thus
include paths were not set for that when only checking
for libmkcal. Drawback now is the hard dependency on
the MeeGo version of libkcalcore.
2010-08-17 13:45:10 +08:00
Patrick Ohly
4e87e50463 EDS compatibility: added icalproperty_free()
Started to use this call recently, also need to wrap it.
2010-08-17 11:30:39 +08:00
Qiankun Miao
2265aaff0c EvolutionBackend: fix memory leak
Function "icalcomponent_remove_property(...)"  removes property instance from
properties list, but doesn't free the space it holds. So, after calling this
function, the property instance removed from properties list should be free
explicitly.
2010-08-16 16:38:19 +08:00
Patrick Ohly
957d5c6175 Merge branch 'meego-1.0'
Conflicts:
	configure-pre.in

Version conflict.
2010-08-15 21:29:08 +02:00
Patrick Ohly
2018114977 gdbus: ensure that header files are included in "make dist"
After commenting out the files, they were no longer considered
by automake.
2010-08-15 21:26:53 +02:00
Patrick Ohly
5b6f3ae3ca kcalextended: adapted to revised API
As part of splitting kcalextended into a modified kcalcore (shared
with KDE) and mkcal (MeeGo), the API was modifid. This patch gets
SyncEvolution to compile again. However, at least on my laptop
it then crashed at runtime inside Qt before even calling mkcal =>
change untested.
2010-08-15 21:24:14 +02:00
Patrick Ohly
438779d7ff SyncContext: added comment for getUsedSyncURL()
The function had been added without explanation. This comment
documents my understanding of its purpose...
2010-08-15 21:24:14 +02:00
Patrick Ohly
18dd70a275 Revert "compile fix for FC 13 (and possibly others): use private copy of gdbus (MBC #3556)"
This reverts commit ec7eb74366.

With the symbol prefix renamed from gdbus into bdbus, we can install
the lib into /usr/lib/syncevolution again, to get it shared between
the "syncevolution" and "syncevo-dbus-server" binaries.
2010-08-09 10:46:11 -04:00
Patrick Ohly
4ba42082fa gdbus: avoid name conflict with glib
The previous solution of linking Bluex gdbus statically was not
enough. On Fedora 14, compile errors due to the glib header files
being pulled in indirectly appeared.

This patch does a global search/replace which changes the
"gdbus" (GLib D-Bus) prefix into "bdbus" (Bluez D-Bus). For the
record:
perl -pi 's/g_dbus_/b_dbus_/g; s/GDBus/BDBus/g; s/GDBUS/BDBUS/g' ...
2010-08-09 10:46:03 -04:00
Patrick Ohly
dd5f4b94b0 gdbus: do not install header files
The library was already considered "private",
so no software should need the header files.
2010-08-09 10:45:55 -04:00
Jussi Kukkonen
5c2c115c87 canonize new device config names (MBC #1194)
Fixes the second half of bug 1194: only allow "-_[a-z][A-Z][0-9]"
characters in the name.
2010-07-16 16:57:09 +02:00
Jussi Kukkonen
181035f8ac prevent overwriting device configs by accident (MBC #3566,1194)
Currently the configuration name for a new config is the
fingerPrint and it overwrites any existing configuration.
This commit starts using deviceName as the base name and adds a
incremental number to the end if a configuration already exists
for that name.
2010-07-16 16:56:58 +02:00
Patrick Ohly
a92e987e81 ZYB.com: service goes away end of June 2010, template removed (MBC #3310)
ZYB.com will be replaced with Vodafone 360, which we don't support (yet).
This patch removes the obsolete template for ZYB.com. The sync-UI still
has some strings for it, just in case that someone has an old template
around or runs it against an old syncevo-dbus-server.
2010-07-16 16:56:44 +02:00
Patrick Ohly
34bb1b1066 syncevo-dbus-server: accept 'application/vnd.syncml+xml; charset=UTF-8' for starting an HTTP session (MBC #3554)
The redundant charset specification was set by the Funambol
Thunderbird client. Because of a literal comparison against
'application/vnd.syncml+xml' the messages were rejected.

This patch strips everything after a semicolon. None of the options
there should matter for SyncML.
2010-07-16 16:56:27 +02:00
Patrick Ohly
ec7eb74366 compile fix for FC 13 (and possibly others): use private copy of gdbus (MBC #3556)
SyncEvolution on FC 13 crashes because it conflicts with a different
system version of the gdbus library. Always linking statically fixes
this.

There never was an official upstream release of gdbus, so sharing the
implementation does not work.
2010-07-16 16:56:11 +02:00
Patrick Ohly
ca7c58b014 config fix: operations on non-peer configs failed (MBC #3157)
When running operations on a non-peer configuration (like --restore @default
addressbook), the operation fails with
[ERROR] <source name>: type 'select backend' not supported

The root cause is that the "type" property was read from a virtual, empty peer
node. MultiplexConfigNode already handled this by falling back to the non-peer
node.

The same special case also needs to be added to SyncSourceNodes::getNode().
2010-07-16 16:56:01 +02:00
Jussi Kukkonen
88ea231145 canonize new device config names (MBC #1194)
Fixes the second half of bug 1194: only allow "-_[a-z][A-Z][0-9]"
characters in the name.
2010-07-16 16:13:17 +02:00
Jussi Kukkonen
f616f35084 prevent overwriting device configs by accident (MBC #3566,1194)
Currently the configuration name for a new config is the
fingerPrint and it overwrites any existing configuration.
This commit starts using deviceName as the base name and adds a
incremental number to the end if a configuration already exists
for that name.
2010-07-16 16:12:42 +02:00
Patrick Ohly
5712425a56 QtContacts: fixed compile error with g++ in MeeGo
g++ in MeeGo Trunk is more picky about bit or of enums.
Fixed by adding explicit cast to enum.
2010-07-16 14:33:15 +02:00
Patrick Ohly
9e38a7cef9 QtContacts: find QtContacts properly
This configure changes removes the hard-coding of -lQtContacts -lQtVersit
and replaces it with proper qmake magic to find the libraries.
2010-07-15 15:57:36 +02:00
Zhu, Yongsheng
e38a479a6c client-test: ignore comments for KCalExtended and QtContacts
'isPropAssignment' checks each line and match whether it's
a property assignment according to match '<word> = value'.
Comments for 'KCalExtended' and 'QtContacts' match this pattern.
Obviously, they should be ignored like other backends comments.
2010-07-14 14:13:57 +08:00
Patrick Ohly
b7ef83d6ed documentation + command line: unified source of usage information (MBC #690)
This patch adds an utility script (readme2c.pl) which extracts the
SYNOPSIS and OPTIONS part of README.rst and puts it into C
strings. These are then used inside the SyncEvolution command line for
short help (just the synopsis) and --help (also all options).

This patch also cleans up README.rst so that the OPTIONS part really
documents most options in sufficient detail for --help to be useful.
The USAGE section remains part of the README and the man page where
the different operations are introduced in a more task-oriented way.

This separation is not always easy to make. The --restore operation
and related parameters are only described in the USAGE part because I
couldn't find a way to introduce them briefly and then add a thorough
explanation under OPTIONS.
2010-07-12 16:31:46 +02:00
Zhu, Yongsheng
99c9919b44 Testing: fix failure of evolution testing due to new backends
Some unit tests of CmdlineTest are failed due to new backends
which were newly implemented, including KCalExtended and QtContacts.
Change the reference data.
2010-07-08 13:51:26 +08:00
Patrick Ohly
1e608a8be5 KCalExtended: fixed test registration
The KCalExtended tests were accidentally enabled in an ifdef checking
the file backend, so they were on even when the backend was off.
2010-07-01 16:59:04 +02:00
Patrick Ohly
26416d0c09 QtContacts: fixed test registration
The QtContacts tests were accidentally enabled in an ifdef checking
the file backend, so they were on even when the backend was off.
2010-07-01 16:58:07 +02:00
Patrick Ohly
bec626d756 QtContacts: fixed compile error when not enabling QtContacts
-lQtContacst -lQtVersit was added unconditionally to the link
line, thus causing link errors when the backend was disabled.
2010-06-30 17:37:28 +02:00
Patrick Ohly
352610c157 ZYB.com: service goes away end of June 2010, template removed (MBC #3310)
ZYB.com will be replaced with Vodafone 360, which we don't support (yet).
This patch removes the obsolete template for ZYB.com. The sync-UI still
has some strings for it, just in case that someone has an old template
around or runs it against an old syncevo-dbus-server.
2010-06-30 11:59:45 +02:00
Patrick Ohly
77a8d87410 syncevo-dbus-server: accept 'application/vnd.syncml+xml; charset=UTF-8' for starting an HTTP session (MBC #3554)
The redundant charset specification was set by the Funambol
Thunderbird client. Because of a literal comparison against
'application/vnd.syncml+xml' the messages were rejected.

This patch strips everything after a semicolon. None of the options
there should matter for SyncML.
2010-06-30 11:35:11 +02:00
Patrick Ohly
56bda141dc compile fix for FC 13 (and possibly others): use private copy of gdbus (MBC #3556)
SyncEvolution on FC 13 crashes because it conflicts with a different
system version of the gdbus library. Always linking statically fixes
this.

There never was an official upstream release of gdbus, so sharing the
implementation does not work.
2010-06-30 10:38:12 +02:00
Patrick Ohly
75e54e8a8a QtContacts: added error checking
None of these functions typically fail, but if they do, then
throw an exception.
2010-06-30 10:38:12 +02:00
Patrick Ohly
7cb798205d QtContacts: enabled more efficient listing of all items
Tell QtContacts to only fill in the minimal amount of information
needed in listAllItems: local ID (always set?!) and modification
time stamps.

Whether this really reduces the amount of information returned to
us wasn't tested, but it also does no harm.
2010-06-30 10:38:12 +02:00
Patrick Ohly
d1490b8b83 KCalExtended: avoid adding incidence anew
addIncidence() accepts an incidence which has the same
UID/RECURRENCE-ID pair as an existing incidence. But later on saving
that modified calendar fails.

It is the responsibility of the KCalExtended user to avoid this
problem, which is what this patch does. This is similar to
EvolutionCalendarSource, except that there adding an item fails more
gracefully with an "exists already" error.
2010-06-30 10:38:12 +02:00
Patrick Ohly
c60abbf543 QtContacts: provide description from database
For items in Synthesis the same approach as in EvolutionContactSource
is used (concatenation of first, middle and last name). For items in the
database, the QContacts::displayLabel() is used.
2010-06-30 10:38:12 +02:00
Patrick Ohly
b6701073e2 KCalExtended: provide description from database
This uses the same approach as EvolutionCalendarSource, except
that right now only VEVENTs are supported.
2010-06-30 10:38:12 +02:00
Patrick Ohly
6f379374c0 KCalExtended: implement backup/restore using SyncSourceRevisions
SyncSourceRevisions does everything that is needed. It can be used
by providing a dummy revision string for each item. This patch
then allows running testItems, which mostly works but also fails
because of some lost data.
2010-06-30 10:38:12 +02:00
Patrick Ohly
a3954e908f KCalExtended: sleep only if necessary
Sleeping for a second is necessary after changed were made, because
then the new time stamp after sleeping is truly larger than the
time stamps created during the sync.

This relies on some aspects of KCalExtended:
- time stamps are set during save()
- change tracking is inclusive (changes >= time stamp),
  which requires a patch to KCalExtended

Because saving has these side effects, it really has to be done
inside endSession(). Removed from close(), where it shouldn't
have had any effect anyway in valid use of the class.
2010-06-30 10:38:12 +02:00
Patrick Ohly
06cd72b102 KCalExtended: must preserve creation time during update
It is the responsibility of the application to ensure that the
right creation time is set for the updated item: preserve the
original one or use the one from the update date, if that is
set.

The correct behavior depends a bit on whether created() maps
to DTSTAMP or CREATED: CREATED has to be preserved unconditionally
(current code in KCalExtended) whereas DTSTAMP is conditional.
2010-06-30 10:38:12 +02:00
Patrick Ohly
5102273d90 KCalExtended: load incidences on demand
KCalExtended is able to list incidences after opening a calendar,
but it won't find them unless they are also loaded. Instead of
loading the whole calendar into memory, only load the individual
incidences that are needed for delete, extract or update purposes.
2010-06-30 10:38:12 +02:00
Patrick Ohly
4caa88801e KCalExtended: added initial SyncSource
Change tracking in this new source is based on the KCalExtended change
tracking functions. This deviates from the "normal" change tracking in
SyncEvolution (TrackingSyncSource and id/revision pairs) and thus
requires different inhertitance and initialization steps.

Like SyncSourceRevisions, the source needs to delay progress to ensure
that time increments between syncs. In contrast to
SyncSourceRevisions, this is done in a very simplistic way without
considering whether any changes were made. Better improve that
(refactor SyncSourceRevisions?), because it slows down testing. It is
also unclear whether the delay has to happen before or after taking
the time stamp for the next sync.

The code works well enough to pass some Client::Source
tests. Compiling it is a bit tricky because it is unclear how exactly
the KCalExtended header files will be installed. The assumption is
that eventually it'll be in a "kcal" directory.
2010-06-30 10:38:12 +02:00
Patrick Ohly
71e78d7282 QtContacts: be careful about which queries to use
"query-builder" controls how the qtcontacts-tracker backend
does certain things. I can be used to enable a new implementation
which is not the default yet.

For save, the new method is already the default in recent
qtcontacts-tracker, but it doesn't hurt to enable it explicitly.  For
fetch, the new method is not the default, but it is needed by us
because without it, the last modified time stamp is not fetched.

We must *not* use query-builder=all, because the new method of
deleting contacts is known to be broken and doesn't do anything.
2010-06-30 10:38:12 +02:00
Patrick Ohly
f84a61d4b0 QtContacts: added simpler removeItem() implementation
The simpler version uses the synchronous removeContact().
Added because the asynchronous one didn't really delete
the contact. But it seems the synchronous one has the
same problem.
2010-06-30 10:38:12 +02:00
Patrick Ohly
fb441e3b93 QtContacts: ignore artificial contact
There's apparently always an artificial contact with a special
number as ID. It doesn't have a last modified value. Ignore this
contact.
2010-06-30 10:38:12 +02:00
Patrick Ohly
697e2659c6 QtContacts: use new save/fetch mechanism (supports time stamps, but currently broken) 2010-06-30 10:38:11 +02:00
Patrick Ohly
3e34da67e3 QtContacts: use proper QContactTimestamp template member detail function 2010-06-30 10:38:11 +02:00
Patrick Ohly
a61d91b940 QtContacts: first complete (but not usable) backend
Import/export is done via QtVersit.

Compiling it expects QtContacts/QtVersit in the same path as the rest
of Qt.
2010-06-30 10:38:11 +02:00
Patrick Ohly
d9a5d1de4f QtContacts: initial, empty implementation
This patch adds the necessary files to write a backend for
QtMobility's QtContacts storage. At this point, compilation
succeeds but the implementation does not do anything useful.
2010-06-30 10:38:11 +02:00
Patrick Ohly
d4594d6c4e command line: fix --print-items description luid handling
The luid in --print-items also needs to be demangled before
passing to the source.
2010-06-30 10:37:51 +02:00
Patrick Ohly
3db8fc1eac command line: allow temporary configs in import/export operations
Temporary source properties are needed when the config does not
exist. This patch sets them before creating source nodes and
documents this behavior.
2010-06-30 10:37:51 +02:00
Patrick Ohly
300952c4ef command line: fix for new update/delete operations
Local IDs were not decoded before invoking the underlying SyncSource
operation. As a result, it failed with "item not found" errors for
those items which really had special characters in their IDs.
2010-06-30 10:37:50 +02:00
Patrick Ohly
3c3532c280 command line import/export: failed for non-peer configs
Besides the issue with reading the "type" (MBC #3157),
operations like "--print-items @some-context addressbook"
also failed because the TrackingSyncSource would try to write
updated id/rev pairs into a DevNullConfigNode, set because
there is no tracking node in @some-context.

DevNullConfigNode does not allow writing. This patch uses
a set of config nodes where the tracking node is volatile and
allows writing.

The additional benefit also for peer configs is that the SyncSource
can no longer overwrite the change tracking for that peer
accidentally because it never gets access to that node.
2010-06-30 10:37:50 +02:00
Patrick Ohly
6ff8f4ff0c config fix: operations on non-peer configs failed (MBC #3157)
When running operations on a non-peer configuration (like --restore @default
addressbook), the operation fails with
[ERROR] <source name>: type 'select backend' not supported

The root cause is that the "type" property was read from a virtual, empty peer
node. MultiplexConfigNode already handled this by falling back to the non-peer
node.

The same special case also needs to be added to SyncSourceNodes::getNode().
2010-06-30 10:37:50 +02:00
Patrick Ohly
ebe8078624 command line --print-items: added short description
SyncSourceLogging has a functional getDescription() method
in many backends that works with only the local data; use
that to extract a description.
2010-06-16 11:05:19 +02:00
Patrick Ohly
42e3588099 command line: added --delete-items
This complements --import/update/export/list-items. --remove was
already taken, for deleting a configuration.

Because the removal is done via the normal m_deleteItem operation, we
inherit the normal SyncML behavior (logging, no error return code for
non-existent items). It would have been nice to let the user choose
how to handle that situation (like --force in rm), but that can't be
done without SyncSource API changes.
2010-06-16 11:05:19 +02:00
Patrick Ohly
91e4b47931 command line: added --import/export/update/print-items
These operations provide a common interface for manipulating
databases supported by SyncEvolution backends. --delete is
an obvious gap, will be added soon.

The implementation supports all backends offering the SyncSourceRaw
interface (Evolution, Akonadi, XMLRPC, file, but not the sqlite demo),
which is determined via a dynamic cast. SyncSourceRaw is necessary
because it allows direct access to the native data format without
going through the Synthesis engine.

Because the Synthesis engine is not activated, printing the short
description (SyncSourceLogging interface) mentioned in the README.rst
is not possible yet. Having such an engine would be useful also for
importing/exporting data which is not in the native format of the
backend; additional command line parameters will be needed to define
that format.

All of the new operations have in common that they work on one source
and multiple LUIDs. This is a slight deviation from other command line
synopsises where all arguments after the server config refer to sources.
The new m_accessItems flag is set for these special operations; they
also share much of the setup code.

The implementation itself tries to use the generic SyncSource
interface as much as possible. It only falls back to more specialized
implementations where necessary (SyncSourceRaw).

The builtin synopsis and usage was intentionally not updated. The
expection is that before this patch lands in the "master" branch, the
builtin text will come directly from README.rst (which was updated).
2010-06-16 11:05:11 +02:00
Patrick Ohly
c0d56d3161 SyncContext:readStdin(): a virtual method for reading input via stdin
The new method is needed for importing item data from stdin, a new
feature for the command line. The default implementation which is
used when executing the command line locally reads from std::cin
directly.

The syncevo-dbus-server would have to ask its client for the data;
this hasn't been implemented yet. To catch the problem and inform
the user, an exception is thrown there.
2010-06-16 11:05:10 +02:00
Patrick Ohly
3df4855bdd Cmdline::isSync(): cosmetic change
Instead of repeating "return false" multiple times, use one if/else check.
2010-06-16 11:05:10 +02:00
Patrick Ohly
32463d532f command line parsing: check for conflicting operations
Previously, it was possible to list several different operations
on the command line ("--version --configure --run ..."). SyncEvolution
then picked one of them in (for users) unpredictable ways.

Now all requested operations are gathered while parsing the command
line and the tool aborts with an error message listing all of them
if more than one is given.
2010-06-16 11:05:10 +02:00
Patrick Ohly
b58d7cab5c ReadFile(): added reading from open stream
Useful for reading from std::cin.
2010-06-16 11:05:10 +02:00
Jussi Kukkonen
2eeefbf723 gtk-ui: make "Sync now" always translatable (MBC #3052) 2010-06-14 17:34:33 +02:00
Patrick Ohly
a1f7f56914 D-Bus API doc: fix for 'make dist'
The .html version should have been only installed, not distributed
as part of the source:
dist_doc_DATA => doc_DATA

That broke when using "make dist" without --enable-doc.
2010-06-09 11:47:50 +02:00
Patrick Ohly
a6957404c6 Doc: enhanced D-Bus API documentation (MBC #1745)
Updated spec-to-docbook.xsl and the documentation in the .xml
files to improve formatting (added lists and paragraphs).

Added README explaining how this formatting works.

The updated spec-to-docbook.xsl no longer produces <reference>
elements in its output, which broke mergepages.xsl. Replaced
with some shell commands which concatenate the <refentry> elements
in a larger <reference> element with a title that also includes
the version.

Cross-references between the different APIs would be nice,
but don't work with the current spec-to-docbook.xsl (because
it only processes one API at a time?). Perhaps merge original
.xml files into one, then produce documentation? Nope, didn't
work. Seems that spec-to-docbook.xsl can only handle one interface
per file.
2010-06-08 17:20:14 +02:00
Zhu, Yongsheng
3c307b04dd Doc: add '--enable-doc' option and generate D-Bus API doc(MBC #1745)
'--enable-doc' configure option is newly added to control
generation of API documentation for backend public API
and D-Bus API. The default value is 'no'.

D-Bus API html documentation could be generated and all
pages(currently 3 docbook files) are merged into one single
html page called 'syncevo-dbus-api-doc.html'. To dynamically
generate 'version' of syncevolution into the html page, a placeholder
'##VERSION##' is used and changed in the generation.
2010-06-08 17:20:14 +02:00
Patrick Ohly
c8af3d4c94 D-Bus Qt bindings: remove annotations for glib
The <annotation> element is not accepted by the binding tool for
glib. Remove them as part of filtering out <doc:*> elements.
2010-06-08 17:06:55 +02:00
Carl Wong
fd072afd7c D-Bus binding for Qt
This patch adds annotations as needed by Qt D-Bus support.
For some of the more complex methods, additional types are
defined.
2010-06-08 17:06:33 +02:00
Patrick Ohly
4989a8ce6f SyncConfig::getUseProxy(): avoid TRUE/FALSE (MBC #10506)
TRUE/FALSE are defines that may or may not be set. Better use the C++ true/false.
2010-06-04 16:31:48 +02:00
Patrick Ohly
8a1c26e3d2 sync-ui: renamed local sync() to do_sync() to avoid name collision with system sync()
As reported by Peter Robison, the source code no longer compiles on
Fedora Core 13. The root cause is a name collision of a static
function with the previously defined system call sync().
2010-06-04 08:03:49 +02:00
Zhu, Yongsheng
ad361f365d LogDirTest: save and restore logger level (MBC#2570)
4 cases in LogDirTest classes are failed due to logging ouput
missing. The root cause is that the 'session' function in LogDirTest
sets the top logger as 'INFO' level and thus the testing output of
'DEBUG' info can't be written in the log file. Thus nightly testing
can't check the result.
The solution is to save the logging level before creating a new session
and restore it again when completion.
2010-06-01 08:13:23 +02:00
Patrick Ohly
2bdda6ae27 lcs: fixed out-of-bounds array access (MBC #1007)
Found by valgrind: the cost function is called with indices just
outside the array, causing it to read unitialized (and potentially
unavailable) memory.

Calling it like this is intentional, as the original LCS algorithm
works like that. The cost function has to map access outside of the
array to the cost at the boundaries. It also has to handle empty
arrays.
2010-05-31 12:44:55 +02:00
Patrick Ohly
912c52e370 HTTP SyncML server mode: fixed crash when handling second session
This problem is specific to SyncEvolution running as HTTP server:
when a second session is requested, SyncContext::analyzeSyncMLMessage()
creates a second sync session that is active temporarily instead
of the main one. This is necessary to detect when the same peer
connects again.

The static m_sourceListPtr was not reset properly by that function,
causing the main session to fail later on when reading it. This patch
solves the problem by making m_sourceListPtr a normal member of
SyncContext and relying on m_activeContext instead to find the current
source list.
2010-05-27 15:33:06 +02:00
Patrick Ohly
0d48a79733 output redirection: detect glib output despite app name
When an application name is set (as introduced for client-test
by some recent changes), testing against "** (process:" as glib
prefix is insufficient, because "process" will be replaced by
the actual application name.

This was detected by the unit tests. This patch fixes the problem
by relaxing the glib testing (check for "** (" prefix and " **:")
and extends the unit test.
2010-05-27 14:21:46 +02:00
Patrick Ohly
b4865677f5 syncevo-dbus-server: first sync was done without libical time zone info (MBC #2435)
If (and only if) compiled with --enable-evolution-compatibility (as
the binaries on syncevolution.org), libical was only pulled into the
syncevo-dbus-server as part of running a sync. That was too late for
libsynthesis, which had already checked for libical earlier in that
sync session.

All following sync sessions then used libical time zone information.

The effect of not having libical time zone information were occasional
mismatches of time zones.
2010-05-26 18:47:46 +02:00
Zhu, Yongsheng
b92b017407 D-Bus server + command line: return error code when failed(MBC #2193)
When logdir can't be accessed, SyncContext handles the error and returns
an error status and command line only returns a false flag. So D-Bus
server has to handle the 'false' flag and throws an exception to
indicate this error to clients.
2010-05-18 08:46:37 +02:00
Zhu, Yongsheng
d32026ead2 config: add 'calendar+todo' source for nokia configs (MBC#2101)
Templates for Nokia phones all have the same problem we stated
in bug#2101. So change them all by adding the source.
2010-05-18 14:19:44 +08:00
Zhu, Yongsheng
b5903618be config: add 'calendar+todo' source for nokia7210c config (MBC#2101)
sync-ui can't create correct config for nokia s40 series phone
because config.ini doesn't include 'calendar+todo' source.
Add it now and then the config is correctly used to sync.
2010-05-18 12:45:10 +08:00
Patrick Ohly
2915fde0e7 Funambol, Memotoo: preserve meeting series when receiving update for detached recurrence (MBC #1916)
The RECURRENCE-ID is not preserved by these servers and also was not
preserved by SyncEvolution or Synthesis, because the servers do not
send CtCap information. As a result, updating a detached recurrence (=
a single instance in a meeting series) overwrote series in Evolution
and only left the updated recurrence.

This patch fixes that problem by copying the original RECURRENCE-ID
property from the original event which is to be updated. This is only
done when necessary, because it has to read the original event.
2010-05-17 12:19:04 +02:00
Patrick Ohly
f8c3f9bb0e EDS compatibility: added several recurrence ID related methods (MBC #1916)
Most of these methods are needed by the patch which fixes MBC #1916.
Some were added as part of experimenting with the solution and were
kept because they might be useful in the future.
2010-05-17 12:19:04 +02:00
Jussi Kukkonen
b9fd541cea gtk-ui: explicitly set names for glade widgets (MBC #1372)
GtkBuilder no longer sets widget name based on ui definition id. This
breaks name-based styling on all widgets originating from Glade, as
Glade does not take the GtkBuilder change into account.

Work around this by explixitly setting the widget names for the widgets
that are referenced by name in the rc-file.
2010-05-11 20:03:55 +02:00
Jussi Kukkonen
c12057d981 gtk-ui: update toolbar style for MeeGo 1.0 (MB #1970) 2010-05-11 20:03:44 +02:00
Patrick Ohly
967f0a8b2c client-test: added test case for broken VTIMEZONE matching (MBC #1332)
client-test now accepts test case files like ical20.ics.<server>,
without the .tem suffix. This is used for testing the problematic
VCALENDAR items from MBC #1332, like this:
CLIENT_TEST_SERVER=local ./client-test Client::Sync::ical20::testConversion

Because "local" is not a recognized server, one has to set the syncURL
in the created "local_1" config before the test runs.
2010-05-04 22:05:15 +02:00
Patrick Ohly
7046f6bc51 SyncContext: accept progress events in server mode (MBC #1359)
The latest Synthesis engine also emits progress events in server mode.
Before this patch, the events were ignored because the code was
conservative about not relying on something not supported. Now
client and server mode report and record progress and statistics
the same way.
2010-05-04 15:36:00 +02:00
Patrick Ohly
581551d5ff Nokia E55: needs absolute alarm times (MBC #1657)
As discussed on the mailing list, the Nokia E55 needs alarm times
in UTC. This rule enables that, using the mechanism introduced
earlier for Mobical.
2010-05-04 09:48:54 +02:00
Patrick Ohly
f7f0bee61b templates: skip over temporary files (MBC #1208)
After switching to files for template, temporary files as
created while editing a template file were also read as templates,
leading to duplicate templates (one old, one modified).

With this patch, invisible files starting with a dot and backup
files ending in a tilde are ignored.
2010-05-04 09:39:20 +02:00
Patrick Ohly
8e759d4d59 templates: also search in .config/syncevolution-templates (MBC #1208)
With this patch, template files are also found in
.config/syncevolution-templates (or the corresponding directory
pointed to by the XDG env variables).

The tests had to be adapted a) to not find templates installed
by the user in his own home and b) to cover finding templates
via XDG_CONFIG_HOME.
2010-05-04 09:39:20 +02:00
Patrick Ohly
29e0b8eac1 templates: use single-file format (MBC #1208)
This patch switches reading of templates on disk from the previous,
one file per .ini file format to the single-file format produced
by the syncevo-phone-config utility. This makes creating templates
much easier, also when using just an editor instead of the tool.

The existing Cmdline tests cover this code pretty well, as demonstrated
by the number of fixes that were necessary in the previous patches
when running the tests. Therefore it should be safe to use this in
SyncEvolution 1.0.
2010-05-04 09:39:20 +02:00
Patrick Ohly
006bcf2603 single file format for multiple .ini files (MBC #1208)
This patch adds the infrastructure for reading a single file
which contains multiple separate .ini files. Writing is not
implemented.

The Ini*ConfigNode classes are derived from the File*ConfigNode
classes and could replace those. The only reason for not doing
this right away is that the master branch is in code freeze in
preparation for 1.0. Removing File*ConfigNode and replacing
their usages should be done after the release.

The SingleFileConfigTree implements the splitting of the single
file into independent pieces. It instantiates IniFileConfigNodes
with in-memory access to the actual data, using the new classes
introduced for this case in the previous patches.

SingleFileConfigTree could also use other ConfigNodes, but that kind
of flexibility is not needed yet and also would require rethinking the
way how the single file is split. Right now the separators ("===
.... ===") are known to not occur in the individual pieces.

Like the FileConfigTree, this class must be able to preserve
nodes which were created without flushing the tree afterwards.
This is done when reading from a read-only template, which may
add new nodes or modify existing ones in memory.
2010-05-04 09:39:20 +02:00
Patrick Ohly
663939976a StringDataBlob: read/write shared string in memory
This class works with a string whose ownership is shared with
others. The goal is that this will avoid copying strings around.

Right now, writing into that string is not implemented, because
only reading from an existing string is needed for the single
.ini file use case (MBC #1208).
2010-05-04 09:39:20 +02:00
Patrick Ohly
8b2503ddc6 ConfigNode: moved ConfigNode::createFileNode() into separate file
Moved ConfigNode::createFileNode() into ConfigNode.cpp where it
belongs. Moving it now allows us to replace FileConfigNode.cpp
later on.
2010-05-04 09:39:20 +02:00
Patrick Ohly
50101688df DataBlob: abstract access to chunks of data
The goal of the DataBlob base class is encapsulating read/write
access to permanent data storage *on demand*. Comparing it to
files, it is more like a path name than a file handle.

boost::shared_ptr are used a) because it automates deletion of
the actual data streams and b) some implementations of DataBlob
might have to share access to these instances.

One possible implementation (included in this patch) is indeed
a plain file. It writes into a temporary file and only renames
it to the final path name on success, which emulates the behavior
of the FileConfigNode. The actual implementation of this renaming
was moved into a separate class, the SafeOstream.

Another (to be added later) is a chunk of data inside a larger file.
This is needed for embedding different .ini style files inside
one large text file, as required for MBC #1208).
2010-05-04 09:39:19 +02:00
Patrick Ohly
6144231589 util: getBasename()/getDirname()/splitPath()
Added functions to split a full path name into its components.
The base name is implemented as in the "basename" utility,
i.e., the trailing slash in "foo/" is ignored, leading to "foo"
as base name.
2010-05-04 09:39:19 +02:00
Jussi Kukkonen
1f60171e53 gtk-ui: preserve configuration names on save (BME #1266)
use the name of a saved config (and not the the template) when saving
the config again.
2010-05-03 15:24:41 +03:00
Jussi Kukkonen
d4e05b2531 gtk-ui: put emergency view in scrolledwindow (BME #1296)
Use a vertical scrollbar when needed.

The commit looks extensive, but it's just glade re-indenting
everything inside the scrolledwindow.
2010-05-03 15:24:41 +03:00
Patrick Ohly
07d0455bbe SAN message: typo fix in text/calendar => text/x-vcalendar mapping (MBC #1197)
The Sony Ericsson K750i accepts "text/x-vcalendar" as type in the SAN message,
but not "text/calendar". We had code which was supposed to map to the older
type, but due to a typo ended up sending "text/x-calendar", which is rejected.
Fixed.
2010-04-28 08:06:57 +02:00
Patrick Ohly
ea3fafe99c syncevo-phone-config: let CTRL-C really abort syncevolution (MBC #1197)
The signal handler in syncevolution interpret CTRL-C as suspend
request. When invoked by syncevo-phone-config, that is not what is
intended by the user and usually had the effect that a sync session
failed without flagging the abort request, thus keeping the script
running.

This patch adds SYNCEVOLUTION_NO_SYNC_SIGNALS, which prevents
installing the signal handlers, and uses that in the script.
As a result, CTRL-C leads to "aborted prematurely", for which
a test was added earlier.

Because syncevolution has to do no cleanup work, aborting it
like this is okay.
2010-04-28 08:06:57 +02:00
Patrick Ohly
c8fc51cdbb syncevolution --version: missing infos about system shared libs
As reported on the mailing list, "syncevolution --version" does not
report about compatibility with shared system libraries (like "using
libecal-1.2.so.7") when using the daemon *and* no sync sessions has
been started.

The root cause is that the daemon does not initialize the system
compatibility when processing the "--version" command line. Once
something else does that, "--version" produces the correct output.

This is only a cosmetic issue, fixed by always initializing when
providing information.
2010-04-26 13:49:42 +02:00
Jussi Kukkonen
92e830be27 gtk-ui: set "settings"-btn insensitive when syncing (MB #10482) 2010-04-20 11:34:07 +03:00
Chen Congwu
9cd5fd44c2 Ovi template: disable certificate checking
This is the same workaround as we already done for Google
2010-04-20 09:22:10 +08:00
Patrick Ohly
10bcfe2812 auto sync notifications: avoid extra "Dismiss" button (MB #10487)
mutter-moblin automatically adds that button itself. Because it didn't
recognize that we also add it ourselves, we ended up with two buttons
called "Dismiss".

The way to avoid this and having a "Dismiss" button in other environments
is to use the ID "default" for our "Dismiss" button, then it'll be ignored
by mutter-moblin.
2010-04-19 16:35:00 +02:00
Patrick Ohly
2f338473b0 Ovi.com: fixed typos
The "todo" source used "Calendar" and thus would have synchronized events.

The spelling for the "calendar" type was inconsistent (capital "C").
2010-04-19 16:32:58 +02:00
Patrick Ohly
443a3b5925 command line, client-test: avoid "g_set_application_name not set" warning
When glib logging is invoked, it check the application name and complains
if not set:
** (process:10130): WARNING **: g_set_application_name not set.

With output redirection we hide this in the command line, but it
showed up in client-test when the system was in a state were another
glib WARNING was triggered.

This patch sets the unlocalized program name instead of using a
localized application name, because we don't have and don't need
localization for these two programs. That seems to satisfy glib.
2010-04-19 16:29:49 +02:00
Patrick Ohly
f0e0c4c373 client-test: enable it to use keyring by default (MB #10479)
With "syncevolution" using the D-Bus server and thus the keyring
by default, the client-test executable should better also use
the keyring. Otherwise setting the password via the command line
will render a test config unusable for client-test.

The patch turns out to be very easy: reusing the code in
CmdlineSyncClient via changing the inheritance of the sync engine used
by client-test-app.cpp plus adapting compile flags is enough.
2010-04-19 14:38:27 +02:00
Patrick Ohly
4d5a1ba273 RetryInterval: 0 for Funambol, 2M for everyone else (MB #10451)
A user reported that the default 1 minute resend interval did not work
for him with his own Funambol server installation. The Funambol
developers are notified, but won't be able to do much about this
in the near future.

Therefore this patch disables message resend in the Funambol server
template. Existing configurations have to be updated manually, both
to suppress the resending and to enable it again later.

The default resend interval is also increased from 1 minute to 2
minutes, to help other slow servers which might have problems handling
resends when they arrive to quickly.
2010-04-19 14:06:55 +02:00
Jussi Kukkonen
1404b78d9a gtk-ui: fix mx-gtk >= 0.99.1 header location (BME #892) 2010-04-19 11:49:05 +02:00
Chen Congwu
1022e21494 Test tools: automatically detection working configuration for a phone (MB#9862)
This is a python script that tries with all possible configuration
combinations for a phone, once found the corresponding configuration and
the configuration template can be generated.
The script is installed as 'syncevo-phone-config'
2010-04-19 11:35:40 +02:00
Chen Congwu
5ae423953c noctcap: Do not send ctcap properties when set SYNCEVOLUTION_NOCTCAP
Some phones might have problem in understanding the Ctcap sent from
SyncEvolution and will leading later syncing problems. Setting the
environment variable will suppress sending ctcap from SyncEvolution
side.
see:
http://lists.syncevolution.org/pipermail/syncevolution/2010-February/001005.html
2010-04-19 11:35:40 +02:00
Chen Congwu
752a234872 Test: Also register file:calendar+todo test for file backend
Since we support both evolution and file backend for supported test
case in client-test.
It might be useful running client-test with calendar+todo test cases
using file backend. (It supports evolution backend only without this
patch).
2010-04-19 11:35:40 +02:00
Patrick Ohly
f035d85aee D-Bus API: added templateName to documentation (MB #10406)
The "templateName" property was added earlier as part of MB #10406.
This patch documents it in the D-Bus server API.
2010-04-19 11:30:55 +02:00
Zhu, Yongsheng
51a0843dcd D-Bus doc: refine spec about Bluetooth device support for GetConfigs
Add more statements to specify how dbus server works for
checking Bluetooth devices and how templates are created for
them.
2010-04-16 11:07:01 +08:00
Patrick Ohly
32a5810182 LogRedirect: redirecting STDOUT to log level SHOW broke the tests
The tests were still expecting the output to appear at level INFO.
They also didn't properly flush the (now) buffered stdout logging.
Added a test which check for this particular feature.
2010-04-15 16:51:55 +02:00