void ServicesDialog::on_tabServiceType_currentChanged(int index)
{
    switch (index)
    {
    case 0:
        if (m_ui->listServiziFree->count() != 0)
        {
            if (m_ui->listServiziFree->currentRow() != 0)
                m_ui->listServiziFree->setCurrentRow(0);
            else
                serviceChanged(m_ui->listServiziFree->item(0));
        }
        break;

    case 1:
        if (m_ui->listServiziLowCost->count() != 0)
        {
            if (m_ui->listServiziLowCost->currentRow() != 0)
                m_ui->listServiziLowCost->setCurrentRow(0);
            else
                serviceChanged(m_ui->listServiziLowCost->item(0));
        }
        break;

    case 2:
        if (m_ui->listServiziAltri->count() != 0)
        {
            if (m_ui->listServiziAltri->currentRow() != 0)
                m_ui->listServiziAltri->setCurrentRow(0);
            else
                serviceChanged(m_ui->listServiziAltri->item(0));
        }
        break;
    }
}
Esempio n. 2
0
JabberAdd::JabberAdd(JabberClient *client)
{
    m_client = client;
    m_wizard = NULL;
    m_result = NULL;
    m_idValidator = new IdValidator(edtID);
    edtID->setValidator(m_idValidator);
    connect(tabAdd, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentChanged(QWidget*)));
    connect(edtID, SIGNAL(returnPressed()), this, SLOT(search()));
    connect(edtID, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&)));
    QStringList services;
    for (unsigned i = 0; i < getContacts()->nClients(); i++){
        Client *c = getContacts()->getClient(i);
        if ((c->protocol() != client->protocol()) || (c->getState() != Client::Connected))
            continue;
        JabberClient *jc = static_cast<JabberClient*>(c);
        QString vHost = QString::fromUtf8(jc->VHost().c_str());
        QStringList::Iterator it;
        for (it = services.begin(); it != services.end(); ++it){
            if ((*it) == vHost)
                break;
        }
        if (it != services.end())
            continue;
        services.append(vHost);
    }
    cmbServices->insertStringList(services);
    connect(cmbServices, SIGNAL(activated(const QString&)), this, SLOT(serviceChanged(const QString&)));
    serviceChanged(cmbServices->currentText());
    fillGroup();
}
void DeclarativeDBusAdaptor::setService(const QString &service)
{
    if (m_service != service) {
        m_service = service;
        emit serviceChanged();
    }
}
Esempio n. 4
0
void SyncTaskListItem::clickedMenu(int item)
{
    KTrader::OfferList::Iterator it;

    if (offers.begin() != offers.end()) {
        for (it = offers.begin(); it != offers.end(); ++it) {
            KService::Ptr service = *it;
            kdDebug(2120) << i18n("Select Name:") << " "
            << service->name() + "; " << i18n("Library:") << " " <<
                    service->library() << endl;
            if (service->name() == itemMenu.text(item)) {
                if (preferedOffer != service->name() ||
                        preferedLibrary != service->library()) {
                    preferedOfferTemp = service->name();
                    preferedLibraryTemp = service->library();
                    itemMenu.setItemChecked(item, true);
                }
            } else {
                itemMenu.setItemChecked(item, false);
            }
        }
    }

    createSyncPlugin(QCheckListItem::isOn());
    emit serviceChanged();
}
Esempio n. 5
0
void QDeclarativeBluetoothSocket::setService(QDeclarativeBluetoothService *service)
{
    d->m_service = service;

    if(!d->m_componentCompleted)
        return;

    if(d->m_connected)
        d->connect();
    emit serviceChanged();
}
Esempio n. 6
0
void ServiceChooser::onButtonToggled(bool checked)
{
	if (!checked)
		return;
	QRadioButton *button = qobject_cast<QRadioButton*>(sender());
	Q_ASSERT(button && !button->objectName().isEmpty());
	QByteArray newService = button->objectName().toAscii();
	Q_ASSERT(m_buttons.contains(newService));
	emit serviceChanged(newService, m_currentService);
	m_currentService = newService;
}
Esempio n. 7
0
void ServiceChooser::setCurrentService(const QByteArray &service)
{
	QRadioButton *button = m_buttons.value(service);
	if (!button)
		return;
	button->blockSignals(true);
	button->setChecked(true);
	emit serviceChanged(service, m_currentService);
	m_currentService = service;
	button->blockSignals(false);
}
void DeclarativeDBusInterface::setService(const QString &service)
{
    if (m_service != service) {
        disconnectSignalHandler();

        m_service = service;
        emit serviceChanged();

        connectSignalHandler();
    }
}
EchoWindow::EchoWindow()
{
    createGUI();
    setLayout(layout);
    setWindowTitle("TextProcessor Demo");

    // instantiate the interface
    textProcessorInterface = new TextProcessorInterface();

    // check the interface is valid
    if (!textProcessorInterface->isValid()) {
        disableTextProcessing(QString());
        statusBar->showMessage("Err: Service unavailable");
    }

    // example of how to get a list of all installed services
    if (textProcessorInterface->isValid()) {
        QStringList services = textProcessorInterface->serviceNames();
        QStringListIterator iterator(services);
        qDebug() << "All services:";
        while (iterator.hasNext())
            qDebug() << iterator.next().toLocal8Bit().constData();
    }

    // example of how to get a list of all services for a particular interface
    if (textProcessorInterface->isValid()) {
        QStringList services = textProcessorInterface->serviceNames("com.nokia.TextProcessorInterface");
        QStringListIterator iterator(services);
        qDebug() << "Services implementing com.nokia.TextProcessorInterface:";
        while (iterator.hasNext())
            qDebug() << iterator.next().toLocal8Bit().constData();
    }

    // connect the availability signals
    // you likely need to know when a service appears/disappears to
    // do things like add/remove an option on a menu
    connect(
        textProcessorInterface, SIGNAL(serviceAvailable(QString)),
        this, SLOT(enableTextProcessing(QString))
    );
    connect(
        textProcessorInterface, SIGNAL(serviceUnavailable(QString)),
        this, SLOT(disableTextProcessing(QString))
    );
    connect(
        textProcessorInterface, SIGNAL(serviceChanged(QString)),
        this, SLOT(enableTextProcessing(QString))
    );
}
void ServiceOperationStatus::setService(Plasma::Service *service)
{
    if (m_service.data() == service) {
        return;
    }

    if (m_service) {
        disconnect(m_service.data(), 0, this, 0);
    }
    if (service) {
        connect(service, &Plasma::Service::operationEnabledChanged,
                this, &ServiceOperationStatus::updateStatus);
    }

    m_service = service;
    updateStatus();
    emit serviceChanged();
}
void MServiceFwBaseIf::handleServiceUnavailable(const QString &service)
{
    Q_D(MServiceFwBaseIf);
    bool noCurrentService      = d->service.isEmpty();
    bool currentServiceHasGone = (service == d->service);

    if (noCurrentService || currentServiceHasGone) {
        // get new service for this interface
        d->service = d->serviceFwProxyPtr->serviceName(d->interface);

        bool noMoreServicesForThisInterface = d->service.isEmpty();
        if (noMoreServicesForThisInterface) {
            if (!noCurrentService)
                emit serviceUnavailable(service);
        } else {
            setService(d->service);
            emit serviceChanged(d->service);
        }
    }
}
void MServiceFwBaseIf::handleServiceAvailable(const QString &service, const QString &interface)
{
    Q_D(MServiceFwBaseIf);
    bool newServiceIsForThisInterface = (interface == d->interface);
    if (newServiceIsForThisInterface) {
        QString previousService = d->service;

        // let service mappper choose which service to use
        d->service = d->serviceFwProxyPtr->serviceName(d->interface);

        bool interfaceWasDead = previousService.isEmpty();
        if (interfaceWasDead) {
            emit serviceAvailable(service);
        }

        bool serviceHasChanged = (previousService != d->service);
        if (serviceHasChanged) {
            setService(d->service);
            emit serviceChanged(d->service);
        }
    }
}
QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent)  :
    QWidget(parent),
    c(connection),
    objectPathRegExp(QLatin1String("\\[ObjectPath: (.*)\\]"))
{
    servicesModel = new QStringListModel(this);
    servicesFilterModel = new QSortFilterProxyModel(this);
    servicesFilterModel->setSourceModel(servicesModel);
    servicesFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    serviceFilterLine = new QLineEdit(this);
    serviceFilterLine->setPlaceholderText(tr("Search..."));
    servicesView = new QListView(this);
    servicesView->setModel(servicesFilterModel);

    connect(serviceFilterLine, SIGNAL(textChanged(QString)), servicesFilterModel, SLOT(setFilterFixedString(QString)));

    tree = new QTreeView;
    tree->setContextMenuPolicy(Qt::CustomContextMenu);

    connect(tree, SIGNAL(activated(QModelIndex)), this, SLOT(activate(QModelIndex)));

    refreshAction = new QAction(tr("&Refresh"), tree);
    refreshAction->setData(42); // increase the amount of 42 used as magic number by one
    refreshAction->setShortcut(QKeySequence::Refresh);
    connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshChildren()));

    QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, tree);
    connect(refreshShortcut, SIGNAL(activated()), this, SLOT(refreshChildren()));

    QVBoxLayout *layout = new QVBoxLayout(this);
    QSplitter *topSplitter = new QSplitter(Qt::Vertical, this);
    layout->addWidget(topSplitter);

    log = new QTextBrowser;
    connect(log, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));

    QSplitter *splitter = new QSplitter(topSplitter);
    splitter->addWidget(servicesView);

    QWidget *servicesWidget = new QWidget;
    QVBoxLayout *servicesLayout = new QVBoxLayout(servicesWidget);
    servicesLayout->addWidget(serviceFilterLine);
    servicesLayout->addWidget(servicesView);
    splitter->addWidget(servicesWidget);
    splitter->addWidget(tree);

    topSplitter->addWidget(splitter);
    topSplitter->addWidget(log);

    connect(servicesView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(serviceChanged(QModelIndex)));
    connect(tree, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(showContextMenu(QPoint)));

    QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);

    if (c.isConnected()) {
        logMessage(QLatin1String("Connected to D-Bus."));
        QDBusConnectionInterface *iface = c.interface();
        connect(iface, SIGNAL(serviceRegistered(QString)),
                this, SLOT(serviceRegistered(QString)));
        connect(iface, SIGNAL(serviceUnregistered(QString)),
                this, SLOT(serviceUnregistered(QString)));
        connect(iface, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
                this, SLOT(serviceOwnerChanged(QString,QString,QString)));
    } else {
        logError(QLatin1String("Cannot connect to D-Bus: ") + c.lastError().message());
    }

    objectPathRegExp.setMinimal(true);

}
Esempio n. 14
0
void Transfer::setService(const QString &s) {
    if (s != service()) {
        m_service = s;
        emit serviceChanged();
    }
}
Esempio n. 15
0
void ServicesDialog::on_listServiziAltri_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
{
    Q_UNUSED(previous);
    serviceChanged(current);
}