summaryrefslogtreecommitdiff
path: root/core/pim/today/todayconfig.cpp
authorzecke <zecke>2004-09-12 23:56:54 (UTC)
committer zecke <zecke>2004-09-12 23:56:54 (UTC)
commit848be27ce441430b6946221cd288ff9d6297096c (patch) (unidiff)
tree1ff3d0bad98bee9d5dd0ff70f3eedd5484e25ab6 /core/pim/today/todayconfig.cpp
parentdf292cd5dbd8f3c11efa06db1a2ed565a6efa9b8 (diff)
downloadopie-848be27ce441430b6946221cd288ff9d6297096c.zip
opie-848be27ce441430b6946221cd288ff9d6297096c.tar.gz
opie-848be27ce441430b6946221cd288ff9d6297096c.tar.bz2
-Refactor loading of the Plugin Widgets' to be only contained
in one place. -Reload the Plugins after configuration to reflect the changes immediately
Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/todayconfig.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index dacce8b..864c708 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -84,25 +84,24 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
84 tab2Layout->addWidget( hbox1 ); 84 tab2Layout->addWidget( hbox1 );
85 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) ); 85 TabWidget3->addTab( tab_2, "pass", tr( "active/order" ) );
86 86
87 // Misc tab 87 // Misc tab
88 tab_3 = new QWidget( TabWidget3, "tab_3" ); 88 tab_3 = new QWidget( TabWidget3, "tab_3" );
89 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 ); 89 QVBoxLayout *tab3Layout = new QVBoxLayout( tab_3 );
90 90
91 m_guiMisc = new TodayConfigMiscBase( tab_3 ); 91 m_guiMisc = new TodayConfigMiscBase( tab_3 );
92 92
93 tab3Layout->addWidget( m_guiMisc ); 93 tab3Layout->addWidget( m_guiMisc );
94 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); 94 TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) );
95 95
96 connect ( m_appletListView , SIGNAL( clicked(QListViewItem*) ), this, SLOT( appletChanged() ) );
97 previousItem = 0l; 96 previousItem = 0l;
98 readConfig(); 97 readConfig();
99} 98}
100 99
101 100
102void TodayConfig::setUpPlugins( OPluginManager * plugManager, OPluginLoader *plugLoader ) { 101void TodayConfig::setUpPlugins( OPluginManager * plugManager, OPluginLoader *plugLoader ) {
103 m_configMap.clear(); 102 m_configMap.clear();
104 103
105 m_pluginManager = plugManager; 104 m_pluginManager = plugManager;
106 m_pluginLoader = plugLoader; 105 m_pluginLoader = plugLoader;
107 106
108 OPluginItem::List inLst = m_pluginLoader->allAvailable( true ); 107 OPluginItem::List inLst = m_pluginLoader->allAvailable( true );
@@ -172,52 +171,58 @@ void TodayConfig::readConfig() {
172void TodayConfig::writeConfig() { 171void TodayConfig::writeConfig() {
173 OConfig cfg( "today" ); 172 OConfig cfg( "today" );
174 173
175 int position = m_appletListView->childCount(); 174 int position = m_appletListView->childCount();
176 175
177 QListViewItemIterator list_it( m_appletListView ); 176 QListViewItemIterator list_it( m_appletListView );
178 OPluginItem::List lst = m_pluginLoader->allAvailable( true ); 177 OPluginItem::List lst = m_pluginLoader->allAvailable( true );
179 178
180 // this makes sure the names get saved in the order selected 179 // this makes sure the names get saved in the order selected
181 for ( ; list_it.current(); ++list_it ) { 180 for ( ; list_it.current(); ++list_it ) {
182 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { 181 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
183 if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) { 182 if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) {
183 qWarning( "Enabling %d and make it %d", position-1,
184 ((QCheckListItem*)list_it.current())->isOn() );
184 (*it).setPosition(position--); 185 (*it).setPosition(position--);
185 m_pluginManager->setEnabled( (*it),((QCheckListItem*)list_it.current())->isOn() ); 186 m_pluginManager->setEnabled( (*it),((QCheckListItem*)list_it.current())->isOn() );
186 } 187 }
187 } 188 }
188 } 189 }
189 190
191 /*
192 * save and get the changes back
193 */
190 m_pluginManager->save(); 194 m_pluginManager->save();
191 195
192 cfg.setGroup( "Autostart" ); 196 cfg.setGroup( "Autostart" );
193 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); 197 m_autoStart = m_guiMisc->CheckBoxAuto->isChecked();
194 cfg.writeEntry( "autostart", m_autoStart ); 198 cfg.writeEntry( "autostart", m_autoStart );
195 m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); 199 m_autoStartTimer = m_guiMisc->SpinBoxTime->value();
196 cfg.writeEntry( "autostartdelay", m_autoStartTimer ); 200 cfg.writeEntry( "autostartdelay", m_autoStartTimer );
197 m_iconSize = m_guiMisc->SpinBoxIconSize->value(); 201 m_iconSize = m_guiMisc->SpinBoxIconSize->value();
198 202
199 cfg.setGroup( "General" ); 203 cfg.setGroup( "General" );
200 cfg.writeEntry( "IconSize", m_iconSize ); 204 cfg.writeEntry( "IconSize", m_iconSize );
201 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); 205 cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() );
202 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); 206 cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 );
203 207
204 // set autostart settings 208 // set autostart settings
205 setAutoStart(); 209 setAutoStart();
206 210
207 OPluginItem::List managedLst = m_pluginManager->managedPlugins(); 211 OPluginItem::List managedLst = m_pluginManager->managedPlugins();
208 for ( OPluginItem::List::Iterator it = managedLst.begin(); it != managedLst.end(); ++it ) { 212 for ( OPluginItem::List::Iterator it = managedLst.begin(); it != managedLst.end(); ++it ) {
209 TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); 213 TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface );
210 if ( m_configMap.contains( iface ) ) 214 if ( m_configMap.contains( iface ) )
211 m_configMap[iface]->writeConfig(); 215 m_configMap[iface]->writeConfig();
216
212 } 217 }
213} 218}
214 219
215 220
216void TodayConfig::moveSelectedUp() { 221void TodayConfig::moveSelectedUp() {
217 QListViewItem *item = m_appletListView->selectedItem(); 222 QListViewItem *item = m_appletListView->selectedItem();
218 if ( item && item->itemAbove() ) { 223 if ( item && item->itemAbove() ) {
219 item->itemAbove()->moveItem( item ); 224 item->itemAbove()->moveItem( item );
220 } 225 }
221} 226}
222 227
223 228