summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-12-08 21:36:54 (UTC)
committer harlekin <harlekin>2003-12-08 21:36:54 (UTC)
commit97a9c3426600791b2a25bb744a460be8d40acb85 (patch) (unidiff)
tree6948e7dfc01a040181cc8678cda0b568cf84818a
parent6ecac17fdf96f2244af762f303639d8e79b453ff (diff)
downloadopie-97a9c3426600791b2a25bb744a460be8d40acb85.zip
opie-97a9c3426600791b2a25bb744a460be8d40acb85.tar.gz
opie-97a9c3426600791b2a25bb744a460be8d40acb85.tar.bz2
remove unused includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/main.cpp1
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginconfig.cpp1
-rw-r--r--core/pim/today/plugins/addressbook/addresspluginwidget.cpp8
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp2
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp1
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginconfig.cpp4
-rw-r--r--core/pim/today/plugins/datebook/datebookpluginwidget.cpp3
-rw-r--r--core/pim/today/plugins/todolist/todopluginconfig.cpp1
-rw-r--r--core/pim/today/today.cpp3
-rw-r--r--core/pim/today/todaybase.cpp1
-rw-r--r--core/pim/today/todayconfig.cpp3
11 files changed, 0 insertions, 28 deletions
diff --git a/core/pim/today/main.cpp b/core/pim/today/main.cpp
index 156cd0f..d4ec3ce 100644
--- a/core/pim/today/main.cpp
+++ b/core/pim/today/main.cpp
@@ -1,24 +1,23 @@
1/* 1/*
2 * main.cpp 2 * main.cpp
3 * 3 *
4 * --------------------- 4 * ---------------------
5 * 5 *
6 * begin : Sun 10 17:20:00 CEST 2002 6 * begin : Sun 10 17:20:00 CEST 2002
7 * copyright : (c) 2002 by Maximilian Reiß 7 * copyright : (c) 2002 by Maximilian Reiß
8 * email : max.reiss@gmx.de 8 * email : max.reiss@gmx.de
9 * 9 *
10 */ 10 */
11/*************************************************************************** 11/***************************************************************************
12 * * 12 * *
13 * This program is free software; you can redistribute it and/or modify * 13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by * 14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or * 15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. * 16 * (at your option) any later version. *
17 * * 17 * *
18 ***************************************************************************/ 18 ***************************************************************************/
19 19
20#include "today.h" 20#include "today.h"
21#include <qpe/qpeapplication.h>
22#include <opie/oapplicationfactory.h> 21#include <opie/oapplicationfactory.h>
23 22
24OPIE_EXPORT_APP( OApplicationFactory<Today> ) 23OPIE_EXPORT_APP( OApplicationFactory<Today> )
diff --git a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
index 8863192..8c55937 100644
--- a/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginconfig.cpp
@@ -1,179 +1,178 @@
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>
26#include <qlabel.h> 25#include <qlabel.h>
27#include <qwhatsthis.h> 26#include <qwhatsthis.h>
28#include <qvgroupbox.h> 27#include <qvgroupbox.h>
29 28
30 29
31AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name) 30AddressBookPluginConfig::AddressBookPluginConfig( QWidget *parent, const char* name)
32 : TodayConfigWidget(parent, name ) { 31 : TodayConfigWidget(parent, name ) {
33 32
34 QVBoxLayout * layout = new QVBoxLayout( this ); 33 QVBoxLayout * layout = new QVBoxLayout( this );
35 layout->setMargin( 20 ); 34 layout->setMargin( 20 );
36 35
37#if 0 36#if 0
38 // Informational stuff 37 // Informational stuff
39 QHBox *box4 = new QHBox( this ); 38 QHBox *box4 = new QHBox( this );
40 QLabel* colorLabel = new QLabel( box4, "" ); 39 QLabel* colorLabel = new QLabel( box4, "" );
41 colorLabel->setText( tr( "To activate settings: Restart application !" ) ); 40 colorLabel->setText( tr( "To activate settings: Restart application !" ) );
42#endif 41#endif
43 42
44 // Buttongroup to enable/disable shown stuff 43 // Buttongroup to enable/disable shown stuff
45 QVGroupBox* b_group = new QVGroupBox( this, "name" ); 44 QVGroupBox* b_group = new QVGroupBox( this, "name" );
46 b_group -> setTitle( tr("Enable/Disable Views") ); 45 b_group -> setTitle( tr("Enable/Disable Views") );
47 m_showBirthdayButton = new QRadioButton( b_group ); 46 m_showBirthdayButton = new QRadioButton( b_group );
48 m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) ); 47 m_showBirthdayButton -> setText( tr( "Show &Birthdays" ) );
49 m_showAnniversaryButton = new QRadioButton( b_group ); 48 m_showAnniversaryButton = new QRadioButton( b_group );
50 m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) ); 49 m_showAnniversaryButton -> setText( tr( "Show &Anniveraries" ) );
51 50
52 QWhatsThis::add( m_showBirthdayButton , tr( "The next birthdays will just be shown, if enabled!" ) ); 51 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 !" ) ); 52 QWhatsThis::add( m_showAnniversaryButton , tr( "The next anniversaries will just be shown, if enabled !" ) );
54 53
55 // Max lines settings 54 // Max lines settings
56 QHBox *box1 = new QHBox( this ); 55 QHBox *box1 = new QHBox( this );
57 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" ); 56 QLabel* TextLabel6 = new QLabel( box1, "TextLabel6" );
58 TextLabel6->setText( tr( "Max Lines: " ) ); 57 TextLabel6->setText( tr( "Max Lines: " ) );
59 SpinBox2 = new QSpinBox( box1, "SpinBox2" ); 58 SpinBox2 = new QSpinBox( box1, "SpinBox2" );
60 SpinBox2->setMaxValue( 40 ); 59 SpinBox2->setMaxValue( 40 );
61 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) ); 60 QWhatsThis::add( SpinBox2 , tr( "Set the maximum number of lines that should be shown for each anniversaries/birthdays" ) );
62 61
63#if 0 62#if 0
64 // Clip settings (currently not used) 63 // Clip settings (currently not used)
65 QHBox *box2 = new QHBox( this ); 64 QHBox *box2 = new QHBox( this );
66 QLabel* clipLabel = new QLabel( box2, "" ); 65 QLabel* clipLabel = new QLabel( box2, "" );
67 clipLabel->setText( tr( "Clip line after X chars: " ) ); 66 clipLabel->setText( tr( "Clip line after X chars: " ) );
68 SpinBoxClip = new QSpinBox( box2, "SpinClip" ); 67 SpinBoxClip = new QSpinBox( box2, "SpinClip" );
69 SpinBoxClip->setMaxValue( 200 ); 68 SpinBoxClip->setMaxValue( 200 );
70 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) ); 69 QWhatsThis::add( SpinBoxClip , tr( "After how many chars should be the info about the task be cut off" ) );
71#endif 70#endif
72 71
73 // Look ahead settings 72 // Look ahead settings
74 QHBox *box3 = new QHBox( this ); 73 QHBox *box3 = new QHBox( this );
75 QLabel* daysLabel = new QLabel( box3, "" ); 74 QLabel* daysLabel = new QLabel( box3, "" );
76 daysLabel->setText( tr( "Days look ahead: " ) ); 75 daysLabel->setText( tr( "Days look ahead: " ) );
77 SpinDaysClip = new QSpinBox( box3, "SpinDays" ); 76 SpinDaysClip = new QSpinBox( box3, "SpinDays" );
78 SpinDaysClip->setMaxValue( 200 ); 77 SpinDaysClip->setMaxValue( 200 );
79 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) ); 78 QWhatsThis::add( SpinDaysClip , tr( "How many days we should search forward" ) );
80 79
81// QHBox *box4 = new QHBox( this ); 80// QHBox *box4 = new QHBox( this );
82 81
83// QLabel* colorLabel = new QLabel( box4, "" ); 82// QLabel* colorLabel = new QLabel( box4, "" );
84// colorLabel->setText( tr( "To activate settings: Restart application !" ) ); 83// colorLabel->setText( tr( "To activate settings: Restart application !" ) );
85 84
86 85
87 QHBox *box5 = new QHBox( this ); 86 QHBox *box5 = new QHBox( this );
88 QLabel* colorLabel2 = new QLabel( box5, "" ); 87 QLabel* colorLabel2 = new QLabel( box5, "" );
89 colorLabel2->setText( tr( "Set Headline Color: " ) ); 88 colorLabel2->setText( tr( "Set Headline Color: " ) );
90 headlineColor = new OColorButton( box5, black , "headlineColor" ); 89 headlineColor = new OColorButton( box5, black , "headlineColor" );
91 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) ); 90 QWhatsThis::add( headlineColor , tr( "Colors for the headlines !" ) );
92 QHBox *box6 = new QHBox( this ); 91 QHBox *box6 = new QHBox( this );
93 92
94 // Entry color settings 93 // Entry color settings
95 QLabel* colorLabel3= new QLabel( box6, "" ); 94 QLabel* colorLabel3= new QLabel( box6, "" );
96 colorLabel3->setText( tr( "Set Entry Color: " ) ); 95 colorLabel3->setText( tr( "Set Entry Color: " ) );
97 entryColor = new OColorButton( box6, black , "entryColor" ); 96 entryColor = new OColorButton( box6, black , "entryColor" );
98 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) ); 97 QWhatsThis::add( entryColor , tr( "This color will be used for shown birthdays/anniversaries !" ) );
99 98
100 // Urgent color settings 99 // Urgent color settings
101 QHBox *box7 = new QHBox( this ); 100 QHBox *box7 = new QHBox( this );
102 QLabel* colorLabel5 = new QLabel( box7, "" ); 101 QLabel* colorLabel5 = new QLabel( box7, "" );
103 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) ); 102 colorLabel5->setText( tr( "Set Urgent\nColor if below " ) );
104 SpinUrgentClip = new QSpinBox( box7, "SpinDays" ); 103 SpinUrgentClip = new QSpinBox( box7, "SpinDays" );
105 SpinUrgentClip->setMaxValue( 200 ); 104 SpinUrgentClip->setMaxValue( 200 );
106 QLabel* colorLabel6 = new QLabel( box7, "" ); 105 QLabel* colorLabel6 = new QLabel( box7, "" );
107 colorLabel6->setText( tr( " days: " ) ); 106 colorLabel6->setText( tr( " days: " ) );
108 urgentColor = new OColorButton( box7, red , "urgentColor" ); 107 urgentColor = new OColorButton( box7, red , "urgentColor" );
109 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) ); 108 QWhatsThis::add( urgentColor , tr( "This urgent color will be used if we are close to the event !" ) );
110 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) ); 109 QWhatsThis::add( SpinUrgentClip , tr( "The urgent color will be used if the birthday/anniversary is closer than given days !" ) );
111 110
112 111
113 //layout->addWidget( box4 ); 112 //layout->addWidget( box4 );
114 layout->addWidget( box1 ); 113 layout->addWidget( box1 );
115 //layout->addWidget( box2 ); 114 //layout->addWidget( box2 );
116 layout->addWidget( box3 ); 115 layout->addWidget( box3 );
117 layout->addWidget( box5 ); 116 layout->addWidget( box5 );
118 layout->addWidget( box6 ); 117 layout->addWidget( box6 );
119 layout->addWidget( box7 ); 118 layout->addWidget( box7 );
120 119
121 readConfig(); 120 readConfig();
122 121
123} 122}
124 123
125void AddressBookPluginConfig::readConfig() { 124void AddressBookPluginConfig::readConfig() {
126 Config cfg( "todayaddressplugin" ); 125 Config cfg( "todayaddressplugin" );
127 cfg.setGroup( "config" ); 126 cfg.setGroup( "config" );
128 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); 127 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
129 SpinBox2->setValue( m_max_lines_task ); 128 SpinBox2->setValue( m_max_lines_task );
130// m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 129// m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
131// SpinBoxClip->setValue( m_maxCharClip ); 130// SpinBoxClip->setValue( m_maxCharClip );
132 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 131 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
133 SpinDaysClip->setValue( m_daysLookAhead ); 132 SpinDaysClip->setValue( m_daysLookAhead );
134 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 133 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
135 SpinUrgentClip->setValue( m_urgentDays ); 134 SpinUrgentClip->setValue( m_urgentDays );
136 135
137 m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() ); 136 m_entryColor = cfg.readEntry( "entrycolor", Qt::black.name() );
138 entryColor->setColor( QColor( m_entryColor ) ); 137 entryColor->setColor( QColor( m_entryColor ) );
139 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 138 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
140 headlineColor->setColor( QColor( m_headlineColor ) ); 139 headlineColor->setColor( QColor( m_headlineColor ) );
141 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 140 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
142 urgentColor->setColor( QColor( m_urgentColor ) ); 141 urgentColor->setColor( QColor( m_urgentColor ) );
143 142
144 m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) ); 143 m_showBirthdayButton->setChecked( cfg.readBoolEntry( "showBirthdays", true ) );
145 m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) ); 144 m_showAnniversaryButton->setChecked( cfg.readBoolEntry( "showAnniversaries", true ) );
146 145
147} 146}
148 147
149 148
150void AddressBookPluginConfig::writeConfig() { 149void AddressBookPluginConfig::writeConfig() {
151 Config cfg( "todayaddressplugin" ); 150 Config cfg( "todayaddressplugin" );
152 cfg.setGroup( "config" ); 151 cfg.setGroup( "config" );
153 m_max_lines_task = SpinBox2->value(); 152 m_max_lines_task = SpinBox2->value();
154 cfg.writeEntry( "maxlinestask", m_max_lines_task ); 153 cfg.writeEntry( "maxlinestask", m_max_lines_task );
155// m_maxCharClip = SpinBoxClip->value(); 154// m_maxCharClip = SpinBoxClip->value();
156// cfg.writeEntry( "maxcharclip", m_maxCharClip ); 155// cfg.writeEntry( "maxcharclip", m_maxCharClip );
157 m_daysLookAhead = SpinDaysClip->value(); 156 m_daysLookAhead = SpinDaysClip->value();
158 cfg.writeEntry( "dayslookahead", m_daysLookAhead ); 157 cfg.writeEntry( "dayslookahead", m_daysLookAhead );
159 m_urgentDays = SpinUrgentClip->value(); 158 m_urgentDays = SpinUrgentClip->value();
160 if ( m_urgentDays > m_daysLookAhead ) 159 if ( m_urgentDays > m_daysLookAhead )
161 m_urgentDays = m_daysLookAhead; 160 m_urgentDays = m_daysLookAhead;
162 cfg.writeEntry( "urgentdays", m_urgentDays ); 161 cfg.writeEntry( "urgentdays", m_urgentDays );
163 162
164 m_entryColor = entryColor->color().name(); 163 m_entryColor = entryColor->color().name();
165 cfg.writeEntry( "entrycolor", m_entryColor ); 164 cfg.writeEntry( "entrycolor", m_entryColor );
166 m_headlineColor = headlineColor->color().name(); 165 m_headlineColor = headlineColor->color().name();
167 cfg.writeEntry( "headlinecolor", m_headlineColor ); 166 cfg.writeEntry( "headlinecolor", m_headlineColor );
168 m_urgentColor = urgentColor->color().name(); 167 m_urgentColor = urgentColor->color().name();
169 cfg.writeEntry( "urgentcolor", m_urgentColor ); 168 cfg.writeEntry( "urgentcolor", m_urgentColor );
170 169
171 cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() ); 170 cfg.writeEntry( "showBirthdays", m_showBirthdayButton->isChecked() );
172 cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() ); 171 cfg.writeEntry( "showAnniversaries", m_showAnniversaryButton->isChecked() );
173 172
174 cfg.write(); 173 cfg.write();
175} 174}
176 175
177 176
178AddressBookPluginConfig::~AddressBookPluginConfig() { 177AddressBookPluginConfig::~AddressBookPluginConfig() {
179} 178}
diff --git a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
index d47bc0b..c8652f3 100644
--- a/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
+++ b/core/pim/today/plugins/addressbook/addresspluginwidget.cpp
@@ -1,229 +1,221 @@
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>
22#include <qtl.h>
23#include <qstring.h>
24#include <qscrollview.h>
25#include <qobject.h>
26#include <qdatetime.h>
27 21
28#include <qpe/config.h> 22#include <qpe/config.h>
29#include <qpe/timestring.h>
30#include <qpe/qcopenvelope_qws.h>
31 23
32#include <opie/ocontact.h> 24#include <opie/ocontact.h>
33 25
34AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name ) 26AddressBookPluginWidget::AddressBookPluginWidget( QWidget *parent, const char* name )
35 : QWidget( parent, name ) { 27 : QWidget( parent, name ) {
36 28
37 addressLabel = 0l; 29 addressLabel = 0l;
38 m_contactdb = 0l; 30 m_contactdb = 0l;
39 layoutTodo = 0l; 31 layoutTodo = 0l;
40 32
41 // Hä ? Nonsense ! (se) 33 // Hä ? Nonsense ! (se)
42 if ( m_contactdb ) { 34 if ( m_contactdb ) {
43 delete m_contactdb; 35 delete m_contactdb;
44 } 36 }
45 37
46 m_contactdb = new OContactAccess("addressplugin"); 38 m_contactdb = new OContactAccess("addressplugin");
47 39
48 connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ), 40 connect( m_contactdb, SIGNAL( signalChanged( const OContactAccess * ) ),
49 this, SLOT( refresh( const OContactAccess * ) ) ); 41 this, SLOT( refresh( const OContactAccess * ) ) );
50 42
51 43
52 readConfig(); 44 readConfig();
53 getAddress(); 45 getAddress();
54} 46}
55 47
56AddressBookPluginWidget::~AddressBookPluginWidget() { 48AddressBookPluginWidget::~AddressBookPluginWidget() {
57 delete m_contactdb; 49 delete m_contactdb;
58} 50}
59 51
60void AddressBookPluginWidget::refresh( const OContactAccess* ) 52void AddressBookPluginWidget::refresh( const OContactAccess* )
61{ 53{
62 qWarning(" AddressBookPluginWidget::Database was changed externally ! "); 54 qWarning(" AddressBookPluginWidget::Database was changed externally ! ");
63 m_contactdb->reload(); 55 m_contactdb->reload();
64 getAddress(); 56 getAddress();
65} 57}
66 58
67void AddressBookPluginWidget::reinitialize() { 59void AddressBookPluginWidget::reinitialize() {
68 readConfig(); 60 readConfig();
69 getAddress(); 61 getAddress();
70} 62}
71 63
72void AddressBookPluginWidget::readConfig() { 64void AddressBookPluginWidget::readConfig() {
73 Config cfg( "todayaddressplugin" ); 65 Config cfg( "todayaddressplugin" );
74 cfg.setGroup( "config" ); 66 cfg.setGroup( "config" );
75 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 ); 67 m_maxLinesTask = cfg.readNumEntry( "maxlinestask", 5 );
76 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 68 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
77 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 ); 69 m_daysLookAhead = cfg.readNumEntry( "dayslookahead", 14 );
78 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 ); 70 m_urgentDays = cfg.readNumEntry( "urgentdays", 7 );
79 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() ); 71 m_entryColor = cfg.readEntry("entrycolor", Qt::black.name() );
80 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() ); 72 m_headlineColor = cfg.readEntry( "headlinecolor", Qt::black.name() );
81 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() ); 73 m_urgentColor = cfg.readEntry( "urgentcolor", Qt::red.name() );
82 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true ); 74 m_showBirthdays = cfg.readBoolEntry( "showBirthdays", true );
83 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true ); 75 m_showAnniversaries = cfg.readBoolEntry( "showAnniversaries", true );
84} 76}
85 77
86 78
87/** 79/**
88 * Get the addresss 80 * Get the addresss
89 */ 81 */
90void AddressBookPluginWidget::getAddress() { 82void AddressBookPluginWidget::getAddress() {
91 83
92 if ( ! layoutTodo ){ 84 if ( ! layoutTodo ){
93 layoutTodo = new QVBoxLayout( this ); 85 layoutTodo = new QVBoxLayout( this );
94 } 86 }
95 87
96 if ( ! addressLabel ) { 88 if ( ! addressLabel ) {
97 addressLabel = new OClickableLabel( this ); 89 addressLabel = new OClickableLabel( this );
98 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) ); 90 connect( addressLabel, SIGNAL( clicked() ), this, SLOT( startAddressBook() ) );
99 layoutTodo->addWidget( addressLabel ); 91 layoutTodo->addWidget( addressLabel );
100 } 92 }
101 93
102 QString output; 94 QString output;
103 95
104 // Check whether the database provide the search option.. 96 // Check whether the database provide the search option..
105 if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ 97 if ( !m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
106 // Libopie seems to be old.. 98 // Libopie seems to be old..
107 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" ); 99 output = QObject::tr( "Database does not provide this search query ! Please upgrade libOpie !<br>" );
108 addressLabel->setText( output ); 100 addressLabel->setText( output );
109 return; 101 return;
110 } 102 }
111 103
112 // Define the query for birthdays and start search.. 104 // Define the query for birthdays and start search..
113 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead ); 105 QDate lookAheadDate = QDate::currentDate().addDays( m_daysLookAhead );
114 int ammount = 0; 106 int ammount = 0;
115 if ( m_showBirthdays ){ 107 if ( m_showBirthdays ){
116 qWarning("Searching from now (%s) until %s ! ", 108 qWarning("Searching from now (%s) until %s ! ",
117 QDate::currentDate().toString().latin1(), 109 QDate::currentDate().toString().latin1(),
118 lookAheadDate.toString().latin1() ); 110 lookAheadDate.toString().latin1() );
119 } 111 }
120 112
121 if ( m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){ 113 if ( m_contactdb->hasQuerySettings( OContactAccess::DateDiff ) ){
122 114
123 115
124 OContact querybirthdays; 116 OContact querybirthdays;
125 querybirthdays.setBirthday( lookAheadDate ); 117 querybirthdays.setBirthday( lookAheadDate );
126 118
127 m_list = m_contactdb->queryByExample( querybirthdays, 119 m_list = m_contactdb->queryByExample( querybirthdays,
128 OContactAccess::DateDiff ); 120 OContactAccess::DateDiff );
129 if ( m_list.count() > 0 ){ 121 if ( m_list.count() > 0 ){
130 output = "<font color=" + m_headlineColor + ">" 122 output = "<font color=" + m_headlineColor + ">"
131 + QObject::tr( "Next birthdays in <b> %1 </b> days:" ) 123 + QObject::tr( "Next birthdays in <b> %1 </b> days:" )
132 .arg( m_daysLookAhead ) 124 .arg( m_daysLookAhead )
133 + "</font> <br>"; 125 + "</font> <br>";
134 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 126 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
135 if ( ammount++ < m_maxLinesTask ){ 127 if ( ammount++ < m_maxLinesTask ){
136 // Now we want to calculate how many days 128 // Now we want to calculate how many days
137 //until birthday. We have to set 129 //until birthday. We have to set
138 // the correct year to calculate the day diff... 130 // the correct year to calculate the day diff...
139 QDate destdate = (*m_it).birthday(); 131 QDate destdate = (*m_it).birthday();
140 destdate.setYMD( QDate::currentDate().year(), 132 destdate.setYMD( QDate::currentDate().year(),
141 destdate.month(), destdate.day() ); 133 destdate.month(), destdate.day() );
142 if ( QDate::currentDate().daysTo(destdate) < 0 ) 134 if ( QDate::currentDate().daysTo(destdate) < 0 )
143 destdate.setYMD( QDate::currentDate().year()+1, 135 destdate.setYMD( QDate::currentDate().year()+1,
144 destdate.month(), destdate.day() ); 136 destdate.month(), destdate.day() );
145 137
146 138
147 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 139 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
148 output += "<font color=" + m_urgentColor + "><b>-" 140 output += "<font color=" + m_urgentColor + "><b>-"
149 + (*m_it).fullName() 141 + (*m_it).fullName()
150 + " (" 142 + " ("
151 + QString::number(QDate::currentDate() 143 + QString::number(QDate::currentDate()
152 .daysTo(destdate)) 144 .daysTo(destdate))
153 + " Days) </b></font><br>"; 145 + " Days) </b></font><br>";
154 146
155 else 147 else
156 output += "<font color=" + m_entryColor + "><b>-" 148 output += "<font color=" + m_entryColor + "><b>-"
157 + (*m_it).fullName() 149 + (*m_it).fullName()
158 + " (" 150 + " ("
159 + QString::number(QDate::currentDate() 151 + QString::number(QDate::currentDate()
160 .daysTo(destdate)) 152 .daysTo(destdate))
161 + " Days) </b></font><br>"; 153 + " Days) </b></font><br>";
162 } 154 }
163 } 155 }
164 } else { 156 } else {
165 output = "<font color=" + m_headlineColor + ">" 157 output = "<font color=" + m_headlineColor + ">"
166 + QObject::tr( "No birthdays in <b> %1 </b> days!" ) 158 + QObject::tr( "No birthdays in <b> %1 </b> days!" )
167 .arg( m_daysLookAhead ) 159 .arg( m_daysLookAhead )
168 + "</font> <br>"; 160 + "</font> <br>";
169 } 161 }
170 } 162 }
171 163
172 if ( m_showAnniversaries ){ 164 if ( m_showAnniversaries ){
173 // Define the query for anniversaries and start search.. 165 // Define the query for anniversaries and start search..
174 OContact queryanniversaries; 166 OContact queryanniversaries;
175 queryanniversaries.setAnniversary( lookAheadDate ); 167 queryanniversaries.setAnniversary( lookAheadDate );
176 168
177 m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff ); 169 m_list = m_contactdb->queryByExample( queryanniversaries, OContactAccess::DateDiff );
178 170
179 ammount = 0; 171 ammount = 0;
180 if ( m_list.count() > 0 ){ 172 if ( m_list.count() > 0 ){
181 output += "<font color=" + m_headlineColor + ">" 173 output += "<font color=" + m_headlineColor + ">"
182 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" ) 174 + QObject::tr( "Next anniversaries in <b> %1 </b> days:" )
183 .arg( m_daysLookAhead ) 175 .arg( m_daysLookAhead )
184 + "</font> <br>"; 176 + "</font> <br>";
185 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) { 177 for ( m_it = m_list.begin(); m_it != m_list.end(); ++m_it ) {
186 if ( ammount++ < m_maxLinesTask ){ 178 if ( ammount++ < m_maxLinesTask ){
187 // Now we want to calculate how many days until anniversary. 179 // Now we want to calculate how many days until anniversary.
188 // We have to set the correct year to calculate the day diff... 180 // We have to set the correct year to calculate the day diff...
189 QDate destdate = (*m_it).anniversary(); 181 QDate destdate = (*m_it).anniversary();
190 destdate.setYMD( QDate::currentDate().year(), destdate.month(), 182 destdate.setYMD( QDate::currentDate().year(), destdate.month(),
191 destdate.day() ); 183 destdate.day() );
192 if ( QDate::currentDate().daysTo(destdate) < 0 ) 184 if ( QDate::currentDate().daysTo(destdate) < 0 )
193 destdate.setYMD( QDate::currentDate().year()+1, 185 destdate.setYMD( QDate::currentDate().year()+1,
194 destdate.month(), destdate.day() ); 186 destdate.month(), destdate.day() );
195 187
196 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays ) 188 if ( QDate::currentDate().daysTo(destdate) < m_urgentDays )
197 output += "<font color=" + m_urgentColor + "><b>-" 189 output += "<font color=" + m_urgentColor + "><b>-"
198 + (*m_it).fullName() 190 + (*m_it).fullName()
199 + " (" 191 + " ("
200 + QString::number(QDate::currentDate() 192 + QString::number(QDate::currentDate()
201 .daysTo( destdate ) ) 193 .daysTo( destdate ) )
202 + " Days) </b></font><br>"; 194 + " Days) </b></font><br>";
203 else 195 else
204 output += "<font color=" + m_entryColor + "><b>-" 196 output += "<font color=" + m_entryColor + "><b>-"
205 + (*m_it).fullName() 197 + (*m_it).fullName()
206 + " (" 198 + " ("
207 + QString::number(QDate::currentDate() 199 + QString::number(QDate::currentDate()
208 .daysTo( destdate ) ) 200 .daysTo( destdate ) )
209 + " Days) </b></font><br>"; 201 + " Days) </b></font><br>";
210 } 202 }
211 } 203 }
212 } else { 204 } else {
213 output += "<font color=" + m_headlineColor + ">" 205 output += "<font color=" + m_headlineColor + ">"
214 + QObject::tr( "No anniversaries in <b> %1 </b> days!" ) 206 + QObject::tr( "No anniversaries in <b> %1 </b> days!" )
215 .arg( m_daysLookAhead ) 207 .arg( m_daysLookAhead )
216 + "</font> <br>"; 208 + "</font> <br>";
217 } 209 }
218 } 210 }
219 211
220 addressLabel->setText( output ); 212 addressLabel->setText( output );
221} 213}
222 214
223/** 215/**
224 * start the todolist 216 * start the todolist
225 */ 217 */
226void AddressBookPluginWidget::startAddressBook() { 218void AddressBookPluginWidget::startAddressBook() {
227 QCopEnvelope e( "QPE/System", "execute(QString)" ); 219 QCopEnvelope e( "QPE/System", "execute(QString)" );
228 e << QString( "addressbook" ); 220 e << QString( "addressbook" );
229} 221}
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
index e595047..e19a690 100644
--- a/core/pim/today/plugins/datebook/datebookevent.cpp
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -1,148 +1,146 @@
1/* 1/*
2 * datebookevent.cpp 2 * datebookevent.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "datebookevent.h" 17#include "datebookevent.h"
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qpe/timestring.h>
20#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
21#include <qpe/qpeapplication.h>
22#include <qpe/calendar.h> 20#include <qpe/calendar.h>
23 21
24#include <opie/odevice.h> 22#include <opie/odevice.h>
25 23
26using namespace Opie; 24using namespace Opie;
27 25
28DateBookEvent::DateBookEvent(const EffectiveEvent &ev, 26DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
29 QWidget* parent, 27 QWidget* parent,
30 bool show_location, 28 bool show_location,
31 bool show_notes, 29 bool show_notes,
32 bool timeExtraLine, 30 bool timeExtraLine,
33 int maxCharClip, 31 int maxCharClip,
34 const char* name, 32 const char* name,
35 WFlags fl) : 33 WFlags fl) :
36 OClickableLabel(parent,name,fl), event(ev) { 34 OClickableLabel(parent,name,fl), event(ev) {
37 35
38 // setAlignment( AlignTop ); 36 // setAlignment( AlignTop );
39 37
40 QString msg; 38 QString msg;
41 39
42 Config config( "qpe" ); 40 Config config( "qpe" );
43 config.setGroup( "Time" ); 41 config.setGroup( "Time" );
44 // if 24 h format 42 // if 24 h format
45 ampm = config.readBoolEntry( "AMPM", TRUE ); 43 ampm = config.readBoolEntry( "AMPM", TRUE );
46 44
47 msg += "<B>" + (ev).description() + "</B>"; 45 msg += "<B>" + (ev).description() + "</B>";
48 if ( (ev).event().hasAlarm() ) { 46 if ( (ev).event().hasAlarm() ) {
49 msg += " <b>" + tr("[with alarm]") +"</b>"; 47 msg += " <b>" + tr("[with alarm]") +"</b>";
50 } 48 }
51 49
52 // include location or not 50 // include location or not
53 if ( show_location ) { 51 if ( show_location ) {
54 msg += "<BR><i>" + (ev).location() + "</i>"; 52 msg += "<BR><i>" + (ev).location() + "</i>";
55 } 53 }
56 54
57 QString timeSpacer = " "; 55 QString timeSpacer = " ";
58 if ( timeExtraLine ) { 56 if ( timeExtraLine ) {
59 timeSpacer = "<br>"; 57 timeSpacer = "<br>";
60 } 58 }
61 59
62 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" ) 60 if ( ( TimeString::timeString( QTime( (ev).event().start().time() ) ) == "00:00" )
63 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) { 61 && ( TimeString::timeString( QTime( (ev).event().end().time() ) ) == "23:59" ) ) {
64 msg += tr ( "All day" ); 62 msg += tr ( "All day" );
65 } else { 63 } else {
66 // start time of event 64 // start time of event
67// QDate tempDate = (ev).event().start().date(); 65// QDate tempDate = (ev).event().start().date();
68 msg += timeSpacer; 66 msg += timeSpacer;
69 msg += ampmTime( QTime( (ev).event().start().time() ) ) 67 msg += ampmTime( QTime( (ev).event().start().time() ) )
70 // end time of event 68 // end time of event
71 + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ); 69 + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) );
72 } 70 }
73 71
74 if ( (ev).date() != QDate::currentDate() ) { 72 if ( (ev).date() != QDate::currentDate() ) {
75 msg += differDate( (ev).date() /* tempDate*/ ); 73 msg += differDate( (ev).date() /* tempDate*/ );
76 } 74 }
77 75
78 // include possible note or not 76 // include possible note or not
79 if ( show_notes ) { 77 if ( show_notes ) {
80 msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); 78 msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
81 } 79 }
82 setText( msg ); 80 setText( msg );
83 connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); 81 connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) );
84} 82}
85 83
86DateBookEvent::~DateBookEvent() { 84DateBookEvent::~DateBookEvent() {
87} 85}
88 86
89/** 87/**
90 * AM/PM timestring conversion. 88 * AM/PM timestring conversion.
91 * @param tm the timestring 89 * @param tm the timestring
92 * @return formatted to am/pm is system is set to it 90 * @return formatted to am/pm is system is set to it
93 */ 91 */
94QString DateBookEvent::ampmTime( QTime tm ) { 92QString DateBookEvent::ampmTime( QTime tm ) {
95 QString s; 93 QString s;
96 if( ampm ) { 94 if( ampm ) {
97 int hour = tm.hour(); 95 int hour = tm.hour();
98 if ( hour == 0 ) { 96 if ( hour == 0 ) {
99 hour = 12; 97 hour = 12;
100 } 98 }
101 if ( hour > 12 ) { 99 if ( hour > 12 ) {
102 hour -= 12; 100 hour -= 12;
103 } 101 }
104 s.sprintf( "%2d:%02d %s", hour, tm.minute(), 102 s.sprintf( "%2d:%02d %s", hour, tm.minute(),
105 (tm.hour() >= 12) ? "PM" : "AM" ); 103 (tm.hour() >= 12) ? "PM" : "AM" );
106 return s; 104 return s;
107 } else { 105 } else {
108 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); 106 s.sprintf( "%2d:%02d", tm.hour(), tm.minute() );
109 return s; 107 return s;
110 } 108 }
111} 109}
112 110
113QString DateBookEvent::differDate( QDate date ) { 111QString DateBookEvent::differDate( QDate date ) {
114// QDate currentDate = QDate::currentDate(); 112// QDate currentDate = QDate::currentDate();
115 QString returnText = "<font color = #407DD9><b> "; 113 QString returnText = "<font color = #407DD9><b> ";
116// int differDate = currentDate.daysTo( date ); 114// int differDate = currentDate.daysTo( date );
117// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) { 115// if ( currentDate.dayOfWeek() == date.dayOfWeek() ) {
118// returnText += "" ; 116// returnText += "" ;
119// // not working right for recurring events 117// // not working right for recurring events
120// //} else if ( differDate == 1 ) { 118// //} else if ( differDate == 1 ) {
121// //returnText += tr( "tomorrow" ); 119// //returnText += tr( "tomorrow" );
122// } else { 120// } else {
123// returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] "; 121// returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] ";
124// } 122// }
125 returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] "; 123 returnText += " [ " + Calendar::nameOfDay( date.dayOfWeek() ) + " ] ";
126 returnText += "</b></font>"; 124 returnText += "</b></font>";
127 return returnText; 125 return returnText;
128} 126}
129 127
130 128
131/** 129/**
132 * starts the edit dialog as known from datebook 130 * starts the edit dialog as known from datebook
133 */ 131 */
134void DateBookEvent::editEventSlot( const Event &e ) { 132void DateBookEvent::editEventSlot( const Event &e ) {
135 133
136 if ( ODevice::inst()->system() == System_Zaurus ) { 134 if ( ODevice::inst()->system() == System_Zaurus ) {
137 QCopEnvelope env( "QPE/Application/datebook", "raise()" ); 135 QCopEnvelope env( "QPE/Application/datebook", "raise()" );
138 } else { 136 } else {
139 QCopEnvelope env( "QPE/Application/datebook", "editEvent(int)" ); 137 QCopEnvelope env( "QPE/Application/datebook", "editEvent(int)" );
140 env << e.uid(); 138 env << e.uid();
141 } 139 }
142} 140}
143 141
144 142
145void DateBookEvent::editMe() { 143void DateBookEvent::editMe() {
146 emit editEvent( event.event() ); 144 emit editEvent( event.event() );
147} 145}
148 146
diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp
index f77e440..8dfa52f 100644
--- a/core/pim/today/plugins/datebook/datebookplugin.cpp
+++ b/core/pim/today/plugins/datebook/datebookplugin.cpp
@@ -1,78 +1,77 @@
1 1
2/* 2/*
3 * datebookplugin.cpp 3 * datebookplugin.cpp
4 * 4 *
5 * copyright : (c) 2002,2003 by Maximilian Reiß 5 * copyright : (c) 2002,2003 by Maximilian Reiß
6 * email : harlekin@handhelds.org 6 * email : harlekin@handhelds.org
7 * 7 *
8 */ 8 */
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18 18
19 19
20#include "datebookevent.h"
21#include "datebookplugin.h" 20#include "datebookplugin.h"
22#include "datebookpluginconfig.h" 21#include "datebookpluginconfig.h"
23 22
24 23
25DatebookPlugin::DatebookPlugin() { 24DatebookPlugin::DatebookPlugin() {
26} 25}
27 26
28DatebookPlugin::~DatebookPlugin() { 27DatebookPlugin::~DatebookPlugin() {
29 delete (DatebookPluginWidget*)m_widget; 28 delete (DatebookPluginWidget*)m_widget;
30} 29}
31 30
32QString DatebookPlugin::pluginName() const { 31QString DatebookPlugin::pluginName() const {
33 return QObject::tr( "Datebook plugin"); 32 return QObject::tr( "Datebook plugin");
34} 33}
35 34
36double DatebookPlugin::versionNumber() const { 35double DatebookPlugin::versionNumber() const {
37 return 1.0; 36 return 1.0;
38} 37}
39 38
40QString DatebookPlugin::pixmapNameWidget() const { 39QString DatebookPlugin::pixmapNameWidget() const {
41 return "datebook/DateBook"; 40 return "datebook/DateBook";
42} 41}
43 42
44QWidget* DatebookPlugin::widget( QWidget* wid ) { 43QWidget* DatebookPlugin::widget( QWidget* wid ) {
45 if(!m_widget) { 44 if(!m_widget) {
46 m_widget = new DatebookPluginWidget( wid, "Datebook" ); 45 m_widget = new DatebookPluginWidget( wid, "Datebook" );
47 } 46 }
48 return m_widget; 47 return m_widget;
49} 48}
50 49
51QString DatebookPlugin::pixmapNameConfig() const { 50QString DatebookPlugin::pixmapNameConfig() const {
52 return "datebook/DateBook"; 51 return "datebook/DateBook";
53} 52}
54 53
55TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { 54TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) {
56 return new DatebookPluginConfig( wid , "Datebook" ); 55 return new DatebookPluginConfig( wid , "Datebook" );
57} 56}
58 57
59QString DatebookPlugin::appName() const { 58QString DatebookPlugin::appName() const {
60 return "datebook"; 59 return "datebook";
61} 60}
62 61
63bool DatebookPlugin::excludeFromRefresh() const { 62bool DatebookPlugin::excludeFromRefresh() const {
64 return false; 63 return false;
65} 64}
66 65
67void DatebookPlugin::refresh() { 66void DatebookPlugin::refresh() {
68 if ( m_widget ) { 67 if ( m_widget ) {
69 m_widget->refresh(); 68 m_widget->refresh();
70 } 69 }
71} 70}
72 71
73void DatebookPlugin::reinitialize() { 72void DatebookPlugin::reinitialize() {
74 if ( m_widget ) { 73 if ( m_widget ) {
75 m_widget->reinitialize(); 74 m_widget->reinitialize();
76 } 75 }
77} 76}
78 77
diff --git a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
index 54f820b..8ead40d 100644
--- a/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginconfig.cpp
@@ -1,77 +1,73 @@
1/* 1/*
2 * datebookpluginconfig.cpp 2 * datebookpluginconfig.cpp
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#include "datebookpluginconfig.h" 18#include "datebookpluginconfig.h"
19 19
20#include <qpe/config.h> 20#include <qpe/config.h>
21 21
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qlabel.h>
24#include <qhbox.h>
25#include <qwhatsthis.h>
26#include <qvbox.h>
27 23
28DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name) 24DatebookPluginConfig::DatebookPluginConfig( QWidget* parent, const char* name)
29 : TodayConfigWidget( parent, name ) { 25 : TodayConfigWidget( parent, name ) {
30 26
31 QVBoxLayout *layout = new QVBoxLayout( this ); 27 QVBoxLayout *layout = new QVBoxLayout( this );
32 28
33 m_gui = new DatebookPluginConfigBase( this ); 29 m_gui = new DatebookPluginConfigBase( this );
34 30
35 layout->addWidget( m_gui ); 31 layout->addWidget( m_gui );
36 32
37 readConfig(); 33 readConfig();
38} 34}
39 35
40void DatebookPluginConfig::readConfig() { 36void DatebookPluginConfig::readConfig() {
41 Config cfg( "todaydatebookplugin" ); 37 Config cfg( "todaydatebookplugin" );
42 cfg.setGroup( "config" ); 38 cfg.setGroup( "config" );
43 39
44 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); 40 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
45 m_gui->SpinBox1->setValue( m_max_lines_meet ); 41 m_gui->SpinBox1->setValue( m_max_lines_meet );
46 m_show_location = cfg.readNumEntry( "showlocation", 1 ); 42 m_show_location = cfg.readNumEntry( "showlocation", 1 );
47 m_gui->CheckBox1->setChecked( m_show_location ); 43 m_gui->CheckBox1->setChecked( m_show_location );
48 m_show_notes = cfg.readNumEntry( "shownotes", 0 ); 44 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
49 m_gui->CheckBox2->setChecked( m_show_notes ); 45 m_gui->CheckBox2->setChecked( m_show_notes );
50 m_only_later = cfg.readNumEntry( "onlylater", 1 ); 46 m_only_later = cfg.readNumEntry( "onlylater", 1 );
51 m_gui->CheckBox4->setChecked( cfg.readNumEntry( "timeextraline", 1 ) ); 47 m_gui->CheckBox4->setChecked( cfg.readNumEntry( "timeextraline", 1 ) );
52 m_gui->CheckBox3->setChecked( m_only_later ); 48 m_gui->CheckBox3->setChecked( m_only_later );
53 m_more_days = cfg.readNumEntry( "moredays", 0 ); 49 m_more_days = cfg.readNumEntry( "moredays", 0 );
54 m_gui->SpinBox2->setValue( m_more_days ); 50 m_gui->SpinBox2->setValue( m_more_days );
55} 51}
56 52
57 53
58void DatebookPluginConfig::writeConfig() { 54void DatebookPluginConfig::writeConfig() {
59 Config cfg( "todaydatebookplugin" ); 55 Config cfg( "todaydatebookplugin" );
60 cfg.setGroup( "config" ); 56 cfg.setGroup( "config" );
61 57
62 m_max_lines_meet = m_gui->SpinBox1->value(); 58 m_max_lines_meet = m_gui->SpinBox1->value();
63 cfg.writeEntry( "maxlinesmeet", m_max_lines_meet); 59 cfg.writeEntry( "maxlinesmeet", m_max_lines_meet);
64 m_show_location = m_gui->CheckBox1->isChecked(); 60 m_show_location = m_gui->CheckBox1->isChecked();
65 cfg.writeEntry( "showlocation", m_show_location); 61 cfg.writeEntry( "showlocation", m_show_location);
66 m_show_notes = m_gui->CheckBox2->isChecked(); 62 m_show_notes = m_gui->CheckBox2->isChecked();
67 cfg.writeEntry( "shownotes", m_show_notes ); 63 cfg.writeEntry( "shownotes", m_show_notes );
68 m_only_later = m_gui->CheckBox3->isChecked(); 64 m_only_later = m_gui->CheckBox3->isChecked();
69 cfg.writeEntry( "timeextraline", m_gui->CheckBox4->isChecked() ); 65 cfg.writeEntry( "timeextraline", m_gui->CheckBox4->isChecked() );
70 cfg.writeEntry( "onlylater", m_only_later ); 66 cfg.writeEntry( "onlylater", m_only_later );
71 m_more_days = m_gui->SpinBox2->value(); 67 m_more_days = m_gui->SpinBox2->value();
72 cfg.writeEntry( "moredays", m_more_days ); 68 cfg.writeEntry( "moredays", m_more_days );
73 cfg.write(); 69 cfg.write();
74} 70}
75 71
76DatebookPluginConfig::~DatebookPluginConfig() { 72DatebookPluginConfig::~DatebookPluginConfig() {
77} 73}
diff --git a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
index 9e95bcd..1b11d1b 100644
--- a/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
+++ b/core/pim/today/plugins/datebook/datebookpluginwidget.cpp
@@ -1,143 +1,140 @@
1 /* 1 /*
2 * datebookpluginwidget.cpp 2 * datebookpluginwidget.cpp
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18#include "datebookpluginwidget.h" 18#include "datebookpluginwidget.h"
19 19
20#include <qpe/timestring.h>
21#include <qpe/config.h> 20#include <qpe/config.h>
22 21
23#include <qdatetime.h>
24#include <qlabel.h>
25#include <qtl.h> 22#include <qtl.h>
26 23
27DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name ) 24DatebookPluginWidget::DatebookPluginWidget( QWidget *parent, const char* name )
28 : QWidget(parent, name ) { 25 : QWidget(parent, name ) {
29 26
30 db = 0l; 27 db = 0l;
31 m_layoutDates = 0l; 28 m_layoutDates = 0l;
32 29
33 if ( m_layoutDates ) { 30 if ( m_layoutDates ) {
34 delete m_layoutDates; 31 delete m_layoutDates;
35 } 32 }
36 m_layoutDates = new QVBoxLayout( this ); 33 m_layoutDates = new QVBoxLayout( this );
37 m_layoutDates->setAutoAdd( true ); 34 m_layoutDates->setAutoAdd( true );
38 35
39 m_eventsList.setAutoDelete( true ); 36 m_eventsList.setAutoDelete( true );
40 37
41 readConfig(); 38 readConfig();
42 getDates(); 39 getDates();
43} 40}
44 41
45DatebookPluginWidget::~DatebookPluginWidget() { 42DatebookPluginWidget::~DatebookPluginWidget() {
46 delete db; 43 delete db;
47 delete m_layoutDates; 44 delete m_layoutDates;
48} 45}
49 46
50 47
51void DatebookPluginWidget::readConfig() { 48void DatebookPluginWidget::readConfig() {
52 Config cfg( "todaydatebookplugin" ); 49 Config cfg( "todaydatebookplugin" );
53 cfg.setGroup( "config" ); 50 cfg.setGroup( "config" );
54 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 ); 51 m_max_lines_meet = cfg.readNumEntry( "maxlinesmeet", 5 );
55 m_show_location = cfg.readNumEntry( "showlocation", 1 ); 52 m_show_location = cfg.readNumEntry( "showlocation", 1 );
56 m_show_notes = cfg.readNumEntry( "shownotes", 0 ); 53 m_show_notes = cfg.readNumEntry( "shownotes", 0 );
57 m_onlyLater = cfg.readNumEntry( "onlylater", 1 ); 54 m_onlyLater = cfg.readNumEntry( "onlylater", 1 );
58 m_moreDays = cfg.readNumEntry( "moredays", 0 ); 55 m_moreDays = cfg.readNumEntry( "moredays", 0 );
59 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 ); 56 m_timeExtraLine = cfg.readNumEntry( "timeextraline", 1 );
60} 57}
61 58
62void DatebookPluginWidget::reinitialize() { 59void DatebookPluginWidget::reinitialize() {
63 readConfig(); 60 readConfig();
64 refresh(); 61 refresh();
65} 62}
66 63
67void DatebookPluginWidget::refresh() { 64void DatebookPluginWidget::refresh() {
68 m_eventsList.clear(); 65 m_eventsList.clear();
69 66
70 if ( m_layoutDates ) { 67 if ( m_layoutDates ) {
71 delete m_layoutDates; 68 delete m_layoutDates;
72 } 69 }
73 m_layoutDates = new QVBoxLayout( this ); 70 m_layoutDates = new QVBoxLayout( this );
74 m_layoutDates->setAutoAdd( true ); 71 m_layoutDates->setAutoAdd( true );
75 72
76 getDates(); 73 getDates();
77} 74}
78 75
79/** 76/**
80 * Get all events that are in the datebook xml file for today 77 * Get all events that are in the datebook xml file for today
81 */ 78 */
82void DatebookPluginWidget::getDates() { 79void DatebookPluginWidget::getDates() {
83 80
84 81
85 if ( db ) { 82 if ( db ) {
86 delete db; 83 delete db;
87 } 84 }
88 db = new DateBookDB; 85 db = new DateBookDB;
89 86
90 QDate date = QDate::currentDate(); 87 QDate date = QDate::currentDate();
91 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) ); 88 QValueList<EffectiveEvent> list = db->getEffectiveEvents( date, date.addDays( m_moreDays ) );
92 qBubbleSort( list ); 89 qBubbleSort( list );
93 int count = 0; 90 int count = 0;
94 91
95 if ( list.count() > 0 ) { 92 if ( list.count() > 0 ) {
96 93
97 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) { 94 for ( QValueList<EffectiveEvent>::ConstIterator it = list.begin(); it != list.end(); ++it ) {
98 95
99 if ( count < m_max_lines_meet ) { 96 if ( count < m_max_lines_meet ) {
100 if ( !m_onlyLater ) { 97 if ( !m_onlyLater ) {
101 count++; 98 count++;
102 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); 99 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
103 m_eventsList.append( l ); 100 m_eventsList.append( l );
104 l->show(); 101 l->show();
105 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 102 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
106 } else { 103 } else {
107 if ( ( QDateTime::currentDateTime() <= (*it).event().end() ) 104 if ( ( QDateTime::currentDateTime() <= (*it).event().end() )
108 // Show events which span over many days and are not elapsed. 105 // Show events which span over many days and are not elapsed.
109 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) ) 106 || ( ( (*it).event().start().date() != date ) && ( QDateTime::currentDateTime() <= (*it).event().end() ) )
110 // Show repeated event for today that is not elapsed. 107 // Show repeated event for today that is not elapsed.
111 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 108 || ( ( (*it).event().repeatType() != Event::NoRepeat )
112 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() ) 109 && ( ( date.dayOfWeek() == (*it).date().dayOfWeek() )
113 && ( QTime::currentTime() < (*it).event().start().time() ) ) ) 110 && ( QTime::currentTime() < (*it).event().start().time() ) ) )
114 // Show repeated event for next days. 111 // Show repeated event for next days.
115 || ( ( (*it).event().repeatType() != Event::NoRepeat ) 112 || ( ( (*it).event().repeatType() != Event::NoRepeat )
116 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) ) 113 && ( date.dayOfWeek() != (*it).date().dayOfWeek() ) )
117 ) 114 )
118 { 115 {
119 count++; 116 count++;
120 // show only later appointments 117 // show only later appointments
121 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine ); 118 DateBookEvent *l = new DateBookEvent( *it, this, m_show_location, m_show_notes, m_timeExtraLine );
122 m_eventsList.append( l ); 119 m_eventsList.append( l );
123 l->show(); 120 l->show();
124 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) ); 121 QObject::connect ( l, SIGNAL( editEvent( const Event & ) ), l, SLOT( editEventSlot( const Event & ) ) );
125 } 122 }
126 } 123 }
127 } 124 }
128 } 125 }
129 if ( m_onlyLater && count == 0 ) { 126 if ( m_onlyLater && count == 0 ) {
130 QLabel* noMoreEvents = new QLabel( this ); 127 QLabel* noMoreEvents = new QLabel( this );
131 m_eventsList.append( noMoreEvents ); 128 m_eventsList.append( noMoreEvents );
132 noMoreEvents->show(); 129 noMoreEvents->show();
133 noMoreEvents->setText( QObject::tr( "No more appointments today" ) ); 130 noMoreEvents->setText( QObject::tr( "No more appointments today" ) );
134 } 131 }
135 } else { 132 } else {
136 QLabel* noEvents = new QLabel( this ); 133 QLabel* noEvents = new QLabel( this );
137 m_eventsList.append( noEvents ); 134 m_eventsList.append( noEvents );
138 noEvents->show(); 135 noEvents->show();
139 noEvents->setText( QObject::tr( "No appointments today" ) ); 136 noEvents->setText( QObject::tr( "No appointments today" ) );
140 } 137 }
141} 138}
142 139
143 140
diff --git a/core/pim/today/plugins/todolist/todopluginconfig.cpp b/core/pim/today/plugins/todolist/todopluginconfig.cpp
index 4821776..76c08a9 100644
--- a/core/pim/today/plugins/todolist/todopluginconfig.cpp
+++ b/core/pim/today/plugins/todolist/todopluginconfig.cpp
@@ -1,59 +1,58 @@
1/* 1/*
2 * todopluginconfig.cpp 2 * todopluginconfig.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todopluginconfig.h" 17#include "todopluginconfig.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20 20
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qwhatsthis.h>
23 22
24 23
25TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name) 24TodolistPluginConfig::TodolistPluginConfig( QWidget *parent, const char* name)
26 : TodayConfigWidget(parent, name ) { 25 : TodayConfigWidget(parent, name ) {
27 26
28 QVBoxLayout * layout = new QVBoxLayout( this ); 27 QVBoxLayout * layout = new QVBoxLayout( this );
29 28
30 m_gui = new TodoPluginConfigBase( this ); 29 m_gui = new TodoPluginConfigBase( this );
31 30
32 layout->addWidget( m_gui ); 31 layout->addWidget( m_gui );
33 32
34 readConfig(); 33 readConfig();
35} 34}
36 35
37void TodolistPluginConfig::readConfig() { 36void TodolistPluginConfig::readConfig() {
38 Config cfg( "todaytodoplugin" ); 37 Config cfg( "todaytodoplugin" );
39 cfg.setGroup( "config" ); 38 cfg.setGroup( "config" );
40 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 ); 39 m_max_lines_task = cfg.readNumEntry( "maxlinestask", 5 );
41 m_gui->SpinBox2->setValue( m_max_lines_task ); 40 m_gui->SpinBox2->setValue( m_max_lines_task );
42 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 ); 41 m_maxCharClip = cfg.readNumEntry( "maxcharclip", 38 );
43 m_gui->SpinBoxClip->setValue( m_maxCharClip ); 42 m_gui->SpinBoxClip->setValue( m_maxCharClip );
44} 43}
45 44
46 45
47void TodolistPluginConfig::writeConfig() { 46void TodolistPluginConfig::writeConfig() {
48 Config cfg( "todaytodoplugin" ); 47 Config cfg( "todaytodoplugin" );
49 cfg.setGroup( "config" ); 48 cfg.setGroup( "config" );
50 m_max_lines_task = m_gui->SpinBox2->value(); 49 m_max_lines_task = m_gui->SpinBox2->value();
51 cfg.writeEntry( "maxlinestask", m_max_lines_task ); 50 cfg.writeEntry( "maxlinestask", m_max_lines_task );
52 m_maxCharClip = m_gui->SpinBoxClip->value(); 51 m_maxCharClip = m_gui->SpinBoxClip->value();
53 cfg.writeEntry( "maxcharclip", m_maxCharClip ); 52 cfg.writeEntry( "maxcharclip", m_maxCharClip );
54 cfg.write(); 53 cfg.write();
55} 54}
56 55
57 56
58TodolistPluginConfig::~TodolistPluginConfig() { 57TodolistPluginConfig::~TodolistPluginConfig() {
59} 58}
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index d4a0ae6..2e7e1a8 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,476 +1,473 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18 18
19#define QTOPIA_INTERNAL_LANGLIST 19#define QTOPIA_INTERNAL_LANGLIST
20 20
21#include "today.h" 21#include "today.h"
22 22
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/global.h> 26#include <qpe/global.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/contact.h> 28#include <qpe/contact.h>
29#include <qpe/timestring.h>
30 29
31#include <qdir.h> 30#include <qdir.h>
32#include <qfile.h>
33#include <qtimer.h> 31#include <qtimer.h>
34#include <qwhatsthis.h> 32#include <qwhatsthis.h>
35#include <qtranslator.h>
36 33
37struct TodayPlugin { 34struct TodayPlugin {
38 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 35 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
39 QLibrary *library; 36 QLibrary *library;
40 QInterfacePtr<TodayPluginInterface> iface; 37 QInterfacePtr<TodayPluginInterface> iface;
41 TodayPluginObject *guiPart; 38 TodayPluginObject *guiPart;
42 QWidget *guiBox; 39 QWidget *guiBox;
43 QString name; 40 QString name;
44 bool active; 41 bool active;
45 bool excludeRefresh; 42 bool excludeRefresh;
46 int pos; 43 int pos;
47}; 44};
48 45
49static QValueList<TodayPlugin> pluginList; 46static QValueList<TodayPlugin> pluginList;
50 47
51static QMap<QString, TodayPlugin> tempList; 48static QMap<QString, TodayPlugin> tempList;
52 49
53Today::Today( QWidget* parent, const char* name, WFlags fl ) 50Today::Today( QWidget* parent, const char* name, WFlags fl )
54 : TodayBase( parent, name, fl ) { 51 : TodayBase( parent, name, fl ) {
55 52
56 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 53 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
57 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 54 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
58 55
59#if defined(Q_WS_QWS) 56#if defined(Q_WS_QWS)
60#if !defined(QT_NO_COP) 57#if !defined(QT_NO_COP)
61 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 58 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
62 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 59 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
63 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 60 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
64#endif 61#endif
65#endif 62#endif
66 63
67 setOwnerField(); 64 setOwnerField();
68 m_refreshTimer = new QTimer( this ); 65 m_refreshTimer = new QTimer( this );
69 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 66 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
70 m_refreshTimer->start( 15000 ); 67 m_refreshTimer->start( 15000 );
71 m_big_box = 0L; 68 m_big_box = 0L;
72 69
73 70
74 layout = new QVBoxLayout( this ); 71 layout = new QVBoxLayout( this );
75 layout->addWidget( Frame ); 72 layout->addWidget( Frame );
76 layout->addWidget( OwnerField ); 73 layout->addWidget( OwnerField );
77 74
78 m_sv = new QScrollView( this ); 75 m_sv = new QScrollView( this );
79 m_sv->setResizePolicy( QScrollView::AutoOneFit ); 76 m_sv->setResizePolicy( QScrollView::AutoOneFit );
80 m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); 77 m_sv->setHScrollBarMode( QScrollView::AlwaysOff );
81 m_sv->setFrameShape( QFrame::NoFrame ); 78 m_sv->setFrameShape( QFrame::NoFrame );
82 79
83 layout->addWidget( m_sv ); 80 layout->addWidget( m_sv );
84 layout->setStretchFactor( m_sv,4 ); 81 layout->setStretchFactor( m_sv,4 );
85 82
86 qApp->processEvents(); 83 qApp->processEvents();
87 loadPlugins(); 84 loadPlugins();
88 showMaximized(); 85 showMaximized();
89} 86}
90 87
91/** 88/**
92 * Qcop receive method. 89 * Qcop receive method.
93 */ 90 */
94void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 91void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
95 QDataStream stream( data, IO_ReadOnly ); 92 QDataStream stream( data, IO_ReadOnly );
96 if ( msg == "message(QString)" ) { 93 if ( msg == "message(QString)" ) {
97 QString message; 94 QString message;
98 stream >> message; 95 stream >> message;
99 setOwnerField( message ); 96 setOwnerField( message );
100 } 97 }
101} 98}
102 99
103void Today::setRefreshTimer( int interval ) { 100void Today::setRefreshTimer( int interval ) {
104 101
105 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 102 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
106 103
107 // 0 is "never" case 104 // 0 is "never" case
108 if ( !interval == 0 ) { 105 if ( !interval == 0 ) {
109 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 106 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
110 m_refreshTimer->changeInterval( interval ); 107 m_refreshTimer->changeInterval( interval );
111 } 108 }
112} 109}
113 110
114 111
115/** 112/**
116 * Initialises the owner field with the default value, the username 113 * Initialises the owner field with the default value, the username
117 */ 114 */
118void Today::setOwnerField() { 115void Today::setOwnerField() {
119 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 116 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
120 if ( QFile::exists( file ) ) { 117 if ( QFile::exists( file ) ) {
121 Contact cont = Contact::readVCard( file )[0]; 118 Contact cont = Contact::readVCard( file )[0];
122 QString returnString = cont.fullName(); 119 QString returnString = cont.fullName();
123 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 120 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
124 } else { 121 } else {
125 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 122 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
126 } 123 }
127} 124}
128 125
129/** 126/**
130 * Set the owner field with a given QString, for example per qcop. 127 * Set the owner field with a given QString, for example per qcop.
131 */ 128 */
132void Today::setOwnerField( QString &message ) { 129void Today::setOwnerField( QString &message ) {
133 if ( !message.isEmpty() ) { 130 if ( !message.isEmpty() ) {
134 OwnerField->setText( "<b>" + message + "</b>" ); 131 OwnerField->setText( "<b>" + message + "</b>" );
135 } 132 }
136} 133}
137 134
138/** 135/**
139 * Init stuff needed for today. Reads the config file. 136 * Init stuff needed for today. Reads the config file.
140 */ 137 */
141void Today::init() { 138void Today::init() {
142 // read config 139 // read config
143 Config cfg( "today" ); 140 Config cfg( "today" );
144 141
145 cfg.setGroup( "Plugins" ); 142 cfg.setGroup( "Plugins" );
146 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 143 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
147 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 144 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
148 145
149 cfg.setGroup( "General" ); 146 cfg.setGroup( "General" );
150 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 147 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
151 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); 148 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
152 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 149 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
153 150
154 // set the date in top label 151 // set the date in top label
155 QDate date = QDate::currentDate(); 152 QDate date = QDate::currentDate();
156 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); 153 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
157 154
158 if ( m_hideBanner ) { 155 if ( m_hideBanner ) {
159 Opiezilla->hide(); 156 Opiezilla->hide();
160 TodayLabel->hide(); 157 TodayLabel->hide();
161 } else { 158 } else {
162 Opiezilla->show(); 159 Opiezilla->show();
163 TodayLabel->show(); 160 TodayLabel->show();
164 } 161 }
165 162
166 if ( m_big_box ) { 163 if ( m_big_box ) {
167 delete m_big_box; 164 delete m_big_box;
168 } 165 }
169 166
170 m_big_box = new QWidget( m_sv->viewport() ); 167 m_big_box = new QWidget( m_sv->viewport() );
171 m_sv->addChild( m_big_box ); 168 m_sv->addChild( m_big_box );
172 m_bblayout = new QVBoxLayout ( m_big_box ); 169 m_bblayout = new QVBoxLayout ( m_big_box );
173} 170}
174 171
175/** 172/**
176 * Load the plugins 173 * Load the plugins
177 */ 174 */
178void Today::loadPlugins() { 175void Today::loadPlugins() {
179 176
180 init(); 177 init();
181 178
182 QValueList<TodayPlugin>::Iterator tit; 179 QValueList<TodayPlugin>::Iterator tit;
183 if ( !pluginList.isEmpty() ) { 180 if ( !pluginList.isEmpty() ) {
184 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 181 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
185 (*tit).guiBox->hide(); 182 (*tit).guiBox->hide();
186 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); 183 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) );
187 delete (*tit).guiBox; 184 delete (*tit).guiBox;
188 (*tit).library->unload(); 185 (*tit).library->unload();
189 delete (*tit).library; 186 delete (*tit).library;
190 } 187 }
191 pluginList.clear(); 188 pluginList.clear();
192 } 189 }
193 190
194 QString path = QPEApplication::qpeDir() + "/plugins/today"; 191 QString path = QPEApplication::qpeDir() + "/plugins/today";
195 QDir dir( path, "lib*.so" ); 192 QDir dir( path, "lib*.so" );
196 193
197 QStringList list = dir.entryList(); 194 QStringList list = dir.entryList();
198 QStringList::Iterator it; 195 QStringList::Iterator it;
199 196
200 // QMap<QString, TodayPlugin> tempList; 197 // QMap<QString, TodayPlugin> tempList;
201 198
202 for ( it = list.begin(); it != list.end(); ++it ) { 199 for ( it = list.begin(); it != list.end(); ++it ) {
203 QInterfacePtr<TodayPluginInterface> iface; 200 QInterfacePtr<TodayPluginInterface> iface;
204 QLibrary *lib = new QLibrary( path + "/" + *it ); 201 QLibrary *lib = new QLibrary( path + "/" + *it );
205 202
206 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 203 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
207 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 204 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
208 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); 205 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
209 qDebug( QString(*it) ); 206 qDebug( QString(*it) );
210 207
211 TodayPlugin plugin; 208 TodayPlugin plugin;
212 plugin.library = lib; 209 plugin.library = lib;
213 plugin.iface = iface; 210 plugin.iface = iface;
214 plugin.name = QString(*it); 211 plugin.name = QString(*it);
215 212
216 QString type = (*it).left( (*it).find(".") ); 213 QString type = (*it).left( (*it).find(".") );
217 214
218 QString lang; 215 QString lang;
219 Config config("locale"); 216 Config config("locale");
220 config.setGroup("Language"); 217 config.setGroup("Language");
221 lang = config.readEntry( "Language", "en" ); 218 lang = config.readEntry( "Language", "en" );
222 219
223 qDebug( "Languages: " + lang ); 220 qDebug( "Languages: " + lang );
224 QTranslator * trans = new QTranslator( qApp ); 221 QTranslator * trans = new QTranslator( qApp );
225 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; 222 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm";
226 if ( trans->load( tfn ) ) { 223 if ( trans->load( tfn ) ) {
227 qApp->installTranslator( trans ); 224 qApp->installTranslator( trans );
228 } else { 225 } else {
229 delete trans; 226 delete trans;
230 } 227 }
231 228
232 229
233 // find out if plugins should be shown 230 // find out if plugins should be shown
234 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 231 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
235 plugin.active = true; 232 plugin.active = true;
236 } else { 233 } else {
237 plugin.active = false; 234 plugin.active = false;
238 } 235 }
239 236
240 plugin.guiPart = plugin.iface->guiPart(); 237 plugin.guiPart = plugin.iface->guiPart();
241 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); 238 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh();
242 239
243 // package the whole thing into a qwidget so it can be shown and hidden 240 // package the whole thing into a qwidget so it can be shown and hidden
244 plugin.guiBox = new QWidget( m_big_box ); 241 plugin.guiBox = new QWidget( m_big_box );
245 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 242 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
246 QPixmap plugPix; 243 QPixmap plugPix;
247 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); 244 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
248 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 245 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
249 plugIcon->setPixmap( plugPix ); 246 plugIcon->setPixmap( plugPix );
250 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); 247 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") );
251 plugIcon->setName( plugin.guiPart->appName() ); 248 plugIcon->setName( plugin.guiPart->appName() );
252 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); 249 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
253 250
254 QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); 251 QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox );
255 boxLayout->addWidget( plugIcon, 0, AlignTop ); 252 boxLayout->addWidget( plugIcon, 0, AlignTop );
256 boxLayout->addWidget( plugWidget, 0, AlignTop ); 253 boxLayout->addWidget( plugWidget, 0, AlignTop );
257 boxLayout->setStretchFactor( plugIcon, 1 ); 254 boxLayout->setStretchFactor( plugIcon, 1 );
258 boxLayout->setStretchFactor( plugWidget, 9 ); 255 boxLayout->setStretchFactor( plugWidget, 9 );
259 256
260 // "prebuffer" it in one more list, to get the sorting done 257 // "prebuffer" it in one more list, to get the sorting done
261 tempList.insert( plugin.name, plugin ); 258 tempList.insert( plugin.name, plugin );
262 259
263 // on first start the list is off course empty 260 // on first start the list is off course empty
264 if ( m_allApplets.isEmpty() ) { 261 if ( m_allApplets.isEmpty() ) {
265 pluginList.append( plugin ); 262 pluginList.append( plugin );
266 m_bblayout->addWidget( plugin.guiBox ); 263 m_bblayout->addWidget( plugin.guiBox );
267 } 264 }
268 265
269 // if plugin is not yet in the list, add it to the layout too 266 // if plugin is not yet in the list, add it to the layout too
270 else if ( !m_allApplets.contains( plugin.name ) ) { 267 else if ( !m_allApplets.contains( plugin.name ) ) {
271 pluginList.append( plugin ); 268 pluginList.append( plugin );
272 } 269 }
273 } else { 270 } else {
274 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 271 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
275 delete lib; 272 delete lib;
276 } 273 }
277 274
278 } 275 }
279 276
280 277
281 if ( !m_allApplets.isEmpty() ) { 278 if ( !m_allApplets.isEmpty() ) {
282 TodayPlugin tempPlugin; 279 TodayPlugin tempPlugin;
283 QStringList::Iterator stringit; 280 QStringList::Iterator stringit;
284 281
285 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 282 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
286 tempPlugin = ( tempList.find( *stringit ) ).data(); 283 tempPlugin = ( tempList.find( *stringit ) ).data();
287 if ( !( (tempPlugin.name).isEmpty() ) ) { 284 if ( !( (tempPlugin.name).isEmpty() ) ) {
288 pluginList.append( tempPlugin ); 285 pluginList.append( tempPlugin );
289 m_bblayout->addWidget( tempPlugin.guiBox ); 286 m_bblayout->addWidget( tempPlugin.guiBox );
290 } 287 }
291 } 288 }
292 } 289 }
293 m_bblayout->addStretch( 2 ); 290 m_bblayout->addStretch( 2 );
294 draw(); 291 draw();
295} 292}
296 293
297 294
298 295
299 296
300/** 297/**
301 * Repaint method. Reread all fields. 298 * Repaint method. Reread all fields.
302 */ 299 */
303void Today::draw() { 300void Today::draw() {
304 301
305 if ( pluginList.count() == 0 ) { 302 if ( pluginList.count() == 0 ) {
306 QLabel *noPlugins = new QLabel( this ); 303 QLabel *noPlugins = new QLabel( this );
307 noPlugins->setText( tr( "No plugins found" ) ); 304 noPlugins->setText( tr( "No plugins found" ) );
308 layout->addWidget( noPlugins ); 305 layout->addWidget( noPlugins );
309 return; 306 return;
310 } 307 }
311 308
312 uint count = 0; 309 uint count = 0;
313 TodayPlugin plugin; 310 TodayPlugin plugin;
314 for ( uint i = 0; i < pluginList.count(); i++ ) { 311 for ( uint i = 0; i < pluginList.count(); i++ ) {
315 plugin = pluginList[i]; 312 plugin = pluginList[i];
316 313
317 if ( plugin.active ) { 314 if ( plugin.active ) {
318 // qDebug( plugin.name + " is ACTIVE " ); 315 // qDebug( plugin.name + " is ACTIVE " );
319 plugin.guiBox->show(); 316 plugin.guiBox->show();
320 } else { 317 } else {
321 // qDebug( plugin.name + " is INACTIVE" ); 318 // qDebug( plugin.name + " is INACTIVE" );
322 plugin.guiBox->hide(); 319 plugin.guiBox->hide();
323 } 320 }
324 count++; 321 count++;
325 } 322 }
326 323
327 if ( count == 0 ) { 324 if ( count == 0 ) {
328 QLabel *noPluginsActive = new QLabel( this ); 325 QLabel *noPluginsActive = new QLabel( this );
329 noPluginsActive->setText( tr( "No plugins activated" ) ); 326 noPluginsActive->setText( tr( "No plugins activated" ) );
330 layout->addWidget( noPluginsActive ); 327 layout->addWidget( noPluginsActive );
331 } 328 }
332 repaint(); 329 repaint();
333} 330}
334 331
335 332
336/** 333/**
337 * The method for the configuration dialog. 334 * The method for the configuration dialog.
338 */ 335 */
339void Today::startConfig() { 336void Today::startConfig() {
340 337
341 // disconnect timer to prevent problems while being on config dialog 338 // disconnect timer to prevent problems while being on config dialog
342 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 339 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
343 m_refreshTimer->stop( ); 340 m_refreshTimer->stop( );
344 341
345 TodayConfig conf( this, "dialog", true ); 342 TodayConfig conf( this, "dialog", true );
346 343
347 TodayPlugin plugin; 344 TodayPlugin plugin;
348 QList<TodayConfigWidget> configWidgetList; 345 QList<TodayConfigWidget> configWidgetList;
349 346
350 for ( int i = pluginList.count() - 1; i >= 0; i-- ) { 347 for ( int i = pluginList.count() - 1; i >= 0; i-- ) {
351 plugin = pluginList[i]; 348 plugin = pluginList[i];
352 349
353 // load the config widgets in the tabs 350 // load the config widgets in the tabs
354 if ( plugin.guiPart->configWidget( this ) != 0l ) { 351 if ( plugin.guiPart->configWidget( this ) != 0l ) {
355 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 352 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
356 configWidgetList.append( widget ); 353 configWidgetList.append( widget );
357 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 354 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
358 , plugin.guiPart->appName() ); 355 , plugin.guiPart->appName() );
359 } 356 }
360 // set the order/activate tab 357 // set the order/activate tab
361 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 358 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
362 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 359 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
363 } 360 }
364 361
365 if ( conf.exec() == QDialog::Accepted ) { 362 if ( conf.exec() == QDialog::Accepted ) {
366 conf.writeConfig(); 363 conf.writeConfig();
367 TodayConfigWidget *confWidget; 364 TodayConfigWidget *confWidget;
368 for ( confWidget = configWidgetList.first(); confWidget != 0; 365 for ( confWidget = configWidgetList.first(); confWidget != 0;
369 confWidget = configWidgetList.next() ) { 366 confWidget = configWidgetList.next() ) {
370 confWidget->writeConfig(); 367 confWidget->writeConfig();
371 } 368 }
372 369
373 // make the plugins to reinitialize ( reread its configs ) 370 // make the plugins to reinitialize ( reread its configs )
374 reinitialize(); 371 reinitialize();
375 draw(); 372 draw();
376 373
377 } else { 374 } else {
378 // since refresh is not called in that case , reconnect the signal 375 // since refresh is not called in that case , reconnect the signal
379 m_refreshTimer->start( 15000 ); // get the config value in here later 376 m_refreshTimer->start( 15000 ); // get the config value in here later
380 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 377 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
381 } 378 }
382} 379}
383 380
384 381
385 382
386void Today::reinitialize() { 383void Today::reinitialize() {
387 384
388 Config cfg( "today" ); 385 Config cfg( "today" );
389 cfg.setGroup( "Plugins" ); 386 cfg.setGroup( "Plugins" );
390 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 387 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
391 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 388 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
392 389
393 /* reinitialize all plugins */ 390 /* reinitialize all plugins */
394 QValueList<TodayPlugin>::Iterator it; 391 QValueList<TodayPlugin>::Iterator it;
395 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 392 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
396 if ( !(*it).excludeRefresh ) { 393 if ( !(*it).excludeRefresh ) {
397 (*it).guiPart->reinitialize(); 394 (*it).guiPart->reinitialize();
398 qDebug( "reinit" ); 395 qDebug( "reinit" );
399 } 396 }
400 397
401 /* check if plugins is still to be shown */ 398 /* check if plugins is still to be shown */
402 if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) { 399 if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) {
403 (*it).active = true; 400 (*it).active = true;
404 } else { 401 } else {
405 (*it).active = false; 402 (*it).active = false;
406 } 403 }
407 404
408 } 405 }
409 406
410 cfg.setGroup( "General" ); 407 cfg.setGroup( "General" );
411 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 408 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
412 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); 409 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
413 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 410 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
414 411
415 // set the date in top label 412 // set the date in top label
416 QDate date = QDate::currentDate(); 413 QDate date = QDate::currentDate();
417 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); 414 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
418 415
419 if ( m_hideBanner ) { 416 if ( m_hideBanner ) {
420 Opiezilla->hide(); 417 Opiezilla->hide();
421 TodayLabel->hide(); 418 TodayLabel->hide();
422 } else { 419 } else {
423 Opiezilla->show(); 420 Opiezilla->show();
424 TodayLabel->show(); 421 TodayLabel->show();
425 } 422 }
426 423
427 delete m_bblayout; 424 delete m_bblayout;
428 m_bblayout = new QVBoxLayout( m_big_box ); 425 m_bblayout = new QVBoxLayout( m_big_box );
429 TodayPlugin tempPlugin; 426 TodayPlugin tempPlugin;
430 QStringList::Iterator stringit; 427 QStringList::Iterator stringit;
431 428
432 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 429 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
433 tempPlugin = ( tempList.find( *stringit ) ).data(); 430 tempPlugin = ( tempList.find( *stringit ) ).data();
434 if ( !( (tempPlugin.name).isEmpty() ) ) { 431 if ( !( (tempPlugin.name).isEmpty() ) ) {
435 m_bblayout->addWidget( tempPlugin.guiBox ); 432 m_bblayout->addWidget( tempPlugin.guiBox );
436 } 433 }
437 } 434 }
438 m_bblayout->addStretch( 2 ); 435 m_bblayout->addStretch( 2 );
439 436
440} 437}
441 438
442/** 439/**
443 * Refresh for the view. Reload all applets 440 * Refresh for the view. Reload all applets
444 * 441 *
445 */ 442 */
446void Today::refresh() { 443void Today::refresh() {
447 444
448 QValueList<TodayPlugin>::Iterator it; 445 QValueList<TodayPlugin>::Iterator it;
449 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 446 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
450 if ( !(*it).excludeRefresh ) { 447 if ( !(*it).excludeRefresh ) {
451 (*it).guiPart->refresh(); 448 (*it).guiPart->refresh();
452 qDebug( "refresh" ); 449 qDebug( "refresh" );
453 } 450 }
454 } 451 }
455 452
456 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); 453 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) );
457 454
458 updateGeometry(); 455 updateGeometry();
459 repaint(); 456 repaint();
460} 457}
461 458
462void Today::startApplication() { 459void Today::startApplication() {
463 QCopEnvelope e( "QPE/System", "execute(QString)" ); 460 QCopEnvelope e( "QPE/System", "execute(QString)" );
464 e << QString( sender()->name() ); 461 e << QString( sender()->name() );
465} 462}
466 463
467/** 464/**
468 * launch addressbook (personal card) 465 * launch addressbook (personal card)
469 */ 466 */
470void Today::editCard() { 467void Today::editCard() {
471 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); 468 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );
472} 469}
473 470
474Today::~Today() { 471Today::~Today() {
475} 472}
476 473
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp
index feb9a84..f2958ad 100644
--- a/core/pim/today/todaybase.cpp
+++ b/core/pim/today/todaybase.cpp
@@ -1,106 +1,105 @@
1/* 1/*
2 * todaybase.cpp 2 * todaybase.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todaybase.h" 17#include "todaybase.h"
18 18
19#include <qvbox.h> 19#include <qvbox.h>
20#include <qlabel.h>
21#include <qwhatsthis.h> 20#include <qwhatsthis.h>
22 21
23#include <qpe/resource.h> 22#include <qpe/resource.h>
24 23
25 24
26TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) 25TodayBase::TodayBase( QWidget* parent, const char* name, WFlags )
27 : QWidget( parent, name, WStyle_ContextHelp ) { 26 : QWidget( parent, name, WStyle_ContextHelp ) {
28 27
29 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo 28 QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo
30 QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla 29 QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla
31 QPixmap config = Resource::loadPixmap( "SettingsIcon" ); // config icon 30 QPixmap config = Resource::loadPixmap( "SettingsIcon" ); // config icon
32 31
33 layout = 0L; 32 layout = 0L;
34 33
35 QPalette pal = this->palette(); 34 QPalette pal = this->palette();
36 QColor col = pal.color( QPalette::Active, QColorGroup::Background ); 35 QColor col = pal.color( QPalette::Active, QColorGroup::Background );
37 pal.setColor( QPalette::Active, QColorGroup::Button, col ); 36 pal.setColor( QPalette::Active, QColorGroup::Button, col );
38 pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); 37 pal.setColor( QPalette::Inactive, QColorGroup::Button, col );
39 pal.setColor( QPalette::Normal, QColorGroup::Button, col ); 38 pal.setColor( QPalette::Normal, QColorGroup::Button, col );
40 pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); 39 pal.setColor( QPalette::Disabled, QColorGroup::Button, col );
41 this->setPalette( pal ); 40 this->setPalette( pal );
42 41
43 // --- logo Section --- 42 // --- logo Section ---
44 QPalette pal2; 43 QPalette pal2;
45 QColorGroup cg; 44 QColorGroup cg;
46 cg.setColor( QColorGroup::Text, white ); 45 cg.setColor( QColorGroup::Text, white );
47 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); 46 cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) );
48 pal2.setActive( cg ); 47 pal2.setActive( cg );
49 48
50// today logo 49// today logo
51 Frame = new QLabel( this, "Frame" ); 50 Frame = new QLabel( this, "Frame" );
52 Frame->setPalette( pal2 ); 51 Frame->setPalette( pal2 );
53 Frame->setFrameShape( QFrame::StyledPanel ); 52 Frame->setFrameShape( QFrame::StyledPanel );
54 Frame->setFrameShadow( QFrame::Raised ); 53 Frame->setFrameShadow( QFrame::Raised );
55 Frame->setLineWidth( 0 ); 54 Frame->setLineWidth( 0 );
56 55
57 QHBoxLayout *frameLayout = new QHBoxLayout( Frame ); 56 QHBoxLayout *frameLayout = new QHBoxLayout( Frame );
58 QVBox *box1 = new QVBox( Frame ); 57 QVBox *box1 = new QVBox( Frame );
59 58
60 // Today text 59 // Today text
61 TodayLabel = new QLabel( box1, "TodayText" ); 60 TodayLabel = new QLabel( box1, "TodayText" );
62 QFont TodayLabel_font( TodayLabel->font() ); 61 QFont TodayLabel_font( TodayLabel->font() );
63 TodayLabel_font.setBold( TRUE ); 62 TodayLabel_font.setBold( TRUE );
64 TodayLabel_font.setPointSize( 40 ); 63 TodayLabel_font.setPointSize( 40 );
65 TodayLabel->setFont( TodayLabel_font ); 64 TodayLabel->setFont( TodayLabel_font );
66 TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); 65 TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin );
67 TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); 66 TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" );
68 67
69 // date 68 // date
70 DateLabel = new QLabel( box1, "TextLabel1" ); 69 DateLabel = new QLabel( box1, "TextLabel1" );
71 QFont DateLabel_font( DateLabel->font() ); 70 QFont DateLabel_font( DateLabel->font() );
72 DateLabel_font.setBold( TRUE ); 71 DateLabel_font.setBold( TRUE );
73 DateLabel->setFont( DateLabel_font ); 72 DateLabel->setFont( DateLabel_font );
74 DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); 73 DateLabel->setBackgroundOrigin( QLabel::ParentOrigin );
75 DateLabel->setTextFormat( RichText ); 74 DateLabel->setTextFormat( RichText );
76 75
77 // Opiezilla 76 // Opiezilla
78 Opiezilla = new QLabel( Frame, "OpieZilla" ); 77 Opiezilla = new QLabel( Frame, "OpieZilla" );
79 Opiezilla->setPixmap( opiezilla ); 78 Opiezilla->setPixmap( opiezilla );
80 QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) ); 79 QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) );
81 Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); 80 Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin );
82 81
83 82
84 // Ownerfield 83 // Ownerfield
85 OwnerField = new OClickableLabel( this , "Owner" ); 84 OwnerField = new OClickableLabel( this , "Owner" );
86 OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); 85 OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) );
87 86
88 // config 87 // config
89 ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); 88 ConfigButton = new OClickableLabel ( Frame, "PushButton1" );
90 ConfigButton->setPixmap( config ); 89 ConfigButton->setPixmap( config );
91 QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); 90 QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) );
92 ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); 91 ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin );
93 92
94 frameLayout->addWidget( box1, 1 ); 93 frameLayout->addWidget( box1, 1 );
95 frameLayout->addStretch( 1 ); 94 frameLayout->addStretch( 1 );
96 frameLayout->addWidget( ConfigButton, 0, AlignBottom ); 95 frameLayout->addWidget( ConfigButton, 0, AlignBottom );
97 frameLayout->addWidget( Opiezilla ); 96 frameLayout->addWidget( Opiezilla );
98} 97}
99 98
100 99
101/** 100/**
102 * D' tor 101 * D' tor
103 */ 102 */
104TodayBase::~TodayBase() { 103TodayBase::~TodayBase() {
105} 104}
106 105
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index bfb5ec6..e71c5b0 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,232 +1,229 @@
1/* 1/*
2 * todayconfig.cpp 2 * todayconfig.cpp
3 * 3 *
4 * copyright : (c) 2002, 2003 by Maximilian Reiß 4 * copyright : (c) 2002, 2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17#include "todayconfig.h" 17#include "todayconfig.h"
18 18
19#include <qpe/config.h> 19#include <qpe/config.h>
20#include <qpe/resource.h> 20#include <qpe/resource.h>
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22 22
23#include <qcheckbox.h> 23#include <qcheckbox.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qspinbox.h> 25#include <qspinbox.h>
26#include <qtabwidget.h>
27#include <qlayout.h> 26#include <qlayout.h>
28#include <qheader.h> 27#include <qheader.h>
29#include <qhbox.h>
30#include <qvbox.h> 28#include <qvbox.h>
31#include <qtoolbutton.h> 29#include <qtoolbutton.h>
32#include <qtooltip.h>
33#include <qwhatsthis.h> 30#include <qwhatsthis.h>
34 31
35class ToolButton : public QToolButton { 32class ToolButton : public QToolButton {
36 33
37public: 34public:
38 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 35 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
39 : QToolButton( parent, name ) { 36 : QToolButton( parent, name ) {
40 setPixmap( Resource::loadPixmap( icon ) ); 37 setPixmap( Resource::loadPixmap( icon ) );
41 setAutoRaise( TRUE ); 38 setAutoRaise( TRUE );
42 setFocusPolicy( QWidget::NoFocus ); 39 setFocusPolicy( QWidget::NoFocus );
43 setToggleButton( t ); 40 setToggleButton( t );
44 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 41 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
45 } 42 }
46}; 43};
47 44
48 45
49/** 46/**
50 * The class has currently quite some duplicate code. 47 * The class has currently quite some duplicate code.
51 * By that way it would be real easy to have it as seperate app in settings tab 48 * By that way it would be real easy to have it as seperate app in settings tab
52 * 49 *
53 */ 50 */
54TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) 51TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
55 : QDialog( parent, name, modal, WStyle_ContextHelp ) { 52 : QDialog( parent, name, modal, WStyle_ContextHelp ) {
56 53
57 setCaption( tr( "Today Config" ) ); 54 setCaption( tr( "Today Config" ) );
58 55
59 QVBoxLayout *layout = new QVBoxLayout( this ); 56 QVBoxLayout *layout = new QVBoxLayout( this );
60 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); 57 TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
61 layout->addWidget( TabWidget3 ); 58 layout->addWidget( TabWidget3 );
62 59
63 tab_2 = new QWidget( TabWidget3, "tab_2" ); 60 tab_2 = new QWidget( TabWidget3, "tab_2" );
64 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); 61 QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 );
65 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); 62 QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 );
66 tab2Layout->addWidget( l ); 63 tab2Layout->addWidget( l );
67 QHBox *hbox1 = new QHBox( tab_2 ); 64 QHBox *hbox1 = new QHBox( tab_2 );
68 m_appletListView = new QListView( hbox1 ); 65 m_appletListView = new QListView( hbox1 );
69 m_appletListView->addColumn( "PluginList" ); 66 m_appletListView->addColumn( "PluginList" );
70 m_appletListView->header()->hide(); 67 m_appletListView->header()->hide();
71 m_appletListView->setSorting( -1 ); 68 m_appletListView->setSorting( -1 );
72 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); 69 QWhatsThis::add( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) );
73 QVBox *vbox1 = new QVBox( hbox1 ); 70 QVBox *vbox1 = new QVBox( hbox1 );
74 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); 71 new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) );
75 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); 72 new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) );
76 tab2Layout->addWidget( hbox1 ); 73 tab2Layout->addWidget( hbox1 );
77 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); 74 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) );
78 75
79 // Misc tab 76 // Misc tab
80 tab_3 = new QWidget( TabWidget3, "tab_3" ); 77 tab_3 = new QWidget( TabWidget3, "tab_3" );
81 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 78 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
82 79
83 m_guiMisc = new TodayConfigMiscBase( tab_3 ); 80 m_guiMisc = new TodayConfigMiscBase( tab_3 );
84 81
85 tab3Layout->addWidget( m_guiMisc ); 82 tab3Layout->addWidget( m_guiMisc );
86 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 83 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
87 84
88 m_applets_changed = false; 85 m_applets_changed = false;
89 86
90 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); 87 connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) );
91 88
92 readConfig(); 89 readConfig();
93 showMaximized(); 90 showMaximized();
94} 91}
95 92
96 93
97/** 94/**
98 * Autostart, uses the new (opie only) autostart method in the launcher code. 95 * Autostart, uses the new (opie only) autostart method in the launcher code.
99 * If registered against that today ist started on each resume. 96 * If registered against that today ist started on each resume.
100 */ 97 */
101void TodayConfig::setAutoStart() { 98void TodayConfig::setAutoStart() {
102 Config cfg( "today" ); 99 Config cfg( "today" );
103 cfg.setGroup( "Autostart" ); 100 cfg.setGroup( "Autostart" );
104 if ( m_autoStart ) { 101 if ( m_autoStart ) {
105 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); 102 QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" );
106 e << QString( "add" ); 103 e << QString( "add" );
107 e << QString( "today" ); 104 e << QString( "today" );
108 e << QString( "%1" ).arg( m_autoStartTimer ); 105 e << QString( "%1" ).arg( m_autoStartTimer );
109 } else { 106 } else {
110 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" ); 107 QCopEnvelope e( "QPE/System", "autoStart(QString,QString)" );
111 e << QString( "remove" ); 108 e << QString( "remove" );
112 e << QString( "today" ); 109 e << QString( "today" );
113 } 110 }
114} 111}
115 112
116/** 113/**
117 * Read the config part 114 * Read the config part
118 */ 115 */
119void TodayConfig::readConfig() { 116void TodayConfig::readConfig() {
120 Config cfg( "today" ); 117 Config cfg( "today" );
121 cfg.setGroup( "Autostart" ); 118 cfg.setGroup( "Autostart" );
122 m_autoStart = cfg.readNumEntry( "autostart", 1 ); 119 m_autoStart = cfg.readNumEntry( "autostart", 1 );
123 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); 120 m_guiMisc->CheckBoxAuto->setChecked( m_autoStart );
124 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); 121 m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 );
125 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); 122 m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer );
126 123
127 cfg.setGroup( "General" ); 124 cfg.setGroup( "General" );
128 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 125 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
129 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); 126 m_guiMisc->SpinBoxIconSize->setValue( m_iconSize );
130 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); 127 m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 );
131 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); 128 m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) );
132 129
133 130
134 cfg.setGroup( "Plugins" ); 131 cfg.setGroup( "Plugins" );
135 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 132 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
136} 133}
137 134
138/** 135/**
139 * Write the config part 136 * Write the config part
140 */ 137 */
141void TodayConfig::writeConfig() { 138void TodayConfig::writeConfig() {
142 Config cfg( "today" ); 139 Config cfg( "today" );
143 cfg.setGroup( "Plugins" ); 140 cfg.setGroup( "Plugins" );
144 if ( m_applets_changed ) { 141 if ( m_applets_changed ) {
145 QStringList exclude; 142 QStringList exclude;
146 QStringList include; 143 QStringList include;
147 QStringList all_applets; 144 QStringList all_applets;
148 145
149 QListViewItemIterator list_it( m_appletListView ); 146 QListViewItemIterator list_it( m_appletListView );
150 147
151 // this makes sure the names get saved in the order selected 148 // this makes sure the names get saved in the order selected
152 for ( ; list_it.current(); ++list_it ) { 149 for ( ; list_it.current(); ++list_it ) {
153 QMap <QString, QCheckListItem *>::Iterator it; 150 QMap <QString, QCheckListItem *>::Iterator it;
154 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) { 151 for ( it = m_applets.begin(); it != m_applets. end (); ++it ) {
155 if ( list_it.current() == (*it) && !(*it)-> isOn () ) { 152 if ( list_it.current() == (*it) && !(*it)-> isOn () ) {
156 exclude << it.key(); 153 exclude << it.key();
157 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){ 154 } else if ( list_it.current() == (*it) && (*it)-> isOn () ){
158 include << it.key(); 155 include << it.key();
159 } 156 }
160 if ( list_it.current() == (*it) ) { 157 if ( list_it.current() == (*it) ) {
161 all_applets << it.key(); 158 all_applets << it.key();
162 } 159 }
163 } 160 }
164 } 161 }
165 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 162 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
166 cfg.writeEntry( "IncludeApplets", include, ',' ); 163 cfg.writeEntry( "IncludeApplets", include, ',' );
167 cfg.writeEntry( "AllApplets", all_applets, ',' ); 164 cfg.writeEntry( "AllApplets", all_applets, ',' );
168 } 165 }
169 166
170 cfg.setGroup( "Autostart" ); 167 cfg.setGroup( "Autostart" );
171 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); 168 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked();
172 cfg.writeEntry( "autostart", m_autoStart ); 169 cfg.writeEntry( "autostart", m_autoStart );
173 m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); 170 m_autoStartTimer = m_guiMisc->SpinBoxTime->value();
174 cfg.writeEntry( "autostartdelay", m_autoStartTimer ); 171 cfg.writeEntry( "autostartdelay", m_autoStartTimer );
175 m_iconSize = m_guiMisc->SpinBoxIconSize->value(); 172 m_iconSize = m_guiMisc->SpinBoxIconSize->value();
176 173
177 cfg.setGroup( "General" ); 174 cfg.setGroup( "General" );
178 cfg.writeEntry( "IconSize", m_iconSize ); 175 cfg.writeEntry( "IconSize", m_iconSize );
179 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); 176 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() );
180 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); 177 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 );
181 178
182 // set autostart settings 179 // set autostart settings
183 setAutoStart(); 180 setAutoStart();
184} 181}
185 182
186 183
187void TodayConfig::moveSelectedUp() { 184void TodayConfig::moveSelectedUp() {
188 QListViewItem *item = m_appletListView->selectedItem(); 185 QListViewItem *item = m_appletListView->selectedItem();
189 if ( item && item->itemAbove() ) { 186 if ( item && item->itemAbove() ) {
190 item->itemAbove()->moveItem( item ); 187 item->itemAbove()->moveItem( item );
191 } 188 }
192} 189}
193 190
194 191
195void TodayConfig::moveSelectedDown() { 192void TodayConfig::moveSelectedDown() {
196 QListViewItem *item = m_appletListView->selectedItem(); 193 QListViewItem *item = m_appletListView->selectedItem();
197 if ( item && item->itemBelow() ) { 194 if ( item && item->itemBelow() ) {
198 item->moveItem( item->itemBelow() ); 195 item->moveItem( item->itemBelow() );
199 } 196 }
200} 197}
201 198
202 199
203/** 200/**
204 * Set up the icons in the order/active tab 201 * Set up the icons in the order/active tab
205 */ 202 */
206void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) { 203void TodayConfig::pluginManagement( QString libName, QString name, QPixmap icon ) {
207 204
208 QCheckListItem *item; 205 QCheckListItem *item;
209 item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox ); 206 item = new QCheckListItem( m_appletListView, name, QCheckListItem::CheckBox );
210 207
211 if ( !icon.isNull() ) { 208 if ( !icon.isNull() ) {
212 item->setPixmap( 0, icon ); 209 item->setPixmap( 0, icon );
213 } 210 }
214 211
215 if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) { 212 if ( m_excludeApplets.find( libName ) == m_excludeApplets.end() ) {
216 item->setOn( TRUE ); 213 item->setOn( TRUE );
217 } 214 }
218 215
219 m_applets[libName] = item; 216 m_applets[libName] = item;
220 217
221 // kind of hack to get the first tab as default. 218 // kind of hack to get the first tab as default.
222 TabWidget3->setCurrentTab( tab_2 ); 219 TabWidget3->setCurrentTab( tab_2 );
223} 220}
224 221
225void TodayConfig::appletChanged() { 222void TodayConfig::appletChanged() {
226 m_applets_changed = true; 223 m_applets_changed = true;
227} 224}
228 225
229 226
230TodayConfig::~TodayConfig() { 227TodayConfig::~TodayConfig() {
231} 228}
232 229