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 | |||
@@ -1,69 +1,74 @@ | |||
1 | /* | 1 | /* |
2 | * addressplugin.cpp | 2 | * addressplugin.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 | 19 | ||
20 | 20 | ||
21 | #include "addressplugin.h" | 21 | #include "addressplugin.h" |
22 | #include "addresspluginconfig.h" | 22 | #include "addresspluginconfig.h" |
23 | 23 | ||
24 | AddressBookPlugin::AddressBookPlugin(): | 24 | AddressBookPlugin::AddressBookPlugin(): |
25 | m_abWidget( 0l ) | 25 | m_abWidget( 0l ) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | AddressBookPlugin::~AddressBookPlugin() { | 29 | AddressBookPlugin::~AddressBookPlugin() { |
30 | } | 30 | } |
31 | 31 | ||
32 | QString AddressBookPlugin::pluginName() const { | 32 | QString AddressBookPlugin::pluginName() const { |
33 | return QObject::tr( "AddressBook plugin" ); | 33 | return QObject::tr( "AddressBook plugin" ); |
34 | } | 34 | } |
35 | 35 | ||
36 | double AddressBookPlugin::versionNumber() const { | 36 | double AddressBookPlugin::versionNumber() const { |
37 | return 0.3; | 37 | return 0.3; |
38 | } | 38 | } |
39 | 39 | ||
40 | QString AddressBookPlugin::pixmapNameWidget() const { | 40 | QString AddressBookPlugin::pixmapNameWidget() const { |
41 | return "addressbook/AddressBook"; | 41 | return "addressbook/AddressBook"; |
42 | } | 42 | } |
43 | 43 | ||
44 | QWidget* AddressBookPlugin::widget( QWidget *wid ) { | 44 | QWidget* AddressBookPlugin::widget( QWidget *wid ) { |
45 | m_abWidget = new AddressBookPluginWidget( wid, "AddressBook" ); | 45 | m_abWidget = new AddressBookPluginWidget( wid, "AddressBook" ); |
46 | return m_abWidget; | 46 | return m_abWidget; |
47 | } | 47 | } |
48 | 48 | ||
49 | QString AddressBookPlugin::pixmapNameConfig() const { | 49 | QString AddressBookPlugin::pixmapNameConfig() const { |
50 | return "addressbook/AddressBook"; | 50 | return "addressbook/AddressBook"; |
51 | } | 51 | } |
52 | 52 | ||
53 | TodayConfigWidget* AddressBookPlugin::configWidget( QWidget* wid ) { | 53 | TodayConfigWidget* AddressBookPlugin::configWidget( QWidget* wid ) { |
54 | return new AddressBookPluginConfig( wid , "AddressBook" ); | 54 | return new AddressBookPluginConfig( wid , "AddressBook" ); |
55 | } | 55 | } |
56 | 56 | ||
57 | QString AddressBookPlugin::appName() const { | 57 | QString AddressBookPlugin::appName() const { |
58 | return "addressbook"; | 58 | return "addressbook"; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | bool AddressBookPlugin::excludeFromRefresh() const { | 62 | bool AddressBookPlugin::excludeFromRefresh() const { |
63 | return false; | 63 | return false; |
64 | } | 64 | } |
65 | 65 | ||
66 | void AddressBookPlugin::refresh() | 66 | void AddressBookPlugin::refresh() |
67 | { | 67 | { |
68 | m_abWidget->refresh( NULL ); | 68 | m_abWidget->refresh( NULL ); |
69 | } | 69 | } |
70 | |||
71 | void 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 | |||
@@ -1,50 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | * addressplugin.h | 2 | * addressplugin.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_H | 19 | #ifndef ADDRESSBOOK_PLUGIN_H |
20 | #define ADDRESSBOOK_PLUGIN_H | 20 | #define ADDRESSBOOK_PLUGIN_H |
21 | 21 | ||
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | 24 | ||
25 | #include <opie/oclickablelabel.h> | 25 | #include <opie/oclickablelabel.h> |
26 | #include <opie/todayplugininterface.h> | 26 | #include <opie/todayplugininterface.h> |
27 | 27 | ||
28 | #include "addresspluginwidget.h" | 28 | #include "addresspluginwidget.h" |
29 | 29 | ||
30 | class AddressBookPlugin : public TodayPluginObject { | 30 | class AddressBookPlugin : public TodayPluginObject { |
31 | 31 | ||
32 | public: | 32 | 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 | |||
@@ -1,175 +1,173 @@ | |||
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 <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qvgroupbox.h> | 28 | #include <qvgroupbox.h> |
29 | 29 | ||
30 | 30 | ||
31 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) | 31 | AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) |
32 | : TodayConfigWidget(parent, name ) { | 32 | : TodayConfigWidget(parent, name ) { |
33 | 33 | ||
34 | QVBoxLayout * layout = new QVBoxLayout( this ); | 34 | QVBoxLayout * layout = new QVBoxLayout( this ); |
35 | layout->setMargin( 20 ); | 35 | layout->setMargin( 20 ); |
36 | 36 | ||
37 | #if 0 | 37 | #if 0 |
38 | // Informational stuff | 38 | // Informational stuff |
39 | QHBox *box4 = new QHBox( this ); | 39 | QHBox *box4 = new QHBox( this ); |
40 | QLabel* colorLabel = new QLabel( box4, "" ); | 40 | QLabel* colorLabel = new QLabel( box4, "" ); |
41 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); | 41 | colorLabel->setText( tr( "To activate settings: Restart application !" ) ); |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | // Buttongroup to enable/disable shown stuff | 44 | // Buttongroup to enable/disable shown stuff |
45 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); | 45 | QVGroupBox* b_group = new QVGroupBox( this, "name" ); |
46 | b_group -> setTitle( tr("Enable/Disable Views") ); | 46 | b_group -> setTitle( tr("Enable/Disable Views") ); |
47 | m_showBirthdayButton = new QRadioButton( b_group ); | 47 | m_showBirthdayButton = new QRadioButton( b_group ); |
48 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); | 48 | m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); |
49 | m_showAnniversaryButton = new QRadioButton( b_group ); | 49 | m_showAnniversaryButton = new QRadioButton( b_group ); |
50 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); | 50 | m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); |
51 | 51 | ||
52 | QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); | 52 | QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); |
53 | QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); | 53 | QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) ); |
54 | 54 | ||
55 | // Max lines settings | 55 | // Max lines settings |
56 | QHBox *box1 = new QHBox( this ); | 56 | QHBox *box1 = new QHBox( this ); |
57 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); | 57 | QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); |
58 | TextLabel6->setText( tr( "Max Lines: " ) ); | 58 | TextLabel6->setText( tr( "Max Lines: " ) ); |
59 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); | 59 | SpinBox2 = new QSpinBox( box1, "SpinBox2" ); |
60 | SpinBox2->setMaxValue( 40 ); | 60 | SpinBox2->setMaxValue( 40 ); |
61 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); | 61 | QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); |
62 | 62 | ||
63 | #if 0 | 63 | #if 0 |
64 | // Clip settings (currently not used) | 64 | // Clip settings (currently not used) |
65 | QHBox *box2 = new QHBox( this ); | 65 | QHBox *box2 = new QHBox( this ); |
66 | QLabel* clipLabel = new QLabel( box2, "" ); | 66 | QLabel* clipLabel = new QLabel( box2, "" ); |
67 | clipLabel->setText( tr( "Clip line after X chars: " ) ); | 67 | clipLabel->setText( tr( "Clip line after X chars: " ) ); |
68 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); | 68 | SpinBoxClip = new QSpinBox( box2, "SpinClip" ); |
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 !" ) ); |
94 | 93 | ||
95 | // Urgent color settings | 94 | // Urgent color settings |
96 | QHBox *box7 = new QHBox( this ); | 95 | QHBox *box7 = new QHBox( this ); |
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 | ||
121 | void AddressBookPluginConfig::readConfig() { | 119 | void AddressBookPluginConfig::readConfig() { |
122 | Config cfg( "todayaddressplugin" ); | 120 | Config cfg( "todayaddressplugin" ); |
123 | cfg.setGroup( "config" ); | 121 | cfg.setGroup( "config" ); |
124 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); | 122 | m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); |
125 | SpinBox2->setValue( m_max_lines_task ); | 123 | SpinBox2->setValue( m_max_lines_task ); |
126 | // m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); | 124 | // m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); |
127 | // SpinBoxClip->setValue( m_maxCharClip ); | 125 | // SpinBoxClip->setValue( m_maxCharClip ); |
128 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); | 126 | m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); |
129 | SpinDaysClip->setValue( m_daysLookAhead ); | 127 | SpinDaysClip->setValue( m_daysLookAhead ); |
130 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); | 128 | m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); |
131 | SpinUrgentClip->setValue( m_urgentDays ); | 129 | SpinUrgentClip->setValue( m_urgentDays ); |
132 | 130 | ||
133 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); | 131 | m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); |
134 | entryColor->setColor( QColor( m_entryColor ) ); | 132 | entryColor->setColor( QColor( m_entryColor ) ); |
135 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); | 133 | m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); |
136 | headlineColor->setColor( QColor( m_headlineColor ) ); | 134 | headlineColor->setColor( QColor( m_headlineColor ) ); |
137 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); | 135 | m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); |
138 | urgentColor->setColor( QColor( m_urgentColor ) ); | 136 | urgentColor->setColor( QColor( m_urgentColor ) ); |
139 | 137 | ||
140 | m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); | 138 | m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); |
141 | m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); | 139 | m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); |
142 | 140 | ||
143 | } | 141 | } |
144 | 142 | ||
145 | 143 | ||
146 | void AddressBookPluginConfig::writeConfig() { | 144 | void AddressBookPluginConfig::writeConfig() { |
147 | Config cfg( "todayaddressplugin" ); | 145 | Config cfg( "todayaddressplugin" ); |
148 | cfg.setGroup( "config" ); | 146 | cfg.setGroup( "config" ); |
149 | m_max_lines_task = SpinBox2->value(); | 147 | m_max_lines_task = SpinBox2->value(); |
150 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); | 148 | cfg.writeEntry( "maxlinestask", m_max_lines_task ); |
151 | // m_maxCharClip = SpinBoxClip->value(); | 149 | // m_maxCharClip = SpinBoxClip->value(); |
152 | // cfg.writeEntry( "maxcharclip", m_maxCharClip ); | 150 | // cfg.writeEntry( "maxcharclip", m_maxCharClip ); |
153 | m_daysLookAhead = SpinDaysClip->value(); | 151 | m_daysLookAhead = SpinDaysClip->value(); |
154 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); | 152 | cfg.writeEntry( "dayslookahead", m_daysLookAhead ); |
155 | m_urgentDays = SpinUrgentClip->value(); | 153 | m_urgentDays = SpinUrgentClip->value(); |
156 | if ( m_urgentDays > m_daysLookAhead ) | 154 | if ( m_urgentDays > m_daysLookAhead ) |
157 | m_urgentDays = m_daysLookAhead; | 155 | m_urgentDays = m_daysLookAhead; |
158 | cfg.writeEntry( "urgentdays", m_urgentDays ); | 156 | cfg.writeEntry( "urgentdays", m_urgentDays ); |
159 | 157 | ||
160 | m_entryColor = entryColor->color().name(); | 158 | m_entryColor = entryColor->color().name(); |
161 | cfg.writeEntry( "entrycolor", m_entryColor ); | 159 | cfg.writeEntry( "entrycolor", m_entryColor ); |
162 | m_headlineColor = headlineColor->color().name(); | 160 | m_headlineColor = headlineColor->color().name(); |
163 | cfg.writeEntry( "headlinecolor", m_headlineColor ); | 161 | cfg.writeEntry( "headlinecolor", m_headlineColor ); |
164 | m_urgentColor = urgentColor->color().name(); | 162 | m_urgentColor = urgentColor->color().name(); |
165 | cfg.writeEntry( "urgentcolor", m_urgentColor ); | 163 | cfg.writeEntry( "urgentcolor", m_urgentColor ); |
166 | 164 | ||
167 | cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); | 165 | cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); |
168 | cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); | 166 | cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); |
169 | 167 | ||
170 | cfg.write(); | 168 | cfg.write(); |
171 | } | 169 | } |
172 | 170 | ||
173 | 171 | ||
174 | AddressBookPluginConfig::~AddressBookPluginConfig() { | 172 | AddressBookPluginConfig::~AddressBookPluginConfig() { |
175 | } | 173 | } |
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 | |||
@@ -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 <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 | ||
29 | class AddressBookPluginConfig : public TodayConfigWidget { | 29 | class AddressBookPluginConfig : public TodayConfigWidget { |
30 | 30 | Q_OBJECT | |
31 | 31 | ||
32 | public: | 32 | public: |
33 | 33 | ||
34 | AddressBookPluginConfig( QWidget *parent, const char *name ); | 34 | AddressBookPluginConfig( QWidget *parent, const char *name ); |
35 | ~AddressBookPluginConfig(); | 35 | ~AddressBookPluginConfig(); |
36 | 36 | ||
37 | private: | 37 | private: |
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 | OColorButton* entryColor; | 49 | OColorButton* entryColor; |
50 | OColorButton* headlineColor; | 50 | OColorButton* headlineColor; |
51 | OColorButton* urgentColor; | 51 | OColorButton* urgentColor; |
52 | QRadioButton* m_showBirthdayButton; | 52 | QRadioButton* m_showBirthdayButton; |
53 | QRadioButton* m_showAnniversaryButton; | 53 | QRadioButton* 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 498de28..dad09db 100644 --- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp +++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp | |||
@@ -1,224 +1,225 @@ | |||
1 | /* | 1 | /* |
2 | * addresspluginwidget.cpp | 2 | * addresspluginwidget.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 "addresspluginwidget.h" | 19 | #include "addresspluginwidget.h" |
20 | 20 | ||
21 | #include <qvaluelist.h> | 21 | #include <qvaluelist.h> |
22 | #include <qtl.h> | 22 | #include <qtl.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qscrollview.h> | 24 | #include <qscrollview.h> |
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qdatetime.h> | 26 | #include <qdatetime.h> |
27 | 27 | ||
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/timestring.h> | 29 | #include <qpe/timestring.h> |
30 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
31 | 31 | ||
32 | #include <opie/ocontact.h> | 32 | #include <opie/ocontact.h> |
33 | 33 | ||
34 | AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) | 34 | AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) |
35 | : QWidget( parent, name ) { | 35 | : QWidget( parent, name ) { |
36 | 36 | ||
37 | addressLabel = 0l; | 37 | addressLabel = 0l; |
38 | m_contactdb = 0l; | 38 | m_contactdb = 0l; |
39 | layoutTodo = 0l; | 39 | layoutTodo = 0l; |
40 | 40 | ||
41 | // Hä ? Nonsense ! (se) | 41 | // Hä ? Nonsense ! (se) |
42 | if ( m_contactdb ) { | 42 | if ( m_contactdb ) { |
43 | delete m_contactdb; | 43 | delete m_contactdb; |
44 | } | 44 | } |
45 | 45 | ||
46 | m_contactdb = new OContactAccess("addressplugin"); | 46 | m_contactdb = new OContactAccess("addressplugin"); |
47 | 47 | ||
48 | connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), | 48 | connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), |
49 | this, SLOT( refresh( const OContactAccess * ) ) ); | 49 | this, SLOT( refresh( const OContactAccess * ) ) ); |
50 | 50 | ||
51 | 51 | ||
52 | readConfig(); | 52 | readConfig(); |
53 | getAddress(); | 53 | getAddress(); |
54 | } | 54 | } |
55 | 55 | ||
56 | AddressBookPluginWidget::~AddressBookPluginWidget() { | 56 | AddressBookPluginWidget::~AddressBookPluginWidget() { |
57 | delete m_contactdb; | 57 | delete m_contactdb; |
58 | } | 58 | } |
59 | 59 | ||
60 | void AddressBookPluginWidget::refresh( const OContactAccess* ) | 60 | void 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 | ||
67 | void AddressBookPluginWidget::reinitialize() { | ||
68 | readConfig(); | ||
69 | getAddress(); | ||
70 | } | ||
67 | 71 | ||
68 | void AddressBookPluginWidget::readConfig() { | 72 | void 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 ); |
79 | m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); | 83 | m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); |
80 | } | 84 | } |
81 | 85 | ||
82 | 86 | ||
83 | /** | 87 | /** |
84 | * Get the addresss | 88 | * Get the addresss |
85 | */ | 89 | */ |
86 | void AddressBookPluginWidget::getAddress() { | 90 | void AddressBookPluginWidget::getAddress() { |
87 | 91 | ||
88 | if ( ! layoutTodo ){ | 92 | if ( ! layoutTodo ){ |
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... |
134 | QDate destdate = (*m_it).birthday(); | 135 | QDate destdate = (*m_it).birthday(); |
135 | destdate.setYMD( QDate::currentDate().year(), | 136 | destdate.setYMD( QDate::currentDate().year(), |
136 | destdate.month(), destdate.day() ); | 137 | destdate.month(), destdate.day() ); |
137 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 138 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
138 | destdate.setYMD( QDate::currentDate().year()+1, | 139 | destdate.setYMD( QDate::currentDate().year()+1, |
139 | destdate.month(), destdate.day() ); | 140 | destdate.month(), destdate.day() ); |
140 | 141 | ||
141 | 142 | ||
142 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 143 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
143 | output += "<font color=" + m_urgentColor + "><b>-" | 144 | output += "<font color=" + m_urgentColor + "><b>-" |
144 | + (*m_it).fullName() | 145 | + (*m_it).fullName() |
145 | + " (" | 146 | + " (" |
146 | + QString::number(QDate::currentDate() | 147 | + QString::number(QDate::currentDate() |
147 | .daysTo(destdate)) | 148 | .daysTo(destdate)) |
148 | + " Days) </b></font><br>"; | 149 | + " Days) </b></font><br>"; |
149 | 150 | ||
150 | else | 151 | else |
151 | output += "<font color=" + m_entryColor + "><b>-" | 152 | output += "<font color=" + m_entryColor + "><b>-" |
152 | + (*m_it).fullName() | 153 | + (*m_it).fullName() |
153 | + " (" | 154 | + " (" |
154 | + QString::number(QDate::currentDate() | 155 | + QString::number(QDate::currentDate() |
155 | .daysTo(destdate)) | 156 | .daysTo(destdate)) |
156 | + " Days) </b></font><br>"; | 157 | + " Days) </b></font><br>"; |
157 | } | 158 | } |
158 | } | 159 | } |
159 | } else { | 160 | } else { |
160 | output = "<font color=" + m_headlineColor + ">" | 161 | output = "<font color=" + m_headlineColor + ">" |
161 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) | 162 | + QObject::tr( "No birthdays in <b> %1 </b> days!" ) |
162 | .arg( m_daysLookAhead ) | 163 | .arg( m_daysLookAhead ) |
163 | + "</font> <br>"; | 164 | + "</font> <br>"; |
164 | } | 165 | } |
165 | } | 166 | } |
166 | 167 | ||
167 | if ( m_showAnniversaries ){ | 168 | if ( m_showAnniversaries ){ |
168 | // Define the query for anniversaries and start search.. | 169 | // Define the query for anniversaries and start search.. |
169 | OContact queryanniversaries; | 170 | OContact queryanniversaries; |
170 | queryanniversaries.setAnniversary( lookAheadDate ); | 171 | queryanniversaries.setAnniversary( lookAheadDate ); |
171 | 172 | ||
172 | m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); | 173 | m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); |
173 | 174 | ||
174 | ammount = 0; | 175 | ammount = 0; |
175 | if ( m_list.count() > 0 ){ | 176 | if ( m_list.count() > 0 ){ |
176 | output += "<font color=" + m_headlineColor + ">" | 177 | output += "<font color=" + m_headlineColor + ">" |
177 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) | 178 | + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) |
178 | .arg( m_daysLookAhead ) | 179 | .arg( m_daysLookAhead ) |
179 | + "</font> <br>"; | 180 | + "</font> <br>"; |
180 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { | 181 | for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { |
181 | if ( ammount++ < m_maxLinesTask ){ | 182 | if ( ammount++ < m_maxLinesTask ){ |
182 | // Now we want to calculate how many days until anniversary. | 183 | // Now we want to calculate how many days until anniversary. |
183 | // We have to set the correct year to calculate the day diff... | 184 | // We have to set the correct year to calculate the day diff... |
184 | QDate destdate = (*m_it).anniversary(); | 185 | QDate destdate = (*m_it).anniversary(); |
185 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), | 186 | destdate.setYMD( QDate::currentDate().year(), destdate.month(), |
186 | destdate.day() ); | 187 | destdate.day() ); |
187 | if ( QDate::currentDate().daysTo(destdate) < 0 ) | 188 | if ( QDate::currentDate().daysTo(destdate) < 0 ) |
188 | destdate.setYMD( QDate::currentDate().year()+1, | 189 | destdate.setYMD( QDate::currentDate().year()+1, |
189 | destdate.month(), destdate.day() ); | 190 | destdate.month(), destdate.day() ); |
190 | 191 | ||
191 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) | 192 | if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) |
192 | output += "<font color=" + m_urgentColor + "><b>-" | 193 | output += "<font color=" + m_urgentColor + "><b>-" |
193 | + (*m_it).fullName() | 194 | + (*m_it).fullName() |
194 | + " (" | 195 | + " (" |
195 | + QString::number(QDate::currentDate() | 196 | + QString::number(QDate::currentDate() |
196 | .daysTo( destdate ) ) | 197 | .daysTo( destdate ) ) |
197 | + " Days) </b></font><br>"; | 198 | + " Days) </b></font><br>"; |
198 | else | 199 | else |
199 | output += "<font color=" + m_entryColor + "><b>-" | 200 | output += "<font color=" + m_entryColor + "><b>-" |
200 | + (*m_it).fullName() | 201 | + (*m_it).fullName() |
201 | + " (" | 202 | + " (" |
202 | + QString::number(QDate::currentDate() | 203 | + QString::number(QDate::currentDate() |
203 | .daysTo( destdate ) ) | 204 | .daysTo( destdate ) ) |
204 | + " Days) </b></font><br>"; | 205 | + " Days) </b></font><br>"; |
205 | } | 206 | } |
206 | } | 207 | } |
207 | } else { | 208 | } else { |
208 | output += "<font color=" + m_headlineColor + ">" | 209 | output += "<font color=" + m_headlineColor + ">" |
209 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) | 210 | + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) |
210 | .arg( m_daysLookAhead ) | 211 | .arg( m_daysLookAhead ) |
211 | + "</font> <br>"; | 212 | + "</font> <br>"; |
212 | } | 213 | } |
213 | } | 214 | } |
214 | 215 | ||
215 | addressLabel->setText( output ); | 216 | addressLabel->setText( output ); |
216 | } | 217 | } |
217 | 218 | ||
218 | /** | 219 | /** |
219 | * start the todolist | 220 | * start the todolist |
220 | */ | 221 | */ |
221 | void AddressBookPluginWidget::startAddressBook() { | 222 | void AddressBookPluginWidget::startAddressBook() { |
222 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 223 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
223 | e << QString( "addressbook" ); | 224 | e << QString( "addressbook" ); |
224 | } | 225 | } |
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 | |||
@@ -1,65 +1,66 @@ | |||
1 | /* | 1 | /* |
2 | * addresspluginwidget.h | 2 | * addresspluginwidget.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_WIDGET_H | 19 | #ifndef ADDRESSBOOK_PLUGIN_WIDGET_H |
20 | #define ADDRESSBOOK_PLUGIN_WIDGET_H | 20 | #define ADDRESSBOOK_PLUGIN_WIDGET_H |
21 | 21 | ||
22 | #include <qstring.h> | 22 | #include <qstring.h> |
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | 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 | ||
30 | class AddressBookPluginWidget : public QWidget { | 30 | class AddressBookPluginWidget : public QWidget { |
31 | 31 | ||
32 | Q_OBJECT | 32 | Q_OBJECT |
33 | 33 | ||
34 | public: | 34 | public: |
35 | AddressBookPluginWidget( QWidget *parent, const char *name ); | 35 | AddressBookPluginWidget( QWidget *parent, const char *name ); |
36 | ~AddressBookPluginWidget(); | 36 | ~AddressBookPluginWidget(); |
37 | 37 | ||
38 | void reinitialize(); | ||
38 | public slots: | 39 | public slots: |
39 | void refresh( const OContactAccess* db ); | 40 | void refresh( const OContactAccess* db ); |
40 | 41 | ||
41 | protected slots: | 42 | protected slots: |
42 | void startAddressBook(); | 43 | void startAddressBook(); |
43 | 44 | ||
44 | private: | 45 | private: |
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; |
50 | OContactAccess::List::Iterator m_it; | 51 | OContactAccess::List::Iterator m_it; |
51 | 52 | ||
52 | void readConfig(); | 53 | void readConfig(); |
53 | void getAddress(); | 54 | void getAddress(); |
54 | int m_maxLinesTask; | 55 | int m_maxLinesTask; |
55 | int m_maxCharClip; | 56 | int m_maxCharClip; |
56 | int m_daysLookAhead; | 57 | int m_daysLookAhead; |
57 | int m_urgentDays; | 58 | int m_urgentDays; |
58 | QString m_entryColor; | 59 | QString m_entryColor; |
59 | QString m_headlineColor; | 60 | QString m_headlineColor; |
60 | QString m_urgentColor; | 61 | QString m_urgentColor; |
61 | bool m_showBirthdays; | 62 | bool m_showBirthdays; |
62 | bool m_showAnniversaries; | 63 | bool m_showAnniversaries; |
63 | }; | 64 | }; |
64 | 65 | ||
65 | #endif | 66 | #endif |
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 @@ | |||
1 | Package: opie-today-addressbookplugin | 1 | Package: opie-today-addressbookplugin |
2 | Files: plugins/today/libtodayaddressbookplugin.so* | 2 | Files: plugins/today/libtodayaddressbookplugin.so* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Stefan Eilers <eilers.stefan@epost.de> | 5 | Maintainer: Stefan Eilers <eilers.stefan@epost.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: $QPE_VERSION-$SUB_VERSION | ||
8 | Depends: libqte2, opie-today | 7 | Depends: libqte2, opie-today |
9 | Description: Addressbook plugin for today shows Birthdays and Anniversaries | 8 | Description: Addressbook plugin for today shows Birthdays and Anniversaries |
9 | Version: $QPE_VERSION$EXTRAVERSION | ||