author | harlekin <harlekin> | 2002-09-20 20:19:14 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-20 20:19:14 (UTC) |
commit | d2d73b6391fbc7f743199f48387d13e887bbac1e (patch) (unidiff) | |
tree | 7f289628796ee4bf0bf1f32d952b5455a42b17bd /core/pim/today/today.cpp | |
parent | 681e6e75efaa5577d376d0bb191afdf323cb4e75 (diff) | |
download | opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.zip opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.tar.gz opie-d2d73b6391fbc7f743199f48387d13e887bbac1e.tar.bz2 |
fixed the crash when closing config dialog and also sorting of the plugins is working now
-rw-r--r-- | core/pim/today/today.cpp | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 7537631..d8b427d 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -110,12 +110,8 @@ void Today::setOwnerField( QString &message ) { | |||
110 | void Today::init() { | 110 | void Today::init() { |
111 | |||
112 | QDate date = QDate::currentDate(); | ||
113 | QString time = ( tr( date.toString() ) ); | ||
114 | |||
115 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | ||
116 | |||
117 | // read config | 111 | // read config |
118 | Config cfg( "today" ); | 112 | Config cfg( "today" ); |
119 | cfg.setGroup( "Applets" ); | 113 | cfg.setGroup( "Plugins" ); |
114 | |||
120 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 115 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
116 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | ||
121 | } | 117 | } |
@@ -135,3 +131,2 @@ void Today::loadPlugins() { | |||
135 | 131 | ||
136 | |||
137 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 132 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
@@ -142,2 +137,5 @@ void Today::loadPlugins() { | |||
142 | 137 | ||
138 | |||
139 | QMap<QString, TodayPlugin> tempList; | ||
140 | |||
143 | for ( it = list.begin(); it != list.end(); ++it ) { | 141 | for ( it = list.begin(); it != list.end(); ++it ) { |
@@ -166,8 +164,6 @@ void Today::loadPlugins() { | |||
166 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 164 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
167 | |||
168 | QPixmap plugPix; | 165 | QPixmap plugPix; |
169 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); | 166 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); |
170 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 167 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
171 | plugIcon->setPixmap( plugPix ); | 168 | plugIcon->setPixmap( plugPix ); |
172 | |||
173 | // a scrollview for each plugin | 169 | // a scrollview for each plugin |
@@ -180,3 +176,2 @@ void Today::loadPlugins() { | |||
180 | sv->addChild( plugWidget ); | 176 | sv->addChild( plugWidget ); |
181 | |||
182 | // make sure the icon is on the top alligned | 177 | // make sure the icon is on the top alligned |
@@ -186,5 +181,10 @@ void Today::loadPlugins() { | |||
186 | boxLayout->setStretchFactor( sv, 9 ); | 181 | boxLayout->setStretchFactor( sv, 9 ); |
187 | layout->addWidget( plugin.guiBox ); | 182 | // "prebuffer" it in one more list, to get the sorting done |
183 | tempList.insert( plugin.name, plugin ); | ||
188 | 184 | ||
189 | pluginList.append( plugin ); | 185 | // on first start the list is off course empty |
186 | if ( m_allApplets.isEmpty() ) { | ||
187 | layout->addWidget( plugin.guiBox ); | ||
188 | pluginList.append( plugin ); | ||
189 | } | ||
190 | } else { | 190 | } else { |
@@ -194,2 +194,14 @@ void Today::loadPlugins() { | |||
194 | } | 194 | } |
195 | |||
196 | if ( !m_allApplets.isEmpty() ) { | ||
197 | TodayPlugin tempPlugin; | ||
198 | QStringList::Iterator stringit; | ||
199 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | ||
200 | tempPlugin = ( tempList.find( *stringit ) ).data(); | ||
201 | if ( !( (tempPlugin.name).isEmpty() ) ) { | ||
202 | layout->addWidget( tempPlugin.guiBox ); | ||
203 | pluginList.append( tempPlugin ); | ||
204 | } | ||
205 | } | ||
206 | } | ||
195 | } | 207 | } |
@@ -229,4 +241,3 @@ void Today::draw() { | |||
229 | } | 241 | } |
230 | //layout->addStretch(0); | 242 | layout->addStretch(0); |
231 | //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | ||
232 | } | 243 | } |
@@ -243,3 +254,4 @@ void Today::startConfig() { | |||
243 | QList<ConfigWidget> configWidgetList; | 254 | QList<ConfigWidget> configWidgetList; |
244 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 255 | |
256 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | ||
245 | plugin = pluginList[i]; | 257 | plugin = pluginList[i]; |
@@ -248,3 +260,3 @@ void Today::startConfig() { | |||
248 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 260 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
249 | ConfigWidget* widget = plugin.guiPart->configWidget( this ); | 261 | ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
250 | configWidgetList.append( widget ); | 262 | configWidgetList.append( widget ); |
@@ -276,2 +288,8 @@ void Today::refresh() { | |||
276 | 288 | ||
289 | // set the date in top label | ||
290 | QDate date = QDate::currentDate(); | ||
291 | QString time = ( tr( date.toString() ) ); | ||
292 | |||
293 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | ||
294 | |||
277 | if ( layout ) { | 295 | if ( layout ) { |