00001 /* 00002 This file is part of the Opie Project 00003 00004 Copyright (C) Opie Team <opie-devel@handhelds.org> 00005 =. 00006 .=l. 00007 .>+-= 00008 _;:, .> :=|. This program is free software; you can 00009 .> <`_, > . <= redistribute it and/or modify it under 00010 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00011 .="- .-=="i, .._ License as published by the Free Software 00012 - . .-<_> .<> Foundation; either version 2 of the License, 00013 ._= =} : or (at your option) any later version. 00014 .%`+i> _;_. 00015 .i_,=:_. -<s. This program is distributed in the hope that 00016 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00017 : .. .:, . . . without even the implied warranty of 00018 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00019 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00020 ..}^=.= = ; Library General Public License for more 00021 ++= -. .` .: details. 00022 : = ...= . :.=- 00023 -. .:....=;==+<; You should have received a copy of the GNU 00024 -_. . . )=. = Library General Public License along with 00025 -- :-=` this library; see the file COPYING.LIB. 00026 If not, write to the Free Software Foundation, 00027 Inc., 59 Temple Place - Suite 330, 00028 Boston, MA 02111-1307, USA. 00029 */ 00030 00031 #ifndef OPIE_TODO_MANAGER_H 00032 #define OPIE_TODO_MANAGER_H 00033 00034 #include <opie2/opimtodo.h> 00035 #include <opie2/otodoaccess.h> 00036 00037 #include <qpe/categories.h> 00038 00039 #include <qarray.h> 00040 #include <qobject.h> 00041 #include <qstring.h> 00042 00043 #include "smalltodo.h" 00044 00045 using Opie::OPimTodo; 00046 using Opie::OPimTodoAccess; 00047 00048 namespace Todo { 00049 class TodoManager : public QObject{ 00050 Q_OBJECT 00051 public: 00052 bool isLoaded()const; 00053 void load(); 00054 TodoManager(QObject* obj = 0); 00055 ~TodoManager(); 00056 00057 QStringList categories()/*const*/; 00058 int catId(const QString&); 00059 OPimTodo event(int uid ); 00060 00061 void updateList(); 00063 OPimTodoAccess::List list()const; 00064 OPimTodoAccess::List sorted( bool asc, int so, int f, int cat ); 00065 00066 OPimTodoAccess::List::Iterator overDue(); 00067 OPimTodoAccess::List::Iterator fromTo( const QDate& start, 00068 const QDate& end ); 00069 OPimTodoAccess::List::Iterator query( const OPimTodo& ev, int query ); 00070 00071 void setCategory( bool sort, int category = -1); 00072 void setShowOverDue( bool show ); 00073 void setSortOrder( int sortOrder ); 00074 void setSortASC( bool ); 00075 void sort(); 00076 00077 OPimTodoAccess* todoDB(); 00078 bool saveAll(); 00079 00080 00081 signals: 00082 void update(); 00083 void updateCategories(); 00084 00085 public slots: 00086 void add( const OPimTodo& ); 00087 void update( int uid, const SmallTodo& ); 00088 void update( int uid, const OPimTodo& ); 00089 bool remove( int uid ); 00090 void remove( const QArray<int>& ); 00091 00095 void removeCompleted(); 00096 void removeAll(); 00097 void reload(); 00098 void save(); 00099 00100 private: 00101 OPimTodoAccess* m_db; 00102 OPimTodoAccess::List m_list; 00103 OPimTodoAccess::List::Iterator m_it; 00104 OPimTodoAccess::List m_sorted; 00105 Categories m_cat; 00106 int m_ca; 00107 /* sort cat */ 00108 bool m_shCat; 00109 int m_sortOrder; 00110 bool m_asc; 00111 00112 }; 00113 }; 00114 00115 #endif
1.4.2