Esempio n. 1
0
void NetctlHelper::createInterface()
{
    if (debug) qDebug() << PDEBUG;

    QDBusConnection bus = QDBusConnection::systemBus();
    if (!bus.registerService(DBUS_HELPER_SERVICE)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register service";
        if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
        return quitHelper();
    }
    if (!bus.registerObject(DBUS_LIB_PATH,
                            new NetctlAdaptor(this, debug, configuration),
                            QDBusConnection::ExportAllContents)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register library object";
        if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
        return quitHelper();
    }
    if (!bus.registerObject(DBUS_CTRL_PATH,
                            new ControlAdaptor(this, debug, configuration),
                            QDBusConnection::ExportAllContents)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register control object";
        if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
        return quitHelper();
    }
    if (!bus.registerObject(DBUS_INTERFACE_PATH,
                            new InterfaceAdaptor(this, debug, configuration),
                            QDBusConnection::ExportAllContents)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register interface object";
        if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
        return quitHelper();
    }
    // session bus
    if (!session) return;
    QDBusConnection sessionBus = QDBusConnection::sessionBus();
    if (!sessionBus.registerService(DBUS_HELPER_SERVICE)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register session service";
        if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
    }
    if (!sessionBus.registerObject(DBUS_LIB_PATH,
                                   new NetctlAdaptor(this, debug, configuration),
                                   QDBusConnection::ExportAllContents)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register session library object";
        if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
    }
    if (!sessionBus.registerObject(DBUS_CTRL_PATH,
                                   new ControlAdaptor(this, debug, configuration),
                                   QDBusConnection::ExportAllContents)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register session control object";
        if (debug) qDebug() << PDEBUG << ":" << sessionBus.lastError().message();
    }
    if (!sessionBus.registerObject(DBUS_INTERFACE_PATH,
                                   new InterfaceAdaptor(this, debug, configuration),
                                   QDBusConnection::ExportAllContents)) {
        if (debug) qDebug() << PDEBUG << ":" << "Could not register session interface object";
        if (debug) qDebug() << PDEBUG << ":" << bus.lastError().message();
        return quitHelper();
    }
}
Esempio n. 2
0
/**
 * \brief Constructor
 *
 * \todo Will set up the backends to the configured values
 */
SimonTTSPrivate::SimonTTSPrivate() : forceReinitialization(true)
{
  new SimonTTSAdaptor(this);
  QDBusConnection dbus = QDBusConnection::sessionBus();
  dbus.registerObject("/SimonTTS", this);
  dbus.registerService("org.simon-listens.SimonTTS");
}
Esempio n. 3
0
DBusSignals::DBusSignals(QObject *parent) : QObject(parent)
{
    new TheshellAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/org/thesuite/theshell", this);
    dbus.registerService("org.thesuite.theshell");
}
Esempio n. 4
0
File: qdl.cpp Progetto: wulinfa/qdl2
Qdl::Qdl() :
    QObject()
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.marxoft.qdl2");
    connection.registerObject("/org/marxoft/qdl2", this, QDBusConnection::ExportScriptableSlots);
}
HomeApplication::HomeApplication(int &argc, char **argv, const QString& appIdentifier) :
    MApplication(argc, argv, appIdentifier),
    upstartMode(false),
    lockedOrientation_(QVariant::Invalid),
    homeScreenService(new HomeScreenService),
    xEventListeners(),
    iteratorActiveForEventListenerContainer(false),
    toBeRemovedEventListeners()
{
    parseArguments(argc, argv);

    // Enable prestart mode
    MApplication::setPrestartMode(M::TerminateOnClose);

    // launch a timer for sending a dbus-signal upstart when home is ready
    // and on screen
    connect(&startupNotificationTimer, SIGNAL(timeout()),
            this, SLOT(sendStartupNotifications()));
    startupNotificationTimer.setSingleShot(true);
    startupNotificationTimer.setInterval(0);
    startupNotificationTimer.start();

    new HomeScreenAdaptor(homeScreenService);

    QDBusConnection connection = QDBusConnection::sessionBus();

    connection.registerService(MEEGO_CORE_HOME_SCREEN_SERVICE_NAME);
    connection.registerObject(MEEGO_CORE_HOME_SCREEN_OBJECT_PATH, homeScreenService);

    connect(homeScreenService, SIGNAL(focusToLauncherApp(const QString&)), this, SIGNAL(focusToLauncherAppRequested(const QString &)));

    // Initialize the X11 atoms used in the UI components
    WindowInfo::initializeAtoms();
}
Esempio n. 6
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;
 }
