23 files changed, 272 insertions, 208 deletions
diff --git a/libopie2/opiedb/osqlbackendmanager.cpp b/libopie2/opiedb/osqlbackendmanager.cpp index fc18e07..bbfbf3d 100644 --- a/libopie2/opiedb/osqlbackendmanager.cpp +++ b/libopie2/opiedb/osqlbackendmanager.cpp @@ -1,10 +1,16 @@ + +#include "osqlbackendmanager.h" + +/* OPIE */ +#include <opie2/odebug.h> + +/* QT */ #include <qdir.h> #include <qmap.h> -#include "osqlbackendmanager.h" /** * \todo FIXME CONFIG!!! */ namespace { @@ -35,13 +41,13 @@ namespace { return false; QStringList list = QStringList::split( '\n', file.readAll() ); QStringList::Iterator it; QString line; for (it = list.begin(); it != list.end(); ++it ) { line = (*it).stripWhiteSpace(); - qWarning("Anonymous::Config:" + line ); + owarn << "Anonymous::Config:" + line << oendl; QStringList test = QStringList::split(' ', line ); m_list.insert( test[0], test[2] ); } return true; } QString Config::value( const QString& key ) { @@ -89,13 +95,13 @@ OSQLBackEnd::ValueList OSQLBackEndManager::scanDir( const QString& dirName ) { /** * read a config file and convert it to a OSQLBackEnd */ OSQLBackEnd OSQLBackEndManager::file2backend( const QString& file ) { OSQLBackEnd end; - qWarning("fileName: " + file ); + owarn << "fileName: " + file << oendl; Config cfg( file ); if (cfg.load() ) { end.setName( cfg.value( "Name") ); end.setVendor( cfg.value("Vendor") ); end.setLicense( cfg.value("License") ); end.setLibrary( cfg.value("Library").local8Bit() ); diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index 588fc8f..69eddfe 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp @@ -121,21 +121,21 @@ void rlikeFunc(sqlite_func *context, int arg, const char **argv){ * try to open a db specified via setUrl * and options */ bool OSQLiteDriver::open() { char *error; - qDebug("OSQLiteDriver::open: about to open"); + odebug << "OSQLiteDriver::open: about to open" << oendl; m_sqlite = sqlite_open(m_url.local8Bit(), 0, &error ); /* failed to open */ if (m_sqlite == 0l ) { // FIXME set the last error - qWarning("OSQLiteDriver::open: %s", error ); + owarn << "OSQLiteDriver::open: " << error << "" << oendl; free( error ); return false; } if (sqlite_create_function(m_sqlite,"rlike",2,rlikeFunc,&sqreg) != 0) odebug << "Unable to create user defined function!" << oendl; if (sqlite_function_type(m_sqlite,"rlike",SQLITE_NUMERIC) != 0) @@ -171,13 +171,13 @@ OSQLResult OSQLiteDriver::query( OSQLQuery* qu) { } Query query; query.driver = this; char *err; /* SQLITE_OK 0 if return code > 0 == failure */ if ( sqlite_exec(m_sqlite, qu->query(),&call_back, &query, &err) > 0 ) { - qWarning("OSQLiteDriver::query: Error while executing %s",err); + owarn << "OSQLiteDriver::query: Error while executing " << err << "" << oendl; free(err ); // FixMe Errors } OSQLResult result(OSQLResult::Success, query.items, diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp index c00585d..2b17230 100644 --- a/libopie2/opiemm/osoundsystem.cpp +++ b/libopie2/opiemm/osoundsystem.cpp @@ -79,13 +79,13 @@ void OSoundSystem::synchronize() s.readLine(); s.readLine(); while ( !s.atEnd() ) { s >> str; str.truncate( str.find( ':' ) ); - qDebug( "OSoundSystem: found interface '%s'", (const char*) str ); + odebug << "OSoundSystem: found interface '" << str << "'" << oendl; OAudioInterface* iface; iface = new OAudioInterface( this, (const char*) str ); _interfaces.insert( str, iface ); s.readLine(); } @@ -234,14 +234,14 @@ void OMixerInterface::init() //odebug << "recmask available and constructed." << oendl; } /* ChannelIterator it; for ( it = _channels.begin(); it != _channels.end(); ++it ) { - qDebug( "Channel %s available (bit %d)", (const char*) it.key(), it.data() ); - qDebug( " +--- Volume: %02d | %02d", volume( it.key() ) & 0xff, volume( it.key() ) >> 8 ); + odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl; + odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl; } */ } QStringList OMixerInterface::allChannels() const { diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index e141097..67718ba 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -602,16 +602,19 @@ void OWirelessNetworkInterface::buildPrivateList() void OWirelessNetworkInterface::dumpInformation() const
{
odebug << "OWirelessNetworkInterface::() -------------- dumping information block ----------------" << oendl;
- qDebug( " - driver's idea of maximum throughput is %d bps = %d byte/s = %d Kb/s = %f.2 Mb/s",
- _range.throughput, _range.throughput / 8, _range.throughput / 8 / 1024, float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 );
- qDebug( " - driver for '%s' (V%d) has been compiled against WE V%d",
- name(), _range.we_version_source, _range.we_version_compiled );
+ odebug << " - driver's idea of maximum throughput is " << _range.throughput
+ << " bps = " << ( _range.throughput / 8 ) << " byte/s = " << ( _range.throughput / 8 / 1024 )
+ << " Kb/s = " << QString().sprintf("%f.2", float( _range.throughput ) / 8.0 / 1024.0 / 1024.0 )
+ << " Mb/s" << oendl;
+
+ odebug << " - driver for '" << name() << "' (V" << _range.we_version_source
+ << ") has been compiled against WE V" << _range.we_version_compiled << oendl;
if ( _range.we_version_compiled != WIRELESS_EXT )
{
owarn << "Version mismatch! WE_DRIVER = " << _range.we_version_compiled << " and WE_OPIENET = " << WIRELESS_EXT << oendl;
}
diff --git a/libopie2/opienet/ostation.cpp b/libopie2/opienet/ostation.cpp index ce0995b..b5ac325 100644 --- a/libopie2/opienet/ostation.cpp +++ b/libopie2/opienet/ostation.cpp @@ -59,14 +59,14 @@ OStation::~OStation() } void OStation::dump() { odebug << "------- OStation::dump() ------------" << oendl; - qDebug( "type: %s", (const char*) type ); - qDebug( "mac: %s", (const char*) macAddress.toString() ); - qDebug( "ap: %s", (const char*) apAddress.toString() ); - qDebug( "ip: %s", (const char*) ipAddress.toString() ); + odebug << "type: " << type << "" << oendl; + odebug << "mac: " << macAddress.toString() << "" << oendl; + odebug << "ap: " << apAddress.toString() << "" << oendl; + odebug << "ip: " << ipAddress.toString() << "" << oendl; } } } diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp index 14207be..dda23cc 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_sql.cpp @@ -29,26 +29,30 @@ /* * SQL Backend for the OPIE-Contact Database. */ #include "ocontactaccessbackend_sql.h" -#include <qarray.h> -#include <qdatetime.h> -#include <qstringlist.h> - -#include <qpe/global.h> -#include <qpe/recordfields.h> - +/* OPIE */ #include <opie2/opimcontact.h> #include <opie2/opimcontactfields.h> #include <opie2/opimdateconversion.h> #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> +#include <opie2/odebug.h> + +#include <qpe/global.h> +#include <qpe/recordfields.h> + +/* QT */ +#include <qarray.h> +#include <qdatetime.h> +#include <qstringlist.h> + using namespace Opie; using namespace Opie::DB; /* @@ -265,13 +269,13 @@ namespace { + "0" // Priority for future enhancements + ",'" + it.data() + "');"; } // qu += "commit;"; - qDebug("add %s", qu.latin1() ); + odebug << "add " << qu << "" << oendl; return qu; } RemoveQuery::RemoveQuery(int uid ) : OSQLQuery(), m_uid( uid ) {} @@ -313,13 +317,13 @@ namespace { } */ QString FindQuery::single()const{ QString qu = "select *"; qu += " from addressbook where uid = " + QString::number(m_uid); - // qWarning("find query: %s", qu.latin1() ); + // owarn << "find query: " << qu << "" << oendl; return qu; } FindCustomQuery::FindCustomQuery(int uid) : OSQLQuery(), m_uid( uid ) { @@ -347,13 +351,13 @@ namespace { namespace Opie { OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL ( const QString& /* appname */, const QString& filename ): OPimContactAccessBackend(), m_changed(false), m_driver( NULL ) { - qDebug("C'tor OPimContactAccessBackend_SQL starts"); + odebug << "C'tor OPimContactAccessBackend_SQL starts" << oendl; QTime t; t.start(); /* Expecting to access the default filename if nothing else is set */ if ( filename.isEmpty() ){ m_fileName = Global::applicationFileName( "addressbook","addressbook.db" ); @@ -364,13 +368,13 @@ OPimContactAccessBackend_SQL::OPimContactAccessBackend_SQL ( const QString& /* a OSQLManager man; m_driver = man.standard(); m_driver->setUrl( m_fileName ); load(); - qDebug("C'tor OPimContactAccessBackend_SQL ends: %d ms", t.elapsed() ); + odebug << "C'tor OPimContactAccessBackend_SQL ends: " << t.elapsed() << " ms" << oendl; } OPimContactAccessBackend_SQL::~OPimContactAccessBackend_SQL () { if( m_driver ) delete m_driver; @@ -427,13 +431,13 @@ QArray<int> OPimContactAccessBackend_SQL::allRecords() const return m_uids; } bool OPimContactAccessBackend_SQL::add ( const OPimContact &newcontact ) { - qDebug("add in contact SQL-Backend"); + odebug << "add in contact SQL-Backend" << oendl; InsertQuery ins( newcontact ); OSQLResult res = m_driver->query( &ins ); if ( res.state() == OSQLResult::Failure ) return false; @@ -466,20 +470,20 @@ bool OPimContactAccessBackend_SQL::replace ( const OPimContact &contact ) return add( contact ); } OPimContact OPimContactAccessBackend_SQL::find ( int uid ) const { - qDebug("OPimContactAccessBackend_SQL::find()"); + odebug << "OPimContactAccessBackend_SQL::find()" << oendl; QTime t; t.start(); OPimContact retContact( requestNonCustom( uid ) ); retContact.setExtraMap( requestCustom( uid ) ); - qDebug("OPimContactAccessBackend_SQL::find() needed: %d ms", t.elapsed() ); + odebug << "OPimContactAccessBackend_SQL::find() needed: " << t.elapsed() << " ms" << oendl; return retContact; } QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &query, int settings, const QDateTime& qd ) @@ -582,13 +586,13 @@ QArray<int> OPimContactAccessBackend_SQL::queryByExample ( const OPimContact &qu // Skip trailing "AND" // if ( isAnyFieldSelected ) // qu = qu.left( qu.length() - 4 ); qu += searchQuery; - qDebug( "queryByExample query: %s", qu.latin1() ); + odebug << "queryByExample query: " << qu << "" << oendl; // Execute query and return the received uid's OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); if ( res.state() != OSQLResult::Success ){ QArray<int> empty; @@ -617,13 +621,13 @@ QArray<int> OPimContactAccessBackend_SQL::matchRegexp( const QRegExp &r ) const searchlist += " OR "; searchlist += " rlike(\""+ r.pattern() + "\",\"" + *it + "\") "; } qu = qu + searchlist + ")"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); return extractUids( res ); @@ -698,31 +702,31 @@ QArray<int> OPimContactAccessBackend_SQL::sorted( bool asc, int , int , int ) QString query = "SELECT uid FROM addressbook "; query += "ORDER BY \"Last Name\" "; if ( !asc ) query += "DESC"; - // qDebug("sorted query is: %s", query.latin1() ); + // odebug << "sorted query is: " << query << "" << oendl; OSQLRawQuery raw( query ); OSQLResult res = m_driver->query( &raw ); if ( res.state() != OSQLResult::Success ){ QArray<int> empty; return empty; } QArray<int> list = extractUids( res ); - qDebug("sorted needed %d ms!", t.elapsed() ); + odebug << "sorted needed " << t.elapsed() << " ms!" << oendl; return list; } void OPimContactAccessBackend_SQL::update() { - qDebug("Update starts"); + odebug << "Update starts" << oendl; QTime t; t.start(); // Now load the database set and extract the uid's // which will be held locally @@ -732,31 +736,31 @@ void OPimContactAccessBackend_SQL::update() return; m_uids = extractUids( res ); m_changed = false; - qDebug("Update ends %d ms", t.elapsed() ); + odebug << "Update ends " << t.elapsed() << " ms" << oendl; } QArray<int> OPimContactAccessBackend_SQL::extractUids( OSQLResult& res ) const { - qDebug("extractUids"); + odebug << "extractUids" << oendl; QTime t; t.start(); OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it; QArray<int> ints(list.count() ); - qDebug(" count = %d", list.count() ); + odebug << " count = " << list.count() << "" << oendl; int i = 0; for (it = list.begin(); it != list.end(); ++it ) { ints[i] = (*it).data("uid").toInt(); i++; } - qDebug("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() ); + odebug << "extractUids ready: count2 = " << i << " needs " << t.elapsed() << " ms" << oendl; return ints; } QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) const @@ -785,13 +789,13 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co // Get data for the selected column and store it with the // corresponding id into the map.. int id = translate[*it]; QString value = resItem.data( (*it) ); - // qDebug("Reading %s... found: %s", (*it).latin1(), value.latin1() ); + // odebug << "Reading " << (*it) << "... found: " << value << "" << oendl; switch( id ){ case Qtopia::Birthday: case Qtopia::Anniversary:{ // Birthday and Anniversary are encoded special ( yyyy-mm-dd ) QStringList list = QStringList::split( '-', value ); @@ -803,25 +807,25 @@ QMap<int, QString> OPimContactAccessBackend_SQL::requestNonCustom( int uid ) co QDate date( year, month, day ); nonCustomMap.insert( id, OPimDateConversion::dateToString( date ) ); } } break; case Qtopia::AddressCategory: - qDebug("Category is: %s", value.latin1() ); + odebug << "Category is: " << value << "" << oendl; default: nonCustomMap.insert( id, value ); } } // First insert uid nonCustomMap.insert( Qtopia::AddressUid, resItem.data( "uid" ) ); t3needed = t3.elapsed(); - // qDebug("Adding UID: %s", resItem.data( "uid" ).latin1() ); - qDebug("RequestNonCustom needed: insg.:%d ms, query: %d ms, mapping: %d ms", - t.elapsed(), t2needed, t3needed ); + // odebug << "Adding UID: " << resItem.data( "uid" ) << "" << oendl; + odebug << "RequestNonCustom needed: insg.:" << t.elapsed() << " ms, query: " << t2needed + << " ms, mapping: " << t3needed << " ms" << oendl; return nonCustomMap; } QMap<QString, QString> OPimContactAccessBackend_SQL::requestCustom( int uid ) const { @@ -831,22 +835,22 @@ QMap<QString, QString> OPimContactAccessBackend_SQL::requestCustom( int uid ) c QMap<QString, QString> customMap; FindCustomQuery query( uid ); OSQLResult res_custom = m_driver->query( &query ); if ( res_custom.state() == OSQLResult::Failure ) { - qWarning("OSQLResult::Failure in find query !!"); + owarn << "OSQLResult::Failure in find query !!" << oendl; QMap<QString, QString> empty; return empty; } OSQLResultItem::ValueList list = res_custom.results(); OSQLResultItem::ValueList::Iterator it = list.begin(); for ( ; it != list.end(); ++it ) { customMap.insert( (*it).data( "type" ), (*it).data( "value" ) ); } - qDebug("RequestCustom needed: %d ms", t.elapsed() ); + odebug << "RequestCustom needed: " << t.elapsed() << " ms" << oendl; return customMap; } } diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp index ffa6a7d..b6ea461 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp @@ -32,12 +32,14 @@ #include "vobject_p.h" /* OPIE */ #include <opie2/ocontactaccessbackend_vcard.h> +#include <opie2/odebug.h> + #include <qpe/timeconversion.h> //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! #define protected public #include <qfile.h> #undef protected @@ -61,26 +63,26 @@ bool OPimContactAccessBackend_VCard::load () if ( QFile::exists(m_file) ){ obj = Parse_MIME_FromFileName( QFile::encodeName(m_file).data() ); if ( !obj ) return false; }else{ - qWarning("File \"%s\" not found !", m_file.latin1() ); + owarn << "File \"" << m_file << "\" not found !" << oendl; return false; } while ( obj ) { OPimContact con = parseVObject( obj ); /* * if uid is 0 assign a new one * this at least happens on * Nokia6210 */ if ( con.uid() == 0 ){ con.setUid( 1 ); - qWarning("assigned new uid %d",con.uid() ); + owarn << "assigned new uid " << con.uid() << "" << oendl; } m_map.insert( con.uid(), con ); VObject *t = obj; obj = nextVObjectInList(obj); @@ -313,13 +315,13 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj ) if ( (type & UNKNOWN) != UNKNOWN ) { if ( ( type & (HOME|WORK) ) == 0 ) // default type |= HOME; if ( ( type & (VOICE|CELL|FAX|PAGER) ) == 0 ) // default type |= VOICE; - qWarning("value %s %d", value.data(), type ); + owarn << "value " << value.data() << " " << type << "" << oendl; if ( (type & (VOICE|HOME) ) == (VOICE|HOME) && (type & (CELL|HOME) ) != (CELL|HOME) ) c.setHomePhone( value ); if ( ( type & (FAX|HOME) ) == (FAX|HOME) ) c.setHomeFax( value ); if ( ( type & (CELL|HOME) ) == (CELL|HOME) ) c.setHomeMobile( value ); @@ -507,13 +509,13 @@ VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) } safeAddPropValue( vcard, VCNoteProp, c.notes() ); // Exporting Birthday regarding RFC 2425 (5.8.4) if ( c.birthday().isValid() ){ - qWarning("Exporting birthday as: %s", convDateToVCardDate( c.birthday() ).latin1() ); + owarn << "Exporting birthday as: " << convDateToVCardDate( c.birthday() ) << "" << oendl; safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); } if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { VObject *org = safeAddProp( vcard, VCOrgProp ); safeAddPropValue( org, VCOrgNameProp, c.company() ); @@ -526,13 +528,13 @@ VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); if ( c.anniversary().isValid() ){ - qWarning("Exporting anniversary as: %s", convDateToVCardDate( c.anniversary() ).latin1() ); + owarn << "Exporting anniversary as: " << convDateToVCardDate( c.anniversary() ) << "" << oendl; safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); } safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); return vcard; @@ -555,27 +557,27 @@ QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) co QDate OPimContactAccessBackend_VCard::convVCardDateToDate( const QString& datestr ) { int monthPos = datestr.find('-'); int dayPos = datestr.find('-', monthPos+1 ); int sep_ignore = 1; if ( monthPos == -1 || dayPos == -1 ) { - qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); + odebug << "fromString didn't find - in str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD ) if ( datestr.length() == 8 ){ monthPos = 4; dayPos = 6; sep_ignore = 0; - qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); + odebug << "Try with follwing positions str = " << datestr << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; } else { return QDate(); } } int y = datestr.left( monthPos ).toInt(); int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); int d = datestr.mid( dayPos + sep_ignore ).toInt(); - qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos); + odebug << "TimeConversion::fromString ymd = " << datestr << " => " << y << " " << m << " " << d << "; mpos = " << monthPos << " ypos = " << dayPos << "" << oendl; QDate date ( y,m,d ); return date; } VObject* OPimContactAccessBackend_VCard::safeAddPropValue( VObject *o, const char *prop, const QString &value ) { diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp index 7b4d81f..5ffcb11 100644 --- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp @@ -27,27 +27,31 @@ Boston, MA 02111-1307, USA. */ /* * XML Backend for the OPIE-Contact Database. */ + +/* OPIE */ #include <opie2/ocontactaccessbackend_xml.h> +#include <opie2/xmltree.h> +#include <opie2/ocontactaccessbackend.h> +#include <opie2/ocontactaccess.h> +#include <opie2/odebug.h> + +#include <qpe/global.h> +/* QT */ #include <qasciidict.h> #include <qfile.h> #include <qfileinfo.h> #include <qregexp.h> #include <qarray.h> #include <qmap.h> -#include <qpe/global.h> - -#include <opie2/xmltree.h> -#include <opie2/ocontactaccessbackend.h> -#include <opie2/ocontactaccess.h> - +/* STD */ #include <stdlib.h> #include <errno.h> using namespace Opie::Core; @@ -101,13 +105,13 @@ bool OPimContactAccessBackend_XML::save() idx_offset += cstr.length(); out = ""; // Write all contacts QListIterator<OPimContact> it( m_contactList ); for ( ; it.current(); ++it ) { - // qWarning(" Uid %d at Offset: %x", (*it)->uid(), idx_offset ); + // owarn << " Uid " << (*it)->uid() << " at Offset: " << idx_offset << "" << oendl; out += "<Contact "; (*it)->save( out ); out += "/>\n"; cstr = out.utf8(); total_written = f.writeBlock( cstr.data(), cstr.length() ); idx_offset += cstr.length(); @@ -456,13 +460,13 @@ QArray<int> OPimContactAccessBackend_XML::sorted( bool asc, int , int , int ) return m_currentQuery; } bool OPimContactAccessBackend_XML::add ( const OPimContact &newcontact ) { - //qWarning("odefaultbackend: ACTION::ADD"); + //owarn << "odefaultbackend: ACTION::ADD" << oendl; updateJournal (newcontact, ACTION_ADD); addContact_p( newcontact ); m_changed = true; return true; @@ -480,13 +484,13 @@ bool OPimContactAccessBackend_XML::replace ( const OPimContact &contact ) updateJournal ( *newCont, ACTION_REPLACE); m_contactList.removeRef ( found ); m_contactList.append ( newCont ); m_uidToContact.remove( QString().setNum( contact.uid() ) ); m_uidToContact.insert( QString().setNum( newCont->uid() ), newCont ); - qWarning("Nur zur Sicherheit: %d == %d ?",contact.uid(), newCont->uid()); + owarn << "Nur zur Sicherheit: " << contact.uid() << " == " << newCont->uid() << " ?" << oendl; return true; } else return false; } @@ -586,21 +590,21 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal dict.insert( "Anniversary", new int(Qtopia::Anniversary) ); dict.insert( "Nickname", new int(Qtopia::Nickname) ); dict.insert( "Notes", new int(Qtopia::Notes) ); dict.insert( "action", new int(JOURNALACTION) ); dict.insert( "actionrow", new int(JOURNALROW) ); - //qWarning( "OPimContactDefaultBackEnd::loading %s", filename.latin1() ); + //owarn << "OPimContactDefaultBackEnd::loading " << filename << "" << oendl; XMLElement *root = XMLElement::load( filename ); if(root != 0l ){ // start parsing /* Parse all XML-Elements and put the data into the * Contact-Class */ XMLElement *element = root->firstChild(); - //qWarning("OPimContactAccess::load tagName(): %s", root->tagName().latin1() ); + //owarn << "OPimContactAccess::load tagName(): " << root->tagName() << "" << oendl; element = element->firstChild(); /* Search Tag "Contacts" which is the parent of all Contacts */ while( element && !isJournal ){ if( element->tagName() != QString::fromLatin1("Contacts") ){ //qWarning ("OPimContactDefBack::Searching for Tag \"Contacts\"! Found: %s", @@ -634,13 +638,13 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal for( it = aMap.begin(); it != aMap.end(); ++it ){ // qWarning ("Read Attribute: %s=%s", it.key().latin1(),it.data().latin1()); int *find = dict[ it.key() ]; /* Unknown attributes will be stored as "Custom" elements */ if ( !find ) { - // qWarning("Attribute %s not known.", it.key().latin1()); + // owarn << "Attribute " << it.key() << " not known." << oendl; //contact.setCustomField(it.key(), it.data()); customMap.insert( it.key(), it.data() ); continue; } /* Check if special conversion is needed and add attribute @@ -701,16 +705,16 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal } /* Move to next element */ element = element->nextChild(); } }else { - qWarning("ODefBack::could not load"); + owarn << "ODefBack::could not load" << oendl; } delete root; - qWarning("returning from loading" ); + owarn << "returning from loading" << oendl; return true; } void OPimContactAccessBackend_XML::updateJournal( const OPimContact& cnt, journal_action action ) diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp index f4f3c94..105c106 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_sql.cpp @@ -28,26 +28,31 @@ */ /* * SQL Backend for the OPIE-Calender Database. * */ -#include <stdio.h> -#include <stdlib.h> - -#include <qarray.h> -#include <qstringlist.h> - -#include <qpe/global.h> - +/* OPIE */ #include <opie2/osqldriver.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> #include <opie2/opimrecurrence.h> #include <opie2/odatebookaccessbackend_sql.h> +#include <opie2/odebug.h> + +#include <qpe/global.h> + +/* QT */ +#include <qarray.h> +#include <qstringlist.h> + +/* STD */ +#include <stdio.h> +#include <stdlib.h> + using namespace Opie::DB; namespace { /** * a find query for custom elements @@ -159,13 +164,13 @@ bool ODateBookAccessBackend_SQL::load() qu += QString( ",%1 VARCHAR(10)" ).arg( it.data() ); } qu += " );"; qu += "create table custom_data( uid INTEGER, id INTEGER, type VARCHAR(10), priority INTEGER, value VARCHAR(10), PRIMARY KEY /* identifier */ (uid, id) );"; - qWarning( "command: %s", qu.latin1() ); + owarn << "command: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); if ( res.state() != OSQLResult::Success ) return false; @@ -218,18 +223,18 @@ void ODateBookAccessBackend_SQL::clear() reload(); } OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{ - qDebug( "ODateBookAccessBackend_SQL::find( %d )", uid ); + odebug << "ODateBookAccessBackend_SQL::find( " << uid << " )" << oendl; QString qu = "select *"; qu += "from datebook where uid = " + QString::number(uid); - qDebug( "Query: %s", qu.latin1() ); + odebug << "Query: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); OSQLResultItem resItem = res.first(); @@ -244,13 +249,13 @@ OPimEvent ODateBookAccessBackend_SQL::find( int uid ) const{ } // Last step: Put map into date event, add custom map and return it OPimEvent retDate( dateEventMap ); retDate.setExtraMap( requestCustom( uid ) ); - qDebug( "ODateBookAccessBackend_SQL::find( %d ) end", uid ); + odebug << "ODateBookAccessBackend_SQL::find( " << uid << " ) end" << oendl; return retDate; } // FIXME: Speed up update of uid's.. bool ODateBookAccessBackend_SQL::add( const OPimEvent& ev ) { @@ -280,13 +285,13 @@ bool ODateBookAccessBackend_SQL::add( const OPimEvent& ev ) + "'," + "0" // Priority for future enhancements + ",'" + it.data() //.latin1() + "');"; } - qWarning("add %s", qu.latin1() ); + owarn << "add " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); if ( res.state() != OSQLResult::Success ){ return false; } @@ -387,13 +392,13 @@ QArray<int> ODateBookAccessBackend_SQL::matchRegexp( const QRegExp &r ) const // Do it make sense to search other fields, too ? qu += " rlike(\""+ r.pattern() + "\", Location ) OR"; qu += " rlike(\""+ r.pattern() + "\", Note )"; qu += " )"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); return extractUids( res ); @@ -402,26 +407,26 @@ QArray<int> ODateBookAccessBackend_SQL::matchRegexp( const QRegExp &r ) const } /* ===== Private Functions ========================================== */ QArray<int> ODateBookAccessBackend_SQL::extractUids( OSQLResult& res ) const { - qWarning("extractUids"); + owarn << "extractUids" << oendl; QTime t; t.start(); OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it; QArray<int> ints(list.count() ); - qWarning(" count = %d", list.count() ); + owarn << " count = " << list.count() << "" << oendl; int i = 0; for (it = list.begin(); it != list.end(); ++it ) { ints[i] = (*it).data("uid").toInt(); i++; } - qWarning("extractUids ready: count2 = %d needs %d ms", i, t.elapsed() ); + owarn << "extractUids ready: count2 = " << i << " needs " << t.elapsed() << " ms" << oendl; return ints; } QMap<QString, QString> ODateBookAccessBackend_SQL::requestCustom( int uid ) const @@ -432,23 +437,23 @@ QMap<QString, QString> ODateBookAccessBackend_SQL::requestCustom( int uid ) cons QMap<QString, QString> customMap; FindCustomQuery query( uid ); OSQLResult res_custom = m_driver->query( &query ); if ( res_custom.state() == OSQLResult::Failure ) { - qWarning("OSQLResult::Failure in find query !!"); + owarn << "OSQLResult::Failure in find query !!" << oendl; QMap<QString, QString> empty; return empty; } OSQLResultItem::ValueList list = res_custom.results(); OSQLResultItem::ValueList::Iterator it = list.begin(); for ( ; it != list.end(); ++it ) { customMap.insert( (*it).data( "type" ), (*it).data( "value" ) ); } - qDebug("RequestCustom needed: %d ms", t.elapsed() ); + odebug << "RequestCustom needed: " << t.elapsed() << " ms" << oendl; return customMap; } } diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp index 77c0253..2ff36e3 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp @@ -23,35 +23,41 @@ -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* OPIE */ +#include <opie2/opimnotifymanager.h> +#include <opie2/opimrecurrence.h> +#include <opie2/opimtimezone.h> +#include <opie2/odatebookaccessbackend_xml.h> +#include <opie2/odebug.h> + +#include <qtopia/global.h> +#include <qtopia/stringutil.h> +#include <qtopia/timeconversion.h> + +/* QT */ +#include <qasciidict.h> +#include <qfile.h> + +/* STD */ #include <errno.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> -#include <qasciidict.h> -#include <qfile.h> - -#include <qtopia/global.h> -#include <qtopia/stringutil.h> -#include <qtopia/timeconversion.h> - -#include <opie2/opimnotifymanager.h> -#include <opie2/opimrecurrence.h> -#include <opie2/opimtimezone.h> -#include <opie2/odatebookaccessbackend_xml.h> using namespace Opie; namespace { // FROM TT again char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) @@ -113,13 +119,13 @@ namespace { FRecChildren, FExceptions }; // FIXME: Use OPimEvent::toMap() here !! (eilers) inline void save( const OPimEvent& ev, QString& buf ) { - qWarning("Saving %d %s", ev.uid(), ev.description().latin1() ); + owarn << "Saving " << ev.uid() << " " << ev.description() << "" << oendl; buf += " description=\"" + Qtopia::escapeString(ev.description() ) + "\""; if (!ev.location().isEmpty() ) buf += " location=\"" + Qtopia::escapeString(ev.location() ) + "\""; buf += " categories=\""+ Qtopia::escapeString( Qtopia::Record::idsToString( ev.categories() ) ) + "\""; buf += " uid=\"" + QString::number( ev.uid() ) + "\""; @@ -487,16 +493,16 @@ void ODateBookAccessBackend_XML::finalizeRecord( OPimEvent& ev ) { OPimTimeZone utc = OPimTimeZone::utc(); ev.setStartDateTime( utc.fromUTCDateTime( start ) ); ev.setEndDateTime ( utc.fromUTCDateTime( end ) ); ev.setTimeZone( "UTC"); // make sure it is really utc }else { /* to current date time */ - // qWarning(" Start is %d", start ); + // owarn << " Start is " << start << "" << oendl; OPimTimeZone zone( ev.timeZone().isEmpty() ? OPimTimeZone::current() : ev.timeZone() ); QDateTime date = zone.toDateTime( start ); - qWarning(" Start is %s", date.toString().latin1() ); + owarn << " Start is " << date.toString() << "" << oendl; ev.setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); date = zone.toDateTime( end ); ev.setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); } if ( rec && rec->doesRecur() ) { @@ -511,24 +517,24 @@ void ODateBookAccessBackend_XML::finalizeRecord( OPimEvent& ev ) { if (alarmTime != -1 ) { QDateTime dt = ev.startDateTime().addSecs( -1*alarmTime*60 ); OPimAlarm al( snd , dt ); ev.notifiers().add( al ); } if ( m_raw.contains( ev.uid() ) || m_rep.contains( ev.uid() ) ) { - qWarning("already contains assign uid"); + owarn << "already contains assign uid" << oendl; ev.setUid( 1 ); } - qWarning("addind %d %s", ev.uid(), ev.description().latin1() ); + owarn << "addind " << ev.uid() << " " << ev.description() << "" << oendl; if ( ev.hasRecurrence() ) m_rep.insert( ev.uid(), ev ); else m_raw.insert( ev.uid(), ev ); } void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString& value) { -// qWarning(" setting %s", value.latin1() ); +// owarn << " setting " << value << "" << oendl; switch( id ) { case FDescription: e.setDescription( value ); break; case FLocation: e.setLocation( value ); @@ -607,13 +613,13 @@ void ODateBookAccessBackend_XML::setField( OPimEvent& e, int id, const QString& } 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() ); + owarn << "adding exception " << date.toString() << "" << oendl; recur()->exceptions().append( date ); } } break; case FTimeZone: if ( value != "None" ) diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 132b5a6..6f65c48 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp @@ -25,27 +25,31 @@ -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qdatetime.h> -#include <qmap.h> -#include <qstring.h> - -#include <qpe/global.h> - +/* OPIE */ #include <opie2/osqldriver.h> #include <opie2/osqlresult.h> #include <opie2/osqlmanager.h> #include <opie2/osqlquery.h> #include <opie2/otodoaccesssql.h> #include <opie2/opimstate.h> #include <opie2/opimnotifymanager.h> #include <opie2/opimrecurrence.h> +#include <opie2/odebug.h> + +#include <qpe/global.h> + +/* QT */ +#include <qdatetime.h> +#include <qmap.h> +#include <qstring.h> + using namespace Opie::DB; using namespace Opie; /* * first some query @@ -288,13 +292,13 @@ namespace { + ",'" + it.data() + "');"; } - qDebug("add %s", qu.latin1() ); + odebug << "add " << qu << "" << oendl; return qu; } RemoveQuery::RemoveQuery(int uid ) : OSQLQuery(), m_uid( uid ) {} RemoveQuery::~RemoveQuery() {} @@ -453,23 +457,23 @@ OPimTodo OPimTodoAccessBackendSQL::find(int uid ) const{ return todo( m_driver->query(&query) ); } OPimTodo OPimTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, uint cur, Frontend::CacheDirection dir ) const{ uint CACHE = readAhead(); - qDebug("searching for %d", uid ); + odebug << "searching for " << uid << "" << oendl; QArray<int> search( CACHE ); uint size =0; OPimTodo to; // we try to cache CACHE items switch( dir ) { /* forward */ case 0: // FIXME: Not a good style to use magic numbers here (eilers) for (uint i = cur; i < ints.count() && size < CACHE; i++ ) { - qDebug("size %d %d", size, ints[i] ); + odebug << "size " << size << " " << ints[i] << "" << oendl; search[size] = ints[i]; size++; } break; /* reverse */ case 1: // FIXME: Not a good style to use magic numbers here (eilers) @@ -538,13 +542,13 @@ QArray<int> OPimTodoAccessBackendSQL::effectiveToDos( const QDate& s, } /* * */ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, int sortFilter, int cat ) { - qDebug("sorted %d, %d", asc, sortOrder ); + odebug << "sorted " << asc << ", " << sortOrder << "" << oendl; QString query; query = "select uid from todolist WHERE "; /* * Sort Filter stuff * not that straight forward @@ -597,17 +601,17 @@ QArray<int> OPimTodoAccessBackendSQL::sorted( bool asc, int sortOrder, case 3: query += "DueDate"; break; } if ( !asc ) { - qDebug("not ascending!"); + odebug << "not ascending!" << oendl; query += " DESC"; } - qDebug( query ); + odebug << query << oendl; OSQLRawQuery raw(query ); return uids( m_driver->query(&raw) ); } bool OPimTodoAccessBackendSQL::date( QDate& da, const QString& str ) const{ if ( str == "0-0-0" ) return false; @@ -626,33 +630,33 @@ OPimTodo OPimTodoAccessBackendSQL::todo( const OSQLResult& res ) const{ OPimTodo to; return to; } OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it = list.begin(); - qDebug("todo1"); + odebug << "todo1" << oendl; OPimTodo to = todo( (*it) ); cache( to ); ++it; for ( ; it != list.end(); ++it ) { - qDebug("caching"); + odebug << "caching" << oendl; cache( todo( (*it) ) ); } return to; } OPimTodo OPimTodoAccessBackendSQL::todo( OSQLResultItem& item )const { - qDebug("todo(ResultItem)"); + odebug << "todo(ResultItem)" << oendl; // Request information from addressbook table and create the OPimTodo-object. bool hasDueDate = false; QDate dueDate = QDate::currentDate(); hasDueDate = date( dueDate, item.data("DueDate") ); QStringList cats = QStringList::split(";", item.data("categories") ); - qDebug("Item is completed: %d", item.data("completed").toInt() ); + odebug << "Item is completed: " << item.data("completed").toInt() << "" << oendl; OPimTodo to( (bool)item.data("completed").toInt(), item.data("priority").toInt(), cats, item.data("summary"), item.data("description"), item.data("progress").toUShort(), hasDueDate, dueDate, item.data("uid").toInt() ); @@ -747,13 +751,13 @@ void OPimTodoAccessBackendSQL::update()const { } QArray<int> OPimTodoAccessBackendSQL::uids( const OSQLResult& res) const{ OSQLResultItem::ValueList list = res.results(); OSQLResultItem::ValueList::Iterator it; QArray<int> ints(list.count() ); - qDebug(" count = %d", list.count() ); + odebug << " count = " << list.count() << "" << oendl; int i = 0; for (it = list.begin(); it != list.end(); ++it ) { ints[i] = (*it).data("uid").toInt(); i++; } @@ -773,13 +777,13 @@ QArray<int> OPimTodoAccessBackendSQL::matchRegexp( const QRegExp &r ) const // Do it make sense to search other fields, too ? qu += " rlike(\""+ r.pattern() + "\",\"description\") OR"; qu += " rlike(\""+ r.pattern() + "\",\"summary\")"; qu += ")"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); return uids( res ); @@ -813,13 +817,13 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){ OSQLRawQuery raw( qu ); OSQLResult res = m_driver->query( &raw ); QArray<int> completed_uids = uids( res ); - qDebug( "Number of completed: %d", completed_uids.size() ); + odebug << "Number of completed: " << completed_uids.size() << "" << oendl; if ( completed_uids.size() == 0 ) return; qu = "DELETE FROM todolist WHERE ("; QString query; @@ -839,31 +843,31 @@ void OPimTodoAccessBackendSQL::removeAllCompleted(){ if ( !query.isEmpty() ) query += " OR "; query += QString( "uid = %1" ).arg( completed_uids[i] ); } qu += query + " );"; - qDebug( "query: %s", qu.latin1() ); + odebug << "query: " << qu << "" << oendl; OSQLRawQuery raw2( qu ); res = m_driver->query( &raw2 ); if ( res.state() == OSQLResult::Failure ) { - qWarning("OPimTodoAccessBackendSQL::removeAllCompleted():Failure in query: %s", qu.latin1() ); + owarn << "OPimTodoAccessBackendSQL::removeAllCompleted():Failure in query: " << qu << "" << oendl; } } QMap<QString, QString> OPimTodoAccessBackendSQL::requestCustom( int uid ) const { QMap<QString, QString> customMap; FindCustomQuery query( uid ); OSQLResult res_custom = m_driver->query( &query ); if ( res_custom.state() == OSQLResult::Failure ) { - qWarning("OSQLResult::Failure in find query !!"); + owarn << "OSQLResult::Failure in find query !!" << oendl; QMap<QString, QString> empty; return empty; } OSQLResultItem::ValueList list = res_custom.results(); OSQLResultItem::ValueList::Iterator it = list.begin(); diff --git a/libopie2/opiepim/backend/otodoaccessvcal.cpp b/libopie2/opiepim/backend/otodoaccessvcal.cpp index 03d4479..14a325e 100644 --- a/libopie2/opiepim/backend/otodoaccessvcal.cpp +++ b/libopie2/opiepim/backend/otodoaccessvcal.cpp @@ -24,17 +24,21 @@ -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* OPIE */ #include "vobject_p.h" -#include <qpe/timeconversion.h> + +/* OPIE */ #include <opie2/otodoaccessvcal.h> +#include <opie2/odebug.h> + +#include <qpe/timeconversion.h> +/* QT */ //FIXME: Hack to allow direct access to FILE* fh. Rewrite this! #define protected public #include <qfile.h> #undef protected using namespace Opie; @@ -85,13 +89,13 @@ namespace { name = vObjectStringZValue( ob ); event.setDueDate( TimeConversion::fromISO8601( name).date() ); } // categories if((ob = isAPropertyOf( obj, VCCategoriesProp )) != 0 ){ name = vObjectStringZValue( ob ); - qWarning("Categories:%s", name.data() ); + owarn << "Categories:" << name.data() << "" << oendl; } event.setUid( 1 ); return event; }; static VObject *vobjByEvent( const OPimTodo &event ) { 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 @@ -23,36 +23,41 @@ -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* 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> #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> -#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; namespace { time_t rp_end; OPimRecurrence* rec; OPimRecurrence *recur() { @@ -174,13 +179,13 @@ bool OPimTodoAccessXML::load() { char *point; const char* collectionString = "<Task "; int strLen = strlen(collectionString); while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) { i = point -dt; i+= strLen; - qWarning("Found a start at %d %d", i, (point-dt) ); + owarn << "Found a start at " << i << " " << (point-dt) << "" << oendl; OPimTodo ev; m_year = m_month = m_day = 0; while ( TRUE ) { while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') ) @@ -230,13 +235,13 @@ bool OPimTodoAccessXML::load() { todo( &dict, ev, attr, str ); } /* * now add it */ - qWarning("End at %d", i ); + owarn << "End at " << i << "" << oendl; if (m_events.contains( ev.uid() ) || ev.uid() == 0) { ev.setUid( 1 ); m_changed = true; } if ( ev.hasDueDate() ) { ev.setDueDate( QDate(m_year, m_month, m_day) ); @@ -253,23 +258,23 @@ bool OPimTodoAccessXML::load() { delete rec; rec = 0; } munmap(map_addr, attribut.st_size ); - qWarning("counts %d records loaded!", m_events.count() ); + owarn << "counts " << m_events.count() << " records loaded!" << oendl; return true; } bool OPimTodoAccessXML::reload() { m_events.clear(); return load(); } bool OPimTodoAccessXML::save() { -// qWarning("saving"); +// owarn << "saving" << oendl; if (!m_opened || !m_changed ) { -// qWarning("not saving"); +// owarn << "not saving" << oendl; return true; } QString strNewFile = m_file + ".new"; QFile f( strNewFile ); if (!f.open( IO_WriteOnly|IO_Raw ) ) return false; @@ -304,13 +309,13 @@ bool OPimTodoAccessXML::save() { return false; } /* flush before renaming */ f.close(); if( ::rename( strNewFile.latin1(), m_file.latin1() ) < 0 ) { -// qWarning("error renaming"); +// owarn << "error renaming" << oendl; QFile::remove( strNewFile ); } m_changed = false; return true; } @@ -342,13 +347,13 @@ void OPimTodoAccessXML::clear() { if (m_opened ) m_changed = true; m_events.clear(); } bool OPimTodoAccessXML::add( const OPimTodo& todo ) { -// qWarning("add"); +// owarn << "add" << oendl; m_changed = true; m_events.insert( todo.uid(), todo ); return true; } bool OPimTodoAccessXML::remove( int uid ) { @@ -401,19 +406,19 @@ QArray<int> OPimTodoAccessXML::overDue() { } /* private */ 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; int *find=0; find = (*dict)[ attr.data() ]; if (!find ) { -// qWarning("Unknown option" + it.key() ); +// owarn << "Unknown option" + it.key() << oendl; ev.setCustomField( attr, val ); return; } switch( *find ) { case OPimTodo::Uid: @@ -460,14 +465,14 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev, break; case OPimTodo::Alarms:{ OPimNotifyManager &manager = ev.notifiers(); QStringList als = QStringList::split(";", val ); for (QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { 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() ); manager.add( al ); } } break; case OPimTodo::Reminders:{ @@ -534,17 +539,17 @@ void OPimTodoAccessXML::todo( QAsciiDict<int>* dict, OPimTodo& ev, } // from PalmtopRecord... GPL ### FIXME namespace { 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."); +// owarn << ".ITEM." << oendl; buf += cit.key(); buf += "=\""; buf += Qtopia::escapeString(cit.data()); buf += "\" "; } return buf; @@ -567,13 +572,13 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const { if ( ev.hasDueDate() ) { str += "DateYear=\"" + QString::number( ev.dueDate().year() ) + "\" "; str += "DateMonth=\"" + QString::number( ev.dueDate().month() ) + "\" "; str += "DateDay=\"" + QString::number( ev.dueDate().day() ) + "\" "; } -// qWarning( "Uid %d", ev.uid() ); +// owarn << "Uid " << ev.uid() << "" << oendl; str += "Uid=\"" + QString::number( ev.uid() ) + "\" "; // append the extra options /* FIXME Qtopia::Record this is currently not * possible you can set custom fields * but don' iterate over the list @@ -614,13 +619,13 @@ QString OPimTodoAccessXML::toString( const OPimTodo& ev )const { + ":" + QString::number( (*it).duration() ) + ":" + QString::number( (*it).sound() ) + ":"; } } // now write the list - qWarning("als: %s", als.join("____________").latin1() ); + owarn << "als: " << als.join("____________") << "" << oendl; str += "Alarms=\""+als.join(";") +"\" "; } /* * now the same for reminders but more easy. We just save the uid of the OPimEvent. */ @@ -835,13 +840,13 @@ QArray<int> OPimTodoAccessXML::sorted( bool asc, int sortOrder, }else if ( bCat && cat != 0) if (!(*it).categories().contains( cat ) ) { continue; } /* isOverdue but we should not show overdue - why?*/ /* if ( (*it).isOverdue() && !bOnly ) { - qWarning("item is overdue but !bOnly"); + owarn << "item is overdue but !bOnly" << oendl; continue; } */ if ( !(*it).isOverdue() && bOnly ) { continue; } diff --git a/libopie2/opiepim/core/opimcontact.cpp b/libopie2/opiepim/core/opimcontact.cpp index c1e06c8..48a74d0 100644 --- a/libopie2/opiepim/core/opimcontact.cpp +++ b/libopie2/opiepim/core/opimcontact.cpp @@ -31,12 +31,14 @@ #include "opimcontact.h" /* OPIE */ #include <opie2/opimresolver.h> #include <opie2/opimdateconversion.h> +#include <opie2/odebug.h> + #include <qpe/stringutil.h> #include <qpe/timestring.h> #include <qpe/config.h> /* QT */ #include <qstylesheet.h> @@ -76,13 +78,13 @@ OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap setCategories( idsFromString( cats ) ); QString uidStr = find( Qtopia::AddressUid ); if ( uidStr.isEmpty() || ( uidStr.toInt() == 0 ) ) { - qWarning( "Invalid UID found. Generate new one.." ); + owarn << "Invalid UID found. Generate new one.." << oendl; setUid( uidGen().generate() ); } else setUid( uidStr.toInt() ); // if ( !uidStr.isEmpty() ) @@ -928,13 +930,13 @@ QStringList OPimContact::emailList() const { QString emailStr = emails(); QStringList r; if ( !emailStr.isEmpty() ) { - qDebug( " emailstr " ); + odebug << " emailstr " << oendl; QStringList l = QStringList::split( emailSeparator(), emailStr ); for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) r += ( *it ).simplifyWhiteSpace(); } return r; @@ -1133,13 +1135,13 @@ class QString OPimContact::recordField( int pos ) const the current stored date will be removed. */ void OPimContact::setBirthday( const QDate &v ) { if ( v.isNull() ) { - qWarning( "Remove Birthday" ); + owarn << "Remove Birthday" << oendl; replace( Qtopia::Birthday, QString::null ); return ; } if ( v.isValid() ) replace( Qtopia::Birthday, OPimDateConversion::dateToString( v ) ); @@ -1152,13 +1154,13 @@ void OPimContact::setBirthday( const QDate &v ) null, the current stored date will be removed. */ void OPimContact::setAnniversary( const QDate &v ) { if ( v.isNull() ) { - qWarning( "Remove Anniversary" ); + owarn << "Remove Anniversary" << oendl; replace( Qtopia::Anniversary, QString::null ); return ; } if ( v.isValid() ) replace( Qtopia::Anniversary, OPimDateConversion::dateToString( v ) ); @@ -1193,13 +1195,13 @@ QDate OPimContact::anniversary() const return empty; } void OPimContact::insertEmail( const QString &v ) { - //qDebug("insertEmail %s", v.latin1()); + //odebug << "insertEmail " << v << "" << oendl; QString e = v.simplifyWhiteSpace(); QString def = defaultEmail(); // if no default, set it as the default email and don't insert if ( def.isEmpty() ) { @@ -1227,22 +1229,22 @@ void OPimContact::insertEmail( const QString &v ) // otherwise, must first contain it if ( !emailsStr.contains( e ) ) return ; // remove it - //qDebug(" removing email from list %s", e.latin1()); + //odebug << " removing email from list " << e << "" << oendl; emails.remove( e ); // reset the string emailsStr = emails.join( emailSeparator() ); // Sharp's brain dead separator replace( Qtopia::Emails, emailsStr ); // if default, then replace the default email with the first one if ( def == e ) { - //qDebug("removeEmail is default; setting new default"); + //odebug << "removeEmail is default; setting new default" << oendl; if ( !emails.count() ) clearEmails(); else // setDefaultEmail will remove e from the list setDefaultEmail( emails.first() ); } } @@ -1256,13 +1258,13 @@ void OPimContact::clearEmails() void OPimContact::setDefaultEmail( const QString &v ) { QString e = v.simplifyWhiteSpace(); - //qDebug("OPimContact::setDefaultEmail %s", e.latin1()); + //odebug << "OPimContact::setDefaultEmail " << e << "" << oendl; replace( Qtopia::DefaultEmail, e ); if ( !e.isEmpty() ) insertEmail( e ); } diff --git a/libopie2/opiepim/core/opimcontactfields.cpp b/libopie2/opiepim/core/opimcontactfields.cpp index 120beb6..5d45d1f 100644 --- a/libopie2/opiepim/core/opimcontactfields.cpp +++ b/libopie2/opiepim/core/opimcontactfields.cpp @@ -28,12 +28,14 @@ */ #include "opimcontactfields.h" /* OPIE */ #include <opie2/opimcontact.h> +#include <opie2/odebug.h> + #include <qpe/config.h> /* QT */ #include <qobject.h> @@ -439,61 +441,61 @@ OPimContactFields::~OPimContactFields() void OPimContactFields::saveToRecord( OPimContact &cnt ) { - qDebug( "ocontactfields saveToRecord: >%s<", fieldOrder.latin1() ); + odebug << "ocontactfields saveToRecord: >" << fieldOrder << "<" << oendl; // Store fieldorder into this contact. cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); globalFieldOrder = fieldOrder; changedFieldOrder = true; } void OPimContactFields::loadFromRecord( const OPimContact &cnt ) { - qDebug( "ocontactfields loadFromRecord" ); - qDebug( "loading >%s<", cnt.fullName().latin1() ); + odebug << "ocontactfields loadFromRecord" << oendl; + odebug << "loading >" << cnt.fullName() << "<" << oendl; // Get fieldorder for this contact. If none is defined, // we will use the global one from the config file.. fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); - qDebug( "fieldOrder from contact>%s<", fieldOrder.latin1() ); + odebug << "fieldOrder from contact>" << fieldOrder << "<" << oendl; if ( fieldOrder.isEmpty() ) { fieldOrder = globalFieldOrder; } - qDebug( "effective fieldOrder in loadFromRecord >%s<", fieldOrder.latin1() ); + odebug << "effective fieldOrder in loadFromRecord >" << fieldOrder << "<" << oendl; } void OPimContactFields::setFieldOrder( int num, int index ) { - qDebug( "qcontactfields setfieldorder pos %i -> %i", num, index ); + odebug << "qcontactfields setfieldorder pos " << num << " -> " << index << "" << oendl; fieldOrder[ num ] = QString::number( index, 16 ) [ 0 ]; // We will store this new fieldorder globally to // remember it for contacts which have none globalFieldOrder = fieldOrder; changedFieldOrder = true; - qDebug( "fieldOrder >%s<", fieldOrder.latin1() ); + odebug << "fieldOrder >" << fieldOrder << "<" << oendl; } int OPimContactFields::getFieldOrder( int num, int defIndex ) { - qDebug( "ocontactfields getFieldOrder" ); - qDebug( "fieldOrder >%s<", fieldOrder.latin1() ); + odebug << "ocontactfields getFieldOrder" << oendl; + odebug << "fieldOrder >" << fieldOrder << "<" << oendl; // Get index of combo as char.. QChar poschar = fieldOrder[ num ]; bool ok; int ret = 0; @@ -504,13 +506,13 @@ int OPimContactFields::getFieldOrder( int num, int defIndex ) ok = false; // Return default value if index for // num was not set or if anything else happened.. if ( !ok ) ret = defIndex; - qDebug( "returning >%i<", ret ); + odebug << "returning >" << ret << "<" << oendl; return ret; } } diff --git a/libopie2/opiepim/core/opimdateconversion.cpp b/libopie2/opiepim/core/opimdateconversion.cpp index 8bf891b..c93e178 100644 --- a/libopie2/opiepim/core/opimdateconversion.cpp +++ b/libopie2/opiepim/core/opimdateconversion.cpp @@ -25,12 +25,14 @@ _;:, .> :=|. This program is free software; you can Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/* OPIE */
#include <opie2/opimdateconversion.h>
+#include <opie2/odebug.h>
+
#include <qpe/timeconversion.h>
namespace Opie
{
QString OPimDateConversion::dateToString( const QDate &d )
@@ -43,13 +45,13 @@ QString OPimDateConversion::dateToString( const QDate &d ) QString month = QString::number( d.month() );
month = month.rightJustify( 2, '0' );
QString day = QString::number( d.day() );
day = day.rightJustify( 2, '0' );
QString str = year + month + day;
- //qDebug( "\tPimContact dateToStr = %s", str.latin1() );
+ //odebug << "\tPimContact dateToStr = " << str << "" << oendl;
return str;
}
QDate OPimDateConversion::dateFromString( const QString& s )
@@ -71,30 +73,30 @@ QDate OPimDateConversion::dateFromString( const QString& s ) int day = s.mid( 6, 2 ).toInt();
// do some quick sanity checking -eilers
// but we isValid() again? -zecke
if ( year < 1900 || year > 3000 )
{
- qWarning( "PimContact year is not in range" );
+ owarn << "PimContact year is not in range" << oendl;
return date;
}
if ( month < 0 || month > 12 )
{
- qWarning( "PimContact month is not in range" );
+ owarn << "PimContact month is not in range" << oendl;
return date;
}
if ( day < 0 || day > 31 )
{
- qWarning( "PimContact day is not in range" );
+ owarn << "PimContact day is not in range" << oendl;
return date;
}
date.setYMD( year, month, day );
if ( !date.isValid() )
{
- qWarning( "PimContact date is not valid" );
+ owarn << "PimContact date is not valid" << oendl;
return date;
}
return date;
}
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp index 9d46651..8752fce 100644 --- a/libopie2/opiepim/core/opimevent.cpp +++ b/libopie2/opiepim/core/opimevent.cpp @@ -30,12 +30,14 @@ #include "opimevent.h" /* OPIE */ #include <opie2/opimrecurrence.h> #include <opie2/opimresolver.h> #include <opie2/opimnotifymanager.h> +#include <opie2/odebug.h> + #include <qpe/categories.h> #include <qpe/stringutil.h> /* QT */ namespace Opie @@ -638,16 +640,16 @@ void OPimEvent::fromMap( const QMap<int, QString>& map ) setEndDateTime ( utc.fromUTCDateTime( end ) ); setTimeZone( "UTC" ); // make sure it is really utc } else { /* to current date time */ - // qWarning(" Start is %d", start ); + // owarn << " Start is " << start << "" << oendl; OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() ); QDateTime date = zone.toDateTime( start ); - qWarning( " Start is %s", date.toString().latin1() ); + owarn << " Start is " << date.toString() << "" << oendl; setStartDateTime( zone.toDateTime( date, OPimTimeZone::current() ) ); date = zone.toDateTime( end ); setEndDateTime ( zone.toDateTime( date, OPimTimeZone::current() ) ); } diff --git a/libopie2/opiepim/core/opimnotifymanager.cpp b/libopie2/opiepim/core/opimnotifymanager.cpp index 573340a..0f863aa 100644 --- a/libopie2/opiepim/core/opimnotifymanager.cpp +++ b/libopie2/opiepim/core/opimnotifymanager.cpp @@ -28,12 +28,13 @@ */ #include "opimnotifymanager.h" /* OPIE */ #include <opie2/opimdateconversion.h> +#include <opie2/odebug.h> /* QT */ #include <qstringlist.h> namespace Opie { @@ -160,13 +161,13 @@ void OPimNotifyManager::deregister( const OPimNotify& ) { } bool OPimNotifyManager::isEmpty() const { - qWarning( "is Empty called on OPimNotifyManager %d %d", m_rem.count(), m_al.count() ); + owarn << "is Empty called on OPimNotifyManager " << m_rem.count() << " " << m_al.count() << "" << oendl; if ( m_rem.isEmpty() && m_al.isEmpty() ) return true; else return false; } // Taken from otodoaccessxml.. code duplication bad. any alternative? @@ -188,13 +189,13 @@ QString OPimNotifyManager::alarmsToString() const + ":" + QString::number( ( *it ).duration() ) + ":" + QString::number( ( *it ).sound() ) + ":"; } } // now write the list - qWarning( "als: %s", als.join( "____________" ).latin1() ); + owarn << "als: " << als.join( "____________" ) << "" << oendl; str = als.join( ";" ); } return str; } @@ -222,13 +223,13 @@ QString OPimNotifyManager::remindersToString() const void OPimNotifyManager::alarmsFromString( const QString& str ) { QStringList als = QStringList::split( ";", str ); for ( QStringList::Iterator it = als.begin(); it != als.end(); ++it ) { QStringList alarm = QStringList::split( ":", ( *it ), TRUE ); // allow empty - qWarning( "alarm: %s", alarm.join( "___" ).latin1() ); + owarn << "alarm: " << alarm.join( "___" ) << "" << oendl; 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() ); add( al ); } diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index c783092..6546d99 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp @@ -118,13 +118,13 @@ bool OPimRecord::isEmpty() const QArray<int> id = it.data(); for ( uint i = 0; i < id.size(); ++i ) { str += it.key() + "," + QString::number( i ) + ";"; } } str = str.remove( str.length()-1, 1); // strip the ; - //qWarning("IDS " + str ); + //owarn << "IDS " + str << oendl; return str; }*/ /* if uid = 1 assign a new one */ void OPimRecord::setUid( int uid ) { diff --git a/libopie2/opiepim/core/opimtimezone.cpp b/libopie2/opiepim/core/opimtimezone.cpp index be21b1b..fefceb5 100644 --- a/libopie2/opiepim/core/opimtimezone.cpp +++ b/libopie2/opiepim/core/opimtimezone.cpp @@ -26,12 +26,15 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "opimtimezone.h" +/* OPIE */ +#include <opie2/odebug.h> + /* STD */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> namespace Opie @@ -146,13 +149,13 @@ QDateTime OPimTimeZone::toDateTime( time_t t ) * convert dt to utc using zone.m_name * convert utc -> timeZoneDT using this->m_name */ QDateTime OPimTimeZone::toDateTime( const QDateTime& dt, const OPimTimeZone& zone ) { time_t utc = to_Time_t( dt, zone.m_name ); - qWarning( "%d %s", utc, zone.m_name.latin1() ); + owarn << "" << utc << " " << zone.m_name << "" << oendl; return utcTime( utc, m_name ); } time_t OPimTimeZone::fromDateTime( const QDateTime& time ) { diff --git a/libopie2/opiepim/core/opimtodo.cpp b/libopie2/opiepim/core/opimtodo.cpp index 47433e0..27b36a6 100644 --- a/libopie2/opiepim/core/opimtodo.cpp +++ b/libopie2/opiepim/core/opimtodo.cpp @@ -32,12 +32,14 @@ /* OPIE */ #include <opie2/opimstate.h> #include <opie2/opimrecurrence.h> #include <opie2/opimmaintainer.h> #include <opie2/opimnotifymanager.h> #include <opie2/opimresolver.h> +#include <opie2/odebug.h> + #include <qpe/palmtopuidgen.h> #include <qpe/palmtoprecord.h> #include <qpe/categories.h> #include <qpe/categoryselect.h> #include <qpe/stringutil.h> @@ -82,23 +84,23 @@ struct OPimTodo::OPimTodoData : public QShared OPimTodo::OPimTodo( const OPimTodo &event ) : OPimRecord( event ), data( event.data ) { data->ref(); - // qWarning("ref up"); + // owarn << "ref up" << oendl; } OPimTodo::~OPimTodo() { - // qWarning("~OPimTodo " ); + // owarn << "~OPimTodo " << oendl; if ( data->deref() ) { - // qWarning("OPimTodo::dereffing"); + // owarn << "OPimTodo::dereffing" << oendl; delete data; data = 0l; } } @@ -107,13 +109,13 @@ OPimTodo::OPimTodo( bool completed, int priority, const QString& summary, const QString &description, ushort progress, bool hasDate, QDate date, int uid ) : OPimRecord( uid ) { - // qWarning("OPimTodoData " + summary); + // owarn << "OPimTodoData " + summary << oendl; setCategories( category ); data = new OPimTodoData; data->date = date; data->isCompleted = completed; @@ -130,13 +132,13 @@ OPimTodo::OPimTodo( bool completed, int priority, const QString& summary, const QString &description, ushort progress, bool hasDate, QDate date, int uid ) : OPimRecord( uid ) { - // qWarning("OPimTodoData" + summary); + // owarn << "OPimTodoData" + summary << oendl; setCategories( idsFromString( category.join( ";" ) ) ); data = new OPimTodoData; data->date = date; data->isCompleted = completed; @@ -303,13 +305,13 @@ void OPimTodo::setHasDueDate( bool hasDate ) data->hasDate = hasDate; } void OPimTodo::setDescription( const QString &desc ) { - // qWarning( "desc " + desc ); + // owarn << "desc " + desc << oendl; changeOrModify(); data->desc = Qtopia::simplifyMultiLineSpace( desc ); } void OPimTodo::setSummary( const QString& sum ) @@ -588,28 +590,28 @@ bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const } void OPimTodo::deref() { - // qWarning("deref in ToDoEvent"); + // owarn << "deref in ToDoEvent" << oendl; if ( data->deref() ) { - // qWarning("deleting"); + // owarn << "deleting" << oendl; delete data; data = 0; } } OPimTodo &OPimTodo::operator=( const OPimTodo &item ) { if ( this == &item ) return * this; OPimRecord::operator=( item ); - //qWarning("operator= ref "); + //owarn << "operator= ref " << oendl; item.data->ref(); deref(); data = item.data; return *this; } @@ -646,13 +648,13 @@ QMap<int, QString> OPimTodo::toMap() const * right in place */ void OPimTodo::changeOrModify() { if ( data->count != 1 ) { - qWarning( "changeOrModify" ); + owarn << "changeOrModify" << oendl; data->deref(); OPimTodoData* d2 = new OPimTodoData(); copy( data, d2 ); data = d2; } } diff --git a/libopie2/opiepim/core/otodoaccess.cpp b/libopie2/opiepim/core/otodoaccess.cpp index c4adbbd..26a68a0 100644 --- a/libopie2/opiepim/core/otodoaccess.cpp +++ b/libopie2/opiepim/core/otodoaccess.cpp @@ -47,13 +47,13 @@ OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access ) if (end == 0l ) m_todoBackEnd = OBackendFactory<OPimTodoAccessBackend>::defaultBackend (OPimGlobal::TODOLIST, QString::null); setBackEnd( m_todoBackEnd ); } OPimTodoAccess::~OPimTodoAccess() { -// qWarning("~OPimTodoAccess"); +// owarn << "~OPimTodoAccess" << oendl; } void OPimTodoAccess::mergeWith( const QValueList<OPimTodo>& list ) { QValueList<OPimTodo>::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) { replace( (*it) ); } diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp index 40dc297..8ce2062 100644 --- a/libopie2/opiepim/ui/opimmainwindow.cpp +++ b/libopie2/opiepim/ui/opimmainwindow.cpp @@ -23,22 +23,29 @@ -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qapplication.h> -#include <qdatetime.h> -#include <qcopchannel_qws.h> + +#include "opimmainwindow.h" + +/* OPIE */ +#include <opie2/opimresolver.h> +#include <opie2/odebug.h> #include <qpe/sound.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> -#include <opie2/opimresolver.h> -#include "opimmainwindow.h" +/* QT */ +#include <qapplication.h> +#include <qdatetime.h> +#include <qcopchannel_qws.h> + + namespace Opie { OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, const char* name, WFlags flag ) : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { @@ -113,13 +120,13 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) delete m_fallBack; }else if ( cmd == "alarm(QDateTime,int)" ) { raise(); QDateTime dt; int uid; stream >> dt; stream >> uid; - qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid ); + owarn << " Date: " << dt.toString() << " Uid: " << uid << "" << oendl; QDateTime current = QDateTime::currentDateTime(); if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) return; doAlarm( dt, uid ); needShow = true; } |