Example #1
0
int Q3DataBrowser::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 24)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 24;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = boundaryChecking(); break;
        case 1: *reinterpret_cast< QString*>(_v) = filter(); break;
        case 2: *reinterpret_cast< QStringList*>(_v) = sort(); break;
        case 3: *reinterpret_cast< bool*>(_v) = confirmEdits(); break;
        case 4: *reinterpret_cast< bool*>(_v) = confirmInsert(); break;
        case 5: *reinterpret_cast< bool*>(_v) = confirmUpdate(); break;
        case 6: *reinterpret_cast< bool*>(_v) = confirmDelete(); break;
        case 7: *reinterpret_cast< bool*>(_v) = confirmCancels(); break;
        case 8: *reinterpret_cast< bool*>(_v) = isReadOnly(); break;
        case 9: *reinterpret_cast< bool*>(_v) = autoEdit(); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setBoundaryChecking(*reinterpret_cast< bool*>(_v)); break;
        case 1: setFilter(*reinterpret_cast< QString*>(_v)); break;
        case 2: setSort(*reinterpret_cast< QStringList*>(_v)); break;
        case 3: setConfirmEdits(*reinterpret_cast< bool*>(_v)); break;
        case 4: setConfirmInsert(*reinterpret_cast< bool*>(_v)); break;
        case 5: setConfirmUpdate(*reinterpret_cast< bool*>(_v)); break;
        case 6: setConfirmDelete(*reinterpret_cast< bool*>(_v)); break;
        case 7: setConfirmCancels(*reinterpret_cast< bool*>(_v)); break;
        case 8: setReadOnly(*reinterpret_cast< bool*>(_v)); break;
        case 9: setAutoEdit(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 10;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 10;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 10;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Example #2
0
void Q3DataBrowser::insert()
{
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return;
    bool doIns = true;
    QSql::Confirm conf = QSql::Yes;
    switch (d->dat.mode()) {
    case QSql::Insert:
        if (autoEdit()) {
            if (confirmInsert())
                conf = confirmEdit(QSql::Insert);
            switch (conf) {
            case QSql::Yes:
                insertCurrent();
                break;
            case QSql::No:
                break;
            case QSql::Cancel:
                doIns = false;
                break;
            }
        }
        break;
    default:
        if (autoEdit() && currentEdited()) {
            if (confirmUpdate())
                conf = confirmEdit(QSql::Update);
            switch (conf) {
            case QSql::Yes:
                updateCurrent();
                break;
            case QSql::No:
                break;
            case QSql::Cancel:
                doIns = false;
                break;
            }
        }
        break;
    }
    if (doIns) {
        d->dat.setMode(QSql::Insert);
        sqlCursor()->primeInsert();
        emit primeInsert(d->frm.record());
        readFields();
    }
}
Example #3
0
bool Q3DataBrowser::preNav()
{
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return false;

    if (!isReadOnly() && autoEdit() && currentEdited()) {
        bool ok = true;
        QSql::Confirm conf = QSql::Yes;
        switch (d->dat.mode()){
        case QSql::Insert:
            if (confirmInsert())
                conf = confirmEdit(QSql::Insert);
            switch (conf) {
            case QSql::Yes:
                ok = insertCurrent();
                d->dat.setMode(QSql::Update);
                break;
            case QSql::No:
                d->dat.setMode(QSql::Update);
                break;
            case QSql::Cancel:
                return false;
            }
            break;
        default:
            if (confirmUpdate())
                conf = confirmEdit(QSql::Update);
            switch (conf) {
            case QSql::Yes:
                ok = updateCurrent();
                break;
            case QSql::No:
                break;
            case QSql::Cancel:
                return false;
            }
        }
        return ok;
    }
    return true;
}
Example #4
0
void Q3DataBrowser::update()
{
    QSqlRecord* buf = d->frm.record();
    Q3SqlCursor* cur = d->cur.cursor();
    if (!buf || !cur)
        return;
    QSql::Confirm conf = QSql::Yes;
    switch (d->dat.mode()){
    case QSql::Insert:
        if (confirmInsert())
            conf = confirmEdit(QSql::Insert);
        switch (conf) {
            case QSql::Yes:
                if (insertCurrent())
                    d->dat.setMode(QSql::Update);
            break;
            case QSql::No:
                d->dat.setMode(QSql::Update);
            cur->editBuffer(true);
            readFields();
            break;
            case QSql::Cancel:
            break;
        }
    break;
    default:
        d->dat.setMode(QSql::Update);
        if (confirmUpdate())
            conf = confirmEdit(QSql::Update);
        switch (conf) {
        case QSql::Yes:
            updateCurrent();
            break;
        case QSql::No:
        case QSql::Cancel:
            break;
        }
        break;
    }
}
Example #5
0
bool Q3DataManager::confirmEdits() const
{
    return (confirmInsert() && confirmUpdate() && confirmDelete());
}