summaryrefslogtreecommitdiff
path: root/core/pim/today
Unidiff
Diffstat (limited to 'core/pim/today') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/config.in2
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.h3
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp3
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h9
5 files changed, 11 insertions, 9 deletions
diff --git a/core/pim/today/plugins/datebook/config.in b/core/pim/today/plugins/datebook/config.in
index 7a14438..413e0b8 100644
--- a/core/pim/today/plugins/datebook/config.in
+++ b/core/pim/today/plugins/datebook/config.in
@@ -1,4 +1,4 @@
1 config TODAY_DATEBOOK 1 config TODAY_DATEBOOK
2 boolean "datebook" 2 boolean "datebook"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2 && LIBOPIECORE2
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
index 9a820f2..f5b0d0a 100644
--- a/core/pim/today/plugins/datebook/datebookevent.cpp
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -1,121 +1,122 @@
1/* 1/*
2 * datebookevent.cpp 2 * datebookevent.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß 4 * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "datebookevent.h" 17#include "datebookevent.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
21#include <qpe/calendar.h> 21#include <qpe/calendar.h>
22 22
23#include <opie2/odevice.h> 23#include <opie2/odevice.h>
24 24
25using namespace Opie; 25using namespace Opie::Ui;
26using namespace Opie::Core;
26 27
27DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 28DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
28 QWidget* parent, 29 QWidget* parent,
29 bool show_location, 30 bool show_location,
30 bool show_notes, 31 bool show_notes,
31 bool timeExtraLine, 32 bool timeExtraLine,
32 int maxCharClip, 33 int maxCharClip,
33 const char* name, 34 const char* name,
34 WFlags fl) : 35 WFlags fl) :
35 OClickableLabel(parent,name,fl), event(ev) { 36 OClickableLabel(parent,name,fl), event(ev) {
36 37
37 // setAlignment( AlignTop ); 38 // setAlignment( AlignTop );
38 39
39 QString msg; 40 QString msg;
40 41
41 Config config( "qpe" ); 42 Config config( "qpe" );
42 config.setGroup( "Time" ); 43 config.setGroup( "Time" );
43 // if 24 h format 44 // if 24 h format
44 ampm = config.readBoolEntry( "AMPM", TRUE ); 45 ampm = config.readBoolEntry( "AMPM", TRUE );
45 46
46 msg += "<B>" + (ev).description() + "</B>"; 47 msg += "<B>" + (ev).description() + "</B>";
47 if ( (ev).event().hasAlarm() ) { 48 if ( (ev).event().hasAlarm() ) {
48 msg += " <b>" + tr("[with alarm]") +"</b>"; 49 msg += " <b>" + tr("[with alarm]") +"</b>";
49 } 50 }
50 51
51 // include location or not 52 // include location or not
52 if ( show_location ) { 53 if ( show_location ) {
53 msg += "<BR><i>" + (ev).location() + "</i>"; 54 msg += "<BR><i>" + (ev).location() + "</i>";
54 } 55 }
55 56
56 QString timeSpacer = " "; 57 QString timeSpacer = " ";
57 if ( timeExtraLine ) { 58 if ( timeExtraLine ) {
58 timeSpacer = "<br>"; 59 timeSpacer = "<br>";
59 } 60 }
60 61
61 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) 62 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" )
62 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { 63 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) {
63 msg += tr ( "All day" ); 64 msg += tr ( "All day" );
64 } else { 65 } else {
65 // start time of event 66 // start time of event
66// QDate tempDate = (ev).event().start().date(); 67// QDate tempDate = (ev).event().start().date();
67 msg += timeSpacer; 68 msg += timeSpacer;
68 msg += ampmTime( QTime( (ev).event().start().time() ) ) 69 msg += ampmTime( QTime( (ev).event().start().time() ) )
69 // end time of event 70 // end time of event
70 + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ); 71 + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) );
71 } 72 }
72 73
73 if ( (ev).date() != QDate::currentDate() ) { 74 if ( (ev).date() != QDate::currentDate() ) {
74 msg += differDate( (ev).date() /* tempDate*/ ); 75 msg += differDate( (ev).date() /* tempDate*/ );
75 } 76 }
76 77
77 // include possible note or not 78 // include possible note or not
78 if ( show_notes ) { 79 if ( show_notes ) {
79 msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); 80 msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
80 } 81 }
81 setText( msg ); 82 setText( msg );
82 connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); 83 connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) );
83} 84}
84 85
85DateBookEvent::~DateBookEvent() { 86DateBookEvent::~DateBookEvent() {
86} 87}
87 88
88/** 89/**
89 * AM/PM timestring conversion. 90 * AM/PM timestring conversion.
90 * @param tm the timestring 91 * @param tm the timestring
91 * @return formatted to am/pm is system is set to it 92 * @return formatted to am/pm is system is set to it
92 */ 93 */
93QString DateBookEvent::ampmTime( QTime tm ) { 94QString DateBookEvent::ampmTime( QTime tm ) {
94 QString s; 95 QString s;
95 if( ampm ) { 96 if( ampm ) {
96 int hour = tm.hour(); 97 int hour = tm.hour();
97 if ( hour == 0 ) { 98 if ( hour == 0 ) {
98 hour = 12; 99 hour = 12;
99 } 100 }
100 if ( hour > 12 ) { 101 if ( hour > 12 ) {
101 hour -= 12; 102 hour -= 12;
102 } 103 }
103 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 104 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
104 (tm.hour() >= 12) ? "PM" : "AM" ); 105 (tm.hour() >= 12) ? "PM" : "AM" );
105 return s; 106 return s;
106 } else { 107 } else {
107 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 108 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
108 return s; 109 return s;
109 } 110 }
110} 111}
111 112
112QString DateBookEvent::differDate( QDate date ) { 113QString DateBookEvent::differDate( QDate date ) {
113// QDate currentDate = QDate::currentDate(); 114// QDate currentDate = QDate::currentDate();
114 QString returnText = "<font color = #407DD9><b> "; 115 QString returnText = "<font color = #407DD9><b> ";
115// int differDate = currentDate.daysTo( date ); 116// int differDate = currentDate.daysTo( date );
116// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { 117// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
117// returnText += "" ; 118// returnText += "" ;
118// // not working right for recurring events 119// // not working right for recurring events
119// //} else if ( differDate == 1 ) { 120// //} else if ( differDate == 1 ) {
120// //returnText += tr( "tomorrow" ); 121// //returnText += tr( "tomorrow" );
121// } else { 122// } else {
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h
index e2ee077..973efe4 100644
--- a/core/pim/today/plugins/datebook/datebookevent.h
+++ b/core/pim/today/plugins/datebook/datebookevent.h
@@ -1,56 +1,55 @@
1/* 1/*
2 * datebookplugin.h 2 * datebookplugin.h
3 * 3 *
4 * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß 4 * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef DATEBOOKEVENT_PLUGIN_H 17#ifndef DATEBOOKEVENT_PLUGIN_H
18#define DATEBOOKEVENT_PLUGIN_H 18#define DATEBOOKEVENT_PLUGIN_H
19 19
20#include <opie2/oclickablelabel.h> 20#include <opie2/oclickablelabel.h>
21 21
22#include <qpe/datebookdb.h> 22#include <qpe/datebookdb.h>
23 23
24using namespace Opie;
25 24
26class DateBookEvent: public OClickableLabel { 25class DateBookEvent: public Opie::Ui::OClickableLabel {
27 26
28 Q_OBJECT 27 Q_OBJECT
29 28
30public: 29public:
31 DateBookEvent( const EffectiveEvent &ev, 30 DateBookEvent( const EffectiveEvent &ev,
32 QWidget* parent = 0, 31 QWidget* parent = 0,
33 bool show_location = 0, 32 bool show_location = 0,
34 bool show_notes = 0, 33 bool show_notes = 0,
35 bool timeExtraLine = 0, 34 bool timeExtraLine = 0,
36 int maxCharClip = 0, 35 int maxCharClip = 0,
37 const char* name = 0, 36 const char* name = 0,
38 WFlags fl = 0 ); 37 WFlags fl = 0 );
39 ~DateBookEvent(); 38 ~DateBookEvent();
40 39
41 signals: 40 signals:
42 void editEvent( const Event &e ); 41 void editEvent( const Event &e );
43 42
44private slots: 43private slots:
45 void editEventSlot( const Event &e ); 44 void editEventSlot( const Event &e );
46 void editMe(); 45 void editMe();
47 46
48 private: 47 private:
49 48
50 QString ampmTime( QTime ); 49 QString ampmTime( QTime );
51 QString differDate( QDate date ); 50 QString differDate( QDate date );
52 const EffectiveEvent event; 51 const EffectiveEvent event;
53 bool ampm; 52 bool ampm;
54}; 53};
55 54
56#endif 55#endif
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
index 567c70f..7ce703e 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.cpp
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -1,117 +1,120 @@
1/* 1/*
2 * todopluginwidget.cpp 2 * todopluginwidget.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todopluginwidget.h" 17#include "todopluginwidget.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
21 21
22using namespace Opie::Ui;
23using namespace Opie;
24
22TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name ) 25TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name )
23 : QWidget( parent, name ) { 26 : QWidget( parent, name ) {
24 27
25 todo = 0l; 28 todo = 0l;
26 layoutTodo = 0l; 29 layoutTodo = 0l;
27 todoLabel = 0l; 30 todoLabel = 0l;
28 31
29 if ( todo ) { 32 if ( todo ) {
30 delete todo; 33 delete todo;
31 } 34 }
32 todo = new OPimTodoAccess(); 35 todo = new OPimTodoAccess();
33 todo->load(); 36 todo->load();
34 37
35 if ( layoutTodo ) { 38 if ( layoutTodo ) {
36 delete layoutTodo; 39 delete layoutTodo;
37 } 40 }
38 layoutTodo = new QVBoxLayout( this ); 41 layoutTodo = new QVBoxLayout( this );
39 layoutTodo->setAutoAdd( true ); 42 layoutTodo->setAutoAdd( true );
40 43
41 if ( todoLabel ) { 44 if ( todoLabel ) {
42 delete todoLabel; 45 delete todoLabel;
43 } 46 }
44 todoLabel = new OClickableLabel( this ); 47 todoLabel = new OClickableLabel( this );
45 48
46 connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) ); 49 connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
47 50
48 readConfig(); 51 readConfig();
49 getTodo(); 52 getTodo();
50} 53}
51 54
52TodolistPluginWidget::~TodolistPluginWidget() { 55TodolistPluginWidget::~TodolistPluginWidget() {
53 delete todo; 56 delete todo;
54 delete todoLabel; 57 delete todoLabel;
55 delete layoutTodo; 58 delete layoutTodo;
56} 59}
57 60
58 61
59void TodolistPluginWidget::readConfig() { 62void TodolistPluginWidget::readConfig() {
60 Config cfg( "todaytodoplugin" ); 63 Config cfg( "todaytodoplugin" );
61 cfg.setGroup( "config" ); 64 cfg.setGroup( "config" );
62 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 65 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
63 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 66 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
64} 67}
65 68
66void TodolistPluginWidget:: refresh() { 69void TodolistPluginWidget:: refresh() {
67 todo->reload(); 70 todo->reload();
68 getTodo(); 71 getTodo();
69} 72}
70 73
71void TodolistPluginWidget::reinitialize() { 74void TodolistPluginWidget::reinitialize() {
72 readConfig(); 75 readConfig();
73 todo->reload(); 76 todo->reload();
74 getTodo(); 77 getTodo();
75} 78}
76 79
77/** 80/**
78 * Get the todos 81 * Get the todos
79 */ 82 */
80void TodolistPluginWidget::getTodo() { 83void TodolistPluginWidget::getTodo() {
81 84
82 85
83 QString output; 86 QString output;
84 QString tmpout; 87 QString tmpout;
85 int count = 0; 88 int count = 0;
86 int ammount = 0; 89 int ammount = 0;
87 90
88 // get overdue todos first 91 // get overdue todos first
89 m_list = todo->sorted( true, 3, 2, 1); 92 m_list = todo->sorted( true, 3, 2, 1);
90 93
91 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 94 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
92 if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) { 95 if (!(*m_it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
93 QString desc = (*m_it).summary(); 96 QString desc = (*m_it).summary();
94 if( desc.isEmpty() ) { 97 if( desc.isEmpty() ) {
95 desc = (*m_it).description(); 98 desc = (*m_it).description();
96 } 99 }
97 tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>"; 100 tmpout += "<font color=#e00000><b>[" + QString("%1").arg((*m_it).priority() ) + "]" + desc.mid( 0, m_maxCharClip ) + "</b></font><br>";
98 ammount++ ; 101 ammount++ ;
99 } 102 }
100 } 103 }
101 104
102 // get total number of still open todos 105 // get total number of still open todos
103 m_list = todo->sorted( true, 1, 4, 1); 106 m_list = todo->sorted( true, 1, 4, 1);
104 107
105 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 108 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
106 count +=1; 109 count +=1;
107 // not the overdues, we allready got them, and not if we are 110 // not the overdues, we allready got them, and not if we are
108 // over the maxlines 111 // over the maxlines
109 if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) { 112 if ( !(*m_it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
110 QString desc = (*m_it).summary(); 113 QString desc = (*m_it).summary();
111 if( desc.isEmpty() ) { 114 if( desc.isEmpty() ) {
112 desc = (*m_it).description(); 115 desc = (*m_it).description();
113 } 116 }
114 tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>"; 117 tmpout += "<b> [" + QString("%1").arg((*m_it).priority() ) + "] </b>" + desc.mid( 0, m_maxCharClip ) + "<br>";
115 ammount++; 118 ammount++;
116 } 119 }
117 } 120 }
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h
index a020cf4..86a9f27 100644
--- a/core/pim/today/plugins/todolist/todopluginwidget.h
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -1,55 +1,54 @@
1/* 1/*
2 * todopluginwidget.h 2 * todopluginwidget.h
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#ifndef TODOLIST_PLUGIN_WIDGET_H 17#ifndef TODOLIST_PLUGIN_WIDGET_H
18#define TODOLIST_PLUGIN_WIDGET_H 18#define TODOLIST_PLUGIN_WIDGET_H
19 19
20#include <qlayout.h> 20#include <qlayout.h>
21 21
22#include <opie2/otodoaccess.h> 22#include <opie2/otodoaccess.h>
23#include <opie2/oclickablelabel.h> 23#include <opie2/oclickablelabel.h>
24 24
25using namespace Opie;
26 25
27class TodolistPluginWidget : public QWidget { 26class TodolistPluginWidget : public QWidget {
28 27
29 Q_OBJECT 28 Q_OBJECT
30 29
31public: 30public:
32 TodolistPluginWidget( QWidget *parent, const char *name ); 31 TodolistPluginWidget( QWidget *parent, const char *name );
33 ~TodolistPluginWidget(); 32 ~TodolistPluginWidget();
34 33
35 void refresh(); 34 void refresh();
36 void reinitialize(); 35 void reinitialize();
37 36
38protected slots: 37protected slots:
39 void startTodolist(); 38 void startTodolist();
40 39
41private: 40private:
42 OClickableLabel *todoLabel; 41 Opie::Ui::OClickableLabel *todoLabel;
43 QVBoxLayout* layoutTodo; 42 QVBoxLayout* layoutTodo;
44 43
45 OPimTodoAccess *todo; 44 Opie::OPimTodoAccess *todo;
46 OPimTodoAccess::List m_list; 45 Opie::OPimTodoAccess::List m_list;
47 OPimTodoAccess::List::Iterator m_it; 46 Opie::OPimTodoAccess::List::Iterator m_it;
48 47
49 void readConfig(); 48 void readConfig();
50 void getTodo(); 49 void getTodo();
51 int m_maxLinesTask; 50 int m_maxLinesTask;
52 int m_maxCharClip; 51 int m_maxCharClip;
53}; 52};
54 53
55#endif 54#endif