//Try both DateFormat values ExtDate ExtDate::fromString( const QString& s ) { ExtDate dResult = ExtDate::fromString( s, Qt::TextDate ); if ( dResult.isValid() ) return dResult; dResult = ExtDate::fromString( s, Qt::ISODate ); if ( dResult.isValid() ) return dResult; else return ExtDate(); //invalid }
bool ExtDatePicker::setDate(const ExtDate& date) { if(date.isValid()) { table->setDate(date); // this also emits dateChanged() which then calls our dateChangedSlot() return true; } else { kdDebug(298) << "ExtDatePicker::setDate: refusing to set invalid date." << endl; return false; } }
ExtDate timeBox::createDate (bool */*ok*/) { QString entry = text().stripWhiteSpace(); // if entry is an empty string or invalid date use current date ExtDate date = ExtDate().fromString(entry); if ( !date.isValid() ) { kdDebug() << k_funcinfo << "Invalid date" << endl; showDate(ExtDate::currentDate()); entry = text().stripWhiteSpace(); return ExtDate::currentDate(); } else { return date; } }