Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

eventitem.cpp

Go to the documentation of this file.
00001 //
00002 //
00003 // C++ Implementation: $MODULE$
00004 //
00005 // Description:
00006 //
00007 //
00008 // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
00009 //
00010 // Copyright: See COPYING file that comes with this distribution
00011 //
00012 //
00013 #include "eventitem.h"
00014 
00015 #include <opie2/oresource.h>
00016 
00017 #include <qpe/qcopenvelope_qws.h>
00018 
00019 
00020 using namespace Opie;
00021 EventItem::EventItem(OListViewItem* parent, OPimEvent *event)
00022  : ResultItem(parent)
00023 {
00024         _event = event;
00025         setText(0, _event->toShortText() );
00026         setIcon();
00027 }
00028 
00029 
00030 EventItem::~EventItem()
00031 {
00032 }
00033 
00034 
00035 QString EventItem::toRichText()
00036 {
00037     return _event->toRichText();
00038 }
00039 
00040 void EventItem::action( int act )
00041 {
00042         if (act == 0){
00043                 QCopEnvelope e("QPE/Application/datebook", "viewDefault(QDate)");
00044                 e << _event->startDateTime().date();
00045         }else if(act == 1){
00046                 QCopEnvelope e("QPE/Application/datebook", "editEvent(int)");
00047                 e << _event->uid();
00048         }
00049 }
00050 
00051 QIntDict<QString> EventItem::actions()
00052 {
00053         QIntDict<QString> result;
00054         result.insert( 0, new QString( QObject::tr("show") ) );
00055         result.insert( 1, new QString( QObject::tr("edit") ) );
00056         return result;
00057 }
00058 
00059 void EventItem::setIcon()
00060 {
00061         QPixmap icon;
00062         switch ( _event->lastHitField() ) {
00063         case -1:
00064         icon = Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon );
00065 //              QWhatsThis::add( icon, QObject::tr("Enter your search terms here") );
00066                 break;
00067         case Qtopia::DatebookDescription:
00068         icon = Opie::Core::OResource::loadPixmap( "osearch/summary", Opie::Core::OResource::SmallIcon );
00069                 break;
00070         case Qtopia::Notes:
00071         icon = Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon );
00072                 break;
00073         case Qtopia::Location:
00074         icon = Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon );
00075                 break;
00076         case Qtopia::StartDateTime:
00077         case Qtopia::EndDateTime:
00078         icon = Opie::Core::OResource::loadPixmap( "osearch/clock", Opie::Core::OResource::SmallIcon );
00079                 break;
00080         default:
00081         icon = Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon );
00082                 break;
00083         }
00084         setPixmap( 0, icon );
00085 }

Generated on Sat Nov 5 16:15:54 2005 for OPIE by  doxygen 1.4.2