~ubuntu-branches/ubuntu/quantal/akonadi/quantal

« back to all changes in this revision

Viewing changes to server/control/main.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-01-24 23:43:13 UTC
  • mto: (3.1.12 sid)
  • mto: This revision was merged to the branch mainline in revision 69.
  • Revision ID: package-import@ubuntu.com-20120124234313-ooald4uh9w8jilyw
Tags: upstream-1.7.0
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "agentmanager.h"
21
21
#include "controlmanager.h"
22
22
#include "processcontrol.h"
 
23
 
23
24
#include "akapplication.h"
24
25
#include "akcrash.h"
25
26
#include "akdebug.h"
26
 
 
27
 
#include "protocol_p.h"
 
27
#include "akdbus.h"
28
28
 
29
29
#include <QtCore/QCoreApplication>
30
30
#include <QtDBus/QDBusConnection>
48
48
 
49
49
int main( int argc, char **argv )
50
50
{
51
 
  AkApplication app( argc, argv );
 
51
  AkCoreApplication app( argc, argv );
52
52
  app.setDescription( QLatin1String("Akonadi Control Process\nDo not run this manually, use 'akonadictl' instead to start/stop Akonadi.") );
53
53
  app.parseCommandLine();
54
54
 
55
55
  // try to acquire the lock first, that means there is no second instance trying to start up at the same time
56
56
  // registering the real service name happens in AgentManager::continueStartup(), when everything is in fact up and running
57
 
  if ( !QDBusConnection::sessionBus().registerService( QLatin1String(AKONADI_DBUS_CONTROL_SERVICE_LOCK) ) ) {
 
57
  if ( !QDBusConnection::sessionBus().registerService( AkDBus::serviceName(AkDBus::ControlLock) ) ) {
58
58
    // We couldn't register. Most likely, it's already running.
59
59
    const QString lastError = QDBusConnection::sessionBus().lastError().message();
60
60
    if (lastError.isEmpty())
61
 
      akFatal() << "Unable to register service as" << AKONADI_DBUS_CONTROL_SERVICE_LOCK << "Maybe it's already running?";
 
61
      akFatal() << "Unable to register service as" << AkDBus::serviceName(AkDBus::ControlLock) << "Maybe it's already running?";
62
62
    else
63
 
      akFatal() << "Unable to register service as" << AKONADI_DBUS_CONTROL_SERVICE_LOCK << "Error was:" << lastError;
 
63
      akFatal() << "Unable to register service as" << AkDBus::serviceName(AkDBus::ControlLock) << "Error was:" << lastError;
64
64
  }
65
65
 
66
66
  // older Akonadi server versions don't use the lock service yet, so check if one is already running before we try to start another one
67
 
  if ( QDBusConnection::sessionBus().interface()->isServiceRegistered( QLatin1String(AKONADI_DBUS_CONTROL_SERVICE) ) )
 
67
  if ( QDBusConnection::sessionBus().interface()->isServiceRegistered( AkDBus::serviceName(AkDBus::Control) ) )
68
68
    akFatal() << "Another Akonadi control process is already running.";
69
69
 
70
70
  new ControlManager;