author | gints <gints> | 2005-05-13 17:30:15 (UTC) |
---|---|---|
committer | gints <gints> | 2005-05-13 17:30:15 (UTC) |
commit | 4451abf402aa1dd967ef8b70a7eba1192f13afb0 (patch) (unidiff) | |
tree | 985405c7a3fe121103114eaebf3f87603894672d | |
parent | b010c50f099d197c0a89755eeef4dc1e40559a83 (diff) | |
download | opie-4451abf402aa1dd967ef8b70a7eba1192f13afb0.zip opie-4451abf402aa1dd967ef8b70a7eba1192f13afb0.tar.gz opie-4451abf402aa1dd967ef8b70a7eba1192f13afb0.tar.bz2 |
Remove latinism in today owner information - bug 1655
-rw-r--r-- | core/pim/today/today.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 67b23e1..450ecb7 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,329 +1,333 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "today.h" | 31 | #include "today.h" |
32 | 32 | ||
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | #include <opie2/opluginloader.h> | 34 | #include <opie2/opluginloader.h> |
35 | #include <opie2/opimcontact.h> | ||
36 | #include <opie2/ocontactaccessbackend_vcard.h> | ||
37 | #include <opie2/ocontactaccess.h> | ||
35 | #include <opie2/oconfig.h> | 38 | #include <opie2/oconfig.h> |
36 | #include <opie2/oresource.h> | 39 | #include <opie2/oresource.h> |
37 | 40 | ||
38 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
39 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
40 | #include <qpe/contact.h> | ||
41 | 43 | ||
42 | #include <qdir.h> | 44 | #include <qdir.h> |
43 | #include <qtimer.h> | 45 | #include <qtimer.h> |
44 | #include <qwhatsthis.h> | 46 | #include <qwhatsthis.h> |
45 | #include <qmessagebox.h> | 47 | #include <qmessagebox.h> |
46 | 48 | ||
47 | using namespace Opie::Ui; | 49 | using namespace Opie::Ui; |
48 | using Opie::Core::OPluginItem; | 50 | using Opie::Core::OPluginItem; |
49 | using Opie::Core::OPluginLoader; | 51 | using Opie::Core::OPluginLoader; |
50 | using Opie::Core::OPluginManager; | 52 | using Opie::Core::OPluginManager; |
51 | using Opie::Core::OConfig; | 53 | using Opie::Core::OConfig; |
52 | 54 | ||
53 | 55 | ||
54 | struct TodayPlugin { | 56 | struct TodayPlugin { |
55 | TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 57 | TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} |
56 | QInterfacePtr<TodayPluginInterface> iface; | 58 | QInterfacePtr<TodayPluginInterface> iface; |
57 | TodayPluginObject *guiPart; | 59 | TodayPluginObject *guiPart; |
58 | OPluginItem oplugin; | 60 | OPluginItem oplugin; |
59 | QWidget *guiBox; | 61 | QWidget *guiBox; |
60 | QString name; | 62 | QString name; |
61 | bool excludeRefresh; | 63 | bool excludeRefresh; |
62 | }; | 64 | }; |
63 | 65 | ||
64 | static QMap<QString, TodayPlugin> pluginList; | 66 | static QMap<QString, TodayPlugin> pluginList; |
65 | 67 | ||
66 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 68 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
67 | : TodayBase( parent, name, fl | WStyle_ContextHelp) { | 69 | : TodayBase( parent, name, fl | WStyle_ContextHelp) { |
68 | 70 | ||
69 | setCaption( tr("Today") ); | 71 | setCaption( tr("Today") ); |
70 | connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 72 | connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
71 | connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 73 | connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
72 | 74 | ||
73 | #if !defined(QT_NO_COP) | 75 | #if !defined(QT_NO_COP) |
74 | 76 | ||
75 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 77 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
76 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 78 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
77 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); | 79 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); |
78 | #endif | 80 | #endif |
79 | 81 | ||
80 | setOwnerField(); | 82 | setOwnerField(); |
81 | m_big_box = 0l; | 83 | m_big_box = 0l; |
82 | m_bblayout = 0l; | 84 | m_bblayout = 0l; |
83 | 85 | ||
84 | layout = new QVBoxLayout( this ); | 86 | layout = new QVBoxLayout( this ); |
85 | layout->addWidget( Frame ); | 87 | layout->addWidget( Frame ); |
86 | layout->addWidget( OwnerField ); | 88 | layout->addWidget( OwnerField ); |
87 | 89 | ||
88 | 90 | ||
89 | m_informationLabel = new QLabel( tr("No plugins activated"), this ); | 91 | m_informationLabel = new QLabel( tr("No plugins activated"), this ); |
90 | layout->addWidget( m_informationLabel ); | 92 | layout->addWidget( m_informationLabel ); |
91 | 93 | ||
92 | m_sv = new QScrollView( this ); | 94 | m_sv = new QScrollView( this ); |
93 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); | 95 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); |
94 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 96 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
95 | m_sv->setFrameShape( QFrame::NoFrame ); | 97 | m_sv->setFrameShape( QFrame::NoFrame ); |
96 | 98 | ||
97 | layout->addWidget( m_sv ); | 99 | layout->addWidget( m_sv ); |
98 | layout->setStretchFactor( m_sv,4 ); | 100 | layout->setStretchFactor( m_sv,4 ); |
99 | 101 | ||
100 | m_refreshTimer = new QTimer( this ); | 102 | m_refreshTimer = new QTimer( this ); |
101 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 103 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
102 | 104 | ||
103 | loadPlugins(); | 105 | loadPlugins(); |
104 | loadShellContent(); | 106 | loadShellContent(); |
105 | loadPluginWidgets(); | 107 | loadPluginWidgets(); |
106 | } | 108 | } |
107 | 109 | ||
108 | /** | 110 | /** |
109 | * Qcop receive method. | 111 | * Qcop receive method. |
110 | */ | 112 | */ |
111 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 113 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
112 | QDataStream stream( data, IO_ReadOnly ); | 114 | QDataStream stream( data, IO_ReadOnly ); |
113 | if ( msg == "message(QString)" ) { | 115 | if ( msg == "message(QString)" ) { |
114 | QString message; | 116 | QString message; |
115 | stream >> message; | 117 | stream >> message; |
116 | setOwnerField( message ); | 118 | setOwnerField( message ); |
117 | } | 119 | } |
118 | } | 120 | } |
119 | 121 | ||
120 | void Today::setRefreshTimer( int interval ) { | 122 | void Today::setRefreshTimer( int interval ) { |
121 | 123 | ||
122 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 124 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
123 | // 0 is "never" case | 125 | // 0 is "never" case |
124 | if ( !interval == 0 ) { | 126 | if ( !interval == 0 ) { |
125 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 127 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
126 | m_refreshTimer->changeInterval( interval ); | 128 | m_refreshTimer->changeInterval( interval ); |
127 | } | 129 | } |
128 | } | 130 | } |
129 | 131 | ||
130 | 132 | ||
131 | /** | 133 | /** |
132 | * Initialises the owner field with the default value, the username | 134 | * Initialises the owner field with the default value, the username |
133 | */ | 135 | */ |
134 | void Today::setOwnerField() { | 136 | void Today::setOwnerField() { |
135 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 137 | QString vfilename = Global::applicationFileName("addressbook", "businesscard.vcf"); |
136 | if ( QFile::exists( file ) ) { | 138 | Opie::OPimContactAccess acc( "today", vfilename, |
137 | Contact cont = Contact::readVCard( file )[0]; | 139 | new Opie::OPimContactAccessBackend_VCard("today", vfilename ) ); |
140 | if ( acc.load() ) { | ||
141 | Opie::OPimContact cont = acc.allRecords()[0]; | ||
138 | QString returnString = cont.fullName(); | 142 | QString returnString = cont.fullName(); |
139 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 143 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
140 | } else { | 144 | } else { |
141 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 145 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
142 | } | 146 | } |
143 | } | 147 | } |
144 | 148 | ||
145 | /** | 149 | /** |
146 | * Set the owner field with a given QString, for example per qcop. | 150 | * Set the owner field with a given QString, for example per qcop. |
147 | */ | 151 | */ |
148 | void Today::setOwnerField( QString &message ) { | 152 | void Today::setOwnerField( QString &message ) { |
149 | if ( !message.isEmpty() ) { | 153 | if ( !message.isEmpty() ) { |
150 | OwnerField->setText( "<b>" + message + "</b>" ); | 154 | OwnerField->setText( "<b>" + message + "</b>" ); |
151 | } | 155 | } |
152 | } | 156 | } |
153 | 157 | ||
154 | 158 | ||
155 | /** | 159 | /** |
156 | * Load the plugins | 160 | * Load the plugins |
157 | */ | 161 | */ |
158 | void Today::loadPlugins() { | 162 | void Today::loadPlugins() { |
159 | m_pluginLoader = new OPluginLoader( "today", true ); | 163 | m_pluginLoader = new OPluginLoader( "today", true ); |
160 | m_pluginLoader->setAutoDelete( true ); | 164 | m_pluginLoader->setAutoDelete( true ); |
161 | 165 | ||
162 | m_manager = new OPluginManager( m_pluginLoader ); | 166 | m_manager = new OPluginManager( m_pluginLoader ); |
163 | m_manager->load(); | 167 | m_manager->load(); |
164 | } | 168 | } |
165 | 169 | ||
166 | void Today::loadShellContent() { | 170 | void Today::loadShellContent() { |
167 | Config cfg( "today" ); | 171 | Config cfg( "today" ); |
168 | cfg.setGroup( "Plugins" ); | 172 | cfg.setGroup( "Plugins" ); |
169 | 173 | ||
170 | 174 | ||
171 | cfg.setGroup( "General" ); | 175 | cfg.setGroup( "General" ); |
172 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 176 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
173 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); | 177 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); |
174 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 178 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
175 | 179 | ||
176 | // set the date in top label | 180 | // set the date in top label |
177 | QDate date = QDate::currentDate(); | 181 | QDate date = QDate::currentDate(); |
178 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); | 182 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); |
179 | 183 | ||
180 | if ( m_hideBanner ) { | 184 | if ( m_hideBanner ) { |
181 | Opiezilla->hide(); | 185 | Opiezilla->hide(); |
182 | TodayLabel->hide(); | 186 | TodayLabel->hide(); |
183 | } else { | 187 | } else { |
184 | Opiezilla->show(); | 188 | Opiezilla->show(); |
185 | TodayLabel->show(); | 189 | TodayLabel->show(); |
186 | } | 190 | } |
187 | } | 191 | } |
188 | 192 | ||
189 | void Today::loadPluginWidgets() { | 193 | void Today::loadPluginWidgets() { |
190 | /* | 194 | /* |
191 | * check if loading of Plugins crashed | 195 | * check if loading of Plugins crashed |
192 | */ | 196 | */ |
193 | if( m_pluginLoader->isInSafeMode() ) { | 197 | if( m_pluginLoader->isInSafeMode() ) { |
194 | QMessageBox::information(this, tr("Today Error"), | 198 | QMessageBox::information(this, tr("Today Error"), |
195 | tr("<qt>The plugin '%1' caused Today to crash." | 199 | tr("<qt>The plugin '%1' caused Today to crash." |
196 | " It could be that the plugin is not properly" | 200 | " It could be that the plugin is not properly" |
197 | " installed.<br>Today tries to continue loading" | 201 | " installed.<br>Today tries to continue loading" |
198 | " plugins.</qt>") | 202 | " plugins.</qt>") |
199 | .arg( m_manager->crashedPlugin().name())); | 203 | .arg( m_manager->crashedPlugin().name())); |
200 | } | 204 | } |
201 | 205 | ||
202 | OPluginItem::List lst = m_pluginLoader->filtered( true ); | 206 | OPluginItem::List lst = m_pluginLoader->filtered( true ); |
203 | 207 | ||
204 | /* | 208 | /* |
205 | * Show or Hide the information of no plugin installed | 209 | * Show or Hide the information of no plugin installed |
206 | */ | 210 | */ |
207 | if ( lst.isEmpty() ) | 211 | if ( lst.isEmpty() ) |
208 | m_informationLabel->show(); | 212 | m_informationLabel->show(); |
209 | else | 213 | else |
210 | m_informationLabel->hide(); | 214 | m_informationLabel->hide(); |
211 | 215 | ||
212 | 216 | ||
213 | /* | 217 | /* |
214 | * Now let us add the plugins | 218 | * Now let us add the plugins |
215 | */ | 219 | */ |
216 | m_big_box = new QWidget( m_sv->viewport() ); | 220 | m_big_box = new QWidget( m_sv->viewport() ); |
217 | m_sv->addChild( m_big_box ); | 221 | m_sv->addChild( m_big_box ); |
218 | m_bblayout = new QVBoxLayout( m_big_box ); | 222 | m_bblayout = new QVBoxLayout( m_big_box ); |
219 | 223 | ||
220 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 224 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
221 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | 225 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
222 | 226 | ||
223 | TodayPlugin plugin; | 227 | TodayPlugin plugin; |
224 | plugin.iface = iface; | 228 | plugin.iface = iface; |
225 | plugin.name = (*it).name(); | 229 | plugin.name = (*it).name(); |
226 | plugin.oplugin = (*it); | 230 | plugin.oplugin = (*it); |
227 | 231 | ||
228 | plugin.guiPart = plugin.iface->guiPart(); | 232 | plugin.guiPart = plugin.iface->guiPart(); |
229 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 233 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
230 | 234 | ||
231 | // package the whole thing into a qwidget so it can be shown and hidden | 235 | // package the whole thing into a qwidget so it can be shown and hidden |
232 | plugin.guiBox = new QWidget( m_big_box ); | 236 | plugin.guiBox = new QWidget( m_big_box ); |
233 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 237 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
234 | QPixmap plugPix; | 238 | QPixmap plugPix; |
235 | plugPix.convertFromImage( Opie::Core::OResource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 239 | plugPix.convertFromImage( Opie::Core::OResource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
236 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 240 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
237 | plugIcon->setPixmap( plugPix ); | 241 | plugIcon->setPixmap( plugPix ); |
238 | QWhatsThis::add | 242 | QWhatsThis::add |
239 | ( plugIcon, tr("Click here to launch the associated app") ); | 243 | ( plugIcon, tr("Click here to launch the associated app") ); |
240 | plugIcon->setName( plugin.guiPart->appName() ); | 244 | plugIcon->setName( plugin.guiPart->appName() ); |
241 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 245 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
242 | 246 | ||
243 | QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); | 247 | QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); |
244 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 248 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
245 | boxLayout->addWidget( plugWidget, 0, AlignTop ); | 249 | boxLayout->addWidget( plugWidget, 0, AlignTop ); |
246 | boxLayout->setStretchFactor( plugIcon, 1 ); | 250 | boxLayout->setStretchFactor( plugIcon, 1 ); |
247 | boxLayout->setStretchFactor( plugWidget, 9 ); | 251 | boxLayout->setStretchFactor( plugWidget, 9 ); |
248 | 252 | ||
249 | pluginList.insert( plugin.name, plugin ); | 253 | pluginList.insert( plugin.name, plugin ); |
250 | m_bblayout->addWidget(plugin.guiBox); | 254 | m_bblayout->addWidget(plugin.guiBox); |
251 | } | 255 | } |
252 | 256 | ||
253 | m_bblayout->addStretch( 1 ); | 257 | m_bblayout->addStretch( 1 ); |
254 | m_big_box->show(); | 258 | m_big_box->show(); |
255 | } | 259 | } |
256 | 260 | ||
257 | 261 | ||
258 | /** | 262 | /** |
259 | * The method for the configuration dialog. | 263 | * The method for the configuration dialog. |
260 | */ | 264 | */ |
261 | void Today::startConfig() { | 265 | void Today::startConfig() { |
262 | // disconnect timer to prevent problems while being on config dialog | 266 | // disconnect timer to prevent problems while being on config dialog |
263 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 267 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
264 | m_refreshTimer->stop( ); | 268 | m_refreshTimer->stop( ); |
265 | 269 | ||
266 | TodayConfig conf( this, "dialog", true ); | 270 | TodayConfig conf( this, "dialog", true ); |
267 | conf.setUpPlugins( m_manager, m_pluginLoader ); | 271 | conf.setUpPlugins( m_manager, m_pluginLoader ); |
268 | 272 | ||
269 | if ( QPEApplication::execDialog(&conf) == QDialog::Accepted ) { | 273 | if ( QPEApplication::execDialog(&conf) == QDialog::Accepted ) { |
270 | conf.writeConfig(); | 274 | conf.writeConfig(); |
271 | clearPluginWidgets(); | 275 | clearPluginWidgets(); |
272 | loadShellContent(); | 276 | loadShellContent(); |
273 | loadPluginWidgets(); | 277 | loadPluginWidgets(); |
274 | } else { | 278 | } else { |
275 | // since reinitialize is not called in that case , reconnect the signal | 279 | // since reinitialize is not called in that case , reconnect the signal |
276 | m_refreshTimer->start( 15000 ); // get the config value in here later | 280 | m_refreshTimer->start( 15000 ); // get the config value in here later |
277 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 281 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
278 | } | 282 | } |
279 | } | 283 | } |
280 | 284 | ||
281 | /** | 285 | /** |
282 | * Refresh for the view. Reload all applets | 286 | * Refresh for the view. Reload all applets |
283 | * | 287 | * |
284 | */ | 288 | */ |
285 | void Today::refresh() { | 289 | void Today::refresh() { |
286 | for ( QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); | 290 | for ( QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); |
287 | it != pluginList.end(); ++it ) | 291 | it != pluginList.end(); ++it ) |
288 | it.data().guiPart->refresh(); | 292 | it.data().guiPart->refresh(); |
289 | 293 | ||
290 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); | 294 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); |
291 | 295 | ||
292 | updateGeometry(); | 296 | updateGeometry(); |
293 | repaint(); | 297 | repaint(); |
294 | } | 298 | } |
295 | 299 | ||
296 | 300 | ||
297 | void Today::startApplication() { | 301 | void Today::startApplication() { |
298 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 302 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
299 | e << QString( sender()->name() ); | 303 | e << QString( sender()->name() ); |
300 | } | 304 | } |
301 | 305 | ||
302 | 306 | ||
303 | /** | 307 | /** |
304 | * launch addressbook (personal card) | 308 | * launch addressbook (personal card) |
305 | */ | 309 | */ |
306 | void Today::editCard() { | 310 | void Today::editCard() { |
307 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); | 311 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); |
308 | } | 312 | } |
309 | 313 | ||
310 | 314 | ||
311 | Today::~Today() { | 315 | Today::~Today() { |
312 | clearPluginWidgets(); | 316 | clearPluginWidgets(); |
313 | delete m_pluginLoader; | 317 | delete m_pluginLoader; |
314 | delete m_manager; | 318 | delete m_manager; |
315 | } | 319 | } |
316 | 320 | ||
317 | 321 | ||
318 | void Today::clearPluginWidgets() { | 322 | void Today::clearPluginWidgets() { |
319 | for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it ) { | 323 | for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it ) { |
320 | delete it.data().guiBox; | 324 | delete it.data().guiBox; |
321 | it.data().guiBox = 0; | 325 | it.data().guiBox = 0; |
322 | } | 326 | } |
323 | 327 | ||
324 | pluginList.clear(); | 328 | pluginList.clear(); |
325 | 329 | ||
326 | delete m_bblayout; | 330 | delete m_bblayout; |
327 | delete m_big_box; | 331 | delete m_big_box; |
328 | m_bblayout = 0; | 332 | m_bblayout = 0; |
329 | m_big_box = 0; | 333 | m_big_box = 0; |