summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/addressbook/addressbook.pro19
-rw-r--r--core/pim/today/plugins/addressbook/addressplugin.cpp63
-rw-r--r--core/pim/today/plugins/addressbook/addressplugin.h44
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.cpp97
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.h60
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginimpl.cpp46
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginimpl.h42
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp149
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.h57
-rw-r--r--core/pim/today/plugins/addressbook/config.in4
-rw-r--r--core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control8
11 files changed, 589 insertions, 0 deletions
diff --git a/core/pim/today/plugins/addressbook/addressbook.pro b/core/pim/today/plugins/addressbook/addressbook.pro
new file mode 100644
index 0000000..5d971e8
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addressbook.pro
@@ -0,0 +1,19 @@
1TEMPLATE = lib
2CONFIG -= moc
3CONFIG += qt release
4
5# Input
6HEADERS = addressplugin.h addresspluginimpl.h addresspluginconfig.h \
7 addresspluginwidget.h
8SOURCES = addressplugin.cpp addresspluginimpl.cpp addresspluginconfig.cpp \
9 addresspluginwidget.cpp
10
11INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library
15
16LIBS+= -lqpe -lopie
17
18DESTDIR = $(OPIEDIR)/plugins/today
19TARGET = todayaddressbookplugin
diff --git a/core/pim/today/plugins/addressbook/addressplugin.cpp b/core/pim/today/plugins/addressbook/addressplugin.cpp
new file mode 100644
index 0000000..b78a54c
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addressplugin.cpp
@@ -0,0 +1,63 @@
1/*
2 * addressplugin.cpp
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19
20
21#include "addressplugin.h"
22#include "addresspluginconfig.h"
23#include "addresspluginwidget.h"
24
25
26AddressBookPlugin::AddressBookPlugin() {
27}
28
29AddressBookPlugin::~AddressBookPlugin() {
30}
31
32QString AddressBookPlugin::pluginName() const {
33 return QObject::tr( "AddressBook plugin" );
34}
35
36double AddressBookPlugin::versionNumber() const {
37 return 0.1;
38}
39
40QString AddressBookPlugin::pixmapNameWidget() const {
41 return "AddressBook";
42}
43
44QWidget* AddressBookPlugin::widget( QWidget *wid ) {
45 return new AddressBookPluginWidget( wid, "AddressBook" );
46}
47
48QString AddressBookPlugin::pixmapNameConfig() const {
49 return "AddressBook";
50}
51
52TodayConfigWidget* AddressBookPlugin::configWidget( QWidget* wid ) {
53 return new AddressBookPluginConfig( wid , "AddressBook" );
54}
55
56QString AddressBookPlugin::appName() const {
57 return "addressbook";
58}
59
60
61bool AddressBookPlugin::excludeFromRefresh() const {
62 return true;
63}
diff --git a/core/pim/today/plugins/addressbook/addressplugin.h b/core/pim/today/plugins/addressbook/addressplugin.h
new file mode 100644
index 0000000..5b655f5
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addressplugin.h
@@ -0,0 +1,44 @@
1/*
2 * addressplugin.h
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef ADDRESSBOOK_PLUGIN_H
20#define ADDRESSBOOK_PLUGIN_H
21
22#include <qstring.h>
23#include <qwidget.h>
24
25#include <opie/oclickablelabel.h>
26#include <opie/todayplugininterface.h>
27
28class AddressBookPlugin : public TodayPluginObject {
29
30public:
31 AddressBookPlugin();
32 ~AddressBookPlugin();
33
34 QString pluginName() const;
35 double versionNumber() const;
36 QString pixmapNameWidget() const;
37 QWidget* widget(QWidget *);
38 QString pixmapNameConfig() const;
39 TodayConfigWidget* configWidget(QWidget *);
40 QString appName() const;
41 bool excludeFromRefresh() const;
42};
43
44#endif
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
new file mode 100644
index 0000000..686d72c
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
@@ -0,0 +1,97 @@
1/*
2 * addresspluginconfig.cpp
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#include "addresspluginconfig.h"
20
21#include <qpe/config.h>
22
23#include <qlayout.h>
24#include <qhbox.h>
25#include <qtoolbutton.h>
26#include <qlabel.h>
27#include <qwhatsthis.h>
28
29
30
31AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name)
32 : TodayConfigWidget(parent, name ) {
33
34 QVBoxLayout * layout = new QVBoxLayout( this );
35 layout->setMargin( 20 );
36
37 QHBox *box1 = new QHBox( this );
38
39 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" );
40 TextLabel6->setText( tr( "Max Lines " ) );
41
42 SpinBox2 = new QSpinBox( box1, "SpinBox2" );
43 SpinBox2->setMaxValue( 40 );
44 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each" ) );
45
46 QHBox *box2 = new QHBox( this );
47
48 QLabel* clipLabel = new QLabel( box2, "" );
49 clipLabel->setText( tr( "Clip line after X chars" ) );
50
51 SpinBoxClip = new QSpinBox( box2, "SpinClip" );
52 SpinBoxClip->setMaxValue( 200 );
53 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) );
54
55 QHBox *box3 = new QHBox( this );
56
57 QLabel* daysLabel = new QLabel( box3, "" );
58 daysLabel->setText( tr( "Days look ahead" ) );
59
60 SpinDaysClip = new QSpinBox( box3, "SpinDays" );
61 SpinDaysClip->setMaxValue( 200 );
62 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
63
64 layout->addWidget( box1 );
65 layout->addWidget( box2 );
66 layout->addWidget( box3 );
67
68 readConfig();
69}
70
71void AddressBookPluginConfig::readConfig() {
72 Config cfg( "todayaddressplugin" );
73 cfg.setGroup( "config" );
74 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
75 SpinBox2->setValue( m_max_lines_task );
76 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
77 SpinBoxClip->setValue( m_maxCharClip );
78 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
79 SpinDaysClip->setValue( m_daysLookAhead );
80}
81
82
83void AddressBookPluginConfig::writeConfig() {
84 Config cfg( "todayaddressplugin" );
85 cfg.setGroup( "config" );
86 m_max_lines_task = SpinBox2->value();
87 cfg.writeEntry( "maxlinestask", m_max_lines_task );
88 m_maxCharClip = SpinBoxClip->value();
89 cfg.writeEntry( "maxcharclip", m_maxCharClip );
90 m_daysLookAhead = SpinDaysClip->value();
91 cfg.writeEntry( "dayslookahead", m_daysLookAhead );
92 cfg.write();
93}
94
95
96AddressBookPluginConfig::~AddressBookPluginConfig() {
97}
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h
new file mode 100644
index 0000000..6f128d4
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h
@@ -0,0 +1,60 @@
1/*
2 * addresspluginconfig.h
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef ADDRESSBOOK_PLUGIN_CONFIG_H
20#define ADDRESSBOOK_PLUGIN_CONFIG_H
21
22#include <qwidget.h>
23#include <qspinbox.h>
24
25#include <opie/todayconfigwidget.h>
26
27class AddressBookPluginConfig : public TodayConfigWidget {
28
29
30public:
31
32 AddressBookPluginConfig( QWidget *parent, const char *name );
33 ~AddressBookPluginConfig();
34
35private:
36 /**
37 * if changed then save
38 */
39 bool changed();
40 void readConfig();
41 void writeConfig();
42
43 QSpinBox* SpinBox2;
44 QSpinBox* SpinBoxClip;
45 QSpinBox* SpinDaysClip;
46
47 // how many lines should be showed in the AddressBook section
48 int m_max_lines_task;
49 // clip the lines after X chars
50 int m_maxCharClip;
51 // How many days look ahead
52 int m_daysLookAhead;
53
54};
55
56
57
58
59
60#endif
diff --git a/core/pim/today/plugins/addressbook/addresspluginimpl.cpp b/core/pim/today/plugins/addressbook/addresspluginimpl.cpp
new file mode 100644
index 0000000..54e620e
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addresspluginimpl.cpp
@@ -0,0 +1,46 @@
1/*
2 * addresspluginimpl.cpp
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#include "addressplugin.h"
20#include "addresspluginimpl.h"
21
22AddressBookPluginImpl::AddressBookPluginImpl() {
23 addressbookPlugin = new AddressBookPlugin();
24}
25
26AddressBookPluginImpl::~AddressBookPluginImpl() {
27 delete addressbookPlugin;
28}
29
30
31TodayPluginObject* AddressBookPluginImpl::guiPart() {
32 return addressbookPlugin;
33}
34
35QRESULT AddressBookPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) {
36 *iface = 0;
37 if ( ( uuid == IID_QUnknown ) || ( uuid == IID_TodayPluginInterface ) ) {
38 *iface = this, (*iface)->addRef();
39 }
40 return QS_OK;
41
42}
43
44Q_EXPORT_INTERFACE() {
45 Q_CREATE_INSTANCE( AddressBookPluginImpl );
46}
diff --git a/core/pim/today/plugins/addressbook/addresspluginimpl.h b/core/pim/today/plugins/addressbook/addresspluginimpl.h
new file mode 100644
index 0000000..a52c021
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addresspluginimpl.h
@@ -0,0 +1,42 @@
1/*
2 * addresspluginimpl.h
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef ADDRESSBOOK_PLUGIN_IMPL_H
20#define ADDRESSBOOK_PLUGIN_IMPL_H
21
22#include <opie/todayplugininterface.h>
23
24class AddressBookPlugin;
25
26class AddressBookPluginImpl : public TodayPluginInterface{
27
28public:
29 AddressBookPluginImpl();
30 virtual ~AddressBookPluginImpl();
31
32 QRESULT queryInterface( const QUuid &, QUnknownInterface** );
33 Q_REFCOUNT
34
35 virtual TodayPluginObject *guiPart();
36
37private:
38 AddressBookPlugin *addressbookPlugin;
39 ulong ref;
40};
41
42#endif
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
new file mode 100644
index 0000000..015ac6a
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -0,0 +1,149 @@
1/*
2 * addresspluginwidget.cpp
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#include "addresspluginwidget.h"
20
21#include <qvaluelist.h>
22#include <qtl.h>
23#include <qstring.h>
24#include <qscrollview.h>
25#include <qobject.h>
26#include <qdatetime.h>
27
28#include <qpe/config.h>
29#include <qpe/timestring.h>
30#include <qpe/qcopenvelope_qws.h>
31
32#include <opie/ocontact.h>
33
34AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name )
35 : QWidget( parent, name ) {
36
37 addressLabel = 0l;
38 m_contactdb = 0l;
39 layoutTodo = 0l;
40
41 // Hä ? Nonsense ! (se)
42 if ( m_contactdb ) {
43 delete m_contactdb;
44 }
45
46 m_contactdb = new OContactAccess("addressplugin");
47
48 connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ),
49 this, SLOT( refresh( const OContactAccess * ) ) );
50
51
52 readConfig();
53 getAddress();
54}
55
56AddressBookPluginWidget::~AddressBookPluginWidget() {
57 delete m_contactdb;
58}
59
60void AddressBookPluginWidget::refresh( const OContactAccess* )
61{
62 qWarning(" AddressBookPluginWidget::Database was changed externally ! ");
63 m_contactdb->reload();
64 getAddress();
65}
66
67
68void AddressBookPluginWidget::readConfig() {
69 Config cfg( "todayaddressplugin" );
70 cfg.setGroup( "config" );
71 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
72 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
73 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
74}
75
76
77/**
78 * Get the addresss
79 */
80void AddressBookPluginWidget::getAddress() {
81
82 if ( ! layoutTodo ){
83 layoutTodo = new QVBoxLayout( this );
84 }
85
86 if ( ! addressLabel ) {
87 addressLabel = new OClickableLabel( this );
88 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) );
89 layoutTodo->addWidget( addressLabel );
90 }
91
92 QString output;
93
94 // Check whether the database provide the search option..
95 if ( ! m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
96
97 // Define the query for birthdays and start search..
98 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
99 qWarning("Searching from now (%s) until %s ! ", QDate::currentDate().toString().latin1(),
100 lookAheadDate.toString().latin1() );
101 OContact querybirthdays;
102 querybirthdays.setBirthday( lookAheadDate );
103
104 int ammount = 0;
105
106 m_list = m_contactdb->queryByExample( querybirthdays, OContactAccess::DateDiff );
107 if ( m_list.count() > 0 ){
108 output = QObject::tr( "Next birthdays in <b> %1 </b> days: <br>" ).arg( m_daysLookAhead );
109 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
110 if ( ammount++ < m_maxLinesTask )
111 output += "<font color=#e00000><b>-" + (*m_it).fullName() + "</b></font><br>";
112 }
113 } else {
114 output = QObject::tr( "No birthdays in <b> %1 </b> days! <br>" ).arg( m_daysLookAhead );
115 }
116
117 // Define the query for anniversaries and start search..
118 OContact queryanniversaries;
119 queryanniversaries.setAnniversary( lookAheadDate );
120
121 m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff );
122
123 ammount = 0;
124 if ( m_list.count() > 0 ){
125 output += QObject::tr( "Next anniversaries in <b> %1 </b> days: <br>" ).arg( m_daysLookAhead );
126 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
127 if ( ammount++ < m_maxLinesTask )
128 output += "<font color=#e00000><b>-" + (*m_it).fullName() + "</b></font><br>";
129 }
130 } else {
131 output += QObject::tr( "No anniversaries in <b> %1 </b> days! <br>" ).arg( m_daysLookAhead );
132 }
133
134
135 }else{
136 // Libopie seems to be old..
137 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" );
138 }
139
140 addressLabel->setText( output );
141}
142
143/**
144 * start the todolist
145 */
146void AddressBookPluginWidget::startAddressBook() {
147 QCopEnvelope e( "QPE/System", "execute(QString)" );
148 e << QString( "addressbook" );
149}
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.h b/core/pim/today/plugins/addressbook/addresspluginwidget.h
new file mode 100644
index 0000000..75e223a
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.h
@@ -0,0 +1,57 @@
1/*
2 * addresspluginwidget.h
3 *
4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de
6 *
7 * This implementation was derived from the todolist plugin implementation
8 *
9 */
10/***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef ADDRESSBOOK_PLUGIN_WIDGET_H
20#define ADDRESSBOOK_PLUGIN_WIDGET_H
21
22#include <qstring.h>
23#include <qwidget.h>
24#include <qlayout.h>
25
26#include <opie/ocontactaccess.h>
27#include <opie/oclickablelabel.h>
28
29
30class AddressBookPluginWidget : public QWidget {
31
32 Q_OBJECT
33
34public:
35 AddressBookPluginWidget( QWidget *parent, const char *name );
36 ~AddressBookPluginWidget();
37
38protected slots:
39 void startAddressBook();
40 void refresh( const OContactAccess* db );
41
42private:
43 OClickableLabel* addressLabel;
44 QVBoxLayout* layoutTodo;
45 OContactAccess * m_contactdb;
46
47 OContactAccess::List m_list;
48 OContactAccess::List::Iterator m_it;
49
50 void readConfig();
51 void getAddress();
52 int m_maxLinesTask;
53 int m_maxCharClip;
54 int m_daysLookAhead;
55};
56
57#endif
diff --git a/core/pim/today/plugins/addressbook/config.in b/core/pim/today/plugins/addressbook/config.in
new file mode 100644
index 0000000..bdba33a
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/config.in
@@ -0,0 +1,4 @@
1 config TODAY_ADDRESSBOOK
2 boolean "addressbook
3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
diff --git a/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control b/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control
new file mode 100644
index 0000000..89e9792
--- a/dev/null
+++ b/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control
@@ -0,0 +1,8 @@
1Files: plugins/today/libtodayaddressbookplugin.so*
2Priority: optional
3Section: opie/applications
4Maintainer: Stefan Eilers <eilers.stefan@epost.de>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION
7Depends: qt-embedded (>=$QTE_VERSION), opie-today
8Description: Addressbook plugin for today shows Birthdays and Anniversaries