Commit graph

1796 commits

Author SHA1 Message Date
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
Patrick Ohly
8dea93eccb SecondsConfigProperty: accept "+" sign in duration and interval properties again
Actually found by unit test. The recently introduced check for a valid
digit before unit characters was also applied to + and should have.

Also added a test case for an invalid unit character without digit.
2010-04-15 16:50:13 +02:00
Zhu, Yongsheng
f774bfb368 command line + D-Bus: pass known environment variables (MB#10477)
When running command line arguments in dbus server, it is necessary
to pass environment variables in the command line environment.
The temporary solution is just to collect possible used environment
variables to dbus server. To support it, a new argument of dbus
method 'Session.execute' is added to pass the map of environment
variables.
2010-04-15 11:19:51 +02:00
Jussi Kukkonen
9259c9e193 templates: add N85 (Nokia S60) template 2010-04-14 13:58:45 +02:00
Patrick Ohly
5d462f57ea vCard profile: hide X-EVOLUTION-UI-SLOT in DevInf for Nokia N85 (MB #8868)
When we declare X-EVOLUTION-UI-SLOT as parameter in our DevInf, then
the N85 doesn't send telephone and email addresses to us. It seems to
get confused about what this unknown parameter is and then disables
the properties it is declared for.

As a workaround, do not "show" the parameter (per-parameter Synthesis
config option), but keep using it. The implication of that change is
minimal. The X-EVOLUTION-UI-SLOT value is used to preserve the order
of entries in the Evolution GUI. Declaring that our client supports
the value is only relevant when not sending it (because then a server
knows that it can drop its own value), but because we always send it,
we don't need to declare it.

In theory, a peer might avoid sending this value to us if we don't
declare it. In practice, peers are not that sophisticated, for good
reasons (like peers not declaring all of their properties). Synthesis
itself definitely still encodes the value even if not declared by
its peer.
2010-04-14 13:58:45 +02:00
Zhu, Yongsheng
5113364ea1 sync-ui: don't use built-in specialized types (MB #10471)
The version of default dbus-glib package is 0.80 on Ubuntu 9.10.
This version has bugs of specialized types which prevents sync ui
using specialized types. So the fix is to define our used types
instead of predefined specialized types of dbus-glib.
2010-04-14 10:50:28 +02:00
Zhu, Yongsheng
4cd3a2f913 dbus server + command line: return error code (MB#10476)
If there is any error during executing command line arguments in
dbus server, it should catch the exception and set the error code
in the Status. Thus command line can judge the error code and
return the correct value to system.
2010-04-14 10:46:35 +02:00
Zhu, Yongsheng
3da3a388cc DBus server: abort when user didn't provide password (MB#10475)
When user didn't provide password, sync ui sends a hash without
'password' key-value pair in the response. Abort the current sync
process under this situation.
2010-04-14 14:51:53 +08:00
Jussi Kukkonen
03f649c459 gtk-ui: fix crasher and wrong UI state (MB #10473)
Going to configuration view and back without selecting any
configuration would set "sync now" button sensitive. Clicking
the button would crash the ui.

This commit fixes both issues.
2010-04-13 16:42:56 +03:00
Zhu, Yongsheng
8fc6808b11 Cal + Mobical: apply the workaround only for Mobical (MB#10458)
Only apply conversion of alarm time to UTC time when server is
Mobical.net. The way is to define a global flag and set the flag
when 'remoterule' of 'Mobical' is matched.

The global flag is declared as a context variable and the script
reads it via built-in function 'SESSIONVAR'.
2010-04-13 09:44:06 +02:00
Zhu, Yongsheng
63621f6804 Calendar: add workaround for 'alarm' in vCalendar1.0 (MB#10458)
Mobical.net syncML server only accepts 'trigger' time
of alarms as 'UTC' time. If 'trigger' time is a duration,
it ignores that.

To prevent this, when the outgoing format is 'vCalendar1.0',
convert the duration time into 'UTC' time.
2010-04-13 09:44:06 +02:00
Patrick Ohly
bc2908a39f vCard profile: disable Synthesis iPhone client TYPE extensions (MB #10462)
These extensions are useful when acting as server for a Synthesis iPhone
client, because then the server can preserve them.

But they are also confusing Evolution when vCards are imported with
these extensions are set. For example, an
ADR;TYPE=X-Synthesis-Ref0;TYPE=HOME is not shown as home address in
the GUI.

The correct solution would be to disable the extensions only when
writing into Evolution. We cannot do that due to technical limitations
("rule" parameter only works on properties).

So as a short term solution, choose the lesser evil and comment
out the extensions. Making Evolution work right is more important
than incremental enhancements of the server.
2010-04-09 18:05:13 +02:00
Jussi Kukkonen
cd65c118c6 templates: set N900 as consumerReady (MB #10336)
We want the N900 template to show up in the UI
2010-04-09 14:55:44 +03:00
Jussi Kukkonen
e8127ae836 gtk-ui: never show non-consumerReady templates (MB #10472) 2010-04-09 14:55:44 +03:00
Patrick Ohly
316080d3ff dbus C++ bridge: fix inconsistent CallbackData instantiation
The recent change of the first CallbackData constructor broke
some code which still passed the old type.
2010-04-09 13:55:09 +02:00
Zhu, Yongsheng
bc7de8351d gdbus c++: fix an issue of DBusClientCall exposed by valgrind (MB#10468)
The issue is to access an invalid memory. The reason is that:
DBusClientCall creates a CallbackData for each dbus call. The
CallbackData itself references the DBusClientCall object. This
object is used to get returned value once the dbus call returns.

However, the typical usage is that DBusClientCall object
is a local variable allocated on the stack. So it is invalid after
existing the stack frame. If using this object in the dbus call
handler, cause a severe problem of reading invalid memory.

The solution is to store an always alive connection object in the
CallbackData instead of DBusClientCall object.
2010-04-09 09:52:07 +02:00
Jussi Kukkonen
5589ba9d5d gtk-ui: fix device template autoselection (MB #10469)
A template in the device configuration template list can currently get
autoselected even if there are several templates with equally good scores.
2010-04-09 10:18:57 +03:00
Zhu, Yongsheng
834d3cfb4d dbus api: change the signature of 'handler' of 'InfoRequest'
Currently the signature of argument 'handler' of 'InfoRequest'
is 's' on dbus server and sync ui. However, in the dbus api document,
its signature is still 'o'. Change it.

The reason for using a string and not an object path is that
when sending the initial request, the parameter has to be
empty. "" for a string is valid, but seems to be problematic
for an object path.
2010-04-09 08:52:30 +02:00
Zhu, Yongsheng
dc95612eec cmdline: fix password hang (MB#5043)
When passwords in the config are not set, the daemon asks them from
clients like command line. Command line should react and let
user input passwords and then send responses to the daemon.

Command line listens to 'Server.InfoRequest' signal and only handles
password requests from sessions created for command line in the daemon.

If command line dies in the process of inputting passwords, the daemon
always waits for it so expand current timeout mechanism into this
process. Otherwise, the daemon waits permanently.
2010-04-09 08:52:26 +02:00
Zhu, Yongsheng
cae8cb485a command line: fix a regression checked by nightly
There is a regression caused by a string exception
"basic_string::_S_construct NULL not valid". This is because
I push back a non-existing string into vector when collecting
converted command line arguments.
2010-04-09 11:24:03 +08:00
Patrick Ohly
76a1557232 command line + D-Bus: fix for "some parameters are already handled by parse()" (MB #5013)
The criteria for not invoking Cmdline::run() was a bit too broad.
For "--template ?", "--help", "--version", "?", "--print-servers" no
output was produced in --daemon mode.

Perhaps the whole m_dontrun logic should be updated. In order to
minimize changes, this patch only duplicates the Cmdline::run()
logic.
2010-04-07 18:23:33 +02:00
Patrick Ohly
67b1c0a599 command line + D-Bus: fix for "pass absolute paths to dbus server" (MB #10461)
argv[0] is skipped by Cmdline::parse(), therefore wasn't added to
the updated argument list for the D-Bus, which then basically
ignored the first command line parameter.
2010-04-07 18:21:54 +02:00
Zhu, Yongsheng
867b286a8e command line + D-Bus: pass absolute paths to dbus server (MB#10461)
Convert relative paths into absolute paths before passing arguments
to dbus server because command line and dbus may have different working
directory.
Leave this kind of task in Command line for it knows the meaning of
parameters and convert them if necessary.

Add a new function 'relToAbs' to convert a relative path to a
canonicalized absolute path.
2010-04-07 13:53:24 +02:00
Zhu, Yongsheng
c7788bc0ce command line + D-Bus: throw exceptions once 'Execute' gets errors (MB#10461)
Previously it is supposed the arguments passed to d-bus are valid.
This seems not good as there are always some unpredictable issues.
Throw exceptions when parsing them encoutering errors.
2010-04-07 13:53:24 +02:00
Zhu, Yongsheng
069a38d980 D-Bus: add description for 'Session.Execute'
Description of 'Session.Execute' is added into the dbus api
document of session.
2010-04-07 13:53:24 +02:00
Zhu, Yongsheng
9319882432 Config: preserve type when getting config from a template (MB#10448)
When getting config of a template in a context, configs in the
context are applied in the returned configs except 'type' property
of sources. 'type' property should be preserved from the template.
It's a special case.
2010-04-07 08:19:02 +02:00
Patrick Ohly
a3f4a06e95 D-Bus API: allow reading template for non-existent context (MB #10448)
A client which wants to create a new config in a non-default context should
always use
   config = GetConfig("<template>@context", true)
   <make changes>
   SetConfig(config)
to ensure that shared properties in that context are preserved.

A client shouldn't have to check whether that context exists. If it doesn't,
the server should simply ignore the context and use the default values from the
template.

This patch adds a test for this, based on the "type" property. The expectation
in the test that the "type" is preserved literally is wrong. "type" currently
must not be preserved, because different templates may have to set
different data formats (MB #10443).
2010-04-07 08:19:02 +02:00
Patrick Ohly
745f6eb32d command line + D-Bus: some parameters are already handled by parse() (MB #5043)
Things like "--sync-property ?" are handled by Cmdline::parse(), producing
output as the parameters are parsed. In this case, running the command line
again in the D-Bus server duplicates the output (once locally, once in the
server).

This patch adds a check for it, similar to the one in Cmdline::run() itself.
2010-04-01 15:57:42 +02:00
Patrick Ohly
822931c1e7 LogRedirect with streams: better error handling (MB #5041)
When using streams, the caller of process() expects that once
the function returns, the streams were read until their end,
so that waitpid() will return eventually without deadlocking.

When an error occurs, this is not guaranteed, so we should
better return via an exception. Execute() was already
prepared for that.
2010-04-01 15:23:29 +02:00
Patrick Ohly
26b48c4cd8 LogRedirect + Execute(): use SOCK_STREAM to detect EOF (MB #5041)
As mentioned in the previous commit, SOCK_DGRAM does not allow us
to detect that the write has closed its ends of the socket pair.
This patch switches to using SOCK_STREAM, which gives us that
feature.

pipe() would also have worked, but with SOCK_DGRAM less code needs to
be changed and it is possible to switch back to SOCK_DGRAM (for
experiments) via a define.

The logic of processing data is different when in "streaming" mode:
process() always fills the chunk of default size 1024 with as much
data as possible, then processes it. For stdout this works well,
because line breaks are preserved before feeding into the logging
system.

With stderr there's an increased risk that lines a split, but right
now no code uses streaming mode for stderr, so that doesn't matter
at all.
2010-04-01 15:23:29 +02:00
Patrick Ohly
469498c2ec LogRedirect + system(): avoid loosing output (MB #5041)
LogRedirect is intentionally written around lossy UDP communication:
when system() starts a command that produces lot of output, the kernel
drops data instead of deadlocking us (system() command blocked in write,
our process blocked waiting for command).

When we know that a command might produce much output *and* we redirect
output, we need a more intelligent replacement for system(). This patch
introduces Execute() for that purpose.

It reuses much of LogRedirect code. LogRedirect has a new constructor
which creates the pipes and then handles the output like it normally
would, except that the pipes are Unix domain datagram sockets and the
instance itself doesn't modify the global state of the parent (doesn't
register itself as logger, doesn't touch FDs 1 and 2).

Unix domain datagram sockets seemed like a combination of a lossless
connection with data boundaries, which has the advantage that the
existing process() code can be reused. When experimenting with
LogRedirect originally, it was observed that domain sockets did
deadlock when writing more than reading.

The problem with this patch is that Unix domain sockets do not flag
that there is no writer anymore. Therefore LogRedirect::process()
cannot detect when it should return.
2010-04-01 15:23:19 +02:00
Patrick Ohly
a013253d0e syncevo-dbus-server stdout: split at lines (MB #5042)
syncevo-dbus-server is the first usage of LogRedirect which also
redirects stdout. In turn, the main usage is catching of "synccompare"
output. It turns out that the assumption for stderr so far that writes
are atomic doesn't hold for stdout of synccompare. Lines often are
interrupted in the middle.

In addition, SE_LOG(SHOW) always inserts a newline.

This patch deals with this by treating data received for stdout as a
data stream. It buffers incomplete lines and appends the rest of the
line when the next chunk comes in.

This delays printing such an incomplete line. flush() is introduced
to get that last, incomplete line logged.

For stderr, keeping text in memory instead of printing it as soon
as received is considered undesirable, therefore that code path
is not changed.
2010-04-01 15:22:27 +02:00
Patrick Ohly
7d17adc4a1 syncevo-dbus-server: redirect stdout (MB #5042)
Redirection of stdout was not activated and thus output of
synccompare was not sent via LogOutput messages.

Activating it shows that more work is necessary, although
it works in principle. Problems: line breaks are inserted
into long synccompare output and lines are swallowed.

Also, cout should not be used by the server itself. Instead
use the logging facilities.
2010-04-01 15:22:27 +02:00
Patrick Ohly
e7da5cc49b fix for Transport Timeout: callback must also be set for D-Bus
The recent patch which moves setTransportCallback() into
createTransportAgent() as incomplete, it didn't adapt
DBusSync::createTransportAgent().

As a reminder, this patch also updates the createTransportAgent()
comments.
2010-04-01 14:49:41 +02:00
Patrick Ohly
18c99352e1 Server.GetSessions(): return array of object paths (MB #10452)
Previously, plain strings were used. With DBusObject instead
the C++ bridge code recognizes the special meaning of those
and correctly sends them over D-Bus as object paths.
2010-04-01 14:45:42 +02:00
Zhu, Yongsheng
b4ebe0c5b0 Cmdline: watch daemon if it has gone (MB #5043)
Add a 'DBusWatch' to watch daemon and exit the process when the
daemon has gone.
Also find that current 'DBusClientCall' related classes are not
efficient and the code is reduntant. Re-design and implement the
inheritance.
2010-04-01 13:21:19 +02:00
Zhu, Yongsheng
15c581f830 Calendar: add workaround for 'alarm' in vCalendar1.0 (MB#10458)
When incoming data type is 'vCalendar1.0', alarms are converted
into VALARM without 'ACTION' field. This makes Evolution report
'unknown action to be performed'. Add 'DISPLAY' as the 'ACTION'
value if it has not.
2010-04-01 13:11:15 +02:00
Chen Congwu
595c2ff65f ObexTransportAgent: set requestStart for connect
requestStart time was used to detect transport timeout, which was only
set inside send(), however it is also possible that the transport
timeout during connect phase (sending a 'Connect' cmd but no response).
2010-04-01 13:10:44 +02:00
Chen Congwu
4ee1f8299f Transport Timeout: setting the timeout callback within createTransportAgent
The original creating the transport and remembering to set the callback approach:
1) For ObexTransport, the callback need to be set inside
createTransportAgent, because the 'connect' process might timeout.
2) It is error prone to remember setting the callback after
creating each transport.
Now setTransportCallback is integrated inside createTransportAgent.
2010-04-01 13:10:44 +02:00
Chen Congwu
5ec64c4504 Presence Detection: listen connman signals instead of polling (mb#10438) 2010-04-01 11:27:58 +08:00
Patrick Ohly
82465b359b SecondsConfigProperty: don't accept units without number (MB #10257)
"MmMmMm" was interpreted as "0M0m0M0m" = 0 seconds. This is not
entirely unreasonable, but perhaps a bit too technical interpretation
of valid input. QA considered it invalid.

So let's be a bit more strict, which has the advantage that more user
typos are found. Now at least one digit must come before each unit
character.
2010-03-31 20:51:34 +02:00
Jussi Kukkonen
11f286e738 gtk-ui: revert to old widgets names for Toolbar
new names are broken in moblin gtk theme, and the old ones have been
added back to the moblin gtk theme...
2010-03-31 20:34:54 +02:00
Jussi Kukkonen
a75ac70bbe gtk-ui: start using GtkToolbar for Meego window
This gets rid of MuxWindow (and the related icon code and images)
for good: Now a specially named GtkToolbar and buttons inside it get
a special treatment from meego gtk theme engine, and end up looking
like Mx window title bar

The meego build will look a bit odd with other gtk themes, though
2010-03-31 20:34:54 +02:00
Jussi Kukkonen
975d0eb677 gtk-ui: fix source order in emergency view (MB #9714) 2010-03-31 17:23:07 +03:00
Jussi Kukkonen
9319a1f3eb gtk-ui: bug fix: show send/receive buttons in config 2010-03-31 16:39:36 +03:00
Jussi Kukkonen
b3b520e762 gtk-ui: improve configuration layout
less padding, hopefully less horizontal scrollbars
2010-03-31 16:38:44 +03:00
Jussi Kukkonen
37ebfc0d23 gtk_ui: check source usability for templates (MB #9961)
When the configuration widget is built:
* start a session
* set temporary config
* run CheckSources, show all sources that are usable

This should fix
MB #9961: memo not disabled by default on meego
MB #9303: User can set Memo-URI in First server settings
2010-03-31 15:59:30 +03:00
Patrick Ohly
ff50b9c9e4 command line + D-Bus: fixed "make distcheck"
libgdbus was always added to the libs of syncevolution,
even if it was not needed and not compiled.
2010-03-30 21:20:55 +02:00
Patrick Ohly
3048b879b6 e_cal_check_timezones(): broken in EDS 2.30 due to change of error code (GNOME Bugzilla #611558, Moblin Bugzilla #9820)
The move to D-Bus changed the error code for "timezone cannot be
retrieved because it doesn't exist" from
E_CALENDAR_STATUS_OBJECT_NOT_FOUND to
E_CALENDAR_STATUS_INVALID_OBJECT. That latter error code was not
recognized by the code and caused e_cal_check_timezones() to fail with
that error ("Could not retrieve calendar time zone").

This patch fixes the problem by recognizing both the old and the new
error code.
2010-03-30 14:29:50 +02:00
Patrick Ohly
61f372eca5 Evolution backends: don't delay in open() unnecessarily
There was an intentional delay of 5 seconds in open() of both calendar
and contacts, followed by a retry of opening the database. This was
meant for the cases where a new database was created ("file://"
prefix) and couldn't be opened just yet, as seen in some older
Evolution releases (and perhaps still relevant today).

This delay hurts the sync-ui when it calls CheckSource() on the
defined, but non-existant "memo" database on MeeGo. This patch
avoids the delay and retry in that case.
2010-03-30 10:58:30 +02:00