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.cpp191
1 files changed, 98 insertions, 93 deletions
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index cce6111..3e06d88 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -28,2 +28,21 @@
*/
+
+/* OPIE */
+#include <opie2/opimdateconversion.h>
+#include <opie2/opimstate.h>
+#include <opie2/opimtimezone.h>
+#include <opie2/opimnotifymanager.h>
+#include <opie2/opimrecurrence.h>
+#include <opie2/otodoaccessxml.h>
+#include <opie2/odebug.h>
+
+#include <qpe/global.h>
+#include <qpe/stringutil.h>
+#include <qpe/timeconversion.h>
+
+/* QT */
+#include <qfile.h>
+#include <qvector.h>
+
+/* STD */
#include <errno.h>
@@ -38,16 +57,2 @@
-#include <qfile.h>
-#include <qvector.h>
-
-#include <qpe/global.h>
-#include <qpe/stringutil.h>
-#include <qpe/timeconversion.h>
-
-#include <opie2/opimdateconversion.h>
-#include <opie2/opimstate.h>
-#include <opie2/opimtimezone.h>
-#include <opie2/opimnotifymanager.h>
-#include <opie2/opimrecurrence.h>
-#include <opie2/otodoaccessxml.h>
-
using namespace Opie;
@@ -78,3 +83,3 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
if (!needle || !haystack || !hLen || !nLen)
- return 0;
+ return 0;
@@ -83,12 +88,12 @@ char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
if ((needleChar = *needle++) != 0) {
- nLen--; //(to make up for needle++)
- do {
- do {
- if ((haystackChar = *hsearch++) == 0)
- return (0);
- if (hsearch >= haystack + hLen)
- return (0);
- } while (haystackChar != needleChar);
- } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
- hsearch--;
+ nLen--; //(to make up for needle++)
+ do {
+ do {
+ if ((haystackChar = *hsearch++) == 0)
+ return (0);
+ if (hsearch >= haystack + hLen)
+ return (0);
+ } while (haystackChar != needleChar);
+ } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
+ hsearch--;
}
@@ -179,3 +184,3 @@ bool OPimTodoAccessXML::load() {
i+= strLen;
- qWarning("Found a start at %d %d", i, (point-dt) );
+ owarn << "Found a start at " << i << " " << (point-dt) << "" << oendl;
@@ -186,41 +191,41 @@ bool OPimTodoAccessXML::load() {
while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') )
- ++i;
- if ( i >= len-2 || (dt[i] == '/' && dt[i+1] == '>') )
- break;
-
- // we have another attribute, read it.
- int j = i;
- while ( j < len && dt[j] != '=' )
- ++j;
- QCString attr( dt+i, j-i+1);
-
- i = ++j; // skip =
-
- // find the start of quotes
- while ( i < len && dt[i] != '"' )
- ++i;
- j = ++i;
-
- bool haveUtf = FALSE;
- bool haveEnt = FALSE;
- while ( j < len && dt[j] != '"' ) {
- if ( ((unsigned char)dt[j]) > 0x7f )
- haveUtf = TRUE;
- if ( dt[j] == '&' )
- haveEnt = TRUE;
- ++j;
- }
- if ( i == j ) {
- // empty value
- i = j + 1;
- continue;
- }
-
- QCString value( dt+i, j-i+1 );
- i = j + 1;
-
- QString str = (haveUtf ? QString::fromUtf8( value )
- : QString::fromLatin1( value ) );
- if ( haveEnt )
- str = Qtopia::plainString( str );
+ ++i;
+ if ( i >= len-2 || (dt[i] == '/' && dt[i+1] == '>') )
+ break;
+
+ // we have another attribute, read it.
+ int j = i;
+ while ( j < len && dt[j] != '=' )
+ ++j;
+ QCString attr( dt+i, j-i+1);
+
+ i = ++j; // skip =
+
+ // find the start of quotes
+ while ( i < len && dt[i] != '"' )
+ ++i;
+ j = ++i;
+
+ bool haveUtf = FALSE;
+ bool haveEnt = FALSE;
+ while ( j < len && dt[j] != '"' ) {
+ if ( ((unsigned char)dt[j]) > 0x7f )
+ haveUtf = TRUE;
+ if ( dt[j] == '&' )
+ haveEnt = TRUE;
+ ++j;
+ }
+ if ( i == j ) {
+ // empty value
+ i = j + 1;
+ continue;
+ }
+
+ QCString value( dt+i, j-i+1 );
+ i = j + 1;
+
+ QString str = (haveUtf ? QString::fromUtf8( value )
+ : QString::fromLatin1( value ) );
+ if ( haveEnt )
+ str = Qtopia::plainString( str );
@@ -235,3 +240,3 @@ bool OPimTodoAccessXML::load() {
*/
- qWarning("End at %d", i );
+ owarn << "End at " << i << "" << oendl;
if (m_events.contains( ev.uid() ) || ev.uid() == 0) {
@@ -258,3 +263,3 @@ bool OPimTodoAccessXML::load() {
- qWarning("counts %d records loaded!", m_events.count() );
+ owarn << "counts " << m_events.count() << " records loaded!" << oendl;
return true;
@@ -266,5 +271,5 @@ bool OPimTodoAccessXML::reload() {
bool OPimTodoAccessXML::save() {
-// qWarning("saving");
+// owarn << "saving" << oendl;
if (!m_opened || !m_changed ) {
-// qWarning("not saving");
+// owarn << "not saving" << oendl;
return true;
@@ -309,3 +314,3 @@ bool OPimTodoAccessXML::save() {
if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) {
-// qWarning("error renaming");
+// owarn << "error renaming" << oendl;
QFile::remove( strNewFile );
@@ -347,3 +352,3 @@ void OPimTodoAccessXML::clear() {
bool OPimTodoAccessXML::add( const OPimTodo& todo ) {
-// qWarning("add");
+// owarn << "add" << oendl;
m_changed = true;
@@ -406,3 +411,3 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
const QCString& attr, const QString& val) {
-// qWarning("parse to do from XMLElement" );
+// owarn << "parse to do from XMLElement" << oendl;
@@ -412,3 +417,3 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
if (!find ) {
-// qWarning("Unknown option" + it.key() );
+// owarn << "Unknown option" + it.key() << oendl;
ev.setCustomField( attr, val );
@@ -465,4 +470,4 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev,
QStringList alarm = QStringList::split(":", (*it), TRUE ); // allow empty
- qWarning("alarm: %s", alarm.join("___").latin1() );
- qWarning("alarm[0]: %s %s", alarm[0].latin1(), OPimDateConversion::dateTimeFromString( alarm[0] ).toString().latin1() );
+ owarn << "alarm: " << alarm.join("___") << "" << oendl;
+ owarn << "alarm[0]: " << alarm[0] << " " << OPimDateConversion::dateTimeFromString( alarm[0] ).toString() << "" << oendl;
OPimAlarm al( alarm[2].toInt(), OPimDateConversion::dateTimeFromString( alarm[0] ), alarm[1].toInt() );
@@ -539,11 +544,11 @@ QString customToXml(const QMap<QString, QString>& customMap )
{
- //qWarning(QString("writing custom %1").arg(customMap.count()));
+ //owarn << QString("writing custom %1").arg(customMap.count()) << oendl;
QString buf(" ");
for ( QMap<QString, QString>::ConstIterator cit = customMap.begin();
- cit != customMap.end(); ++cit) {
-// qWarning(".ITEM.");
- buf += cit.key();
- buf += "=\"";
- buf += Qtopia::escapeString(cit.data());
- buf += "\" ";
+ cit != customMap.end(); ++cit) {
+// owarn << ".ITEM." << oendl;
+ buf += cit.key();
+ buf += "=\"";
+ buf += Qtopia::escapeString(cit.data());
+ buf += "\" ";
}
@@ -572,3 +577,3 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
}
-// qWarning( "Uid %d", ev.uid() );
+// owarn << "Uid " << ev.uid() << "" << oendl;
str += "Uid=\"" + QString::number( ev.uid() ) + "\" ";
@@ -619,3 +624,3 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const {
// now write the list
- qWarning("als: %s", als.join("____________").latin1() );
+ owarn << "als: " << als.join("____________") << "" << oendl;
str += "Alarms=\""+als.join(";") +"\" ";
@@ -840,3 +845,3 @@ QArray<int> OPimTodoAccessXML::sorted( bool asc, int sortOrder,
/* if ( (*it).isOverdue() && !bOnly ) {
- qWarning("item is overdue but !bOnly");
+ owarn << "item is overdue but !bOnly" << oendl;
continue;
@@ -893,4 +898,4 @@ QArray<int> OPimTodoAccessXML::matchRegexp( const QRegExp &r ) const
{
- QArray<int> m_currentQuery( m_events.count() );
- uint arraycounter = 0;
+ QArray<int> m_currentQuery( m_events.count() );
+ uint arraycounter = 0;
@@ -898,10 +903,10 @@ QArray<int> OPimTodoAccessXML::matchRegexp( const QRegExp &r ) const
for (it = m_events.begin(); it != m_events.end(); ++it ) {
- if ( it.data().match( r ) )
- m_currentQuery[arraycounter++] = it.data().uid();
+ if ( it.data().match( r ) )
+ m_currentQuery[arraycounter++] = it.data().uid();
- }
- // Shrink to fit..
- m_currentQuery.resize(arraycounter);
+ }
+ // Shrink to fit..
+ m_currentQuery.resize(arraycounter);
- return m_currentQuery;
+ return m_currentQuery;
}