-rw-r--r-- | core/pim/today/today.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 58ba4f4..aef0a9b 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -71,8 +71,8 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
71 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); | 71 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); |
72 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 72 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
73 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); | 73 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); |
74 | #endif | 74 | #endif |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | setOwnerField(); | 77 | setOwnerField(); |
78 | todo = new ToDoDB; | 78 | todo = new ToDoDB; |
@@ -146,24 +146,25 @@ void Today::draw() { | |||
146 | 146 | ||
147 | // if the todolist.xml file was not modified in between, do not parse it. | 147 | // if the todolist.xml file was not modified in between, do not parse it. |
148 | if (checkIfModified()) { | 148 | if (checkIfModified()) { |
149 | if (todo) delete todo; | ||
149 | todo = new ToDoDB; | 150 | todo = new ToDoDB; |
150 | getTodo(); | 151 | getTodo(); |
151 | } | 152 | } |
152 | 153 | ||
153 | // how often refresh | 154 | // how often refresh |
154 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); | 155 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); |
155 | } | 156 | } |
156 | 157 | ||
157 | /* | 158 | /* |
158 | * Check if the todolist.xml was modified (if there are new entries. | 159 | * Check if the todolist.xml was modified (if there are new entries. |
159 | * Returns true if it was modified. | 160 | * Returns true if it was modified. |
160 | */ | 161 | */ |
161 | bool Today::checkIfModified() { | 162 | bool Today::checkIfModified() { |
162 | 163 | ||
163 | QDir dir; | 164 | QDir dir; |
164 | QString homedir = dir.homeDirPath (); | 165 | QString homedir = dir.homeDirPath (); |
165 | QString time; | 166 | QString time; |
166 | 167 | ||
167 | Config cfg("today"); | 168 | Config cfg("today"); |
168 | cfg.setGroup("Files"); | 169 | cfg.setGroup("Files"); |
169 | time = cfg.readEntry("todolisttimestamp", ""); | 170 | time = cfg.readEntry("todolisttimestamp", ""); |
@@ -174,7 +175,7 @@ bool Today::checkIfModified() { | |||
174 | return false; | 175 | return false; |
175 | } else { | 176 | } else { |
176 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); | 177 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); |
177 | cfg.write(); | 178 | cfg.write(); |
178 | return true; | 179 | return true; |
179 | } | 180 | } |
180 | } | 181 | } |
@@ -186,13 +187,13 @@ bool Today::checkIfModified() { | |||
186 | void Today::init() { | 187 | void Today::init() { |
187 | QDate date = QDate::currentDate(); | 188 | QDate date = QDate::currentDate(); |
188 | QString time = (tr( date.toString()) ); | 189 | QString time = (tr( date.toString()) ); |
189 | 190 | ||
190 | TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); | 191 | TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); |
191 | 192 | ||
192 | // read config | 193 | // read config |
193 | Config cfg("today"); | 194 | Config cfg("today"); |
194 | cfg.setGroup("BaseConfig"); | 195 | cfg.setGroup("BaseConfig"); |
195 | 196 | ||
196 | // -- config file section -- | 197 | // -- config file section -- |
197 | // how many lines should be showed in the task section | 198 | // how many lines should be showed in the task section |
198 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); | 199 | MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); |
@@ -202,7 +203,7 @@ void Today::init() { | |||
202 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); | 203 | MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); |
203 | // If location is to be showed too, 1 to activate it. | 204 | // If location is to be showed too, 1 to activate it. |
204 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); | 205 | SHOW_LOCATION = cfg.readNumEntry("showlocation",1); |
205 | // if notes should be shown | 206 | // if notes should be shown |
206 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); | 207 | SHOW_NOTES = cfg.readNumEntry("shownotes",0); |
207 | // should only later appointments be shown or all for the current day. | 208 | // should only later appointments be shown or all for the current day. |
208 | ONLY_LATER = cfg.readNumEntry("onlylater",1); | 209 | ONLY_LATER = cfg.readNumEntry("onlylater",1); |
@@ -268,7 +269,7 @@ void Today::startConfig() { | |||
268 | */ | 269 | */ |
269 | void Today::getDates() { | 270 | void Today::getDates() { |
270 | QDate date = QDate::currentDate(); | 271 | QDate date = QDate::currentDate(); |
271 | 272 | ||
272 | if (AllDateBookEvents) delete AllDateBookEvents; | 273 | if (AllDateBookEvents) delete AllDateBookEvents; |
273 | AllDateBookEvents = new QWidget( ); | 274 | AllDateBookEvents = new QWidget( ); |
274 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); | 275 | QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); |