author | tille <tille> | 2003-05-10 16:48:06 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-10 16:48:06 (UTC) |
commit | 2a37284ab7ea4a29b6e55a84445ad5b2e3d6739b (patch) (side-by-side diff) | |
tree | 106fbe5d77b51b93662400360a7f50905be9f407 | |
parent | e4cde5a1da5271b8bc4919afedaf9cb47e346409 (diff) | |
download | opie-2a37284ab7ea4a29b6e55a84445ad5b2e3d6739b.zip opie-2a37284ab7ea4a29b6e55a84445ad5b2e3d6739b.tar.gz opie-2a37284ab7ea4a29b6e55a84445ad5b2e3d6739b.tar.bz2 |
QString::contains( QRegExp ) does not use the settings of QRegExp
(QT feature or bug?)
lets use QRegExp::match( QString ) instead
-rw-r--r-- | libopie/pim/oevent.cpp | 10 | ||||
-rw-r--r-- | libopie2/opiepim/oevent.cpp | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp index b731c8a..cda12f9 100644 --- a/libopie/pim/oevent.cpp +++ b/libopie/pim/oevent.cpp @@ -183,73 +183,73 @@ QDateTime OEvent::endDateTime()const { } QDateTime OEvent::endDateTimeInZone()const { /* if no timezone, or all day event or if the current and this timeZone match... */ if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); OTimeZone zone(data->timezone ); return zone.toDateTime( data->end, OTimeZone::current() ); } void OEvent::setEndDateTime( const QDateTime& dt ) { changeOrModify(); data->end = dt; } bool OEvent::isMultipleDay()const { return data->end.date().day() - data->start.date().day(); } bool OEvent::isAllDay()const { return data->isAllDay; } void OEvent::setAllDay( bool allDay ) { changeOrModify(); data->isAllDay = allDay; if (allDay ) data->timezone = "UTC"; } void OEvent::setTimeZone( const QString& tz ) { changeOrModify(); data->timezone = tz; } QString OEvent::timeZone()const { if (data->isAllDay ) return QString::fromLatin1("UTC"); return data->timezone; } bool OEvent::match( const QRegExp& re )const { - if (data->description.contains( re ) ) + if ( re.match( data->description ) != -1 ) return true; - if ( data->note.contains( re ) ) + if ( re.match( data->note ) != -1 ) return true; - if ( data->location.contains( re ) ) + if ( re.match( data->location ) != -1 ) return true; - if ( data->start.toString().contains( re ) ) + if ( re.match( data->start.toString() ) != -1 ) return true; - if ( data->end.toString().contains( re ) ) + if ( re.match( data->end.toString() ) != -1 ) return true; return false; } QString OEvent::toRichText()const { QString text; if ( !description().isEmpty() ) { text += "<b>" + QObject::tr( "Description:") + "</b><br>"; text += Qtopia::escapeString(description() ). replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if ( startDateTime().isValid() ) { text += "<b>" + QObject::tr( "Start:") + "</b> "; text += Qtopia::escapeString(startDateTime().toString() ). replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if ( endDateTime().isValid() ) { text += "<b>" + QObject::tr( "End:") + "</b> "; text += Qtopia::escapeString(endDateTime().toString() ). replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if ( !note().isEmpty() ) { text += "<b>" + QObject::tr( "Note:") + "</b><br>"; text += note(); // text += Qtopia::escapeString(note() ). // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } return text; } QString OEvent::toShortText()const { QString text; text += QString::number( startDateTime().date().day() ); text += "."; diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp index b731c8a..cda12f9 100644 --- a/libopie2/opiepim/oevent.cpp +++ b/libopie2/opiepim/oevent.cpp @@ -183,73 +183,73 @@ QDateTime OEvent::endDateTime()const { } QDateTime OEvent::endDateTimeInZone()const { /* if no timezone, or all day event or if the current and this timeZone match... */ if (data->timezone.isEmpty() || data->isAllDay || data->timezone == OTimeZone::current().timeZone() ) return endDateTime(); OTimeZone zone(data->timezone ); return zone.toDateTime( data->end, OTimeZone::current() ); } void OEvent::setEndDateTime( const QDateTime& dt ) { changeOrModify(); data->end = dt; } bool OEvent::isMultipleDay()const { return data->end.date().day() - data->start.date().day(); } bool OEvent::isAllDay()const { return data->isAllDay; } void OEvent::setAllDay( bool allDay ) { changeOrModify(); data->isAllDay = allDay; if (allDay ) data->timezone = "UTC"; } void OEvent::setTimeZone( const QString& tz ) { changeOrModify(); data->timezone = tz; } QString OEvent::timeZone()const { if (data->isAllDay ) return QString::fromLatin1("UTC"); return data->timezone; } bool OEvent::match( const QRegExp& re )const { - if (data->description.contains( re ) ) + if ( re.match( data->description ) != -1 ) return true; - if ( data->note.contains( re ) ) + if ( re.match( data->note ) != -1 ) return true; - if ( data->location.contains( re ) ) + if ( re.match( data->location ) != -1 ) return true; - if ( data->start.toString().contains( re ) ) + if ( re.match( data->start.toString() ) != -1 ) return true; - if ( data->end.toString().contains( re ) ) + if ( re.match( data->end.toString() ) != -1 ) return true; return false; } QString OEvent::toRichText()const { QString text; if ( !description().isEmpty() ) { text += "<b>" + QObject::tr( "Description:") + "</b><br>"; text += Qtopia::escapeString(description() ). replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if ( startDateTime().isValid() ) { text += "<b>" + QObject::tr( "Start:") + "</b> "; text += Qtopia::escapeString(startDateTime().toString() ). replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if ( endDateTime().isValid() ) { text += "<b>" + QObject::tr( "End:") + "</b> "; text += Qtopia::escapeString(endDateTime().toString() ). replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } if ( !note().isEmpty() ) { text += "<b>" + QObject::tr( "Note:") + "</b><br>"; text += note(); // text += Qtopia::escapeString(note() ). // replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; } return text; } QString OEvent::toShortText()const { QString text; text += QString::number( startDateTime().date().day() ); text += "."; |