Exemple #1
0
QVariantMap RunConfiguration::toMap() const
{
    QVariantMap map = ProjectConfiguration::toMap();

    map.unite(m_debuggerAspect->toMap());

    foreach (IRunConfigurationAspect *aspect, m_aspects)
        map.unite(aspect->toMap());

    return map;
}
    bool SignonIdentity::verifyUser(const QVariantMap &params)
    {
        SIGNON_RETURN_IF_CAM_UNAVAILABLE(false);

        bool ok;
        SignonIdentityInfo info = queryInfo(ok, true);

        if (!ok) {
            BLAME() << "Identity not found.";
            replyError(SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME,
                       SIGNOND_IDENTITY_NOT_FOUND_ERR_STR);
            return false;
        }
        if (!info.storePassword() || info.password().isEmpty()) {
            BLAME() << "Password is not stored.";
            replyError(SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME,
                       SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR);
            return false;
        }

        //delay dbus reply, ui interaction might take long time to complete
        setDelayedReply(true);
        m_message = message();

        //create ui request to ask password
        QVariantMap uiRequest;
        uiRequest.unite(params);
        uiRequest.insert(SSOUI_KEY_QUERYPASSWORD, true);
        uiRequest.insert(SSOUI_KEY_USERNAME, info.userName());
        uiRequest.insert(SSOUI_KEY_CAPTION, info.caption());

        queryUserPassword(uiRequest);
        return false;
    }
QVariantMap LocalTransformManager::transformList() const
{
    QVariantMap modelsVariantMap;

    foreach(const LocalTransformInfo _localTransform, _localTransformInfos)
    {
        modelsVariantMap.unite(transformToMap(_localTransform.model));
    }
Exemple #4
0
JsonReply* JsonRPCServer::Introspect(const QVariantMap &params) const
{
    Q_UNUSED(params)

    QVariantMap data;
    data.insert("types", JsonTypes::allTypes());
    QVariantMap methods;
    foreach (JsonHandler *handler, m_handlers) {
        methods.unite(handler->introspect(QMetaMethod::Method));
    }
Exemple #5
0
void Process::check_error(QVariantMap const &error_info)
{
    if (!rc())
        return;
    QVariantMap err = {{"msg", "Process error"}
                       , {"cmd", ps->program()}
                       , {"args", QVariant(ps->arguments())}
                       , {"rc", rc()}
                       , {"stderr", stderr()}
                       , {"stdout", stdout()}
                       , {"info", errorInfo()}};
    err.unite(error_info);
    error::raise(err);
}
Exemple #6
0
QVariantMap GsmDbus::toMap()
{
  QVariantMap map;
  Knm::GsmSetting * setting = static_cast<Knm::GsmSetting *>(m_setting);
  if (!setting->number().isEmpty())
      map.insert(QLatin1String(NM_SETTING_GSM_NUMBER), setting->number());
  if (!setting->username().isEmpty())
      map.insert(QLatin1String(NM_SETTING_GSM_USERNAME), setting->username());
  if (!setting->apn().isEmpty())
      map.insert(QLatin1String(NM_SETTING_GSM_APN), setting->apn());
  if (!setting->networkid().isEmpty())
      map.insert(QLatin1String(NM_SETTING_GSM_NETWORK_ID), setting->networkid());
  if (setting->networktype() != NM_SETTING_GSM_NETWORK_TYPE_ANY) {
      map.insert(QLatin1String(NM_SETTING_GSM_NETWORK_TYPE), setting->networktype());
  }
  insertIfTrue(map, NM_SETTING_GSM_HOME_ONLY, setting->homeonly());

  map.unite(toSecretsMap());
  map.insert(QLatin1String(NM_SETTING_GSM_PASSWORD_FLAGS), (int)setting->passwordflags());
  map.insert(QLatin1String(NM_SETTING_GSM_PIN_FLAGS), (int)setting->pinflags());

  //map.insert("band", setting->band());
  return map;
}
Exemple #7
0
QVariantMap Security8021xDbus::toMap()
{
    QVariantMap map;
    Knm::Security8021xSetting * setting = static_cast<Knm::Security8021xSetting *>(m_setting);
    if (setting->enabled()) {
        if (!setting->eap().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_EAP), setting->eap());
        }
        if (!setting->identity().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_IDENTITY), setting->identity());
        }
        if (!setting->anonymousidentity().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_ANONYMOUS_IDENTITY), setting->anonymousidentity());
        }
        if (!setting->cacert().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_CA_CERT), setting->cacert());
        }
        if (!setting->capath().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_CA_PATH), setting->capath());
        }
#if defined(NM_SETTING_802_1X_SUBJECT_MATCH)
        if (!setting->subjectmatch().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_SUBJECT_MATCH), setting->subjectmatch());
        }
#endif
#if defined(NM_SETTING_802_1X_ALTSUBJECT_MATCHES)
        if (!setting->altsubjectmatches().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_ALTSUBJECT_MATCHES), setting->altsubjectmatches());
        }
#endif
        if (!setting->clientcert().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_CLIENT_CERT), setting->clientcert());
        }
        if (setting->eap().contains(QLatin1String("peap"))) {
            switch (setting->phase1peapver()) {
                case Knm::Security8021xSetting::EnumPhase1peapver::zero:
                    map.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPVER), "0");
                    break;
                case Knm::Security8021xSetting::EnumPhase1peapver::one:
                    map.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPVER), "1");
                    if (!setting->phase1peaplabel().isEmpty()) {
                        map.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_PEAPLABEL), setting->phase1peaplabel());
                    }
                    break;
            }
        }
        if (!setting->phase1fastprovisioning().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING), setting->phase1fastprovisioning());
        }
        switch (setting->phase2auth()) {
            case Knm::Security8021xSetting::EnumPhase2auth::none:
                //map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "none");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::pap:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "pap");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::mschap:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "mschap");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::mschapv2:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "mschapv2");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::chap:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "chap");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::md5:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "md5");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::gtc:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "gtc");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::otp:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "otp");
                break;
            case Knm::Security8021xSetting::EnumPhase2auth::tls:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTH), "tls");
                break;
        }
        switch (setting->phase2autheap()) {
            case Knm::Security8021xSetting::EnumPhase2autheap::none:
                //map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), "none");
                break;
            case Knm::Security8021xSetting::EnumPhase2autheap::md5:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), "md5");
                break;
            case Knm::Security8021xSetting::EnumPhase2autheap::gtc:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), "gtc");
                break;
            case Knm::Security8021xSetting::EnumPhase2autheap::otp:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), "otp");
                break;
            case Knm::Security8021xSetting::EnumPhase2autheap::mschapv2:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), "mschapv2");
                break;
            case Knm::Security8021xSetting::EnumPhase2autheap::tls:
                map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_AUTHEAP), "tls");
                break;
        }
        if (!setting->phase2cacert().isEmpty())
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_CERT), setting->phase2cacert());
        if (!setting->phase2capath().isEmpty())
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_CA_PATH), setting->phase2capath());
#if defined(NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH)
        if (!setting->phase2subjectmatch().isEmpty())
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH), setting->phase2subjectmatch());
#endif
#if defined(NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES)
        if (!setting->phase2altsubjectmatches().isEmpty())
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES), setting->phase2altsubjectmatches());
#endif
        if (!setting->phase2clientcert().isEmpty())
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_CLIENT_CERT), setting->phase2clientcert());
        if (!setting->phase2privatekey().isEmpty())
            map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY), setting->phase2privatekey());
        if (!setting->privatekey().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY), setting->privatekey());
        }
        if (!setting->pin().isEmpty()) {
            map.insert(QLatin1String(NM_SETTING_802_1X_PIN), setting->pin());
            map.insert(QLatin1String(NM_SETTING_802_1X_PIN_FLAGS), (int)setting->pinflags());
        }
        if (!setting->eap().contains(QLatin1String("leap"))) {
            map.insert(QLatin1String(NM_SETTING_802_1X_SYSTEM_CA_CERTS), setting->useSystemCaCerts());
        }

        map.unite(toSecretsMap());

        map.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_FLAGS), (int)setting->passwordflags());
        map.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS), (int)setting->privatekeypasswordflags());
        map.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS), (int)setting->phase2privatekeypasswordflags());
    }
    return map;
}
Exemple #8
0
/*!
  Returns a map of all form data.
*/
QVariantMap THttpRequest::allParameters() const
{
    QVariantMap params = d->queryItems;
    return params.unite(d->formItems);
}
Exemple #9
0
 foreach (JsonHandler *handler, m_handlers) {
     signalsMap.unite(handler->introspect(QMetaMethod::Signal));
 }
