summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/osearch/contactitem.cpp87
-rw-r--r--core/pim/osearch/contactitem.h1
-rw-r--r--core/pim/osearch/eventitem.cpp28
-rw-r--r--core/pim/osearch/eventitem.h1
-rw-r--r--core/pim/osearch/todoitem.cpp27
-rw-r--r--core/pim/osearch/todoitem.h1
6 files changed, 145 insertions, 0 deletions
diff --git a/core/pim/osearch/contactitem.cpp b/core/pim/osearch/contactitem.cpp
index 7d8ecf1..3928b1f 100644
--- a/core/pim/osearch/contactitem.cpp
+++ b/core/pim/osearch/contactitem.cpp
@@ -1,56 +1,143 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "contactitem.h"
+#include <qpixmap.h>
#include <opie/ocontact.h>
+#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
ContactItem::ContactItem(OListViewItem* parent, OContact *contact)
: ResultItem(parent)
{
_contact = contact;
setText(0, _contact->toShortText());
+ setIcon();
}
+void ContactItem::setIcon()
+{
+ QPixmap icon;
+ switch ( _contact->lastHitField() ) {
+ case -1:
+ icon = Resource::loadPixmap( "reset" );
+ break;
+ case Qtopia::BusinessPhone:
+ icon = Resource::loadPixmap( "addressbook/phonework" );
+ break;
+ case Qtopia::BusinessFax:
+ icon = Resource::loadPixmap( "addressbook/faxwork" );
+ break;
+ case Qtopia::BusinessMobile:
+ icon = Resource::loadPixmap( "addressbook/mobilework" );
+ break;
+ case Qtopia::DefaultEmail:
+ icon = Resource::loadPixmap( "addressbook/email" );
+ break;
+ case Qtopia::Emails:
+ icon = Resource::loadPixmap( "addressbook/email" );
+ break;
+ case Qtopia::HomePhone:
+ qDebug("homephone");
+ icon = Resource::loadPixmap( "addressbook/phonehome" );
+ break;
+ case Qtopia::HomeFax:
+ icon = Resource::loadPixmap( "addressbook/faxhome" );
+ break;
+ case Qtopia::HomeMobile:
+ icon = Resource::loadPixmap( "addressbook/mobilehome" );
+ break;
+ case Qtopia::HomeWebPage:
+ icon = Resource::loadPixmap( "addressbook/webpagehome" );
+ break;
+ case Qtopia::BusinessWebPage:
+ icon = Resource::loadPixmap( "addressbook/webpagework" );
+ break;
+ case Qtopia::Title:
+ case Qtopia::FirstName:
+ case Qtopia::MiddleName:
+ case Qtopia::LastName:
+ case Qtopia::Suffix:
+ case Qtopia::Nickname:
+ case Qtopia::FileAs:
+ icon = Resource::loadPixmap( "addressbook/identity" );
+ break;
+ case Qtopia::HomeStreet:
+ case Qtopia::HomeCity:
+ case Qtopia::HomeState:
+ case Qtopia::HomeZip:
+ case Qtopia::HomeCountry:
+ icon = Resource::loadPixmap( "addressbook/addresshome" );
+ break;
+ case Qtopia::Company:
+ case Qtopia::BusinessCity:
+ case Qtopia::BusinessStreet:
+ case Qtopia::BusinessZip:
+ case Qtopia::BusinessCountry:
+ case Qtopia::JobTitle:
+ case Qtopia::Department:
+ case Qtopia::Office:
+ case Qtopia::Manager:
+ case Qtopia::BusinessPager:
+ case Qtopia::Profession:
+ icon = Resource::loadPixmap( "addressbook/addresshome" );
+ break;
+ case Qtopia::Assistant:
+ case Qtopia::Spouse:
+ case Qtopia::Children:
+ icon = Resource::loadPixmap( "osearch/personal" );
+ break;
+ case Qtopia::Birthday:
+ case Qtopia::Anniversary:
+ icon = Resource::loadPixmap( "osearch/clock" );
+ break;
+ case Qtopia::Notes:
+ break;
+ default:
+ icon = Resource::loadPixmap( "DocsIcon" );
+ break;
+ }
+ setPixmap( 0, icon );
+}
ContactItem::~ContactItem()
{
delete _contact;
}
QString ContactItem::toRichText()
{
return _contact->toRichText();
}
void ContactItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/addressbook", "show(int)");
e << _contact->uid();
}else if(act == 1){
QCopEnvelope e("QPE/Application/addressbook", "edit(int)");
e << _contact->uid();
}
}
QIntDict<QString> ContactItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
diff --git a/core/pim/osearch/contactitem.h b/core/pim/osearch/contactitem.h
index 5e0017d..d6303e2 100644
--- a/core/pim/osearch/contactitem.h
+++ b/core/pim/osearch/contactitem.h
@@ -1,40 +1,41 @@
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef CONTACTITEM_H
#define CONTACTITEM_H
#include "resultitem.h"
class OContact;
/**
@author Patrick S. Vogt
*/
class ContactItem : public ResultItem
{
public:
ContactItem(OListViewItem* parent, OContact *contact);
~ContactItem();
virtual QString toRichText();
virtual void action( int );
virtual QIntDict<QString> actions();
private:
+ void setIcon();
OContact *_contact;
};
#endif
diff --git a/core/pim/osearch/eventitem.cpp b/core/pim/osearch/eventitem.cpp
index 3b84b42..5b7a840 100644
--- a/core/pim/osearch/eventitem.cpp
+++ b/core/pim/osearch/eventitem.cpp
@@ -1,54 +1,82 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "eventitem.h"
#include <qdatetime.h>
+#include <qpixmap.h>
+#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <opie/oevent.h>
EventItem::EventItem(OListViewItem* parent, OEvent *event)
: ResultItem(parent)
{
_event = event;
setText(0, _event->toShortText() );
+ setIcon();
}
EventItem::~EventItem()
{
}
QString EventItem::toRichText()
{
return _event->toRichText();
}
void EventItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)");
e << _event->startDateTime().date();
}else if(act == 1){
QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
e << _event->uid();
}
}
QIntDict<QString> EventItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
+
+void EventItem::setIcon()
+{
+ QPixmap icon;
+ switch ( _event->lastHitField() ) {
+ case -1:
+ icon = Resource::loadPixmap( "reset" );
+ break;
+ case Qtopia::DatebookDescription:
+ case Qtopia::Notes:
+ icon = Resource::loadPixmap( "osearch/personal" );
+ break;
+ case Qtopia::Location:
+ icon = Resource::loadPixmap( "home" );
+ break;
+ case Qtopia::StartDateTime:
+ case Qtopia::EndDateTime:
+ icon = Resource::loadPixmap( "osearch/clock" );
+ break;
+ default:
+ icon = Resource::loadPixmap( "DocsIcon" );
+ break;
+ }
+ setPixmap( 0, icon );
+}
diff --git a/core/pim/osearch/eventitem.h b/core/pim/osearch/eventitem.h
index d0d45a8..5f9c9fc 100644
--- a/core/pim/osearch/eventitem.h
+++ b/core/pim/osearch/eventitem.h
@@ -1,39 +1,40 @@
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef EVENTITEM_H
#define EVENTITEM_H
#include "resultitem.h"
class OEvent;
/**
@author Patrick S. Vogt
*/
class EventItem : public ResultItem
{
public:
EventItem(OListViewItem* parent, OEvent *event);
~EventItem();
virtual QString toRichText();
virtual void action( int );
virtual QIntDict<QString> actions();
private:
+ void setIcon();
OEvent *_event;
};
#endif
diff --git a/core/pim/osearch/todoitem.cpp b/core/pim/osearch/todoitem.cpp
index 8b354f1..de4ea97 100644
--- a/core/pim/osearch/todoitem.cpp
+++ b/core/pim/osearch/todoitem.cpp
@@ -1,52 +1,79 @@
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "todoitem.h"
#include <opie/otodo.h>
+#include <qpixmap.h>
+#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
TodoItem::TodoItem(OListViewItem* parent, OTodo *todo)
: ResultItem(parent)
{
_todo = todo;
setText( 0, todo->toShortText() );
+ setIcon();
}
TodoItem::~TodoItem()
{
delete _todo;
}
QString TodoItem::toRichText()
{
return _todo->toRichText();
}
void TodoItem::action( int act )
{
if (act == 0){
QCopEnvelope e("QPE/Application/todolist", "show(int)");
e << _todo->uid();
}else if (act == 1){
QCopEnvelope e("QPE/Application/todolist", "edit(int)");
e << _todo->uid();
}
}
QIntDict<QString> TodoItem::actions()
{
QIntDict<QString> result;
result.insert( 0, new QString( QObject::tr("show") ) );
result.insert( 1, new QString( QObject::tr("edit") ) );
return result;
}
+
+void TodoItem::setIcon()
+{
+ QPixmap icon;
+ switch ( _todo->lastHitField() ) {
+ case -1:
+ icon = Resource::loadPixmap( "reset" );
+ break;
+ case OTodo::Description:
+ case OTodo::Summary:
+ icon = Resource::loadPixmap( "osearch/personal" );
+ break;
+ case OTodo::Priority:
+ icon = Resource::loadPixmap( "todo/priority1" );
+ break;
+ case OTodo::HasDate:
+ icon = Resource::loadPixmap( "osearch/clock" );
+ break;
+ default:
+ icon = Resource::loadPixmap( "DocsIcon" );
+ break;
+ }
+ setPixmap( 0, icon );
+}
diff --git a/core/pim/osearch/todoitem.h b/core/pim/osearch/todoitem.h
index 9dfd4ff..cc78e57 100644
--- a/core/pim/osearch/todoitem.h
+++ b/core/pim/osearch/todoitem.h
@@ -1,37 +1,38 @@
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef TODOITEM_H
#define TODOITEM_H
#include "resultitem.h"
class OTodo;
/**
@author Patrick S. Vogt
*/
class TodoItem : public ResultItem
{
public:
TodoItem(OListViewItem* parent, OTodo *todo);
~TodoItem();
virtual QString toRichText();
virtual void action( int );
virtual QIntDict<QString> actions();
private:
+ void setIcon();
OTodo *_todo;
};
#endif