summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
authorar <ar>2004-06-01 21:38:07 (UTC)
committer ar <ar>2004-06-01 21:38:07 (UTC)
commitbaed1d5ab8589aef14440009bc4e7380bcc5a741 (patch) (side-by-side diff)
treec636e892c5eec0df2b36d16cb601a7da41a2ef0f /libopie2/opiepim/core
parent4438393d8eef624565e840b798429071829adea8 (diff)
downloadopie-baed1d5ab8589aef14440009bc4e7380bcc5a741.zip
opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.gz
opie-baed1d5ab8589aef14440009bc4e7380bcc5a741.tar.bz2
- convert to odebug framework
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimcontact.cpp20
-rw-r--r--libopie2/opiepim/core/opimcontactfields.cpp22
-rw-r--r--libopie2/opiepim/core/opimdateconversion.cpp12
-rw-r--r--libopie2/opiepim/core/opimevent.cpp24
-rw-r--r--libopie2/opiepim/core/opimnotifymanager.cpp7
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp2
-rw-r--r--libopie2/opiepim/core/opimtimezone.cpp5
-rw-r--r--libopie2/opiepim/core/opimtodo.cpp22
-rw-r--r--libopie2/opiepim/core/otodoaccess.cpp2
9 files changed, 65 insertions, 51 deletions
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
@@ -21,32 +21,34 @@
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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.
*/
#define QTOPIA_INTERNAL_CONTACT_MRE
#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>
/* STD */
#include <stdio.h>
/*!
\class Contact contact.h
\brief The Contact class holds the data of an address book entry.
This data includes information the name of the person, contact
information, and business information such as deparment and job title.
@@ -66,40 +68,40 @@ OPimContact::OPimContact():OPimRecord(), mMap(), d( 0 )
/*!
\internal
Creates a new contact. The properties of the contact are
set from \a fromMap.
*/
OPimContact::OPimContact( const QMap<int, QString> &fromMap ):OPimRecord(), mMap( fromMap ), d( 0 )
{
QString cats = mMap[ Qtopia::AddressCategory ];
if ( !cats.isEmpty() )
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() )
- // setUid( uidStr.toInt() );
+ // setUid( uidStr.toInt() );
}
/*!
Destroys a contact.
*/
OPimContact::~OPimContact()
{}
/*! \fn void OPimContact::setTitle( const QString &str )
Sets the title of the contact to \a str.
*/
/*! \fn void OPimContact::setFirstName( const QString &str )
Sets the first name of the contact to \a str.
*/
@@ -918,33 +920,33 @@ QStringList OPimContact::childrenList() const
/*! \fn void OPimContact::insertEmails( const QStringList &emailList )
Appends the \a emailList to the exiting email list
*/
/*!
Returns a list of email addresses belonging to the contact, including
the default email address.
*/
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;
}
/*!
\overload
Generates the string for the contact to be filed as from the first,
middle and last name of the contact.
*/
void OPimContact::setFileAs()
{
@@ -1123,52 +1125,52 @@ class QString OPimContact::recordField( int pos ) const
QStringList SLFIELDS = fields(); // ?? why this ? (se)
return SLFIELDS[ pos ];
}
// In future releases, we should store birthday and anniversary
// internally as QDate instead of QString !
// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
/*! \fn void OPimContact::setBirthday( const QDate& date )
Sets the birthday for the contact to \a date. If date is null
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 ) );
}
/*! \fn void OPimContact::setAnniversary( const QDate &date )
Sets the anniversary of the contact to \a date. If date is
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 ) );
}
/*! \fn QDate OPimContact::birthday() const
Returns the birthday of the contact.
*/
QDate OPimContact::birthday() const
{
QString str = find( Qtopia::Birthday );
// qWarning ("Birthday %s", str.latin1() );
@@ -1183,33 +1185,33 @@ QDate OPimContact::birthday() const
Returns the anniversary of the contact.
*/
QDate OPimContact::anniversary() const
{
QDate empty;
QString str = find( Qtopia::Anniversary );
// qWarning ("Anniversary %s", str.latin1() );
if ( !str.isEmpty() )
return OPimDateConversion::dateFromString ( str );
else
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() )
{
setDefaultEmail( e ); // will insert into the list for us
return ;
}
// otherwise, insert assuming doesn't already exist
QString emailsStr = find( Qtopia::Emails );
if ( emailsStr.contains( e ) )
return ;
if ( !emailsStr.isEmpty() )
emailsStr += emailSeparator();
@@ -1217,62 +1219,62 @@ void OPimContact::insertEmail( const QString &v )
replace( Qtopia::Emails, emailsStr );
}
void OPimContact::removeEmail( const QString &v )
{
QString e = v.simplifyWhiteSpace();
QString def = defaultEmail();
QString emailsStr = find( Qtopia::Emails );
QStringList emails = emailList();
// 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() );
}
}
void OPimContact::clearEmails()
{
mMap.remove( Qtopia::DefaultEmail );
mMap.remove( Qtopia::Emails );
}
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 );
}
void OPimContact::insertEmails( const QStringList &v )
{
for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it )
insertEmail( *it );
}
int OPimContact::rtti() const
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
@@ -18,32 +18,34 @@
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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 "opimcontactfields.h"
/* OPIE */
#include <opie2/opimcontact.h>
+#include <opie2/odebug.h>
+
#include <qpe/config.h>
/* QT */
#include <qobject.h>
namespace Opie
{
/*!
\internal
Returns a list of personal field names for a contact.
*/
QStringList OPimContactFields::personalfields( bool sorted, bool translated )
{
QStringList list;
QMap<int, QString> mapIdToStr;
@@ -429,88 +431,88 @@ OPimContactFields::~OPimContactFields()
// We will store the fieldorder into the config file
// to reuse it for the future..
if ( changedFieldOrder )
{
Config cfg ( "AddressBook" );
cfg.setGroup( "ContactFieldOrder" );
cfg.writeEntry( "General", globalFieldOrder );
}
}
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;
// Convert char to number..
if ( !( poschar == QChar::null ) )
ret = QString( poschar ).toInt( &ok, 16 );
else
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
@@ -15,96 +15,98 @@ _;:, .> :=|. This program is free software; you can
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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/odebug.h>
+
#include <qpe/timeconversion.h>
namespace Opie
{
QString OPimDateConversion::dateToString( const QDate &d )
{
if ( d.isNull() || !d.isValid() )
return QString::null;
// ISO format in year, month, day (YYYYMMDD); e.g. 20021231
QString year = QString::number( d.year() );
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 )
{
QDate date;
if ( s.isEmpty() )
return date;
// Be backward compatible to old Opie format:
// Try to load old format. If it fails, try new ISO-Format!
date = TimeConversion::fromString ( s );
if ( date.isValid() )
return date;
// Read ISO-Format (YYYYMMDD)
int year = s.mid( 0, 4 ).toInt();
int month = s.mid( 4, 2 ).toInt();
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;
}
QString OPimDateConversion::dateTimeToString( const QDateTime& dt )
{
if ( !dt.isValid() || dt.isNull() )
return QString::null;
QString year = QString::number( dt.date().year() );
QString month = QString::number( dt.date().month() );
QString day = QString::number( dt.date().day() );
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
@@ -20,32 +20,34 @@
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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 "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
{
int OCalendarHelper::week( const QDate& date )
{
// Calculates the week this date is in within that
// month. Equals the "row" is is in in the month view
int week = 1;
QDate tmp( date.year(), date.month(), 1 );
if ( date.dayOfWeek() < tmp.dayOfWeek() )
++week;
@@ -542,37 +544,37 @@ void OPimEvent::deref()
}
}
// Exporting Event data to map. Using the same
// encoding as ODateBookAccessBackend_xml does..
// Thus, we could remove the stuff there and use this
// for it and for all other places..
// Encoding should happen at one place, only ! (eilers)
QMap<int, QString> OPimEvent::toMap() const
{
QMap<int, QString> retMap;
retMap.insert( OPimEvent::FUid, QString::number( uid() ) );
retMap.insert( OPimEvent::FCategories, Qtopia::escapeString( Qtopia::Record::idsToString( categories() ) ) );
retMap.insert( OPimEvent::FDescription, Qtopia::escapeString( description() ) );
retMap.insert( OPimEvent::FLocation, Qtopia::escapeString( location() ) );
retMap.insert( OPimEvent::FType, isAllDay() ? "AllDay" : "" );
- if ( notifiers().alarms().count() ){
- // Currently we just support one alarm.. (eilers)
- OPimAlarm alarm = notifiers().alarms() [ 0 ];
- retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
- retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
+ if ( notifiers().alarms().count() ){
+ // Currently we just support one alarm.. (eilers)
+ OPimAlarm alarm = notifiers().alarms() [ 0 ];
+ retMap.insert( OPimEvent::FAlarm, QString::number( alarm.dateTime().secsTo( startDateTime() ) / 60 ) );
+ retMap.insert( OPimEvent::FSound, ( alarm.sound() == OPimAlarm::Loud ) ? "loud" : "silent" );
}
OPimTimeZone zone( timeZone().isEmpty() ? OPimTimeZone::current() : timeZone() );
retMap.insert( OPimEvent::FStart, QString::number( zone.fromUTCDateTime( zone.toDateTime( startDateTime(), OPimTimeZone::utc() ) ) ) );
retMap.insert( OPimEvent::FEnd, QString::number( zone.fromUTCDateTime( zone.toDateTime( endDateTime(), OPimTimeZone::utc() ) ) ) );
retMap.insert( OPimEvent::FNote, Qtopia::escapeString( note() ) );
retMap.insert( OPimEvent::FTimeZone, timeZone().isEmpty() ? QString( "None" ) : timeZone() );
if ( parent() )
retMap.insert( OPimEvent::FRecParent, QString::number( parent() ) );
if ( children().count() )
{
QArray<int> childr = children();
QString buf;
for ( uint i = 0; i < childr.count(); i++ )
{
if ( i != 0 ) buf += " ";
@@ -628,57 +630,57 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
}
time_t start = ( time_t ) map[ OPimEvent::FStart ].toLong();
time_t end = ( time_t ) map[ OPimEvent::FEnd ].toLong();
/* AllDay is always in UTC */
if ( isAllDay() )
{
OPimTimeZone utc = OPimTimeZone::utc();
setStartDateTime( utc.fromUTCDateTime( start ) );
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() ) );
}
int alarmTime = -1;
if ( !map[ OPimEvent::FAlarm ].isEmpty() )
alarmTime = map[ OPimEvent::FAlarm ].toInt();
int sound = ( ( map[ OPimEvent::FSound ] == "loud" ) ? OPimAlarm::Loud : OPimAlarm::Silent );
if ( ( alarmTime != -1 ) )
{
- QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
- OPimAlarm al( sound , dt );
- notifiers().add( al );
+ QDateTime dt = startDateTime().addSecs( -1 * alarmTime * 60 );
+ OPimAlarm al( sound , dt );
+ notifiers().add( al );
}
if ( !map[ OPimEvent::FNote ].isEmpty() )
- setNote( map[ OPimEvent::FNote ] );
+ setNote( map[ OPimEvent::FNote ] );
if ( !map[ OPimEvent::FRecParent ].isEmpty() )
setParent( map[ OPimEvent::FRecParent ].toInt() );
if ( !map[ OPimEvent::FRecChildren ].isEmpty() )
{
QStringList list = QStringList::split( ' ', map[ OPimEvent::FRecChildren ] );
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
{
addChild( ( *it ).toInt() );
}
}
// Fill recurrence stuff and put it directly into the OPimRecurrence-Object using fromMap..
if ( !map[ OPimEvent::FRType ].isEmpty() )
{
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
@@ -18,32 +18,33 @@
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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 "opimnotifymanager.h"
/* OPIE */
#include <opie2/opimdateconversion.h>
+#include <opie2/odebug.h>
/* QT */
#include <qstringlist.h>
namespace Opie
{
OPimNotifyManager::OPimNotifyManager( const Reminders& rem, const Alarms& al )
: m_rem( rem ), m_al( al )
{}
OPimNotifyManager::~OPimNotifyManager()
{}
@@ -150,61 +151,61 @@ void OPimNotifyManager::registerNotify( const OPimNotify& )
}
/* FIXME!!! */
/**
* same as above...
* Also implement Url model
* have a MainWindow....
*/
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?
QString OPimNotifyManager::alarmsToString() const
{
QString str;
OPimNotifyManager::Alarms alarms = m_al;
if ( !alarms.isEmpty() )
{
QStringList als;
OPimNotifyManager::Alarms::Iterator it = alarms.begin();
for ( ; it != alarms.end(); ++it )
{
/* only if time is valid */
if ( ( *it ).dateTime().isValid() )
{
als << OPimDateConversion::dateTimeToString( ( *it ).dateTime() )
+ ":" + 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;
}
QString OPimNotifyManager::remindersToString() const
{
QString str;
OPimNotifyManager::Reminders reminders = m_rem;
if ( !reminders.isEmpty() )
{
OPimNotifyManager::Reminders::Iterator it = reminders.begin();
QStringList records;
@@ -212,33 +213,33 @@ QString OPimNotifyManager::remindersToString() const
{
records << QString::number( ( *it ).recordUid() );
}
str = records.join( ";" );
}
return str;
}
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 );
}
}
void OPimNotifyManager::remindersFromString( const QString& str )
{
QStringList rems = QStringList::split( ";", str );
for ( QStringList::Iterator it = rems.begin(); it != rems.end(); ++it )
{
OPimReminder rem( ( *it ).toInt() );
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
@@ -108,33 +108,33 @@ void OPimRecord::addCategoryName( const QString& )
bool OPimRecord::isEmpty() const
{
return ( uid() == 0 );
}
/*QString OPimRecord::crossToString()const {
QString str;
QMap<QString, QArray<int> >::ConstIterator it;
for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
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 )
{
if ( uid == 1 )
uid = uidGen().generate();
Qtopia::Record::setUid( uid );
};
Qtopia::UidGen &OPimRecord::uidGen()
{
return m_uidGen;
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
@@ -16,32 +16,35 @@
: .. .:, . . . without even the implied warranty of
=_ + =;=|` MERCHANTABILITY or FITNESS FOR A
_.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.= = ; Library General Public License for more
++= -. .` .: details.
: = ...= . :.=-
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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 "opimtimezone.h"
+/* OPIE */
+#include <opie2/odebug.h>
+
/* STD */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
namespace Opie
{
QDateTime utcTime( time_t t )
{
tm * broken = ::gmtime( &t );
QDateTime ret;
ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon + 1, broken->tm_mday ) );
ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) );
return ret;
}
@@ -136,33 +139,33 @@ QDateTime OPimTimeZone::fromUTCDateTime( time_t t )
}
QDateTime OPimTimeZone::toDateTime( time_t t )
{
return utcTime( t, m_name );
}
/*
* 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 )
{
return to_Time_t( time, m_name );
}
time_t OPimTimeZone::fromUTCDateTime( const QDateTime& time )
{
return to_Time_t( time, "UTC" );
}
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
@@ -22,32 +22,34 @@
-. .:....=;==+<; You should have received a copy of the GNU
-_. . . )=. = 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 "opimtodo.h"
/* 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>
/* QT */
#include <qobject.h>
#include <qshared.h>
namespace Opie
{
struct OPimTodo::OPimTodoData : public QShared
{
OPimTodoData() : QShared()
@@ -72,81 +74,81 @@ struct OPimTodo::OPimTodoData : public QShared
QString sum;
QMap<QString, QString> extra;
ushort prog;
OPimState *state;
OPimRecurrence *recur;
OPimMaintainer *maintainer;
QDate start;
QDate completed;
OPimNotifyManager *notifiers;
};
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;
}
}
OPimTodo::OPimTodo( bool completed, int priority,
const QArray<int> &category,
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;
data->hasDate = hasDate;
data->priority = priority;
data->sum = summary;
data->prog = progress;
data->desc = Qtopia::simplifyMultiLineSpace( description );
}
OPimTodo::OPimTodo( bool completed, int priority,
const QStringList &category,
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;
data->hasDate = hasDate;
data->priority = priority;
data->sum = summary;
data->prog = progress;
data->desc = Qtopia::simplifyMultiLineSpace( description );
}
bool OPimTodo::match( const QRegExp &regExp ) const
{
@@ -293,33 +295,33 @@ OPimMaintainer OPimTodo::maintainer() const
void OPimTodo::setCompleted( bool completed )
{
changeOrModify();
data->isCompleted = completed;
}
void OPimTodo::setHasDueDate( bool hasDate )
{
changeOrModify();
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 )
{
changeOrModify();
data->sum = sum;
}
void OPimTodo::setPriority( int prio )
{
changeOrModify();
data->priority = prio;
@@ -578,48 +580,48 @@ bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const
if ( data->priority != toDoEvent.data->prog ) return false;
if ( data->isCompleted != toDoEvent.data->isCompleted ) return false;
if ( data->hasDate != toDoEvent.data->hasDate ) return false;
if ( data->date != toDoEvent.data->date ) return false;
if ( data->sum != toDoEvent.data->sum ) return false;
if ( data->desc != toDoEvent.data->desc ) return false;
if ( data->maintainer != toDoEvent.data->maintainer )
return false;
return OPimRecord::operator==( toDoEvent );
}
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;
}
QMap<int, QString> OPimTodo::toMap() const
{
QMap<int, QString> map;
map.insert( Uid, QString::number( uid() ) );
map.insert( Category, idsToString( categories() ) );
map.insert( HasDate, QString::number( data->hasDate ) );
map.insert( Completed, QString::number( data->isCompleted ) );
@@ -636,33 +638,33 @@ QMap<int, QString> OPimTodo::toMap() const
map.insert( Reminders, );
map.
*/
return map;
}
/**
* change or modify looks at the ref count and either
* creates a new QShared Object or it can modify it
* 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;
}
}
// WATCHOUT
/*
* if you add something to the Data struct
* be sure to copy it here
*/
void OPimTodo::copy( OPimTodoData* src, OPimTodoData* dest )
{
dest->date = src->date;
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
@@ -37,33 +37,33 @@
#include <opie2/opimglobal.h>
namespace Opie {
OPimTodoAccess::OPimTodoAccess( OPimTodoAccessBackend* end, enum Access )
: QObject(), OPimAccessTemplate<OPimTodo>( end ), m_todoBackEnd( end )
{
// if (end == 0l )
// m_todoBackEnd = new OPimTodoAccessBackendSQL( QString::null);
// Zecke: Du musst hier noch fr das XML-Backend einen Appnamen bergeben !
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) );
}
}
OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start,
const QDate& end,
bool includeNoDates ) {
QArray<int> ints = m_todoBackEnd->effectiveToDos( start, end, includeNoDates );
List lis( ints, this );
return lis;
}
OPimTodoAccess::List OPimTodoAccess::effectiveToDos( const QDate& start,