author | drw <drw> | 2005-04-06 22:25:21 (UTC) |
---|---|---|
committer | drw <drw> | 2005-04-06 22:25:21 (UTC) |
commit | cd1b15147d372d8786c855764d397553651c358d (patch) (unidiff) | |
tree | 643479f1a84698f79227d7c8243921eacc3fe818 | |
parent | 678c792dd69e42a15d8ac5eaaa9228dfd413ed4c (diff) | |
download | opie-cd1b15147d372d8786c855764d397553651c358d.zip opie-cd1b15147d372d8786c855764d397553651c358d.tar.gz opie-cd1b15147d372d8786c855764d397553651c358d.tar.bz2 |
Use OResource for loading images and fix headers
-rw-r--r-- | core/pim/today/main.cpp | 45 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 46 | ||||
-rw-r--r-- | core/pim/today/today.h | 43 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 54 | ||||
-rw-r--r-- | core/pim/today/todaybase.h | 42 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 49 | ||||
-rw-r--r-- | core/pim/today/todayconfig.h | 42 |
7 files changed, 209 insertions, 112 deletions
diff --git a/core/pim/today/main.cpp b/core/pim/today/main.cpp index d63bc30..44b845c 100644 --- a/core/pim/today/main.cpp +++ b/core/pim/today/main.cpp | |||
@@ -1,25 +1,36 @@ | |||
1 | /* | 1 | /* |
2 | * main.cpp | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * --------------------- | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * | 5 | =. |
6 | * begin : Sun 10 17:20:00 CEST 2002 | 6 | .=l. |
7 | * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß | 7 | Â Â Â Â Â Â .>+-= |
8 | * email : max.reiss@gmx.de | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | */ | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | /*************************************************************************** | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * This program is free software; you can redistribute it and/or modify * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * it under the terms of the GNU General Public License as published by * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | * (at your option) any later version. * | 16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; |
17 | * * | 17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of |
18 | ***************************************************************************/ | 18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
19 | 30 | ||
20 | #include "today.h" | 31 | #include "today.h" |
21 | 32 | ||
22 | #include <opie2/oapplicationfactory.h> | 33 | #include <opie2/oapplicationfactory.h> |
23 | 34 | ||
24 | using namespace Opie::Core; | 35 | using namespace Opie::Core; |
25 | OPIE_EXPORT_APP( OApplicationFactory<Today> ) | 36 | OPIE_EXPORT_APP( OApplicationFactory<Today> ) |
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 3e895a4..67b23e1 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,120 +1,134 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * copyright : (c) 2002,2003,2004 by Maximilian Reiß | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * email : harlekin@handhelds.org | 5 | =. |
6 | * | 6 | .=l. |
7 | */ | 7 | Â Â Â Â Â Â .>+-= |
8 | /*************************************************************************** | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | * it under the terms of the GNU General Public License as published by * | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * (at your option) any later version. * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | ***************************************************************************/ | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
16 | 30 | ||
17 | #include "today.h" | 31 | #include "today.h" |
18 | 32 | ||
19 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
20 | #include <opie2/opluginloader.h> | 34 | #include <opie2/opluginloader.h> |
21 | #include <opie2/oconfig.h> | 35 | #include <opie2/oconfig.h> |
36 | #include <opie2/oresource.h> | ||
22 | 37 | ||
23 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
24 | #include <qpe/resource.h> | ||
25 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/contact.h> | 40 | #include <qpe/contact.h> |
27 | 41 | ||
28 | #include <qdir.h> | 42 | #include <qdir.h> |
29 | #include <qtimer.h> | 43 | #include <qtimer.h> |
30 | #include <qwhatsthis.h> | 44 | #include <qwhatsthis.h> |
31 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
32 | 46 | ||
33 | using namespace Opie::Ui; | 47 | using namespace Opie::Ui; |
34 | using Opie::Core::OPluginItem; | 48 | using Opie::Core::OPluginItem; |
35 | using Opie::Core::OPluginLoader; | 49 | using Opie::Core::OPluginLoader; |
36 | using Opie::Core::OPluginManager; | 50 | using Opie::Core::OPluginManager; |
37 | using Opie::Core::OConfig; | 51 | using Opie::Core::OConfig; |
38 | 52 | ||
39 | 53 | ||
40 | struct TodayPlugin { | 54 | struct TodayPlugin { |
41 | TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 55 | TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} |
42 | QInterfacePtr<TodayPluginInterface> iface; | 56 | QInterfacePtr<TodayPluginInterface> iface; |
43 | TodayPluginObject *guiPart; | 57 | TodayPluginObject *guiPart; |
44 | OPluginItem oplugin; | 58 | OPluginItem oplugin; |
45 | QWidget *guiBox; | 59 | QWidget *guiBox; |
46 | QString name; | 60 | QString name; |
47 | bool excludeRefresh; | 61 | bool excludeRefresh; |
48 | }; | 62 | }; |
49 | 63 | ||
50 | static QMap<QString, TodayPlugin> pluginList; | 64 | static QMap<QString, TodayPlugin> pluginList; |
51 | 65 | ||
52 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 66 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
53 | : TodayBase( parent, name, fl | WStyle_ContextHelp) { | 67 | : TodayBase( parent, name, fl | WStyle_ContextHelp) { |
54 | 68 | ||
55 | setCaption( tr("Today") ); | 69 | setCaption( tr("Today") ); |
56 | connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 70 | connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
57 | connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 71 | connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
58 | 72 | ||
59 | #if !defined(QT_NO_COP) | 73 | #if !defined(QT_NO_COP) |
60 | 74 | ||
61 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 75 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
62 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 76 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
63 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); | 77 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); |
64 | #endif | 78 | #endif |
65 | 79 | ||
66 | setOwnerField(); | 80 | setOwnerField(); |
67 | m_big_box = 0l; | 81 | m_big_box = 0l; |
68 | m_bblayout = 0l; | 82 | m_bblayout = 0l; |
69 | 83 | ||
70 | layout = new QVBoxLayout( this ); | 84 | layout = new QVBoxLayout( this ); |
71 | layout->addWidget( Frame ); | 85 | layout->addWidget( Frame ); |
72 | layout->addWidget( OwnerField ); | 86 | layout->addWidget( OwnerField ); |
73 | 87 | ||
74 | 88 | ||
75 | m_informationLabel = new QLabel( tr("No plugins activated"), this ); | 89 | m_informationLabel = new QLabel( tr("No plugins activated"), this ); |
76 | layout->addWidget( m_informationLabel ); | 90 | layout->addWidget( m_informationLabel ); |
77 | 91 | ||
78 | m_sv = new QScrollView( this ); | 92 | m_sv = new QScrollView( this ); |
79 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); | 93 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); |
80 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 94 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
81 | m_sv->setFrameShape( QFrame::NoFrame ); | 95 | m_sv->setFrameShape( QFrame::NoFrame ); |
82 | 96 | ||
83 | layout->addWidget( m_sv ); | 97 | layout->addWidget( m_sv ); |
84 | layout->setStretchFactor( m_sv,4 ); | 98 | layout->setStretchFactor( m_sv,4 ); |
85 | 99 | ||
86 | m_refreshTimer = new QTimer( this ); | 100 | m_refreshTimer = new QTimer( this ); |
87 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 101 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
88 | 102 | ||
89 | loadPlugins(); | 103 | loadPlugins(); |
90 | loadShellContent(); | 104 | loadShellContent(); |
91 | loadPluginWidgets(); | 105 | loadPluginWidgets(); |
92 | } | 106 | } |
93 | 107 | ||
94 | /** | 108 | /** |
95 | * Qcop receive method. | 109 | * Qcop receive method. |
96 | */ | 110 | */ |
97 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 111 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
98 | QDataStream stream( data, IO_ReadOnly ); | 112 | QDataStream stream( data, IO_ReadOnly ); |
99 | if ( msg == "message(QString)" ) { | 113 | if ( msg == "message(QString)" ) { |
100 | QString message; | 114 | QString message; |
101 | stream >> message; | 115 | stream >> message; |
102 | setOwnerField( message ); | 116 | setOwnerField( message ); |
103 | } | 117 | } |
104 | } | 118 | } |
105 | 119 | ||
106 | void Today::setRefreshTimer( int interval ) { | 120 | void Today::setRefreshTimer( int interval ) { |
107 | 121 | ||
108 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 122 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
109 | // 0 is "never" case | 123 | // 0 is "never" case |
110 | if ( !interval == 0 ) { | 124 | if ( !interval == 0 ) { |
111 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 125 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
112 | m_refreshTimer->changeInterval( interval ); | 126 | m_refreshTimer->changeInterval( interval ); |
113 | } | 127 | } |
114 | } | 128 | } |
115 | 129 | ||
116 | 130 | ||
117 | /** | 131 | /** |
118 | * Initialises the owner field with the default value, the username | 132 | * Initialises the owner field with the default value, the username |
119 | */ | 133 | */ |
120 | void Today::setOwnerField() { | 134 | void Today::setOwnerField() { |
@@ -125,192 +139,192 @@ void Today::setOwnerField() { | |||
125 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 139 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
126 | } else { | 140 | } else { |
127 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 141 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
128 | } | 142 | } |
129 | } | 143 | } |
130 | 144 | ||
131 | /** | 145 | /** |
132 | * Set the owner field with a given QString, for example per qcop. | 146 | * Set the owner field with a given QString, for example per qcop. |
133 | */ | 147 | */ |
134 | void Today::setOwnerField( QString &message ) { | 148 | void Today::setOwnerField( QString &message ) { |
135 | if ( !message.isEmpty() ) { | 149 | if ( !message.isEmpty() ) { |
136 | OwnerField->setText( "<b>" + message + "</b>" ); | 150 | OwnerField->setText( "<b>" + message + "</b>" ); |
137 | } | 151 | } |
138 | } | 152 | } |
139 | 153 | ||
140 | 154 | ||
141 | /** | 155 | /** |
142 | * Load the plugins | 156 | * Load the plugins |
143 | */ | 157 | */ |
144 | void Today::loadPlugins() { | 158 | void Today::loadPlugins() { |
145 | m_pluginLoader = new OPluginLoader( "today", true ); | 159 | m_pluginLoader = new OPluginLoader( "today", true ); |
146 | m_pluginLoader->setAutoDelete( true ); | 160 | m_pluginLoader->setAutoDelete( true ); |
147 | 161 | ||
148 | m_manager = new OPluginManager( m_pluginLoader ); | 162 | m_manager = new OPluginManager( m_pluginLoader ); |
149 | m_manager->load(); | 163 | m_manager->load(); |
150 | } | 164 | } |
151 | 165 | ||
152 | void Today::loadShellContent() { | 166 | void Today::loadShellContent() { |
153 | Config cfg( "today" ); | 167 | Config cfg( "today" ); |
154 | cfg.setGroup( "Plugins" ); | 168 | cfg.setGroup( "Plugins" ); |
155 | 169 | ||
156 | 170 | ||
157 | cfg.setGroup( "General" ); | 171 | cfg.setGroup( "General" ); |
158 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 172 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
159 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); | 173 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); |
160 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 174 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
161 | 175 | ||
162 | // set the date in top label | 176 | // set the date in top label |
163 | QDate date = QDate::currentDate(); | 177 | QDate date = QDate::currentDate(); |
164 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); | 178 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); |
165 | 179 | ||
166 | if ( m_hideBanner ) { | 180 | if ( m_hideBanner ) { |
167 | Opiezilla->hide(); | 181 | Opiezilla->hide(); |
168 | TodayLabel->hide(); | 182 | TodayLabel->hide(); |
169 | } else { | 183 | } else { |
170 | Opiezilla->show(); | 184 | Opiezilla->show(); |
171 | TodayLabel->show(); | 185 | TodayLabel->show(); |
172 | } | 186 | } |
173 | } | 187 | } |
174 | 188 | ||
175 | void Today::loadPluginWidgets() { | 189 | void Today::loadPluginWidgets() { |
176 | /* | 190 | /* |
177 | * check if loading of Plugins crashed | 191 | * check if loading of Plugins crashed |
178 | */ | 192 | */ |
179 | if( m_pluginLoader->isInSafeMode() ) { | 193 | if( m_pluginLoader->isInSafeMode() ) { |
180 | QMessageBox::information(this, tr("Today Error"), | 194 | QMessageBox::information(this, tr("Today Error"), |
181 | tr("<qt>The plugin '%1' caused Today to crash." | 195 | tr("<qt>The plugin '%1' caused Today to crash." |
182 | " It could be that the plugin is not properly" | 196 | " It could be that the plugin is not properly" |
183 | " installed.<br>Today tries to continue loading" | 197 | " installed.<br>Today tries to continue loading" |
184 | " plugins.</qt>") | 198 | " plugins.</qt>") |
185 | .arg( m_manager->crashedPlugin().name())); | 199 | .arg( m_manager->crashedPlugin().name())); |
186 | } | 200 | } |
187 | 201 | ||
188 | OPluginItem::List lst = m_pluginLoader->filtered( true ); | 202 | OPluginItem::List lst = m_pluginLoader->filtered( true ); |
189 | 203 | ||
190 | /* | 204 | /* |
191 | * Show or Hide the information of no plugin installed | 205 | * Show or Hide the information of no plugin installed |
192 | */ | 206 | */ |
193 | if ( lst.isEmpty() ) | 207 | if ( lst.isEmpty() ) |
194 | m_informationLabel->show(); | 208 | m_informationLabel->show(); |
195 | else | 209 | else |
196 | m_informationLabel->hide(); | 210 | m_informationLabel->hide(); |
197 | 211 | ||
198 | 212 | ||
199 | /* | 213 | /* |
200 | * Now let us add the plugins | 214 | * Now let us add the plugins |
201 | */ | 215 | */ |
202 | m_big_box = new QWidget( m_sv->viewport() ); | 216 | m_big_box = new QWidget( m_sv->viewport() ); |
203 | m_sv->addChild( m_big_box ); | 217 | m_sv->addChild( m_big_box ); |
204 | m_bblayout = new QVBoxLayout( m_big_box ); | 218 | m_bblayout = new QVBoxLayout( m_big_box ); |
205 | 219 | ||
206 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 220 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
207 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | 221 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
208 | 222 | ||
209 | TodayPlugin plugin; | 223 | TodayPlugin plugin; |
210 | plugin.iface = iface; | 224 | plugin.iface = iface; |
211 | plugin.name = (*it).name(); | 225 | plugin.name = (*it).name(); |
212 | plugin.oplugin = (*it); | 226 | plugin.oplugin = (*it); |
213 | 227 | ||
214 | plugin.guiPart = plugin.iface->guiPart(); | 228 | plugin.guiPart = plugin.iface->guiPart(); |
215 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 229 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
216 | 230 | ||
217 | // package the whole thing into a qwidget so it can be shown and hidden | 231 | // package the whole thing into a qwidget so it can be shown and hidden |
218 | plugin.guiBox = new QWidget( m_big_box ); | 232 | plugin.guiBox = new QWidget( m_big_box ); |
219 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 233 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
220 | QPixmap plugPix; | 234 | QPixmap plugPix; |
221 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 235 | plugPix.convertFromImage( Opie::Core::OResource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
222 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 236 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
223 | plugIcon->setPixmap( plugPix ); | 237 | plugIcon->setPixmap( plugPix ); |
224 | QWhatsThis::add | 238 | QWhatsThis::add |
225 | ( plugIcon, tr("Click here to launch the associated app") ); | 239 | ( plugIcon, tr("Click here to launch the associated app") ); |
226 | plugIcon->setName( plugin.guiPart->appName() ); | 240 | plugIcon->setName( plugin.guiPart->appName() ); |
227 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 241 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
228 | 242 | ||
229 | QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); | 243 | QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); |
230 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 244 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
231 | boxLayout->addWidget( plugWidget, 0, AlignTop ); | 245 | boxLayout->addWidget( plugWidget, 0, AlignTop ); |
232 | boxLayout->setStretchFactor( plugIcon, 1 ); | 246 | boxLayout->setStretchFactor( plugIcon, 1 ); |
233 | boxLayout->setStretchFactor( plugWidget, 9 ); | 247 | boxLayout->setStretchFactor( plugWidget, 9 ); |
234 | 248 | ||
235 | pluginList.insert( plugin.name, plugin ); | 249 | pluginList.insert( plugin.name, plugin ); |
236 | m_bblayout->addWidget(plugin.guiBox); | 250 | m_bblayout->addWidget(plugin.guiBox); |
237 | } | 251 | } |
238 | 252 | ||
239 | m_bblayout->addStretch( 1 ); | 253 | m_bblayout->addStretch( 1 ); |
240 | m_big_box->show(); | 254 | m_big_box->show(); |
241 | } | 255 | } |
242 | 256 | ||
243 | 257 | ||
244 | /** | 258 | /** |
245 | * The method for the configuration dialog. | 259 | * The method for the configuration dialog. |
246 | */ | 260 | */ |
247 | void Today::startConfig() { | 261 | void Today::startConfig() { |
248 | // disconnect timer to prevent problems while being on config dialog | 262 | // disconnect timer to prevent problems while being on config dialog |
249 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 263 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
250 | m_refreshTimer->stop( ); | 264 | m_refreshTimer->stop( ); |
251 | 265 | ||
252 | TodayConfig conf( this, "dialog", true ); | 266 | TodayConfig conf( this, "dialog", true ); |
253 | conf.setUpPlugins( m_manager, m_pluginLoader ); | 267 | conf.setUpPlugins( m_manager, m_pluginLoader ); |
254 | 268 | ||
255 | if ( QPEApplication::execDialog(&conf) == QDialog::Accepted ) { | 269 | if ( QPEApplication::execDialog(&conf) == QDialog::Accepted ) { |
256 | conf.writeConfig(); | 270 | conf.writeConfig(); |
257 | clearPluginWidgets(); | 271 | clearPluginWidgets(); |
258 | loadShellContent(); | 272 | loadShellContent(); |
259 | loadPluginWidgets(); | 273 | loadPluginWidgets(); |
260 | } else { | 274 | } else { |
261 | // since reinitialize is not called in that case , reconnect the signal | 275 | // since reinitialize is not called in that case , reconnect the signal |
262 | m_refreshTimer->start( 15000 ); // get the config value in here later | 276 | m_refreshTimer->start( 15000 ); // get the config value in here later |
263 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 277 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
264 | } | 278 | } |
265 | } | 279 | } |
266 | 280 | ||
267 | /** | 281 | /** |
268 | * Refresh for the view. Reload all applets | 282 | * Refresh for the view. Reload all applets |
269 | * | 283 | * |
270 | */ | 284 | */ |
271 | void Today::refresh() { | 285 | void Today::refresh() { |
272 | for ( QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); | 286 | for ( QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); |
273 | it != pluginList.end(); ++it ) | 287 | it != pluginList.end(); ++it ) |
274 | it.data().guiPart->refresh(); | 288 | it.data().guiPart->refresh(); |
275 | 289 | ||
276 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); | 290 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); |
277 | 291 | ||
278 | updateGeometry(); | 292 | updateGeometry(); |
279 | repaint(); | 293 | repaint(); |
280 | } | 294 | } |
281 | 295 | ||
282 | 296 | ||
283 | void Today::startApplication() { | 297 | void Today::startApplication() { |
284 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 298 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
285 | e << QString( sender()->name() ); | 299 | e << QString( sender()->name() ); |
286 | } | 300 | } |
287 | 301 | ||
288 | 302 | ||
289 | /** | 303 | /** |
290 | * launch addressbook (personal card) | 304 | * launch addressbook (personal card) |
291 | */ | 305 | */ |
292 | void Today::editCard() { | 306 | void Today::editCard() { |
293 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); | 307 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); |
294 | } | 308 | } |
295 | 309 | ||
296 | 310 | ||
297 | Today::~Today() { | 311 | Today::~Today() { |
298 | clearPluginWidgets(); | 312 | clearPluginWidgets(); |
299 | delete m_pluginLoader; | 313 | delete m_pluginLoader; |
300 | delete m_manager; | 314 | delete m_manager; |
301 | } | 315 | } |
302 | 316 | ||
303 | 317 | ||
304 | void Today::clearPluginWidgets() { | 318 | void Today::clearPluginWidgets() { |
305 | for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it ) { | 319 | for(QMap<QString, TodayPlugin>::Iterator it = pluginList.begin(); it != pluginList.end(); ++it ) { |
306 | delete it.data().guiBox; | 320 | delete it.data().guiBox; |
307 | it.data().guiBox = 0; | 321 | it.data().guiBox = 0; |
308 | } | 322 | } |
309 | 323 | ||
310 | pluginList.clear(); | 324 | pluginList.clear(); |
311 | 325 | ||
312 | delete m_bblayout; | 326 | delete m_bblayout; |
313 | delete m_big_box; | 327 | delete m_big_box; |
314 | m_bblayout = 0; | 328 | m_bblayout = 0; |
315 | m_big_box = 0; | 329 | m_big_box = 0; |
316 | } | 330 | } |
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 8dbe9aa..dd828ac 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -1,94 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | * today.h | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * copyright : (c) 2002,2003,2004 by Maximilian Reiß | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * email : harlekin@handhelds.org | 5 | =. |
6 | * | 6 | .=l. |
7 | */ | 7 | Â Â Â Â Â Â .>+-= |
8 | /*************************************************************************** | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | * it under the terms of the GNU General Public License as published by * | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * (at your option) any later version. * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | ***************************************************************************/ | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
30 | |||
16 | #ifndef TODAY_H | 31 | #ifndef TODAY_H |
17 | #define TODAY_H | 32 | #define TODAY_H |
18 | 33 | ||
19 | 34 | ||
20 | #include "todayconfig.h" | 35 | #include "todayconfig.h" |
21 | #include "todaybase.h" | 36 | #include "todaybase.h" |
22 | 37 | ||
23 | #include <opie2/todayplugininterface.h> | 38 | #include <opie2/todayplugininterface.h> |
24 | #include <opie2/oclickablelabel.h> | 39 | #include <opie2/oclickablelabel.h> |
25 | #include <opie2/opluginloader.h> | 40 | #include <opie2/opluginloader.h> |
26 | 41 | ||
27 | #include <qpe/qlibrary.h> | 42 | #include <qpe/qlibrary.h> |
28 | 43 | ||
29 | #include <qscrollview.h> | 44 | #include <qscrollview.h> |
30 | #include <qvbox.h> | 45 | #include <qvbox.h> |
31 | 46 | ||
32 | 47 | ||
33 | class QVBoxLayout; | 48 | class QVBoxLayout; |
34 | 49 | ||
35 | namespace Opie { | 50 | namespace Opie { |
36 | namespace Core { | 51 | namespace Core { |
37 | class OPluginManager; | 52 | class OPluginManager; |
38 | class OPluginLoader; | 53 | class OPluginLoader; |
39 | } | 54 | } |
40 | } | 55 | } |
41 | 56 | ||
42 | class Today : public TodayBase { | 57 | class Today : public TodayBase { |
43 | Q_OBJECT | 58 | Q_OBJECT |
44 | 59 | ||
45 | public: | 60 | public: |
46 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 61 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
47 | ~Today(); | 62 | ~Today(); |
48 | static QString appName() { | 63 | static QString appName() { |
49 | return QString::fromLatin1("today"); | 64 | return QString::fromLatin1("today"); |
50 | } | 65 | } |
51 | 66 | ||
52 | private slots: | 67 | private slots: |
53 | void startConfig(); | 68 | void startConfig(); |
54 | void startApplication(); | 69 | void startApplication(); |
55 | void editCard(); | 70 | void editCard(); |
56 | void refresh(); | 71 | void refresh(); |
57 | 72 | ||
58 | private: | 73 | private: |
59 | void setOwnerField(); | 74 | void setOwnerField(); |
60 | void setOwnerField(QString &string); | 75 | void setOwnerField(QString &string); |
61 | 76 | ||
62 | void setRefreshTimer( int ); | 77 | void setRefreshTimer( int ); |
63 | 78 | ||
64 | void clearPluginWidgets(); | 79 | void clearPluginWidgets(); |
65 | void loadPluginWidgets(); | 80 | void loadPluginWidgets(); |
66 | void loadShellContent(); | 81 | void loadShellContent(); |
67 | 82 | ||
68 | 83 | ||
69 | private slots: | 84 | private slots: |
70 | void channelReceived(const QCString &msg, const QByteArray & data); | 85 | void channelReceived(const QCString &msg, const QByteArray & data); |
71 | void loadPlugins(); | 86 | void loadPlugins(); |
72 | 87 | ||
73 | private: | 88 | private: |
74 | TodayConfig *conf; | 89 | TodayConfig *conf; |
75 | QStringList m_excludeApplets; | 90 | QStringList m_excludeApplets; |
76 | QStringList m_allApplets; | 91 | QStringList m_allApplets; |
77 | 92 | ||
78 | QScrollView *m_sv; | 93 | QScrollView *m_sv; |
79 | QWidget* m_big_box; | 94 | QWidget* m_big_box; |
80 | QVBoxLayout *m_bblayout; | 95 | QVBoxLayout *m_bblayout; |
81 | QLabel *m_informationLabel; | 96 | QLabel *m_informationLabel; |
82 | 97 | ||
83 | Opie::Core::OPluginLoader *m_pluginLoader; | 98 | Opie::Core::OPluginLoader *m_pluginLoader; |
84 | Opie::Core::OPluginManager *m_manager; | 99 | Opie::Core::OPluginManager *m_manager; |
85 | 100 | ||
86 | QTimer *m_refreshTimer; | 101 | QTimer *m_refreshTimer; |
87 | 102 | ||
88 | bool m_refreshTimerEnabled; | 103 | bool m_refreshTimerEnabled; |
89 | int m_newStart; | 104 | int m_newStart; |
90 | int m_iconSize; | 105 | int m_iconSize; |
91 | int m_maxCharClip; | 106 | int m_maxCharClip; |
92 | int m_hideBanner; | 107 | int m_hideBanner; |
93 | }; | 108 | }; |
94 | #endif | 109 | #endif |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index a89f454..931f45a 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -1,110 +1,124 @@ | |||
1 | /* | 1 | /* |
2 | * todaybase.cpp | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * email : harlekin@handhelds.org | 5 | =. |
6 | * | 6 | .=l. |
7 | */ | 7 | Â Â Â Â Â Â .>+-= |
8 | /*************************************************************************** | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | * it under the terms of the GNU General Public License as published by * | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * (at your option) any later version. * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | ***************************************************************************/ | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
16 | 30 | ||
17 | #include "todaybase.h" | 31 | #include "todaybase.h" |
18 | 32 | ||
33 | #include <opie2/oresource.h> | ||
34 | |||
19 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
20 | #include <qpe/resource.h> | ||
21 | 36 | ||
22 | #include <qvbox.h> | 37 | #include <qvbox.h> |
23 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
24 | 39 | ||
25 | using namespace Opie::Ui; | 40 | using namespace Opie::Ui; |
26 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) | 41 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags ) |
27 | : QWidget( parent, name, WStyle_ContextHelp ) { | 42 | : QWidget( parent, name, WStyle_ContextHelp ) { |
28 | 43 | ||
29 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo | 44 | QPixmap logo = Opie::Core::OResource::loadPixmap( "today/today_logo" ); // logo |
30 | QImage opiezillaimage = QImage( Resource::loadImage("logo/opielogo" ) ); | 45 | QImage opiezillaimage = QImage( Opie::Core::OResource::loadImage( "logo/opielogo" ) ); |
31 | opiezillaimage = opiezillaimage.smoothScale( 45, 45 ); | 46 | opiezillaimage = opiezillaimage.smoothScale( 45, 45 ); |
32 | QPixmap opiezilla; //the opiezilla | 47 | QPixmap opiezilla; //the opiezilla |
33 | opiezilla.convertFromImage( opiezillaimage ); | 48 | opiezilla.convertFromImage( opiezillaimage ); |
34 | QPixmap config; | 49 | QPixmap config = Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ); |
35 | config.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
36 | 50 | ||
37 | layout = 0L; | 51 | layout = 0L; |
38 | 52 | ||
39 | QPalette pal = this->palette(); | 53 | QPalette pal = this->palette(); |
40 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); | 54 | QColor col = pal.color( QPalette::Active, QColorGroup::Background ); |
41 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); | 55 | pal.setColor( QPalette::Active, QColorGroup::Button, col ); |
42 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); | 56 | pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); |
43 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); | 57 | pal.setColor( QPalette::Normal, QColorGroup::Button, col ); |
44 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); | 58 | pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); |
45 | this->setPalette( pal ); | 59 | this->setPalette( pal ); |
46 | 60 | ||
47 | // --- logo Section --- | 61 | // --- logo Section --- |
48 | QPalette pal2; | 62 | QPalette pal2; |
49 | QColorGroup cg; | 63 | QColorGroup cg; |
50 | cg.setColor( QColorGroup::Text, white ); | 64 | cg.setColor( QColorGroup::Text, white ); |
51 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); | 65 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230 ), logo ) ); |
52 | pal2.setActive( cg ); | 66 | pal2.setActive( cg ); |
53 | 67 | ||
54 | // today logo | 68 | // today logo |
55 | Frame = new QLabel( this, "Frame" ); | 69 | Frame = new QLabel( this, "Frame" ); |
56 | Frame->setPalette( pal2 ); | 70 | Frame->setPalette( pal2 ); |
57 | Frame->setFrameShape( QFrame::StyledPanel ); | 71 | Frame->setFrameShape( QFrame::StyledPanel ); |
58 | Frame->setFrameShadow( QFrame::Raised ); | 72 | Frame->setFrameShadow( QFrame::Raised ); |
59 | Frame->setLineWidth( 0 ); | 73 | Frame->setLineWidth( 0 ); |
60 | 74 | ||
61 | QHBoxLayout *frameLayout = new QHBoxLayout( Frame ); | 75 | QHBoxLayout *frameLayout = new QHBoxLayout( Frame ); |
62 | QVBox *box1 = new QVBox( Frame ); | 76 | QVBox *box1 = new QVBox( Frame ); |
63 | 77 | ||
64 | // Today text | 78 | // Today text |
65 | TodayLabel = new QLabel( box1, "TodayText" ); | 79 | TodayLabel = new QLabel( box1, "TodayText" ); |
66 | QFont TodayLabel_font( TodayLabel->font() ); | 80 | QFont TodayLabel_font( TodayLabel->font() ); |
67 | TodayLabel_font.setBold( TRUE ); | 81 | TodayLabel_font.setBold( TRUE ); |
68 | TodayLabel_font.setPointSize( 40 ); | 82 | TodayLabel_font.setPointSize( 40 ); |
69 | TodayLabel->setFont( TodayLabel_font ); | 83 | TodayLabel->setFont( TodayLabel_font ); |
70 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 84 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
71 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); | 85 | TodayLabel->setText( "<font color=#FFFFFF>" + tr("Today") +"</font>" ); |
72 | 86 | ||
73 | // date | 87 | // date |
74 | DateLabel = new QLabel( box1, "TextLabel1" ); | 88 | DateLabel = new QLabel( box1, "TextLabel1" ); |
75 | QFont DateLabel_font( DateLabel->font() ); | 89 | QFont DateLabel_font( DateLabel->font() ); |
76 | DateLabel_font.setBold( TRUE ); | 90 | DateLabel_font.setBold( TRUE ); |
77 | DateLabel->setFont( DateLabel_font ); | 91 | DateLabel->setFont( DateLabel_font ); |
78 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | 92 | DateLabel->setBackgroundOrigin( QLabel::ParentOrigin ); |
79 | DateLabel->setTextFormat( RichText ); | 93 | DateLabel->setTextFormat( RichText ); |
80 | 94 | ||
81 | // Opiezilla | 95 | // Opiezilla |
82 | Opiezilla = new QLabel( Frame, "OpieZilla" ); | 96 | Opiezilla = new QLabel( Frame, "OpieZilla" ); |
83 | Opiezilla->setPixmap( opiezilla ); | 97 | Opiezilla->setPixmap( opiezilla ); |
84 | QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Reiß" ) ); | 98 | QWhatsThis::add( Opiezilla , tr( "Today by Maximilian Rei�" ) ); |
85 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); | 99 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); |
86 | 100 | ||
87 | 101 | ||
88 | // Ownerfield | 102 | // Ownerfield |
89 | OwnerField = new OClickableLabel( this , "Owner" ); | 103 | OwnerField = new OClickableLabel( this , "Owner" ); |
90 | OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); | 104 | OwnerField->setAlignment( int (QLabel::AlignTop | QLabel::AlignLeft ) ); |
91 | 105 | ||
92 | // config | 106 | // config |
93 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); | 107 | ConfigButton = new OClickableLabel ( Frame, "PushButton1" ); |
94 | ConfigButton->setPixmap( config ); | 108 | ConfigButton->setPixmap( config ); |
95 | QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); | 109 | QWhatsThis::add( ConfigButton, tr( "Click here to get to the config dialog" ) ); |
96 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); | 110 | ConfigButton->setBackgroundOrigin( QLabel::ParentOrigin ); |
97 | 111 | ||
98 | frameLayout->addWidget( box1, 1 ); | 112 | frameLayout->addWidget( box1, 1 ); |
99 | frameLayout->addStretch( 1 ); | 113 | frameLayout->addStretch( 1 ); |
100 | frameLayout->addWidget( ConfigButton, 0, AlignBottom ); | 114 | frameLayout->addWidget( ConfigButton, 0, AlignBottom ); |
101 | frameLayout->addWidget( Opiezilla ); | 115 | frameLayout->addWidget( Opiezilla ); |
102 | } | 116 | } |
103 | 117 | ||
104 | 118 | ||
105 | /** | 119 | /** |
106 | * D' tor | 120 | * D' tor |
107 | */ | 121 | */ |
108 | TodayBase::~TodayBase() { | 122 | TodayBase::~TodayBase() { |
109 | } | 123 | } |
110 | 124 | ||
diff --git a/core/pim/today/todaybase.h b/core/pim/today/todaybase.h index 6ee9bb2..5b34234 100644 --- a/core/pim/today/todaybase.h +++ b/core/pim/today/todaybase.h | |||
@@ -1,55 +1,69 @@ | |||
1 | /* | 1 | /* |
2 | * todaybase.h | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * email : harlekin@handhelds.org | 5 | =. |
6 | * | 6 | .=l. |
7 | */ | 7 | Â Â Â Â Â Â .>+-= |
8 | /*************************************************************************** | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | * it under the terms of the GNU General Public License as published by * | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * (at your option) any later version. * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | ***************************************************************************/ | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
16 | 30 | ||
17 | #ifndef TODAYBASE_H | 31 | #ifndef TODAYBASE_H |
18 | #define TODAYBASE_H | 32 | #define TODAYBASE_H |
19 | 33 | ||
20 | #include <opie2/oclickablelabel.h> | 34 | #include <opie2/oclickablelabel.h> |
21 | 35 | ||
22 | #include <qlayout.h> | 36 | #include <qlayout.h> |
23 | 37 | ||
24 | class QVBox; | 38 | class QVBox; |
25 | class QGridLayout; | 39 | class QGridLayout; |
26 | class QFrame; | 40 | class QFrame; |
27 | class QLabel; | 41 | class QLabel; |
28 | class QPushButton; | 42 | class QPushButton; |
29 | class QBoxLayout; | 43 | class QBoxLayout; |
30 | 44 | ||
31 | 45 | ||
32 | 46 | ||
33 | 47 | ||
34 | class TodayBase : public QWidget | 48 | class TodayBase : public QWidget |
35 | { | 49 | { |
36 | Q_OBJECT | 50 | Q_OBJECT |
37 | 51 | ||
38 | public: | 52 | public: |
39 | TodayBase( QWidget* parent = 0, const char* name = 0, WFlags = 0 ); | 53 | TodayBase( QWidget* parent = 0, const char* name = 0, WFlags = 0 ); |
40 | ~TodayBase(); | 54 | ~TodayBase(); |
41 | 55 | ||
42 | QFrame* Frame4; | 56 | QFrame* Frame4; |
43 | QPushButton* DatesButton; | 57 | QPushButton* DatesButton; |
44 | QVBoxLayout* layout; | 58 | QVBoxLayout* layout; |
45 | Opie::Ui::OClickableLabel* OwnerField; | 59 | Opie::Ui::OClickableLabel* OwnerField; |
46 | QLabel* Frame; | 60 | QLabel* Frame; |
47 | QLabel* DateLabel; | 61 | QLabel* DateLabel; |
48 | QFrame* Frame15; | 62 | QFrame* Frame15; |
49 | QLabel* Opiezilla; | 63 | QLabel* Opiezilla; |
50 | QLabel* TodayLabel; | 64 | QLabel* TodayLabel; |
51 | Opie::Ui::OClickableLabel* ConfigButton; | 65 | Opie::Ui::OClickableLabel* ConfigButton; |
52 | 66 | ||
53 | }; | 67 | }; |
54 | 68 | ||
55 | #endif | 69 | #endif |
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index 864c708..04a16e1 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -1,143 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.cpp | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * copyright : (c) 2002, 2003, 2004 by Maximilian Reiß | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * email : harlekin@handhelds.org | 5 | =. |
6 | * | 6 | .=l. |
7 | */ | 7 | Â Â Â Â Â Â .>+-= |
8 | /*************************************************************************** | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | * it under the terms of the GNU General Public License as published by * | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * (at your option) any later version. * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | ***************************************************************************/ | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
16 | 30 | ||
17 | #include "todayconfig.h" | 31 | #include "todayconfig.h" |
18 | 32 | ||
19 | #include <opie2/oconfig.h> | 33 | #include <opie2/oconfig.h> |
20 | #include <opie2/opluginloader.h> | 34 | #include <opie2/opluginloader.h> |
35 | #include <opie2/oresource.h> | ||
21 | #include <opie2/todayplugininterface.h> | 36 | #include <opie2/todayplugininterface.h> |
22 | 37 | ||
23 | #include <qpe/resource.h> | ||
24 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
26 | 40 | ||
27 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
28 | #include <qlabel.h> | 42 | #include <qlabel.h> |
29 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
30 | #include <qlayout.h> | 44 | #include <qlayout.h> |
31 | #include <qheader.h> | 45 | #include <qheader.h> |
32 | #include <qvbox.h> | 46 | #include <qvbox.h> |
33 | #include <qtoolbutton.h> | 47 | #include <qtoolbutton.h> |
34 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
35 | 49 | ||
36 | using namespace Opie::Ui; | 50 | using namespace Opie::Ui; |
37 | using Opie::Core::OConfig; | 51 | using Opie::Core::OConfig; |
38 | using Opie::Core::OPluginManager; | 52 | using Opie::Core::OPluginManager; |
39 | using Opie::Core::OPluginLoader; | 53 | using Opie::Core::OPluginLoader; |
40 | using Opie::Core::OPluginItem; | 54 | using Opie::Core::OPluginItem; |
41 | 55 | ||
42 | class ToolButton : public QToolButton { | 56 | class ToolButton : public QToolButton { |
43 | 57 | ||
44 | public: | 58 | public: |
45 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 59 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
46 | : QToolButton( parent, name ) { | 60 | : QToolButton( parent, name ) { |
47 | setPixmap( Resource::loadPixmap( icon ) ); | 61 | setUsesBigPixmap( true ); |
62 | setPixmap( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ); | ||
48 | setAutoRaise( TRUE ); | 63 | setAutoRaise( TRUE ); |
49 | setFocusPolicy( QWidget::NoFocus ); | 64 | setFocusPolicy( QWidget::NoFocus ); |
50 | setToggleButton( t ); | 65 | setToggleButton( t ); |
51 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 66 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
52 | } | 67 | } |
53 | }; | 68 | }; |
54 | 69 | ||
55 | 70 | ||
56 | /** | 71 | /** |
57 | * The class has currently quite some duplicate code. | 72 | * The class has currently quite some duplicate code. |
58 | * By that way it would be real easy to have it as seperate app in settings tab | 73 | * By that way it would be real easy to have it as seperate app in settings tab |
59 | * | 74 | * |
60 | */ | 75 | */ |
61 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) | 76 | TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) |
62 | : QDialog( parent, name, modal, WStyle_ContextHelp ) { | 77 | : QDialog( parent, name, modal, WStyle_ContextHelp ) { |
63 | 78 | ||
64 | setCaption( tr( "Today Config" ) ); | 79 | setCaption( tr( "Today Config" ) ); |
65 | 80 | ||
66 | QVBoxLayout *layout = new QVBoxLayout( this ); | 81 | QVBoxLayout *layout = new QVBoxLayout( this ); |
67 | TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 82 | TabWidget3 = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
68 | layout->addWidget( TabWidget3 ); | 83 | layout->addWidget( TabWidget3 ); |
69 | 84 | ||
70 | tab_2 = new QWidget( TabWidget3, "tab_2" ); | 85 | tab_2 = new QWidget( TabWidget3, "tab_2" ); |
71 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); | 86 | QVBoxLayout *tab2Layout = new QVBoxLayout( tab_2, 4 ,4 ); |
72 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); | 87 | QLabel *l = new QLabel( tr( "Load which plugins in what order:" ), tab_2 ); |
73 | tab2Layout->addWidget( l ); | 88 | tab2Layout->addWidget( l ); |
74 | QHBox *hbox1 = new QHBox( tab_2 ); | 89 | QHBox *hbox1 = new QHBox( tab_2 ); |
75 | m_appletListView = new QListView( hbox1 ); | 90 | m_appletListView = new QListView( hbox1 ); |
76 | m_appletListView->addColumn( "PluginList" ); | 91 | m_appletListView->addColumn( "PluginList" ); |
77 | m_appletListView->header()->hide(); | 92 | m_appletListView->header()->hide(); |
78 | m_appletListView->setSorting( -1 ); | 93 | m_appletListView->setSorting( -1 ); |
79 | QWhatsThis::add | 94 | QWhatsThis::add |
80 | ( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); | 95 | ( m_appletListView, tr( "Check a checkbox to activate/deactivate a plugin or use the arrow buttons on the right to change the appearance order" ) ); |
81 | QVBox *vbox1 = new QVBox( hbox1 ); | 96 | QVBox *vbox1 = new QVBox( hbox1 ); |
82 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); | 97 | new ToolButton( vbox1, tr( "Move Up" ), "up", this , SLOT( moveSelectedUp() ) ); |
83 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); | 98 | new ToolButton( vbox1, tr( "Move Down" ), "down", this , SLOT( moveSelectedDown() ) ); |
84 | tab2Layout->addWidget( hbox1 ); | 99 | tab2Layout->addWidget( hbox1 ); |
85 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); | 100 | TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); |
86 | 101 | ||
87 | // Misc tab | 102 | // Misc tab |
88 | tab_3 = new QWidget( TabWidget3, "tab_3" ); | 103 | tab_3 = new QWidget( TabWidget3, "tab_3" ); |
89 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); | 104 | QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); |
90 | 105 | ||
91 | m_guiMisc = new TodayConfigMiscBase( tab_3 ); | 106 | m_guiMisc = new TodayConfigMiscBase( tab_3 ); |
92 | 107 | ||
93 | tab3Layout->addWidget( m_guiMisc ); | 108 | tab3Layout->addWidget( m_guiMisc ); |
94 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); | 109 | TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); |
95 | 110 | ||
96 | previousItem = 0l; | 111 | previousItem = 0l; |
97 | readConfig(); | 112 | readConfig(); |
98 | } | 113 | } |
99 | 114 | ||
100 | 115 | ||
101 | void TodayConfig::setUpPlugins( OPluginManager * plugManager, OPluginLoader *plugLoader ) { | 116 | void TodayConfig::setUpPlugins( OPluginManager * plugManager, OPluginLoader *plugLoader ) { |
102 | m_configMap.clear(); | 117 | m_configMap.clear(); |
103 | 118 | ||
104 | m_pluginManager = plugManager; | 119 | m_pluginManager = plugManager; |
105 | m_pluginLoader = plugLoader; | 120 | m_pluginLoader = plugLoader; |
106 | 121 | ||
107 | OPluginItem::List inLst = m_pluginLoader->allAvailable( true ); | 122 | OPluginItem::List inLst = m_pluginLoader->allAvailable( true ); |
108 | 123 | ||
109 | OPluginItem::List lst; | 124 | OPluginItem::List lst; |
110 | for ( OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { | 125 | for ( OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { |
111 | lst.prepend((*it)); | 126 | lst.prepend((*it)); |
112 | 127 | ||
113 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | 128 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
114 | TodayConfigWidget *widget = iface->guiPart()->configWidget( TabWidget3 ); | 129 | TodayConfigWidget *widget = iface->guiPart()->configWidget( TabWidget3 ); |
115 | 130 | ||
116 | if (!widget ) | 131 | if (!widget ) |
117 | continue; | 132 | continue; |
118 | 133 | ||
119 | m_configMap.insert( iface, widget ); | 134 | m_configMap.insert( iface, widget ); |
120 | TabWidget3->addTab( widget, iface->guiPart()->pixmapNameConfig() | 135 | TabWidget3->addTab( widget, iface->guiPart()->pixmapNameConfig() |
121 | , iface->guiPart()->appName() ); | 136 | , iface->guiPart()->appName() ); |
122 | } | 137 | } |
123 | 138 | ||
124 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) | 139 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) |
125 | pluginManagement( (*it) ); | 140 | pluginManagement( (*it) ); |
126 | 141 | ||
127 | 142 | ||
128 | TabWidget3->setCurrentTab( tab_2 ); | 143 | TabWidget3->setCurrentTab( tab_2 ); |
129 | } | 144 | } |
130 | 145 | ||
131 | /** | 146 | /** |
132 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 147 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
133 | * If registered against that today ist started on each resume. | 148 | * If registered against that today ist started on each resume. |
134 | */ | 149 | */ |
135 | void TodayConfig::setAutoStart() { | 150 | void TodayConfig::setAutoStart() { |
136 | OConfig cfg( "today" ); | 151 | OConfig cfg( "today" ); |
137 | cfg.setGroup( "Autostart" ); | 152 | cfg.setGroup( "Autostart" ); |
138 | if ( m_autoStart ) { | 153 | if ( m_autoStart ) { |
139 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); | 154 | QCopEnvelope e( "QPE/System", "autoStart(QString,QString,QString)" ); |
140 | e << QString( "add" ); | 155 | e << QString( "add" ); |
141 | e << QString( "today" ); | 156 | e << QString( "today" ); |
142 | e << QString( "%1" ).arg( m_autoStartTimer ); | 157 | e << QString( "%1" ).arg( m_autoStartTimer ); |
143 | } else { | 158 | } else { |
@@ -149,107 +164,107 @@ void TodayConfig::setAutoStart() { | |||
149 | 164 | ||
150 | /** | 165 | /** |
151 | * Read the config part | 166 | * Read the config part |
152 | */ | 167 | */ |
153 | void TodayConfig::readConfig() { | 168 | void TodayConfig::readConfig() { |
154 | OConfig cfg( "today" ); | 169 | OConfig cfg( "today" ); |
155 | cfg.setGroup( "Autostart" ); | 170 | cfg.setGroup( "Autostart" ); |
156 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); | 171 | m_autoStart = cfg.readNumEntry( "autostart", 1 ); |
157 | m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); | 172 | m_guiMisc->CheckBoxAuto->setChecked( m_autoStart ); |
158 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); | 173 | m_autoStartTimer = cfg.readNumEntry( "autostartdelay", 0 ); |
159 | m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); | 174 | m_guiMisc->SpinBoxTime->setValue( m_autoStartTimer ); |
160 | 175 | ||
161 | cfg.setGroup( "General" ); | 176 | cfg.setGroup( "General" ); |
162 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 177 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
163 | m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); | 178 | m_guiMisc->SpinBoxIconSize->setValue( m_iconSize ); |
164 | m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); | 179 | m_guiMisc->SpinRefresh->setValue( cfg.readNumEntry( "checkinterval", 15000 ) / 1000 ); |
165 | m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); | 180 | m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); |
166 | } | 181 | } |
167 | 182 | ||
168 | /** | 183 | /** |
169 | * Write the config part | 184 | * Write the config part |
170 | */ | 185 | */ |
171 | void TodayConfig::writeConfig() { | 186 | void TodayConfig::writeConfig() { |
172 | OConfig cfg( "today" ); | 187 | OConfig cfg( "today" ); |
173 | 188 | ||
174 | int position = m_appletListView->childCount(); | 189 | int position = m_appletListView->childCount(); |
175 | 190 | ||
176 | QListViewItemIterator list_it( m_appletListView ); | 191 | QListViewItemIterator list_it( m_appletListView ); |
177 | OPluginItem::List lst = m_pluginLoader->allAvailable( true ); | 192 | OPluginItem::List lst = m_pluginLoader->allAvailable( true ); |
178 | 193 | ||
179 | // this makes sure the names get saved in the order selected | 194 | // this makes sure the names get saved in the order selected |
180 | for ( ; list_it.current(); ++list_it ) { | 195 | for ( ; list_it.current(); ++list_it ) { |
181 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 196 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
182 | if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) { | 197 | if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) { |
183 | qWarning( "Enabling %d and make it %d", position-1, | 198 | qWarning( "Enabling %d and make it %d", position-1, |
184 | ((QCheckListItem*)list_it.current())->isOn() ); | 199 | ((QCheckListItem*)list_it.current())->isOn() ); |
185 | (*it).setPosition(position--); | 200 | (*it).setPosition(position--); |
186 | m_pluginManager->setEnabled( (*it),((QCheckListItem*)list_it.current())->isOn() ); | 201 | m_pluginManager->setEnabled( (*it),((QCheckListItem*)list_it.current())->isOn() ); |
187 | } | 202 | } |
188 | } | 203 | } |
189 | } | 204 | } |
190 | 205 | ||
191 | /* | 206 | /* |
192 | * save and get the changes back | 207 | * save and get the changes back |
193 | */ | 208 | */ |
194 | m_pluginManager->save(); | 209 | m_pluginManager->save(); |
195 | 210 | ||
196 | cfg.setGroup( "Autostart" ); | 211 | cfg.setGroup( "Autostart" ); |
197 | m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); | 212 | m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); |
198 | cfg.writeEntry( "autostart", m_autoStart ); | 213 | cfg.writeEntry( "autostart", m_autoStart ); |
199 | m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); | 214 | m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); |
200 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); | 215 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); |
201 | m_iconSize = m_guiMisc->SpinBoxIconSize->value(); | 216 | m_iconSize = m_guiMisc->SpinBoxIconSize->value(); |
202 | 217 | ||
203 | cfg.setGroup( "General" ); | 218 | cfg.setGroup( "General" ); |
204 | cfg.writeEntry( "IconSize", m_iconSize ); | 219 | cfg.writeEntry( "IconSize", m_iconSize ); |
205 | cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); | 220 | cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); |
206 | cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); | 221 | cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); |
207 | 222 | ||
208 | // set autostart settings | 223 | // set autostart settings |
209 | setAutoStart(); | 224 | setAutoStart(); |
210 | 225 | ||
211 | OPluginItem::List managedLst = m_pluginManager->managedPlugins(); | 226 | OPluginItem::List managedLst = m_pluginManager->managedPlugins(); |
212 | for ( OPluginItem::List::Iterator it = managedLst.begin(); it != managedLst.end(); ++it ) { | 227 | for ( OPluginItem::List::Iterator it = managedLst.begin(); it != managedLst.end(); ++it ) { |
213 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | 228 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
214 | if ( m_configMap.contains( iface ) ) | 229 | if ( m_configMap.contains( iface ) ) |
215 | m_configMap[iface]->writeConfig(); | 230 | m_configMap[iface]->writeConfig(); |
216 | 231 | ||
217 | } | 232 | } |
218 | } | 233 | } |
219 | 234 | ||
220 | 235 | ||
221 | void TodayConfig::moveSelectedUp() { | 236 | void TodayConfig::moveSelectedUp() { |
222 | QListViewItem *item = m_appletListView->selectedItem(); | 237 | QListViewItem *item = m_appletListView->selectedItem(); |
223 | if ( item && item->itemAbove() ) { | 238 | if ( item && item->itemAbove() ) { |
224 | item->itemAbove()->moveItem( item ); | 239 | item->itemAbove()->moveItem( item ); |
225 | } | 240 | } |
226 | } | 241 | } |
227 | 242 | ||
228 | 243 | ||
229 | void TodayConfig::moveSelectedDown() { | 244 | void TodayConfig::moveSelectedDown() { |
230 | QListViewItem *item = m_appletListView->selectedItem(); | 245 | QListViewItem *item = m_appletListView->selectedItem(); |
231 | if ( item && item->itemBelow() ) { | 246 | if ( item && item->itemBelow() ) { |
232 | item->moveItem( item->itemBelow() ); | 247 | item->moveItem( item->itemBelow() ); |
233 | } | 248 | } |
234 | } | 249 | } |
235 | 250 | ||
236 | 251 | ||
237 | /** | 252 | /** |
238 | * Set up the icons in the order/active tab | 253 | * Set up the icons in the order/active tab |
239 | */ | 254 | */ |
240 | void TodayConfig::pluginManagement( OPluginItem plugItem ) { | 255 | void TodayConfig::pluginManagement( OPluginItem plugItem ) { |
241 | 256 | ||
242 | QCheckListItem *item = new QCheckListItem( m_appletListView, plugItem.name(), QCheckListItem::CheckBox ); | 257 | QCheckListItem *item = new QCheckListItem( m_appletListView, plugItem.name(), QCheckListItem::CheckBox ); |
243 | 258 | ||
244 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( plugItem, IID_TodayPluginInterface ); | 259 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( plugItem, IID_TodayPluginInterface ); |
245 | QPixmap icon = Resource::loadPixmap( iface->guiPart()->pixmapNameWidget() ); | 260 | QPixmap icon = Opie::Core::OResource::loadPixmap( iface->guiPart()->pixmapNameWidget(), Opie::Core::OResource::SmallIcon ); |
246 | if ( !icon.isNull() ) { | 261 | if ( !icon.isNull() ) { |
247 | item->setPixmap( 0, icon ); | 262 | item->setPixmap( 0, icon ); |
248 | } | 263 | } |
249 | item->setOn( plugItem.isEnabled() ); | 264 | item->setOn( plugItem.isEnabled() ); |
250 | previousItem = item; | 265 | previousItem = item; |
251 | } | 266 | } |
252 | 267 | ||
253 | 268 | ||
254 | 269 | ||
255 | TodayConfig::~TodayConfig() {} | 270 | TodayConfig::~TodayConfig() {} |
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h index 81120d3..d467996 100644 --- a/core/pim/today/todayconfig.h +++ b/core/pim/today/todayconfig.h | |||
@@ -1,89 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | * todayconfig.h | 2 | Â Â Â Â Â Â Â Â This file is part of the Opie Project |
3 | * | 3 | |
4 | * copyright : (c) 2002,2003, 2004 by Maximilian Reiß | 4 | Copyright (C) Maximilian Reiss <harlekin@handhelds.org> |
5 | * email : harlekin@handhelds.org | 5 | =. |
6 | * | 6 | .=l. |
7 | */ | 7 | Â Â Â Â Â Â .>+-= |
8 | /*************************************************************************** | 8 | Â _;:, Â Â .> Â Â :=|. This program is free software; you can |
9 | * * | 9 | .> <`_, Â > Â . Â <= redistribute it and/or modify it under |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | :`=1 )Y*s>-.-- Â : the terms of the GNU Library General Public |
11 | * it under the terms of the GNU General Public License as published by * | 11 | .="- .-=="i, Â Â .._ License as published by the Free Software |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | Â - . Â .-<_> Â Â .<> Foundation; either version 2 of the License, |
13 | * (at your option) any later version. * | 13 | Â Â Â ._= =} Â Â Â : or (at your option) any later version. |
14 | * * | 14 | Â Â .%`+i> Â Â Â _;_. |
15 | ***************************************************************************/ | 15 | Â Â .i_,=:_. Â Â Â -<s. This program is distributed in the hope that |
16 | Â Â Â + Â . Â -:. Â Â Â = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | Â Â : .. Â Â .:, Â Â . . . without even the implied warranty of | ||
18 | Â Â =_ Â Â Â Â + Â Â =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | Â _.=:. Â Â Â : Â Â :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= Â Â Â = Â Â Â ; Library General Public License for more | ||
21 | ++= Â -. Â Â .` Â Â .: details. | ||
22 | Â : Â Â = Â ...= . :.=- | ||
23 | Â -. Â .:....=;==+<; You should have received a copy of the GNU | ||
24 | Â -_. . . Â )=. Â = Library General Public License along with | ||
25 | Â Â -- Â Â Â Â :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | */ | ||
16 | 30 | ||
17 | #ifndef TODAYCONFIG_H | 31 | #ifndef TODAYCONFIG_H |
18 | #define TODAYCONFIG_H | 32 | #define TODAYCONFIG_H |
19 | 33 | ||
20 | #include "todayconfigmiscbase.h" | 34 | #include "todayconfigmiscbase.h" |
21 | 35 | ||
22 | #include <opie2/otabwidget.h> | 36 | #include <opie2/otabwidget.h> |
23 | #include <opie2/opluginloader.h> | 37 | #include <opie2/opluginloader.h> |
24 | 38 | ||
25 | #include <qvariant.h> | 39 | #include <qvariant.h> |
26 | #include <qdialog.h> | 40 | #include <qdialog.h> |
27 | #include <qlistview.h> | 41 | #include <qlistview.h> |
28 | 42 | ||
29 | class QCheckBox; | 43 | class QCheckBox; |
30 | class QLabel; | 44 | class QLabel; |
31 | class QSpinBox; | 45 | class QSpinBox; |
32 | class QTabWidget; | 46 | class QTabWidget; |
33 | class TodayConfigWidget; | 47 | class TodayConfigWidget; |
34 | class TodayPluginInterface; | 48 | class TodayPluginInterface; |
35 | 49 | ||
36 | namespace Opie { | 50 | namespace Opie { |
37 | namespace Core { | 51 | namespace Core { |
38 | class OPluginManager; | 52 | class OPluginManager; |
39 | class OPluginLoader; | 53 | class OPluginLoader; |
40 | class OPluginItem; | 54 | class OPluginItem; |
41 | } | 55 | } |
42 | } | 56 | } |
43 | 57 | ||
44 | class TodayConfig : public QDialog { | 58 | class TodayConfig : public QDialog { |
45 | Q_OBJECT | 59 | Q_OBJECT |
46 | 60 | ||
47 | public: | 61 | public: |
48 | TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE ); | 62 | TodayConfig( QWidget* parent = 0, const char* name = 0, bool modal = FALSE ); |
49 | ~TodayConfig(); | 63 | ~TodayConfig(); |
50 | 64 | ||
51 | Opie::Ui::OTabWidget* TabWidget3; | 65 | Opie::Ui::OTabWidget* TabWidget3; |
52 | 66 | ||
53 | void writeConfig(); | 67 | void writeConfig(); |
54 | 68 | ||
55 | void setUpPlugins( Opie::Core::OPluginManager * plugManager, Opie::Core::OPluginLoader * plugLoader ); | 69 | void setUpPlugins( Opie::Core::OPluginManager * plugManager, Opie::Core::OPluginLoader * plugLoader ); |
56 | 70 | ||
57 | protected slots: | 71 | protected slots: |
58 | void moveSelectedUp(); | 72 | void moveSelectedUp(); |
59 | void moveSelectedDown(); | 73 | void moveSelectedDown(); |
60 | 74 | ||
61 | private: | 75 | private: |
62 | void setAutoStart(); | 76 | void setAutoStart(); |
63 | void readConfig(); | 77 | void readConfig(); |
64 | void pluginManagement( Opie::Core::OPluginItem plugItem); | 78 | void pluginManagement( Opie::Core::OPluginItem plugItem); |
65 | 79 | ||
66 | QListView* m_appletListView; | 80 | QListView* m_appletListView; |
67 | QMap<QString,QCheckListItem*> m_applets; | 81 | QMap<QString,QCheckListItem*> m_applets; |
68 | QMap<TodayPluginInterface*,TodayConfigWidget*> m_configMap; | 82 | QMap<TodayPluginInterface*,TodayConfigWidget*> m_configMap; |
69 | 83 | ||
70 | int m_autoStart; | 84 | int m_autoStart; |
71 | int m_autoStartTimer; | 85 | int m_autoStartTimer; |
72 | int m_iconSize; | 86 | int m_iconSize; |
73 | QStringList m_excludeApplets; | 87 | QStringList m_excludeApplets; |
74 | bool m_applets_changed; | 88 | bool m_applets_changed; |
75 | 89 | ||
76 | QWidget* tab_2; | 90 | QWidget* tab_2; |
77 | QWidget* tab_3; | 91 | QWidget* tab_3; |
78 | QLabel* TextLabel1, *TextLabel4; | 92 | QLabel* TextLabel1, *TextLabel4; |
79 | QSpinBox* SpinBox7; | 93 | QSpinBox* SpinBox7; |
80 | 94 | ||
81 | Opie::Core::OPluginManager *m_pluginManager; | 95 | Opie::Core::OPluginManager *m_pluginManager; |
82 | Opie::Core::OPluginLoader *m_pluginLoader; | 96 | Opie::Core::OPluginLoader *m_pluginLoader; |
83 | 97 | ||
84 | QCheckListItem *previousItem; | 98 | QCheckListItem *previousItem; |
85 | 99 | ||
86 | TodayConfigMiscBase *m_guiMisc; | 100 | TodayConfigMiscBase *m_guiMisc; |
87 | }; | 101 | }; |
88 | 102 | ||
89 | #endif | 103 | #endif |