void QConnectionManager::updateServicesMap()
{
    qDebug() << Q_FUNC_INFO;
    QStringList oldServices = orderedServicesList;
    orderedServicesList.clear();

    Q_FOREACH (const QString &tech,techPreferenceList) {
        QVector<NetworkService*> services = netman->getServices(tech);

        Q_FOREACH (NetworkService *serv, services) {

            servicesMap.insert(serv->path(), serv);
            orderedServicesList << serv->path();

            if (!oldServices.contains(serv->path())) {
                //new!
                qDebug() <<"new service"
                         << serv->path();

                QObject::connect(serv, SIGNAL(stateChanged(QString)),
                                 this,SLOT(serviceStateChanged(QString)), Qt::UniqueConnection);
                QObject::connect(serv, SIGNAL(connectRequestFailed(QString)),
                                 this,SLOT(serviceErrorChanged(QString)), Qt::UniqueConnection);

                QObject::connect(serv, SIGNAL(errorChanged(QString)),
                                 this,SLOT(servicesError(QString)), Qt::UniqueConnection);
                QObject::connect(serv, SIGNAL(strengthChanged(uint)),
                                 this,SLOT(onServiceStrengthChanged(uint)), Qt::UniqueConnection);
                QObject::connect(serv, SIGNAL(serviceConnectionStarted()),
                                 this,SLOT(onServiceConnectionStarted()), Qt::UniqueConnection);
                QObject::connect(serv, SIGNAL(serviceDisconnectionStarted()),
                                 this,SLOT(onServiceDisconnectionStarted()), Qt::UniqueConnection);
                QObject::connect(serv, SIGNAL(autoConnectChanged(bool)),
                                 this,SLOT(serviceAutoconnectChanged(bool)), Qt::UniqueConnection);
            }
Example #2
0
void ServiceListener::slotDBusSignal( const QDBusMessage& message )
{
    odebug << "ConnMan: " << message.member() << oendl;
    if( message.member() == "PropertyChanged" ) {
        QString prop = message[0].toString();
        if( prop == "State" ) {
            QString oldState = m_state;
            QString newState = message[1].toVariant().value.toString();
            if( oldState != newState ) {
                emit serviceStateChanged( QDBusObjectPath( QCString( m_proxy->path() )), oldState, newState );
                m_state = newState;
                sendSignalStrength();
            }
        }
        else if( prop == "Strength" ) {
            m_strength = message[1].toVariant().value.toByte();
            sendSignalStrength();
        }
    }
}
 void ServiceManagerModelPrivate::connectService(Service * service)
 {
     connect(service, SIGNAL(descriptionChanged(QString)), this, SLOT(onServiceDescriptionChanged(QString)));
     connect(service, SIGNAL(serviceStateChanged(Kend::Service::ServiceState)), this, SLOT(onServiceStateChanged(Kend::Service::ServiceState)));
     connect(service, SIGNAL(credentialsChanged(QVariantMap)), this, SLOT(onServiceCredentialsChanged(QVariantMap)));
 }
    AccountInfoPanel::AccountInfoPanel(Service * service, QWidget * parent)
        : QWidget(parent), service(service), serviceNameAlternative(false)
    {
        // Get defaults
        QVariantMap defaults(Utopia::defaults());

        serviceInfoLayout = new QGridLayout(this);

        // Account type (hidden until there are more possibilities)
        QLabel * serviceTypeLabel = new QLabel("Account type:");
        serviceInfoLayout->addWidget(serviceTypeLabel, 0, 0, Qt::AlignRight);
        serviceTypeLabel->hide();
        serviceType = new QLabel;
        serviceInfoLayout->addWidget(serviceType, 0, 1, 1, 2);
        serviceType->hide();

        // Service name
        QLabel * serviceNameLabel = new QLabel("Service name:");
        serviceNameLabel->installEventFilter(this);
        serviceInfoLayout->addWidget(serviceNameLabel, 1, 0, Qt::AlignRight);
        serviceName = new QLabel;
        serviceName->installEventFilter(this);
        serviceInfoLayout->addWidget(serviceName, 1, 1, 1, 2);

        // Account description
        serviceInfoLayout->addWidget(new QLabel("Description:"), 2, 0, Qt::AlignRight);
        descriptionLineEdit = new QLineEdit;
        connect(descriptionLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(onDescriptionChanged(const QString &)));
        serviceInfoLayout->addWidget(descriptionLineEdit, 2, 1, 1, 2);

        // Credentials
        // The following renaming is a temporary fix for commercial users whose usernames
        // are not email addresses
        userNameLabel = new QLabel(defaults.value("rename_username", "Email address").toString() + ":");
        serviceInfoLayout->addWidget(userNameLabel, 3, 0, Qt::AlignRight);
        userName = new QLineEdit;
        connect(userName, SIGNAL(textEdited(const QString &)), this, SLOT(onUserNameChanged(const QString &)));
        serviceInfoLayout->addWidget(userName, 3, 1);
        registerLabel = new QLabel("<a href='register' style='text-decoration: none'>Register</a>");
        registerLabel->setProperty("class", "link");
        connect(registerLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(onLinkActivated(const QString &)));
        serviceInfoLayout->addWidget(registerLabel, 3, 2);
        passwordLabel = new QLabel("Password:"******"<a href='resetPassword' style='text-decoration: none'>Reset Password</a>");
        resetPasswordLabel->setProperty("class", "link");
        connect(resetPasswordLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(onLinkActivated(const QString &)));
        serviceInfoLayout->addWidget(resetPasswordLabel, 4, 2);
        anonymousCheckBox = new QCheckBox("Use anonymously");
        connect(anonymousCheckBox, SIGNAL(clicked(bool)), this, SLOT(onAnonymousChanged(bool)));
        serviceInfoLayout->addWidget(anonymousCheckBox, 5, 1, 1, 2, Qt::AlignTop);

        profileButton = new QPushButton("User profile...");
        connect(profileButton, SIGNAL(clicked()), this, SLOT(onProfileButtonClicked()));
        serviceInfoLayout->addWidget(profileButton, 6, 0, 1, 3, Qt::AlignRight);

        // Disclaimer text
        disclaimer = new QLabel;
        disclaimer->setAlignment(Qt::AlignBottom | Qt::AlignLeft);
        disclaimer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
        disclaimer->setObjectName("disclaimer");
        serviceInfoLayout->addWidget(disclaimer, 6, 1, 1, 2);

        // Layout
        serviceInfoLayout->setColumnStretch(0, 0);
        serviceInfoLayout->setColumnStretch(1, 1);
        serviceInfoLayout->setRowStretch(0, 0);
        serviceInfoLayout->setRowStretch(1, 0);
        serviceInfoLayout->setRowStretch(2, 0);
        serviceInfoLayout->setRowStretch(3, 0);
        serviceInfoLayout->setRowStretch(4, 0);
        serviceInfoLayout->setRowStretch(5, 1);
        serviceInfoLayout->setRowStretch(6, 1);

        refreshInformation();

        setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);

        connect(service, SIGNAL(serviceStateChanged(Kend::Service::ServiceState)), this, SLOT(onServiceStateChanged(Kend::Service::ServiceState)));

        onServiceStateChanged(service->serviceState());
    }