summaryrefslogtreecommitdiff
authoreilers <eilers>2003-08-01 12:44:27 (UTC)
committer eilers <eilers>2003-08-01 12:44:27 (UTC)
commit79e5e877ad1a42cf6486db94a2face8f8107ff8c (patch) (unidiff)
tree36dbcce317bfca3ad8775d864fef511d2ab3a769
parent6c715b67a8f0e32a4edca5be91332622834c8d91 (diff)
downloadopie-79e5e877ad1a42cf6486db94a2face8f8107ff8c.zip
opie-79e5e877ad1a42cf6486db94a2face8f8107ff8c.tar.gz
opie-79e5e877ad1a42cf6486db94a2face8f8107ff8c.tar.bz2
Merging changes in BRANCH_1_0 into HEAD
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/plugins/addressbook/addressplugin.cpp5
-rw-r--r--core/pim/today/plugins/addressbook/addressplugin.h1
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.cpp2
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.h2
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp11
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.h1
-rw-r--r--core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control2
7 files changed, 15 insertions, 9 deletions
diff --git a/core/pim/today/plugins/addressbook/addressplugin.cpp b/core/pim/today/plugins/addressbook/addressplugin.cpp
index a70f8d8..5d5d34c 100644
--- a/core/pim/today/plugins/addressbook/addressplugin.cpp
+++ b/core/pim/today/plugins/addressbook/addressplugin.cpp
@@ -58,12 +58,17 @@ QString AddressBookPlugin::appName() const {
58 return "addressbook"; 58 return "addressbook";
59} 59}
60 60
61 61
62bool AddressBookPlugin::excludeFromRefresh() const { 62bool AddressBookPlugin::excludeFromRefresh() const {
63 return false; 63 return false;
64} 64}
65 65
66void AddressBookPlugin::refresh() 66void AddressBookPlugin::refresh()
67{ 67{
68 m_abWidget->refresh( NULL ); 68 m_abWidget->refresh( NULL );
69} 69}
70
71void AddressBookPlugin::reinitialize()
72{
73 m_abWidget->reinitialize();
74}
diff --git a/core/pim/today/plugins/addressbook/addressplugin.h b/core/pim/today/plugins/addressbook/addressplugin.h
index 04e4faf..0b3b065 100644
--- a/core/pim/today/plugins/addressbook/addressplugin.h
+++ b/core/pim/today/plugins/addressbook/addressplugin.h
@@ -33,18 +33,19 @@ public:
33 AddressBookPlugin(); 33 AddressBookPlugin();
34 ~AddressBookPlugin(); 34 ~AddressBookPlugin();
35 35
36 QString pluginName() const; 36 QString pluginName() const;
37 double versionNumber() const; 37 double versionNumber() const;
38 QString pixmapNameWidget() const; 38 QString pixmapNameWidget() const;
39 QWidget* widget(QWidget *); 39 QWidget* widget(QWidget *);
40 QString pixmapNameConfig() const; 40 QString pixmapNameConfig() const;
41 TodayConfigWidget* configWidget(QWidget *); 41 TodayConfigWidget* configWidget(QWidget *);
42 QString appName() const; 42 QString appName() const;
43 bool excludeFromRefresh() const; 43 bool excludeFromRefresh() const;
44 void refresh(); 44 void refresh();
45 void reinitialize();
45 46
46 private: 47 private:
47 AddressBookPluginWidget* m_abWidget; 48 AddressBookPluginWidget* m_abWidget;
48}; 49};
49 50
50#endif 51#endif
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
index 9c65e7d..b79c679 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
@@ -69,25 +69,24 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char*
69 SpinBoxClip->setMaxValue( 200 ); 69 SpinBoxClip->setMaxValue( 200 );
70 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); 70 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) );
71#endif 71#endif
72 72
73 // Look ahead settings 73 // Look ahead settings
74 QHBox *box3 = new QHBox( this ); 74 QHBox *box3 = new QHBox( this );
75 QLabel* daysLabel = new QLabel( box3, "" ); 75 QLabel* daysLabel = new QLabel( box3, "" );
76 daysLabel->setText( tr( "Days look ahead: " ) ); 76 daysLabel->setText( tr( "Days look ahead: " ) );
77 SpinDaysClip = new QSpinBox( box3, "SpinDays" ); 77 SpinDaysClip = new QSpinBox( box3, "SpinDays" );
78 SpinDaysClip->setMaxValue( 200 ); 78 SpinDaysClip->setMaxValue( 200 );
79 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); 79 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
80 80
81 // Headline color settings
82 QHBox *box5 = new QHBox( this ); 81 QHBox *box5 = new QHBox( this );
83 QLabel* colorLabel2 = new QLabel( box5, "" ); 82 QLabel* colorLabel2 = new QLabel( box5, "" );
84 colorLabel2->setText( tr( "Set Headline Color: " ) ); 83 colorLabel2->setText( tr( "Set Headline Color: " ) );
85 headlineColor = new OColorButton( box5, black , "headlineColor" ); 84 headlineColor = new OColorButton( box5, black , "headlineColor" );
86 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); 85 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) );
87 QHBox *box6 = new QHBox( this ); 86 QHBox *box6 = new QHBox( this );
88 87
89 // Entry color settings 88 // Entry color settings
90 QLabel* colorLabel3= new QLabel( box6, "" ); 89 QLabel* colorLabel3= new QLabel( box6, "" );
91 colorLabel3->setText( tr( "Set Entry Color: " ) ); 90 colorLabel3->setText( tr( "Set Entry Color: " ) );
92 entryColor = new OColorButton( box6, black , "entryColor" ); 91 entryColor = new OColorButton( box6, black , "entryColor" );
93 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); 92 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) );
@@ -97,25 +96,24 @@ AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char*
97 QLabel* colorLabel5 = new QLabel( box7, "" ); 96 QLabel* colorLabel5 = new QLabel( box7, "" );
98 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); 97 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) );
99 SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); 98 SpinUrgentClip = new QSpinBox( box7, "SpinDays" );
100 SpinUrgentClip->setMaxValue( 200 ); 99 SpinUrgentClip->setMaxValue( 200 );
101 QLabel* colorLabel6 = new QLabel( box7, "" ); 100 QLabel* colorLabel6 = new QLabel( box7, "" );
102 colorLabel6->setText( tr( " days: " ) ); 101 colorLabel6->setText( tr( " days: " ) );
103 urgentColor = new OColorButton( box7, red , "urgentColor" ); 102 urgentColor = new OColorButton( box7, red , "urgentColor" );
104 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); 103 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) );
105 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); 104 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) );
106 105
107 106
108 layout->addWidget( b_group ); 107 layout->addWidget( b_group );
109 // layout->addWidget( box4 );
110 layout->addWidget( box1 ); 108 layout->addWidget( box1 );
111 // layout->addWidget( box2 ); 109 // layout->addWidget( box2 );
112 layout->addWidget( box3 ); 110 layout->addWidget( box3 );
113 layout->addWidget( box5 ); 111 layout->addWidget( box5 );
114 layout->addWidget( box6 ); 112 layout->addWidget( box6 );
115 layout->addWidget( box7 ); 113 layout->addWidget( box7 );
116 114
117 readConfig(); 115 readConfig();
118 116
119} 117}
120 118
121void AddressBookPluginConfig::readConfig() { 119void AddressBookPluginConfig::readConfig() {
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h
index 5e07aa3..5626e5d 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.h
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h
@@ -18,25 +18,25 @@
18 18
19#ifndef ADDRESSBOOK_PLUGIN_CONFIG_H 19#ifndef ADDRESSBOOK_PLUGIN_CONFIG_H
20#define ADDRESSBOOK_PLUGIN_CONFIG_H 20#define ADDRESSBOOK_PLUGIN_CONFIG_H
21 21
22#include <qwidget.h> 22#include <qwidget.h>
23#include <qspinbox.h> 23#include <qspinbox.h>
24#include <qradiobutton.h> 24#include <qradiobutton.h>
25 25
26#include <opie/todayconfigwidget.h> 26#include <opie/todayconfigwidget.h>
27#include <opie/ocolorbutton.h> 27#include <opie/ocolorbutton.h>
28 28
29class AddressBookPluginConfig : public TodayConfigWidget { 29class AddressBookPluginConfig : public TodayConfigWidget {
30 30 Q_OBJECT
31 31
32public: 32public:
33 33
34 AddressBookPluginConfig( QWidget *parent, const char *name ); 34 AddressBookPluginConfig( QWidget *parent, const char *name );
35 ~AddressBookPluginConfig(); 35 ~AddressBookPluginConfig();
36 36
37private: 37private:
38 /** 38 /**
39 * if changed then save 39 * if changed then save
40 */ 40 */
41 bool changed(); 41 bool changed();
42 void readConfig(); 42 void readConfig();
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index 498de28..dad09db 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -55,24 +55,28 @@ AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char*
55 55
56AddressBookPluginWidget::~AddressBookPluginWidget() { 56AddressBookPluginWidget::~AddressBookPluginWidget() {
57 delete m_contactdb; 57 delete m_contactdb;
58} 58}
59 59
60void AddressBookPluginWidget::refresh( const OContactAccess* ) 60void AddressBookPluginWidget::refresh( const OContactAccess* )
61{ 61{
62 qWarning(" AddressBookPluginWidget::Database was changed externally ! "); 62 qWarning(" AddressBookPluginWidget::Database was changed externally ! ");
63 m_contactdb->reload(); 63 m_contactdb->reload();
64 getAddress(); 64 getAddress();
65} 65}
66 66
67void AddressBookPluginWidget::reinitialize() {
68 readConfig();
69 getAddress();
70}
67 71
68void AddressBookPluginWidget::readConfig() { 72void AddressBookPluginWidget::readConfig() {
69 Config cfg( "todayaddressplugin" ); 73 Config cfg( "todayaddressplugin" );
70 cfg.setGroup( "config" ); 74 cfg.setGroup( "config" );
71 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 75 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
72 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 76 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
73 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 77 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
74 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 78 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
75 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); 79 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() );
76 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 80 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
77 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 81 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
78 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); 82 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true );
@@ -89,45 +93,42 @@ void AddressBookPluginWidget::getAddress() {
89 layoutTodo = new QVBoxLayout( this ); 93 layoutTodo = new QVBoxLayout( this );
90 } 94 }
91 95
92 if ( ! addressLabel ) { 96 if ( ! addressLabel ) {
93 addressLabel = new OClickableLabel( this ); 97 addressLabel = new OClickableLabel( this );
94 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); 98 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) );
95 layoutTodo->addWidget( addressLabel ); 99 layoutTodo->addWidget( addressLabel );
96 } 100 }
97 101
98 QString output; 102 QString output;
99 103
100 // Check whether the database provide the search option.. 104 // Check whether the database provide the search option..
101 // The following if-statement was replaced due to a bug in some 105 if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
102 // implementations of libopie. The replacement should work everywhere..(eilers)
103 // if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
104 if ( !( m_contactdb->querySettings() & OContactAccess::DateDiff ) ){
105 // Libopie seems to be old.. 106 // Libopie seems to be old..
106 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); 107 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" );
107 addressLabel->setText( output ); 108 addressLabel->setText( output );
108 return; 109 return;
109 } 110 }
110 111
111 // Define the query for birthdays and start search.. 112 // Define the query for birthdays and start search..
112 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); 113 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
113 int ammount = 0; 114 int ammount = 0;
114 if ( m_showBirthdays ){ 115 if ( m_showBirthdays ){
115 qWarning("Searching from now (%s) until %s ! ", 116 qWarning("Searching from now (%s) until %s ! ",
116 QDate::currentDate().toString().latin1(), 117 QDate::currentDate().toString().latin1(),
117 lookAheadDate.toString().latin1() ); 118 lookAheadDate.toString().latin1() );
119
118 OContact querybirthdays; 120 OContact querybirthdays;
119 querybirthdays.setBirthday( lookAheadDate ); 121 querybirthdays.setBirthday( lookAheadDate );
120 122
121
122 m_list = m_contactdb->queryByExample( querybirthdays, 123 m_list = m_contactdb->queryByExample( querybirthdays,
123 OContactAccess::DateDiff ); 124 OContactAccess::DateDiff );
124 if ( m_list.count() > 0 ){ 125 if ( m_list.count() > 0 ){
125 output = "<font color=" + m_headlineColor + ">" 126 output = "<font color=" + m_headlineColor + ">"
126 + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) 127 + QObject::tr( "Next birthdays in <b> %1 </b> days:" )
127 .arg( m_daysLookAhead ) 128 .arg( m_daysLookAhead )
128 + "</font> <br>"; 129 + "</font> <br>";
129 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 130 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
130 if ( ammount++ < m_maxLinesTask ){ 131 if ( ammount++ < m_maxLinesTask ){
131 // Now we want to calculate how many days 132 // Now we want to calculate how many days
132 //until birthday. We have to set 133 //until birthday. We have to set
133 // the correct year to calculate the day diff... 134 // the correct year to calculate the day diff...
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.h b/core/pim/today/plugins/addressbook/addresspluginwidget.h
index cf2ecce..b0e3811 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.h
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.h
@@ -26,24 +26,25 @@
26#include <opie/ocontactaccess.h> 26#include <opie/ocontactaccess.h>
27#include <opie/oclickablelabel.h> 27#include <opie/oclickablelabel.h>
28 28
29 29
30class AddressBookPluginWidget : public QWidget { 30class AddressBookPluginWidget : public QWidget {
31 31
32 Q_OBJECT 32 Q_OBJECT
33 33
34public: 34public:
35 AddressBookPluginWidget( QWidget *parent, const char *name ); 35 AddressBookPluginWidget( QWidget *parent, const char *name );
36 ~AddressBookPluginWidget(); 36 ~AddressBookPluginWidget();
37 37
38 void reinitialize();
38public slots: 39public slots:
39 void refresh( const OContactAccess* db ); 40 void refresh( const OContactAccess* db );
40 41
41protected slots: 42protected slots:
42 void startAddressBook(); 43 void startAddressBook();
43 44
44private: 45private:
45 OClickableLabel* addressLabel; 46 OClickableLabel* addressLabel;
46 QVBoxLayout* layoutTodo; 47 QVBoxLayout* layoutTodo;
47 OContactAccess * m_contactdb; 48 OContactAccess * m_contactdb;
48 49
49 OContactAccess::List m_list; 50 OContactAccess::List m_list;
diff --git a/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control b/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control
index 9fe23b6..1876eb8 100644
--- a/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control
+++ b/core/pim/today/plugins/addressbook/opie-today-addressbookplugin.control
@@ -1,9 +1,9 @@
1Package: opie-today-addressbookplugin 1Package: opie-today-addressbookplugin
2Files: plugins/today/libtodayaddressbookplugin.so* 2Files: plugins/today/libtodayaddressbookplugin.so*
3Priority: optional 3Priority: optional
4Section: opie/applications 4Section: opie/applications
5Maintainer: Stefan Eilers <eilers.stefan@epost.de> 5Maintainer: Stefan Eilers <eilers.stefan@epost.de>
6Architecture: arm 6Architecture: arm
7Version: $QPE_VERSION-$SUB_VERSION
8Depends: libqte2, opie-today 7Depends: libqte2, opie-today
9Description: Addressbook plugin for today shows Birthdays and Anniversaries 8Description: Addressbook plugin for today shows Birthdays and Anniversaries
9Version: $QPE_VERSION$EXTRAVERSION