author | zecke <zecke> | 2002-04-15 20:53:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-15 20:53:57 (UTC) |
commit | e010d922ac415558e5efd35e69e39e45908b5501 (patch) (unidiff) | |
tree | 7b6dac3a82613fdefb15c818541891f577ecf48d | |
parent | 15244683bb97d303d0d3b6104b46a9b429aaed85 (diff) | |
download | opie-e010d922ac415558e5efd35e69e39e45908b5501.zip opie-e010d922ac415558e5efd35e69e39e45908b5501.tar.gz opie-e010d922ac415558e5efd35e69e39e45908b5501.tar.bz2 |
updates?
too much to remember
-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,4 +1,6 @@ | |||
1 | 1 | ||
2 | |||
3 | #include <qpe/config.h> | ||
2 | #include "ofontmenu.h" | 4 | #include "ofontmenu.h" |
3 | 5 | ||
4 | 6 | ||
@@ -7,6 +9,8 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li | |||
7 | : QPopupMenu( parent, name ) | 9 | : QPopupMenu( parent, name ) |
8 | { | 10 | { |
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() ), |
11 | 0, 10); | 15 | 0, 10); |
12 | insertItem(tr("Medium"), this, SLOT(slotMedium() ), | 16 | insertItem(tr("Medium"), this, SLOT(slotMedium() ), |
@@ -14,6 +18,34 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li | |||
14 | insertItem(tr("Small"), this, SLOT(slotSmall() ), | 18 | insertItem(tr("Small"), this, SLOT(slotSmall() ), |
15 | 0, 12 ); | 19 | 0, 12 ); |
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 | } |
18 | void OFontMenu::setWidgets(const QList<QWidget> &list ) | 50 | void OFontMenu::setWidgets(const QList<QWidget> &list ) |
19 | { | 51 | { |
@@ -61,6 +93,7 @@ void OFontMenu::slotLarge() | |||
61 | } | 93 | } |
62 | void OFontMenu::setFontSize(int size ) | 94 | void OFontMenu::setFontSize(int size ) |
63 | { | 95 | { |
96 | m_size = size; | ||
64 | QWidget *wid; | 97 | QWidget *wid; |
65 | for(wid = m_list.first(); wid !=0; wid = m_list.next() ){ | 98 | for(wid = m_list.first(); wid !=0; wid = m_list.next() ){ |
66 | QFont font = wid->font(); | 99 | QFont font = wid->font(); |
@@ -75,4 +108,5 @@ void OFontMenu::setFontSize(int size ) | |||
75 | wids->wid->setFont( font ); | 108 | wids->wid->setFont( font ); |
76 | } | 109 | } |
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 | |||
@@ -47,19 +47,25 @@ namespace { | |||
47 | }; | 47 | }; |
48 | 48 | ||
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 { |
51 | Q_OBJECT | 52 | Q_OBJECT |
52 | public: | 53 | public: |
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 ); |
55 | void addWidget(QWidget *wid ); | 58 | void addWidget(QWidget *wid ); |
56 | void forceSize(QWidget *wid, int size ); | 59 | void forceSize(QWidget *wid, int size ); |
57 | void removeWidget(QWidget *wid ); | 60 | void removeWidget(QWidget *wid ); |
58 | const QList<QWidget> &widgets()const; | 61 | const QList<QWidget> &widgets()const; |
59 | 62 | ||
63 | signals: | ||
64 | void fontChanged(int size ); | ||
60 | private: | 65 | private: |
61 | QList<QWidget> m_list; | 66 | QList<QWidget> m_list; |
62 | QList<WidSize> m_wids; | 67 | QList<WidSize> m_wids; |
68 | int m_size; | ||
63 | class OFontMenuPrivate; | 69 | class OFontMenuPrivate; |
64 | OFontMenuPrivate *d; | 70 | OFontMenuPrivate *d; |
65 | private slots: | 71 | private slots: |
diff --git a/libopie/tododb.cpp b/libopie/tododb.cpp index 3f6dc30..4d6711d 100644 --- a/libopie/tododb.cpp +++ b/libopie/tododb.cpp | |||
@@ -197,10 +197,30 @@ void ToDoDB::removeEvent( const ToDoEvent &event ) | |||
197 | { | 197 | { |
198 | m_todos.remove( event ); | 198 | m_todos.remove( 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() |
201 | { | 214 | { |
202 | load(); | 215 | load(); |
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 ) |
205 | { | 225 | { |
206 | m_fileName =file; | 226 | m_fileName =file; |
diff --git a/libopie/tododb.h b/libopie/tododb.h index e77a0f4..7fd9f96 100644 --- a/libopie/tododb.h +++ b/libopie/tododb.h | |||
@@ -23,7 +23,9 @@ class ToDoDB | |||
23 | void addEvent(const ToDoEvent &event ); | 23 | void addEvent(const ToDoEvent &event ); |
24 | void editEvent(const ToDoEvent &editEvent ); | 24 | void editEvent(const ToDoEvent &editEvent ); |
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(); |
28 | void setFileName(const QString & ); | 30 | void setFileName(const QString & ); |
29 | QString fileName()const; | 31 | QString fileName()const; |
diff --git a/libopie/todoevent.cpp b/libopie/todoevent.cpp index 28b2e98..a5dba4f 100644 --- a/libopie/todoevent.cpp +++ b/libopie/todoevent.cpp | |||
@@ -12,7 +12,6 @@ ToDoEvent::ToDoEvent(const ToDoEvent &event ) | |||
12 | ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, | 12 | ToDoEvent::ToDoEvent(bool completed, int priority, const QStringList &category, |
13 | const QString &description, bool hasDate, QDate date, int uid ) | 13 | const QString &description, bool hasDate, QDate date, int uid ) |
14 | { | 14 | { |
15 | qWarning("todoEvent c'tor" ); | ||
16 | m_date = date; | 15 | m_date = date; |
17 | m_isCompleted = completed; | 16 | m_isCompleted = completed; |
18 | m_hasDate = hasDate; | 17 | m_hasDate = hasDate; |
@@ -70,7 +69,6 @@ void ToDoEvent::clearCategories() | |||
70 | void ToDoEvent::setCategories(const QStringList &list ) | 69 | void ToDoEvent::setCategories(const QStringList &list ) |
71 | { | 70 | { |
72 | m_category = list; | 71 | m_category = list; |
73 | qWarning("todoevent: %s", list.join(";" ).latin1() ); | ||
74 | } | 72 | } |
75 | QDate ToDoEvent::date()const | 73 | QDate ToDoEvent::date()const |
76 | { | 74 | { |