-rw-r--r-- | core/pim/today/today.cpp | 28 | ||||
-rw-r--r-- | core/pim/today/today.h | 14 |
2 files changed, 25 insertions, 17 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 2dc96fc..58ba4f4 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -183,17 +183,16 @@ bool Today::checkIfModified() { /* * Init stuff needed for today. Reads the config file. */ void Today::init() { QDate date = QDate::currentDate(); QString time = (tr( date.toString()) ); TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); - db = new DateBookDB; // read config Config cfg("today"); cfg.setGroup("BaseConfig"); // -- config file section -- // how many lines should be showed in the task section MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); @@ -202,18 +201,19 @@ void Today::init() { // how many lines should be showed in the datebook section MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); // If location is to be showed too, 1 to activate it. SHOW_LOCATION = cfg.readNumEntry("showlocation",1); // if notes should be shown SHOW_NOTES = cfg.readNumEntry("shownotes",0); // should only later appointments be shown or all for the current day. ONLY_LATER = cfg.readNumEntry("onlylater",1); -} + db = new DateBookDB; +} /* * The method for the configuration dialog. */ void Today::startConfig() { conf = new todayconfig ( this, "", true ); // read the config @@ -291,25 +291,25 @@ void Today::getDates() { if ( count <= MAX_LINES_MEET ) { QTime time = QTime::currentTime(); if (!ONLY_LATER) { count++; - DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents); + DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); layoutDates->addWidget(l); connect (l, SIGNAL(editEvent(const Event &)), this, SLOT(editEvent(const Event &))); } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { count++; // show only later appointments - DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents); + DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); layoutDates->addWidget(l); connect (l, SIGNAL(editEvent(const Event &)), this, SLOT(editEvent(const Event &))); } } } if (ONLY_LATER && count==0) { QLabel* noMoreEvents = new QLabel(AllDateBookEvents); @@ -437,87 +437,89 @@ Today::~Today() { } /* * Gets the events for the current day, if it should get all dates */ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, - QWidget* parent = 0, - const char* name = 0, - WFlags fl = 0) : + QWidget* parent = 0, + int SHOW_LOCATION = 0, + int SHOW_NOTES = 0, + const char* name = 0, + WFlags fl = 0) : ClickableLabel(parent,name,fl), event(ev) { QString msg; //QTime time = QTime::currentTime(); if (!ONLY_LATER) { msg += "<B>" + (ev).description() + "</B>"; if ( (ev).event().hasAlarm() ) { msg += " <b>[with alarm]</b>"; } // include location or not if (SHOW_LOCATION == 1) { - msg += "<BR><i>" + (ev).location(); - msg += "</i>"; + msg += "<BR><i>" + (ev).location() + "</i>"; } if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { msg += "<br>All day"; } else { // start time of event msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) // end time of event + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); } // include possible note or not if (SHOW_NOTES == 1) { - msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; + msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); } } setText(msg); connect(this, SIGNAL(clicked()), this, SLOT(editMe())); setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); } DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, QWidget* parent = 0, + int SHOW_LOCATION = 0, + int SHOW_NOTES = 0, const char* name = 0, WFlags fl = 0) : ClickableLabel(parent,name,fl), event(ev) { QString msg; QTime time = QTime::currentTime(); if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { // show only later appointments msg += "<B>" + (ev).description() + "</B>"; if ( (ev).event().hasAlarm() ) { msg += " <b>[with alarm]</b>"; } // include location or not if (SHOW_LOCATION == 1) { - msg += "<BR><i>" + (ev).location(); - msg += "</i>"; + msg += "<BR><i>" + (ev).location() + "</i>"; } if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { msg += "<br>All day"; } else { // start time of event msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) // end time of event + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); } // include possible note or not if (SHOW_NOTES == 1) { - msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP) + "<br>"; + msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); } } setText(msg); connect(this, SIGNAL(clicked()), this, SLOT(editMe())); setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); } diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 6048781..090e8f9 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h @@ -73,32 +73,38 @@ class Today : public TodayBase { int SHOW_LOCATION; int SHOW_NOTES; }; class DateBookEvent: public ClickableLabel { Q_OBJECT public: DateBookEvent(const EffectiveEvent &ev, - QWidget* parent = 0, const char* name = 0, - WFlags fl = 0); + QWidget* parent = 0, + int SHOW_LOCATION = 0, + int SHOW_NOTES = 0, + const char* name = 0, + WFlags fl = 0); signals: void editEvent(const Event &e); private slots: void editMe(); private: const EffectiveEvent event; }; class DateBookEventLater: public ClickableLabel { Q_OBJECT public: DateBookEventLater(const EffectiveEvent &ev, - QWidget* parent = 0, const char* name = 0, - WFlags fl = 0); + QWidget* parent = 0, + int SHOW_LOCATION = 0, + int SHOW_NOTES = 0, + const char* name = 0, + WFlags fl = 0); signals: void editEvent(const Event &e); private slots: void editMe(); private: const EffectiveEvent event; }; |