Example #1
0
/* Remove uinput device, stop threads and unregister from dbus
 */
Tohkbd::~Tohkbd()
{
    /* Restore orientation when shutting down */
    if (forceLandscapeOrientation)
    {
        QList<QVariant> args;
        args.append(currentOrientationLock);
        tohkbd2user->callWithArgumentList(QDBus::AutoDetect, "setOrientationLock", args);
    }

    uinputif->closeUinputDevice();

    worker->abort();
    thread->wait();
    delete thread;
    delete worker;

    if (dbusRegistered)
    {
        QDBusConnection connection = QDBusConnection::systemBus();
        connection.unregisterObject(PATH);
        connection.unregisterService(SERVICE);

        printf("tohkbd2: unregistered from dbus systemBus\n");
        tohkbd2user->call(QDBus::AutoDetect, "quit");
    }
}
Example #2
0
void MprisPlayer::unregisterService()
{
    if (!m_serviceName.isEmpty()) {
        QDBusConnection connection = QDBusConnection::sessionBus();
        connection.unregisterService(QString(serviceNamePrefix).append(m_serviceName));
    }
}
Example #3
0
/* Remove uinput device, stop threads and unregister from dbus
 */
Tohkbd::~Tohkbd()
{
    /* Restore orientation when shutting down */
    if (forceLandscapeOrientation)
    {
        tohkbd2user->setOrientationLock(currentOrientationLock);
    }

    uinputif->closeUinputDevice();

    worker->abort();
    thread->wait();
    delete thread;
    delete worker;

    if (dbusRegistered)
    {
        QDBusConnection connection = QDBusConnection::systemBus();
        connection.unregisterObject(PATH);
        connection.unregisterService(SERVICE);

        printf("tohkbd2: unregistered from dbus systemBus\n");
        tohkbd2user->quit();
    }
}
Example #4
0
bool registerInstance(Gui::MainWindow *window, QString &error)
{
    QDBusConnection conn = QDBusConnection::sessionBus();
    if (!conn.isConnected()) {
        error = conn.lastError().message();
        return false;
    }

    bool serviceOk = conn.registerService(service());
    if (!serviceOk) {
        error = conn.lastError().message();
        return false;
    }

    MainWindowBridge *object = new MainWindowBridge(window);
    bool objectOk = conn.registerObject(path, object, QDBusConnection::ExportAllSlots);
    if (!objectOk) {
        error = conn.lastError().message();
        delete object;
        conn.unregisterService(service());
        return false;
    }

    return true;
}
Example #5
0
 // ---------------------------------------------------------------------------------
 bool detail::service_to_register_with_dbus::at_system_bus()
 {
   QDBusConnection con = dbus().system_bus();
   if ( !con.isConnected() )
   {
     qWarning() << "not connected to system bus";
     return false;
   }
   if ( _M_op == REGISTER )
   {
     bool result = con.registerService ( _M_service );
     if ( result == false )
     {
       qDebug() << "something went wrong when trying to register the DBUS service: " << _M_service;
       qDebug() << con.lastError();
       return false;
     }
     return true;
   }
   else
   {
     if ( con.interface()->isServiceRegistered ( _M_service ) )
     {
       return con.unregisterService ( _M_service );
     }
   }
   return true;
 }
Example #6
0
void JobViewServer::startServer() {
  QDBusConnection bus = QDBusConnection::sessionBus();
  bus.unregisterService("org.kde.kuiserver"); 
  bus.unregisterService("org.kde.JobViewServer");
  bus.unregisterObject("/JobViewServer");
  if (bus.registerService("org.kde.kuiserver") && bus.registerService("org.kde.JobViewServer") && bus.registerObject("/JobViewServer", this)) {
    connected = true;
  } else {
    connected = false;
    QDBusServiceWatcher* watcher = new QDBusServiceWatcher("org.kde.kuiserver", bus, QDBusServiceWatcher::WatchForUnregistration, this);
    QDBusServiceWatcher* watcher2 = new QDBusServiceWatcher("org.kde.JobViewServer", bus, QDBusServiceWatcher::WatchForUnregistration, this);
    QObject::connect(watcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(startServer()));
    QObject::connect(watcher, SIGNAL(serviceUnregistered(QString)), watcher, SLOT(deleteLater()));
    QObject::connect(watcher2, SIGNAL(serviceUnregistered(QString)), this, SLOT(startServer()));
    QObject::connect(watcher2, SIGNAL(serviceUnregistered(QString)), watcher2, SLOT(deleteLater()));
  }
  updateStatusIndicators();
}
Example #7
0
 // ---------------------------------------------------------------------------------
 bool detail::service_to_register_with_dbus::at_session_bus()
 {
   QDBusConnection con = dbus().session_bus();
   if ( !con.isConnected() )
   {
     qWarning() << "not connected to session bus";
     return false;
   }
   if ( _M_op == REGISTER )
   {
     return con.registerService ( _M_service );
   }
   if ( con.interface()->isServiceRegistered ( _M_service ) )
   {
     return con.unregisterService ( _M_service );
   }
   return true;
 }
Example #8
0
Interface::~Interface()
{
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.unregisterObject( "/MainWindow" );
    dbus.unregisterService( "org.k3b.k3b" );
}
NotificationsEngine::~NotificationsEngine()
{
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.unregisterService( "org.freedesktop.Notifications" );
}