Beispiel #1
0
bool KeyValuesTable::check_unique()
{
    forceUpdateCells();

    unsigned n = numRows();

    if (n != 0) {
        unsigned index;

        if (text(n - 1, 0).isEmpty())
            n -= 1;

        QStringList l;

        for (index = 0; index != n; index += 1) {
            const QString & s = text(index, 0);

            if (l.findIndex(s) != -1) {
                msg_critical(TR("Error"), TR("key '%1' used several times", s));
                return FALSE;
            }
            else
                l.append(s);
        }
    }

    return TRUE;
}
bool KeyValuesTable::check_unique()
{
    forceUpdateCells();

    unsigned n = rowCount();

    if (n != 0) {
        unsigned index;

        if (text(n - 1, 0).isEmpty())
            n -= 1;

        QStringList l;

        for (index = 0; index != n; index += 1) {
            const QString & s = text(index, 0);

            if (l.indexOf(s) != -1) {
                msg_critical(tr("Error"), QObject::tr("key '%1' used several times").arg(s));
                return FALSE;
            }
            else
                l.append(s);
        }
    }

    return TRUE;
}
Beispiel #3
0
void KeyValuesTable::update(HaveKeyValueData * oper) {
  forceUpdateCells();
  
  unsigned n = numRows();
  unsigned index;
  
  if (text(n - 1, 0).isEmpty())
    n -= 1;
  
  oper->set_n_keys(n);
  
  for (index = 0; index != n; index += 1) {
    oper->set_key(index, fromUnicode(text(index, 0)));
    oper->set_value(index, fromUnicode(text(index, 1)));
  }
}