-rw-r--r-- | libopie/ofontmenu.cc | 34 | ||||
-rw-r--r-- | libopie/ofontmenu.h | 6 | ||||
-rw-r--r-- | libopie/tododb.cpp | 20 | ||||
-rw-r--r-- | libopie/tododb.h | 4 | ||||
-rw-r--r-- | libopie/todoevent.cpp | 2 |
5 files changed, 63 insertions, 3 deletions
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc index 2acae1c..52ff3ee 100644 --- a/libopie/ofontmenu.cc +++ b/libopie/ofontmenu.cc | |||
@@ -1,2 +1,4 @@ | |||
1 | 1 | ||
2 | |||
3 | #include <qpe/config.h> | ||
2 | #include "ofontmenu.h" | 4 | #include "ofontmenu.h" |
@@ -9,2 +11,4 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li | |||
9 | m_list = list; | 11 | m_list = list; |
12 | m_wids.setAutoDelete( TRUE ); | ||
13 | |||
10 | insertItem(tr("Large"), this, SLOT(slotLarge() ), | 14 | insertItem(tr("Large"), this, SLOT(slotLarge() ), |
@@ -16,2 +20,30 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li | |||
16 | setCheckable( true ); | 20 | setCheckable( true ); |
21 | m_size=10; | ||
22 | } | ||
23 | void OFontMenu::save(Config *cfg ) | ||
24 | { | ||
25 | cfg->setGroup("OFontMenu" ); | ||
26 | cfg->writeEntry("size", m_size ); | ||
27 | } | ||
28 | void OFontMenu::restore(Config *cfg ) | ||
29 | { | ||
30 | cfg->setGroup("OFontMeny" ); | ||
31 | m_size = cfg->readNumEntry("size" ); | ||
32 | setItemChecked(10, false ); | ||
33 | setItemChecked(11, false ); | ||
34 | setItemChecked(12, false ); | ||
35 | switch( m_size ){ | ||
36 | case 8: | ||
37 | setItemChecked(12, true ); | ||
38 | break; | ||
39 | case 14: | ||
40 | setItemChecked(10, true ); | ||
41 | break; | ||
42 | case 10:// fall through | ||
43 | default: | ||
44 | setItemChecked(11, true ); | ||
45 | m_size = 10; | ||
46 | break; | ||
47 | } | ||
48 | setFontSize( m_size ); | ||
17 | } | 49 | } |
@@ -63,2 +95,3 @@ void OFontMenu::setFontSize(int size ) | |||
63 | { | 95 | { |
96 | m_size = size; | ||
64 | QWidget *wid; | 97 | QWidget *wid; |
@@ -77,2 +110,3 @@ void OFontMenu::setFontSize(int size ) | |||
77 | } | 110 | } |
111 | emit fontChanged(size ); | ||
78 | } | 112 | } |
diff --git a/libopie/ofontmenu.h b/libopie/ofontmenu.h index 37a628e..609f240 100644 --- a/libopie/ofontmenu.h +++ b/libopie/ofontmenu.h | |||
@@ -49,2 +49,3 @@ namespace { | |||
49 | // if i would be on kde this would be a KActionMenu... | 49 | // if i would be on kde this would be a KActionMenu... |
50 | class Config; | ||
50 | class OFontMenu : public QPopupMenu { | 51 | class OFontMenu : public QPopupMenu { |
@@ -53,2 +54,4 @@ class OFontMenu : public QPopupMenu { | |||
53 | OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); | 54 | OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); |
55 | void save(Config *cfg ); | ||
56 | void restore(Config *cfg ); | ||
54 | void setWidgets(const QList<QWidget> &list ); | 57 | void setWidgets(const QList<QWidget> &list ); |
@@ -59,2 +62,4 @@ class OFontMenu : public QPopupMenu { | |||
59 | 62 | ||
63 | signals: | ||
64 | void fontChanged(int size ); | ||
60 | private: | 65 | private: |
@@ -62,2 +67,3 @@ class OFontMenu : public QPopupMenu { | |||
62 | QList<WidSize> m_wids; | 67 | QList<WidSize> m_wids; |
68 | int m_size; | ||
63 | class OFontMenuPrivate; | 69 | class OFontMenuPrivate; |
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index 3f6dc30..4d6711d 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp | |||
@@ -199,2 +199,15 @@ void ToDoDB::removeEvent( const ToDoEvent &event ) | |||
199 | } | 199 | } |
200 | void ToDoDB::replaceEvent(const ToDoEvent &event ) | ||
201 | { | ||
202 | QValueList<ToDoEvent>::Iterator it; | ||
203 | int uid = event.uid(); | ||
204 | // == is not overloaded as we would like :( so let's search for the uid | ||
205 | for(it = m_todos.begin(); it != m_todos.end(); ++it ){ | ||
206 | if( (*it).uid() == uid ){ | ||
207 | m_todos.remove( (*it) ); | ||
208 | break; // should save us the iterate is now borked | ||
209 | } | ||
210 | } | ||
211 | m_todos.append(event); | ||
212 | } | ||
200 | void ToDoDB::reload() | 213 | void ToDoDB::reload() |
@@ -203,2 +216,9 @@ void ToDoDB::reload() | |||
203 | } | 216 | } |
217 | void ToDoDB::mergeWith(const QValueList<ToDoEvent>& events ) | ||
218 | { | ||
219 | QValueList<ToDoEvent>::ConstIterator it; | ||
220 | for( it = events.begin(); it != events.end(); ++it ){ | ||
221 | replaceEvent( (*it) ); | ||
222 | } | ||
223 | } | ||
204 | void ToDoDB::setFileName(const QString &file ) | 224 | void ToDoDB::setFileName(const QString &file ) |
diff --git a/libopie/tododb.h b/libopie/tododb.h index e77a0f4..7fd9f96 100644 --- a/libopie/tododb.h +++ b/libopie/tododb.h | |||
@@ -25,3 +25,5 @@ class ToDoDB | |||
25 | void removeEvent(const ToDoEvent &event); | 25 | void removeEvent(const ToDoEvent &event); |
26 | 26 | void replaceEvent(const ToDoEvent &event ); | |
27 | // QValueList<ToDoEvents will overwrite existing ones no smart code at all ;) | ||
28 | void mergeWith(const QValueList<ToDoEvent>& ); | ||
27 | void reload(); | 29 | void reload(); |
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index 28b2e98..a5dba4f 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp | |||
@@ -14,3 +14,2 @@ ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, | |||
14 | { | 14 | { |
15 | qWarning("todoEvent c'tor" ); | ||
16 | m_date = date; | 15 | m_date = date; |
@@ -72,3 +71,2 @@ void ToDoEvent::setCategories(const QStringList &list ) | |||
72 | m_category = list; | 71 | m_category = list; |
73 | qWarning("todoevent: %s", list.join(";" ).latin1() ); | ||
74 | } | 72 | } |