summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp31
-rw-r--r--libopie/pim/oevent.cpp56
-rw-r--r--libopie/pim/otodo.cpp54
-rw-r--r--libopie2/opiepim/ocontact.cpp31
-rw-r--r--libopie2/opiepim/oevent.cpp56
-rw-r--r--libopie2/opiepim/otodo.cpp54
6 files changed, 212 insertions, 70 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index a7ca975..a2fb68c 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -419,178 +419,182 @@ OContact::~OContact()
/*!
\internal
*/
QMap<int, QString> OContact::toMap() const
{
QMap<int, QString> map = mMap;
QString cats = idsToString( categories() );
if ( !cats.isEmpty() )
map.insert( Qtopia::AddressCategory, cats );
return map;
}
/*!
Returns a rich text formatted QString representing the contents the contact.
*/
QString OContact::toRichText() const
{
QString text;
QString value, comp, state;
QString str;
bool marker = false;
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
- text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
+ text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>";
+
if ( !(value = jobTitle()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
comp = company();
if ( !(value = department()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( comp )
text += ", ";
else
text += "<br>";
}
if ( !comp.isEmpty() )
text += Qtopia::escapeString(comp) + "<br>";
+ text += "<hr><br>";
+
+ // defailt email
QString defEmail = defaultEmail();
if ( !defEmail.isEmpty() )
- text += "<b>" + QObject::tr("Default Email: ") + "</b>"
+ text += "<b><img src=\"addressbook/email\">" + QObject::tr("Default Email: ") + "</b>"
+ Qtopia::escapeString(defEmail) + "<br>";
- text += "<hr>";
+ text += "<br>";
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
- text += "<br>";
text += QObject::tr( "<b>Work Address:</b>" );
text += "<br>";
marker = true;
}
if ( !(value = businessStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = businessState();
if ( !(value = businessZip()).isEmpty() )
text += Qtopia::escapeString(value) + " ";
if ( !(value = businessCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( state )
text += ", " + Qtopia::escapeString(state);
text += "<br>";
} else if ( !state.isEmpty() )
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = businessCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
// rest of Business data
str = office();
if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Office: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessWebpage();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
+ text += "<b><img src=\"addressbook/webpagework\">" + QObject::tr("Business Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessPhone();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
+ text += "<b><img src=\"addressbook/phonework\">" + QObject::tr("Business Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessFax();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
+ text += "<b><img src=\"addressbook/faxwork\">" + QObject::tr("Business Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessMobile();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
+ text += "<b><img src=\"addressbook/mobilework\">" + QObject::tr("Business Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessPager();
if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
+ text += "<br>";
+
// home address
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
!homeZip().isEmpty() || !homeCountry().isEmpty() ) {
- text += "<br>";
text += QObject::tr( "<b>Home Address:</b>" );
text += "<br>";
}
if ( !(value = homeStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = homeState();
if ( !(value = homeZip()).isEmpty() )
text += Qtopia::escapeString(value) + " ";
if ( !(value = homeCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( !state.isEmpty() )
text += ", " + Qtopia::escapeString(state);
text += "<br>";
} else if (!state.isEmpty())
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = homeCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
// rest of Home data
str = homeWebpage();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
+ text += "<b><img src=\"addressbook/webpagehome\">" + QObject::tr("Home Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = homePhone();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
+ text += "<b><img src=\"addressbook/phonehome\">" + QObject::tr("Home Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = homeFax();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
+ text += "<b><img src=\"addressbook/faxhome\">" + QObject::tr("Home Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = homeMobile();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
+ text += "<b><img src=\"addressbook/mobilehome\">" + QObject::tr("Home Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
if ( marker )
text += "<br><hr><br>";
// the others...
str = emails();
if ( !str.isEmpty() && ( str != defEmail ) )
text += "<b>" + QObject::tr("All Emails: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = profession();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Profession: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = assistant();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Assistant: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = manager();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Manager: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = gender();
@@ -604,48 +608,49 @@ QString OContact::toRichText() const
str = spouse();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Spouse: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
text += "<b>" + QObject::tr("Birthday: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
str = children();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Children: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = nickname();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Nickname: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ // categories
if ( categoryNames("Contacts").count() ){
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames("Contacts").join(", ");
text += "<br>";
}
// notes last
if ( !(value = notes()).isEmpty() ) {
text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
QRegExp reg("\n");
//QString tmp = Qtopia::escapeString(value);
QString tmp = QStyleSheet::convertFromPlainText(value);
//tmp.replace( reg, "<br>" );
text += "<br>" + tmp + "<br>";
}
return text;
}
/*!
\internal
*/
void OContact::insert( int key, const QString &v )
{
diff --git a/libopie/pim/oevent.cpp b/libopie/pim/oevent.cpp
index 83b191f..e4f5d92 100644
--- a/libopie/pim/oevent.cpp
+++ b/libopie/pim/oevent.cpp
@@ -214,64 +214,96 @@ QString OEvent::timeZone()const {
bool OEvent::match( const QRegExp& re )const {
if ( re.match( data->description ) != -1 ){
setLastHitField( Qtopia::DatebookDescription );
return true;
}
if ( re.match( data->note ) != -1 ){
setLastHitField( Qtopia::Note );
return true;
}
if ( re.match( data->location ) != -1 ){
setLastHitField( Qtopia::Location );
return true;
}
if ( re.match( data->start.toString() ) != -1 ){
setLastHitField( Qtopia::StartDateTime );
return true;
}
if ( re.match( data->end.toString() ) != -1 ){
setLastHitField( Qtopia::EndDateTime );
return true;
}
return false;
}
QString OEvent::toRichText()const {
- QString text;
+ QString text, value;
+
+ // description
+ text += "<b><h3><img src=\"datebook/DateBook\">";
if ( !description().isEmpty() ) {
- text += "<b>" + QObject::tr( "Description:") + "</b><br>";
- text += Qtopia::escapeString(description() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
+ }
+ text += "</h3></b><br><hr><br>";
+
+ // location
+ if ( !(value = location()).isEmpty() ) {
+ text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
+ text += Qtopia::escapeString(value) + "<br>";
+ }
+
+ // all day event
+ if ( isAllDay() ) {
+ text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
}
- if ( startDateTime().isValid() ) {
- text += "<b>" + QObject::tr( "Start:") + "</b> ";
- text += Qtopia::escapeString(startDateTime().toString() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ // multiple day event
+ else if ( isMultipleDay () ) {
+ text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
+ }
+ // start & end times
+ else {
+ // start time
+ if ( startDateTime().isValid() ) {
+ text += "<b>" + QObject::tr( "Start:") + "</b> ";
+ text += Qtopia::escapeString(startDateTime().toString() ).
+ replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ }
+
+ // end time
+ if ( endDateTime().isValid() ) {
+ text += "<b>" + QObject::tr( "End:") + "</b> ";
+ text += Qtopia::escapeString(endDateTime().toString() ).
+ replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ }
}
- if ( endDateTime().isValid() ) {
- text += "<b>" + QObject::tr( "End:") + "</b> ";
- text += Qtopia::escapeString(endDateTime().toString() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+
+ // categories
+ if ( categoryNames("Calendar").count() ){
+ text += "<b>" + QObject::tr( "Category:") + "</b> ";
+ text += categoryNames("Calendar").join(", ");
+ text += "<br>";
}
+
+ //notes
if ( !note().isEmpty() ) {
text += "<b>" + QObject::tr( "Note:") + "</b><br>";
text += note();
// text += Qtopia::escapeString(note() ).
// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
return text;
}
QString OEvent::toShortText()const {
QString text;
text += QString::number( startDateTime().date().day() );
text += ".";
text += QString::number( startDateTime().date().month() );
text += ".";
text += QString::number( startDateTime().date().year() );
text += " ";
text += QString::number( startDateTime().time().hour() );
text += ":";
text += QString::number( startDateTime().time().minute() );
text += " - ";
text += description();
return text;
}
QString OEvent::type()const {
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp
index e087a00..c84eeeb 100644
--- a/libopie/pim/otodo.cpp
+++ b/libopie/pim/otodo.cpp
@@ -252,69 +252,103 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) {
data->maintainer = new OPimMaintainer( pim );
}
bool OTodo::isOverdue( )
{
if( data->hasDate && !data->isCompleted)
return QDate::currentDate() > data->date;
return false;
}
void OTodo::setProgress(ushort progress )
{
changeOrModify();
data->prog = progress;
}
QString OTodo::toShortText() const {
return summary();
}
/*!
Returns a richt text string
*/
QString OTodo::toRichText() const
{
QString text;
QStringList catlist;
- // Description of the todo
+ // summary
+ text += "<b><h3><img src=\"todo/TodoList\">";
if ( !summary().isEmpty() ) {
- text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
- text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
}
+ text += "</h3></b><br><hr><br>";
+
+ // description
if( !description().isEmpty() ){
text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
}
- text += "<br><br><br>";
- text += "<b>" + QObject::tr( "Priority:") +" </b>"
- + QString::number( priority() ) + " <br>";
+ // priority
+ int priorityval = priority();
+ text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
+ QString::number( priorityval ) + "\">";
+// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
+// QString::number( priority() ) + "\"><br>";
+ switch ( priorityval )
+ {
+ case 1 : text += QObject::tr( "Very high" );
+ break;
+ case 2 : text += QObject::tr( "High" );
+ break;
+ case 3 : text += QObject::tr( "Normal" );
+ break;
+ case 4 : text += QObject::tr( "Low" );
+ break;
+ case 5 : text += QObject::tr( "Very low" );
+ break;
+ };
+ text += "<br>";
+
+ // progress
text += "<b>" + QObject::tr( "Progress:") + " </b>"
+ QString::number( progress() ) + " %<br>";
+
+ // due date
if (hasDueDate() ){
- text += "<b>" + QObject::tr( "Deadline:") + " </b>";
- text += dueDate().toString();
- text += "<br>";
+ QDate dd = dueDate();
+ int off = QDate::currentDate().daysTo( dd );
+
+ text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
+ if ( off < 0 )
+ text += "#FF0000";
+ else if ( off == 0 )
+ text += "#FFFF00";
+ else if ( off > 0 )
+ text += "#00FF00";
+
+ text += "\">" + dd.toString() + "</font><br>";
}
-
+
+ // categories
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames( "Todo List" ).join(", ");
text += "<br>";
return text;
}
bool OTodo::hasNotifiers()const {
if (!data->notifiers) return false;
return !data->notifiers->isEmpty();
}
OPimNotifyManager& OTodo::notifiers() {
if (!data->notifiers )
data->notifiers = new OPimNotifyManager;
return (*data->notifiers);
}
const OPimNotifyManager& OTodo::notifiers()const{
if (!data->notifiers )
data->notifiers = new OPimNotifyManager;
return (*data->notifiers);
}
bool OTodo::operator<( const OTodo &toDoEvent )const{
if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index a7ca975..a2fb68c 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -419,178 +419,182 @@ OContact::~OContact()
/*!
\internal
*/
QMap<int, QString> OContact::toMap() const
{
QMap<int, QString> map = mMap;
QString cats = idsToString( categories() );
if ( !cats.isEmpty() )
map.insert( Qtopia::AddressCategory, cats );
return map;
}
/*!
Returns a rich text formatted QString representing the contents the contact.
*/
QString OContact::toRichText() const
{
QString text;
QString value, comp, state;
QString str;
bool marker = false;
// name, jobtitle and company
if ( !(value = fullName()).isEmpty() )
- text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
+ text += "<b><h3><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>";
+
if ( !(value = jobTitle()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
comp = company();
if ( !(value = department()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( comp )
text += ", ";
else
text += "<br>";
}
if ( !comp.isEmpty() )
text += Qtopia::escapeString(comp) + "<br>";
+ text += "<hr><br>";
+
+ // defailt email
QString defEmail = defaultEmail();
if ( !defEmail.isEmpty() )
- text += "<b>" + QObject::tr("Default Email: ") + "</b>"
+ text += "<b><img src=\"addressbook/email\">" + QObject::tr("Default Email: ") + "</b>"
+ Qtopia::escapeString(defEmail) + "<br>";
- text += "<hr>";
+ text += "<br>";
// business address
if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
!businessZip().isEmpty() || !businessCountry().isEmpty() ) {
- text += "<br>";
text += QObject::tr( "<b>Work Address:</b>" );
text += "<br>";
marker = true;
}
if ( !(value = businessStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = businessState();
if ( !(value = businessZip()).isEmpty() )
text += Qtopia::escapeString(value) + " ";
if ( !(value = businessCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( state )
text += ", " + Qtopia::escapeString(state);
text += "<br>";
} else if ( !state.isEmpty() )
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = businessCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
// rest of Business data
str = office();
if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Office: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessWebpage();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
+ text += "<b><img src=\"addressbook/webpagework\">" + QObject::tr("Business Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessPhone();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
+ text += "<b><img src=\"addressbook/phonework\">" + QObject::tr("Business Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessFax();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
+ text += "<b><img src=\"addressbook/faxwork\">" + QObject::tr("Business Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessMobile();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
+ text += "<b><img src=\"addressbook/mobilework\">" + QObject::tr("Business Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = businessPager();
if ( !str.isEmpty() ){
text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
+ text += "<br>";
+
// home address
if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
!homeZip().isEmpty() || !homeCountry().isEmpty() ) {
- text += "<br>";
text += QObject::tr( "<b>Home Address:</b>" );
text += "<br>";
}
if ( !(value = homeStreet()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
state = homeState();
if ( !(value = homeZip()).isEmpty() )
text += Qtopia::escapeString(value) + " ";
if ( !(value = homeCity()).isEmpty() ) {
text += Qtopia::escapeString(value);
if ( !state.isEmpty() )
text += ", " + Qtopia::escapeString(state);
text += "<br>";
} else if (!state.isEmpty())
text += Qtopia::escapeString(state) + "<br>";
if ( !(value = homeCountry()).isEmpty() )
text += Qtopia::escapeString(value) + "<br>";
// rest of Home data
str = homeWebpage();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
+ text += "<b><img src=\"addressbook/webpagehome\">" + QObject::tr("Home Web Page: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = homePhone();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
+ text += "<b><img src=\"addressbook/phonehome\">" + QObject::tr("Home Phone: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = homeFax();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
+ text += "<b><img src=\"addressbook/faxhome\">" + QObject::tr("Home Fax: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
str = homeMobile();
if ( !str.isEmpty() ){
- text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
+ text += "<b><img src=\"addressbook/mobilehome\">" + QObject::tr("Home Mobile: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
marker = true;
}
if ( marker )
text += "<br><hr><br>";
// the others...
str = emails();
if ( !str.isEmpty() && ( str != defEmail ) )
text += "<b>" + QObject::tr("All Emails: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = profession();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Profession: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = assistant();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Assistant: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = manager();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Manager: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = gender();
@@ -604,48 +608,49 @@ QString OContact::toRichText() const
str = spouse();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Spouse: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
text += "<b>" + QObject::tr("Birthday: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
}
str = children();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Children: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
str = nickname();
if ( !str.isEmpty() )
text += "<b>" + QObject::tr("Nickname: ") + "</b>"
+ Qtopia::escapeString(str) + "<br>";
+ // categories
if ( categoryNames("Contacts").count() ){
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames("Contacts").join(", ");
text += "<br>";
}
// notes last
if ( !(value = notes()).isEmpty() ) {
text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
QRegExp reg("\n");
//QString tmp = Qtopia::escapeString(value);
QString tmp = QStyleSheet::convertFromPlainText(value);
//tmp.replace( reg, "<br>" );
text += "<br>" + tmp + "<br>";
}
return text;
}
/*!
\internal
*/
void OContact::insert( int key, const QString &v )
{
diff --git a/libopie2/opiepim/oevent.cpp b/libopie2/opiepim/oevent.cpp
index 83b191f..e4f5d92 100644
--- a/libopie2/opiepim/oevent.cpp
+++ b/libopie2/opiepim/oevent.cpp
@@ -214,64 +214,96 @@ QString OEvent::timeZone()const {
bool OEvent::match( const QRegExp& re )const {
if ( re.match( data->description ) != -1 ){
setLastHitField( Qtopia::DatebookDescription );
return true;
}
if ( re.match( data->note ) != -1 ){
setLastHitField( Qtopia::Note );
return true;
}
if ( re.match( data->location ) != -1 ){
setLastHitField( Qtopia::Location );
return true;
}
if ( re.match( data->start.toString() ) != -1 ){
setLastHitField( Qtopia::StartDateTime );
return true;
}
if ( re.match( data->end.toString() ) != -1 ){
setLastHitField( Qtopia::EndDateTime );
return true;
}
return false;
}
QString OEvent::toRichText()const {
- QString text;
+ QString text, value;
+
+ // description
+ text += "<b><h3><img src=\"datebook/DateBook\">";
if ( !description().isEmpty() ) {
- text += "<b>" + QObject::tr( "Description:") + "</b><br>";
- text += Qtopia::escapeString(description() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "" );
+ }
+ text += "</h3></b><br><hr><br>";
+
+ // location
+ if ( !(value = location()).isEmpty() ) {
+ text += "<b>" + QObject::tr( "Location:" ) + "</b> ";
+ text += Qtopia::escapeString(value) + "<br>";
+ }
+
+ // all day event
+ if ( isAllDay() ) {
+ text += "<b><i>" + QObject::tr( "This is an all day event" ) + "</i></b><br>";
}
- if ( startDateTime().isValid() ) {
- text += "<b>" + QObject::tr( "Start:") + "</b> ";
- text += Qtopia::escapeString(startDateTime().toString() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ // multiple day event
+ else if ( isMultipleDay () ) {
+ text += "<b><i>" + QObject::tr( "This is a multiple day event" ) + "</i></b><br>";
+ }
+ // start & end times
+ else {
+ // start time
+ if ( startDateTime().isValid() ) {
+ text += "<b>" + QObject::tr( "Start:") + "</b> ";
+ text += Qtopia::escapeString(startDateTime().toString() ).
+ replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ }
+
+ // end time
+ if ( endDateTime().isValid() ) {
+ text += "<b>" + QObject::tr( "End:") + "</b> ";
+ text += Qtopia::escapeString(endDateTime().toString() ).
+ replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ }
}
- if ( endDateTime().isValid() ) {
- text += "<b>" + QObject::tr( "End:") + "</b> ";
- text += Qtopia::escapeString(endDateTime().toString() ).
- replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+
+ // categories
+ if ( categoryNames("Calendar").count() ){
+ text += "<b>" + QObject::tr( "Category:") + "</b> ";
+ text += categoryNames("Calendar").join(", ");
+ text += "<br>";
}
+
+ //notes
if ( !note().isEmpty() ) {
text += "<b>" + QObject::tr( "Note:") + "</b><br>";
text += note();
// text += Qtopia::escapeString(note() ).
// replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
}
return text;
}
QString OEvent::toShortText()const {
QString text;
text += QString::number( startDateTime().date().day() );
text += ".";
text += QString::number( startDateTime().date().month() );
text += ".";
text += QString::number( startDateTime().date().year() );
text += " ";
text += QString::number( startDateTime().time().hour() );
text += ":";
text += QString::number( startDateTime().time().minute() );
text += " - ";
text += description();
return text;
}
QString OEvent::type()const {
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp
index e087a00..c84eeeb 100644
--- a/libopie2/opiepim/otodo.cpp
+++ b/libopie2/opiepim/otodo.cpp
@@ -252,69 +252,103 @@ void OTodo::setMaintainer( const OPimMaintainer& pim ) {
data->maintainer = new OPimMaintainer( pim );
}
bool OTodo::isOverdue( )
{
if( data->hasDate && !data->isCompleted)
return QDate::currentDate() > data->date;
return false;
}
void OTodo::setProgress(ushort progress )
{
changeOrModify();
data->prog = progress;
}
QString OTodo::toShortText() const {
return summary();
}
/*!
Returns a richt text string
*/
QString OTodo::toRichText() const
{
QString text;
QStringList catlist;
- // Description of the todo
+ // summary
+ text += "<b><h3><img src=\"todo/TodoList\">";
if ( !summary().isEmpty() ) {
- text += "<b>" + QObject::tr( "Summary:") + "</b><br>";
- text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>";
+ text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "" );
}
+ text += "</h3></b><br><hr><br>";
+
+ // description
if( !description().isEmpty() ){
text += "<b>" + QObject::tr( "Description:" ) + "</b><br>";
text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ;
}
- text += "<br><br><br>";
- text += "<b>" + QObject::tr( "Priority:") +" </b>"
- + QString::number( priority() ) + " <br>";
+ // priority
+ int priorityval = priority();
+ text += "<b>" + QObject::tr( "Priority:") +" </b><img src=\"todo/priority" +
+ QString::number( priorityval ) + "\">";
+// text += "<b>" + QObject::tr( "Priority:") +"</b><img src=\"todo/priority" +
+// QString::number( priority() ) + "\"><br>";
+ switch ( priorityval )
+ {
+ case 1 : text += QObject::tr( "Very high" );
+ break;
+ case 2 : text += QObject::tr( "High" );
+ break;
+ case 3 : text += QObject::tr( "Normal" );
+ break;
+ case 4 : text += QObject::tr( "Low" );
+ break;
+ case 5 : text += QObject::tr( "Very low" );
+ break;
+ };
+ text += "<br>";
+
+ // progress
text += "<b>" + QObject::tr( "Progress:") + " </b>"
+ QString::number( progress() ) + " %<br>";
+
+ // due date
if (hasDueDate() ){
- text += "<b>" + QObject::tr( "Deadline:") + " </b>";
- text += dueDate().toString();
- text += "<br>";
+ QDate dd = dueDate();
+ int off = QDate::currentDate().daysTo( dd );
+
+ text += "<b>" + QObject::tr( "Deadline:" ) + " </b><font color=\"";
+ if ( off < 0 )
+ text += "#FF0000";
+ else if ( off == 0 )
+ text += "#FFFF00";
+ else if ( off > 0 )
+ text += "#00FF00";
+
+ text += "\">" + dd.toString() + "</font><br>";
}
-
+
+ // categories
text += "<b>" + QObject::tr( "Category:") + "</b> ";
text += categoryNames( "Todo List" ).join(", ");
text += "<br>";
return text;
}
bool OTodo::hasNotifiers()const {
if (!data->notifiers) return false;
return !data->notifiers->isEmpty();
}
OPimNotifyManager& OTodo::notifiers() {
if (!data->notifiers )
data->notifiers = new OPimNotifyManager;
return (*data->notifiers);
}
const OPimNotifyManager& OTodo::notifiers()const{
if (!data->notifiers )
data->notifiers = new OPimNotifyManager;
return (*data->notifiers);
}
bool OTodo::operator<( const OTodo &toDoEvent )const{
if( !hasDueDate() && !toDoEvent.hasDueDate() ) return true;