summaryrefslogtreecommitdiff
path: root/core
authorharlekin <harlekin>2002-03-11 15:05:28 (UTC)
committer harlekin <harlekin>2002-03-11 15:05:28 (UTC)
commit07177b1aa8b5c6979fe06874da903a9d17debb65 (patch) (unidiff)
tree3cd6fef4b53355e861ae1d3db923c9ee92436a47 /core
parentcb57d1df6804ab3739f96ba1881ffc8110e3caa9 (diff)
downloadopie-07177b1aa8b5c6979fe06874da903a9d17debb65.zip
opie-07177b1aa8b5c6979fe06874da903a9d17debb65.tar.gz
opie-07177b1aa8b5c6979fe06874da903a9d17debb65.tar.bz2
some new features like clickable appointments, but not connected to datebook yet
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/TODO11
-rw-r--r--core/pim/today/changelog4
-rw-r--r--core/pim/today/today.cpp159
-rw-r--r--core/pim/today/today.h25
-rw-r--r--core/pim/today/today.pro5
-rw-r--r--core/pim/today/todaybase.cpp16
-rw-r--r--core/pim/today/todaybase.h6
-rw-r--r--core/pim/today/todayconfig.h2
8 files changed, 147 insertions, 81 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO
index 5876e2b..a3b01d2 100644
--- a/core/pim/today/TODO
+++ b/core/pim/today/TODO
@@ -1,13 +1,14 @@
1TODO for today: 1TODO for today:
2 2
3* start the app on "resume" 3* start the app on "resume" (partly done)
4 4
5* show alarm icons on alarm events 5* show alarm icons on alarm events (partly done)
6 6
7* add am/pm mode instead of 24 h, take system default 7* add am/pm mode instead of 24 h, take system default
8 8
9 * fix 23 pm bug (done??)
10
11* qcop integration for updating events? 9* qcop integration for updating events?
12 10
13* sort todos by pri. \ No newline at end of file 11* sort todos by pri.
12
13* make Opiezilla a clickable label wich is allway on the far right side of
14the screen , klick will open credits ,) \ No newline at end of file
diff --git a/core/pim/today/changelog b/core/pim/today/changelog
index 7111154..333326d 100644
--- a/core/pim/today/changelog
+++ b/core/pim/today/changelog
@@ -1,3 +1,7 @@
1
2* Appointments are now clickable (connection to datebook still missing)
3* autostart support (opie only)
4
10.2.7 50.2.7
2 6
3* check if todolist.xml was changed before parsing it 7* check if todolist.xml was changed before parsing it
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index d715fc1..69bcb68 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -39,12 +39,14 @@
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 43
43//#include <iostream.h> 44//#include <iostream.h>
44//#include <unistd.h> 45//#include <unistd.h>
45#include <stdlib.h> 46#include <stdlib.h>
46 47
47 48
49
48int MAX_LINES_TASK; 50int MAX_LINES_TASK;
49int MAX_CHAR_CLIP; 51int MAX_CHAR_CLIP;
50int MAX_LINES_MEET; 52int MAX_LINES_MEET;
@@ -53,6 +55,8 @@ int SHOW_NOTES;
53// show only later dates 55// show only later dates
54int ONLY_LATER; 56int ONLY_LATER;
55int AUTOSTART; 57int AUTOSTART;
58
59int NEW_START=1;
56/* 60/*
57 * Constructs a Example which is a child of 'parent', with the 61 * Constructs a Example which is a child of 'parent', with the
58 * name 'name' and widget flags set to 'f' 62 * name 'name' and widget flags set to 'f'
@@ -69,7 +73,6 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
69 draw(); 73 draw();
70} 74}
71 75
72
73void Today::autoStart() { 76void Today::autoStart() {
74 Config cfg("today"); 77 Config cfg("today");
75 cfg.setGroup("Autostart"); 78 cfg.setGroup("Autostart");
@@ -203,7 +206,10 @@ void Today::startConfig() {
203 */ 206 */
204void Today::getDates() { 207void Today::getDates() {
205 QDate date = QDate::currentDate(); 208 QDate date = QDate::currentDate();
206 QTime time = QTime::currentTime(); 209 QWidget* AllDateBookEvents = new QWidget( );
210 QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents);
211 //QTime time = QTime::currentTime();
212
207 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); 213 QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date);
208 214
209 Config config( "qpe" ); 215 Config config( "qpe" );
@@ -221,68 +227,25 @@ void Today::getDates() {
221 count++; 227 count++;
222 228
223 if ( count <= MAX_LINES_MEET ) { 229 if ( count <= MAX_LINES_MEET ) {
224 //cout << time.toString() << endl; 230
225 //cout << TimeString::dateString((*it).event().end()) << endl; 231
226 232 DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents);
227 // decide if to get all day or only later appointments 233 layoutDates->addWidget(l);
228 if (!ONLY_LATER) { 234 connect (l, SIGNAL(editEvent(const Event &)),
229 msg += "<B>" + (*it).description() + "</B>"; 235 this, SIGNAL(editEvent(const Event &)));
230 if ( (*it).event().hasAlarm() ) {
231 msg += " <b>[with alarm]</b>";
232 }
233 // include location or not
234 if (SHOW_LOCATION == 1) {
235 msg += "<BR><i>" + (*it).location();
236 msg += "</i>";
237 }
238
239 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
240 msg += "<br>All day";
241 } else {
242 // start time of event
243 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
244 // end time of event
245 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
246 }
247 msg += "<BR>";
248 // include possible note or not
249 if (SHOW_NOTES == 1) {
250 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
251 }
252 } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) {
253 msg += "<B>" + (*it).description() + "</B>";
254 if ( (*it).event().hasAlarm() ) {
255 msg += " <b>[with alarm]</b>";
256 }
257 // include location or not
258 if (SHOW_LOCATION == 1) {
259 msg+= "<BR><i>" + (*it).location();
260 msg += "</i>";
261 }
262
263 if ( (TimeString::timeString(QTime((*it).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((*it).event().end().time()) ) == "23:59") ) {
264 msg += "<br>All day";
265 } else {
266 // start time of event
267 msg += "<br>" + TimeString::timeString(QTime((*it).event().start().time()) )
268 // end time of event
269 + "<b> - </b>" + TimeString::timeString(QTime((*it).event().end().time()) );
270 }
271 msg += "<BR>";
272 // include possible note or not
273 if (SHOW_NOTES == 1) {
274 msg += " <i>note</i>:" +((*it).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
275 }
276 }
277 } 236 }
278 } 237
279 if (msg.isEmpty()) { 238 }
280 msg = tr("No more appointments today"); 239 layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding));
281 } 240 sv1->addChild(AllDateBookEvents);
282 DatesField->setText(msg); 241
242 //if (msg.isEmpty()) {
243 // msg = tr("No more appointments today");
244 //}
245 //DatesField->setText(msg);
283 } 246 }
284} 247}
285 248
286/* 249/*
287 * Parse in the todolist.xml 250 * Parse in the todolist.xml
288 */ 251 */
@@ -371,9 +334,10 @@ void Today::getMail() {
371void Today::getTodo() { 334void Today::getTodo() {
372 335
373 // if the todolist.xml file was not modified in between, do not parse it. 336 // if the todolist.xml file was not modified in between, do not parse it.
374 if (!checkIfModified()) { 337 if (!checkIfModified() && !NEW_START) {
375 return; 338 return;
376 } 339 }
340 NEW_START=0;
377 341
378 QString output; 342 QString output;
379 QString tmpout; 343 QString tmpout;
@@ -441,3 +405,74 @@ void Today::startMail() {
441Today::~Today() { 405Today::~Today() {
442 // no need to delete child widgets, Qt does it all for us 406 // no need to delete child widgets, Qt does it all for us
443} 407}
408
409
410DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
411 QWidget* parent = 0,
412 const char* name = 0,
413 WFlags fl = 0) :
414 ClickableLabel(parent,name,fl), event(ev) {
415
416 QString msg;
417 QTime time = QTime::currentTime();
418
419 if (!ONLY_LATER) {
420 msg += "<B>" + (ev).description() + "</B>";
421 if ( (ev).event().hasAlarm() ) {
422 msg += " <b>[with alarm]</b>";
423 }
424 // include location or not
425 if (SHOW_LOCATION == 1) {
426 msg += "<BR><i>" + (ev).location();
427 msg += "</i>";
428 }
429
430 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
431 msg += "<br>All day";
432 } else {
433 // start time of event
434 msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) )
435 // end time of event
436 + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) );
437 }
438 msg += "<BR>";
439 // include possible note or not
440 if (SHOW_NOTES == 1) {
441 msg += " <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
442 }
443 } else if ((time.toString() <= TimeString::dateString((ev).event().end())) ) {
444 msg += "<B>" + (ev).description() + "</B>";
445 if ( (ev).event().hasAlarm() ) {
446 msg += " <b>[with alarm]</b>";
447 }
448 // include location or not
449 if (SHOW_LOCATION == 1) {
450 msg+= "<BR><i>" + (ev).location();
451 msg += "</i>";
452 }
453
454 if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) {
455 msg += "<br>All day";
456 } else {
457 // start time of event
458 msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) )
459 // end time of event
460 + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) );
461 }
462 // include possible note or not
463 if (SHOW_NOTES == 1) {
464 msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>";
465 }
466 }
467
468 setText(msg);
469 connect(this, SIGNAL(clicked()), this, SLOT(editMe()));
470 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
471}
472
473void DateBookEvent::editMe() {
474 emit editEvent(event.event());
475}
476
477
478
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index b3b7d01..0a0837c 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -20,17 +20,21 @@
20 20
21#ifndef TODAY_H 21#ifndef TODAY_H
22#define TODAY_H 22#define TODAY_H
23#include "todaybase.h"
24 23
25#include <qpe/datebookdb.h> 24#include <qpe/datebookdb.h>
25#include <qpe/event.h>
26 26
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlist.h> 28#include <qlist.h>
29
29#include "TodoItem.h" 30#include "TodoItem.h"
30#include "todayconfig.h" 31#include "todayconfig.h"
32#include "todaybase.h"
33#include "clickablelabel.h"
34
35class QVBoxLayout;
31 36
32class Today : public TodayBase 37class Today : public TodayBase {
33{
34 Q_OBJECT 38 Q_OBJECT
35 39
36 public: 40 public:
@@ -61,5 +65,20 @@ class Today : public TodayBase
61 int SHOW_LOCATION; 65 int SHOW_LOCATION;
62 int SHOW_NOTES; 66 int SHOW_NOTES;
63}; 67};
68
69class DateBookEvent: public ClickableLabel {
70 Q_OBJECT
71public:
72 DateBookEvent(const EffectiveEvent &ev,
73 QWidget* parent = 0, const char* name = 0,
74 WFlags fl = 0);
75signals:
76 void editEvent(const Event &e);
77private slots:
78 void editMe();
79private:
80 const EffectiveEvent event;
81};
82
64#endif // TODAY_H 83#endif // TODAY_H
65 84
diff --git a/core/pim/today/today.pro b/core/pim/today/today.pro
index 7d56e71..454b3ff 100644
--- a/core/pim/today/today.pro
+++ b/core/pim/today/today.pro
@@ -1,8 +1,9 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on debug 2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release 3 CONFIG = qt warn_on release
4 HEADERS = today.h TodoItem.h minidom.h todaybase.h todayconfig.h 4 HEADERS = today.h TodoItem.h minidom.h todaybase.h todayconfig.h clickablelabel.h
5 SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp minidom.c TodoItem.cpp 5 SOURCES = main.cpp today.cpp todaybase.cpp todayconfig.cpp minidom.c TodoItem.cpp clickablelabel.cpp
6
6 INCLUDEPATH+= $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe 9LIBS += -lqpe
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index 5c1dc24..552e2eb 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -51,6 +51,7 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
51 pal.setColor(QPalette::Active, QColorGroup::Button, col); 51 pal.setColor(QPalette::Active, QColorGroup::Button, col);
52 this->setPalette(pal); 52 this->setPalette(pal);
53 53
54
54 QWidget *d = QApplication::desktop(); 55 QWidget *d = QApplication::desktop();
55 int w=d->width(); 56 int w=d->width();
56 int h=d->height(); 57 int h=d->height();
@@ -95,7 +96,8 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
95 Frame4->setFrameStyle( QFrame::NoFrame ); 96 Frame4->setFrameStyle( QFrame::NoFrame );
96 Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) ); 97 Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) );
97 98
98 QScrollView* sv1 = new QScrollView( Frame4 ); 99 // QScrollView* sv1 = new QScrollView( Frame4 );
100 sv1 = new QScrollView( Frame4 );
99 sv1->setResizePolicy(QScrollView::AutoOneFit); 101 sv1->setResizePolicy(QScrollView::AutoOneFit);
100 sv1->setHScrollBarMode( QScrollView::AlwaysOff ); 102 sv1->setHScrollBarMode( QScrollView::AlwaysOff );
101 // need to find a better way!!! 103 // need to find a better way!!!
@@ -109,13 +111,15 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
109 DatesButton->setPixmap( datebook ); 111 DatesButton->setPixmap( datebook );
110 DatesButton->setFlat( TRUE ); 112 DatesButton->setFlat( TRUE );
111 113
112 DatesField = new QLabel( sv1->viewport(), "DatesField" ); 114 //DatesField = new QLabel( sv1->viewport(), "DatesField" );
113 sv1->addChild(DatesField); 115 //DatesField = new QVBox(sv1->viewport());
114 DatesField->setText( tr( "No appointments today" ) ); 116 //QWidget *dummy = new QWidget(sv1->viewport());
115 DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); 117 //sv1->addChild(DatesField);
118 //DatesField->setText( tr( "No appointments today" ) );
119 // DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
116 120
117 121
118 // --- mail section --- 122 // --- mail section ---)
119 MailFrame = new QFrame( this ,"MailFrame" ); 123 MailFrame = new QFrame( this ,"MailFrame" );
120 MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); 124 MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin );
121 MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); 125 MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) );
diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h
index 13fbb8d..8840125 100644
--- a/core/pim/today/todaybase.h
+++ b/core/pim/today/todaybase.h
@@ -14,7 +14,7 @@
14#include <qscrollview.h> 14#include <qscrollview.h>
15#include <qsplitter.h> 15#include <qsplitter.h>
16 16
17class QVBoxLayout; 17class QVBox;
18class QHBoxLayout; 18class QHBoxLayout;
19class QGridLayout; 19class QGridLayout;
20class QFrame; 20class QFrame;
@@ -32,10 +32,12 @@ public:
32 //QScrollView* Frame4; 32 //QScrollView* Frame4;
33 QFrame* Frame4; 33 QFrame* Frame4;
34 QPushButton* DatesButton; 34 QPushButton* DatesButton;
35 QLabel* DatesField; 35 //QLabel* DatesField;
36 QLabel* Frame; 36 QLabel* Frame;
37 QFrame* MailFrame; 37 QFrame* MailFrame;
38 QLabel* TextLabel1; 38 QLabel* TextLabel1;
39 QScrollView* sv1;
40 QVBox* DatesField;
39 QFrame* Frame15; 41 QFrame* Frame15;
40 QLabel* TodoField; 42 QLabel* TodoField;
41 QLabel* MailField; 43 QLabel* MailField;
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h
index 020097d..4739b5a 100644
--- a/core/pim/today/todayconfig.h
+++ b/core/pim/today/todayconfig.h
@@ -11,7 +11,7 @@
11 11
12#include <qvariant.h> 12#include <qvariant.h>
13#include <qdialog.h> 13#include <qdialog.h>
14class QVBoxLayout; 14//class QVBoxLayout;
15class QHBoxLayout; 15class QHBoxLayout;
16class QGridLayout; 16class QGridLayout;
17class QCheckBox; 17class QCheckBox;