From kde-commits Tue Jun 19 08:39:58 2007 From: David Faure Date: Tue, 19 Jun 2007 08:39:58 +0000 To: kde-commits Subject: Re: KDE/kdepim/kleopatra Message-Id: <200706191040.05697.dfaure () klaralvdalens-datakonsult ! se> X-MARC-Message: https://marc.info/?l=kde-commits&m=118224347501721 On Monday 18 June 2007, Laurent Montel wrote: > On Saturday 16 June 2007 09:49:16 David Faure wrote: > > On Friday 15 June 2007, Laurent Montel wrote: > > > +  QString dbusService; > > > +  int result = KDBusServiceStarter::self()->findServiceFor( > > > "DBUS/Mailer", QString::null, &error, &dbusService ); if ( result != 0 ) > > > { > > >      kDebug() << "Couldn't connect to KMail\n"; > > >      KMessageBox::error( this, > > > @@ -439,6 +440,27 @@ > > >      return; > > >    } > > >   > > > +  //TODO look at if we can find kmail when embedded into kontact > > > +   bool kmailFound = false; > > > +   QDBusConnection dbus = QDBusConnection::sessionBus(); > > > +   QDBusReply reply = > > > dbus.interface()->registeredServiceNames(); +   if ( !reply.isValid() ) > > > +      return; > > > + > > > +   const QStringList allServices = reply; > > > +   for ( QStringList::const_iterator it = allServices.begin(), end = > > > allServices.end() ; it != end ; ++it ) { +        const QString service = > > > *it; > > > +        if ( service.startsWith( "org.kde.kmail" ) ) { > > > +                kmailFound = true; > > > +                break; > > > +        } > > > +   } > > > + > > > +   if(!kmailFound) > > > +   { > > > +       //TODO launch it into kontact > > > +   } > > > > Hmm all of this is what KDBusServiceStarter::self()->findServiceFor( ) is > > supposed to do. If it doesn't work, it should be debugged, but the above > > code shouldn't be necessary. > > I just start to port it. > I didn't start to test it. Hmm, but then why did you add all this code? It wasn't there before, so it's not needed now either. > But KDBusServiceStarter::self()->findServiceFor( ) is able to find when kmail > is embedded into kontact ? Yes, just like KDCOPServiceStarter was able to do this in kde3. It looks up who provides DBUS/ResourceBackend/IMAP, finds that KMail.desktop does, and that file also says X-DBUS-ServiceName=org.kde.kmail so KDBusServiceStarter will look whether org.kde.kmail is registered (and it is, when kmail is embedded into kontact, at least it's supposed to ;). -- David Faure, faure@kde.org, dfaure@klaralvdalens-datakonsult.se KDE/KOffice developer, Qt consultancy projects Klarälvdalens Datakonsult AB, Platform-independent software solutions