Akonadi: fixed issue with running inside syncevo-dbus-server

KApplication starts of it's own DBus service of the format
org.syncevolution.syncevolution-processId
Sending a patch upstream to stop this needs a lot more work and
should be out by KDE 4.8 (hope so).
Also
cleaned up the ugly
if (getenv("KDE_FULL_SESSION")!= true)
with
if (getenv("KDE_FULL_SESSION"))
This commit is contained in:
Dinesh 2011-03-30 22:21:45 +05:30 committed by Patrick Ohly
parent 3dc7b5fb17
commit 0cb2aa6a30
4 changed files with 20 additions and 14 deletions

View File

@ -29,6 +29,7 @@ extern "C" {
#include <QtCore/QString>
#include <QtCore/QLatin1String>
#include <QtCore/QDebug>
#include <QtDBus/QDBusConnection>
#include <KApplication>
#include <KAboutData>
@ -82,6 +83,9 @@ CmdlineSyncClient::CmdlineSyncClient(const string &server,
KCmdLineArgs::init(argc, argv, &aboutData);
if (!kapp) {
new KApplication;
//To stop KApplication from spawning it's own DBus Service ... Will have to patch KApplication about this
QDBusConnection::sessionBus().unregisterService("org.syncevolution.syncevolution-"+QString::number(getpid()));
}
#endif
}
@ -111,8 +115,7 @@ string CmdlineSyncClient::askPassword(const string &passwordName,
#ifdef USE_GNOME_KEYRING
//When Both GNOME KEYRING and KWALLET are available, Check if this is a KDE Session
//and Call KWallet if it is. else pick Gnome Keyring by default
const QByteArray isKdeRunning = getenv("KDE_FULL_SESSION");
if (isKdeRunning != "true") {
if (getenv("KDE_FULL_SESSION")) {
isKde = false;
}
#endif
@ -184,8 +187,7 @@ bool CmdlineSyncClient::savePassword(const string &passwordName,
#ifdef USE_GNOME_KEYRING
// When both GNOME KEYRING and KWALLET are available, check if
// this is a KDE Session and call
const QByteArray isKdeRunning = getenv("KDE_FULL_SESSION");
if (isKdeRunning != "true") {
if (getenv("KDE_FULL_SESSION")) {
isKde = false;
}
#endif

View File

@ -26,11 +26,11 @@ Query databases:
syncevolution
Configuring syncevolution for contacts with Akonadi as backend:
syncevolution --source-property sync=none \
syncevolution --configure --source-property sync=none \
--sync-property username=... \
--sync-property password=... \
scheduleworld
syncevolution --source-property sync=two-way \
syncevolution --configure --source-property sync=two-way \
--source-property type=kde-contacts \
--source-property evolutionsource=akonadi:?... \
scheduleworld addressbook

View File

@ -42,6 +42,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QStringList>
#include <QtDBus/QDBusConnection>
#include <QtCore/QDebug>
@ -99,10 +100,12 @@ void AkonadiSyncSource::start()
"http://www.syncevolution.org/",
// The bug report email address
"syncevolution@syncevolution.org");
KCmdLineArgs::init( argc, argv, &aboutData );
if(!qApp){
new KApplication;
KCmdLineArgs::init(argc, argv, &aboutData);
if (!kapp) {
new KApplication;
//To stop KApplication from spawning it's own DBus Service ... Will have to patch KApplication about this
QDBusConnection::sessionBus().unregisterService("org.syncevolution.syncevolution-"+QString::number(getpid()));
}
// Start The Akonadi Server if not already Running.
if (!Akonadi::ServerManager::isRunning()) {

View File

@ -79,6 +79,7 @@ extern "C" {
#include <QtCore/QLatin1String>
#include <QtCore/QByteArray>
#include <QtCore/QDebug>
#include <QtDBus/QDBusConnection>
#include <KApplication>
#include <KAboutData>
@ -3128,8 +3129,7 @@ string DBusUserInterface::askPassword(const string &passwordName,
#ifdef USE_GNOME_KEYRING
//When Both GNOME KEYRING and KWALLET are available, Check if this is a KDE Session
//and Call
QByteArray isKdeRunning=getenv("KDE_FULL_SESSION");
if(isKdeRunning!="true")
if(getenv("KDE_FULL_SESSION"))
isKde=false;
#endif
if (isKde){
@ -3205,8 +3205,7 @@ bool DBusUserInterface::savePassword(const string &passwordName,
#ifdef USE_GNOME_KEYRING
//When Both GNOME KEYRING and KWALLET are available, Check if this is a KDE Session
//and Call
QByteArray isKdeRunning=getenv("KDE_FULL_SESSION");
if(isKdeRunning!="true")
if(getenv("KDE_FULL_SESSION"))
isKde=false;
#endif
if(isKde){
@ -3330,6 +3329,8 @@ DBusSync::DBusSync(const std::string &config,
KCmdLineArgs::init(argc, argv, &aboutData);
if (!kapp) {
new KApplication;
//To stop KApplication from spawning it's own DBus Service ... Will have to patch KApplication about this
QDBusConnection::sessionBus().unregisterService("org.syncevolution.syncevolution-"+QString::number(getpid()));
}
#endif