Exemplo n.º 1
0
bool CWizIndexBase::ModifyStyleEx(const WIZSTYLEDATA& data)
{
    qDebug() << "modify style, name: " << data.strName;

    Q_ASSERT(data.strKbGUID == m_strKbGUID);

    WIZSTYLEDATA dataOld;
    StyleFromGUID(data.strGUID, dataOld);

    CString strFormat = FormatUpdateSQLFormat(TABLE_NAME_WIZ_STYLE, FIELD_LIST_WIZ_STYLE_MODIFY, TABLE_KEY_WIZ_STYLE);

    CString strSQL;
    strSQL.Format(strFormat,
        STR2SQL(data.strName).utf16(),
        STR2SQL(data.strDescription).utf16(),
        COLOR2SQL(data.crTextColor).utf16(),
        COLOR2SQL(data.crBackColor).utf16(),
        data.bTextBold ? 1 : 0,
        data.nFlagIndex,
        TIME2SQL(data.tModified).utf16(),
        WizInt64ToStr(data.nVersion).utf16(),
        STR2SQL(data.strGUID).utf16()
        );

    if (!ExecSQL(strSQL))
        return false;

    WIZSTYLEDATA dataNew;
    StyleFromGUID(data.strGUID, dataNew);

    if (!m_bUpdating) {
        emit styleModified(dataOld, dataNew);
    }

    return true;
}
Exemplo n.º 2
0
bool CWizDatabase::UpdateStyle(const WIZSTYLEDATA& data)
{
    bool bRet = false;

    WIZSTYLEDATA dataTemp;
    if (StyleFromGUID(data.strGUID, dataTemp)) {
        bRet = ModifyStyleEx(data);
    } else {
        bRet = CreateStyleEx(data);
    }

    if (!bRet) {
        Q_EMIT updateError("Failed to update style: " + data.strName);
    }

    return bRet;
}