author | zecke <zecke> | 2002-04-13 23:18:09 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-13 23:18:09 (UTC) |
commit | 707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5 (patch) (unidiff) | |
tree | d17645bbf5e0318e6e10c3377605c107a110ebd1 /libopie | |
parent | 0f7ff8056deb70f1c32bdcf46bb2b623063bdc1c (diff) | |
download | opie-707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5.zip opie-707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5.tar.gz opie-707f0d3dd81b8ecec2df4e942c0efd2ee51b7fc5.tar.bz2 |
PopupMenu for fontsize handling like on the Zaurus
-rw-r--r-- | libopie/libopie.pro | 4 | ||||
-rw-r--r-- | libopie/ofontmenu.cc | 78 | ||||
-rw-r--r-- | libopie/ofontmenu.h | 77 | ||||
-rw-r--r-- | libopie/tododb.cpp | 1 |
4 files changed, 158 insertions, 2 deletions
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index 3c8da78..ddc0c33 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -1,8 +1,8 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofileselector.h ofiledialog.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h oconfig.h | 3 | HEADERS = ofontmenu.h ofileselector.h ofiledialog.h tododb.h todoevent.h todoresource.h todovcalresource.h xmltree.h oconfig.h |
4 | SOURCES = ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp oconfig.cpp | 4 | SOURCES = ofontmenu.cc ofileselector.cc ofiledialog.cc xmltree.cc tododb.cpp todoevent.cpp todovcalresource.cpp oconfig.cpp |
5 | TARGET = opie | 5 | TARGET = opie |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | 7 | DESTDIR = $(QTDIR)/lib$(PROJMAK) |
8 | #VERSION = 1.0.0 \ No newline at end of file | 8 | #VERSION = 1.0.0 \ No newline at end of file |
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc new file mode 100644 index 0000000..2acae1c --- a/dev/null +++ b/libopie/ofontmenu.cc | |||
@@ -0,0 +1,78 @@ | |||
1 | |||
2 | #include "ofontmenu.h" | ||
3 | |||
4 | |||
5 | |||
6 | OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list ) | ||
7 | : QPopupMenu( parent, name ) | ||
8 | { | ||
9 | m_list = list; | ||
10 | insertItem(tr("Large"), this, SLOT(slotLarge() ), | ||
11 | 0, 10); | ||
12 | insertItem(tr("Medium"), this, SLOT(slotMedium() ), | ||
13 | 0, 11 ); | ||
14 | insertItem(tr("Small"), this, SLOT(slotSmall() ), | ||
15 | 0, 12 ); | ||
16 | setCheckable( true ); | ||
17 | } | ||
18 | void OFontMenu::setWidgets(const QList<QWidget> &list ) | ||
19 | { | ||
20 | m_list = list; | ||
21 | } | ||
22 | void OFontMenu::addWidget( QWidget *wid ) | ||
23 | { | ||
24 | m_list.append(wid ); | ||
25 | } | ||
26 | void OFontMenu::removeWidget( QWidget *wid ) | ||
27 | { | ||
28 | m_list.remove( wid ); | ||
29 | } | ||
30 | const QList<QWidget> &OFontMenu::widgets()const | ||
31 | { | ||
32 | return m_list; | ||
33 | } | ||
34 | void OFontMenu::forceSize(QWidget *wid, int size ) | ||
35 | { | ||
36 | WidSize *widz = new WidSize; | ||
37 | widz->wid = wid; | ||
38 | widz->size = size; | ||
39 | m_wids.append( widz ); | ||
40 | } | ||
41 | void OFontMenu::slotSmall() | ||
42 | { | ||
43 | setItemChecked(10, false ); | ||
44 | setItemChecked(11, false ); | ||
45 | setItemChecked(12, true ); | ||
46 | setFontSize( 8 ); | ||
47 | } | ||
48 | void OFontMenu::slotMedium() | ||
49 | { | ||
50 | setItemChecked(10, false ); | ||
51 | setItemChecked(11, true ); | ||
52 | setItemChecked(12, false ); | ||
53 | setFontSize(10 ); | ||
54 | } | ||
55 | void OFontMenu::slotLarge() | ||
56 | { | ||
57 | setItemChecked(10, true ); | ||
58 | setItemChecked(11, false ); | ||
59 | setItemChecked(12, false ); | ||
60 | setFontSize(14 ); | ||
61 | } | ||
62 | void OFontMenu::setFontSize(int size ) | ||
63 | { | ||
64 | QWidget *wid; | ||
65 | for(wid = m_list.first(); wid !=0; wid = m_list.next() ){ | ||
66 | QFont font = wid->font(); | ||
67 | font.setPointSize( size ); | ||
68 | wid->setFont( font ); | ||
69 | } | ||
70 | if(!m_wids.isEmpty() ){ | ||
71 | WidSize *wids; | ||
72 | for( wids = m_wids.first(); wids != 0; wids = m_wids.next() ){ | ||
73 | QFont font = wids->wid->font(); | ||
74 | font.setPointSize( wids->size ); | ||
75 | wids->wid->setFont( font ); | ||
76 | } | ||
77 | } | ||
78 | } | ||
diff --git a/libopie/ofontmenu.h b/libopie/ofontmenu.h new file mode 100644 index 0000000..37a628e --- a/dev/null +++ b/libopie/ofontmenu.h | |||
@@ -0,0 +1,77 @@ | |||
1 | |||
2 | /* | ||
3 | |||
4 | =. This file is part of the OPIE Project | ||
5 | .=l. Copyright (c) 2002 zekce <zecke@handhelds.org> | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This library is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This library is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | |||
29 | */ | ||
30 | |||
31 | |||
32 | |||
33 | |||
34 | #ifndef ofontmenu_h | ||
35 | #define ofontmenu_h | ||
36 | |||
37 | #include <qpopupmenu.h> | ||
38 | #include <qlist.h> | ||
39 | |||
40 | |||
41 | namespace { | ||
42 | struct WidSize { | ||
43 | QWidget *wid; | ||
44 | int size; | ||
45 | }; | ||
46 | |||
47 | }; | ||
48 | |||
49 | // if i would be on kde this would be a KActionMenu... | ||
50 | class OFontMenu : public QPopupMenu { | ||
51 | Q_OBJECT | ||
52 | public: | ||
53 | OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); | ||
54 | void setWidgets(const QList<QWidget> &list ); | ||
55 | void addWidget(QWidget *wid ); | ||
56 | void forceSize(QWidget *wid, int size ); | ||
57 | void removeWidget(QWidget *wid ); | ||
58 | const QList<QWidget> &widgets()const; | ||
59 | |||
60 | private: | ||
61 | QList<QWidget> m_list; | ||
62 | QList<WidSize> m_wids; | ||
63 | class OFontMenuPrivate; | ||
64 | OFontMenuPrivate *d; | ||
65 | private slots: | ||
66 | virtual void slotSmall(); | ||
67 | virtual void slotMedium(); | ||
68 | virtual void slotLarge(); | ||
69 | void setFontSize(int size ); | ||
70 | }; | ||
71 | |||
72 | #endif | ||
73 | |||
74 | |||
75 | |||
76 | |||
77 | |||
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index 7814c4f..3f6dc30 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp | |||
@@ -1,226 +1,227 @@ | |||
1 | 1 | ||
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | #include <opie/tododb.h> | 3 | #include <opie/tododb.h> |
4 | #include <opie/xmltree.h> | 4 | #include <opie/xmltree.h> |
5 | #include <opie/todoresource.h> | 5 | #include <opie/todoresource.h> |
6 | #include <qpe/palmtoprecord.h> | 6 | #include <qpe/palmtoprecord.h> |
7 | #include <qpe/global.h> | 7 | #include <qpe/global.h> |
8 | 8 | ||
9 | namespace { | 9 | namespace { |
10 | 10 | ||
11 | class FileToDoResource : public ToDoResource { | 11 | class FileToDoResource : public ToDoResource { |
12 | public: | 12 | public: |
13 | FileToDoResource() {}; | 13 | FileToDoResource() {}; |
14 | bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){ | 14 | bool save(const QString &name, const QValueList<ToDoEvent> &m_todos ){ |
15 | // prepare the XML | 15 | // prepare the XML |
16 | XMLElement *tasks = new XMLElement( ); | 16 | XMLElement *tasks = new XMLElement( ); |
17 | tasks->setTagName("Tasks" ); | 17 | tasks->setTagName("Tasks" ); |
18 | for( QValueList<ToDoEvent>::ConstIterator it = m_todos.begin(); it != m_todos.end(); ++it ){ | 18 | for( QValueList<ToDoEvent>::ConstIterator it = m_todos.begin(); it != m_todos.end(); ++it ){ |
19 | XMLElement::AttributeMap map; | 19 | XMLElement::AttributeMap map; |
20 | XMLElement *task = new XMLElement(); | 20 | XMLElement *task = new XMLElement(); |
21 | map.insert( "Completed", QString::number((int)(*it).isCompleted() ) ); | 21 | map.insert( "Completed", QString::number((int)(*it).isCompleted() ) ); |
22 | map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); | 22 | map.insert( "HasDate", QString::number((int)(*it).hasDate() ) ); |
23 | map.insert( "Priority", QString::number( (*it).priority() ) ); | 23 | map.insert( "Priority", QString::number( (*it).priority() ) ); |
24 | QArray<int> arrat = (*it).categories(); | 24 | QArray<int> arrat = (*it).categories(); |
25 | QString attr; | 25 | QString attr; |
26 | for(uint i=0; i < arrat.count(); i++ ){ | 26 | for(uint i=0; i < arrat.count(); i++ ){ |
27 | attr.append(QString::number(arrat[i])+";" ); | 27 | attr.append(QString::number(arrat[i])+";" ); |
28 | } | 28 | } |
29 | if(!attr.isEmpty() ) // remove the last ; | 29 | if(!attr.isEmpty() ) // remove the last ; |
30 | attr.remove(attr.length()-1, 1 ); | 30 | attr.remove(attr.length()-1, 1 ); |
31 | map.insert( "Categories", attr ); | 31 | map.insert( "Categories", attr ); |
32 | //else | 32 | //else |
33 | //map.insert( "Categories", QString::null ); | 33 | //map.insert( "Categories", QString::null ); |
34 | map.insert( "Description", (*it).description() ); | 34 | map.insert( "Description", (*it).description() ); |
35 | if( (*it).hasDate() ){ | 35 | if( (*it).hasDate() ){ |
36 | map.insert("DateYear", QString::number( (*it).date().year() ) ); | 36 | map.insert("DateYear", QString::number( (*it).date().year() ) ); |
37 | map.insert("DateMonth", QString::number( (*it).date().month() ) ); | 37 | map.insert("DateMonth", QString::number( (*it).date().month() ) ); |
38 | map.insert("DateDay", QString::number( (*it).date().day() ) ); | 38 | map.insert("DateDay", QString::number( (*it).date().day() ) ); |
39 | } | 39 | } |
40 | map.insert("Uid", QString::number( (*it).uid() ) ); | 40 | map.insert("Uid", QString::number( (*it).uid() ) ); |
41 | task->setTagName("Task" ); | 41 | task->setTagName("Task" ); |
42 | task->setAttributes( map ); | 42 | task->setAttributes( map ); |
43 | tasks->appendChild(task); | 43 | tasks->appendChild(task); |
44 | } | 44 | } |
45 | QFile file( name); | 45 | QFile file( name); |
46 | if( file.open(IO_WriteOnly ) ){ | 46 | if( file.open(IO_WriteOnly ) ){ |
47 | QTextStream stream(&file ); | 47 | QTextStream stream(&file ); |
48 | stream << "<!DOCTYPE Tasks>" << endl; | 48 | stream << "<!DOCTYPE Tasks>" << endl; |
49 | tasks->save(stream ); | 49 | tasks->save(stream ); |
50 | delete tasks; | 50 | delete tasks; |
51 | stream << "</Tasks>" << endl; | ||
51 | file.close(); | 52 | file.close(); |
52 | return true; | 53 | return true; |
53 | } | 54 | } |
54 | return false; | 55 | return false; |
55 | } | 56 | } |
56 | QValueList<ToDoEvent> load( const QString &name ){ | 57 | QValueList<ToDoEvent> load( const QString &name ){ |
57 | qWarning("loading tododb" ); | 58 | qWarning("loading tododb" ); |
58 | QValueList<ToDoEvent> m_todos; | 59 | QValueList<ToDoEvent> m_todos; |
59 | XMLElement *root = XMLElement::load( name ); | 60 | XMLElement *root = XMLElement::load( name ); |
60 | if(root != 0l ){ // start parsing | 61 | if(root != 0l ){ // start parsing |
61 | qWarning("ToDoDB::load tagName(): %s", root->tagName().latin1() ); | 62 | qWarning("ToDoDB::load tagName(): %s", root->tagName().latin1() ); |
62 | //if( root->tagName() == QString::fromLatin1("Tasks" ) ){// Start | 63 | //if( root->tagName() == QString::fromLatin1("Tasks" ) ){// Start |
63 | XMLElement *element = root->firstChild(); | 64 | XMLElement *element = root->firstChild(); |
64 | element = element->firstChild(); | 65 | element = element->firstChild(); |
65 | while( element ){ | 66 | while( element ){ |
66 | qWarning("ToDoDB::load element tagName() : %s", element->tagName().latin1() ); | 67 | qWarning("ToDoDB::load element tagName() : %s", element->tagName().latin1() ); |
67 | QString dummy; | 68 | QString dummy; |
68 | ToDoEvent event; | 69 | ToDoEvent event; |
69 | bool ok; | 70 | bool ok; |
70 | int dumInt; | 71 | int dumInt; |
71 | // completed | 72 | // completed |
72 | dummy = element->attribute("Completed" ); | 73 | dummy = element->attribute("Completed" ); |
73 | dumInt = dummy.toInt(&ok ); | 74 | dumInt = dummy.toInt(&ok ); |
74 | if(ok ) event.setCompleted( dumInt == 0 ? false : true ); | 75 | if(ok ) event.setCompleted( dumInt == 0 ? false : true ); |
75 | // hasDate | 76 | // hasDate |
76 | dummy = element->attribute("HasDate" ); | 77 | dummy = element->attribute("HasDate" ); |
77 | dumInt = dummy.toInt(&ok ); | 78 | dumInt = dummy.toInt(&ok ); |
78 | if(ok ) event.setHasDate( dumInt == 0 ? false: true ); | 79 | if(ok ) event.setHasDate( dumInt == 0 ? false: true ); |
79 | // set the date | 80 | // set the date |
80 | bool hasDa = dumInt; | 81 | bool hasDa = dumInt; |
81 | if ( hasDa ) { //parse the date | 82 | if ( hasDa ) { //parse the date |
82 | int year, day, month = 0; | 83 | int year, day, month = 0; |
83 | year = day = month; | 84 | year = day = month; |
84 | // year | 85 | // year |
85 | dummy = element->attribute("DateYear" ); | 86 | dummy = element->attribute("DateYear" ); |
86 | dumInt = dummy.toInt(&ok ); | 87 | dumInt = dummy.toInt(&ok ); |
87 | if( ok ) year = dumInt; | 88 | if( ok ) year = dumInt; |
88 | // month | 89 | // month |
89 | dummy = element->attribute("DateMonth" ); | 90 | dummy = element->attribute("DateMonth" ); |
90 | dumInt = dummy.toInt(&ok ); | 91 | dumInt = dummy.toInt(&ok ); |
91 | if(ok ) month = dumInt; | 92 | if(ok ) month = dumInt; |
92 | dummy = element->attribute("DateDay" ); | 93 | dummy = element->attribute("DateDay" ); |
93 | dumInt = dummy.toInt(&ok ); | 94 | dumInt = dummy.toInt(&ok ); |
94 | if(ok ) day = dumInt; | 95 | if(ok ) day = dumInt; |
95 | // set the date | 96 | // set the date |
96 | QDate date( year, month, day ); | 97 | QDate date( year, month, day ); |
97 | event.setDate( date); | 98 | event.setDate( date); |
98 | } | 99 | } |
99 | dummy = element->attribute("Priority" ); | 100 | dummy = element->attribute("Priority" ); |
100 | dumInt = dummy.toInt(&ok ); | 101 | dumInt = dummy.toInt(&ok ); |
101 | if(!ok ) dumInt = ToDoEvent::NORMAL; | 102 | if(!ok ) dumInt = ToDoEvent::NORMAL; |
102 | event.setPriority( dumInt ); | 103 | event.setPriority( dumInt ); |
103 | //description | 104 | //description |
104 | dummy = element->attribute("Description" ); | 105 | dummy = element->attribute("Description" ); |
105 | event.setDescription( dummy ); | 106 | event.setDescription( dummy ); |
106 | // category | 107 | // category |
107 | dummy = element->attribute("Categories" ); | 108 | dummy = element->attribute("Categories" ); |
108 | QStringList ids = QStringList::split(";", dummy ); | 109 | QStringList ids = QStringList::split(";", dummy ); |
109 | event.setCategories( ids ); | 110 | event.setCategories( ids ); |
110 | 111 | ||
111 | //uid | 112 | //uid |
112 | dummy = element->attribute("Uid" ); | 113 | dummy = element->attribute("Uid" ); |
113 | dumInt = dummy.toInt(&ok ); | 114 | dumInt = dummy.toInt(&ok ); |
114 | if(ok ) event.setUid( dumInt ); | 115 | if(ok ) event.setUid( dumInt ); |
115 | m_todos.append( event ); | 116 | m_todos.append( event ); |
116 | element = element->nextChild(); // next element | 117 | element = element->nextChild(); // next element |
117 | } | 118 | } |
118 | //} | 119 | //} |
119 | }else { | 120 | }else { |
120 | qWarning("could not load" ); | 121 | qWarning("could not load" ); |
121 | } | 122 | } |
122 | delete root; | 123 | delete root; |
123 | qWarning("returning" ); | 124 | qWarning("returning" ); |
124 | return m_todos; | 125 | return m_todos; |
125 | } | 126 | } |
126 | }; | 127 | }; |
127 | 128 | ||
128 | } | 129 | } |
129 | 130 | ||
130 | ToDoDB::ToDoDB(const QString &fileName, ToDoResource *res ){ | 131 | ToDoDB::ToDoDB(const QString &fileName, ToDoResource *res ){ |
131 | m_fileName = fileName; | 132 | m_fileName = fileName; |
132 | if( fileName.isEmpty() && res == 0 ){ | 133 | if( fileName.isEmpty() && res == 0 ){ |
133 | m_fileName = Global::applicationFileName("todolist","todolist.xml"); | 134 | m_fileName = Global::applicationFileName("todolist","todolist.xml"); |
134 | res = new FileToDoResource(); | 135 | res = new FileToDoResource(); |
135 | //qWarning("%s", m_fileName.latin1() ); | 136 | //qWarning("%s", m_fileName.latin1() ); |
136 | }else if(res == 0 ){ // let's create a ToDoResource for xml | 137 | }else if(res == 0 ){ // let's create a ToDoResource for xml |
137 | res = new FileToDoResource(); | 138 | res = new FileToDoResource(); |
138 | } | 139 | } |
139 | m_res = res; | 140 | m_res = res; |
140 | load(); | 141 | load(); |
141 | } | 142 | } |
142 | ToDoResource* ToDoDB::resource(){ | 143 | ToDoResource* ToDoDB::resource(){ |
143 | return m_res; | 144 | return m_res; |
144 | }; | 145 | }; |
145 | void ToDoDB::setResource( ToDoResource *res ) | 146 | void ToDoDB::setResource( ToDoResource *res ) |
146 | { | 147 | { |
147 | delete m_res; | 148 | delete m_res; |
148 | m_res = res; | 149 | m_res = res; |
149 | } | 150 | } |
150 | ToDoDB::~ToDoDB() | 151 | ToDoDB::~ToDoDB() |
151 | { | 152 | { |
152 | delete m_res; | 153 | delete m_res; |
153 | } | 154 | } |
154 | QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from, const QDate &to, | 155 | QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from, const QDate &to, |
155 | bool all ) | 156 | bool all ) |
156 | { | 157 | { |
157 | QValueList<ToDoEvent> events; | 158 | QValueList<ToDoEvent> events; |
158 | for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ | 159 | for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ |
159 | if( (*it).hasDate() ){ | 160 | if( (*it).hasDate() ){ |
160 | if( (*it).date() >= from && (*it).date() <= to ) | 161 | if( (*it).date() >= from && (*it).date() <= to ) |
161 | events.append( (*it) ); | 162 | events.append( (*it) ); |
162 | }else if( all ){ | 163 | }else if( all ){ |
163 | events.append( (*it) ); | 164 | events.append( (*it) ); |
164 | } | 165 | } |
165 | } | 166 | } |
166 | return events; | 167 | return events; |
167 | } | 168 | } |
168 | QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from, | 169 | QValueList<ToDoEvent> ToDoDB::effectiveToDos(const QDate &from, |
169 | bool all) | 170 | bool all) |
170 | { | 171 | { |
171 | return effectiveToDos( from, QDate::currentDate(), all ); | 172 | return effectiveToDos( from, QDate::currentDate(), all ); |
172 | } | 173 | } |
173 | QValueList<ToDoEvent> ToDoDB::overDue() | 174 | QValueList<ToDoEvent> ToDoDB::overDue() |
174 | { | 175 | { |
175 | QValueList<ToDoEvent> events; | 176 | QValueList<ToDoEvent> events; |
176 | for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ | 177 | for( QValueList<ToDoEvent>::Iterator it = m_todos.begin(); it!= m_todos.end(); ++it ){ |
177 | if( (*it).isOverdue() ) | 178 | if( (*it).isOverdue() ) |
178 | events.append((*it) ); | 179 | events.append((*it) ); |
179 | } | 180 | } |
180 | return events; | 181 | return events; |
181 | } | 182 | } |
182 | QValueList<ToDoEvent> ToDoDB::rawToDos() | 183 | QValueList<ToDoEvent> ToDoDB::rawToDos() |
183 | { | 184 | { |
184 | return m_todos; | 185 | return m_todos; |
185 | } | 186 | } |
186 | void ToDoDB::addEvent( const ToDoEvent &event ) | 187 | void ToDoDB::addEvent( const ToDoEvent &event ) |
187 | { | 188 | { |
188 | m_todos.append( event ); | 189 | m_todos.append( event ); |
189 | } | 190 | } |
190 | void ToDoDB::editEvent( const ToDoEvent &event ) | 191 | void ToDoDB::editEvent( const ToDoEvent &event ) |
191 | { | 192 | { |
192 | m_todos.remove( event ); | 193 | m_todos.remove( event ); |
193 | m_todos.append( event ); | 194 | m_todos.append( event ); |
194 | } | 195 | } |
195 | void ToDoDB::removeEvent( const ToDoEvent &event ) | 196 | void ToDoDB::removeEvent( const ToDoEvent &event ) |
196 | { | 197 | { |
197 | m_todos.remove( event ); | 198 | m_todos.remove( event ); |
198 | } | 199 | } |
199 | void ToDoDB::reload() | 200 | void ToDoDB::reload() |
200 | { | 201 | { |
201 | load(); | 202 | load(); |
202 | } | 203 | } |
203 | void ToDoDB::setFileName(const QString &file ) | 204 | void ToDoDB::setFileName(const QString &file ) |
204 | { | 205 | { |
205 | m_fileName =file; | 206 | m_fileName =file; |
206 | } | 207 | } |
207 | QString ToDoDB::fileName()const | 208 | QString ToDoDB::fileName()const |
208 | { | 209 | { |
209 | return m_fileName; | 210 | return m_fileName; |
210 | } | 211 | } |
211 | void ToDoDB::load() | 212 | void ToDoDB::load() |
212 | { | 213 | { |
213 | m_todos = m_res->load( m_fileName ); | 214 | m_todos = m_res->load( m_fileName ); |
214 | } | 215 | } |
215 | bool ToDoDB::save() | 216 | bool ToDoDB::save() |
216 | { | 217 | { |
217 | return m_res->save( m_fileName, m_todos ); | 218 | return m_res->save( m_fileName, m_todos ); |
218 | } | 219 | } |
219 | 220 | ||
220 | 221 | ||
221 | 222 | ||
222 | 223 | ||
223 | 224 | ||
224 | 225 | ||
225 | 226 | ||
226 | 227 | ||