[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdepim/kleopatra
From:       David Faure <dfaure () klaralvdalens-datakonsult ! se>
Date:       2007-06-19 8:39:58
Message-ID: 200706191040.05697.dfaure () klaralvdalens-datakonsult ! se
[Download RAW message or body]

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<QStringList> 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic