Ejemplo n.º 1
0
WelcomeDialog::WelcomeDialog(const QString &strDefaultUserId, const QString& strLocale, QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::WelcomeDialog)
    , m_strDefaultUserId(strDefaultUserId)
    , m_verifyAccount(WIZ_API_URL)
{
    ui->setupUi(this);

    ui->labelProxySettings->setText(WizFormatString1("<a href=\"proxy_settings\">%1</a>", tr("Proxy settings")));

    // load webview content
    QString strLocalFileName = ::WizGetResourcesPath() + "languages/welcome_" + strLocale + ".htm";
    QString strFileName = ::WizGetResourcesPath() + "languages/welcome.htm";
    if (PathFileExists(strLocalFileName))
    {
        strFileName = strLocalFileName;
    }

    QPalette pal = palette();
    QColor color = pal.color(QPalette::Background);

    CString strHtml;
    ::WizLoadUnicodeTextFromFile(strFileName, strHtml);
    strHtml.replace("ButtonFace", "#" + ::WizColorToString(color));

    ui->webView->setHtml(strHtml, QUrl::fromLocalFile(strFileName));
    ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);

    connect(ui->webView, SIGNAL(linkClicked(const QUrl&)), \
            SLOT(on_webView_linkClicked(const QUrl&)), Qt::UniqueConnection);

    connect(ui->labelProxySettings, SIGNAL(linkActivated(const QString&)), \
            SLOT(on_labelProxySettings_linkActivated(const QString&)), \
            Qt::UniqueConnection);

    connect(ui->comboUsers, SIGNAL(activated(const QString&)), \
            SLOT(on_comboUsers_activated(const QString&)));

    connect(ui->comboUsers, SIGNAL(editTextChanged(const QString&)), \
            SLOT(on_comboUsers_editTextChanged(const QString&)));

    connect(ui->checkAutoLogin, SIGNAL(stateChanged(int)), \
            SLOT(on_checkAutoLogin_stateChanged(int)));

    connect(ui->buttonLogin, SIGNAL(clicked()), SLOT(accept()));

    connect(&m_verifyAccount, SIGNAL(done(bool, const CString&)), \
            SLOT(verifyAccountDone(bool, const CString&)));

    setUsers();

    setFixedSize(size());
}
mongo::ListSessionsSpec mongo::listSessionsParseSpec(StringData stageName,
                                                     const BSONElement& spec) {
    uassert(ErrorCodes::TypeMismatch,
            str::stream() << stageName << " options must be specified in an object, but found: "
                          << typeName(spec.type()),
            spec.type() == BSONType::Object);

    IDLParserErrorContext ctx(stageName);
    auto ret = ListSessionsSpec::parse(ctx, spec.Obj());

    uassert(ErrorCodes::UnsupportedFormat,
            str::stream() << stageName
                          << " may not specify {allUsers:true} and {users:[...]} at the same time",
            !ret.getAllUsers() || !ret.getUsers() || ret.getUsers()->empty());

    // Verify that the correct state is set on the client.
    uassert(
        31106,
        str::stream() << "The " << DocumentSourceListLocalSessions::kStageName
                      << "stage is not allowed in this context :: missing an AuthorizationManager",
        AuthorizationManager::get(Client::getCurrent()->getServiceContext()));
    uassert(
        31111,
        str::stream() << "The " << DocumentSourceListLocalSessions::kStageName
                      << "stage is not allowed in this context :: missing a LogicalSessionCache",
        LogicalSessionCache::get(Client::getCurrent()->getOperationContext()));

    if (!ret.getAllUsers() && (!ret.getUsers() || ret.getUsers()->empty())) {
        // Implicit request for self
        const auto& userName =
            getUserNameForLoggedInUser(Client::getCurrent()->getOperationContext());
        ret.setUsers(std::vector<ListSessionsUser>({userName}));
    }

    return ret;
}
Ejemplo n.º 3
0
Settings::Settings(QMap<QString, QVariant> language, QMap<QString, QString> settings, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Settings)
{
    ui->setupUi(this);

    setLanguageChoice(language);

    setLanguage(settings);
    setNewData(settings);
    setLoadData(settings);
    setSaveAsData(settings);
    setSaveData(settings);
    setQuit(settings);
    setUsers(settings);
    setSearch(settings);
    setSeeCategory(settings);
    setAddCategory(settings);
    setRemoveCategory(settings);
    setSeeMedia(settings);
    setAddMedia(settings);
    setRemoveMedia(settings);
    setSettings(settings);
}