Esempio n. 7
0
DBusService::DBusService(QObject *parent) :
    QObject(parent)
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.marxoft.cutetube2");
    connection.registerObject("/", this, QDBusConnection::ExportAllSlots);
}
Esempio n. 8
0
bool SessionManager::registerDBus()
{
    QDBusConnection bus = QDBusConnection::sessionBus();

    // Start the D-Bus service
    (void)new SessionAdaptor(this);
    if (!bus.registerObject(objectPath, this)) {
        qWarning() << "Couldn't register /U2TSession D-Bus object:"
                                   << qPrintable(bus.lastError().message());
        return false;
    }
    if (!bus.registerService(interfaceName)) {
        qWarning() << "Couldn't register io.u2t.session D-Bus service:"
                                   << qPrintable(bus.lastError().message());
        return false;
    }
    qDebug() << "Registered" << interfaceName << "D-Bus interface";

    // Register process launcher service
    if (!m_launcher->registerInterface())
        return false;
    //
    // // Register screen saver interface
    // if (!m_screenSaver->registerInterface())
    //     return false;

    return true;
}
ConflictResolutionScreen::ConflictResolutionScreen()
{
    setStyleSheet( "background-color: white;" );

    new OneclickinstallerAdaptor( this );
    QDBusConnection connection = QDBusConnection::systemBus();
    if ( !connection.isConnected() ) {
        qFatal( "Cannot connect to the D-Bus system bus" );
        exit( 1 );
    }
    connection.registerObject( "/OCI", this );
    if ( !connection.registerService("org.opensuse.oneclickinstaller") ) {
        qFatal( qPrintable( QDBusConnection::systemBus().lastError().message() ) );
        exit( 1 );
    }

    m_mainLayout = new QVBoxLayout;

    //QObject::connect( m_ociHelper, SIGNAL( displayProblemAndSolutions( QString, QString ) ), this, SLOT( problemSolutionWidget( QString, QString ) ) );
    QDBusConnection sysBus = QDBusConnection::systemBus();
    if ( !sysBus.isConnected() ) {
        qFatal( "Cannot connect to the D-Bus system bus" );
        exit( 1 );
    }
    sysBus.connect( QString(), QString(), "org.opensuse.OCIHelper", "displayProblemAndSolutions", this, SLOT( problemSolutionWidget( QString, QStringList ) ) );

    setLayout ( m_mainLayout );
}
Esempio n. 10
0
SplashApp::SplashApp(int &argc, char ** argv)
    : QApplication(argc, argv),
      m_stage(0),
      m_testing(false)
{
    m_testing = arguments().contains(QStringLiteral("--test"));

    m_desktop = QApplication::desktop();
    screenGeometryChanged(m_desktop->screenCount());

    setStage(1);

    QPixmap cursor(32, 32);
    cursor.fill(QColor(0, 0, 0, 0));
    setOverrideCursor(QCursor(cursor));

    if (m_testing) {
        m_timer.start(TEST_STEP_INTERVAL, this);
    }

    connect(m_desktop, SIGNAL(screenCountChanged(int)), this, SLOT(screenGeometryChanged(int)));
    connect(m_desktop, SIGNAL(workAreaResized(int)), this, SLOT(screenGeometryChanged(int)));

    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject(QStringLiteral("/KSplash"), this, QDBusConnection::ExportScriptableSlots);
    dbus.registerService(QStringLiteral("org.kde.KSplash"));
}
Esempio n. 11
0
File: main.cpp Progetto: Afreeca/qt
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QGraphicsScene scene;
    scene.setSceneRect(-500, -500, 1000, 1000);
    scene.setItemIndexMethod(QGraphicsScene::NoIndex);

    Car *car = new Car();
    scene.addItem(car);

    QGraphicsView view(&scene);
    view.setRenderHint(QPainter::Antialiasing);
    view.setBackgroundBrush(Qt::darkGray);
    view.setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Qt DBus Controlled Car"));
    view.resize(400, 300);
    view.show();

    new CarInterfaceAdaptor(car);
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerObject("/Car", car);
    connection.registerService("com.trolltech.CarExample");

    return app.exec();
}
Esempio n. 12
0
Config::Config(const QString &organization,
        const QString &application, QObject *parent):
    QSettings(organization, application, parent)
{
    proxyOn = false;
    proxyURL = "";
    proxyUser = "";
    proxyPasswd = "";
    proxyPort = 3128;
    read();

    if (value("CurrentWallpaper").toString().isNull()) {
        CurrentWallpaper =  DesktopWidget::applicationDirPath() + "/share/plexy/skins/default/default.png";
    }

    if (value("iconTheme").toString().isNull()) {
        iconTheme = "default";
    }

    collitionOn = false;

    if (widgetList.count() < 0) {
        writeToFile();
    }
#ifdef Q_WS_X11
    // register  with dbus
    new ConfigAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/Configuration", this);
    dbus.registerService("org.PlexyDesk.Config");
#endif
}
Esempio n. 13
0
DBusAdaptor::DBusAdaptor(MainWindow *mainWindow)
    : QDBusAbstractAdaptor(mainWindow), m_mainWindow(mainWindow)
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.qstardict.dbus");
    connection.registerObject("/qstardict", mainWindow);
}
Esempio n. 14
0
MprisPlugin::MprisPlugin()
    : InfoPlugin()
{
    qDebug() << Q_FUNC_INFO;

    m_playbackStatus = "Stopped";

    m_supportedPushTypes << InfoNowPlaying << InfoNowPaused << InfoNowResumed << InfoNowStopped;

    new MprisPluginRootAdaptor( this );
    new MprisPluginPlayerAdaptor( this );
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/org/mpris/MediaPlayer2", this);
    dbus.registerService("org.mpris.MediaPlayer2.tomahawk");

    connect( AudioEngine::instance(), SIGNAL( volumeChanged( int ) ),
            SLOT( onVolumeChanged( int ) ) );

    // When the playlist changes, signals for several properties are sent
    connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ),
            SLOT( onPlaylistChanged( Tomahawk::PlaylistInterface* ) ) );

    // When a track is added or removed, CanGoNext updated signal is sent
    PlaylistInterface *playlist = AudioEngine::instance()->playlist();
    if( playlist )
        connect( playlist->object(), SIGNAL( trackCountChanged( unsigned int ) ),
                SLOT( onTrackCountChanged( unsigned int ) ) );

}
Esempio n. 15
0
bool 
WeatherApplicationExtension::initialize(const QString &){
   QGraphicsObject* mWidget;

   box = new MyMWidget();

   /* D-BUS */
   new MeecastIf(box);
   QDBusConnection connection = QDBusConnection::sessionBus();
   bool ret = connection.registerService("com.meecast.applet");
   ret = connection.registerObject("/com/meecast/applet", box);
   EventFeedIf* client =  new EventFeedIf("com.nokia.home.EventFeed", "/eventfeed",
                                           QDBusConnection::sessionBus(), 0); 
   QObject::connect(client, SIGNAL(refreshRequested()), box, SLOT(refreshRequested()));  

   QTimer::singleShot(1000, box, SLOT(refreshRequested()));

   /* Copy wallpaper */
   if (!(QFile::exists("/home/user/.cache/com.meecast.omweather/wallpaper_MeeCast_original.png"))){
       QDir dir("/home/user/.cache/com.meecast.omweather");
       if (!dir.exists())
           dir.mkpath("/home/user/.cache/com.meecast.omweather");

       MGConfItem *wallpaperItem;
       wallpaperItem = new MGConfItem ("/desktop/meego/background/portrait/picture_filename"); 

       if (QFile::exists(wallpaperItem->value().toString()))
           QFile::copy(wallpaperItem->value().toString(),
                   "/home/user/.cache/com.meecast.omweather/wallpaper_MeeCast_original.png"); 
   }
//   box->startpredeamon();
   return true;
}
Esempio n. 16
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;
}
Esempio n. 17
0
IMPanel::IMPanel(QObject* parent)
        : QObject(parent)
{
    new IMPanelAdaptor(this);
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.kde.impanel");
    connection.registerObject("/org/kde/impanel", this);
}
Esempio n. 18
0
KFritzDbusService::KFritzDbusService(KMainWindow *parent)
: QObject(parent)
{
    new KFritzDbusServiceAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject("/KFritz",this);
    dbus.registerService("org.kde.KFritz");
}
NotificationsEngine::NotificationsEngine( QObject* parent, const QVariantList& args )
    : Plasma::DataEngine( parent, args ), m_nextId( 1 )
{
    new NotificationsAdaptor(this);

    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerService( "org.freedesktop.Notifications" );
    dbus.registerObject( "/org/freedesktop/Notifications", this );
}
Esempio n. 20
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();
}
Esempio n. 21
0
void EPDbusService::execute()
{
    QDBusConnection connect = QDBusConnection::sessionBus();

    if(!connect.registerService("test.dbus.service"))
    {
        qDebug()<<"register service failure";
    }
}
Esempio n. 22
0
CuteNews::CuteNews() :
    QObject(),
    m_connection(0),
    m_engine(0)
{
    QDBusConnection connection = QDBusConnection::sessionBus();
    connection.registerService("org.marxoft.cutenews");
    connection.registerObject("/org/marxoft/cutenews", this, QDBusConnection::ExportScriptableSlots);
}
Esempio n. 23
0
NotificationsEngine::NotificationsEngine( QObject* parent, const QVariantList& args )
    : Plasma::DataEngine( parent, args ), m_nextId( 1 )
{
    new NotificationsAdaptor(this);

    QDBusConnection dbus = QDBusConnection::sessionBus();
    bool so = dbus.registerService( "org.freedesktop.Notifications" );
    bool ro = dbus.registerObject( "/org/freedesktop/Notifications", this );
    qDebug() << "Are we the only client? (Both have to be true) " << so << ro;
}
Esempio n. 24
0
Interface::Interface(  MainWindow* main  )
:
    QObject( main ),
    m_main( main )
{
    new K3bInterfaceAdaptor( this );
    QDBusConnection dbus = QDBusConnection::sessionBus();
    dbus.registerObject( "/MainWindow", this );
    dbus.registerService( "org.k3b.k3b" );
}
Esempio n. 25
0
MainWidget::MainWidget(QWidget *parent) :
    QWidget(parent), db(NULL), configForm(NULL), managerForm(NULL), backupForm(NULL), dbus_conn(QDBusConnection::sessionBus())
{
    new ClientManagerAdaptor(this);
    QDBusConnection dbus = QDBusConnection::sessionBus();
    // expose qcma over dbus so the database update can be triggered
    dbus.registerObject("/ClientManager", this);
    dbus.registerService("org.qcma.ClientManager");
    trayIcon = NULL;
}
Esempio n. 26
0
NelisquareDbus::NelisquareDbus(QApplication *parent, QDeclarativeView *view) :
    QDBusAbstractAdaptor(parent), m_view(view)
{
    QDBusConnection bus = QDBusConnection::sessionBus();
    bus.registerService("com.nelisquare");
    bus.registerObject("/com/nelisquare", parent);

    QObject *rootObject = qobject_cast<QObject*>(view->rootObject());
    rootObject->connect(this,SIGNAL(processUINotification(QVariant)),SLOT(processUINotification(QVariant)));
    rootObject->connect(this,SIGNAL(processURI(QVariant)),SLOT(processURI(QVariant)));
}
Esempio n. 27
0
DBusAdapter::DBusAdapter(QObject *parent) :
    QDBusAbstractAdaptor(parent)
{
    setAutoRelaySignals(true);

    QDBusConnection bus = QDBusConnection::sessionBus();
    qDebug() << "DBUS Register service" <<
    bus.registerService("net.thecust.systemmonitor");
    qDebug() << "DBUS Register object" <<
    bus.registerObject("/net/thecust/systemmonitor", parent);
}
FakeAccounts::FakeAccounts(QObject *parent)
    : QObject(parent)
    , m_lastUid(1000)
{
    QDBusConnection bus = QDBusConnection::sessionBus();

    if (!bus.registerObject(QStringLiteral("/org/freedesktop/Accounts"), this))
        qFatal("Unable to register object: %s", qPrintable(bus.lastError().message()));
    if (!bus.registerService(QStringLiteral("org.freedesktop.Accounts")))
        qFatal("Unable to register service: %s", qPrintable(bus.lastError().message()));
}
Esempio n. 29
0
BrowserService::BrowserService(QObject * parent)
    : QObject(parent)
    , m_registered(true)
{
    new DBusAdaptor(this);
    QDBusConnection connection = QDBusConnection::sessionBus();
    if(!connection.registerService(SAILFISH_BROWSER_SERVICE) ||
            !connection.registerObject("/", this)) {
        m_registered = false;
    }
}
Esempio n. 30
0
void MainController::creatDBusService()
{
    // 用于建立到session bus的连接
    QDBusConnection bus = QDBusConnection::sessionBus();
    // 在session bus上注册名为"com.fcitx_qimpanel.hotel"的service
    if (!bus.registerService("com.fcitx_qimpanel.hotel")) {  //注意命名规则-和_
            qDebug() << bus.lastError().message();
            exit(1);
    }
    // "QDBusConnection::ExportAllSlots"表示把类Hotel的所有Slot都导出为这个Object的method
    bus.registerObject("/", mSelf ,QDBusConnection::ExportAllSlots);//可以优化只导出需要的
}