summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp4
-rw-r--r--libopie/pim/opimrecord.cpp4
-rw-r--r--libopie/pim/opimrecord.h2
-rw-r--r--libopie/pim/otodo.cpp2
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp4
-rw-r--r--libopie2/opiepim/core/opimrecord.h2
-rw-r--r--libopie2/opiepim/ocontact.cpp4
-rw-r--r--libopie2/opiepim/otodo.cpp2
8 files changed, 12 insertions, 12 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index 178559b..9cccfc8 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -534,195 +534,195 @@ QString OContact::toRichText() const
534 text += QObject::tr( "<b>Home Address:</b>" ); 534 text += QObject::tr( "<b>Home Address:</b>" );
535 text += "<br>"; 535 text += "<br>";
536 } 536 }
537 537
538 if ( !(value = homeStreet()).isEmpty() ) 538 if ( !(value = homeStreet()).isEmpty() )
539 text += Qtopia::escapeString(value) + "<br>"; 539 text += Qtopia::escapeString(value) + "<br>";
540 state = homeState(); 540 state = homeState();
541 if ( !(value = homeZip()).isEmpty() ) 541 if ( !(value = homeZip()).isEmpty() )
542 text += Qtopia::escapeString(value) + " "; 542 text += Qtopia::escapeString(value) + " ";
543 if ( !(value = homeCity()).isEmpty() ) { 543 if ( !(value = homeCity()).isEmpty() ) {
544 text += Qtopia::escapeString(value); 544 text += Qtopia::escapeString(value);
545 if ( !state.isEmpty() ) 545 if ( !state.isEmpty() )
546 text += ", " + Qtopia::escapeString(state); 546 text += ", " + Qtopia::escapeString(state);
547 text += "<br>"; 547 text += "<br>";
548 } else if (!state.isEmpty()) 548 } else if (!state.isEmpty())
549 text += Qtopia::escapeString(state) + "<br>"; 549 text += Qtopia::escapeString(state) + "<br>";
550 if ( !(value = homeCountry()).isEmpty() ) 550 if ( !(value = homeCountry()).isEmpty() )
551 text += Qtopia::escapeString(value) + "<br>"; 551 text += Qtopia::escapeString(value) + "<br>";
552 552
553 // rest of Home data 553 // rest of Home data
554 str = homeWebpage(); 554 str = homeWebpage();
555 if ( !str.isEmpty() ){ 555 if ( !str.isEmpty() ){
556 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 556 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
557 + Qtopia::escapeString(str) + "<br>"; 557 + Qtopia::escapeString(str) + "<br>";
558 marker = true; 558 marker = true;
559 } 559 }
560 str = homePhone(); 560 str = homePhone();
561 if ( !str.isEmpty() ){ 561 if ( !str.isEmpty() ){
562 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 562 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
563 + Qtopia::escapeString(str) + "<br>"; 563 + Qtopia::escapeString(str) + "<br>";
564 marker = true; 564 marker = true;
565 } 565 }
566 str = homeFax(); 566 str = homeFax();
567 if ( !str.isEmpty() ){ 567 if ( !str.isEmpty() ){
568 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 568 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
569 + Qtopia::escapeString(str) + "<br>"; 569 + Qtopia::escapeString(str) + "<br>";
570 marker = true; 570 marker = true;
571 } 571 }
572 str = homeMobile(); 572 str = homeMobile();
573 if ( !str.isEmpty() ){ 573 if ( !str.isEmpty() ){
574 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 574 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
575 + Qtopia::escapeString(str) + "<br>"; 575 + Qtopia::escapeString(str) + "<br>";
576 marker = true; 576 marker = true;
577 } 577 }
578 578
579 if ( marker ) 579 if ( marker )
580 text += "<br><hr><br>"; 580 text += "<br><hr><br>";
581 // the others... 581 // the others...
582 str = emails(); 582 str = emails();
583 if ( !str.isEmpty() && ( str != defEmail ) ) 583 if ( !str.isEmpty() && ( str != defEmail ) )
584 text += "<b>" + QObject::tr("All Emails: ") + "</b>" 584 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
585 + Qtopia::escapeString(str) + "<br>"; 585 + Qtopia::escapeString(str) + "<br>";
586 str = profession(); 586 str = profession();
587 if ( !str.isEmpty() ) 587 if ( !str.isEmpty() )
588 text += "<b>" + QObject::tr("Profession: ") + "</b>" 588 text += "<b>" + QObject::tr("Profession: ") + "</b>"
589 + Qtopia::escapeString(str) + "<br>"; 589 + Qtopia::escapeString(str) + "<br>";
590 str = assistant(); 590 str = assistant();
591 if ( !str.isEmpty() ) 591 if ( !str.isEmpty() )
592 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 592 text += "<b>" + QObject::tr("Assistant: ") + "</b>"
593 + Qtopia::escapeString(str) + "<br>"; 593 + Qtopia::escapeString(str) + "<br>";
594 str = manager(); 594 str = manager();
595 if ( !str.isEmpty() ) 595 if ( !str.isEmpty() )
596 text += "<b>" + QObject::tr("Manager: ") + "</b>" 596 text += "<b>" + QObject::tr("Manager: ") + "</b>"
597 + Qtopia::escapeString(str) + "<br>"; 597 + Qtopia::escapeString(str) + "<br>";
598 str = gender(); 598 str = gender();
599 if ( !str.isEmpty() && str.toInt() != 0 ) { 599 if ( !str.isEmpty() && str.toInt() != 0 ) {
600 if ( str.toInt() == 1 ) 600 if ( str.toInt() == 1 )
601 str = QObject::tr( "Male" ); 601 str = QObject::tr( "Male" );
602 else if ( str.toInt() == 2 ) 602 else if ( str.toInt() == 2 )
603 str = QObject::tr( "Female" ); 603 str = QObject::tr( "Female" );
604 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 604 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
605 } 605 }
606 str = spouse(); 606 str = spouse();
607 if ( !str.isEmpty() ) 607 if ( !str.isEmpty() )
608 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 608 text += "<b>" + QObject::tr("Spouse: ") + "</b>"
609 + Qtopia::escapeString(str) + "<br>"; 609 + Qtopia::escapeString(str) + "<br>";
610 if ( birthday().isValid() ){ 610 if ( birthday().isValid() ){
611 str = TimeString::numberDateString( birthday() ); 611 str = TimeString::numberDateString( birthday() );
612 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 612 text += "<b>" + QObject::tr("Birthday: ") + "</b>"
613 + Qtopia::escapeString(str) + "<br>"; 613 + Qtopia::escapeString(str) + "<br>";
614 } 614 }
615 if ( anniversary().isValid() ){ 615 if ( anniversary().isValid() ){
616 str = TimeString::numberDateString( anniversary() ); 616 str = TimeString::numberDateString( anniversary() );
617 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 617 text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
618 + Qtopia::escapeString(str) + "<br>"; 618 + Qtopia::escapeString(str) + "<br>";
619 } 619 }
620 str = children(); 620 str = children();
621 if ( !str.isEmpty() ) 621 if ( !str.isEmpty() )
622 text += "<b>" + QObject::tr("Children: ") + "</b>" 622 text += "<b>" + QObject::tr("Children: ") + "</b>"
623 + Qtopia::escapeString(str) + "<br>"; 623 + Qtopia::escapeString(str) + "<br>";
624 624
625 str = nickname(); 625 str = nickname();
626 if ( !str.isEmpty() ) 626 if ( !str.isEmpty() )
627 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 627 text += "<b>" + QObject::tr("Nickname: ") + "</b>"
628 + Qtopia::escapeString(str) + "<br>"; 628 + Qtopia::escapeString(str) + "<br>";
629 629
630 if ( categoryNames().count() ){ 630 if ( categoryNames("Contacts").count() ){
631 text += "<b>" + QObject::tr( "Category:") + "</b> "; 631 text += "<b>" + QObject::tr( "Category:") + "</b> ";
632 text += categoryNames().join(", "); 632 text += categoryNames("Contacts").join(", ");
633 text += "<br>"; 633 text += "<br>";
634 } 634 }
635 635
636 // notes last 636 // notes last
637 if ( !(value = notes()).isEmpty() ) { 637 if ( !(value = notes()).isEmpty() ) {
638 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; 638 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
639 QRegExp reg("\n"); 639 QRegExp reg("\n");
640 640
641 //QString tmp = Qtopia::escapeString(value); 641 //QString tmp = Qtopia::escapeString(value);
642 QString tmp = QStyleSheet::convertFromPlainText(value); 642 QString tmp = QStyleSheet::convertFromPlainText(value);
643 //tmp.replace( reg, "<br>" ); 643 //tmp.replace( reg, "<br>" );
644 text += "<br>" + tmp + "<br>"; 644 text += "<br>" + tmp + "<br>";
645 } 645 }
646 return text; 646 return text;
647} 647}
648 648
649/*! 649/*!
650 \internal 650 \internal
651*/ 651*/
652void OContact::insert( int key, const QString &v ) 652void OContact::insert( int key, const QString &v )
653{ 653{
654 QString value = v.stripWhiteSpace(); 654 QString value = v.stripWhiteSpace();
655 if ( value.isEmpty() ) 655 if ( value.isEmpty() )
656 mMap.remove( key ); 656 mMap.remove( key );
657 else 657 else
658 mMap.insert( key, value ); 658 mMap.insert( key, value );
659} 659}
660 660
661/*! 661/*!
662 \internal 662 \internal
663*/ 663*/
664void OContact::replace( int key, const QString & v ) 664void OContact::replace( int key, const QString & v )
665{ 665{
666 QString value = v.stripWhiteSpace(); 666 QString value = v.stripWhiteSpace();
667 if ( value.isEmpty() ) 667 if ( value.isEmpty() )
668 mMap.remove( key ); 668 mMap.remove( key );
669 else 669 else
670 mMap.replace( key, value ); 670 mMap.replace( key, value );
671} 671}
672 672
673/*! 673/*!
674 \internal 674 \internal
675*/ 675*/
676QString OContact::find( int key ) const 676QString OContact::find( int key ) const
677{ 677{
678 return mMap[key]; 678 return mMap[key];
679} 679}
680 680
681/*! 681/*!
682 \internal 682 \internal
683*/ 683*/
684QString OContact::displayAddress( const QString &street, 684QString OContact::displayAddress( const QString &street,
685 const QString &city, 685 const QString &city,
686 const QString &state, 686 const QString &state,
687 const QString &zip, 687 const QString &zip,
688 const QString &country ) const 688 const QString &country ) const
689{ 689{
690 QString s = street; 690 QString s = street;
691 if ( !street.isEmpty() ) 691 if ( !street.isEmpty() )
692 s+= "\n"; 692 s+= "\n";
693 s += city; 693 s += city;
694 if ( !city.isEmpty() && !state.isEmpty() ) 694 if ( !city.isEmpty() && !state.isEmpty() )
695 s += ", "; 695 s += ", ";
696 s += state; 696 s += state;
697 if ( !state.isEmpty() && !zip.isEmpty() ) 697 if ( !state.isEmpty() && !zip.isEmpty() )
698 s += " "; 698 s += " ";
699 s += zip; 699 s += zip;
700 if ( !country.isEmpty() && !s.isEmpty() ) 700 if ( !country.isEmpty() && !s.isEmpty() )
701 s += "\n"; 701 s += "\n";
702 s += country; 702 s += country;
703 return s; 703 return s;
704} 704}
705 705
706/*! 706/*!
707 \internal 707 \internal
708*/ 708*/
709QString OContact::displayBusinessAddress() const 709QString OContact::displayBusinessAddress() const
710{ 710{
711 return displayAddress( businessStreet(), businessCity(), 711 return displayAddress( businessStreet(), businessCity(),
712 businessState(), businessZip(), 712 businessState(), businessZip(),
713 businessCountry() ); 713 businessCountry() );
714} 714}
715 715
716/*! 716/*!
717 \internal 717 \internal
718*/ 718*/
719QString OContact::displayHomeAddress() const 719QString OContact::displayHomeAddress() const
720{ 720{
721 return displayAddress( homeStreet(), homeCity(), 721 return displayAddress( homeStreet(), homeCity(),
722 homeState(), homeZip(), 722 homeState(), homeZip(),
723 homeCountry() ); 723 homeCountry() );
724} 724}
725 725
726/*! 726/*!
727 Returns the full name of the contact 727 Returns the full name of the contact
728*/ 728*/
diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp
index ac0f4a9..d45417a 100644
--- a/libopie/pim/opimrecord.cpp
+++ b/libopie/pim/opimrecord.cpp
@@ -1,136 +1,136 @@
1#include <qarray.h> 1#include <qarray.h>
2 2
3#include <qpe/categories.h> 3#include <qpe/categories.h>
4#include <qpe/categoryselect.h> 4#include <qpe/categoryselect.h>
5 5
6#include "opimrecord.h" 6#include "opimrecord.h"
7 7
8Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); 8Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
9 9
10 10
11OPimRecord::OPimRecord( int uid ) 11OPimRecord::OPimRecord( int uid )
12 : Qtopia::Record() { 12 : Qtopia::Record() {
13 13
14 setUid( uid ); 14 setUid( uid );
15} 15}
16OPimRecord::~OPimRecord() { 16OPimRecord::~OPimRecord() {
17} 17}
18OPimRecord::OPimRecord( const OPimRecord& rec ) 18OPimRecord::OPimRecord( const OPimRecord& rec )
19 : Qtopia::Record( rec ) 19 : Qtopia::Record( rec )
20{ 20{
21 (*this) = rec; 21 (*this) = rec;
22} 22}
23 23
24OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { 24OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
25 Qtopia::Record::operator=( rec ); 25 Qtopia::Record::operator=( rec );
26 m_xrefman = rec.m_xrefman; 26 m_xrefman = rec.m_xrefman;
27 27
28 return *this; 28 return *this;
29} 29}
30/* 30/*
31 * category names 31 * category names
32 */ 32 */
33QStringList OPimRecord::categoryNames()const { 33QStringList OPimRecord::categoryNames( const QString& appname ) const {
34 QStringList list; 34 QStringList list;
35 QArray<int> cats = categories(); 35 QArray<int> cats = categories();
36 Categories catDB; 36 Categories catDB;
37 catDB.load( categoryFileName() ); 37 catDB.load( categoryFileName() );
38 38
39 for (uint i = 0; i < cats.count(); i++ ) { 39 for (uint i = 0; i < cats.count(); i++ ) {
40 list << catDB.label("Todo List", cats[i] ); 40 list << catDB.label( appname, cats[i] );
41 } 41 }
42 42
43 return list; 43 return list;
44} 44}
45void OPimRecord::setCategoryNames( const QStringList& ) { 45void OPimRecord::setCategoryNames( const QStringList& ) {
46 46
47} 47}
48void OPimRecord::addCategoryName( const QString& ) { 48void OPimRecord::addCategoryName( const QString& ) {
49 Categories catDB; 49 Categories catDB;
50 catDB.load( categoryFileName() ); 50 catDB.load( categoryFileName() );
51 51
52 52
53} 53}
54bool OPimRecord::isEmpty()const { 54bool OPimRecord::isEmpty()const {
55 return ( uid() == 0 ); 55 return ( uid() == 0 );
56} 56}
57/*QString OPimRecord::crossToString()const { 57/*QString OPimRecord::crossToString()const {
58 QString str; 58 QString str;
59 QMap<QString, QArray<int> >::ConstIterator it; 59 QMap<QString, QArray<int> >::ConstIterator it;
60 for (it = m_relations.begin(); it != m_relations.end(); ++it ) { 60 for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
61 QArray<int> id = it.data(); 61 QArray<int> id = it.data();
62 for ( uint i = 0; i < id.size(); ++i ) { 62 for ( uint i = 0; i < id.size(); ++i ) {
63 str += it.key() + "," + QString::number( i ) + ";"; 63 str += it.key() + "," + QString::number( i ) + ";";
64 } 64 }
65 } 65 }
66 str = str.remove( str.length()-1, 1); // strip the ; 66 str = str.remove( str.length()-1, 1); // strip the ;
67 //qWarning("IDS " + str ); 67 //qWarning("IDS " + str );
68 68
69 return str; 69 return str;
70 }*/ 70 }*/
71/* if uid = 1 assign a new one */ 71/* if uid = 1 assign a new one */
72void OPimRecord::setUid( int uid ) { 72void OPimRecord::setUid( int uid ) {
73 if ( uid == 1) 73 if ( uid == 1)
74 uid = uidGen().generate(); 74 uid = uidGen().generate();
75 75
76 Qtopia::Record::setUid( uid ); 76 Qtopia::Record::setUid( uid );
77}; 77};
78Qtopia::UidGen &OPimRecord::uidGen() { 78Qtopia::UidGen &OPimRecord::uidGen() {
79 return m_uidGen; 79 return m_uidGen;
80} 80}
81OPimXRefManager &OPimRecord::xrefmanager() { 81OPimXRefManager &OPimRecord::xrefmanager() {
82 return m_xrefman; 82 return m_xrefman;
83} 83}
84int OPimRecord::rtti(){ 84int OPimRecord::rtti(){
85 return 0; 85 return 0;
86} 86}
87 87
88/** 88/**
89 * now let's put our data into the stream 89 * now let's put our data into the stream
90 */ 90 */
91/* 91/*
92 * First read UID 92 * First read UID
93 * Categories 93 * Categories
94 * XRef 94 * XRef
95 */ 95 */
96bool OPimRecord::loadFromStream( QDataStream& stream ) { 96bool OPimRecord::loadFromStream( QDataStream& stream ) {
97 int Int; 97 int Int;
98 uint UInt; 98 uint UInt;
99 stream >> Int; 99 stream >> Int;
100 setUid(Int); 100 setUid(Int);
101 101
102 /** Categories */ 102 /** Categories */
103 stream >> UInt; 103 stream >> UInt;
104 QArray<int> array(UInt); 104 QArray<int> array(UInt);
105 for (uint i = 0; i < UInt; i++ ) { 105 for (uint i = 0; i < UInt; i++ ) {
106 stream >> array[i]; 106 stream >> array[i];
107 } 107 }
108 setCategories( array ); 108 setCategories( array );
109 109
110 /* 110 /*
111 * now we do the X-Ref stuff 111 * now we do the X-Ref stuff
112 */ 112 */
113 OPimXRef xref; 113 OPimXRef xref;
114 stream >> UInt; 114 stream >> UInt;
115 for ( uint i = 0; i < UInt; i++ ) { 115 for ( uint i = 0; i < UInt; i++ ) {
116 xref.setPartner( OPimXRef::One, partner( stream ) ); 116 xref.setPartner( OPimXRef::One, partner( stream ) );
117 xref.setPartner( OPimXRef::Two, partner( stream ) ); 117 xref.setPartner( OPimXRef::Two, partner( stream ) );
118 m_xrefman.add( xref ); 118 m_xrefman.add( xref );
119 } 119 }
120 120
121 return true; 121 return true;
122} 122}
123bool OPimRecord::saveToStream( QDataStream& stream )const { 123bool OPimRecord::saveToStream( QDataStream& stream )const {
124 /** UIDs */ 124 /** UIDs */
125 125
126 stream << uid(); 126 stream << uid();
127 127
128 /** Categories */ 128 /** Categories */
129 stream << categories().count(); 129 stream << categories().count();
130 for ( uint i = 0; i < categories().count(); i++ ) { 130 for ( uint i = 0; i < categories().count(); i++ ) {
131 stream << categories()[i]; 131 stream << categories()[i];
132 } 132 }
133 133
134 /* 134 /*
135 * first the XRef count 135 * first the XRef count
136 * then the xrefs 136 * then the xrefs
diff --git a/libopie/pim/opimrecord.h b/libopie/pim/opimrecord.h
index 665530f..c7f9460 100644
--- a/libopie/pim/opimrecord.h
+++ b/libopie/pim/opimrecord.h
@@ -1,134 +1,134 @@
1#ifndef OPIE_PIM_RECORD_H 1#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 2#define OPIE_PIM_RECORD_H
3 3
4#include <qdatastream.h> 4#include <qdatastream.h>
5#include <qmap.h> 5#include <qmap.h>
6#include <qstring.h> 6#include <qstring.h>
7#include <qstringlist.h> 7#include <qstringlist.h>
8 8
9#include <qpe/palmtoprecord.h> 9#include <qpe/palmtoprecord.h>
10 10
11#include <opie/opimxrefmanager.h> 11#include <opie/opimxrefmanager.h>
12 12
13/** 13/**
14 * This is the base class for 14 * This is the base class for
15 * all PIM Records 15 * all PIM Records
16 * 16 *
17 */ 17 */
18class OPimRecord : public Qtopia::Record { 18class OPimRecord : public Qtopia::Record {
19public: 19public:
20 /** 20 /**
21 * c'tor 21 * c'tor
22 * uid of 0 isEmpty 22 * uid of 0 isEmpty
23 * uid of 1 will be assigned a new one 23 * uid of 1 will be assigned a new one
24 */ 24 */
25 OPimRecord(int uid = 0); 25 OPimRecord(int uid = 0);
26 ~OPimRecord(); 26 ~OPimRecord();
27 27
28 /** 28 /**
29 * copy c'tor 29 * copy c'tor
30 */ 30 */
31 OPimRecord( const OPimRecord& rec ); 31 OPimRecord( const OPimRecord& rec );
32 32
33 /** 33 /**
34 * copy operator 34 * copy operator
35 */ 35 */
36 OPimRecord &operator=( const OPimRecord& ); 36 OPimRecord &operator=( const OPimRecord& );
37 37
38 /** 38 /**
39 * category names resolved 39 * category names resolved
40 */ 40 */
41 QStringList categoryNames()const; 41 QStringList categoryNames( const QString& appname )const;
42 42
43 /** 43 /**
44 * set category names they will be resolved 44 * set category names they will be resolved
45 */ 45 */
46 void setCategoryNames( const QStringList& ); 46 void setCategoryNames( const QStringList& );
47 47
48 /** 48 /**
49 * addCategoryName adds a name 49 * addCategoryName adds a name
50 * to the internal category list 50 * to the internal category list
51 */ 51 */
52 void addCategoryName( const QString& ); 52 void addCategoryName( const QString& );
53 53
54 /** 54 /**
55 * if a Record isEmpty 55 * if a Record isEmpty
56 * it's empty if it's 0 56 * it's empty if it's 0
57 */ 57 */
58 virtual bool isEmpty()const; 58 virtual bool isEmpty()const;
59 59
60 /** 60 /**
61 * toRichText summary 61 * toRichText summary
62 */ 62 */
63 virtual QString toRichText()const = 0; 63 virtual QString toRichText()const = 0;
64 64
65 /** 65 /**
66 * a small one line summary 66 * a small one line summary
67 */ 67 */
68 virtual QString toShortText()const = 0; 68 virtual QString toShortText()const = 0;
69 69
70 /** 70 /**
71 * the name of the Record 71 * the name of the Record
72 */ 72 */
73 virtual QString type()const = 0; 73 virtual QString type()const = 0;
74 74
75 /** 75 /**
76 * converts the internal structure to a map 76 * converts the internal structure to a map
77 */ 77 */
78 virtual QMap<int, QString> toMap()const = 0; 78 virtual QMap<int, QString> toMap()const = 0;
79 79
80 /** 80 /**
81 * key value representation of extra items 81 * key value representation of extra items
82 */ 82 */
83 virtual QMap<QString, QString> toExtraMap()const = 0; 83 virtual QMap<QString, QString> toExtraMap()const = 0;
84 84
85 /** 85 /**
86 * the name for a recordField 86 * the name for a recordField
87 */ 87 */
88 virtual QString recordField(int)const = 0; 88 virtual QString recordField(int)const = 0;
89 89
90 /** 90 /**
91 * returns a reference of the 91 * returns a reference of the
92 * Cross Reference Manager 92 * Cross Reference Manager
93 * Partner 'One' is THIS PIM RECORD! 93 * Partner 'One' is THIS PIM RECORD!
94 * 'Two' is the Partner where we link to 94 * 'Two' is the Partner where we link to
95 */ 95 */
96 OPimXRefManager& xrefmanager(); 96 OPimXRefManager& xrefmanager();
97 97
98 /** 98 /**
99 * set the uid 99 * set the uid
100 */ 100 */
101 virtual void setUid( int uid ); 101 virtual void setUid( int uid );
102 102
103 /* 103 /*
104 * used inside the Templates for casting 104 * used inside the Templates for casting
105 * REIMPLEMENT in your .... 105 * REIMPLEMENT in your ....
106 */ 106 */
107 static int rtti(); 107 static int rtti();
108 108
109 /** 109 /**
110 * some marshalling and de marshalling code 110 * some marshalling and de marshalling code
111 * saves the OPimRecord 111 * saves the OPimRecord
112 * to and from a DataStream 112 * to and from a DataStream
113 */ 113 */
114 virtual bool loadFromStream(QDataStream& ); 114 virtual bool loadFromStream(QDataStream& );
115 virtual bool saveToStream( QDataStream& stream )const; 115 virtual bool saveToStream( QDataStream& stream )const;
116 116
117protected: 117protected:
118 Qtopia::UidGen &uidGen(); 118 Qtopia::UidGen &uidGen();
119// QString crossToString()const; 119// QString crossToString()const;
120 120
121private: 121private:
122 class OPimRecordPrivate; 122 class OPimRecordPrivate;
123 OPimRecordPrivate *d; 123 OPimRecordPrivate *d;
124 OPimXRefManager m_xrefman; 124 OPimXRefManager m_xrefman;
125 static Qtopia::UidGen m_uidGen; 125 static Qtopia::UidGen m_uidGen;
126 126
127private: 127private:
128 void flush( const OPimXRefPartner&, QDataStream& stream )const; 128 void flush( const OPimXRefPartner&, QDataStream& stream )const;
129 OPimXRefPartner partner( QDataStream& ); 129 OPimXRefPartner partner( QDataStream& );
130}; 130};
131 131
132 132
133 133
134#endif 134#endif
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index cde2b3d..b4d4aa9 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -162,193 +162,193 @@ OPimMaintainer OTodo::maintainer()const {
162} 162}
163void OTodo::setCompleted( bool completed ) 163void OTodo::setCompleted( bool completed )
164{ 164{
165 changeOrModify(); 165 changeOrModify();
166 data->isCompleted = completed; 166 data->isCompleted = completed;
167} 167}
168void OTodo::setHasDueDate( bool hasDate ) 168void OTodo::setHasDueDate( bool hasDate )
169{ 169{
170 changeOrModify(); 170 changeOrModify();
171 data->hasDate = hasDate; 171 data->hasDate = hasDate;
172} 172}
173void OTodo::setDescription(const QString &desc ) 173void OTodo::setDescription(const QString &desc )
174{ 174{
175// qWarning( "desc " + desc ); 175// qWarning( "desc " + desc );
176 changeOrModify(); 176 changeOrModify();
177 data->desc = Qtopia::simplifyMultiLineSpace(desc ); 177 data->desc = Qtopia::simplifyMultiLineSpace(desc );
178} 178}
179void OTodo::setSummary( const QString& sum ) 179void OTodo::setSummary( const QString& sum )
180{ 180{
181 changeOrModify(); 181 changeOrModify();
182 data->sum = sum; 182 data->sum = sum;
183} 183}
184void OTodo::setPriority(int prio ) 184void OTodo::setPriority(int prio )
185{ 185{
186 changeOrModify(); 186 changeOrModify();
187 data->priority = prio; 187 data->priority = prio;
188} 188}
189void OTodo::setDueDate( const QDate& date ) 189void OTodo::setDueDate( const QDate& date )
190{ 190{
191 changeOrModify(); 191 changeOrModify();
192 data->date = date; 192 data->date = date;
193} 193}
194void OTodo::setStartDate( const QDate& date ) { 194void OTodo::setStartDate( const QDate& date ) {
195 changeOrModify(); 195 changeOrModify();
196 data->start = date; 196 data->start = date;
197} 197}
198void OTodo::setCompletedDate( const QDate& date ) { 198void OTodo::setCompletedDate( const QDate& date ) {
199 changeOrModify(); 199 changeOrModify();
200 data->completed = date; 200 data->completed = date;
201} 201}
202void OTodo::setState( const OPimState& state ) { 202void OTodo::setState( const OPimState& state ) {
203 changeOrModify(); 203 changeOrModify();
204 data->state = state; 204 data->state = state;
205} 205}
206void OTodo::setRecurrence( const ORecur& rec) { 206void OTodo::setRecurrence( const ORecur& rec) {
207 changeOrModify(); 207 changeOrModify();
208 data->recur = rec; 208 data->recur = rec;
209} 209}
210void OTodo::setMaintainer( const OPimMaintainer& pim ) { 210void OTodo::setMaintainer( const OPimMaintainer& pim ) {
211 changeOrModify(); 211 changeOrModify();
212 data->maintainer = pim; 212 data->maintainer = pim;
213} 213}
214bool OTodo::isOverdue( ) 214bool OTodo::isOverdue( )
215{ 215{
216 if( data->hasDate && !data->isCompleted) 216 if( data->hasDate && !data->isCompleted)
217 return QDate::currentDate() > data->date; 217 return QDate::currentDate() > data->date;
218 return false; 218 return false;
219} 219}
220void OTodo::setProgress(ushort progress ) 220void OTodo::setProgress(ushort progress )
221{ 221{
222 changeOrModify(); 222 changeOrModify();
223 data->prog = progress; 223 data->prog = progress;
224} 224}
225QString OTodo::toShortText() const { 225QString OTodo::toShortText() const {
226 return summary(); 226 return summary();
227} 227}
228/*! 228/*!
229 Returns a richt text string 229 Returns a richt text string
230*/ 230*/
231QString OTodo::toRichText() const 231QString OTodo::toRichText() const
232{ 232{
233 QString text; 233 QString text;
234 QStringList catlist; 234 QStringList catlist;
235 235
236 // Description of the todo 236 // Description of the todo
237 if ( !summary().isEmpty() ) { 237 if ( !summary().isEmpty() ) {
238 text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; 238 text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
239 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 239 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
240 } 240 }
241 if( !description().isEmpty() ){ 241 if( !description().isEmpty() ){
242 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 242 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
244 } 244 }
245 text += "<br><br><br>"; 245 text += "<br><br><br>";
246 246
247 text += "<b>" + QObject::tr( "Priority:") +" </b>" 247 text += "<b>" + QObject::tr( "Priority:") +" </b>"
248 + QString::number( priority() ) + " <br>"; 248 + QString::number( priority() ) + " <br>";
249 text += "<b>" + QObject::tr( "Progress:") + " </b>" 249 text += "<b>" + QObject::tr( "Progress:") + " </b>"
250 + QString::number( progress() ) + " %<br>"; 250 + QString::number( progress() ) + " %<br>";
251 if (hasDueDate() ){ 251 if (hasDueDate() ){
252 text += "<b>" + QObject::tr( "Deadline:") + " </b>"; 252 text += "<b>" + QObject::tr( "Deadline:") + " </b>";
253 text += dueDate().toString(); 253 text += dueDate().toString();
254 text += "<br>"; 254 text += "<br>";
255 } 255 }
256 256
257 text += "<b>" + QObject::tr( "Category:") + "</b> "; 257 text += "<b>" + QObject::tr( "Category:") + "</b> ";
258 text += categoryNames().join(", "); 258 text += categoryNames( "Todo List" ).join(", ");
259 text += "<br>"; 259 text += "<br>";
260 260
261 return text; 261 return text;
262} 262}
263OPimNotifyManager& OTodo::notifiers() { 263OPimNotifyManager& OTodo::notifiers() {
264 return data->notifiers; 264 return data->notifiers;
265} 265}
266 266
267bool OTodo::operator<( const OTodo &toDoEvent )const{ 267bool OTodo::operator<( const OTodo &toDoEvent )const{
268 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 268 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
269 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 269 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
270 if( hasDueDate() && toDoEvent.hasDueDate() ){ 270 if( hasDueDate() && toDoEvent.hasDueDate() ){
271 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 271 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
272 return priority() < toDoEvent.priority(); 272 return priority() < toDoEvent.priority();
273 }else{ 273 }else{
274 return dueDate() < toDoEvent.dueDate(); 274 return dueDate() < toDoEvent.dueDate();
275 } 275 }
276 } 276 }
277 return false; 277 return false;
278} 278}
279bool OTodo::operator<=(const OTodo &toDoEvent )const 279bool OTodo::operator<=(const OTodo &toDoEvent )const
280{ 280{
281 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 281 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
282 if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; 282 if( !hasDueDate() && toDoEvent.hasDueDate() ) return true;
283 if( hasDueDate() && toDoEvent.hasDueDate() ){ 283 if( hasDueDate() && toDoEvent.hasDueDate() ){
284 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 284 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
285 return priority() <= toDoEvent.priority(); 285 return priority() <= toDoEvent.priority();
286 }else{ 286 }else{
287 return dueDate() <= toDoEvent.dueDate(); 287 return dueDate() <= toDoEvent.dueDate();
288 } 288 }
289 } 289 }
290 return true; 290 return true;
291} 291}
292bool OTodo::operator>(const OTodo &toDoEvent )const 292bool OTodo::operator>(const OTodo &toDoEvent )const
293{ 293{
294 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; 294 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false;
295 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 295 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
296 if( hasDueDate() && toDoEvent.hasDueDate() ){ 296 if( hasDueDate() && toDoEvent.hasDueDate() ){
297 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 297 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
298 return priority() > toDoEvent.priority(); 298 return priority() > toDoEvent.priority();
299 }else{ 299 }else{
300 return dueDate() > toDoEvent.dueDate(); 300 return dueDate() > toDoEvent.dueDate();
301 } 301 }
302 } 302 }
303 return false; 303 return false;
304} 304}
305bool OTodo::operator>=(const OTodo &toDoEvent )const 305bool OTodo::operator>=(const OTodo &toDoEvent )const
306{ 306{
307 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 307 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
308 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 308 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
309 if( hasDueDate() && toDoEvent.hasDueDate() ){ 309 if( hasDueDate() && toDoEvent.hasDueDate() ){
310 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 310 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
311 return priority() > toDoEvent.priority(); 311 return priority() > toDoEvent.priority();
312 }else{ 312 }else{
313 return dueDate() > toDoEvent.dueDate(); 313 return dueDate() > toDoEvent.dueDate();
314 } 314 }
315 } 315 }
316 return true; 316 return true;
317} 317}
318bool OTodo::operator==(const OTodo &toDoEvent )const 318bool OTodo::operator==(const OTodo &toDoEvent )const
319{ 319{
320 if ( data->priority != toDoEvent.data->priority ) return false; 320 if ( data->priority != toDoEvent.data->priority ) return false;
321 if ( data->priority != toDoEvent.data->prog ) return false; 321 if ( data->priority != toDoEvent.data->prog ) return false;
322 if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; 322 if ( data->isCompleted != toDoEvent.data->isCompleted ) return false;
323 if ( data->hasDate != toDoEvent.data->hasDate ) return false; 323 if ( data->hasDate != toDoEvent.data->hasDate ) return false;
324 if ( data->date != toDoEvent.data->date ) return false; 324 if ( data->date != toDoEvent.data->date ) return false;
325 if ( data->sum != toDoEvent.data->sum ) return false; 325 if ( data->sum != toDoEvent.data->sum ) return false;
326 if ( data->desc != toDoEvent.data->desc ) return false; 326 if ( data->desc != toDoEvent.data->desc ) return false;
327 if ( data->maintainer != toDoEvent.data->maintainer ) 327 if ( data->maintainer != toDoEvent.data->maintainer )
328 return false; 328 return false;
329 329
330 return OPimRecord::operator==( toDoEvent ); 330 return OPimRecord::operator==( toDoEvent );
331} 331}
332void OTodo::deref() { 332void OTodo::deref() {
333 333
334// qWarning("deref in ToDoEvent"); 334// qWarning("deref in ToDoEvent");
335 if ( data->deref() ) { 335 if ( data->deref() ) {
336// qWarning("deleting"); 336// qWarning("deleting");
337 delete data; 337 delete data;
338 data= 0; 338 data= 0;
339 } 339 }
340} 340}
341OTodo &OTodo::operator=(const OTodo &item ) 341OTodo &OTodo::operator=(const OTodo &item )
342{ 342{
343 OPimRecord::operator=( item ); 343 OPimRecord::operator=( item );
344 //qWarning("operator= ref "); 344 //qWarning("operator= ref ");
345 item.data->ref(); 345 item.data->ref();
346 deref(); 346 deref();
347 data = item.data; 347 data = item.data;
348 348
349 return *this; 349 return *this;
350} 350}
351 351
352QMap<int, QString> OTodo::toMap() const { 352QMap<int, QString> OTodo::toMap() const {
353 QMap<int, QString> map; 353 QMap<int, QString> map;
354 354
diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp
index ac0f4a9..d45417a 100644
--- a/libopie2/opiepim/core/opimrecord.cpp
+++ b/libopie2/opiepim/core/opimrecord.cpp
@@ -1,136 +1,136 @@
1#include <qarray.h> 1#include <qarray.h>
2 2
3#include <qpe/categories.h> 3#include <qpe/categories.h>
4#include <qpe/categoryselect.h> 4#include <qpe/categoryselect.h>
5 5
6#include "opimrecord.h" 6#include "opimrecord.h"
7 7
8Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia ); 8Qtopia::UidGen OPimRecord::m_uidGen( Qtopia::UidGen::Qtopia );
9 9
10 10
11OPimRecord::OPimRecord( int uid ) 11OPimRecord::OPimRecord( int uid )
12 : Qtopia::Record() { 12 : Qtopia::Record() {
13 13
14 setUid( uid ); 14 setUid( uid );
15} 15}
16OPimRecord::~OPimRecord() { 16OPimRecord::~OPimRecord() {
17} 17}
18OPimRecord::OPimRecord( const OPimRecord& rec ) 18OPimRecord::OPimRecord( const OPimRecord& rec )
19 : Qtopia::Record( rec ) 19 : Qtopia::Record( rec )
20{ 20{
21 (*this) = rec; 21 (*this) = rec;
22} 22}
23 23
24OPimRecord &OPimRecord::operator=( const OPimRecord& rec) { 24OPimRecord &OPimRecord::operator=( const OPimRecord& rec) {
25 Qtopia::Record::operator=( rec ); 25 Qtopia::Record::operator=( rec );
26 m_xrefman = rec.m_xrefman; 26 m_xrefman = rec.m_xrefman;
27 27
28 return *this; 28 return *this;
29} 29}
30/* 30/*
31 * category names 31 * category names
32 */ 32 */
33QStringList OPimRecord::categoryNames()const { 33QStringList OPimRecord::categoryNames( const QString& appname ) const {
34 QStringList list; 34 QStringList list;
35 QArray<int> cats = categories(); 35 QArray<int> cats = categories();
36 Categories catDB; 36 Categories catDB;
37 catDB.load( categoryFileName() ); 37 catDB.load( categoryFileName() );
38 38
39 for (uint i = 0; i < cats.count(); i++ ) { 39 for (uint i = 0; i < cats.count(); i++ ) {
40 list << catDB.label("Todo List", cats[i] ); 40 list << catDB.label( appname, cats[i] );
41 } 41 }
42 42
43 return list; 43 return list;
44} 44}
45void OPimRecord::setCategoryNames( const QStringList& ) { 45void OPimRecord::setCategoryNames( const QStringList& ) {
46 46
47} 47}
48void OPimRecord::addCategoryName( const QString& ) { 48void OPimRecord::addCategoryName( const QString& ) {
49 Categories catDB; 49 Categories catDB;
50 catDB.load( categoryFileName() ); 50 catDB.load( categoryFileName() );
51 51
52 52
53} 53}
54bool OPimRecord::isEmpty()const { 54bool OPimRecord::isEmpty()const {
55 return ( uid() == 0 ); 55 return ( uid() == 0 );
56} 56}
57/*QString OPimRecord::crossToString()const { 57/*QString OPimRecord::crossToString()const {
58 QString str; 58 QString str;
59 QMap<QString, QArray<int> >::ConstIterator it; 59 QMap<QString, QArray<int> >::ConstIterator it;
60 for (it = m_relations.begin(); it != m_relations.end(); ++it ) { 60 for (it = m_relations.begin(); it != m_relations.end(); ++it ) {
61 QArray<int> id = it.data(); 61 QArray<int> id = it.data();
62 for ( uint i = 0; i < id.size(); ++i ) { 62 for ( uint i = 0; i < id.size(); ++i ) {
63 str += it.key() + "," + QString::number( i ) + ";"; 63 str += it.key() + "," + QString::number( i ) + ";";
64 } 64 }
65 } 65 }
66 str = str.remove( str.length()-1, 1); // strip the ; 66 str = str.remove( str.length()-1, 1); // strip the ;
67 //qWarning("IDS " + str ); 67 //qWarning("IDS " + str );
68 68
69 return str; 69 return str;
70 }*/ 70 }*/
71/* if uid = 1 assign a new one */ 71/* if uid = 1 assign a new one */
72void OPimRecord::setUid( int uid ) { 72void OPimRecord::setUid( int uid ) {
73 if ( uid == 1) 73 if ( uid == 1)
74 uid = uidGen().generate(); 74 uid = uidGen().generate();
75 75
76 Qtopia::Record::setUid( uid ); 76 Qtopia::Record::setUid( uid );
77}; 77};
78Qtopia::UidGen &OPimRecord::uidGen() { 78Qtopia::UidGen &OPimRecord::uidGen() {
79 return m_uidGen; 79 return m_uidGen;
80} 80}
81OPimXRefManager &OPimRecord::xrefmanager() { 81OPimXRefManager &OPimRecord::xrefmanager() {
82 return m_xrefman; 82 return m_xrefman;
83} 83}
84int OPimRecord::rtti(){ 84int OPimRecord::rtti(){
85 return 0; 85 return 0;
86} 86}
87 87
88/** 88/**
89 * now let's put our data into the stream 89 * now let's put our data into the stream
90 */ 90 */
91/* 91/*
92 * First read UID 92 * First read UID
93 * Categories 93 * Categories
94 * XRef 94 * XRef
95 */ 95 */
96bool OPimRecord::loadFromStream( QDataStream& stream ) { 96bool OPimRecord::loadFromStream( QDataStream& stream ) {
97 int Int; 97 int Int;
98 uint UInt; 98 uint UInt;
99 stream >> Int; 99 stream >> Int;
100 setUid(Int); 100 setUid(Int);
101 101
102 /** Categories */ 102 /** Categories */
103 stream >> UInt; 103 stream >> UInt;
104 QArray<int> array(UInt); 104 QArray<int> array(UInt);
105 for (uint i = 0; i < UInt; i++ ) { 105 for (uint i = 0; i < UInt; i++ ) {
106 stream >> array[i]; 106 stream >> array[i];
107 } 107 }
108 setCategories( array ); 108 setCategories( array );
109 109
110 /* 110 /*
111 * now we do the X-Ref stuff 111 * now we do the X-Ref stuff
112 */ 112 */
113 OPimXRef xref; 113 OPimXRef xref;
114 stream >> UInt; 114 stream >> UInt;
115 for ( uint i = 0; i < UInt; i++ ) { 115 for ( uint i = 0; i < UInt; i++ ) {
116 xref.setPartner( OPimXRef::One, partner( stream ) ); 116 xref.setPartner( OPimXRef::One, partner( stream ) );
117 xref.setPartner( OPimXRef::Two, partner( stream ) ); 117 xref.setPartner( OPimXRef::Two, partner( stream ) );
118 m_xrefman.add( xref ); 118 m_xrefman.add( xref );
119 } 119 }
120 120
121 return true; 121 return true;
122} 122}
123bool OPimRecord::saveToStream( QDataStream& stream )const { 123bool OPimRecord::saveToStream( QDataStream& stream )const {
124 /** UIDs */ 124 /** UIDs */
125 125
126 stream << uid(); 126 stream << uid();
127 127
128 /** Categories */ 128 /** Categories */
129 stream << categories().count(); 129 stream << categories().count();
130 for ( uint i = 0; i < categories().count(); i++ ) { 130 for ( uint i = 0; i < categories().count(); i++ ) {
131 stream << categories()[i]; 131 stream << categories()[i];
132 } 132 }
133 133
134 /* 134 /*
135 * first the XRef count 135 * first the XRef count
136 * then the xrefs 136 * then the xrefs
diff --git a/libopie2/opiepim/core/opimrecord.h b/libopie2/opiepim/core/opimrecord.h
index 665530f..c7f9460 100644
--- a/libopie2/opiepim/core/opimrecord.h
+++ b/libopie2/opiepim/core/opimrecord.h
@@ -1,134 +1,134 @@
1#ifndef OPIE_PIM_RECORD_H 1#ifndef OPIE_PIM_RECORD_H
2#define OPIE_PIM_RECORD_H 2#define OPIE_PIM_RECORD_H
3 3
4#include <qdatastream.h> 4#include <qdatastream.h>
5#include <qmap.h> 5#include <qmap.h>
6#include <qstring.h> 6#include <qstring.h>
7#include <qstringlist.h> 7#include <qstringlist.h>
8 8
9#include <qpe/palmtoprecord.h> 9#include <qpe/palmtoprecord.h>
10 10
11#include <opie/opimxrefmanager.h> 11#include <opie/opimxrefmanager.h>
12 12
13/** 13/**
14 * This is the base class for 14 * This is the base class for
15 * all PIM Records 15 * all PIM Records
16 * 16 *
17 */ 17 */
18class OPimRecord : public Qtopia::Record { 18class OPimRecord : public Qtopia::Record {
19public: 19public:
20 /** 20 /**
21 * c'tor 21 * c'tor
22 * uid of 0 isEmpty 22 * uid of 0 isEmpty
23 * uid of 1 will be assigned a new one 23 * uid of 1 will be assigned a new one
24 */ 24 */
25 OPimRecord(int uid = 0); 25 OPimRecord(int uid = 0);
26 ~OPimRecord(); 26 ~OPimRecord();
27 27
28 /** 28 /**
29 * copy c'tor 29 * copy c'tor
30 */ 30 */
31 OPimRecord( const OPimRecord& rec ); 31 OPimRecord( const OPimRecord& rec );
32 32
33 /** 33 /**
34 * copy operator 34 * copy operator
35 */ 35 */
36 OPimRecord &operator=( const OPimRecord& ); 36 OPimRecord &operator=( const OPimRecord& );
37 37
38 /** 38 /**
39 * category names resolved 39 * category names resolved
40 */ 40 */
41 QStringList categoryNames()const; 41 QStringList categoryNames( const QString& appname )const;
42 42
43 /** 43 /**
44 * set category names they will be resolved 44 * set category names they will be resolved
45 */ 45 */
46 void setCategoryNames( const QStringList& ); 46 void setCategoryNames( const QStringList& );
47 47
48 /** 48 /**
49 * addCategoryName adds a name 49 * addCategoryName adds a name
50 * to the internal category list 50 * to the internal category list
51 */ 51 */
52 void addCategoryName( const QString& ); 52 void addCategoryName( const QString& );
53 53
54 /** 54 /**
55 * if a Record isEmpty 55 * if a Record isEmpty
56 * it's empty if it's 0 56 * it's empty if it's 0
57 */ 57 */
58 virtual bool isEmpty()const; 58 virtual bool isEmpty()const;
59 59
60 /** 60 /**
61 * toRichText summary 61 * toRichText summary
62 */ 62 */
63 virtual QString toRichText()const = 0; 63 virtual QString toRichText()const = 0;
64 64
65 /** 65 /**
66 * a small one line summary 66 * a small one line summary
67 */ 67 */
68 virtual QString toShortText()const = 0; 68 virtual QString toShortText()const = 0;
69 69
70 /** 70 /**
71 * the name of the Record 71 * the name of the Record
72 */ 72 */
73 virtual QString type()const = 0; 73 virtual QString type()const = 0;
74 74
75 /** 75 /**
76 * converts the internal structure to a map 76 * converts the internal structure to a map
77 */ 77 */
78 virtual QMap<int, QString> toMap()const = 0; 78 virtual QMap<int, QString> toMap()const = 0;
79 79
80 /** 80 /**
81 * key value representation of extra items 81 * key value representation of extra items
82 */ 82 */
83 virtual QMap<QString, QString> toExtraMap()const = 0; 83 virtual QMap<QString, QString> toExtraMap()const = 0;
84 84
85 /** 85 /**
86 * the name for a recordField 86 * the name for a recordField
87 */ 87 */
88 virtual QString recordField(int)const = 0; 88 virtual QString recordField(int)const = 0;
89 89
90 /** 90 /**
91 * returns a reference of the 91 * returns a reference of the
92 * Cross Reference Manager 92 * Cross Reference Manager
93 * Partner 'One' is THIS PIM RECORD! 93 * Partner 'One' is THIS PIM RECORD!
94 * 'Two' is the Partner where we link to 94 * 'Two' is the Partner where we link to
95 */ 95 */
96 OPimXRefManager& xrefmanager(); 96 OPimXRefManager& xrefmanager();
97 97
98 /** 98 /**
99 * set the uid 99 * set the uid
100 */ 100 */
101 virtual void setUid( int uid ); 101 virtual void setUid( int uid );
102 102
103 /* 103 /*
104 * used inside the Templates for casting 104 * used inside the Templates for casting
105 * REIMPLEMENT in your .... 105 * REIMPLEMENT in your ....
106 */ 106 */
107 static int rtti(); 107 static int rtti();
108 108
109 /** 109 /**
110 * some marshalling and de marshalling code 110 * some marshalling and de marshalling code
111 * saves the OPimRecord 111 * saves the OPimRecord
112 * to and from a DataStream 112 * to and from a DataStream
113 */ 113 */
114 virtual bool loadFromStream(QDataStream& ); 114 virtual bool loadFromStream(QDataStream& );
115 virtual bool saveToStream( QDataStream& stream )const; 115 virtual bool saveToStream( QDataStream& stream )const;
116 116
117protected: 117protected:
118 Qtopia::UidGen &uidGen(); 118 Qtopia::UidGen &uidGen();
119// QString crossToString()const; 119// QString crossToString()const;
120 120
121private: 121private:
122 class OPimRecordPrivate; 122 class OPimRecordPrivate;
123 OPimRecordPrivate *d; 123 OPimRecordPrivate *d;
124 OPimXRefManager m_xrefman; 124 OPimXRefManager m_xrefman;
125 static Qtopia::UidGen m_uidGen; 125 static Qtopia::UidGen m_uidGen;
126 126
127private: 127private:
128 void flush( const OPimXRefPartner&, QDataStream& stream )const; 128 void flush( const OPimXRefPartner&, QDataStream& stream )const;
129 OPimXRefPartner partner( QDataStream& ); 129 OPimXRefPartner partner( QDataStream& );
130}; 130};
131 131
132 132
133 133
134#endif 134#endif
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index 178559b..9cccfc8 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -534,195 +534,195 @@ QString OContact::toRichText() const
534 text += QObject::tr( "<b>Home Address:</b>" ); 534 text += QObject::tr( "<b>Home Address:</b>" );
535 text += "<br>"; 535 text += "<br>";
536 } 536 }
537 537
538 if ( !(value = homeStreet()).isEmpty() ) 538 if ( !(value = homeStreet()).isEmpty() )
539 text += Qtopia::escapeString(value) + "<br>"; 539 text += Qtopia::escapeString(value) + "<br>";
540 state = homeState(); 540 state = homeState();
541 if ( !(value = homeZip()).isEmpty() ) 541 if ( !(value = homeZip()).isEmpty() )
542 text += Qtopia::escapeString(value) + " "; 542 text += Qtopia::escapeString(value) + " ";
543 if ( !(value = homeCity()).isEmpty() ) { 543 if ( !(value = homeCity()).isEmpty() ) {
544 text += Qtopia::escapeString(value); 544 text += Qtopia::escapeString(value);
545 if ( !state.isEmpty() ) 545 if ( !state.isEmpty() )
546 text += ", " + Qtopia::escapeString(state); 546 text += ", " + Qtopia::escapeString(state);
547 text += "<br>"; 547 text += "<br>";
548 } else if (!state.isEmpty()) 548 } else if (!state.isEmpty())
549 text += Qtopia::escapeString(state) + "<br>"; 549 text += Qtopia::escapeString(state) + "<br>";
550 if ( !(value = homeCountry()).isEmpty() ) 550 if ( !(value = homeCountry()).isEmpty() )
551 text += Qtopia::escapeString(value) + "<br>"; 551 text += Qtopia::escapeString(value) + "<br>";
552 552
553 // rest of Home data 553 // rest of Home data
554 str = homeWebpage(); 554 str = homeWebpage();
555 if ( !str.isEmpty() ){ 555 if ( !str.isEmpty() ){
556 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 556 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
557 + Qtopia::escapeString(str) + "<br>"; 557 + Qtopia::escapeString(str) + "<br>";
558 marker = true; 558 marker = true;
559 } 559 }
560 str = homePhone(); 560 str = homePhone();
561 if ( !str.isEmpty() ){ 561 if ( !str.isEmpty() ){
562 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 562 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
563 + Qtopia::escapeString(str) + "<br>"; 563 + Qtopia::escapeString(str) + "<br>";
564 marker = true; 564 marker = true;
565 } 565 }
566 str = homeFax(); 566 str = homeFax();
567 if ( !str.isEmpty() ){ 567 if ( !str.isEmpty() ){
568 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 568 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
569 + Qtopia::escapeString(str) + "<br>"; 569 + Qtopia::escapeString(str) + "<br>";
570 marker = true; 570 marker = true;
571 } 571 }
572 str = homeMobile(); 572 str = homeMobile();
573 if ( !str.isEmpty() ){ 573 if ( !str.isEmpty() ){
574 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 574 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
575 + Qtopia::escapeString(str) + "<br>"; 575 + Qtopia::escapeString(str) + "<br>";
576 marker = true; 576 marker = true;
577 } 577 }
578 578
579 if ( marker ) 579 if ( marker )
580 text += "<br><hr><br>"; 580 text += "<br><hr><br>";
581 // the others... 581 // the others...
582 str = emails(); 582 str = emails();
583 if ( !str.isEmpty() && ( str != defEmail ) ) 583 if ( !str.isEmpty() && ( str != defEmail ) )
584 text += "<b>" + QObject::tr("All Emails: ") + "</b>" 584 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
585 + Qtopia::escapeString(str) + "<br>"; 585 + Qtopia::escapeString(str) + "<br>";
586 str = profession(); 586 str = profession();
587 if ( !str.isEmpty() ) 587 if ( !str.isEmpty() )
588 text += "<b>" + QObject::tr("Profession: ") + "</b>" 588 text += "<b>" + QObject::tr("Profession: ") + "</b>"
589 + Qtopia::escapeString(str) + "<br>"; 589 + Qtopia::escapeString(str) + "<br>";
590 str = assistant(); 590 str = assistant();
591 if ( !str.isEmpty() ) 591 if ( !str.isEmpty() )
592 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 592 text += "<b>" + QObject::tr("Assistant: ") + "</b>"
593 + Qtopia::escapeString(str) + "<br>"; 593 + Qtopia::escapeString(str) + "<br>";
594 str = manager(); 594 str = manager();
595 if ( !str.isEmpty() ) 595 if ( !str.isEmpty() )
596 text += "<b>" + QObject::tr("Manager: ") + "</b>" 596 text += "<b>" + QObject::tr("Manager: ") + "</b>"
597 + Qtopia::escapeString(str) + "<br>"; 597 + Qtopia::escapeString(str) + "<br>";
598 str = gender(); 598 str = gender();
599 if ( !str.isEmpty() && str.toInt() != 0 ) { 599 if ( !str.isEmpty() && str.toInt() != 0 ) {
600 if ( str.toInt() == 1 ) 600 if ( str.toInt() == 1 )
601 str = QObject::tr( "Male" ); 601 str = QObject::tr( "Male" );
602 else if ( str.toInt() == 2 ) 602 else if ( str.toInt() == 2 )
603 str = QObject::tr( "Female" ); 603 str = QObject::tr( "Female" );
604 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 604 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
605 } 605 }
606 str = spouse(); 606 str = spouse();
607 if ( !str.isEmpty() ) 607 if ( !str.isEmpty() )
608 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 608 text += "<b>" + QObject::tr("Spouse: ") + "</b>"
609 + Qtopia::escapeString(str) + "<br>"; 609 + Qtopia::escapeString(str) + "<br>";
610 if ( birthday().isValid() ){ 610 if ( birthday().isValid() ){
611 str = TimeString::numberDateString( birthday() ); 611 str = TimeString::numberDateString( birthday() );
612 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 612 text += "<b>" + QObject::tr("Birthday: ") + "</b>"
613 + Qtopia::escapeString(str) + "<br>"; 613 + Qtopia::escapeString(str) + "<br>";
614 } 614 }
615 if ( anniversary().isValid() ){ 615 if ( anniversary().isValid() ){
616 str = TimeString::numberDateString( anniversary() ); 616 str = TimeString::numberDateString( anniversary() );
617 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 617 text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
618 + Qtopia::escapeString(str) + "<br>"; 618 + Qtopia::escapeString(str) + "<br>";
619 } 619 }
620 str = children(); 620 str = children();
621 if ( !str.isEmpty() ) 621 if ( !str.isEmpty() )
622 text += "<b>" + QObject::tr("Children: ") + "</b>" 622 text += "<b>" + QObject::tr("Children: ") + "</b>"
623 + Qtopia::escapeString(str) + "<br>"; 623 + Qtopia::escapeString(str) + "<br>";
624 624
625 str = nickname(); 625 str = nickname();
626 if ( !str.isEmpty() ) 626 if ( !str.isEmpty() )
627 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 627 text += "<b>" + QObject::tr("Nickname: ") + "</b>"
628 + Qtopia::escapeString(str) + "<br>"; 628 + Qtopia::escapeString(str) + "<br>";
629 629
630 if ( categoryNames().count() ){ 630 if ( categoryNames("Contacts").count() ){
631 text += "<b>" + QObject::tr( "Category:") + "</b> "; 631 text += "<b>" + QObject::tr( "Category:") + "</b> ";
632 text += categoryNames().join(", "); 632 text += categoryNames("Contacts").join(", ");
633 text += "<br>"; 633 text += "<br>";
634 } 634 }
635 635
636 // notes last 636 // notes last
637 if ( !(value = notes()).isEmpty() ) { 637 if ( !(value = notes()).isEmpty() ) {
638 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; 638 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
639 QRegExp reg("\n"); 639 QRegExp reg("\n");
640 640
641 //QString tmp = Qtopia::escapeString(value); 641 //QString tmp = Qtopia::escapeString(value);
642 QString tmp = QStyleSheet::convertFromPlainText(value); 642 QString tmp = QStyleSheet::convertFromPlainText(value);
643 //tmp.replace( reg, "<br>" ); 643 //tmp.replace( reg, "<br>" );
644 text += "<br>" + tmp + "<br>"; 644 text += "<br>" + tmp + "<br>";
645 } 645 }
646 return text; 646 return text;
647} 647}
648 648
649/*! 649/*!
650 \internal 650 \internal
651*/ 651*/
652void OContact::insert( int key, const QString &v ) 652void OContact::insert( int key, const QString &v )
653{ 653{
654 QString value = v.stripWhiteSpace(); 654 QString value = v.stripWhiteSpace();
655 if ( value.isEmpty() ) 655 if ( value.isEmpty() )
656 mMap.remove( key ); 656 mMap.remove( key );
657 else 657 else
658 mMap.insert( key, value ); 658 mMap.insert( key, value );
659} 659}
660 660
661/*! 661/*!
662 \internal 662 \internal
663*/ 663*/
664void OContact::replace( int key, const QString & v ) 664void OContact::replace( int key, const QString & v )
665{ 665{
666 QString value = v.stripWhiteSpace(); 666 QString value = v.stripWhiteSpace();
667 if ( value.isEmpty() ) 667 if ( value.isEmpty() )
668 mMap.remove( key ); 668 mMap.remove( key );
669 else 669 else
670 mMap.replace( key, value ); 670 mMap.replace( key, value );
671} 671}
672 672
673/*! 673/*!
674 \internal 674 \internal
675*/ 675*/
676QString OContact::find( int key ) const 676QString OContact::find( int key ) const
677{ 677{
678 return mMap[key]; 678 return mMap[key];
679} 679}
680 680
681/*! 681/*!
682 \internal 682 \internal
683*/ 683*/
684QString OContact::displayAddress( const QString &street, 684QString OContact::displayAddress( const QString &street,
685 const QString &city, 685 const QString &city,
686 const QString &state, 686 const QString &state,
687 const QString &zip, 687 const QString &zip,
688 const QString &country ) const 688 const QString &country ) const
689{ 689{
690 QString s = street; 690 QString s = street;
691 if ( !street.isEmpty() ) 691 if ( !street.isEmpty() )
692 s+= "\n"; 692 s+= "\n";
693 s += city; 693 s += city;
694 if ( !city.isEmpty() && !state.isEmpty() ) 694 if ( !city.isEmpty() && !state.isEmpty() )
695 s += ", "; 695 s += ", ";
696 s += state; 696 s += state;
697 if ( !state.isEmpty() && !zip.isEmpty() ) 697 if ( !state.isEmpty() && !zip.isEmpty() )
698 s += " "; 698 s += " ";
699 s += zip; 699 s += zip;
700 if ( !country.isEmpty() && !s.isEmpty() ) 700 if ( !country.isEmpty() && !s.isEmpty() )
701 s += "\n"; 701 s += "\n";
702 s += country; 702 s += country;
703 return s; 703 return s;
704} 704}
705 705
706/*! 706/*!
707 \internal 707 \internal
708*/ 708*/
709QString OContact::displayBusinessAddress() const 709QString OContact::displayBusinessAddress() const
710{ 710{
711 return displayAddress( businessStreet(), businessCity(), 711 return displayAddress( businessStreet(), businessCity(),
712 businessState(), businessZip(), 712 businessState(), businessZip(),
713 businessCountry() ); 713 businessCountry() );
714} 714}
715 715
716/*! 716/*!
717 \internal 717 \internal
718*/ 718*/
719QString OContact::displayHomeAddress() const 719QString OContact::displayHomeAddress() const
720{ 720{
721 return displayAddress( homeStreet(), homeCity(), 721 return displayAddress( homeStreet(), homeCity(),
722 homeState(), homeZip(), 722 homeState(), homeZip(),
723 homeCountry() ); 723 homeCountry() );
724} 724}
725 725
726/*! 726/*!
727 Returns the full name of the contact 727 Returns the full name of the contact
728*/ 728*/
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index cde2b3d..b4d4aa9 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -162,193 +162,193 @@ OPimMaintainer OTodo::maintainer()const {
162} 162}
163void OTodo::setCompleted( bool completed ) 163void OTodo::setCompleted( bool completed )
164{ 164{
165 changeOrModify(); 165 changeOrModify();
166 data->isCompleted = completed; 166 data->isCompleted = completed;
167} 167}
168void OTodo::setHasDueDate( bool hasDate ) 168void OTodo::setHasDueDate( bool hasDate )
169{ 169{
170 changeOrModify(); 170 changeOrModify();
171 data->hasDate = hasDate; 171 data->hasDate = hasDate;
172} 172}
173void OTodo::setDescription(const QString &desc ) 173void OTodo::setDescription(const QString &desc )
174{ 174{
175// qWarning( "desc " + desc ); 175// qWarning( "desc " + desc );
176 changeOrModify(); 176 changeOrModify();
177 data->desc = Qtopia::simplifyMultiLineSpace(desc ); 177 data->desc = Qtopia::simplifyMultiLineSpace(desc );
178} 178}
179void OTodo::setSummary( const QString& sum ) 179void OTodo::setSummary( const QString& sum )
180{ 180{
181 changeOrModify(); 181 changeOrModify();
182 data->sum = sum; 182 data->sum = sum;
183} 183}
184void OTodo::setPriority(int prio ) 184void OTodo::setPriority(int prio )
185{ 185{
186 changeOrModify(); 186 changeOrModify();
187 data->priority = prio; 187 data->priority = prio;
188} 188}
189void OTodo::setDueDate( const QDate& date ) 189void OTodo::setDueDate( const QDate& date )
190{ 190{
191 changeOrModify(); 191 changeOrModify();
192 data->date = date; 192 data->date = date;
193} 193}
194void OTodo::setStartDate( const QDate& date ) { 194void OTodo::setStartDate( const QDate& date ) {
195 changeOrModify(); 195 changeOrModify();
196 data->start = date; 196 data->start = date;
197} 197}
198void OTodo::setCompletedDate( const QDate& date ) { 198void OTodo::setCompletedDate( const QDate& date ) {
199 changeOrModify(); 199 changeOrModify();
200 data->completed = date; 200 data->completed = date;
201} 201}
202void OTodo::setState( const OPimState& state ) { 202void OTodo::setState( const OPimState& state ) {
203 changeOrModify(); 203 changeOrModify();
204 data->state = state; 204 data->state = state;
205} 205}
206void OTodo::setRecurrence( const ORecur& rec) { 206void OTodo::setRecurrence( const ORecur& rec) {
207 changeOrModify(); 207 changeOrModify();
208 data->recur = rec; 208 data->recur = rec;
209} 209}
210void OTodo::setMaintainer( const OPimMaintainer& pim ) { 210void OTodo::setMaintainer( const OPimMaintainer& pim ) {
211 changeOrModify(); 211 changeOrModify();
212 data->maintainer = pim; 212 data->maintainer = pim;
213} 213}
214bool OTodo::isOverdue( ) 214bool OTodo::isOverdue( )
215{ 215{
216 if( data->hasDate && !data->isCompleted) 216 if( data->hasDate && !data->isCompleted)
217 return QDate::currentDate() > data->date; 217 return QDate::currentDate() > data->date;
218 return false; 218 return false;
219} 219}
220void OTodo::setProgress(ushort progress ) 220void OTodo::setProgress(ushort progress )
221{ 221{
222 changeOrModify(); 222 changeOrModify();
223 data->prog = progress; 223 data->prog = progress;
224} 224}
225QString OTodo::toShortText() const { 225QString OTodo::toShortText() const {
226 return summary(); 226 return summary();
227} 227}
228/*! 228/*!
229 Returns a richt text string 229 Returns a richt text string
230*/ 230*/
231QString OTodo::toRichText() const 231QString OTodo::toRichText() const
232{ 232{
233 QString text; 233 QString text;
234 QStringList catlist; 234 QStringList catlist;
235 235
236 // Description of the todo 236 // Description of the todo
237 if ( !summary().isEmpty() ) { 237 if ( !summary().isEmpty() ) {
238 text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; 238 text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
239 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; 239 text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
240 } 240 }
241 if( !description().isEmpty() ){ 241 if( !description().isEmpty() ){
242 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; 242 text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; 243 text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
244 } 244 }
245 text += "<br><br><br>"; 245 text += "<br><br><br>";
246 246
247 text += "<b>" + QObject::tr( "Priority:") +" </b>" 247 text += "<b>" + QObject::tr( "Priority:") +" </b>"
248 + QString::number( priority() ) + " <br>"; 248 + QString::number( priority() ) + " <br>";
249 text += "<b>" + QObject::tr( "Progress:") + " </b>" 249 text += "<b>" + QObject::tr( "Progress:") + " </b>"
250 + QString::number( progress() ) + " %<br>"; 250 + QString::number( progress() ) + " %<br>";
251 if (hasDueDate() ){ 251 if (hasDueDate() ){
252 text += "<b>" + QObject::tr( "Deadline:") + " </b>"; 252 text += "<b>" + QObject::tr( "Deadline:") + " </b>";
253 text += dueDate().toString(); 253 text += dueDate().toString();
254 text += "<br>"; 254 text += "<br>";
255 } 255 }
256 256
257 text += "<b>" + QObject::tr( "Category:") + "</b> "; 257 text += "<b>" + QObject::tr( "Category:") + "</b> ";
258 text += categoryNames().join(", "); 258 text += categoryNames( "Todo List" ).join(", ");
259 text += "<br>"; 259 text += "<br>";
260 260
261 return text; 261 return text;
262} 262}
263OPimNotifyManager& OTodo::notifiers() { 263OPimNotifyManager& OTodo::notifiers() {
264 return data->notifiers; 264 return data->notifiers;
265} 265}
266 266
267bool OTodo::operator<( const OTodo &toDoEvent )const{ 267bool OTodo::operator<( const OTodo &toDoEvent )const{
268 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 268 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
269 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 269 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
270 if( hasDueDate() && toDoEvent.hasDueDate() ){ 270 if( hasDueDate() && toDoEvent.hasDueDate() ){
271 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 271 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
272 return priority() < toDoEvent.priority(); 272 return priority() < toDoEvent.priority();
273 }else{ 273 }else{
274 return dueDate() < toDoEvent.dueDate(); 274 return dueDate() < toDoEvent.dueDate();
275 } 275 }
276 } 276 }
277 return false; 277 return false;
278} 278}
279bool OTodo::operator<=(const OTodo &toDoEvent )const 279bool OTodo::operator<=(const OTodo &toDoEvent )const
280{ 280{
281 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 281 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
282 if( !hasDueDate() && toDoEvent.hasDueDate() ) return true; 282 if( !hasDueDate() && toDoEvent.hasDueDate() ) return true;
283 if( hasDueDate() && toDoEvent.hasDueDate() ){ 283 if( hasDueDate() && toDoEvent.hasDueDate() ){
284 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 284 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
285 return priority() <= toDoEvent.priority(); 285 return priority() <= toDoEvent.priority();
286 }else{ 286 }else{
287 return dueDate() <= toDoEvent.dueDate(); 287 return dueDate() <= toDoEvent.dueDate();
288 } 288 }
289 } 289 }
290 return true; 290 return true;
291} 291}
292bool OTodo::operator>(const OTodo &toDoEvent )const 292bool OTodo::operator>(const OTodo &toDoEvent )const
293{ 293{
294 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false; 294 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return false;
295 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 295 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
296 if( hasDueDate() && toDoEvent.hasDueDate() ){ 296 if( hasDueDate() && toDoEvent.hasDueDate() ){
297 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 297 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
298 return priority() > toDoEvent.priority(); 298 return priority() > toDoEvent.priority();
299 }else{ 299 }else{
300 return dueDate() > toDoEvent.dueDate(); 300 return dueDate() > toDoEvent.dueDate();
301 } 301 }
302 } 302 }
303 return false; 303 return false;
304} 304}
305bool OTodo::operator>=(const OTodo &toDoEvent )const 305bool OTodo::operator>=(const OTodo &toDoEvent )const
306{ 306{
307 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true; 307 if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
308 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false; 308 if( !hasDueDate() && toDoEvent.hasDueDate() ) return false;
309 if( hasDueDate() && toDoEvent.hasDueDate() ){ 309 if( hasDueDate() && toDoEvent.hasDueDate() ){
310 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide 310 if( dueDate() == toDoEvent.dueDate() ){ // let's the priority decide
311 return priority() > toDoEvent.priority(); 311 return priority() > toDoEvent.priority();
312 }else{ 312 }else{
313 return dueDate() > toDoEvent.dueDate(); 313 return dueDate() > toDoEvent.dueDate();
314 } 314 }
315 } 315 }
316 return true; 316 return true;
317} 317}
318bool OTodo::operator==(const OTodo &toDoEvent )const 318bool OTodo::operator==(const OTodo &toDoEvent )const
319{ 319{
320 if ( data->priority != toDoEvent.data->priority ) return false; 320 if ( data->priority != toDoEvent.data->priority ) return false;
321 if ( data->priority != toDoEvent.data->prog ) return false; 321 if ( data->priority != toDoEvent.data->prog ) return false;
322 if ( data->isCompleted != toDoEvent.data->isCompleted ) return false; 322 if ( data->isCompleted != toDoEvent.data->isCompleted ) return false;
323 if ( data->hasDate != toDoEvent.data->hasDate ) return false; 323 if ( data->hasDate != toDoEvent.data->hasDate ) return false;
324 if ( data->date != toDoEvent.data->date ) return false; 324 if ( data->date != toDoEvent.data->date ) return false;
325 if ( data->sum != toDoEvent.data->sum ) return false; 325 if ( data->sum != toDoEvent.data->sum ) return false;
326 if ( data->desc != toDoEvent.data->desc ) return false; 326 if ( data->desc != toDoEvent.data->desc ) return false;
327 if ( data->maintainer != toDoEvent.data->maintainer ) 327 if ( data->maintainer != toDoEvent.data->maintainer )
328 return false; 328 return false;
329 329
330 return OPimRecord::operator==( toDoEvent ); 330 return OPimRecord::operator==( toDoEvent );
331} 331}
332void OTodo::deref() { 332void OTodo::deref() {
333 333
334// qWarning("deref in ToDoEvent"); 334// qWarning("deref in ToDoEvent");
335 if ( data->deref() ) { 335 if ( data->deref() ) {
336// qWarning("deleting"); 336// qWarning("deleting");
337 delete data; 337 delete data;
338 data= 0; 338 data= 0;
339 } 339 }
340} 340}
341OTodo &OTodo::operator=(const OTodo &item ) 341OTodo &OTodo::operator=(const OTodo &item )
342{ 342{
343 OPimRecord::operator=( item ); 343 OPimRecord::operator=( item );
344 //qWarning("operator= ref "); 344 //qWarning("operator= ref ");
345 item.data->ref(); 345 item.data->ref();
346 deref(); 346 deref();
347 data = item.data; 347 data = item.data;
348 348
349 return *this; 349 return *this;
350} 350}
351 351
352QMap<int, QString> OTodo::toMap() const { 352QMap<int, QString> OTodo::toMap() const {
353 QMap<int, QString> map; 353 QMap<int, QString> map;
354 354