summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-09-15 21:13:47 (UTC)
committer harlekin <harlekin>2002-09-15 21:13:47 (UTC)
commit87cd421d72df1d7706925285a48c008007471310 (patch) (unidiff)
treeeb7805bd6702f2820aac159baa4a9c5592a52ee4
parent251fd5b1687994c30e8bea1091e893468086223f (diff)
downloadopie-87cd421d72df1d7706925285a48c008007471310.zip
opie-87cd421d72df1d7706925285a48c008007471310.tar.gz
opie-87cd421d72df1d7706925285a48c008007471310.tar.bz2
plugins for the new today
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebook.pro19
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp118
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.h50
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp73
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h47
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp82
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.h48
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginimpl.cpp42
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginimpl.h42
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp114
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.h52
-rw-r--r--core/pim/today/plugins/datebook/opie-today-datebookplugin.control8
-rw-r--r--core/pim/today/plugins/mail/mail.pro17
-rw-r--r--core/pim/today/plugins/mail/mailplugin.cpp63
-rw-r--r--core/pim/today/plugins/mail/mailplugin.h47
-rw-r--r--core/pim/today/plugins/mail/mailpluginimpl.cpp45
-rw-r--r--core/pim/today/plugins/mail/mailpluginimpl.h40
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.cpp73
-rw-r--r--core/pim/today/plugins/mail/mailpluginwidget.h45
-rw-r--r--core/pim/today/plugins/mail/opie-today-todolistplugin.control8
-rw-r--r--core/pim/today/plugins/todolist/moc_todoplugin.cpp0
-rw-r--r--core/pim/today/plugins/todolist/moc_todoplugin.obin0 -> 2268 bytes
-rw-r--r--core/pim/today/plugins/todolist/opie-today-todolistplugin.control8
-rw-r--r--core/pim/today/plugins/todolist/todolist.pro20
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp71
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h47
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.cpp69
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.h55
-rw-r--r--core/pim/today/plugins/todolist/todopluginimpl.cpp43
-rw-r--r--core/pim/today/plugins/todolist/todopluginimpl.h40
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.cpp132
-rw-r--r--core/pim/today/plugins/todolist/todopluginwidget.h47
32 files changed, 1565 insertions, 0 deletions
diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro
new file mode 100644
index 0000000..615059a
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebook.pro
@@ -0,0 +1,19 @@
1TEMPLATE = lib
2CONFIG -= moc
3CONFIG += qt debug
4
5# Input
6HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \
7 datebookevent.h datebookpluginwidget.h
8SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \
9 datebookevent.cpp datebookpluginwidget.cpp
10
11INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library
15
16LIBS+= -lqpe -lopie
17
18DESTDIR = $(OPIEDIR)/plugins/today
19TARGET = todaydatebookplugin \ No newline at end of file
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
new file mode 100644
index 0000000..1caf061
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -0,0 +1,118 @@
1/*
2 * datebookevent.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "datebookevent.h"
18#include <qpe/config.h>
19#include <qpe/timestring.h>
20#include <qpe/qcopenvelope_qws.h>
21#include <qpe/qpeapplication.h>
22
23DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
24 QWidget* parent,
25 int show_location,
26 int show_notes,
27 // int onlyLater,
28 int maxCharClip,
29 const char* name,
30 WFlags fl) :
31 OClickableLabel(parent,name,fl), event(ev) {
32
33 QString msg;
34
35 Config config( "qpe" );
36 config.setGroup( "Time" );
37 // if 24 h format
38 ampm = config.readBoolEntry( "AMPM", TRUE );
39
40 msg += "<B>" + (ev).description() + "</B>";
41 if ( (ev).event().hasAlarm() ) {
42 msg += " <b>[with alarm]</b>";
43 }
44
45 // include location or not
46 if ( show_location == 1) {
47 msg += "<BR><i>" + (ev).location() + "</i>";
48 }
49
50 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" )
51 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59") ) {
52 msg += "<br>All day";
53 } else {
54 // start time of event
55 msg += "<br>" + ampmTime(QTime( (ev).event().start().time() ) )
56 // end time of event
57 + "<b> - </b>" + ampmTime(QTime( (ev).event().end().time() ) );
58 }
59
60 // include possible note or not
61 if ( show_notes == 1) {
62 msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
63 }
64
65 setText( msg );
66 connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) );
67 setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) );
68}
69
70
71QString DateBookEvent::ampmTime( QTime tm ) {
72
73 QString s;
74 if( ampm ) {
75 int hour = tm.hour();
76 if ( hour == 0 ) {
77 hour = 12;
78 }
79 if ( hour > 12 ) {
80 hour -= 12;
81 }
82 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
83 (tm.hour() >= 12) ? "PM" : "AM" );
84 return s;
85 } else {
86 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
87 return s;
88 }
89
90}
91
92
93//extern QPEApplication *todayApp;
94
95/*
96 * starts the edit dialog as known from datebook
97 */
98void DateBookEvent::editEventSlot( const Event &e ) {
99 startDatebook();
100
101 while( !QCopChannel::isRegistered( "QPE/Datebook" ) ) qApp->processEvents();
102 QCopEnvelope env( "QPE/Datebook", "editEvent(int)" );
103 env << e.uid();
104}
105
106
107/**
108 * launches datebook
109 */
110void DateBookEvent::startDatebook() {
111 QCopEnvelope e("QPE/System", "execute(QString)");
112 e << QString("datebook");
113}
114
115void DateBookEvent::editMe() {
116 emit editEvent(event.event());
117}
118
diff --git a/core/pim/today/plugins/datebook/datebookevent.h b/core/pim/today/plugins/datebook/datebookevent.h
new file mode 100644
index 0000000..1168f7c
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookevent.h
@@ -0,0 +1,50 @@
1/*
2 * datebookplugin.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef DATEBOOKEVENT_PLUGIN_H
18#define DATEBOOKEVENT_PLUGIN_H
19
20#include <opie/oclickablelabel.h>
21#include <qpe/datebookdb.h>
22
23
24class DateBookEvent: public OClickableLabel {
25
26 Q_OBJECT
27
28public:
29 DateBookEvent(const EffectiveEvent &ev,
30 QWidget* parent = 0,
31 int show_location = 0,
32 int show_notes = 0,
33 // int onlyLater = 0,
34 int maxCharClip = 0,
35 const char* name = 0,
36 WFlags fl = 0);
37signals:
38 void editEvent(const Event &e);
39private slots:
40 void editEventSlot(const Event &e);
41 void editMe();
42private:
43 void startDatebook();
44 DateBookDB *db;
45 QString ampmTime(QTime);
46 const EffectiveEvent event;
47 bool ampm;
48};
49
50#endif
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
new file mode 100644
index 0000000..d2a73df
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -0,0 +1,73 @@
1/*
2 * datebookplugin.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18
19#include "datebookevent.h"
20#include "datebookplugin.h"
21#include "datebookpluginwidget.h"
22#include "datebookpluginconfig.h"
23
24#include "../../configwidget.h"
25
26#include <qpe/timestring.h>
27#include <qpe/config.h>
28
29
30DatebookPlugin::DatebookPlugin() {
31}
32
33DatebookPlugin::~DatebookPlugin() {
34}
35
36QString DatebookPlugin::pluginName() const {
37 return "Datebook plugin";
38}
39
40double DatebookPlugin::versionNumber() const {
41 return 0.1;
42}
43
44QString DatebookPlugin::pixmapNameWidget() const {
45 return "DateBook";
46}
47
48QWidget* DatebookPlugin::widget( QWidget* wid ) {
49 return new DatebookPluginWidget( wid, "Datebook" );
50}
51
52QString DatebookPlugin::pixmapNameConfig() const {
53 return "DateBook";
54}
55
56ConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) {
57 return new DatebookPluginConfig( wid , "Datebook" );
58}
59
60QString DatebookPlugin::appName() const {
61 return "datebook";
62}
63
64int DatebookPlugin::minHeight() const {
65 return 10;
66}
67
68int DatebookPlugin::maxHeight() const {
69 return 100;
70}
71
72
73
diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h
new file mode 100644
index 0000000..f2c4446
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookplugin.h
@@ -0,0 +1,47 @@
1/*
2 * datebookplugin.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef DATEBOOK_PLUGIN_H
18#define DATEBOOK_PLUGIN_H
19
20#include <qstring.h>
21#include <qwidget.h>
22
23#include <qpe/datebookdb.h>
24#include <opie/oclickablelabel.h>
25
26#include "../../todayplugininterface.h"
27
28class DatebookPlugin : public TodayPluginObject {
29
30public:
31 DatebookPlugin();
32 ~DatebookPlugin();
33
34 QString pluginName() const;
35 double versionNumber() const;
36 QString pixmapNameWidget() const;
37 QWidget* widget( QWidget *);
38 QString pixmapNameConfig() const;
39 ConfigWidget* configWidget( QWidget *);
40 QString appName() const;
41 virtual int minHeight() const;
42 virtual int maxHeight() const;
43
44};
45
46
47#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
new file mode 100644
index 0000000..7482f5e
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -0,0 +1,82 @@
1
2
3#include "datebookpluginconfig.h"
4
5
6#include <qpe/config.h>
7
8#include <qlayout.h>
9#include <qtoolbutton.h>
10#include <qlabel.h>
11#include <qhbox.h>
12#include <qvbox.h>
13
14DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
15 : ConfigWidget( parent, name ) {
16
17 QVBoxLayout * layout = new QVBoxLayout( this );
18
19 QHBox *box1 = new QHBox( this );
20 QLabel* TextLabel4 = new QLabel( box1, "TextLabel4" );
21 TextLabel4->setText( tr( "Show location" ) );
22 CheckBox1 = new QCheckBox( box1, "CheckBox1" );
23
24 QHBox *box2 = new QHBox( this );
25 QLabel* TextLabel5 = new QLabel( box2 , "TextLabel5" );
26 TextLabel5->setText( tr( "Show notes" ) );
27 CheckBox2 = new QCheckBox( box2, "CheckBox2" );
28
29 QHBox *box3 = new QHBox( this );
30 QLabel* TextLabel6 = new QLabel( box3, "All Day");
31 TextLabel6->setText( tr( "Show only later\n"
32 "appointments") );
33 CheckBox3 = new QCheckBox ( box3, "CheckBox3" );
34
35 QHBox *box4 = new QHBox( this );
36 QLabel *TextLabel3 = new QLabel( box4, "TextLabel3" );
37 TextLabel3->setText( tr( "How many \nappointment\n"
38 "should be \nshown?" ) );
39 SpinBox1 = new QSpinBox( box4, "SpinBox1" );
40 SpinBox1->setMaxValue( 10 );
41 SpinBox1->setValue( 5 );
42
43 layout->addWidget( box1 );
44 layout->addWidget( box2 );
45 layout->addWidget( box3 );
46 layout->addWidget( box4 );
47
48 readConfig();
49}
50
51void DatebookPluginConfig::readConfig() {
52 Config cfg( "todaydatebookplugin" );
53 cfg.setGroup( "config" );
54
55 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
56 SpinBox1->setValue( m_max_lines_meet );
57 m_show_location = cfg.readNumEntry( "showlocation", 1 );
58 CheckBox1->setChecked( m_show_location );
59 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
60 CheckBox2->setChecked( m_show_notes );
61 m_only_later = cfg.readNumEntry( "onlylater", 1 );
62 CheckBox3->setChecked( m_only_later );
63}
64
65
66void DatebookPluginConfig::writeConfig() {
67 Config cfg( "todaydatebookplugin" );
68 cfg.setGroup( "config" );
69
70 m_max_lines_meet = SpinBox1->value();
71 cfg.writeEntry( "maxlinesmeet", m_max_lines_meet);
72 m_show_location = CheckBox1->isChecked();
73 cfg.writeEntry( "showlocation", m_show_location);
74 m_show_notes = CheckBox2->isChecked();
75 cfg.writeEntry( "shownotes", m_show_notes );
76 m_only_later = CheckBox3->isChecked();
77 cfg.writeEntry( "onlylater", m_only_later );
78 cfg.write();
79}
80
81DatebookPluginConfig::~DatebookPluginConfig() {
82}
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.h b/core/pim/today/plugins/datebook/datebookpluginconfig.h
new file mode 100644
index 0000000..33d3c4e
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.h
@@ -0,0 +1,48 @@
1
2#ifndef DATEBOOK_PLUGIN_CONFIG_H
3#define DATEBOOK_PLUGIN_CONFIG_H
4
5#include <qwidget.h>
6#include <qcheckbox.h>
7#include <qspinbox.h>
8
9#include "../../configwidget.h"
10
11class DatebookPluginConfig : public ConfigWidget {
12
13 Q_OBJECT
14
15public:
16 DatebookPluginConfig( QWidget *parent, const char *name );
17 ~DatebookPluginConfig();
18
19 void writeConfig();
20private:
21 /**
22 * if changed then save
23 */
24 bool changed();
25 void readConfig();
26
27 QCheckBox* CheckBox2;
28 QCheckBox* CheckBox1;
29 QCheckBox* CheckBox3;
30 QSpinBox* SpinBox1;
31
32 // how many lines should be showed in the datebook section
33 int m_max_lines_meet;
34 // If location is to be showed too, 1 to activate it.
35 int m_show_location;
36 // if notes should be shown
37 int m_show_notes;
38 // should only later appointments be shown or all for the current day.
39 int m_only_later;
40
41
42};
43
44
45
46
47
48#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginimpl.cpp b/core/pim/today/plugins/datebook/datebookpluginimpl.cpp
new file mode 100644
index 0000000..4159b49
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookpluginimpl.cpp
@@ -0,0 +1,42 @@
1/*
2 * datebookpluginimpl.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "datebookplugin.h"
18#include "datebookpluginimpl.h"
19
20DatebookPluginImpl::DatebookPluginImpl() {
21 datebookPlugin = new DatebookPlugin();
22}
23
24DatebookPluginImpl::~DatebookPluginImpl() {
25}
26
27TodayPluginObject* DatebookPluginImpl::guiPart() {
28 return datebookPlugin;
29}
30
31QRESULT DatebookPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
32 *iface = 0;
33 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) {
34 *iface = this, (*iface)->addRef();
35 }
36 return QS_OK;
37
38}
39
40Q_EXPORT_INTERFACE() {
41 Q_CREATE_INSTANCE( DatebookPluginImpl );
42}
diff --git a/core/pim/today/plugins/datebook/datebookpluginimpl.h b/core/pim/today/plugins/datebook/datebookpluginimpl.h
new file mode 100644
index 0000000..037dff4
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookpluginimpl.h
@@ -0,0 +1,42 @@
1/*
2 * datebookpluginimpl.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef DATEBOOK_PLUGIN_IMPL_H
18#define DATEBOOK_PLUGIN_IMPL_H
19
20#include "../../todayplugininterface.h"
21
22class DatebookPlugin;
23
24class DatebookPluginImpl : public TodayPluginInterface{
25
26public:
27 DatebookPluginImpl();
28 virtual ~DatebookPluginImpl();
29
30 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
31 Q_REFCOUNT
32
33 virtual TodayPluginObject *guiPart();
34
35private:
36 DatebookPlugin *datebookPlugin;
37 ulong ref;
38
39
40};
41
42#endif
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
new file mode 100644
index 0000000..e4667ae
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -0,0 +1,114 @@
1/*
2 * datebookpluginwidget.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18#include "datebookpluginwidget.h"
19#include "datebookevent.h"
20
21#include <qpe/timestring.h>
22#include <qpe/config.h>
23
24#include <qdatetime.h>
25#include <qlabel.h>
26#include <qlayout.h>
27#include <qtl.h>
28#include <qscrollview.h>
29#include <qtimer.h>
30
31DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name)
32 : QWidget(parent, name ) {
33 db = 0l;
34 readConfig();
35 getDates();
36}
37
38DatebookPluginWidget::~DatebookPluginWidget() {
39 delete db;
40}
41
42
43void DatebookPluginWidget::readConfig() {
44 Config cfg( "todaydatebookplugin" );
45 cfg.setGroup( "config" );
46 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
47 m_show_location = cfg.readNumEntry( "showlocation", 1 );
48 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
49 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
50}
51
52
53/**
54 * Get all events that are in the datebook xml file for today
55 */
56void DatebookPluginWidget::getDates() {
57
58
59 QDate date = QDate::currentDate();
60
61 QVBoxLayout* layoutDates = new QVBoxLayout( this );
62
63 if ( db ) {
64 delete db;
65 }
66
67 db = new DateBookDB;
68
69 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date );
70
71 qBubbleSort( list );
72
73 Config config( "qpe" );
74
75 int count=0;
76
77 if ( list.count() > 0 ) {
78
79 for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) {
80
81 if ( count <= m_max_lines_meet ) {
82 QTime time = QTime::currentTime();
83
84 if ( !m_onlyLater ) {
85 count++;
86 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
87 layoutDates->addWidget( l );
88 QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
89 } else if ( ( time.toString() <= TimeString::dateString( (*it).event().end() ) ) ) {
90 count++;
91 // show only later appointments
92 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes );
93 layoutDates->addWidget( l );
94 QObject::connect ( l, SIGNAL( editEvent( const Event &) ), l, SLOT( editEventSlot( const Event &) ) );
95 }
96 }
97 }
98 if ( m_onlyLater && count == 0 ) {
99 QLabel* noMoreEvents = new QLabel( this );
100 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
101 layoutDates->addWidget( noMoreEvents );
102 }
103 } else {
104 QLabel* noEvents = new QLabel( this );
105 noEvents->setText( QObject::tr( "No appointments today" ) );
106 layoutDates->addWidget( noEvents );
107 }
108
109 layoutDates->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
110
111 // how often refresh - later have qcop update calls in *db
112 //QTimer::singleShot( 20*1000, this , SLOT( getDates() ) );
113}
114
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.h b/core/pim/today/plugins/datebook/datebookpluginwidget.h
new file mode 100644
index 0000000..e0213ec
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.h
@@ -0,0 +1,52 @@
1/*
2 * datebookpluginwidget.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef DATEBOOK_PLUGIN_WIDGET_H
18#define DATEBOOK_PLUGIN_WIDGET_H
19
20#include <qstring.h>
21#include <qwidget.h>
22
23#include <qpe/datebookdb.h>
24#include <opie/oclickablelabel.h>
25
26
27class DatebookPluginWidget : public QWidget {
28
29 Q_OBJECT
30
31public:
32 DatebookPluginWidget( QWidget *parent, const char *name );
33 ~DatebookPluginWidget();
34
35
36private:
37 DateBookDB* db;
38 void readConfig();
39 void getDates();
40
41 // how many lines should be showed in the datebook section
42 int m_max_lines_meet;
43 // If location is to be showed too, 1 to activate it.
44 int m_show_location;
45 // if notes should be shown
46 int m_show_notes;
47 // should only later appointments be shown or all for the current day.
48 int m_onlyLater;
49
50};
51
52#endif
diff --git a/core/pim/today/plugins/datebook/opie-today-datebookplugin.control b/core/pim/today/plugins/datebook/opie-today-datebookplugin.control
new file mode 100644
index 0000000..3ee523b
--- a/dev/null
+++ b/core/pim/today/plugins/datebook/opie-today-datebookplugin.control
@@ -0,0 +1,8 @@
1Files: $OPIEDIR/lib/today/libtodaydatebookplugin.so*
2Priority: optional
3Section: opie/applications
4Maintainer: Maximilian Reiss <harlekin@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Datebook plugin for today
diff --git a/core/pim/today/plugins/mail/mail.pro b/core/pim/today/plugins/mail/mail.pro
new file mode 100644
index 0000000..58bda54
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mail.pro
@@ -0,0 +1,17 @@
1TEMPLATE = lib
2CONFIG -= moc
3CONFIG += qt debug
4
5# Input
6HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h
7SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp
8
9INCLUDEPATH += $(OPIEDIR)/include \
10 ../ ../library
11DEPENDPATH += $(OPIEDIR)/include \
12 ../ ../library
13
14LIBS+= -lqpe -lopie
15
16DESTDIR = $(OPIEDIR)/plugins/today
17TARGET = todaymailplugin \ No newline at end of file
diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp
new file mode 100644
index 0000000..a594361
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mailplugin.cpp
@@ -0,0 +1,63 @@
1/*
2 * mailplugin.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18#include "mailplugin.h"
19#include "mailpluginwidget.h"
20
21
22MailPlugin::MailPlugin() {
23}
24
25MailPlugin::~MailPlugin() {
26}
27
28QString MailPlugin::pluginName() const {
29 return "Mail plugin";
30}
31
32double MailPlugin::versionNumber() const {
33 return 0.1;
34}
35
36QString MailPlugin::pixmapNameWidget() const {
37 return "mail/desktopicon";
38}
39
40QWidget* MailPlugin::widget( QWidget * wid ) {
41 return new MailPluginWidget( wid, "Mail" );
42}
43
44QString MailPlugin::pixmapNameConfig() const {
45 return 0l;
46}
47
48QWidget* MailPlugin::configWidget( QWidget* wid ) {
49 return 0l;
50}
51
52QString MailPlugin::appName() const {
53 return "Mail";
54}
55
56int MailPlugin::minHeight() const {
57 return 10;
58}
59
60int MailPlugin::maxHeight() const {
61 return 10;
62}
63
diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h
new file mode 100644
index 0000000..113102e
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mailplugin.h
@@ -0,0 +1,47 @@
1/*
2 * mailplugin.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18#ifndef MAIL_PLUGIN_H
19#define MAIL_PLUGIN_H
20
21#include <qstring.h>
22#include <qwidget.h>
23
24#include <opie/tododb.h>
25#include <opie/oclickablelabel.h>
26
27#include "../../todayplugininterface.h"
28
29class MailPlugin : public TodayPluginObject {
30
31public:
32 MailPlugin();
33 ~MailPlugin();
34
35 QString pluginName() const;
36 double versionNumber() const;
37 QString pixmapNameWidget() const;
38 QWidget* widget(QWidget *);
39 QString pixmapNameConfig() const;
40 QWidget* configWidget(QWidget *);
41 QString appName() const;
42 virtual int minHeight() const;
43 virtual int maxHeight() const;
44
45};
46
47#endif
diff --git a/core/pim/today/plugins/mail/mailpluginimpl.cpp b/core/pim/today/plugins/mail/mailpluginimpl.cpp
new file mode 100644
index 0000000..e5a1e05
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mailpluginimpl.cpp
@@ -0,0 +1,45 @@
1/*
2 * mailpluginimpl.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18
19#include "mailplugin.h"
20#include "mailpluginimpl.h"
21
22MailPluginImpl::MailPluginImpl() {
23 mailPlugin = new MailPlugin();
24}
25
26MailPluginImpl::~MailPluginImpl() {
27}
28
29
30TodayPluginObject* MailPluginImpl::guiPart() {
31 return mailPlugin;
32}
33
34QRESULT MailPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
35 *iface = 0;
36 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) {
37 *iface = this, (*iface)->addRef();
38 }
39 return QS_OK;
40
41}
42
43Q_EXPORT_INTERFACE() {
44 Q_CREATE_INSTANCE( MailPluginImpl );
45}
diff --git a/core/pim/today/plugins/mail/mailpluginimpl.h b/core/pim/today/plugins/mail/mailpluginimpl.h
new file mode 100644
index 0000000..9930e6e
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mailpluginimpl.h
@@ -0,0 +1,40 @@
1/*
2 * mailpluginimpl.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef MAIL_PLUGIN_IMPL_H
18#define MAIL_PLUGIN_IMPL_H
19
20#include "../../todayplugininterface.h"
21
22class MailPlugin;
23
24class MailPluginImpl : public TodayPluginInterface{
25
26public:
27 MailPluginImpl();
28 virtual ~MailPluginImpl();
29
30 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
31 Q_REFCOUNT
32
33 virtual TodayPluginObject *guiPart();
34
35private:
36 MailPlugin *mailPlugin;
37 ulong ref;
38};
39
40#endif
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.cpp b/core/pim/today/plugins/mail/mailpluginwidget.cpp
new file mode 100644
index 0000000..a6f3562
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mailpluginwidget.cpp
@@ -0,0 +1,73 @@
1/*
2 * mailpluginwidget.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18#include <qvaluelist.h>
19#include <qtl.h>
20#include <qstring.h>
21#include <qobject.h>
22#include <qlayout.h>
23
24#include <qpe/config.h>
25#include <qpe/timestring.h>
26#include <qpe/qcopenvelope_qws.h>
27
28#include "mailpluginwidget.h"
29
30MailPluginWidget::MailPluginWidget( QWidget *parent, const char* name)
31 : QWidget(parent, name ) {
32
33 readConfig();
34 getInfo();
35}
36
37MailPluginWidget::~MailPluginWidget() {
38}
39
40
41void MailPluginWidget::readConfig() {
42 Config cfg( "todaymailplugin" );
43 cfg.setGroup( "config" );
44}
45
46
47void MailPluginWidget::getInfo() {
48
49 QHBoxLayout* layout = new QHBoxLayout( this );
50
51 mailLabel = new OClickableLabel( this );
52 mailLabel->setMaximumHeight( 15 );
53 connect( mailLabel, SIGNAL( clicked() ), this, SLOT( startMail() ) );
54
55 Config cfg( "opiemail" );
56 cfg.setGroup( "today" );
57
58 int NEW_MAILS = cfg.readNumEntry( "newmails", 0 );
59 int OUTGOING = cfg.readNumEntry( "outgoing", 0 );
60
61 QString output = QObject::tr( "<b>%1</b> new mail(s), <b>%2</b> outgoing" ).arg( NEW_MAILS ).arg( OUTGOING );
62
63 mailLabel->setText( output );
64 layout->addWidget( mailLabel );
65}
66
67/**
68 * launches datebook
69 */
70void MailPluginWidget::startMail() {
71 QCopEnvelope e("QPE/System", "execute(QString)");
72 e << QString( "mail" );
73}
diff --git a/core/pim/today/plugins/mail/mailpluginwidget.h b/core/pim/today/plugins/mail/mailpluginwidget.h
new file mode 100644
index 0000000..2feef80
--- a/dev/null
+++ b/core/pim/today/plugins/mail/mailpluginwidget.h
@@ -0,0 +1,45 @@
1/*
2 * mailpluginwidget.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18#ifndef MAIL_PLUGIN_WIDGET_H
19#define MAIL_PLUGIN_WIDGET_H
20
21#include <qstring.h>
22#include <qwidget.h>
23
24#include <opie/tododb.h>
25#include <opie/oclickablelabel.h>
26
27class MailPluginWidget : public QWidget {
28
29 Q_OBJECT
30
31
32public:
33 MailPluginWidget( QWidget *parent, const char *name );
34 ~MailPluginWidget();
35
36protected slots:
37 void startMail();
38
39private:
40 OClickableLabel *mailLabel;
41 void readConfig();
42 void getInfo();
43};
44
45#endif
diff --git a/core/pim/today/plugins/mail/opie-today-todolistplugin.control b/core/pim/today/plugins/mail/opie-today-todolistplugin.control
new file mode 100644
index 0000000..7fb8cbf
--- a/dev/null
+++ b/core/pim/today/plugins/mail/opie-today-todolistplugin.control
@@ -0,0 +1,8 @@
1Files: $OPIEDIR/lib/today/libtodaymailplugin.so*
2Priority: optional
3Section: opie/applications
4Maintainer: Maximilian Reiss <harlekin@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Mail plugin for today
diff --git a/core/pim/today/plugins/todolist/moc_todoplugin.cpp b/core/pim/today/plugins/todolist/moc_todoplugin.cpp
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/moc_todoplugin.cpp
diff --git a/core/pim/today/plugins/todolist/moc_todoplugin.o b/core/pim/today/plugins/todolist/moc_todoplugin.o
new file mode 100644
index 0000000..1e6a22f
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/moc_todoplugin.o
Binary files differ
diff --git a/core/pim/today/plugins/todolist/opie-today-todolistplugin.control b/core/pim/today/plugins/todolist/opie-today-todolistplugin.control
new file mode 100644
index 0000000..91a7202
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/opie-today-todolistplugin.control
@@ -0,0 +1,8 @@
1Files: $OPIEDIR/lib/today/libtodaytodolistplugin.so*
2Priority: optional
3Section: opie/applications
4Maintainer: Maximilian Reiss <harlekin@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Todolist plugin for today
diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro
new file mode 100644
index 0000000..1f9c61c
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todolist.pro
@@ -0,0 +1,20 @@
1TEMPLATE = lib
2#TEMPLATE = app
3CONFIG -= moc
4CONFIG += qt debug
5
6# Input
7HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \
8 todopluginwidget.h
9SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \
10 todopluginwidget.cpp
11
12INCLUDEPATH += $(OPIEDIR)/include \
13 ../ ../library
14DEPENDPATH += $(OPIEDIR)/include \
15 ../ ../library
16
17LIBS+= -lqpe -lopie
18
19DESTDIR = $(OPIEDIR)/plugins/today
20TARGET = todaytodolistplugin \ No newline at end of file
diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp
new file mode 100644
index 0000000..f5f6ed6
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todoplugin.cpp
@@ -0,0 +1,71 @@
1/*
2 * todoplugin.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17
18
19#include "todoplugin.h"
20#include "todopluginconfig.h"
21#include "todopluginwidget.h"
22
23
24TodolistPlugin::TodolistPlugin() {
25}
26
27TodolistPlugin::~TodolistPlugin() {
28}
29
30QString TodolistPlugin::pluginName() const {
31 return "Todolist plugin";
32}
33
34double TodolistPlugin::versionNumber() const {
35 return 0.1;
36}
37
38QString TodolistPlugin::pixmapNameWidget() const {
39 return "TodoList";
40}
41
42QWidget* TodolistPlugin::widget( QWidget *wid ) {
43 return new TodolistPluginWidget( wid, "Todolist" );
44}
45
46QString TodolistPlugin::pixmapNameConfig() const {
47 return "TodoList";
48}
49
50ConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) {
51 return new TodolistPluginConfig( wid , "Todolist" );
52}
53
54QString TodolistPlugin::appName() const {
55 return "Todolist";
56}
57
58int TodolistPlugin::minHeight() const {
59 return 10;
60}
61
62int TodolistPlugin::maxHeight() const {
63 return 100;
64}
65
66
67
68
69 int main() {
70}
71
diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h
new file mode 100644
index 0000000..77889d6
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todoplugin.h
@@ -0,0 +1,47 @@
1/*
2 * todoplugin.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_H
18#define TODOLIST_PLUGIN_H
19
20#include <qstring.h>
21#include <qwidget.h>
22
23#include <opie/tododb.h>
24#include <opie/oclickablelabel.h>
25
26#include "../../todayplugininterface.h"
27#include "../../configwidget.h"
28
29class TodolistPlugin : public TodayPluginObject {
30
31
32public:
33 TodolistPlugin();
34 ~TodolistPlugin();
35
36 QString pluginName() const;
37 double versionNumber() const;
38 QString pixmapNameWidget() const;
39 QWidget* widget(QWidget *);
40 QString pixmapNameConfig() const;
41 ConfigWidget* configWidget(QWidget *);
42 QString appName() const;
43 virtual int minHeight() const;
44 virtual int maxHeight() const;
45};
46
47#endif
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp
new file mode 100644
index 0000000..da81600
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp
@@ -0,0 +1,69 @@
1/*
2 * todopluginconfig.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "todopluginconfig.h"
18
19#include <qpe/config.h>
20
21#include <qlayout.h>
22#include <qtoolbutton.h>
23#include <qlabel.h>
24
25
26TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name)
27 : ConfigWidget(parent, name ) {
28
29 QVBoxLayout * layout = new QVBoxLayout( this );
30
31 QFrame* Frame9 = new QFrame( this, "Frame9" );
32 Frame9->setGeometry( QRect( -5, 0, 230, 310 ) );
33 Frame9->setFrameShape( QFrame::StyledPanel );
34 Frame9->setFrameShadow( QFrame::Raised );
35
36 QLabel* TextLabel6 = new QLabel( Frame9, "TextLabel6" );
37 TextLabel6->setGeometry( QRect( 20, 10, 100, 60 ) );
38 TextLabel6->setText( tr( "How many\n"
39 "tasks should \n"
40 "be shown?" ) );
41
42 SpinBox2 = new QSpinBox( Frame9, "SpinBox2" );
43 SpinBox2->setGeometry( QRect( 115, 20, 58, 25 ) );
44 SpinBox2->setMaxValue( 20 );
45 SpinBox2->setValue( 5 );
46
47 layout->addWidget( Frame9 );
48
49 readConfig();
50}
51
52void TodolistPluginConfig::readConfig() {
53 Config cfg( "todaydatebookplugin" );
54 cfg.setGroup( "config" );
55 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
56 SpinBox2->setValue( m_max_lines_task );
57}
58
59
60void TodolistPluginConfig::writeConfig() {
61 Config cfg( "todaydatebookplugin" );
62 cfg.setGroup( "config" );
63 cfg.writeEntry( "maxlinestask", m_max_lines_task );
64 cfg.write();
65}
66
67
68TodolistPluginConfig::~TodolistPluginConfig() {
69}
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.h b/core/pim/today/plugins/todolist/todopluginconfig.h
new file mode 100644
index 0000000..a46cc7c
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginconfig.h
@@ -0,0 +1,55 @@
1/*
2 * todopluginconfig.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_CONFIG_H
18#define TODOLIST_PLUGIN_CONFIG_H
19
20#include <qwidget.h>
21#include <qspinbox.h>
22
23#include "../../configwidget.h"
24
25class TodolistPluginConfig : public ConfigWidget {
26
27 Q_OBJECT
28
29public:
30
31 TodolistPluginConfig( QWidget *parent, const char *name );
32 ~TodolistPluginConfig();
33
34private:
35 /**
36 * if changed then save
37 */
38 bool changed();
39 void readConfig();
40 void writeConfig();
41
42 QSpinBox* SpinBox2;
43
44 // how many lines should be showed in the todolist section
45 int m_max_lines_task;
46
47
48
49};
50
51
52
53
54
55#endif
diff --git a/core/pim/today/plugins/todolist/todopluginimpl.cpp b/core/pim/today/plugins/todolist/todopluginimpl.cpp
new file mode 100644
index 0000000..b1849ff
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginimpl.cpp
@@ -0,0 +1,43 @@
1/*
2 * todopluginimpl.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "todoplugin.h"
18#include "todopluginimpl.h"
19
20TodolistPluginImpl::TodolistPluginImpl() {
21 todolistPlugin = new TodolistPlugin();
22}
23
24TodolistPluginImpl::~TodolistPluginImpl() {
25}
26
27
28TodayPluginObject* TodolistPluginImpl::guiPart() {
29 return todolistPlugin;
30}
31
32QRESULT TodolistPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
33 *iface = 0;
34 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) {
35 *iface = this, (*iface)->addRef();
36 }
37 return QS_OK;
38
39}
40
41Q_EXPORT_INTERFACE() {
42 Q_CREATE_INSTANCE( TodolistPluginImpl );
43}
diff --git a/core/pim/today/plugins/todolist/todopluginimpl.h b/core/pim/today/plugins/todolist/todopluginimpl.h
new file mode 100644
index 0000000..29e0294
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginimpl.h
@@ -0,0 +1,40 @@
1/*
2 * todopluginimpl.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_IMPL_H
18#define TODOLIST_PLUGIN_IMPL_H
19
20#include "../../todayplugininterface.h"
21
22class TodolistPlugin;
23
24class TodolistPluginImpl : public TodayPluginInterface{
25
26public:
27 TodolistPluginImpl();
28 virtual ~TodolistPluginImpl();
29
30 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
31 Q_REFCOUNT
32
33 virtual TodayPluginObject *guiPart();
34
35private:
36 TodolistPlugin *todolistPlugin;
37 ulong ref;
38};
39
40#endif
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.cpp b/core/pim/today/plugins/todolist/todopluginwidget.cpp
new file mode 100644
index 0000000..2a0e5a3
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginwidget.cpp
@@ -0,0 +1,132 @@
1/*
2 * todopluginwidget.cpp
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "todopluginwidget.h"
18
19#include <qvaluelist.h>
20#include <qtl.h>
21#include <qstring.h>
22#include <qscrollview.h>
23#include <qobject.h>
24#include <qlayout.h>
25
26#include <qpe/config.h>
27#include <qpe/timestring.h>
28#include <qpe/qcopenvelope_qws.h>
29
30TodolistPluginWidget::TodolistPluginWidget( QWidget *parent, const char* name)
31 : QWidget(parent, name ) {
32
33 todoLabel= 0l;
34
35 todo = 0l;
36 if ( todo ) {
37 delete todo;
38 }
39 todo = new ToDoDB();
40
41 readConfig();
42 m_maxCharClip = 36;
43 getTodo();
44}
45
46TodolistPluginWidget::~TodolistPluginWidget() {
47 delete todo;
48}
49
50void TodolistPluginWidget::readConfig() {
51 Config cfg( "todaytodolistplugin" );
52 cfg.setGroup( "config" );
53 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
54}
55
56
57/**
58 * Get the todos
59 */
60void TodolistPluginWidget::getTodo() {
61
62 QVBoxLayout* layoutTodo = new QVBoxLayout( this );
63
64 if ( todoLabel ) {
65 delete todoLabel;
66 }
67
68 todoLabel = new OClickableLabel( this );
69 todoLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) );
70 connect( todoLabel, SIGNAL( clicked() ), this, SLOT( startTodolist() ) );
71 QString output;
72 QString tmpout;
73 int count = 0;
74 int ammount = 0;
75
76 // get overdue todos first
77 QValueList<ToDoEvent> overDueList = todo->overDue();
78 qBubbleSort(overDueList);
79 for ( QValueList<ToDoEvent>::Iterator it = overDueList.begin();
80 it!=overDueList.end(); ++it ) {
81 if (!(*it).isCompleted() && ( ammount < m_maxLinesTask ) ) {
82 QString desc = (*it).summary();
83 if( desc.isEmpty() ) {
84 desc = (*it).description();
85 }
86 tmpout += "<font color=#e00000><b>-" + desc.mid(0, m_maxCharClip) + "</b></font><br>";
87 ammount++;
88 }
89 }
90
91 // get total number of still open todos
92 QValueList<ToDoEvent> openTodo = todo->rawToDos();
93 qBubbleSort( openTodo );
94 for ( QValueList<ToDoEvent>::Iterator it=openTodo.begin();
95 it!=openTodo.end(); ++it ) {
96 if ( !(*it).isCompleted() ){
97 count +=1;
98 // not the overdues, we allready got them, and not if we are
99 // over the maxlines
100 if ( !(*it).isOverdue() && ( ammount < m_maxLinesTask ) ) {
101 QString desc = (*it).summary();
102 if( desc.isEmpty() ) {
103 desc = (*it).description();
104 }
105 tmpout += "<b>-</b>" + desc.mid(0, m_maxCharClip) + "<br>";
106 ammount++;
107 }
108 }
109 }
110
111
112 if ( count > 0 ) {
113 if( count == 1 ) {
114 output += QObject::tr( "There is <b> 1</b> active task: <br>" );
115 } else {
116 output += QObject::tr( "There are <b> %1</b> active tasks: <br>" ).arg(count);
117 }
118 output += tmpout;
119 } else {
120 output = QObject::tr( "No active tasks" );
121 }
122 todoLabel->setText( output );
123 layoutTodo->addWidget( todoLabel );
124}
125
126/**
127 * start the todolist
128 */
129void TodolistPluginWidget::startTodolist() {
130 QCopEnvelope e("QPE/System", "execute(QString)");
131 e << QString("todolist");
132}
diff --git a/core/pim/today/plugins/todolist/todopluginwidget.h b/core/pim/today/plugins/todolist/todopluginwidget.h
new file mode 100644
index 0000000..ccc312a
--- a/dev/null
+++ b/core/pim/today/plugins/todolist/todopluginwidget.h
@@ -0,0 +1,47 @@
1/*
2 * todopluginwidget.h
3 *
4 * copyright : (c) 2002 by Maximilian Reiß
5 * email : harlekin@handhelds.org
6 *
7 */
8/***************************************************************************
9 * *
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 *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef TODOLIST_PLUGIN_WIDGET_H
18#define TODOLIST_PLUGIN_WIDGET_H
19
20#include <qstring.h>
21#include <qwidget.h>
22
23#include <opie/tododb.h>
24#include <opie/oclickablelabel.h>
25
26
27class TodolistPluginWidget : public QWidget {
28
29 Q_OBJECT
30
31public:
32 TodolistPluginWidget( QWidget *parent, const char *name );
33 ~TodolistPluginWidget();
34
35protected slots:
36 void startTodolist();
37
38private:
39 OClickableLabel *todoLabel;
40 ToDoDB *todo;
41 void readConfig();
42 void getTodo();
43 int m_maxLinesTask;
44 int m_maxCharClip;
45};
46
47#endif