5 files changed, 54 insertions, 11 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp index 5fd5221..6b7c3ce 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp | |||
@@ -27,47 +27,51 @@ DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) | |||
27 | QVBoxLayout *layout = new QVBoxLayout( this ); | 27 | QVBoxLayout *layout = new QVBoxLayout( this ); |
28 | 28 | ||
29 | m_gui = new DatebookPluginConfigBase( this ); | 29 | m_gui = new DatebookPluginConfigBase( this ); |
30 | 30 | ||
31 | layout->addWidget( m_gui ); | 31 | layout->addWidget( m_gui ); |
32 | 32 | ||
33 | readConfig(); | 33 | readConfig(); |
34 | } | 34 | } |
35 | 35 | ||
36 | void DatebookPluginConfig::readConfig() { | 36 | void DatebookPluginConfig::readConfig() { |
37 | Config cfg( "todaydatebookplugin" ); | 37 | Config cfg( "todaydatebookplugin" ); |
38 | cfg.setGroup( "config" ); | 38 | cfg.setGroup( "config" ); |
39 | 39 | ||
40 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); | 40 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); |
41 | m_gui->SpinBox1->setValue( m_max_lines_meet ); | 41 | m_gui->SpinBox1->setValue( m_max_lines_meet ); |
42 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); | 42 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); |
43 | m_gui->CheckBox1->setChecked( m_show_location ); | 43 | m_gui->CheckBox1->setChecked( m_show_location ); |
44 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 44 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
45 | m_gui->CheckBox2->setChecked( m_show_notes ); | 45 | m_gui->CheckBox2->setChecked( m_show_notes ); |
46 | m_only_later = cfg.readNumEntry( "onlylater", 1 ); | 46 | m_only_later = cfg.readNumEntry( "onlylater", 1 ); |
47 | m_gui->CheckBox4->setChecked( cfg.readNumEntry( "timeextraline", 1 ) ); | 47 | m_gui->CheckBox4->setChecked( cfg.readNumEntry( "timeextraline", 1 ) ); |
48 | m_gui->CheckBox3->setChecked( m_only_later ); | 48 | m_gui->CheckBox3->setChecked( m_only_later ); |
49 | m_more_days = cfg.readNumEntry( "moredays", 0 ); | 49 | m_more_days = cfg.readNumEntry( "moredays", 0 ); |
50 | m_gui->SpinBox2->setValue( m_more_days ); | 50 | m_gui->SpinBox2->setValue( m_more_days ); |
51 | m_maxCharClip = cfg.readNumEntry( "maxcharclip" , 38 ); | ||
52 | m_gui->SpinBox3->setValue( m_maxCharClip ); | ||
51 | } | 53 | } |
52 | 54 | ||
53 | 55 | ||
54 | void DatebookPluginConfig::writeConfig() { | 56 | void DatebookPluginConfig::writeConfig() { |
55 | Config cfg( "todaydatebookplugin" ); | 57 | Config cfg( "todaydatebookplugin" ); |
56 | cfg.setGroup( "config" ); | 58 | cfg.setGroup( "config" ); |
57 | 59 | ||
58 | m_max_lines_meet = m_gui->SpinBox1->value(); | 60 | m_max_lines_meet = m_gui->SpinBox1->value(); |
59 | cfg.writeEntry( "maxlinesmeet", m_max_lines_meet); | 61 | cfg.writeEntry( "maxlinesmeet", m_max_lines_meet); |
60 | m_show_location = m_gui->CheckBox1->isChecked(); | 62 | m_show_location = m_gui->CheckBox1->isChecked(); |
61 | cfg.writeEntry( "showlocation", m_show_location); | 63 | cfg.writeEntry( "showlocation", m_show_location); |
62 | m_show_notes = m_gui->CheckBox2->isChecked(); | 64 | m_show_notes = m_gui->CheckBox2->isChecked(); |
63 | cfg.writeEntry( "shownotes", m_show_notes ); | 65 | cfg.writeEntry( "shownotes", m_show_notes ); |
64 | m_only_later = m_gui->CheckBox3->isChecked(); | 66 | m_only_later = m_gui->CheckBox3->isChecked(); |
65 | cfg.writeEntry( "timeextraline", m_gui->CheckBox4->isChecked() ); | 67 | cfg.writeEntry( "timeextraline", m_gui->CheckBox4->isChecked() ); |
66 | cfg.writeEntry( "onlylater", m_only_later ); | 68 | cfg.writeEntry( "onlylater", m_only_later ); |
67 | m_more_days = m_gui->SpinBox2->value(); | 69 | m_more_days = m_gui->SpinBox2->value(); |
68 | cfg.writeEntry( "moredays", m_more_days ); | 70 | cfg.writeEntry( "moredays", m_more_days ); |
71 | m_maxCharClip = m_gui->SpinBox3->value(); | ||
72 | cfg.writeEntry( "maxcharclip", m_maxCharClip ); | ||
69 | cfg.write(); | 73 | cfg.write(); |
70 | } | 74 | } |
71 | 75 | ||
72 | DatebookPluginConfig::~DatebookPluginConfig() { | 76 | DatebookPluginConfig::~DatebookPluginConfig() { |
73 | } | 77 | } |
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h index 4f4e3f1..61e31e0 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfig.h +++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h | |||
@@ -35,29 +35,30 @@ class DatebookPluginConfig : public TodayConfigWidget { | |||
35 | 35 | ||
36 | public: | 36 | public: |
37 | DatebookPluginConfig( QWidget *parent, const char *name ); | 37 | DatebookPluginConfig( QWidget *parent, const char *name ); |
38 | ~DatebookPluginConfig(); | 38 | ~DatebookPluginConfig(); |
39 | 39 | ||
40 | void writeConfig(); | 40 | void writeConfig(); |
41 | private: | 41 | private: |
42 | /** | 42 | /** |
43 | * if changed then save | 43 | * if changed then save |
44 | */ | 44 | */ |
45 | bool changed(); | 45 | bool changed(); |
46 | void readConfig(); | 46 | void readConfig(); |
47 | 47 | ||
48 | 48 | ||
49 | DatebookPluginConfigBase *m_gui; | 49 | DatebookPluginConfigBase *m_gui; |
50 | // how many lines should be showed in the datebook section | 50 | // how many lines should be showed in the datebook section |
51 | int m_max_lines_meet; | 51 | int m_max_lines_meet; |
52 | // If location is to be showed too, 1 to activate it. | 52 | // If location is to be showed too, 1 to activate it. |
53 | int m_show_location; | 53 | int m_show_location; |
54 | // if notes should be shown | 54 | // if notes should be shown |
55 | int m_show_notes; | 55 | int m_show_notes; |
56 | // should only later appointments be shown or all for the current day. | 56 | // should only later appointments be shown or all for the current day. |
57 | int m_only_later; | 57 | int m_only_later; |
58 | int m_more_days; | 58 | int m_more_days; |
59 | int m_maxCharClip; | ||
59 | 60 | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | 63 | ||
63 | #endif | 64 | #endif |
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui b/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui index 943e8ec..004204a 100644 --- a/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui +++ b/core/pim/today/plugins/datebook/datebookpluginconfigbase.ui | |||
@@ -1,115 +1,115 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>DatebookPluginConfigBase</class> | 2 | <class>DatebookPluginConfigBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>DatebookPluginConfigBase</cstring> | 7 | <cstring>DatebookPluginConfigBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>228</width> | 14 | <width>224</width> |
15 | <height>267</height> | 15 | <height>267</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>DatebookPluginConfigBase</string> | 20 | <string>DatebookPluginConfigBase</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>whatsThis</name> | 23 | <name>whatsThis</name> |
24 | <string></string> | 24 | <string></string> |
25 | </property> | 25 | </property> |
26 | <vbox> | 26 | <grid> |
27 | <property stdset="1"> | 27 | <property stdset="1"> |
28 | <name>margin</name> | 28 | <name>margin</name> |
29 | <number>11</number> | 29 | <number>11</number> |
30 | </property> | 30 | </property> |
31 | <property stdset="1"> | 31 | <property stdset="1"> |
32 | <name>spacing</name> | 32 | <name>spacing</name> |
33 | <number>6</number> | 33 | <number>6</number> |
34 | </property> | 34 | </property> |
35 | <widget> | 35 | <widget row="0" column="0" > |
36 | <class>QCheckBox</class> | 36 | <class>QCheckBox</class> |
37 | <property stdset="1"> | 37 | <property stdset="1"> |
38 | <name>name</name> | 38 | <name>name</name> |
39 | <cstring>CheckBox1</cstring> | 39 | <cstring>CheckBox1</cstring> |
40 | </property> | 40 | </property> |
41 | <property stdset="1"> | 41 | <property stdset="1"> |
42 | <name>text</name> | 42 | <name>text</name> |
43 | <string>Show location</string> | 43 | <string>Show location</string> |
44 | </property> | 44 | </property> |
45 | <property> | 45 | <property> |
46 | <name>whatsThis</name> | 46 | <name>whatsThis</name> |
47 | <string>Check this if the location of an appointment should be shown for each one</string> | 47 | <string>Check this if the location of an appointment should be shown for each one</string> |
48 | </property> | 48 | </property> |
49 | </widget> | 49 | </widget> |
50 | <widget> | 50 | <widget row="1" column="0" > |
51 | <class>QCheckBox</class> | 51 | <class>QCheckBox</class> |
52 | <property stdset="1"> | 52 | <property stdset="1"> |
53 | <name>name</name> | 53 | <name>name</name> |
54 | <cstring>CheckBox2</cstring> | 54 | <cstring>CheckBox2</cstring> |
55 | </property> | 55 | </property> |
56 | <property stdset="1"> | 56 | <property stdset="1"> |
57 | <name>text</name> | 57 | <name>text</name> |
58 | <string>Show notes</string> | 58 | <string>Show notes</string> |
59 | </property> | 59 | </property> |
60 | <property> | 60 | <property> |
61 | <name>whatsThis</name> | 61 | <name>whatsThis</name> |
62 | <string>Check this if the note attached to an appointment should be shown for each one</string> | 62 | <string>Check this if the note attached to an appointment should be shown for each one</string> |
63 | </property> | 63 | </property> |
64 | </widget> | 64 | </widget> |
65 | <widget> | 65 | <widget row="2" column="0" > |
66 | <class>QCheckBox</class> | 66 | <class>QCheckBox</class> |
67 | <property stdset="1"> | 67 | <property stdset="1"> |
68 | <name>name</name> | 68 | <name>name</name> |
69 | <cstring>CheckBox3</cstring> | 69 | <cstring>CheckBox3</cstring> |
70 | </property> | 70 | </property> |
71 | <property stdset="1"> | 71 | <property stdset="1"> |
72 | <name>text</name> | 72 | <name>text</name> |
73 | <string>Show only later appointments</string> | 73 | <string>Show only later appointments</string> |
74 | </property> | 74 | </property> |
75 | <property> | 75 | <property> |
76 | <name>whatsThis</name> | 76 | <name>whatsThis</name> |
77 | <string>Check this if only appointments later then current time should be shown</string> | 77 | <string>Check this if only appointments later then current time should be shown</string> |
78 | </property> | 78 | </property> |
79 | </widget> | 79 | </widget> |
80 | <widget> | 80 | <widget row="3" column="0" > |
81 | <class>QCheckBox</class> | 81 | <class>QCheckBox</class> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>name</name> | 83 | <name>name</name> |
84 | <cstring>CheckBox4</cstring> | 84 | <cstring>CheckBox4</cstring> |
85 | </property> | 85 | </property> |
86 | <property stdset="1"> | 86 | <property stdset="1"> |
87 | <name>text</name> | 87 | <name>text</name> |
88 | <string>Show time in extra line</string> | 88 | <string>Show time in extra line</string> |
89 | </property> | 89 | </property> |
90 | </widget> | 90 | </widget> |
91 | <widget> | 91 | <widget row="4" column="0" > |
92 | <class>QLayoutWidget</class> | 92 | <class>QLayoutWidget</class> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>name</name> | 94 | <name>name</name> |
95 | <cstring>Layout3</cstring> | 95 | <cstring>Layout3</cstring> |
96 | </property> | 96 | </property> |
97 | <hbox> | 97 | <hbox> |
98 | <property stdset="1"> | 98 | <property stdset="1"> |
99 | <name>margin</name> | 99 | <name>margin</name> |
100 | <number>0</number> | 100 | <number>0</number> |
101 | </property> | 101 | </property> |
102 | <property stdset="1"> | 102 | <property stdset="1"> |
103 | <name>spacing</name> | 103 | <name>spacing</name> |
104 | <number>6</number> | 104 | <number>6</number> |
105 | </property> | 105 | </property> |
106 | <widget> | 106 | <widget> |
107 | <class>QSpinBox</class> | 107 | <class>QSpinBox</class> |
108 | <property stdset="1"> | 108 | <property stdset="1"> |
109 | <name>name</name> | 109 | <name>name</name> |
110 | <cstring>SpinBox1</cstring> | 110 | <cstring>SpinBox1</cstring> |
111 | </property> | 111 | </property> |
112 | <property stdset="1"> | 112 | <property stdset="1"> |
113 | <name>maxValue</name> | 113 | <name>maxValue</name> |
114 | <number>10</number> | 114 | <number>10</number> |
115 | </property> | 115 | </property> |
@@ -117,49 +117,49 @@ | |||
117 | <name>whatsThis</name> | 117 | <name>whatsThis</name> |
118 | <string>How many appointments should be shown maximal. In chronical order</string> | 118 | <string>How many appointments should be shown maximal. In chronical order</string> |
119 | </property> | 119 | </property> |
120 | </widget> | 120 | </widget> |
121 | <widget> | 121 | <widget> |
122 | <class>QLabel</class> | 122 | <class>QLabel</class> |
123 | <property stdset="1"> | 123 | <property stdset="1"> |
124 | <name>name</name> | 124 | <name>name</name> |
125 | <cstring>TextLabel1</cstring> | 125 | <cstring>TextLabel1</cstring> |
126 | </property> | 126 | </property> |
127 | <property stdset="1"> | 127 | <property stdset="1"> |
128 | <name>text</name> | 128 | <name>text</name> |
129 | <string>How many appointment should be shown?</string> | 129 | <string>How many appointment should be shown?</string> |
130 | </property> | 130 | </property> |
131 | <property stdset="1"> | 131 | <property stdset="1"> |
132 | <name>alignment</name> | 132 | <name>alignment</name> |
133 | <set>WordBreak|AlignVCenter|AlignLeft</set> | 133 | <set>WordBreak|AlignVCenter|AlignLeft</set> |
134 | </property> | 134 | </property> |
135 | <property> | 135 | <property> |
136 | <name>wordwrap</name> | 136 | <name>wordwrap</name> |
137 | </property> | 137 | </property> |
138 | </widget> | 138 | </widget> |
139 | </hbox> | 139 | </hbox> |
140 | </widget> | 140 | </widget> |
141 | <widget> | 141 | <widget row="5" column="0" > |
142 | <class>QLayoutWidget</class> | 142 | <class>QLayoutWidget</class> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>name</name> | 144 | <name>name</name> |
145 | <cstring>Layout2</cstring> | 145 | <cstring>Layout2</cstring> |
146 | </property> | 146 | </property> |
147 | <hbox> | 147 | <hbox> |
148 | <property stdset="1"> | 148 | <property stdset="1"> |
149 | <name>margin</name> | 149 | <name>margin</name> |
150 | <number>0</number> | 150 | <number>0</number> |
151 | </property> | 151 | </property> |
152 | <property stdset="1"> | 152 | <property stdset="1"> |
153 | <name>spacing</name> | 153 | <name>spacing</name> |
154 | <number>6</number> | 154 | <number>6</number> |
155 | </property> | 155 | </property> |
156 | <widget> | 156 | <widget> |
157 | <class>QSpinBox</class> | 157 | <class>QSpinBox</class> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>name</name> | 159 | <name>name</name> |
160 | <cstring>SpinBox2</cstring> | 160 | <cstring>SpinBox2</cstring> |
161 | </property> | 161 | </property> |
162 | <property stdset="1"> | 162 | <property stdset="1"> |
163 | <name>specialValueText</name> | 163 | <name>specialValueText</name> |
164 | <string>only today</string> | 164 | <string>only today</string> |
165 | </property> | 165 | </property> |
@@ -171,48 +171,83 @@ | |||
171 | <name>whatsThis</name> | 171 | <name>whatsThis</name> |
172 | <string>How many more days should be in the range</string> | 172 | <string>How many more days should be in the range</string> |
173 | </property> | 173 | </property> |
174 | </widget> | 174 | </widget> |
175 | <widget> | 175 | <widget> |
176 | <class>QLabel</class> | 176 | <class>QLabel</class> |
177 | <property stdset="1"> | 177 | <property stdset="1"> |
178 | <name>name</name> | 178 | <name>name</name> |
179 | <cstring>TextLabel2</cstring> | 179 | <cstring>TextLabel2</cstring> |
180 | </property> | 180 | </property> |
181 | <property stdset="1"> | 181 | <property stdset="1"> |
182 | <name>text</name> | 182 | <name>text</name> |
183 | <string>How many more days</string> | 183 | <string>How many more days</string> |
184 | </property> | 184 | </property> |
185 | <property stdset="1"> | 185 | <property stdset="1"> |
186 | <name>alignment</name> | 186 | <name>alignment</name> |
187 | <set>WordBreak|AlignVCenter|AlignLeft</set> | 187 | <set>WordBreak|AlignVCenter|AlignLeft</set> |
188 | </property> | 188 | </property> |
189 | <property> | 189 | <property> |
190 | <name>wordwrap</name> | 190 | <name>wordwrap</name> |
191 | </property> | 191 | </property> |
192 | </widget> | 192 | </widget> |
193 | </hbox> | 193 | </hbox> |
194 | </widget> | 194 | </widget> |
195 | <spacer> | 195 | <widget row="6" column="0" > |
196 | <class>QLayoutWidget</class> | ||
197 | <property stdset="1"> | ||
198 | <name>name</name> | ||
199 | <cstring>Layout6</cstring> | ||
200 | </property> | ||
201 | <hbox> | ||
202 | <property stdset="1"> | ||
203 | <name>margin</name> | ||
204 | <number>0</number> | ||
205 | </property> | ||
206 | <property stdset="1"> | ||
207 | <name>spacing</name> | ||
208 | <number>6</number> | ||
209 | </property> | ||
210 | <widget> | ||
211 | <class>QSpinBox</class> | ||
212 | <property stdset="1"> | ||
213 | <name>name</name> | ||
214 | <cstring>SpinBox3</cstring> | ||
215 | </property> | ||
216 | </widget> | ||
217 | <widget> | ||
218 | <class>QLabel</class> | ||
219 | <property stdset="1"> | ||
220 | <name>name</name> | ||
221 | <cstring>TextLabel1_2</cstring> | ||
222 | </property> | ||
223 | <property stdset="1"> | ||
224 | <name>text</name> | ||
225 | <string>Clip line after X chars</string> | ||
226 | </property> | ||
227 | </widget> | ||
228 | </hbox> | ||
229 | </widget> | ||
230 | <spacer row="7" column="0" > | ||
196 | <property> | 231 | <property> |
197 | <name>name</name> | 232 | <name>name</name> |
198 | <cstring>Spacer2</cstring> | 233 | <cstring>Spacer2</cstring> |
199 | </property> | 234 | </property> |
200 | <property stdset="1"> | 235 | <property stdset="1"> |
201 | <name>orientation</name> | 236 | <name>orientation</name> |
202 | <enum>Vertical</enum> | 237 | <enum>Vertical</enum> |
203 | </property> | 238 | </property> |
204 | <property stdset="1"> | 239 | <property stdset="1"> |
205 | <name>sizeType</name> | 240 | <name>sizeType</name> |
206 | <enum>Expanding</enum> | 241 | <enum>Expanding</enum> |
207 | </property> | 242 | </property> |
208 | <property> | 243 | <property> |
209 | <name>sizeHint</name> | 244 | <name>sizeHint</name> |
210 | <size> | 245 | <size> |
211 | <width>20</width> | 246 | <width>20</width> |
212 | <height>20</height> | 247 | <height>20</height> |
213 | </size> | 248 | </size> |
214 | </property> | 249 | </property> |
215 | </spacer> | 250 | </spacer> |
216 | </vbox> | 251 | </grid> |
217 | </widget> | 252 | </widget> |
218 | </UI> | 253 | </UI> |
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp index 0820802..eb6d47a 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp | |||
@@ -33,91 +33,92 @@ DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) | |||
33 | m_layoutDates = new QVBoxLayout( this ); | 33 | m_layoutDates = new QVBoxLayout( this ); |
34 | m_layoutDates->setAutoAdd( true ); | 34 | m_layoutDates->setAutoAdd( true ); |
35 | 35 | ||
36 | m_eventsList.setAutoDelete( true ); | 36 | m_eventsList.setAutoDelete( true ); |
37 | 37 | ||
38 | readConfig(); | 38 | readConfig(); |
39 | getDates(); | 39 | getDates(); |
40 | } | 40 | } |
41 | 41 | ||
42 | DatebookPluginWidget::~DatebookPluginWidget() { | 42 | DatebookPluginWidget::~DatebookPluginWidget() { |
43 | delete db; | 43 | delete db; |
44 | delete m_layoutDates; | 44 | delete m_layoutDates; |
45 | } | 45 | } |
46 | 46 | ||
47 | 47 | ||
48 | void DatebookPluginWidget::readConfig() { | 48 | void DatebookPluginWidget::readConfig() { |
49 | Config cfg( "todaydatebookplugin" ); | 49 | Config cfg( "todaydatebookplugin" ); |
50 | cfg.setGroup( "config" ); | 50 | cfg.setGroup( "config" ); |
51 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); | 51 | m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); |
52 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); | 52 | m_show_location = cfg.readNumEntry( "showlocation", 1 ); |
53 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); | 53 | m_show_notes = cfg.readNumEntry( "shownotes", 0 ); |
54 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); | 54 | m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); |
55 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); | 55 | m_moreDays = cfg.readNumEntry( "moredays", 0 ); |
56 | m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); | 56 | m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); |
57 | m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | ||
57 | } | 58 | } |
58 | 59 | ||
59 | void DatebookPluginWidget::reinitialize() { | 60 | void DatebookPluginWidget::reinitialize() { |
60 | readConfig(); | 61 | readConfig(); |
61 | refresh(); | 62 | refresh(); |
62 | } | 63 | } |
63 | 64 | ||
64 | void DatebookPluginWidget::refresh() { | 65 | void DatebookPluginWidget::refresh() { |
65 | m_eventsList.clear(); | 66 | m_eventsList.clear(); |
66 | 67 | ||
67 | if ( m_layoutDates ) { | 68 | if ( m_layoutDates ) { |
68 | delete m_layoutDates; | 69 | delete m_layoutDates; |
69 | } | 70 | } |
70 | m_layoutDates = new QVBoxLayout( this ); | 71 | m_layoutDates = new QVBoxLayout( this ); |
71 | m_layoutDates->setAutoAdd( true ); | 72 | m_layoutDates->setAutoAdd( true ); |
72 | 73 | ||
73 | getDates(); | 74 | getDates(); |
74 | } | 75 | } |
75 | 76 | ||
76 | /** | 77 | /** |
77 | * Get all events that are in the datebook xml file for today | 78 | * Get all events that are in the datebook xml file for today |
78 | */ | 79 | */ |
79 | void DatebookPluginWidget::getDates() { | 80 | void DatebookPluginWidget::getDates() { |
80 | 81 | ||
81 | 82 | ||
82 | if ( db ) { | 83 | if ( db ) { |
83 | delete db; | 84 | delete db; |
84 | } | 85 | } |
85 | db = new DateBookDB; | 86 | db = new DateBookDB; |
86 | 87 | ||
87 | QDate date = QDate::currentDate(); | 88 | QDate date = QDate::currentDate(); |
88 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); | 89 | QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); |
89 | qBubbleSort( list ); | 90 | qBubbleSort( list ); |
90 | int count = 0; | 91 | int count = 0; |
91 | 92 | ||
92 | if ( list.count() > 0 ) { | 93 | if ( list.count() > 0 ) { |
93 | 94 | ||
94 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { | 95 | for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { |
95 | 96 | ||
96 | if ( count < m_max_lines_meet ) { | 97 | if ( count < m_max_lines_meet ) { |
97 | if ( !m_onlyLater ) { | 98 | if ( !m_onlyLater ) { |
98 | count++; | 99 | count++; |
99 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); | 100 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine, m_maxCharClip ); |
100 | m_eventsList.append( l ); | 101 | m_eventsList.append( l ); |
101 | l->show(); | 102 | l->show(); |
102 | QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) ); | 103 | QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) ); |
103 | } else { | 104 | } else { |
104 | if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) | 105 | if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) |
105 | // Show events which span over many days and are not elapsed. | 106 | // Show events which span over many days and are not elapsed. |
106 | || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) | 107 | || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) |
107 | // Show repeated event for today that is not elapsed. | 108 | // Show repeated event for today that is not elapsed. |
108 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) | 109 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) |
109 | && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) | 110 | && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) |
110 | && ( QTime::currentTime() < (*it).event().start().time() ) ) ) | 111 | && ( QTime::currentTime() < (*it).event().start().time() ) ) ) |
111 | // Show repeated event for next days. | 112 | // Show repeated event for next days. |
112 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) | 113 | || ( ( (*it).event().repeatType() != Event::NoRepeat ) |
113 | && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) | 114 | && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) |
114 | ) | 115 | ) |
115 | { | 116 | { |
116 | count++; | 117 | count++; |
117 | // show only later appointments | 118 | // show only later appointments |
118 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); | 119 | DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); |
119 | m_eventsList.append( l ); | 120 | m_eventsList.append( l ); |
120 | l->show(); | 121 | l->show(); |
121 | QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) ); | 122 | QObject::connect ( l, SIGNAL( editEvent(const Event&) ), l, SLOT( editEventSlot(const Event&) ) ); |
122 | } | 123 | } |
123 | } | 124 | } |
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h index f8ed89e..65e060e 100644 --- a/core/pim/today/plugins/datebook/datebookpluginwidget.h +++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h | |||
@@ -36,27 +36,29 @@ public: | |||
36 | DatebookPluginWidget( QWidget *parent, const char *name ); | 36 | DatebookPluginWidget( QWidget *parent, const char *name ); |
37 | ~DatebookPluginWidget(); | 37 | ~DatebookPluginWidget(); |
38 | void refresh(); | 38 | void refresh(); |
39 | void reinitialize(); | 39 | void reinitialize(); |
40 | 40 | ||
41 | private: | 41 | private: |
42 | DateBookDB* db; | 42 | DateBookDB* db; |
43 | QGuardedPtr<QVBoxLayout> m_layoutDates; | 43 | QGuardedPtr<QVBoxLayout> m_layoutDates; |
44 | QList<QWidget> m_eventsList; | 44 | QList<QWidget> m_eventsList; |
45 | void readConfig(); | 45 | void readConfig(); |
46 | void getDates(); | 46 | void getDates(); |
47 | 47 | ||
48 | 48 | ||
49 | // how many lines should be showed in the datebook section | 49 | // how many lines should be showed in the datebook section |
50 | int m_max_lines_meet; | 50 | int m_max_lines_meet; |
51 | // If location is to be showed too, 1 to activate it. | 51 | // If location is to be showed too, 1 to activate it. |
52 | bool m_show_location; | 52 | bool m_show_location; |
53 | // if notes should be shown | 53 | // if notes should be shown |
54 | bool m_show_notes; | 54 | bool m_show_notes; |
55 | // should only later appointments be shown or all for the current day. | 55 | // should only later appointments be shown or all for the current day. |
56 | bool m_onlyLater; | 56 | bool m_onlyLater; |
57 | int m_moreDays; | 57 | int m_moreDays; |
58 | // true if time of an appointment should be an extra line | 58 | // true if time of an appointment should be an extra line |
59 | bool m_timeExtraLine; | 59 | bool m_timeExtraLine; |
60 | //max characters displayed in notes | ||
61 | int m_maxCharClip; | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | #endif | 64 | #endif |