QVariantMap WirelessSecurityDbus::toMap()
{
    QVariantMap map;
    Knm::WirelessSecuritySetting *setting = static_cast<Knm::WirelessSecuritySetting *>(m_setting);

    if (setting->securityType() != Knm::WirelessSecuritySetting::EnumSecurityType::None)
        // don't return anything if there is no security
    {
        switch (setting->keymgmt())
        {
            case Knm::WirelessSecuritySetting::EnumKeymgmt::None:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT), "none");
                qDebug() << "Adding key-mgmt: none";
                break;
            case Knm::WirelessSecuritySetting::EnumKeymgmt::Ieee8021x:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT), "ieee8021x");
                qDebug() << "Adding key-mgmt: ieee8021x";
                break;
            case Knm::WirelessSecuritySetting::EnumKeymgmt::WPANone:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT), "wpa-none");
                qDebug() << "Adding key-mgmt: wpa-none";
                break;
            case Knm::WirelessSecuritySetting::EnumKeymgmt::WPAPSK:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT), "wpa-psk");
                qDebug() << "Adding key-mgmt: wpa-psk";
                break;
            case Knm::WirelessSecuritySetting::EnumKeymgmt::WPAEAP:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT), "wpa-eap");
                qDebug() << "Adding key-mgmt: wpa-eap";
                break;
        }
        switch (setting->authalg())
        {
            case Knm::WirelessSecuritySetting::EnumAuthalg::none:
                // the none auth alg is internal
                break;
            case Knm::WirelessSecuritySetting::EnumAuthalg::open:
                // the default
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_AUTH_ALG), "open");
                break;
            case Knm::WirelessSecuritySetting::EnumAuthalg::shared:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_AUTH_ALG), "shared");
                break;
            case Knm::WirelessSecuritySetting::EnumAuthalg::leap:
                map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_AUTH_ALG), "leap");
                break;
        }
        if (!setting->proto().isEmpty())
        {
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_PROTO), setting->proto());
        }
        if (!setting->pairwise().isEmpty())
        {
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_PAIRWISE), setting->pairwise());
        }
        if (!setting->group().isEmpty())
        {
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_GROUP), setting->group());
        }
        if (!setting->leapusername().isEmpty())
        {
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME), setting->leapusername());
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD_FLAGS), (int)setting->leappasswordflags());
        }

        map.unite(toSecretsMap());

        if (!setting->wepkey0().isEmpty() || !setting->wepkey1().isEmpty() ||  !setting->wepkey2().isEmpty() || !setting->wepkey3().isEmpty())
        {
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS), (int)setting->wepkeyflags());
        }
        if (!setting->psk().isEmpty())
        {
            map.insert(QLatin1String(NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS), (int)setting->pskflags());
        }

    } // end of if not setting->clear()
    return map;
}
bool SqlDataQuery::getDataResults(QSqlDatabase &connection, int offset,
        int limit, QList<DataItem> *results) {

    if (!m_query.isEmpty()) {
        // are we using caching to optimize scrolling queries?
        // ???? how to deal with overlapping names between valueBinding and DataItem ???????
        QString queryToUse = m_query;
        QVariantMap valuesToUse = m_bindValues;
        int offsetToUse = offset;
        bool useCache = !m_scrollUpQuery.isEmpty()
                         && !m_scrollDownQuery.isEmpty();
        if (useCache && 0 < m_endOffset) {
            // we have previously cached data
            if (offset < m_startOffset) {
                // we're moving up the list
                if (m_startOffset == (offset + limit)) {
                    // we have a cached anchor item we can use for optimized query
                    queryToUse = m_scrollUpQuery;
                    valuesToUse.unite(m_startItem.payload().toMap());
                    ++m_scrollUpCount;
                }
            } else if (offset > m_startOffset) {
                // moving down the list
                if (m_endOffset == (offset - 1)) {
                    // we have a cached anchor item we can use for optimized query
                    queryToUse = m_scrollDownQuery;
                    valuesToUse.unite(m_endItem.payload().toMap());
                    offsetToUse = 0; // do not use offset
                    ++m_scrollDownCount;
                }
            }
        }
        qDebug() << "Current query statistics: total queries = " << ++m_totalCount
                 << ", queries using scrollUp optimization = " << m_scrollUpCount
                 << ", queries using scrollDown optimization = " << m_scrollDownCount;

        // Get the data.
        if (!SqlQueryUtils().getQueryData(connection, queryToUse, offsetToUse,
                limit, valuesToUse, m_keyColumn, m_revisionColumn, results,
                &m_error)) {
            qWarning() << "Failed to load the data.";
            qDebug() << "queryToUse=" << queryToUse << ",offsetToUse="
                     << offsetToUse << ",valuesToUse=" << valuesToUse
                     << ",m_error=" << m_error;
        } else {
            // Success - update cache if we're using it
            if (useCache) {
                int resultCount = results->size();
                if (resultCount < 2) {
                    // next time - this will indicate that we do not have cached data
                    m_startOffset = -1;
                    m_endOffset = -1;
                } else {
                    m_startOffset = offset;
                    m_endOffset = offset + resultCount - 1;
                    m_startItem = results->at(0);
                    m_endItem = results->at(resultCount - 1);
                    //TDEBUG << "Caching: start=" <<  m_startOffset << ", " << m_startItem;
                    //TDEBUG << "Caching: end=" <<  m_endOffset << ", " << m_endItem;
                }
            }
            return true;
        }
    } else {
        qWarning() << "The Query is empty.";
    }
    return false;
}
QVariantMap AnalyzerSettings::defaults() const
{
    QVariantMap map;
    foreach (AbstractAnalyzerSubConfig *config, subConfigs()) {
        map.unite(config->defaults());
    }