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
@@ -13,195 +13,195 @@
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);