summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp97
-rw-r--r--core/pim/today/today.h5
-rw-r--r--core/pim/today/todaybase.cpp17
-rw-r--r--core/pim/today/todaybase.h2
4 files changed, 91 insertions, 30 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 81d4d36..08efe2d 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -29,2 +29,4 @@
29#include <qpe/resource.h> 29#include <qpe/resource.h>
30#include <qpe/contact.h>
31#include <qpe/global.h>
30 32
@@ -69,3 +71,12 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
69 71
72#if defined(Q_WS_QWS)
73#if !defined(QT_NO_COP)
74 QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this );
75 connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)),
76 this, SLOT ( channelReceived(const QCString &, const QByteArray &)) );
77#endif
78#endif
79
70 draw(); 80 draw();
81 setOwnerField();
71 autoStart(); 82 autoStart();
@@ -73,2 +84,42 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
73 84
85/*
86 * Qcop receive method.
87 */
88void Today::channelReceived(const QCString &msg, const QByteArray & data) {
89 QDataStream stream(data, IO_ReadOnly );
90 if ( msg == "message(QString)" ) {
91 QString message;
92 stream >> message;
93 setOwnerField(message);
94 }
95
96}
97
98/*
99 * Initialises the owner field with the default value, the username
100 */
101void Today::setOwnerField() {
102 QString file = Global::applicationFileName("addressbook", "businesscard.vcf");
103 if (QFile::exists(file)) {
104 Contact cont = Contact::readVCard(file)[0];
105 QString returnString = cont.fullName();
106 OwnerField->setText( tr ("<b>Owned by " + returnString + "</b>"));
107 } else {
108 OwnerField->setText( tr ("<b>to lame to fill out the business card </b>"));
109 }
110}
111
112/*
113 * Set the owner field with a given QString, for example per qcop.
114 */
115void Today::setOwnerField(QString &message) {
116 if (!message.isEmpty()) {
117 OwnerField->setText("<b>" + message + "</b>");
118 }
119}
120
121/*
122 * Autostart, uses the new (opie only) autostart method in the launcher code.
123 * If registered against that today ist started on each resume.
124 */
74void Today::autoStart() { 125void Today::autoStart() {
@@ -88,2 +139,5 @@ void Today::autoStart() {
88 139
140/*
141 * Repaint method. Reread all fields.
142 */
89void Today::draw() { 143void Today::draw() {
@@ -97,3 +151,2 @@ void Today::draw() {
97 151
98
99/* 152/*
@@ -124,2 +177,5 @@ bool Today::checkIfModified() {
124 177
178/*
179 * Init stuff needed for today. Reads the config file.
180 */
125void Today::init() { 181void Today::init() {
@@ -127,3 +183,2 @@ void Today::init() {
127 QString time = (tr( date.toString()) ); 183 QString time = (tr( date.toString()) );
128// QString time = (tr( date.toString()) , white);
129 184
@@ -136,2 +191,3 @@ void Today::init() {
136 191
192 // -- config file section --
137 // how many lines should be showed in the task section 193 // how many lines should be showed in the task section
@@ -139,3 +195,3 @@ void Today::init() {
139 // after how many chars should the be cut off on tasks and notes 195 // after how many chars should the be cut off on tasks and notes
140 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",30); 196 MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40);
141 // how many lines should be showed in the datebook section 197 // how many lines should be showed in the datebook section
@@ -146,12 +202,13 @@ void Today::init() {
146 SHOW_NOTES = cfg.readNumEntry("shownotes",0); 202 SHOW_NOTES = cfg.readNumEntry("shownotes",0);
203 // should only later appointments be shown or all for the current day.
147 ONLY_LATER = cfg.readNumEntry("onlylater",1); 204 ONLY_LATER = cfg.readNumEntry("onlylater",1);
148
149} 205}
150 206
151void Today::startConfig() {
152 conf = new todayconfig ( this, "", true );
153 207
208/*
209 * The method for the configuration dialog.
210 */
211void Today::startConfig() {
154 212
155 //Config cfg = new Config("today"); 213 conf = new todayconfig ( this, "", true );
156
157 // read the config 214 // read the config
@@ -173,3 +230,3 @@ void Today::startConfig() {
173 conf->CheckBox3->setChecked(ONLY_LATER); 230 conf->CheckBox3->setChecked(ONLY_LATER);
174 231 // if today should be autostarted
175 conf->CheckBoxAuto->setChecked(AUTOSTART); 232 conf->CheckBoxAuto->setChecked(AUTOSTART);
@@ -194,2 +251,3 @@ void Today::startConfig() {
194 cfg.writeEntry("autostart", autostart); 251 cfg.writeEntry("autostart", autostart);
252
195 // sync it to "disk" 253 // sync it to "disk"
@@ -264,4 +322,2 @@ void Today::getDates() {
264 AllDateBookEvents->show(); 322 AllDateBookEvents->show();
265
266
267} 323}
@@ -341,6 +397,4 @@ void Today::getMail() {
341 397
342
343 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); 398 QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING);
344 399
345
346 MailField->setText(output); 400 MailField->setText(output);
@@ -351,3 +405,2 @@ void Today::getMail() {
351 * Get the todos 405 * Get the todos
352 *
353 */ 406 */
@@ -359,2 +412,3 @@ void Today::getTodo() {
359 } 412 }
413 // since it was the new start or the return from config dialog, set it to 0 again.
360 NEW_START=0; 414 NEW_START=0;
@@ -404,2 +458,6 @@ void Today::startDatebook() {
404} 458}
459
460/*
461 * starts the edit dialog as known from datebook
462 */
405void Today::editEvent(const Event &e) { 463void Today::editEvent(const Event &e) {
@@ -431,7 +489,4 @@ void Today::startMail() {
431 489
432/* 490
433 * Destroys the object and frees any allocated resources
434 */
435Today::~Today() { 491Today::~Today() {
436 // no need to delete child widgets, Qt does it all for us
437} 492}
@@ -439,2 +494,6 @@ Today::~Today() {
439 494
495
496/*
497 * Gets the events for the current day, if it should get all dates
498 */
440DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 499DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
@@ -467,2 +526,3 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
467 } 526 }
527
468 // include possible note or not 528 // include possible note or not
@@ -521,2 +581,3 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev,
521 581
582
522void DateBookEvent::editMe() { 583void DateBookEvent::editMe() {
diff --git a/core/pim/today/today.h b/core/pim/today/today.h
index 0b4356c..6dec2c2 100644
--- a/core/pim/today/today.h
+++ b/core/pim/today/today.h
@@ -57,3 +57,8 @@ class Today : public TodayBase {
57 bool checkIfModified(); 57 bool checkIfModified();
58 void setOwnerField();
59 void setOwnerField(QString &string);
58 QList<TodoItem> loadTodo(const char *filename); 60 QList<TodoItem> loadTodo(const char *filename);
61private slots:
62 void channelReceived(const QCString &msg, const QByteArray & data);
63
59 private: 64 private:
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index 552e2eb..c0b8d34 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -88,2 +88,6 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
88 88
89 OwnerField = new QLabel(this , "Owner" );
90 OwnerField->setGeometry(QRect(0,0, this->width(), 12 ));
91 OwnerField->setAlignment(int (QLabel::AlignTop | QLabel::AlignLeft ) );
92 OwnerField->setMaximumHeight(12);
89 93
@@ -96,5 +100,4 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
96 Frame4->setFrameStyle( QFrame::NoFrame ); 100 Frame4->setFrameStyle( QFrame::NoFrame );
97 Frame4->setGeometry (QRect( 0, 0, this->width() , this->height()) ); 101 Frame4->setGeometry (QRect( 0, 8, this->width() , this->height()) );
98 102
99 // QScrollView* sv1 = new QScrollView( Frame4 );
100 sv1 = new QScrollView( Frame4 ); 103 sv1 = new QScrollView( Frame4 );
@@ -113,10 +116,2 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
113 116
114 //DatesField = new QLabel( sv1->viewport(), "DatesField" );
115 //DatesField = new QVBox(sv1->viewport());
116 //QWidget *dummy = new QWidget(sv1->viewport());
117 //sv1->addChild(DatesField);
118 //DatesField->setText( tr( "No appointments today" ) );
119 // DatesField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) );
120
121
122 // --- mail section ---) 117 // --- mail section ---)
@@ -144,3 +139,2 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
144 139
145
146 // --- todo section -- 140 // --- todo section --
@@ -181,2 +175,3 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl )
181 layout->addWidget(Frame); 175 layout->addWidget(Frame);
176 layout->addWidget(OwnerField);
182 layout->addWidget(Frame4); 177 layout->addWidget(Frame4);
diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h
index 8840125..0118faa 100644
--- a/core/pim/today/todaybase.h
+++ b/core/pim/today/todaybase.h
@@ -34,3 +34,3 @@ public:
34 QPushButton* DatesButton; 34 QPushButton* DatesButton;
35 //QLabel* DatesField; 35 QLabel* OwnerField;
36 QLabel* Frame; 36 QLabel* Frame;