Ejemplo n.º 1
0
void NowPlaying::init()
{
    switch (formFactor())
    {
        case Plasma::Horizontal:
            layoutHorizontal();
            break;
        case Plasma::Vertical:
            layoutHorizontal(); // FIXME
            break;
        default:
            layoutPlanar();
            break;
    }

    Plasma::DataEngine* nowPlayingEngine = dataEngine("nowplaying");

    if (nowPlayingEngine)
    {
        connect(nowPlayingEngine, SIGNAL(sourceAdded(QString)),
                SLOT(playerAdded(QString)));
        connect(nowPlayingEngine, SIGNAL(sourceRemoved(QString)),
                SLOT(playerRemoved(QString)));

        findPlayer();
    }
    else
    {
        kDebug() << "Now Playing engine not found";
    }
}
Ejemplo n.º 2
0
void DBusSystemTrayProtocol::init()
{
    qCDebug(SYSTEMTRAY) << "ST Dataengine" << m_dataEngine->isValid();
    if (m_dataEngine->isValid()) {
        initRegisteredServices();
        connect(m_dataEngine, SIGNAL(sourceAdded(QString)),
                this, SLOT(newTask(QString)));
        connect(m_dataEngine, SIGNAL(sourceRemoved(QString)),
                this, SLOT(cleanupTask(QString)));
    }
}
Ejemplo n.º 3
0
// Constructor
WeatherEngine::WeatherEngine(QObject *parent, const QVariantList& args)
        :  Plasma::DataEngine(parent, args),
           m_networkAvailable(false)
{
    Q_UNUSED(args)

    m_reconnectTimer.setSingleShot(true);
    connect(&m_reconnectTimer, SIGNAL(timeout()), this, SLOT(startReconnect()));

    // Globally notify all plugins to remove their sources (and unload plugin)
    connect(this, SIGNAL(sourceRemoved(QString)), this, SLOT(removeIonSource(QString)));
    connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(unloadIons()));
}
Ejemplo n.º 4
0
SolidDeviceEngine::SolidDeviceEngine(QObject* parent, const QVariantList& args)
        : Plasma::DataEngine(parent, args),
          m_temperature(0),
          m_notifier(0)
{
    Q_UNUSED(args)
    m_signalmanager = new DeviceSignalMapManager(this);

    listenForNewDevices();
    setMinimumPollingInterval(1000);
    connect(this, SIGNAL(sourceRemoved(QString)),
            this, SLOT(sourceWasRemoved(QString)));
}
Ejemplo n.º 5
0
void Hdd_Activity::init()
{
    KGlobal::locale()->insertCatalog("plasma_applet_system-monitor");
    setEngine(dataEngine("systemmonitor"));
    setTitle(i18n("Disk Activity"), true);

    /* At the time this method is running, not all sources may be connected. */
    connect(engine(), SIGNAL(sourceAdded(QString)), this, SLOT(sourceChanged(QString)));
    connect(engine(), SIGNAL(sourceRemoved(QString)), this, SLOT(sourceChanged(QString)));

    foreach (const QString& source, engine()->sources()) {
        sourceChanged(source);
    }
void WorkareasManager::init()
{
    m_dataEngine = Plasma::DataEngineManager::self()->loadEngine("workareas");
    m_plgActOrdering = new PluginDelayActivitiesOrdering(this);
    connect(m_plgActOrdering, SIGNAL(orderActivitiesTriggered()), this, SLOT(orderActivitiesSlot()));

    foreach (const QString source, m_dataEngine->sources())
        activityAddedSlot(source);

    m_actModel->sortModel();

    // activity addition and removal
    connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SLOT(activityAddedSlot(QString)));
    connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SLOT(activityRemovedSlot(QString)));
}
Ejemplo n.º 7
0
void ActivityManager::init() {
  Plasma::ToolTipManager::self()->registerWidget(this);
  extender()->setEmptyExtenderMessage(i18n("No Activities..."));
  // don't grow too much height
  extender()->setMaximumHeight(300);
  if (extender()->item("Activities") == 0) {
    // create the item
    Plasma::ExtenderItem *item = new Plasma::ExtenderItem(extender());
    // initialize the item
    initExtenderItem(item);
    // set item name and title
    item->setName("Activities");
    item->setTitle("Activities");
  }
  // connect data sources
  Plasma::DataEngine *engine = dataEngine("org.kde.activities");
  foreach (const QString source, engine->sources())
    activityAdded(source);
  // activity addition and removal
  connect(engine, SIGNAL(sourceAdded(QString)), this, SLOT(activityAdded(QString)));
  connect(engine, SIGNAL(sourceRemoved(QString)), this, SLOT(activityRemoved(QString)));
}
Ejemplo n.º 8
0
    //layout->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));

    //This is an awful hack, but I need to keep the old behaviour for plasma-netbook
    //while using the new activity API for plasma-desktop.
    //TODO 4.6 convert netbook to the activity API so we won't need this
    if (qApp->applicationName() == "plasma-desktop") {
        m_engine = dataEngine("org.kde.activities");
        Plasma::DataEngine::Data data = m_engine->query("Status");
        QStringList activities = data["Running"].toStringList();
        //kDebug() << "$$$$$$$$$$$$# sources:" << activities.size();
        foreach (const QString &id, activities) {
            insertActivity(id);
        }
        m_engine->connectAllSources(this);
        connect(m_engine, SIGNAL(sourceAdded(QString)), this, SLOT(activityAdded(QString)));
        connect(m_engine, SIGNAL(sourceRemoved(QString)), this, SLOT(activityRemoved(QString)));
        connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(switchActivity(int)));
    } else {
        m_tabBar->nativeWidget()->installEventFilter(this);
        if (containment()) {
            Plasma::Corona *c = containment()->corona();

            if (!c) {
                kDebug() << "No corona, can't happen";
                setFailedToLaunch(true);
                return;
            }

            QList<Plasma::Containment*> containments = c->containments();
            foreach (Plasma::Containment *cont, containments) {
                if (cont->containmentType() == Plasma::Containment::PanelContainment || cont->containmentType() == Plasma::Containment::CustomPanelContainment || c->offscreenWidgets().contains(cont)) {