From 22e0b0ddd78f13b2648befe892d9ec6c5b1b1229 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 12 Feb 2009 14:42:04 +0000 Subject: Added fuzziness attribute. --- client/widgets/datetime.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/client/widgets/datetime.cc b/client/widgets/datetime.cc index 40aa31a..8f85186 100644 --- a/client/widgets/datetime.cc +++ b/client/widgets/datetime.cc @@ -38,6 +38,38 @@ DateTime::DateTime(QDomNode &node, MacroWindow *macrowindow) setMinimumDateTime(QDateTime::fromTime_t(0)); QDomElement elem = node.toElement(); + + switch(elem.attribute("fuzziness", "5").toLong()) { + case 1: + setDisplayFormat("yyyy"); + break; + + case 2: + setDisplayFormat("MMM yyyy"); + break; + + case 3: + setDisplayFormat("dd MMM yyyy"); + break; + + case 4: + setDisplayFormat("dd MMM yyyy hh"); + break; + + case 5: + setDisplayFormat("dd MMM yyyy hh:mm"); + break; + + case 6: + setDisplayFormat("dd MMM yyyy hh:mm:ss"); + break; + + case 7: + default: + setDisplayFormat("dd MMM yyyy hh:mm:ss:zzz"); + break; + } + /* if(elem.hasAttribute("readonly")) { if(elem.attribute("readonly") == "true" || elem.attribute("readonly") == "1") { -- cgit v1.2.3