[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/mailcommon
From: Sergio Luis Martins <iamsergio () gmail ! com>
Date: 2010-12-04 16:53:42
Message-ID: 20101204165342.166F7AC8A4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1203576 by smartins:
On wince/windows we can't call korganizer-mobile.sh through KDBusServiceStarter.
Start it directly.
M +34 -4 mailutil.cpp
--- trunk/KDE/kdepim/mailcommon/mailutil.cpp #1203575:1203576
@@ -131,19 +131,48 @@
/* static */
void MailCommon::Util::ensureKorganizerRunning( bool switchTo )
{
+ // FIXME: this function returns void, but there can be errors.
+ // FIXME: this function should be inside a QObject, and async, and emit a signal \
when korg registered itself successfuly +
QString error;
+ bool result = true;
QString dbusService;
+
+ #if defined (Q_OS_WINCE) || defined(Q_OS_WIN32)
+ //Can't run the korganizer-mobile.sh through KDBusServiceStarter in these \
platforms. + QDBusInterface *interface = new QDBusInterface( "org.kde.korganizer", \
"/MainApplication" ); + if ( !interface->isValid() ) {
+ kDebug() << "Starting korganizer...";
+ delete interface;
+
+ QDBusServiceWatcher *watcher = new QDBusServiceWatcher( "org.kde.korganizer", \
QDBusConnection::sessionBus(), + \
QDBusServiceWatcher::WatchForRegistration ); + QEventLoop loop;
+ watcher->connect( watcher, SIGNAL( serviceRegistered( const QString& ) ), \
&loop, SLOT( quit() ) ); + result = QProcess::startDetached( "korganizer-mobile" \
); + if ( result ) {
+ kDebug() << "Starting loop";
+ loop.exec();
+ kDebug() << "Korganizer finished starting";
+ } else {
+ kWarning() << "Failed to start korganizer with QProcess";
+ }
+
+ delete watcher;
+ }
+ #else
QString constraint;
#ifdef KDEPIM_MOBILE_UI
// start the mobile korg instead of the desktop one
constraint = "'mobile' in Keywords";
- #endif;
+ #endif
- const int result = KDBusServiceStarter::self()->findServiceFor( "DBUS/Organizer",
+ result = KDBusServiceStarter::self()->findServiceFor( "DBUS/Organizer",
constraint,
- &error, \
&dbusService );
- if ( result == 0 ) {
+ &error, &dbusService ) == \
0; + #endif
+ if ( result ) {
// OK, so korganizer (or kontact) is running. Now ensure the object we want is \
loaded. QDBusInterface iface( "org.kde.korganizer", "/MainApplication",
"org.kde.KUniqueApplication" );
@@ -301,6 +330,7 @@
#else
kDebug() << "mobile";
MailCommon::Util::ensureKorganizerRunning( false );
+ kDebug() << "opening editor";
OrgKdeKorganizerCalendarInterface *iface =
new OrgKdeKorganizerCalendarInterface( "org.kde.korganizer", "/Calendar",
QDBusConnection::sessionBus() );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic