Пример #1
0
void MTPageAcct_Server::initializePage() //virtual
{
    std::string str_name;
    QString     qstr_id;
    // -------------------------------------------
    QString qstr_default_id = Moneychanger::It()->get_default_notary_id();
    // -------------------------------------------
    QString qstr_current_id = field("NotaryID").toString();
    // -------------------------------------------
    qstr_id = qstr_current_id.isEmpty() ? qstr_default_id : qstr_current_id;
    // -------------------------------------------
    if (qstr_id.isEmpty() && (opentxs::OTAPI_Wrap::It()->GetServerCount() > 0))
        qstr_id = QString::fromStdString(opentxs::OTAPI_Wrap::It()->GetServer_ID(0));
    // -------------------------------------------
    if (!qstr_id.isEmpty())
        str_name = opentxs::OTAPI_Wrap::It()->GetServer_Name(qstr_id.toStdString());
    // -------------------------------------------
    if (str_name.empty() || qstr_id.isEmpty())
        SetFieldsBlank();
    else
    {
        QString qstrName = QString::fromStdString(str_name);
        // ---------------------------
        setField("NotaryID",   qstr_id);
        setField("ServerName", qstrName);
        // ---------------------------
        ui->lineEditID->home(false);
        // ---------------------------
        if (qstr_default_id.isEmpty())
            emit SetDefaultServer(qstr_id, qstrName);
    }
}
Пример #2
0
void MTPageAcct_Server::on_pushButtonSelect_clicked()
{
    QString qstr_default_id = Moneychanger::It()->get_default_notary_id();
    // -------------------------------------------
    QString qstr_current_id = field("NotaryID").toString();
    // -------------------------------------------
    if (qstr_current_id.isEmpty())
        qstr_current_id = qstr_default_id;
    // -------------------------------------------
    if (qstr_current_id.isEmpty() && (opentxs::OTAPI_Wrap::It()->GetServerCount() > 0))
        qstr_current_id = QString::fromStdString(opentxs::OTAPI_Wrap::It()->GetServer_ID(0));
    // -------------------------------------------
    // Select from Servers in local wallet.
    //
    DlgChooser theChooser(this);
    // -----------------------------------------------
    mapIDName & the_map = theChooser.m_map;

    bool bFoundDefault = false;
    // -----------------------------------------------
    const int32_t the_count = opentxs::OTAPI_Wrap::It()->GetServerCount();
    // -----------------------------------------------
    for (int32_t ii = 0; ii < the_count; ++ii)
    {
        QString OT_id = QString::fromStdString(opentxs::OTAPI_Wrap::It()->GetServer_ID(ii));
        QString OT_name("");
        // -----------------------------------------------
        if (!OT_id.isEmpty())
        {
            if (!qstr_current_id.isEmpty() && (OT_id == qstr_current_id))
                bFoundDefault = true;
            // -----------------------------------------------
            OT_name = QString::fromStdString(opentxs::OTAPI_Wrap::It()->GetServer_Name(OT_id.toStdString()));
            // -----------------------------------------------
            the_map.insert(OT_id, OT_name);
        }
     }
    // -----------------------------------------------
    if (bFoundDefault)
        theChooser.SetPreSelected(qstr_current_id);
    // -----------------------------------------------
    theChooser.setWindowTitle(tr("Select the Server"));
    // -----------------------------------------------
    if (theChooser.exec() == QDialog::Accepted)
    {
        if (!theChooser.m_qstrCurrentID  .isEmpty() &&
            !theChooser.m_qstrCurrentName.isEmpty())
        {
            setField("NotaryID",   theChooser.m_qstrCurrentID);
            setField("ServerName", theChooser.m_qstrCurrentName);
            // -----------------------------------------
            ui->lineEditID->home(false);
            // -----------------------------------------
            if (qstr_default_id.isEmpty())
                emit SetDefaultServer(theChooser.m_qstrCurrentID, theChooser.m_qstrCurrentName);
        }
    }
}
Пример #3
0
void
Settings::RemoveServer(const char* server)
{
    int32 index = _GetStringByValue("server", server);
    if (index != B_ERROR) {
        fMessage.RemoveData("server", index);

        int32 count;
        fMessage.GetInfo("server", NULL, &count);
        if (GetDefaultServer() >= count)
            SetDefaultServer(count - 1);
    }
}
Пример #4
0
MTPageAcct_Server::MTPageAcct_Server(QWidget *parent) :
    QWizardPage(parent),
    m_bFirstRun(true),
    ui(new Ui::MTPageAcct_Server)
{
    ui->setupUi(this);

    QString style_sheet = "QPushButton{border: none; border-style: outset; text-align:left; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, stop: 1 #f6f7fa);}"
            "QPushButton:pressed {border: 1px solid black; text-align:left; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, stop: 1 #f6f7fa); }"
            "QPushButton:hover {border: 1px solid black; text-align:left; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, stop: 1 #f6f7fa); }";

    ui->pushButtonSelect->setStyleSheet(style_sheet);

    ui->lineEditID->setStyleSheet("QLineEdit { background-color: lightgray }");

    this->registerField("NotaryID*",  ui->lineEditID);
    this->registerField("ServerName", ui->pushButtonSelect, "text");
    // -----------------------------------------------
    connect(this, SIGNAL(SetDefaultServer(QString, QString)), Moneychanger::It(), SLOT(setDefaultServer(QString,QString)));
}
Пример #5
0
BOOL CDataProcess::InitInfo(CString strQueryUrl, long lInterval, bool bUseZipCompress, bool bGetType)
{
	m_lQueryInterval = lInterval;
	m_bDataGetType = bGetType;
	m_bUseZipCompress = bUseZipCompress;
	DWORD dwServiceType = 0;
	CString strServer = "";
	CString strObject = "";
	INTERNET_PORT nPort = 80;
	BOOL bRet = AfxParseURL(strQueryUrl, dwServiceType, strServer, m_strObject, nPort);
	if (!bRet)
	{
		return FALSE;
	}
	if (nPort == 443)
	{
		SetHttpType(0);
	}
	SetDefaultServer(LPCTSTR(strServer));
	return TRUE;
}