Example #1
18
void NewAccount::addAccountDescription ()
  {
    // Function for adding or editing an account description.
    QDialog *description = new QDialog ( this, "description", TRUE );
    description->setCaption ( "Notes" );
    QMultiLineEdit *enter = new QMultiLineEdit ( description );
    enter->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) );
    enter->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) );
    enter->setWordWrap ( QMultiLineEdit::WidgetWidth );
    if ( accountdescription != "(NULL)" )
      enter->setText ( accountdescription );
    if ( description->exec () == QDialog::Accepted )
      accountdescription = enter->text ();
  }
Example #2
0
void classISQL::SaveSQL()
{
    QMultiLineEdit  *txt;
    QString         qsFileName;

    if ( pTabBar->currentTab() == 0 )
    {
        txt = txtSQL;
        qsFileName = qsSQLFileName;
    }
    else
    {
        txt = txtResults;
        qsFileName = qsResultsFileName;
    }

    if ( qsFileName == "" )
    {
        SaveAsSQL();
        return;
    }

    // TRY TO SAVE THE FILE
    QFile hFile( qsFileName );

    if ( !hFile.open( IO_WriteOnly ) )
        return;

    hFile.writeBlock( txt->text(), txt->text().length() );
    hFile.close();

}
Example #3
0
void classISQL::SaveAsSQL()
{
    QMultiLineEdit  *txt;
    QString         qsFileName;

    if ( pTabBar->currentTab() == 0 )
    {
        txt = txtSQL;
        qsFileName = qsSQLFileName;
    }
    else
    {
        txt = txtResults;
        qsFileName = qsResultsFileName;
    }

    // LET USER PICK A FILE
    QString qsFile = QFileDialog::getSaveFileName( qsFileName );
    if ( qsFile.isNull() )
        return;

    // TRY TO SAVE THE FILE
    QFile hFile( qsFile );

    if ( !hFile.open( IO_WriteOnly ) )
        return;

    hFile.writeBlock( txt->text(), txt->text().length() );
    hFile.close();

    if ( pTabBar->currentTab() == 0 )
    {
        qsSQLFileName = qsFile;
    }
    else
    {
        qsResultsFileName = qsFile;
    }

}
Example #4
0
QString JabberSearch::condition(bool &bXSearch)
{
    bXSearch = m_bXData;
    QString res;
    if (m_bXData)
        res += "x:data";

    QObjectList *l = queryList("QLineEdit");
    QObjectListIt it( *l );
    QObject *obj;
    while ((obj = it.current()) != 0 ){
        QLineEdit *edit = static_cast<QLineEdit*>(obj);
        if (!edit->text().isEmpty()){
            if (!res.isEmpty())
                res += ";";
            res += edit->name();
            res += "=";
            res += quoteChars(edit->text(), ";");
        }
        ++it;
    }
    delete l;

    l = queryList("QComboBox");
    QObjectListIt it1( *l );
    while ((obj = it1.current()) != 0 ){
        CComboBox *box = static_cast<CComboBox*>(obj);
        if (box->currentText().isEmpty()){
            ++it1;
            continue;
        }
        if (!res.isEmpty())
            res += ";";
        res += box->name();
        res += "=";
        res += quoteChars(box->value(), ";");
        ++it1;
    }
    delete l;

    l = queryList("QCheckBox");
    QObjectListIt it2( *l );
    while ((obj = it2.current()) != 0 ){
        QCheckBox *box = static_cast<QCheckBox*>(obj);
        if (!box->isChecked()){
            ++it2;
            continue;
        }
        if (!res.isEmpty())
            res += ";";
        res += box->name();
        res += "=1";
        ++it2;
    }
    delete l;

    l = queryList("QMultiLineEdit");
    QObjectListIt it3( *l );
    while ((obj = it3.current()) != 0 ){
        QMultiLineEdit *edit = static_cast<QMultiLineEdit*>(obj);
        if (!edit->text().isEmpty()){
            if (!res.isEmpty())
                res += ";";
            res += edit->name();
            res += "=";
            res += quoteChars(edit->text(), ";");
        }
        ++it3;
    }
    delete l;

    if (!m_key.empty()){
        if (!res.isEmpty())
            res += ";";
        res += "key=";
        res += quoteChars(QString::fromUtf8(m_key.c_str()), ";");
    }

    return res;
}
QString JabberSearch::condition(QWidget *w)
{
    QString res;
    if (m_bXData && (w == NULL))
        res += "x:data";

    if (w == NULL)
        w = this;

    QObjectList *l = w->queryList("QLineEdit");
    QObjectListIt it( *l );
    QObject *obj;
    while ((obj = it.current()) != 0 ){
        QLineEdit *edit = static_cast<QLineEdit*>(obj);
        if (!edit->text().isEmpty()){
            if (!res.isEmpty())
                res += ';';
            res += edit->name();
            res += '=';
            res += quoteChars(edit->text(), ";");
        }
        ++it;
    }
    delete l;

    l = w->queryList("QComboBox");
    QObjectListIt it1( *l );
    while ((obj = it1.current()) != 0 ){
        CComboBox *box = static_cast<CComboBox*>(obj);
        if (box->currentText().isEmpty()){
            ++it1;
            continue;
        }
        if (!res.isEmpty())
            res += ';';
        res += box->name();
        res += '=';
        res += quoteChars(box->value(), ";");
        ++it1;
    }
    delete l;

    l = w->queryList("QCheckBox");
    QObjectListIt it2( *l );
    while ((obj = it2.current()) != 0 ){
        QCheckBox *box = static_cast<QCheckBox*>(obj);
        if (!res.isEmpty())
            res += ';';
        res += box->name();
        res += box->isChecked() ? "=1" : "=0";
        ++it2;
    }
    delete l;

    l = w->queryList("QMultiLineEdit");
    QObjectListIt it3( *l );
    while ((obj = it3.current()) != 0 ){
        QMultiLineEdit *edit = static_cast<QMultiLineEdit*>(obj);
        if (!edit->text().isEmpty()){
            if (!res.isEmpty())
                res += ';';
            res += edit->name();
            res += '=';
            res += quoteChars(edit->text(), ";");
        }
        ++it3;
    }
    delete l;

    if (!m_key.isEmpty() && (w == NULL)){
        if (!res.isEmpty())
            res += ';';
        res += "key=";
        res += quoteChars(m_key, ";");
    }
    return res;
}