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

todoitem.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 "todoitem.h"
00014 
00015 #include <opie2/oresource.h>
00016 
00017 #include <qpe/qcopenvelope_qws.h>
00018 
00019 using namespace Opie;
00020 TodoItem::TodoItem(OListViewItem* parent, OPimTodo *todo)
00021 : ResultItem(parent)
00022 {
00023         _todo = todo;
00024         setText( 0, todo->toShortText() );
00025         setIcon();
00026 }
00027 
00028 TodoItem::~TodoItem()
00029 {
00030         delete _todo;
00031 }
00032 
00033 QString TodoItem::toRichText()
00034 {
00035         return _todo->toRichText();
00036 }
00037 
00038 void TodoItem::action( int act )
00039 {
00040         if (act == 0){
00041                 QCopEnvelope e("QPE/Application/todolist", "show(int)");
00042                 e << _todo->uid();
00043         }else if (act == 1){
00044                 QCopEnvelope e("QPE/Application/todolist", "edit(int)");
00045                 e << _todo->uid();
00046         }
00047 }
00048 
00049 QIntDict<QString> TodoItem::actions()
00050 {
00051         QIntDict<QString> result;
00052         result.insert( 0, new QString( QObject::tr("show") ) );
00053         result.insert( 1, new QString( QObject::tr("edit") ) );
00054         return result;
00055 }
00056 
00057 void TodoItem::setIcon()
00058 {
00059         QPixmap icon;
00060         switch ( _todo->lastHitField() ) {
00061         case -1:
00062         icon = Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon );
00063                 break;
00064         case OPimTodo::Description:
00065         icon = Opie::Core::OResource::loadPixmap( "txt", Opie::Core::OResource::SmallIcon );
00066                 break;
00067         case OPimTodo::Summary:
00068         icon = Opie::Core::OResource::loadPixmap( "osearch/summary", Opie::Core::OResource::SmallIcon );
00069                 break;
00070         case OPimTodo::Priority:
00071         icon = Opie::Core::OResource::loadPixmap( "todo/priority1", Opie::Core::OResource::SmallIcon );
00072                 break;
00073         case OPimTodo::HasDate:
00074         icon = Opie::Core::OResource::loadPixmap( "osearch/clock", Opie::Core::OResource::SmallIcon );
00075                 break;
00076         default:
00077         icon = Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon );
00078                 break;
00079         }
00080         setPixmap( 0, icon );
00081 }

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