summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/core
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/core') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiepim/core/opimcontact.cpp18
-rw-r--r--libopie2/opiepim/core/opimcontactfields.cpp22
-rw-r--r--libopie2/opiepim/core/opimdateconversion.cpp12
-rw-r--r--libopie2/opiepim/core/opimevent.cpp6
-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, 55 insertions, 41 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
@@ -13,94 +13,96 @@
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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.
*/
#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.
\ingroup qtopiaemb
\ingroup qtopiadesktop
*/
namespace Opie
{
/*!
Creates a new, empty contact.
*/
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() );
}
/*!
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.
*/
/*! \fn void OPimContact::setMiddleName( const QString &str )
@@ -910,49 +912,49 @@ QStringList OPimContact::childrenList() const
email list
*/
/*! \fn void OPimContact::clearEmails()
Clears the email list.
*/
/*! \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()
{
QString lastName, firstName, middleName, fileas;
lastName = find( Qtopia::LastName );
firstName = find( Qtopia::FirstName );
middleName = find( Qtopia::MiddleName );
if ( !lastName.isEmpty() && !firstName.isEmpty()
&& !middleName.isEmpty() )
fileas = lastName + ", " + firstName + " " + middleName;
@@ -1115,172 +1117,172 @@ QString OPimContact::toShortText() const
QString OPimContact::type() const
{
return QString::fromLatin1( "OPimContact" );
}
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() );
if ( !str.isEmpty() )
return OPimDateConversion::dateFromString ( str );
else
return QDate();
}
/*! \fn QDate OPimContact::anniversary() 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();
emailsStr += e;
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
{
return OPimResolver::AddressBook;
}
void OPimContact::setUid( int i )
{
OPimRecord::setUid( i );
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
@@ -10,48 +10,50 @@
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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 "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;
if ( translated )
mapIdToStr = idToTrFields();
else
mapIdToStr = idToUntrFields();
list.append( mapIdToStr[ Qtopia::AddressUid ] );
list.append( mapIdToStr[ Qtopia::AddressCategory ] );
@@ -421,96 +423,96 @@ OPimContactFields::OPimContactFields() :
// use it as a start pattern
Config cfg ( "AddressBook" );
cfg.setGroup( "ContactFieldOrder" );
globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER );
}
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
@@ -7,112 +7,114 @@ _;:, .> :=|. This program is free software; you can
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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() );
QString hour = QString::number( dt.time().hour() );
QString min = QString::number( dt.time().minute() );
QString sec = QString::number( dt.time().second() );
month = month.rightJustify( 2, '0' );
day = day. rightJustify( 2, '0' );
hour = hour. rightJustify( 2, '0' );
min = min. rightJustify( 2, '0' );
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
@@ -12,48 +12,50 @@
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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 "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;
week += ( date.day() - 1 ) / 7;
return week;
}
int OCalendarHelper::ocurrence( const QDate& date )
@@ -620,52 +622,52 @@ void OPimEvent::fromMap( const QMap<int, QString>& map )
if ( map[ OPimEvent::FType ] == "AllDay" )
setAllDay( true );
else
setAllDay( false );
if ( !map[ OPimEvent::FTimeZone ].isEmpty() && ( map[ OPimEvent::FTimeZone ] != "None" ) )
{
setTimeZone( map[ OPimEvent::FTimeZone ] );
}
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 );
}
if ( !map[ OPimEvent::FNote ].isEmpty() )
setNote( map[ OPimEvent::FNote ] );
if ( !map[ OPimEvent::FRecParent ].isEmpty() )
setParent( map[ OPimEvent::FRecParent ].toInt() );
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
@@ -10,48 +10,49 @@
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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 "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()
{}
/* use static_cast and type instead of dynamic... */
void OPimNotifyManager::add( const OPimNotify& noti )
{
if ( noti.type() == QString::fromLatin1( "OPimReminder" ) )
{
const OPimReminder & rem = static_cast<const OPimReminder&>( noti );
m_rem.append( rem );
}
@@ -142,108 +143,108 @@ void OPimNotifyManager::setReminders( const Reminders& rem )
* The idea is to check if the provider for our service
* is online
* if it is we will use QCOP
* if not the Factory to get the backend...
* Qtopia1.6 services would be kewl to have here....
*/
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;
for ( ; it != reminders.end(); ++it )
{
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() );
add( rem );
}
}
}
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
@@ -100,49 +100,49 @@ void OPimRecord::addCategoryName( const QString& )
{
Categories catDB;
catDB.load( categoryFileName() );
}
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;
}
OPimXRefManager &OPimRecord::xrefmanager()
{
return m_xrefman;
}
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
@@ -8,48 +8,51 @@
.> <`_, > . <= redistribute it and/or modify it under
:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
.="- .-=="i, .._ License as published by the Free Software
- . .-<_> .<> Foundation; either version 2 of the License,
._= =} : or (at your option) any later version.
.%`+i> _;_.
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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;
}
QDateTime utcTime( time_t t, const QString& zone )
{
QCString org = ::getenv( "TZ" );
#ifndef Q_OS_MACX // Following line causes bus errors on Mac
::setenv( "TZ", zone.latin1(), true );
::tzset();
@@ -128,49 +131,49 @@ QDateTime OPimTimeZone::toUTCDateTime( const QDateTime& dt )
{
return OPimTimeZone::utc().toDateTime( dt, *this );
}
QDateTime OPimTimeZone::fromUTCDateTime( time_t t )
{
return utcTime( 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" );
}
OPimTimeZone OPimTimeZone::current()
{
QCString str = ::getenv( "TZ" );
OPimTimeZone zone( str );
return zone;
}
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
@@ -14,48 +14,50 @@
.i_,=:_. -<s. This program is distributed in the hope that
+ . -:. = it will be useful, but WITHOUT ANY WARRANTY;
: .. .:, . . . 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 "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()
{
recur = 0;
state = 0;
maintainer = 0;
notifiers = 0;
};
~OPimTodoData()
{
@@ -64,97 +66,97 @@ struct OPimTodo::OPimTodoData : public QShared
delete notifiers;
}
QDate date;
bool isCompleted: 1;
bool hasDate: 1;
int priority;
QString desc;
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
{
if ( QString::number( data->priority ).find( regExp ) != -1 )
{
setLastHitField( Priority );
return true;
}
else if ( data->hasDate && data->date.toString().find( regExp ) != -1 )
{
setLastHitField( HasDate );
@@ -285,49 +287,49 @@ bool OPimTodo::hasMaintainer() const
OPimMaintainer OPimTodo::maintainer() const
{
if ( !data->maintainer ) return OPimMaintainer();
return ( *data->maintainer );
}
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;
}
void OPimTodo::setDueDate( const QDate& date )
{
changeOrModify();
data->date = date;
}
@@ -570,107 +572,107 @@ bool OPimTodo::operator>=( const OPimTodo &toDoEvent ) const
}
return true;
}
bool OPimTodo::operator==( const OPimTodo &toDoEvent ) const
{
if ( data->priority != toDoEvent.data->priority ) return false;
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 ) );
map.insert( Description, data->desc );
map.insert( Summary, data->sum );
map.insert( Priority, QString::number( data->priority ) );
map.insert( DateDay, QString::number( data->date.day() ) );
map.insert( DateMonth, QString::number( data->date.month() ) );
map.insert( DateYear, QString::number( data->date.year() ) );
map.insert( Progress, QString::number( data->prog ) );
// map.insert( CrossReference, crossToString() );
/* FIXME!!! map.insert( State, );
map.insert( Recurrence, );
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;
dest->isCompleted = src->isCompleted;
dest->hasDate = src->hasDate;
dest->priority = src->priority;
dest->desc = src->desc;
dest->sum = src->sum;
dest->extra = src->extra;
dest->prog = src->prog;
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
@@ -29,49 +29,49 @@
#include <qdatetime.h>
#include <qpe/alarmserver.h>
// #include "otodoaccesssql.h"
#include <opie2/otodoaccess.h>
#include <opie2/obackendfactory.h>
#include <opie2/opimresolver.h>
#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,
bool includeNoDates ) {
return effectiveToDos( start, QDate::currentDate(),
includeNoDates );
}
OPimTodoAccess::List OPimTodoAccess::overDue() {
List lis( m_todoBackEnd->overDue(), this );
return lis;
}