summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-04-13 17:32:22 (UTC)
committer harlekin <harlekin>2002-04-13 17:32:22 (UTC)
commit4964c6a97eff0ab98b21c3942c8598be4739c74c (patch) (unidiff)
tree57e8f01eaa7d32d83b00a914dc87584c48ae4ade
parent74ca4fc34f8634c39b12a60ae97df88a612c12b1 (diff)
downloadopie-4964c6a97eff0ab98b21c3942c8598be4739c74c.zip
opie-4964c6a97eff0ab98b21c3942c8598be4739c74c.tar.gz
opie-4964c6a97eff0ab98b21c3942c8598be4739c74c.tar.bz2
i18n fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/today.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 6dac6d9..61bd0c4 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,303 +1,303 @@
1/* 1/*
2 * today.cpp : main class 2 * today.cpp : main class
3 * 3 *
4 * --------------------- 4 * ---------------------
5 * 5 *
6 * begin : Sun 10 17:20:00 CEST 2002 6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß 7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de 8 * email : max.reiss@gmx.de
9 * 9 *
10 */ 10 */
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19 19
20#include "today.h" 20#include "today.h"
21 21
22#include <qpe/timestring.h> 22#include <qpe/timestring.h>
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/qprocess.h> 25#include <qpe/qprocess.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/contact.h> 27#include <qpe/contact.h>
28#include <qpe/global.h> 28#include <qpe/global.h>
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30 30
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qdatetime.h> 33#include <qdatetime.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35#include <qcheckbox.h> 35#include <qcheckbox.h>
36#include <qspinbox.h> 36#include <qspinbox.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qtimer.h> 39#include <qtimer.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qfileinfo.h> 41#include <qfileinfo.h>
42#include <qlayout.h> 42#include <qlayout.h>
43#include <qtl.h> 43#include <qtl.h>
44 44
45//#include <iostream.h> 45//#include <iostream.h>
46#include <unistd.h> 46#include <unistd.h>
47#include <stdlib.h> 47#include <stdlib.h>
48 48
49int MAX_LINES_TASK; 49int MAX_LINES_TASK;
50int MAX_CHAR_CLIP; 50int MAX_CHAR_CLIP;
51int MAX_LINES_MEET; 51int MAX_LINES_MEET;
52int SHOW_LOCATION; 52int SHOW_LOCATION;
53int SHOW_NOTES; 53int SHOW_NOTES;
54// show only later dates 54// show only later dates
55int ONLY_LATER; 55int ONLY_LATER;
56int AUTOSTART; 56int AUTOSTART;
57int NEW_START=1; 57int NEW_START=1;
58 58
59/* 59/*
60 * Constructs a Example which is a child of 'parent', with the 60 * Constructs a Example which is a child of 'parent', with the
61 * name 'name' and widget flags set to 'f' 61 * name 'name' and widget flags set to 'f'
62 */ 62 */
63Today::Today( QWidget* parent, const char* name, WFlags fl ) 63Today::Today( QWidget* parent, const char* name, WFlags fl )
64 : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { 64 : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) {
65 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); 65 QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) );
66 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); 66 QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) );
67 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); 67 QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) );
68 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); 68 QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) );
69 69
70#if defined(Q_WS_QWS) 70#if defined(Q_WS_QWS)
71#if !defined(QT_NO_COP) 71#if !defined(QT_NO_COP)
72 QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); 72 QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this );
73 connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), 73 connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)),
74 this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); 74 this, SLOT ( channelReceived(const QCString &, const QByteArray &)) );
75#endif 75#endif
76#endif 76#endif
77 77
78 78
79 79
80 db = NULL; 80 db = NULL;
81 setOwnerField(); 81 setOwnerField();
82 todo = new ToDoDB; 82 todo = new ToDoDB;
83 getTodo(); 83 getTodo();
84 draw(); 84 draw();
85 autoStart(); 85 autoStart();
86} 86}
87 87
88/* 88/*
89 * Qcop receive method. 89 * Qcop receive method.
90 */ 90 */
91void Today::channelReceived(const QCString &msg, const QByteArray & data) { 91void Today::channelReceived(const QCString &msg, const QByteArray & data) {
92 QDataStream stream(data, IO_ReadOnly ); 92 QDataStream stream(data, IO_ReadOnly );
93 if ( msg == "message(QString)" ) { 93 if ( msg == "message(QString)" ) {
94 QString message; 94 QString message;
95 stream >> message; 95 stream >> message;
96 setOwnerField(message); 96 setOwnerField(message);
97 } 97 }
98 98
99} 99}
100 100
101/* 101/*
102 * Initialises the owner field with the default value, the username 102 * Initialises the owner field with the default value, the username
103 */ 103 */
104void Today::setOwnerField() { 104void Today::setOwnerField() {
105 QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); 105 QString file = Global::applicationFileName("addressbook", "businesscard.vcf");
106 if (QFile::exists(file)) { 106 if (QFile::exists(file)) {
107 Contact cont = Contact::readVCard(file)[0]; 107 Contact cont = Contact::readVCard(file)[0];
108 QString returnString = cont.fullName(); 108 QString returnString = cont.fullName();
109 OwnerField->setText( tr ("<b>Owned by " + returnString + "</b>")); 109 OwnerField->setText( "<b>" +tr ("Owned by ") + returnString + "</b>");
110 } else { 110 } else {
111 OwnerField->setText( tr ("<b>Please fill out the business card </b>")); 111 OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>");
112 } 112 }
113} 113}
114 114
115/* 115/*
116 * Set the owner field with a given QString, for example per qcop. 116 * Set the owner field with a given QString, for example per qcop.
117 */ 117 */
118void Today::setOwnerField(QString &message) { 118void Today::setOwnerField(QString &message) {
119 if (!message.isEmpty()) { 119 if (!message.isEmpty()) {
120 OwnerField->setText("<b>" + message + "</b>"); 120 OwnerField->setText("<b>" + message + "</b>");
121 } 121 }
122} 122}
123 123
124/* 124/*
125 * Autostart, uses the new (opie only) autostart method in the launcher code. 125 * Autostart, uses the new (opie only) autostart method in the launcher code.
126 * If registered against that today ist started on each resume. 126 * If registered against that today ist started on each resume.
127 */ 127 */
128void Today::autoStart() { 128void Today::autoStart() {
129 Config cfg("today"); 129 Config cfg("today");
130 cfg.setGroup("Autostart"); 130 cfg.setGroup("Autostart");
131 AUTOSTART = cfg.readNumEntry("autostart",1); 131 AUTOSTART = cfg.readNumEntry("autostart",1);
132 if (AUTOSTART) { 132 if (AUTOSTART) {
133 QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); 133 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
134 e << QString("add"); 134 e << QString("add");
135 e << QString("today"); 135 e << QString("today");
136 } else { 136 } else {
137 QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); 137 QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
138 e << QString("remove"); 138 e << QString("remove");
139 e << QString("today"); 139 e << QString("today");
140 } 140 }
141} 141}
142 142
143/* 143/*
144 * Repaint method. Reread all fields. 144 * Repaint method. Reread all fields.
145 */ 145 */
146void Today::draw() { 146void Today::draw() {
147 init(); 147 init();
148 getDates(); 148 getDates();
149 getMail(); 149 getMail();
150 150
151 // if the todolist.xml file was not modified in between, do not parse it. 151 // if the todolist.xml file was not modified in between, do not parse it.
152 if (checkIfModified()) { 152 if (checkIfModified()) {
153 if (todo) delete todo; 153 if (todo) delete todo;
154 todo = new ToDoDB; 154 todo = new ToDoDB;
155 getTodo(); 155 getTodo();
156 } 156 }
157 157
158 // how often refresh 158 // how often refresh
159 QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); 159 QTimer::singleShot( 20*1000, this, SLOT(draw() ) );
160} 160}
161 161
162/* 162/*
163 * Check if the todolist.xml was modified (if there are new entries. 163 * Check if the todolist.xml was modified (if there are new entries.
164 * Returns true if it was modified. 164 * Returns true if it was modified.
165 */ 165 */
166bool Today::checkIfModified() { 166bool Today::checkIfModified() {
167 167
168 QDir dir; 168 QDir dir;
169 QString homedir = dir.homeDirPath (); 169 QString homedir = dir.homeDirPath ();
170 QString time; 170 QString time;
171 171
172 Config cfg("today"); 172 Config cfg("today");
173 cfg.setGroup("Files"); 173 cfg.setGroup("Files");
174 time = cfg.readEntry("todolisttimestamp", ""); 174 time = cfg.readEntry("todolisttimestamp", "");
175 175
176 QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); 176 QFileInfo file = (homedir +"/Applications/todolist/todolist.xml");
177 QDateTime fileTime = file.lastModified(); 177 QDateTime fileTime = file.lastModified();
178 if (time.compare(fileTime.toString()) == 0) { 178 if (time.compare(fileTime.toString()) == 0) {
179 return false; 179 return false;
180 } else { 180 } else {
181 cfg.writeEntry("todolisttimestamp", fileTime.toString() ); 181 cfg.writeEntry("todolisttimestamp", fileTime.toString() );
182 cfg.write(); 182 cfg.write();
183 return true; 183 return true;
184 } 184 }
185} 185}
186 186
187 187
188/* 188/*
189 * Init stuff needed for today. Reads the config file. 189 * Init stuff needed for today. Reads the config file.
190 */ 190 */
191void Today::init() { 191void Today::init() {
192 QDate date = QDate::currentDate(); 192 QDate date = QDate::currentDate();
193 QString time = (tr( date.toString()) ); 193 QString time = (tr( date.toString()) );
194 194
195 TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); 195 TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>"));
196 196
197 // read config 197 // read config
198 Config cfg("today"); 198 Config cfg("today");
199 cfg.setGroup("BaseConfig"); 199 cfg.setGroup("BaseConfig");
200 200
201 // -- config file section -- 201 // -- config file section --
202 // how many lines should be showed in the task section 202 // how many lines should be showed in the task section
203 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); 203 MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5);
204 // after how many chars should the be cut off on tasks and notes 204 // after how many chars should the be cut off on tasks and notes
205 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); 205 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40);
206 // how many lines should be showed in the datebook section 206 // how many lines should be showed in the datebook section
207 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); 207 MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5);
208 // If location is to be showed too, 1 to activate it. 208 // If location is to be showed too, 1 to activate it.
209 SHOW_LOCATION = cfg.readNumEntry("showlocation",1); 209 SHOW_LOCATION = cfg.readNumEntry("showlocation",1);
210 // if notes should be shown 210 // if notes should be shown
211 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 211 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
212 // should only later appointments be shown or all for the current day. 212 // should only later appointments be shown or all for the current day.
213 ONLY_LATER = cfg.readNumEntry("onlylater",1); 213 ONLY_LATER = cfg.readNumEntry("onlylater",1);
214 214
215 //db = new DateBookDB; 215 //db = new DateBookDB;
216} 216}
217 217
218/* 218/*
219 * The method for the configuration dialog. 219 * The method for the configuration dialog.
220 */ 220 */
221void Today::startConfig() { 221void Today::startConfig() {
222 222
223 conf = new todayconfig ( this, "", true ); 223 conf = new todayconfig ( this, "", true );
224 // read the config 224 // read the config
225 Config cfg("today"); 225 Config cfg("today");
226 cfg.setGroup("BaseConfig"); 226 cfg.setGroup("BaseConfig");
227 227
228 //init(); 228 //init();
229 229
230 conf->SpinBox1->setValue(MAX_LINES_MEET); 230 conf->SpinBox1->setValue(MAX_LINES_MEET);
231 // location show box 231 // location show box
232 conf->CheckBox1->setChecked(SHOW_LOCATION); 232 conf->CheckBox1->setChecked(SHOW_LOCATION);
233 // notes show box 233 // notes show box
234 conf->CheckBox2->setChecked(SHOW_NOTES); 234 conf->CheckBox2->setChecked(SHOW_NOTES);
235 // task lines 235 // task lines
236 conf->SpinBox2->setValue(MAX_LINES_TASK); 236 conf->SpinBox2->setValue(MAX_LINES_TASK);
237 // clip when? 237 // clip when?
238 conf->SpinBox7->setValue(MAX_CHAR_CLIP); 238 conf->SpinBox7->setValue(MAX_CHAR_CLIP);
239 // only later 239 // only later
240 conf->CheckBox3->setChecked(ONLY_LATER); 240 conf->CheckBox3->setChecked(ONLY_LATER);
241 // if today should be autostarted 241 // if today should be autostarted
242 conf->CheckBoxAuto->setChecked(AUTOSTART); 242 conf->CheckBoxAuto->setChecked(AUTOSTART);
243 243
244 conf->exec(); 244 conf->exec();
245 245
246 int maxlinestask = conf->SpinBox2->value(); 246 int maxlinestask = conf->SpinBox2->value();
247 int maxmeet = conf->SpinBox1->value(); 247 int maxmeet = conf->SpinBox1->value();
248 int location = conf->CheckBox1->isChecked(); 248 int location = conf->CheckBox1->isChecked();
249 int notes = conf->CheckBox2->isChecked(); 249 int notes = conf->CheckBox2->isChecked();
250 int maxcharclip = conf->SpinBox7->value(); 250 int maxcharclip = conf->SpinBox7->value();
251 int onlylater = conf->CheckBox3->isChecked(); 251 int onlylater = conf->CheckBox3->isChecked();
252 int autostart =conf->CheckBoxAuto->isChecked(); 252 int autostart =conf->CheckBoxAuto->isChecked();
253 253
254 cfg.writeEntry("maxlinestask",maxlinestask); 254 cfg.writeEntry("maxlinestask",maxlinestask);
255 cfg.writeEntry("maxcharclip", maxcharclip); 255 cfg.writeEntry("maxcharclip", maxcharclip);
256 cfg.writeEntry("maxlinesmeet",maxmeet); 256 cfg.writeEntry("maxlinesmeet",maxmeet);
257 cfg.writeEntry("showlocation",location); 257 cfg.writeEntry("showlocation",location);
258 cfg.writeEntry("shownotes", notes); 258 cfg.writeEntry("shownotes", notes);
259 cfg.writeEntry("onlylater", onlylater); 259 cfg.writeEntry("onlylater", onlylater);
260 cfg.setGroup("Autostart"); 260 cfg.setGroup("Autostart");
261 cfg.writeEntry("autostart", autostart); 261 cfg.writeEntry("autostart", autostart);
262 262
263 // sync it to "disk" 263 // sync it to "disk"
264 cfg.write(); 264 cfg.write();
265 NEW_START=1; 265 NEW_START=1;
266 draw(); 266 draw();
267 autoStart(); 267 autoStart();
268} 268}
269 269
270 270
271/* 271/*
272 * Get all events that are in the datebook xml file for today 272 * Get all events that are in the datebook xml file for today
273 */ 273 */
274void Today::getDates() { 274void Today::getDates() {
275 QDate date = QDate::currentDate(); 275 QDate date = QDate::currentDate();
276 276
277 if (AllDateBookEvents) delete AllDateBookEvents; 277 if (AllDateBookEvents) delete AllDateBookEvents;
278 AllDateBookEvents = new QWidget( ); 278 AllDateBookEvents = new QWidget( );
279 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); 279 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents);
280 280
281 if (db) { 281 if (db) {
282 delete db; 282 delete db;
283 } 283 }
284 db = new DateBookDB; 284 db = new DateBookDB;
285 285
286 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 286 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
287 287
288 qBubbleSort(list); 288 qBubbleSort(list);
289 // printf("Get dates\n"); 289 // printf("Get dates\n");
290 290
291 Config config( "qpe" ); 291 Config config( "qpe" );
292 // if 24 h format 292 // if 24 h format
293 //bool ampm = config.readBoolEntry( "AMPM", TRUE ); 293 //bool ampm = config.readBoolEntry( "AMPM", TRUE );
294 294
295 int count=0; 295 int count=0;
296 296
297 if ( list.count() > 0 ) { 297 if ( list.count() > 0 ) {
298 298
299 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); 299 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin();
300 it!=list.end(); ++it ) { 300 it!=list.end(); ++it ) {
301 301
302 302
303 if ( count <= MAX_LINES_MEET ) { 303 if ( count <= MAX_LINES_MEET ) {