Fixing display of user defined variables of type date (and time) , need help

Friedrich W. H. Kossebau kossebau at kde.org
Thu Sep 27 17:49:49 BST 2012


Hi,

I looked into why date variables are always only displayed with the default 
format and found that the error lies in that KoOdfNumberStyles::format(...) 
expects the value for date (and seems also time) to be a number in string 
form:
--- 8< ---
QString format(...)
{
[...]
         case Date: {
            bool ok;
            int v = value.toInt(&ok);
            return ok ? formatDate(v, format.formatStr) : value;
[...]
}
--- 8< ---

Problem now is that DateVariable keeps the value as date string around and not 
in that single number string version (from what I understood, no yet the 
complete picture).

There is also this TODO (from you, Sebastian):
--- 8< ---
void UserVariable::valueChanged()
{
    //TODO apply following also to plugins/variables/DateVariable.cpp:96
    //TODO handle formula
    QString value = variableManager()->value(m_name);
    value = KoOdfNumberStyles::format(value, m_numberstyle);
kDebug() << m_name<<variableManager()->value(m_name) << 
m_numberstyle.formatStr << value;
    setValue(value);
}
--- 8< ---

Are you working on this any time soon, Sebastian? Or could you point me into 
the direction how this TODO is planned to be solved, so I can give it a try?

Cheers
Friedrich



More information about the calligra-devel mailing list