Diffstat (limited to 'libopie/pim/odatebookaccessbackend_xml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/odatebookaccessbackend_xml.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/libopie/pim/odatebookaccessbackend_xml.cpp index a0ae7b7..ab2eea4 100644 --- a/libopie/pim/odatebookaccessbackend_xml.cpp +++ b/libopie/pim/odatebookaccessbackend_xml.cpp @@ -541,48 +541,66 @@ void ODateBookAccessBackend_XML::setField( OEvent& e, int id, const QString& val case FRHasEndDate: recur()->setHasEndDate( value.toInt() ); break; case FREndDate: { rp_end = (time_t) value.toLong(); break; } case FRStart: { start = (time_t) value.toLong(); break; } case FREnd: { end = ( (time_t) value.toLong() ); break; } case FNote: e.setNote( value ); break; case FCreated: created = value.toInt(); break; case FRecParent: e.setParent( value.toInt() ); break; case FRecChildren:{ QStringList list = QStringList::split(' ', value ); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { e.addChild( (*it).toInt() ); } } break; case FExceptions:{ QStringList list = QStringList::split(' ', value ); for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QDate date( (*it).left(4).toInt(), (*it).mid(4, 2).toInt(), (*it).right(2).toInt() ); qWarning("adding exception %s", date.toString().latin1() ); recur()->exceptions().append( date ); } } break; case FTimeZone: if ( value != "None" ) e.setTimeZone( value ); break; default: break; } } +QArray<int> ODateBookAccessBackend_XML::matchRegexp( const QRegExp &r ) const +{ + QArray<int> m_currentQuery( m_raw.count()+ m_rep.count() ); + uint arraycounter = 0; + QMap<int, OEvent>::ConstIterator it; + + for ( it = m_raw.begin(); it != m_raw.end(); ++it ) + if ( it.data().match( r ) ) + m_currentQuery[arraycounter++] = it.data().uid(); + for ( it = m_rep.begin(); it != m_rep.end(); ++it ) + if ( it.data().match( r ) ) + m_currentQuery[arraycounter++] = it.data().uid(); + + // Shrink to fit.. + m_currentQuery.resize(arraycounter); + + return m_currentQuery; +} |