summaryrefslogtreecommitdiff
authordrw <drw>2005-06-06 19:09:03 (UTC)
committer drw <drw>2005-06-06 19:09:03 (UTC)
commit9ccde964284da2c2dcc42da5e04f818e45baa148 (patch) (unidiff)
treeaafeed7ef6bcceaf1271a7f3b748b3fd9634c0f6
parent85a043b065f0b43470bc15dc6594eb520f379505 (diff)
downloadopie-9ccde964284da2c2dcc42da5e04f818e45baa148.zip
opie-9ccde964284da2c2dcc42da5e04f818e45baa148.tar.gz
opie-9ccde964284da2c2dcc42da5e04f818e45baa148.tar.bz2
Fix to show/not show birthdays and use checkboxes for selection in plugin config dialog (courtesy of hrw)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.cpp4
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.h6
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp94
3 files changed, 52 insertions, 52 deletions
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
index 7b6117e..4f1630d 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
@@ -1,137 +1,137 @@
1/* 1/*
2 * addresspluginconfig.cpp 2 * addresspluginconfig.cpp
3 * 3 *
4 * copyright : (c) 2003 by Stefan Eilers 4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de 5 * email : eilers.stefan@epost.de
6 * 6 *
7 * This implementation was derived from the todolist plugin implementation 7 * This implementation was derived from the todolist plugin implementation
8 * 8 *
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "addresspluginconfig.h" 19#include "addresspluginconfig.h"
20 20
21#include <qpe/config.h> 21#include <qpe/config.h>
22 22
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include <qvgroupbox.h> 27#include <qvgroupbox.h>
28 28
29 29
30AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) 30AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name)
31 : TodayConfigWidget(parent, name ) { 31 : TodayConfigWidget(parent, name ) {
32 32
33 QVBoxLayout * layout = new QVBoxLayout( this ); 33 QVBoxLayout * layout = new QVBoxLayout( this );
34 layout->setMargin( 5 ); 34 layout->setMargin( 5 );
35 35
36 // Buttongroup to enable/disable shown stuff 36 // Buttongroup to enable/disable shown stuff
37 QVGroupBox* b_group = new QVGroupBox( this, "name" ); 37 QVGroupBox* b_group = new QVGroupBox( this, "name" );
38 b_group -> setTitle( tr("Enable/Disable Views") ); 38 b_group -> setTitle( tr("Enable/Disable Views") );
39 m_showBirthdayButton = new QRadioButton( b_group ); 39 m_showBirthdayButton = new QCheckBox( b_group );
40 m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); 40 m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) );
41 m_showAnniversaryButton = new QRadioButton( b_group ); 41 m_showAnniversaryButton = new QCheckBox( b_group );
42 m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); 42 m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) );
43 43
44 QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); 44 QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) );
45 QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); 45 QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) );
46 46
47 // Max lines settings 47 // Max lines settings
48 QHBox *box1 = new QHBox( this ); 48 QHBox *box1 = new QHBox( this );
49 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); 49 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" );
50 TextLabel6->setText( tr( "Max Lines: " ) ); 50 TextLabel6->setText( tr( "Max Lines: " ) );
51 SpinBox2 = new QSpinBox( box1, "SpinBox2" ); 51 SpinBox2 = new QSpinBox( box1, "SpinBox2" );
52 SpinBox2->setMaxValue( 40 ); 52 SpinBox2->setMaxValue( 40 );
53 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); 53 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) );
54 54
55 // Look ahead settings 55 // Look ahead settings
56 QHBox *box3 = new QHBox( this ); 56 QHBox *box3 = new QHBox( this );
57 QLabel* daysLabel = new QLabel( box3, "" ); 57 QLabel* daysLabel = new QLabel( box3, "" );
58 daysLabel->setText( tr( "Days look ahead: " ) ); 58 daysLabel->setText( tr( "Days look ahead: " ) );
59 SpinDaysClip = new QSpinBox( box3, "SpinDays" ); 59 SpinDaysClip = new QSpinBox( box3, "SpinDays" );
60 SpinDaysClip->setMaxValue( 200 ); 60 SpinDaysClip->setMaxValue( 200 );
61 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); 61 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
62 62
63 63
64 QHBox *box5 = new QHBox( this ); 64 QHBox *box5 = new QHBox( this );
65 QLabel* colorLabel2 = new QLabel( box5, "" ); 65 QLabel* colorLabel2 = new QLabel( box5, "" );
66 colorLabel2->setText( tr( "Set Headline Color: " ) ); 66 colorLabel2->setText( tr( "Set Headline Color: " ) );
67 headlineColor = new Opie::OColorButton( box5, black , "headlineColor" ); 67 headlineColor = new Opie::OColorButton( box5, black , "headlineColor" );
68 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); 68 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) );
69 QHBox *box6 = new QHBox( this ); 69 QHBox *box6 = new QHBox( this );
70 70
71 // Entry color settings 71 // Entry color settings
72 QLabel* colorLabel3= new QLabel( box6, "" ); 72 QLabel* colorLabel3= new QLabel( box6, "" );
73 colorLabel3->setText( tr( "Set Entry Color: " ) ); 73 colorLabel3->setText( tr( "Set Entry Color: " ) );
74 entryColor = new Opie::OColorButton( box6, black , "entryColor" ); 74 entryColor = new Opie::OColorButton( box6, black , "entryColor" );
75 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); 75 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) );
76 76
77 // Urgent color settings 77 // Urgent color settings
78 QHBox *box7 = new QHBox( this ); 78 QHBox *box7 = new QHBox( this );
79 QLabel* colorLabel5 = new QLabel( box7, "" ); 79 QLabel* colorLabel5 = new QLabel( box7, "" );
80 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); 80 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) );
81 SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); 81 SpinUrgentClip = new QSpinBox( box7, "SpinDays" );
82 SpinUrgentClip->setMaxValue( 200 ); 82 SpinUrgentClip->setMaxValue( 200 );
83 QLabel* colorLabel6 = new QLabel( box7, "" ); 83 QLabel* colorLabel6 = new QLabel( box7, "" );
84 colorLabel6->setText( tr( " days: " ) ); 84 colorLabel6->setText( tr( " days: " ) );
85 urgentColor = new Opie::OColorButton( box7, red , "urgentColor" ); 85 urgentColor = new Opie::OColorButton( box7, red , "urgentColor" );
86 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); 86 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) );
87 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); 87 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) );
88 88
89 89
90 layout->addWidget( b_group ); 90 layout->addWidget( b_group );
91 layout->addWidget( box1 ); 91 layout->addWidget( box1 );
92 layout->addWidget( box3 ); 92 layout->addWidget( box3 );
93 layout->addWidget( box5 ); 93 layout->addWidget( box5 );
94 layout->addWidget( box6 ); 94 layout->addWidget( box6 );
95 layout->addWidget( box7 ); 95 layout->addWidget( box7 );
96 96
97 /* 97 /*
98 * pack the widgets together 98 * pack the widgets together
99 */ 99 */
100 QSpacerItem *item = new QSpacerItem( 1, 2, QSizePolicy::Minimum, 100 QSpacerItem *item = new QSpacerItem( 1, 2, QSizePolicy::Minimum,
101 QSizePolicy::MinimumExpanding ); 101 QSizePolicy::MinimumExpanding );
102 layout->addItem( item ); 102 layout->addItem( item );
103 103
104 readConfig(); 104 readConfig();
105 105
106} 106}
107 107
108void AddressBookPluginConfig::readConfig() { 108void AddressBookPluginConfig::readConfig() {
109 Config cfg( "todayaddressplugin" ); 109 Config cfg( "todayaddressplugin" );
110 cfg.setGroup( "config" ); 110 cfg.setGroup( "config" );
111 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); 111 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
112 SpinBox2->setValue( m_max_lines_task ); 112 SpinBox2->setValue( m_max_lines_task );
113// m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 113// m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
114// SpinBoxClip->setValue( m_maxCharClip ); 114// SpinBoxClip->setValue( m_maxCharClip );
115 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 115 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
116 SpinDaysClip->setValue( m_daysLookAhead ); 116 SpinDaysClip->setValue( m_daysLookAhead );
117 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 117 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
118 SpinUrgentClip->setValue( m_urgentDays ); 118 SpinUrgentClip->setValue( m_urgentDays );
119 119
120 m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); 120 m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() );
121 entryColor->setColor( QColor( m_entryColor ) ); 121 entryColor->setColor( QColor( m_entryColor ) );
122 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 122 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
123 headlineColor->setColor( QColor( m_headlineColor ) ); 123 headlineColor->setColor( QColor( m_headlineColor ) );
124 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 124 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
125 urgentColor->setColor( QColor( m_urgentColor ) ); 125 urgentColor->setColor( QColor( m_urgentColor ) );
126 126
127 m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); 127 m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) );
128 m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); 128 m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) );
129 129
130} 130}
131 131
132 132
133void AddressBookPluginConfig::writeConfig() { 133void AddressBookPluginConfig::writeConfig() {
134 Config cfg( "todayaddressplugin" ); 134 Config cfg( "todayaddressplugin" );
135 cfg.setGroup( "config" ); 135 cfg.setGroup( "config" );
136 m_max_lines_task = SpinBox2->value(); 136 m_max_lines_task = SpinBox2->value();
137 cfg.writeEntry( "maxlinestask", m_max_lines_task ); 137 cfg.writeEntry( "maxlinestask", m_max_lines_task );
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.h b/core/pim/today/plugins/addressbook/addresspluginconfig.h
index e065ca2..1284fdc 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.h
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.h
@@ -1,75 +1,75 @@
1/* 1/*
2 * addresspluginconfig.h 2 * addresspluginconfig.h
3 * 3 *
4 * copyright : (c) 2003 by Stefan Eilers 4 * copyright : (c) 2003 by Stefan Eilers
5 * email : eilers.stefan@epost.de 5 * email : eilers.stefan@epost.de
6 * 6 *
7 * This implementation was derived from the todolist plugin implementation 7 * This implementation was derived from the todolist plugin implementation
8 * 8 *
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
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 <opie2/todayconfigwidget.h> 22#include <opie2/todayconfigwidget.h>
23#include <opie2/ocolorbutton.h> 23#include <opie2/ocolorbutton.h>
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qspinbox.h> 26#include <qspinbox.h>
27#include <qradiobutton.h> 27#include <qcheckbox.h>
28 28
29class AddressBookPluginConfig : public TodayConfigWidget { 29class AddressBookPluginConfig : public TodayConfigWidget {
30 Q_OBJECT 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();
43 void writeConfig(); 43 void writeConfig();
44 44
45 QSpinBox* SpinBox2; 45 QSpinBox* SpinBox2;
46 QSpinBox* SpinBoxClip; 46 QSpinBox* SpinBoxClip;
47 QSpinBox* SpinDaysClip; 47 QSpinBox* SpinDaysClip;
48 QSpinBox* SpinUrgentClip; 48 QSpinBox* SpinUrgentClip;
49 Opie::OColorButton* entryColor; 49 Opie::OColorButton* entryColor;
50 Opie::OColorButton* headlineColor; 50 Opie::OColorButton* headlineColor;
51 Opie::OColorButton* urgentColor; 51 Opie::OColorButton* urgentColor;
52 QRadioButton* m_showBirthdayButton; 52 QCheckBox* m_showBirthdayButton;
53 QRadioButton* m_showAnniversaryButton; 53 QCheckBox* m_showAnniversaryButton;
54 54
55 // how many lines should be showed in the AddressBook section 55 // how many lines should be showed in the AddressBook section
56 int m_max_lines_task; 56 int m_max_lines_task;
57 // clip the lines after X chars 57 // clip the lines after X chars
58 int m_maxCharClip; 58 int m_maxCharClip;
59 // How many days look ahead 59 // How many days look ahead
60 int m_daysLookAhead; 60 int m_daysLookAhead;
61 // Days until urgent color is used 61 // Days until urgent color is used
62 int m_urgentDays; 62 int m_urgentDays;
63 // Entry Color 63 // Entry Color
64 QString m_entryColor; 64 QString m_entryColor;
65 // Headline Color 65 // Headline Color
66 QString m_headlineColor; 66 QString m_headlineColor;
67 // Urgent Color 67 // Urgent Color
68 QString m_urgentColor; 68 QString m_urgentColor;
69}; 69};
70 70
71 71
72 72
73 73
74 74
75#endif 75#endif
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index df7c5e1..5662af2 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -9,207 +9,207 @@
9 */ 9 */
10/*************************************************************************** 10/***************************************************************************
11 * * 11 * *
12 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. * 15 * (at your option) any later version. *
16 * * 16 * *
17 ***************************************************************************/ 17 ***************************************************************************/
18 18
19#include "addresspluginwidget.h" 19#include "addresspluginwidget.h"
20 20
21#include <opie2/odebug.h> 21#include <opie2/odebug.h>
22#include <opie2/opimcontact.h> 22#include <opie2/opimcontact.h>
23 23
24#include <qpe/config.h> 24#include <qpe/config.h>
25 25
26AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) 26AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name )
27 : QWidget( parent, name ) { 27 : QWidget( parent, name ) {
28 28
29 addressLabel = 0l; 29 addressLabel = 0l;
30 m_contactdb = 0l; 30 m_contactdb = 0l;
31 layoutTodo = 0l; 31 layoutTodo = 0l;
32 32
33 m_contactdb = new Opie::OPimContactAccess("addressplugin"); 33 m_contactdb = new Opie::OPimContactAccess("addressplugin");
34 34
35 connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ), 35 connect( m_contactdb, SIGNAL( signalChanged(const Opie::OPimContactAccess*) ),
36 this, SLOT( refresh(const Opie::OPimContactAccess*) ) ); 36 this, SLOT( refresh(const Opie::OPimContactAccess*) ) );
37 37
38 38
39 readConfig(); 39 readConfig();
40 getAddress(); 40 getAddress();
41} 41}
42 42
43AddressBookPluginWidget::~AddressBookPluginWidget() { 43AddressBookPluginWidget::~AddressBookPluginWidget() {
44 delete m_contactdb; 44 delete m_contactdb;
45} 45}
46 46
47void AddressBookPluginWidget::refresh( const Opie::OPimContactAccess* ) 47void AddressBookPluginWidget::refresh( const Opie::OPimContactAccess* )
48{ 48{
49 owarn << " AddressBookPluginWidget::Database was changed externally ! " << oendl; 49 owarn << " AddressBookPluginWidget::Database was changed externally ! " << oendl;
50 m_contactdb->reload(); 50 m_contactdb->reload();
51 getAddress(); 51 getAddress();
52} 52}
53 53
54void AddressBookPluginWidget::reinitialize() { 54void AddressBookPluginWidget::reinitialize() {
55 readConfig(); 55 readConfig();
56 getAddress(); 56 getAddress();
57} 57}
58 58
59void AddressBookPluginWidget::readConfig() { 59void AddressBookPluginWidget::readConfig() {
60 Config cfg( "todayaddressplugin" ); 60 Config cfg( "todayaddressplugin" );
61 cfg.setGroup( "config" ); 61 cfg.setGroup( "config" );
62 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 62 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
63 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 63 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
64 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 64 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
65 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 65 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
66 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); 66 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() );
67 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 67 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
68 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 68 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
69 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); 69 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true );
70 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); 70 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true );
71} 71}
72 72
73 73
74/** 74/**
75 * Get the addresss 75 * Get the addresss
76 */ 76 */
77void AddressBookPluginWidget::getAddress() { 77void AddressBookPluginWidget::getAddress() {
78 78
79 if ( ! layoutTodo ){ 79 if ( ! layoutTodo ){
80 layoutTodo = new QVBoxLayout( this ); 80 layoutTodo = new QVBoxLayout( this );
81 } 81 }
82 82
83 if ( ! addressLabel ) { 83 if ( ! addressLabel ) {
84 addressLabel = new Opie::Ui::OClickableLabel( this ); 84 addressLabel = new Opie::Ui::OClickableLabel( this );
85 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); 85 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) );
86 layoutTodo->addWidget( addressLabel ); 86 layoutTodo->addWidget( addressLabel );
87 } 87 }
88 88
89 QString output; 89 QString output;
90 90
91 // Check whether the database provide the search option.. 91 // Check whether the database provide the search option..
92 if ( !m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){ 92 if ( !m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){
93 // Libopie seems to be old.. 93 // Libopie seems to be old..
94 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); 94 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" );
95 addressLabel->setText( output ); 95 addressLabel->setText( output );
96 return; 96 return;
97 } 97 }
98 98
99 // Define the query for birthdays and start search.. 99 // Define the query for birthdays and start search..
100 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); 100 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
101 int ammount = 0; 101 int ammount = 0;
102 if ( m_showBirthdays ){ 102 if ( m_showBirthdays ){
103 owarn << "Searching from now (" << QDate::currentDate().toString() << ") until " 103 owarn << "Searching from now (" << QDate::currentDate().toString() << ") until "
104 << lookAheadDate.toString() << " ! " << oendl; 104 << lookAheadDate.toString() << " ! " << oendl;
105 }
106
107 if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){
108
109
110 Opie::OPimContact querybirthdays;
111 querybirthdays.setBirthday( lookAheadDate );
112 105
113 m_list = m_contactdb->queryByExample( querybirthdays, 106 if ( m_contactdb->hasQuerySettings( Opie::OPimContactAccess::DateDiff ) ){
114 Opie::OPimContactAccess::DateDiff ); 107
115 if ( m_list.count() > 0 ){ 108
116 output = "<font color=" + m_headlineColor + ">" 109 Opie::OPimContact querybirthdays;
117 + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) 110 querybirthdays.setBirthday( lookAheadDate );
118 .arg( m_daysLookAhead ) 111
119 + "</font> <br>"; 112 m_list = m_contactdb->queryByExample( querybirthdays,
120 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 113 Opie::OPimContactAccess::DateDiff );
121 if ( ammount++ < m_maxLinesTask ){ 114 if ( m_list.count() > 0 ){
122 // Now we want to calculate how many days 115 output = "<font color=" + m_headlineColor + ">"
123 //until birthday. We have to set 116 + QObject::tr( "Next birthdays in <b> %1 </b> days:" )
124 // the correct year to calculate the day diff... 117 .arg( m_daysLookAhead )
125 QDate destdate = (*m_it).birthday(); 118 + "</font> <br>";
126 destdate.setYMD( QDate::currentDate().year(), 119 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
127 destdate.month(), destdate.day() ); 120 if ( ammount++ < m_maxLinesTask ){
128 if ( QDate::currentDate().daysTo(destdate) < 0 ) 121 // Now we want to calculate how many days
129 destdate.setYMD( QDate::currentDate().year()+1, 122 //until birthday. We have to set
123 // the correct year to calculate the day diff...
124 QDate destdate = (*m_it).birthday();
125 destdate.setYMD( QDate::currentDate().year(),
130 destdate.month(), destdate.day() ); 126 destdate.month(), destdate.day() );
131 127 if ( QDate::currentDate().daysTo(destdate) < 0 )
132 128 destdate.setYMD( QDate::currentDate().year()+1,
133 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 129 destdate.month(), destdate.day() );
134 output += "<font color=" + m_urgentColor + "><b>-" 130
135 + (*m_it).fullName() 131
136 + " (" 132 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
137 + QString::number(QDate::currentDate() 133 output += "<font color=" + m_urgentColor + "><b>-"
138 .daysTo(destdate)) 134 + (*m_it).fullName()
139 + " Days) </b></font><br>"; 135 + " ("
140 136 + QString::number(QDate::currentDate()
141 else 137 .daysTo(destdate))
142 output += "<font color=" + m_entryColor + "><b>-" 138 + " Days) </b></font><br>";
143 + (*m_it).fullName() 139
144 + " (" 140 else
145 + QString::number(QDate::currentDate() 141 output += "<font color=" + m_entryColor + "><b>-"
146 .daysTo(destdate)) 142 + (*m_it).fullName()
147 + " Days) </b></font><br>"; 143 + " ("
144 + QString::number(QDate::currentDate()
145 .daysTo(destdate))
146 + " Days) </b></font><br>";
147 }
148 } 148 }
149 } else {
150 output = "<font color=" + m_headlineColor + ">"
151 + QObject::tr( "No birthdays in <b> %1 </b> days!" )
152 .arg( m_daysLookAhead )
153 + "</font> <br>";
149 } 154 }
150 } else {
151 output = "<font color=" + m_headlineColor + ">"
152 + QObject::tr( "No birthdays in <b> %1 </b> days!" )
153 .arg( m_daysLookAhead )
154 + "</font> <br>";
155 } 155 }
156 } 156 }
157 157
158 if ( m_showAnniversaries ){ 158 if ( m_showAnniversaries ){
159 // Define the query for anniversaries and start search.. 159 // Define the query for anniversaries and start search..
160 Opie::OPimContact queryanniversaries; 160 Opie::OPimContact queryanniversaries;
161 queryanniversaries.setAnniversary( lookAheadDate ); 161 queryanniversaries.setAnniversary( lookAheadDate );
162 162
163 m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff ); 163 m_list = m_contactdb->queryByExample( queryanniversaries, Opie::OPimContactAccess::DateDiff );
164 164
165 ammount = 0; 165 ammount = 0;
166 if ( m_list.count() > 0 ){ 166 if ( m_list.count() > 0 ){
167 output += "<font color=" + m_headlineColor + ">" 167 output += "<font color=" + m_headlineColor + ">"
168 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) 168 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" )
169 .arg( m_daysLookAhead ) 169 .arg( m_daysLookAhead )
170 + "</font> <br>"; 170 + "</font> <br>";
171 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 171 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
172 if ( ammount++ < m_maxLinesTask ){ 172 if ( ammount++ < m_maxLinesTask ){
173 // Now we want to calculate how many days until anniversary. 173 // Now we want to calculate how many days until anniversary.
174 // We have to set the correct year to calculate the day diff... 174 // We have to set the correct year to calculate the day diff...
175 QDate destdate = (*m_it).anniversary(); 175 QDate destdate = (*m_it).anniversary();
176 destdate.setYMD( QDate::currentDate().year(), destdate.month(), 176 destdate.setYMD( QDate::currentDate().year(), destdate.month(),
177 destdate.day() ); 177 destdate.day() );
178 if ( QDate::currentDate().daysTo(destdate) < 0 ) 178 if ( QDate::currentDate().daysTo(destdate) < 0 )
179 destdate.setYMD( QDate::currentDate().year()+1, 179 destdate.setYMD( QDate::currentDate().year()+1,
180 destdate.month(), destdate.day() ); 180 destdate.month(), destdate.day() );
181 181
182 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 182 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
183 output += "<font color=" + m_urgentColor + "><b>-" 183 output += "<font color=" + m_urgentColor + "><b>-"
184 + (*m_it).fullName() 184 + (*m_it).fullName()
185 + " (" 185 + " ("
186 + QString::number(QDate::currentDate() 186 + QString::number(QDate::currentDate()
187 .daysTo( destdate ) ) 187 .daysTo( destdate ) )
188 + " Days) </b></font><br>"; 188 + " Days) </b></font><br>";
189 else 189 else
190 output += "<font color=" + m_entryColor + "><b>-" 190 output += "<font color=" + m_entryColor + "><b>-"
191 + (*m_it).fullName() 191 + (*m_it).fullName()
192 + " (" 192 + " ("
193 + QString::number(QDate::currentDate() 193 + QString::number(QDate::currentDate()
194 .daysTo( destdate ) ) 194 .daysTo( destdate ) )
195 + " Days) </b></font><br>"; 195 + " Days) </b></font><br>";
196 } 196 }
197 } 197 }
198 } else { 198 } else {
199 output += "<font color=" + m_headlineColor + ">" 199 output += "<font color=" + m_headlineColor + ">"
200 + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) 200 + QObject::tr( "No anniversaries in <b> %1 </b> days!" )
201 .arg( m_daysLookAhead ) 201 .arg( m_daysLookAhead )
202 + "</font> <br>"; 202 + "</font> <br>";
203 } 203 }
204 } 204 }
205 205
206 addressLabel->setText( output ); 206 addressLabel->setText( output );
207} 207}
208 208
209/** 209/**
210 * start the todolist 210 * start the todolist
211 */ 211 */
212void AddressBookPluginWidget::startAddressBook() { 212void AddressBookPluginWidget::startAddressBook() {
213 QCopEnvelope e( "QPE/System", "execute(QString)" ); 213 QCopEnvelope e( "QPE/System", "execute(QString)" );
214 e << QString( "addressbook" ); 214 e << QString( "addressbook" );
215} 215}