summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/orecordlist.h12
-rw-r--r--libopie/pim/otodo.cpp25
-rw-r--r--libopie/pim/otodoaccessxml.cpp2
-rw-r--r--libopie2/opiepim/backend/otodoaccessxml.cpp2
-rw-r--r--libopie2/opiepim/orecordlist.h12
-rw-r--r--libopie2/opiepim/otodo.cpp25
6 files changed, 42 insertions, 36 deletions
diff --git a/libopie/pim/orecordlist.h b/libopie/pim/orecordlist.h
index 75bb33c..36728b8 100644
--- a/libopie/pim/orecordlist.h
+++ b/libopie/pim/orecordlist.h
@@ -35,17 +35,17 @@ public:
ORecordListIterator( const ORecordListIterator& );
ORecordListIterator &operator=(const ORecordListIterator& );
/**
* a * operator ;)
* use it like this T = (*it);
*/
- T &operator*();
+ T operator*();
ORecordListIterator &operator++();
ORecordListIterator &operator--();
bool operator==( const ORecordListIterator& it );
bool operator!=( const ORecordListIterator& it );
private:
QArray<int> m_uids;
@@ -94,46 +94,47 @@ private:
};
/* ok now implement it */
template <class T>
ORecordListIterator<T>::ORecordListIterator() {
m_current = 0;
m_temp = 0l;
m_end = true;
+ m_record = T();
}
template <class T>
ORecordListIterator<T>::~ORecordListIterator() {
/* nothing to delete */
}
template <class T>
ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
- qWarning("ORecordListIterator");
+// qWarning("ORecordListIterator copy c'tor");
m_uids = it.m_uids;
m_current = it.m_current;
m_temp = it.m_temp;
m_end = it.m_end;
m_record = it.m_record;
}
template <class T>
ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) {
m_uids = it.m_uids;
m_current = it.m_current;
m_temp = it.m_temp;
m_end = it.m_end;
- m_record = it.m_record;
+// m_record = it.m_record;
return *this;
}
template <class T>
-T &ORecordListIterator<T>::operator*() {
- qWarning("operator* %d %d", m_current, m_uids[m_current] );
+T ORecordListIterator<T>::operator*() {
+// qWarning("operator* %d %d", m_current, m_uids[m_current] );
if (!m_end )
m_record = m_temp->find( m_uids[m_current] );
else
m_record = T();
return m_record;
}
@@ -188,17 +189,16 @@ ORecordList<T>::ORecordList( const QArray<int>& ids,
{
}
template <class T>
ORecordList<T>::~ORecordList() {
/* nothing to do here */
}
template <class T>
ORecordList<T>::Iterator ORecordList<T>::begin() {
- qWarning("ORecordList::begin");
Iterator it( m_ids, m_acc );
return it;
}
template <class T>
ORecordList<T>::Iterator ORecordList<T>::end() {
Iterator it( m_ids, m_acc );
it.m_end = true;
it.m_current = m_ids.count();
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index b3c14e6..cc46b21 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -31,35 +31,36 @@ struct OTodo::OTodoData : public QShared {
bool hasAlarmDateTime :1;
QDateTime alarmDateTime;
};
OTodo::OTodo(const OTodo &event )
: OPimRecord( event ), data( event.data )
{
data->ref();
- qWarning("ref up");
+// qWarning("ref up");
}
OTodo::~OTodo() {
- qWarning("~OTodo " + data->sum );
+
+// qWarning("~OTodo " );
if ( data->deref() ) {
- qWarning("OTodo::dereffing");
+// qWarning("OTodo::dereffing");
delete data;
data = 0l;
}
}
OTodo::OTodo(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("OTodoData " + summary);
+// qWarning("OTodoData " + summary);
setCategories( category );
data = new OTodoData;
data->date = date;
data->isCompleted = completed;
data->hasDate = hasDate;
data->priority = priority;
@@ -72,22 +73,22 @@ OTodo::OTodo(bool completed, int priority,
OTodo::OTodo(bool completed, int priority,
const QStringList &category,
const QString& summary,
const QString &description,
ushort progress,
bool hasDate, QDate date, int uid )
: OPimRecord( uid )
{
- qWarning("OTodoData" + summary);
+// qWarning("OTodoData" + summary);
setCategories( idsFromString( category.join(";") ) );
data = new OTodoData;
- data->date = date;
+ data->date = date;
data->isCompleted = completed;
data->hasDate = hasDate;
data->priority = priority;
data->sum = summary;
data->prog = progress;
data->desc = Qtopia::simplifyMultiLineSpace(description );
data->hasAlarmDateTime = false;
@@ -155,16 +156,17 @@ void OTodo::setHasDueDate( bool hasDate )
}
void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime )
{
changeOrModify();
data->hasAlarmDateTime = hasAlarmDateTime;
}
void OTodo::setDescription(const QString &desc )
{
+ qWarning( "desc " + desc );
changeOrModify();
data->desc = Qtopia::simplifyMultiLineSpace(desc );
}
void OTodo::setSummary( const QString& sum )
{
changeOrModify();
data->sum = sum;
}
@@ -302,29 +304,30 @@ bool OTodo::operator==(const OTodo &toDoEvent )const
return false;
if ( data->alarmDateTime != toDoEvent.data->alarmDateTime )
return false;
return OPimRecord::operator==( toDoEvent );
}
void OTodo::deref() {
- //qWarning("deref in ToDoEvent");
+// qWarning("deref in ToDoEvent");
if ( data->deref() ) {
- //qWarning("deleting");
+// qWarning("deleting");
delete data;
- d= 0;
+ data= 0;
}
}
OTodo &OTodo::operator=(const OTodo &item )
{
- OPimRecord::operator=( item );
+// OPimRecord::operator=( item );
//qWarning("operator= ref ");
item.data->ref();
deref();
+ data = item.data;
return *this;
}
QMap<int, QString> OTodo::toMap() const {
QMap<int, QString> map;
map.insert( Uid, QString::number( uid() ) );
@@ -350,17 +353,17 @@ QMap<QString, QString> OTodo::toExtraMap()const {
}
/**
* change or modify looks at the ref count and either
* creates a new QShared Object or it can modify it
* right in place
*/
void OTodo::changeOrModify() {
if ( data->count != 1 ) {
- qWarning("changeOrModify");
+// qWarning("changeOrModify");
data->deref();
OTodoData* d2 = new OTodoData();
copy(data, d2 );
data = d2;
}
}
void OTodo::copy( OTodoData* src, OTodoData* dest ) {
dest->date = src->date;
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp
index 21756c9..3a72881 100644
--- a/libopie/pim/otodoaccessxml.cpp
+++ b/libopie/pim/otodoaccessxml.cpp
@@ -63,24 +63,24 @@ bool OTodoAccessXML::load() {
continue;
}
/* here is the right element for a task */
OTodo ev = todo( &dict, element );
m_events.insert( ev.uid(), ev );
element = element->nextChild();
}
- return true;
}else {
qWarning("could not parse");
return false;;
}
delete root;
m_opened = true;
+ qWarning("Access %d" + m_events.count() );
return true;
}
bool OTodoAccessXML::reload() {
return load();
}
bool OTodoAccessXML::save() {
if (!m_opened || !m_changed )
return true;
diff --git a/libopie2/opiepim/backend/otodoaccessxml.cpp b/libopie2/opiepim/backend/otodoaccessxml.cpp
index 21756c9..3a72881 100644
--- a/libopie2/opiepim/backend/otodoaccessxml.cpp
+++ b/libopie2/opiepim/backend/otodoaccessxml.cpp
@@ -63,24 +63,24 @@ bool OTodoAccessXML::load() {
continue;
}
/* here is the right element for a task */
OTodo ev = todo( &dict, element );
m_events.insert( ev.uid(), ev );
element = element->nextChild();
}
- return true;
}else {
qWarning("could not parse");
return false;;
}
delete root;
m_opened = true;
+ qWarning("Access %d" + m_events.count() );
return true;
}
bool OTodoAccessXML::reload() {
return load();
}
bool OTodoAccessXML::save() {
if (!m_opened || !m_changed )
return true;
diff --git a/libopie2/opiepim/orecordlist.h b/libopie2/opiepim/orecordlist.h
index 75bb33c..36728b8 100644
--- a/libopie2/opiepim/orecordlist.h
+++ b/libopie2/opiepim/orecordlist.h
@@ -35,17 +35,17 @@ public:
ORecordListIterator( const ORecordListIterator& );
ORecordListIterator &operator=(const ORecordListIterator& );
/**
* a * operator ;)
* use it like this T = (*it);
*/
- T &operator*();
+ T operator*();
ORecordListIterator &operator++();
ORecordListIterator &operator--();
bool operator==( const ORecordListIterator& it );
bool operator!=( const ORecordListIterator& it );
private:
QArray<int> m_uids;
@@ -94,46 +94,47 @@ private:
};
/* ok now implement it */
template <class T>
ORecordListIterator<T>::ORecordListIterator() {
m_current = 0;
m_temp = 0l;
m_end = true;
+ m_record = T();
}
template <class T>
ORecordListIterator<T>::~ORecordListIterator() {
/* nothing to delete */
}
template <class T>
ORecordListIterator<T>::ORecordListIterator( const ORecordListIterator<T>& it) {
- qWarning("ORecordListIterator");
+// qWarning("ORecordListIterator copy c'tor");
m_uids = it.m_uids;
m_current = it.m_current;
m_temp = it.m_temp;
m_end = it.m_end;
m_record = it.m_record;
}
template <class T>
ORecordListIterator<T> &ORecordListIterator<T>::operator=( const ORecordListIterator<T>& it) {
m_uids = it.m_uids;
m_current = it.m_current;
m_temp = it.m_temp;
m_end = it.m_end;
- m_record = it.m_record;
+// m_record = it.m_record;
return *this;
}
template <class T>
-T &ORecordListIterator<T>::operator*() {
- qWarning("operator* %d %d", m_current, m_uids[m_current] );
+T ORecordListIterator<T>::operator*() {
+// qWarning("operator* %d %d", m_current, m_uids[m_current] );
if (!m_end )
m_record = m_temp->find( m_uids[m_current] );
else
m_record = T();
return m_record;
}
@@ -188,17 +189,16 @@ ORecordList<T>::ORecordList( const QArray<int>& ids,
{
}
template <class T>
ORecordList<T>::~ORecordList() {
/* nothing to do here */
}
template <class T>
ORecordList<T>::Iterator ORecordList<T>::begin() {
- qWarning("ORecordList::begin");
Iterator it( m_ids, m_acc );
return it;
}
template <class T>
ORecordList<T>::Iterator ORecordList<T>::end() {
Iterator it( m_ids, m_acc );
it.m_end = true;
it.m_current = m_ids.count();
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index b3c14e6..cc46b21 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -31,35 +31,36 @@ struct OTodo::OTodoData : public QShared {
bool hasAlarmDateTime :1;
QDateTime alarmDateTime;
};
OTodo::OTodo(const OTodo &event )
: OPimRecord( event ), data( event.data )
{
data->ref();
- qWarning("ref up");
+// qWarning("ref up");
}
OTodo::~OTodo() {
- qWarning("~OTodo " + data->sum );
+
+// qWarning("~OTodo " );
if ( data->deref() ) {
- qWarning("OTodo::dereffing");
+// qWarning("OTodo::dereffing");
delete data;
data = 0l;
}
}
OTodo::OTodo(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("OTodoData " + summary);
+// qWarning("OTodoData " + summary);
setCategories( category );
data = new OTodoData;
data->date = date;
data->isCompleted = completed;
data->hasDate = hasDate;
data->priority = priority;
@@ -72,22 +73,22 @@ OTodo::OTodo(bool completed, int priority,
OTodo::OTodo(bool completed, int priority,
const QStringList &category,
const QString& summary,
const QString &description,
ushort progress,
bool hasDate, QDate date, int uid )
: OPimRecord( uid )
{
- qWarning("OTodoData" + summary);
+// qWarning("OTodoData" + summary);
setCategories( idsFromString( category.join(";") ) );
data = new OTodoData;
- data->date = date;
+ data->date = date;
data->isCompleted = completed;
data->hasDate = hasDate;
data->priority = priority;
data->sum = summary;
data->prog = progress;
data->desc = Qtopia::simplifyMultiLineSpace(description );
data->hasAlarmDateTime = false;
@@ -155,16 +156,17 @@ void OTodo::setHasDueDate( bool hasDate )
}
void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime )
{
changeOrModify();
data->hasAlarmDateTime = hasAlarmDateTime;
}
void OTodo::setDescription(const QString &desc )
{
+ qWarning( "desc " + desc );
changeOrModify();
data->desc = Qtopia::simplifyMultiLineSpace(desc );
}
void OTodo::setSummary( const QString& sum )
{
changeOrModify();
data->sum = sum;
}
@@ -302,29 +304,30 @@ bool OTodo::operator==(const OTodo &toDoEvent )const
return false;
if ( data->alarmDateTime != toDoEvent.data->alarmDateTime )
return false;
return OPimRecord::operator==( toDoEvent );
}
void OTodo::deref() {
- //qWarning("deref in ToDoEvent");
+// qWarning("deref in ToDoEvent");
if ( data->deref() ) {
- //qWarning("deleting");
+// qWarning("deleting");
delete data;
- d= 0;
+ data= 0;
}
}
OTodo &OTodo::operator=(const OTodo &item )
{
- OPimRecord::operator=( item );
+// OPimRecord::operator=( item );
//qWarning("operator= ref ");
item.data->ref();
deref();
+ data = item.data;
return *this;
}
QMap<int, QString> OTodo::toMap() const {
QMap<int, QString> map;
map.insert( Uid, QString::number( uid() ) );
@@ -350,17 +353,17 @@ QMap<QString, QString> OTodo::toExtraMap()const {
}
/**
* change or modify looks at the ref count and either
* creates a new QShared Object or it can modify it
* right in place
*/
void OTodo::changeOrModify() {
if ( data->count != 1 ) {
- qWarning("changeOrModify");
+// qWarning("changeOrModify");
data->deref();
OTodoData* d2 = new OTodoData();
copy(data, d2 );
data = d2;
}
}
void OTodo::copy( OTodoData* src, OTodoData* dest ) {
dest->date = src->date;