summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/otodoaccessxml.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/backend/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp228
1 files changed, 114 insertions, 114 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 2d50ecd..cce6111 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -45,7 +45,7 @@
-#include <opie2/oconversion.h>
+#include <opie2/opimdateconversion.h>
#include <opie2/opimstate.h>
-#include <opie2/otimezone.h>
+#include <opie2/opimtimezone.h>
#include <opie2/opimnotifymanager.h>
-#include <opie2/orecur.h>
+#include <opie2/opimrecurrence.h>
#include <opie2/otodoaccessxml.h>
@@ -56,5 +56,5 @@ namespace {
time_t rp_end;
- ORecur* rec;
- ORecur *recur() {
- if (!rec ) rec = new ORecur;
+ OPimRecurrence* rec;
+ OPimRecurrence *recur() {
+ if (!rec ) rec = new OPimRecurrence;
return rec;
@@ -63,3 +63,3 @@ namespace {
enum MoreAttributes {
- FRType = OTodo::CompletedDate + 2,
+ FRType = OPimTodo::CompletedDate + 2,
FRWeekdays,
@@ -100,5 +100,5 @@ namespace Opie {
-OTodoAccessXML::OTodoAccessXML( const QString& appName,
+OPimTodoAccessXML::OPimTodoAccessXML( const QString& appName,
const QString& fileName )
- : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
+ : OPimTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false )
{
@@ -109,6 +109,6 @@ OTodoAccessXML::OTodoAccessXML( const QString& appName,
}
-OTodoAccessXML::~OTodoAccessXML() {
+OPimTodoAccessXML::~OPimTodoAccessXML() {
}
-bool OTodoAccessXML::load() {
+bool OPimTodoAccessXML::load() {
rec = 0;
@@ -122,21 +122,21 @@ bool OTodoAccessXML::load() {
dict.setAutoDelete( TRUE );
- dict.insert("Categories" , new int(OTodo::Category) );
- dict.insert("Uid" , new int(OTodo::Uid) );
- dict.insert("HasDate" , new int(OTodo::HasDate) );
- dict.insert("Completed" , new int(OTodo::Completed) );
- dict.insert("Description" , new int(OTodo::Description) );
- dict.insert("Summary" , new int(OTodo::Summary) );
- dict.insert("Priority" , new int(OTodo::Priority) );
- dict.insert("DateDay" , new int(OTodo::DateDay) );
- dict.insert("DateMonth" , new int(OTodo::DateMonth) );
- dict.insert("DateYear" , new int(OTodo::DateYear) );
- dict.insert("Progress" , new int(OTodo::Progress) );
- dict.insert("CompletedDate", new int(OTodo::CompletedDate) );
- dict.insert("StartDate", new int(OTodo::StartDate) );
- dict.insert("CrossReference", new int(OTodo::CrossReference) );
- dict.insert("State", new int(OTodo::State) );
- dict.insert("Alarms", new int(OTodo::Alarms) );
- dict.insert("Reminders", new int(OTodo::Reminders) );
- dict.insert("Notifiers", new int(OTodo::Notifiers) );
- dict.insert("Maintainer", new int(OTodo::Maintainer) );
+ dict.insert("Categories" , new int(OPimTodo::Category) );
+ dict.insert("Uid" , new int(OPimTodo::Uid) );
+ dict.insert("HasDate" , new int(OPimTodo::HasDate) );
+ dict.insert("Completed" , new int(OPimTodo::Completed) );
+ dict.insert("Description" , new int(OPimTodo::Description) );
+ dict.insert("Summary" , new int(OPimTodo::Summary) );
+ dict.insert("Priority" , new int(OPimTodo::Priority) );
+ dict.insert("DateDay" , new int(OPimTodo::DateDay) );
+ dict.insert("DateMonth" , new int(OPimTodo::DateMonth) );
+ dict.insert("DateYear" , new int(OPimTodo::DateYear) );
+ dict.insert("Progress" , new int(OPimTodo::Progress) );
+ dict.insert("CompletedDate", new int(OPimTodo::CompletedDate) );
+ dict.insert("StartDate", new int(OPimTodo::StartDate) );
+ dict.insert("CrossReference", new int(OPimTodo::CrossReference) );
+ dict.insert("State", new int(OPimTodo::State) );
+ dict.insert("Alarms", new int(OPimTodo::Alarms) );
+ dict.insert("Reminders", new int(OPimTodo::Reminders) );
+ dict.insert("Notifiers", new int(OPimTodo::Notifiers) );
+ dict.insert("Maintainer", new int(OPimTodo::Maintainer) );
dict.insert("rtype", new int(FRType) );
@@ -181,3 +181,3 @@ bool OTodoAccessXML::load() {
- OTodo ev;
+ OPimTodo ev;
m_year = m_month = m_day = 0;
@@ -244,4 +244,4 @@ bool OTodoAccessXML::load() {
if ( rec && rec->doesRecur() ) {
- OTimeZone utc = OTimeZone::utc();
- ORecur recu( *rec ); // call copy c'tor
+ OPimTimeZone utc = OPimTimeZone::utc();
+ OPimRecurrence recu( *rec ); // call copy c'tor
recu.setEndDate( utc.fromUTCDateTime( rp_end ).date() );
@@ -261,3 +261,3 @@ bool OTodoAccessXML::load() {
}
-bool OTodoAccessXML::reload() {
+bool OPimTodoAccessXML::reload() {
m_events.clear();
@@ -265,3 +265,3 @@ bool OTodoAccessXML::reload() {
}
-bool OTodoAccessXML::save() {
+bool OPimTodoAccessXML::save() {
// qWarning("saving");
@@ -281,3 +281,3 @@ bool OTodoAccessXML::save() {
// for all todos
- QMap<int, OTodo>::Iterator it;
+ QMap<int, OPimTodo>::Iterator it;
for (it = m_events.begin(); it != m_events.end(); ++it ) {
@@ -316,5 +316,5 @@ bool OTodoAccessXML::save() {
}
-QArray<int> OTodoAccessXML::allRecords()const {
+QArray<int> OPimTodoAccessXML::allRecords()const {
QArray<int> ids( m_events.count() );
- QMap<int, OTodo>::ConstIterator it;
+ QMap<int, OPimTodo>::ConstIterator it;
int i = 0;
@@ -327,3 +327,3 @@ QArray<int> OTodoAccessXML::allRecords()const {
}
-QArray<int> OTodoAccessXML::queryByExample( const OTodo&, int, const QDateTime& ) {
+QArray<int> OPimTodoAccessXML::queryByExample( const OPimTodo&, int, const QDateTime& ) {
QArray<int> ids(0);
@@ -331,6 +331,6 @@ QArray<int> OTodoAccessXML::queryByExample( const OTodo&, int, const QDateTime&
}
-OTodo OTodoAccessXML::find( int uid )const {
- OTodo todo;
+OPimTodo OPimTodoAccessXML::find( int uid )const {
+ OPimTodo todo;
todo.setUid( 0 ); // isEmpty()
- QMap<int, OTodo>::ConstIterator it = m_events.find( uid );
+ QMap<int, OPimTodo>::ConstIterator it = m_events.find( uid );
if ( it != m_events.end() )
@@ -340,3 +340,3 @@ OTodo OTodoAccessXML::find( int uid )const {
}
-void OTodoAccessXML::clear() {
+void OPimTodoAccessXML::clear() {
if (m_opened )
@@ -346,3 +346,3 @@ void OTodoAccessXML::clear() {
}
-bool OTodoAccessXML::add( const OTodo& todo ) {
+bool OPimTodoAccessXML::add( const OPimTodo& todo ) {
// qWarning("add");
@@ -353,3 +353,3 @@ bool OTodoAccessXML::add( const OTodo& todo ) {
}
-bool OTodoAccessXML::remove( int uid ) {
+bool OPimTodoAccessXML::remove( int uid ) {
m_changed = true;
@@ -359,3 +359,3 @@ bool OTodoAccessXML::remove( int uid ) {
}
-bool OTodoAccessXML::replace( const OTodo& todo) {
+bool OPimTodoAccessXML::replace( const OPimTodo& todo) {
m_changed = true;
@@ -365,3 +365,3 @@ bool OTodoAccessXML::replace( const OTodo& todo) {
}
-QArray<int> OTodoAccessXML::effectiveToDos( const QDate& start,
+QArray<int> OPimTodoAccessXML::effectiveToDos( const QDate& start,
const QDate& end,
@@ -369,3 +369,3 @@ QArray<int> OTodoAccessXML::effectiveToDos( const QDate& start,
QArray<int> ids( m_events.count() );
- QMap<int, OTodo>::Iterator it;
+ QMap<int, OPimTodo>::Iterator it;
@@ -387,3 +387,3 @@ QArray<int> OTodoAccessXML::effectiveToDos( const QDate& start,
}
-QArray<int> OTodoAccessXML::overDue() {
+QArray<int> OPimTodoAccessXML::overDue() {
QArray<int> ids( m_events.count() );
@@ -391,3 +391,3 @@ QArray<int> OTodoAccessXML::overDue() {
- QMap<int, OTodo>::Iterator it;
+ QMap<int, OPimTodo>::Iterator it;
for ( it = m_events.begin(); it != m_events.end(); ++it ) {
@@ -404,3 +404,3 @@ QArray<int> OTodoAccessXML::overDue() {
/* private */
-void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
+void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
const QCString& attr, const QString& val) {
@@ -418,45 +418,45 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
switch( *find ) {
- case OTodo::Uid:
+ case OPimTodo::Uid:
ev.setUid( val.toInt() );
break;
- case OTodo::Category:
+ case OPimTodo::Category:
ev.setCategories( ev.idsFromString( val ) );
break;
- case OTodo::HasDate:
+ case OPimTodo::HasDate:
ev.setHasDueDate( val.toInt() );
break;
- case OTodo::Completed:
+ case OPimTodo::Completed:
ev.setCompleted( val.toInt() );
break;
- case OTodo::Description:
+ case OPimTodo::Description:
ev.setDescription( val );
break;
- case OTodo::Summary:
+ case OPimTodo::Summary:
ev.setSummary( val );
break;
- case OTodo::Priority:
+ case OPimTodo::Priority:
ev.setPriority( val.toInt() );
break;
- case OTodo::DateDay:
+ case OPimTodo::DateDay:
m_day = val.toInt();
break;
- case OTodo::DateMonth:
+ case OPimTodo::DateMonth:
m_month = val.toInt();
break;
- case OTodo::DateYear:
+ case OPimTodo::DateYear:
m_year = val.toInt();
break;
- case OTodo::Progress:
+ case OPimTodo::Progress:
ev.setProgress( val.toInt() );
break;
- case OTodo::CompletedDate:
- ev.setCompletedDate( OConversion::dateFromString( val ) );
+ case OPimTodo::CompletedDate:
+ ev.setCompletedDate( OPimDateConversion::dateFromString( val ) );
break;
- case OTodo::StartDate:
- ev.setStartDate( OConversion::dateFromString( val ) );
+ case OPimTodo::StartDate:
+ ev.setStartDate( OPimDateConversion::dateFromString( val ) );
break;
- case OTodo::State:
+ case OPimTodo::State:
ev.setState( val.toInt() );
break;
- case OTodo::Alarms:{
+ case OPimTodo::Alarms:{
OPimNotifyManager &manager = ev.notifiers();
@@ -466,4 +466,4 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
qWarning("alarm: %s", alarm.join("___").latin1() );
- qWarning("alarm[0]: %s %s", alarm[0].latin1(), OConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
- OPimAlarm al( alarm[2].toInt(), OConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
+ qWarning("alarm[0]: %s %s", alarm[0].latin1(), OPimDateConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
+ OPimAlarm al( alarm[2].toInt(), OPimDateConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
manager.add( al );
@@ -472,3 +472,3 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
break;
- case OTodo::Reminders:{
+ case OPimTodo::Reminders:{
OPimNotifyManager &manager = ev.notifiers();
@@ -481,3 +481,3 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
break;
- case OTodo::CrossReference:
+ case OPimTodo::CrossReference:
{
@@ -501,13 +501,13 @@ void OTodoAccessXML::todo( QAsciiDict<int>* dict, OTodo& ev,
if ( val == "Daily" )
- recur()->setType( ORecur::Daily );
+ recur()->setType( OPimRecurrence::Daily );
else if ( val == "Weekly" )
- recur()->setType( ORecur::Weekly);
+ recur()->setType( OPimRecurrence::Weekly);
else if ( val == "MonthlyDay" )
- recur()->setType( ORecur::MonthlyDay );
+ recur()->setType( OPimRecurrence::MonthlyDay );
else if ( val == "MonthlyDate" )
- recur()->setType( ORecur::MonthlyDate );
+ recur()->setType( OPimRecurrence::MonthlyDate );
else if ( val == "Yearly" )
- recur()->setType( ORecur::Yearly );
+ recur()->setType( OPimRecurrence::Yearly );
else
- recur()->setType( ORecur::NoRepeat );
+ recur()->setType( OPimRecurrence::NoRepeat );
break;
@@ -555,3 +555,3 @@ QString customToXml(const QMap<QString, QString>& customMap )
-QString OTodoAccessXML::toString( const OTodo& ev )const {
+QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
QString str;
@@ -593,5 +593,5 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
if ( ev.hasStartDate() )
- str += "StartDate=\""+ OConversion::dateToString( ev.startDate() ) +"\" ";
+ str += "StartDate=\""+ OPimDateConversion::dateToString( ev.startDate() ) +"\" ";
if ( ev.hasCompletedDate() )
- str += "CompletedDate=\""+ OConversion::dateToString( ev.completedDate() ) +"\" ";
+ str += "CompletedDate=\""+ OPimDateConversion::dateToString( ev.completedDate() ) +"\" ";
if ( ev.hasState() )
@@ -612,3 +612,3 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
if ( (*it).dateTime().isValid() ) {
- als << OConversion::dateTimeToString( (*it).dateTime() )
+ als << OPimDateConversion::dateTimeToString( (*it).dateTime() )
+ ":" + QString::number( (*it).duration() )
@@ -624,3 +624,3 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
/*
- * now the same for reminders but more easy. We just save the uid of the OEvent.
+ * now the same for reminders but more easy. We just save the uid of the OPimEvent.
*/
@@ -641,3 +641,3 @@ QString OTodoAccessXML::toString( const OTodo& ev )const {
}
-QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
+QString OPimTodoAccessXML::toString( const QArray<int>& ints ) const {
return Qtopia::Record::idsToString( ints );
@@ -650,4 +650,4 @@ QString OTodoAccessXML::toString( const QArray<int>& ints ) const {
-struct OTodoXMLContainer {
- OTodo todo;
+struct OPimTodoXMLContainer {
+ OPimTodo todo;
};
@@ -655,3 +655,3 @@ struct OTodoXMLContainer {
namespace {
- inline QString string( const OTodo& todo) {
+ inline QString string( const OPimTodo& todo) {
return todo.summary().isEmpty() ?
@@ -660,3 +660,3 @@ namespace {
}
- inline int completed( const OTodo& todo1, const OTodo& todo2) {
+ inline int completed( const OPimTodo& todo1, const OPimTodo& todo2) {
int ret = 0;
@@ -666,9 +666,9 @@ namespace {
}
- inline int priority( const OTodo& t1, const OTodo& t2) {
+ inline int priority( const OPimTodo& t1, const OPimTodo& t2) {
return ( t1.priority() - t2.priority() );
}
- inline int description( const OTodo& t1, const OTodo& t2) {
+ inline int description( const OPimTodo& t1, const OPimTodo& t2) {
return QString::compare( string(t1), string(t2) );
}
- inline int deadline( const OTodo& t1, const OTodo& t2) {
+ inline int deadline( const OPimTodo& t1, const OPimTodo& t2) {
int ret = 0;
@@ -705,6 +705,6 @@ namespace {
*/
-class OTodoXMLVector : public QVector<OTodoXMLContainer> {
+class OPimTodoXMLVector : public QVector<OPimTodoXMLContainer> {
public:
- OTodoXMLVector(int size, bool asc, int sort)
- : QVector<OTodoXMLContainer>( size )
+ OPimTodoXMLVector(int size, bool asc, int sort)
+ : QVector<OPimTodoXMLContainer>( size )
{
@@ -715,3 +715,3 @@ public:
/* return the summary/description */
- QString string( const OTodo& todo) {
+ QString string( const OPimTodo& todo) {
return todo.summary().isEmpty() ?
@@ -728,4 +728,4 @@ public:
int ret =0;
- OTodoXMLContainer* con1 = (OTodoXMLContainer*)d1;
- OTodoXMLContainer* con2 = (OTodoXMLContainer*)d2;
+ OPimTodoXMLContainer* con1 = (OPimTodoXMLContainer*)d1;
+ OPimTodoXMLContainer* con2 = (OPimTodoXMLContainer*)d2;
@@ -818,6 +818,6 @@ public:
-QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
+QArray<int> OPimTodoAccessXML::sorted( bool asc, int sortOrder,
int sortFilter, int cat ) {
- OTodoXMLVector vector(m_events.count(), asc,sortOrder );
- QMap<int, OTodo>::Iterator it;
+ OPimTodoXMLVector vector(m_events.count(), asc,sortOrder );
+ QMap<int, OPimTodo>::Iterator it;
int item = 0;
@@ -853,3 +853,3 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
- OTodoXMLContainer* con = new OTodoXMLContainer();
+ OPimTodoXMLContainer* con = new OPimTodoXMLContainer();
con->todo = (*it);
@@ -868,5 +868,5 @@ QArray<int> OTodoAccessXML::sorted( bool asc, int sortOrder,
};
-void OTodoAccessXML::removeAllCompleted() {
- QMap<int, OTodo> events = m_events;
- for ( QMap<int, OTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
+void OPimTodoAccessXML::removeAllCompleted() {
+ QMap<int, OPimTodo> events = m_events;
+ for ( QMap<int, OPimTodo>::Iterator it = m_events.begin(); it != m_events.end(); ++it ) {
if ( (*it).isCompleted() )
@@ -876,3 +876,3 @@ void OTodoAccessXML::removeAllCompleted() {
}
-QBitArray OTodoAccessXML::supports()const {
+QBitArray OPimTodoAccessXML::supports()const {
static QBitArray ar = sup();
@@ -880,10 +880,10 @@ QBitArray OTodoAccessXML::supports()const {
}
-QBitArray OTodoAccessXML::sup() {
- QBitArray ar( OTodo::CompletedDate +1 );
+QBitArray OPimTodoAccessXML::sup() {
+ QBitArray ar( OPimTodo::CompletedDate +1 );
ar.fill( true );
- ar[OTodo::CrossReference] = false;
- ar[OTodo::State ] = false;
- ar[OTodo::Reminders] = false;
- ar[OTodo::Notifiers] = false;
- ar[OTodo::Maintainer] = false;
+ ar[OPimTodo::CrossReference] = false;
+ ar[OPimTodo::State ] = false;
+ ar[OPimTodo::Reminders] = false;
+ ar[OPimTodo::Notifiers] = false;
+ ar[OPimTodo::Maintainer] = false;
@@ -891,3 +891,3 @@ QBitArray OTodoAccessXML::sup() {
}
-QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const
+QArray<int> OPimTodoAccessXML::matchRegexp( const QRegExp &r ) const
{
@@ -896,3 +896,3 @@ QArray<int> OTodoAccessXML::matchRegexp( const QRegExp &r ) const
- QMap<int, OTodo>::ConstIterator it;
+ QMap<int, OPimTodo>::ConstIterator it;
for (it = m_events.begin(); it != m_events.end(); ++it ) {