Diffstat (limited to 'core/pim/today/todayconfig.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/today/todayconfig.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index c9823d4..dacce8b 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp | |||
@@ -87,52 +87,53 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) | |||
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() ) ); | 96 | connect ( m_appletListView , SIGNAL( clicked(QListViewItem*) ), this, SLOT( appletChanged() ) ); |
97 | previousItem = 0l; | 97 | previousItem = 0l; |
98 | readConfig(); | 98 | readConfig(); |
99 | QPEApplication::showDialog( this ); | ||
100 | } | 99 | } |
101 | 100 | ||
102 | 101 | ||
103 | void TodayConfig::setUpPlugins( OPluginManager * plugManager, OPluginLoader *plugLoader ) { | 102 | void TodayConfig::setUpPlugins( OPluginManager * plugManager, OPluginLoader *plugLoader ) { |
104 | 103 | m_configMap.clear(); | |
105 | 104 | ||
106 | m_pluginManager = plugManager; | 105 | m_pluginManager = plugManager; |
107 | m_pluginLoader = plugLoader; | 106 | m_pluginLoader = plugLoader; |
108 | 107 | ||
109 | OPluginItem::List inLst = m_pluginLoader->allAvailable( true ); | 108 | OPluginItem::List inLst = m_pluginLoader->allAvailable( true ); |
110 | 109 | ||
111 | OPluginItem::List lst; | 110 | OPluginItem::List lst; |
112 | for ( OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { | 111 | for ( OPluginItem::List::Iterator it = inLst.begin(); it != inLst.end(); ++it ) { |
113 | lst.prepend((*it)); | 112 | lst.prepend((*it)); |
114 | 113 | ||
115 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | 114 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
115 | TodayConfigWidget *widget = iface->guiPart()->configWidget( TabWidget3 ); | ||
116 | 116 | ||
117 | if ( iface->guiPart()->configWidget(this) != 0l ) { | 117 | if (!widget ) |
118 | TodayConfigWidget* widget = iface->guiPart()->configWidget( TabWidget3 ); | 118 | continue; |
119 | TabWidget3->addTab( widget, iface->guiPart()->pixmapNameConfig() | 119 | |
120 | , iface->guiPart()->appName() ); | 120 | m_configMap.insert( iface, widget ); |
121 | } | 121 | TabWidget3->addTab( widget, iface->guiPart()->pixmapNameConfig() |
122 | , iface->guiPart()->appName() ); | ||
122 | } | 123 | } |
123 | 124 | ||
124 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 125 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) |
125 | pluginManagement( (*it) ); | 126 | pluginManagement( (*it) ); |
126 | } | 127 | |
127 | 128 | ||
128 | TabWidget3->setCurrentTab( tab_2 ); | 129 | TabWidget3->setCurrentTab( tab_2 ); |
129 | } | 130 | } |
130 | 131 | ||
131 | /** | 132 | /** |
132 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 133 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
133 | * If registered against that today ist started on each resume. | 134 | * If registered against that today ist started on each resume. |
134 | */ | 135 | */ |
135 | void TodayConfig::setAutoStart() { | 136 | void TodayConfig::setAutoStart() { |
136 | OConfig cfg( "today" ); | 137 | OConfig cfg( "today" ); |
137 | cfg.setGroup( "Autostart" ); | 138 | cfg.setGroup( "Autostart" ); |
138 | if ( m_autoStart ) { | 139 | if ( m_autoStart ) { |
@@ -165,28 +166,28 @@ void TodayConfig::readConfig() { | |||
165 | m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); | 166 | m_guiMisc->CheckBoxHide->setChecked( cfg.readNumEntry( "HideBanner", 0 ) ); |
166 | } | 167 | } |
167 | 168 | ||
168 | /** | 169 | /** |
169 | * Write the config part | 170 | * Write the config part |
170 | */ | 171 | */ |
171 | void TodayConfig::writeConfig() { | 172 | void TodayConfig::writeConfig() { |
172 | OConfig cfg( "today" ); | 173 | OConfig cfg( "today" ); |
173 | 174 | ||
174 | int position = m_appletListView->childCount(); | 175 | int position = m_appletListView->childCount(); |
175 | 176 | ||
176 | QListViewItemIterator list_it( m_appletListView ); | 177 | QListViewItemIterator list_it( m_appletListView ); |
177 | // | 178 | OPluginItem::List lst = m_pluginLoader->allAvailable( true ); |
179 | |||
178 | // this makes sure the names get saved in the order selected | 180 | // this makes sure the names get saved in the order selected |
179 | for ( ; list_it.current(); ++list_it ) { | 181 | for ( ; list_it.current(); ++list_it ) { |
180 | OPluginItem::List lst = m_pluginLoader->allAvailable( true ); | ||
181 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 182 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
182 | if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) { | 183 | if ( QString::compare( (*it).name() , list_it.current()->text(0) ) == 0 ) { |
183 | (*it).setPosition(position--); | 184 | (*it).setPosition(position--); |
184 | m_pluginManager->setEnabled( (*it),((QCheckListItem*)list_it.current())->isOn() ); | 185 | m_pluginManager->setEnabled( (*it),((QCheckListItem*)list_it.current())->isOn() ); |
185 | } | 186 | } |
186 | } | 187 | } |
187 | } | 188 | } |
188 | 189 | ||
189 | m_pluginManager->save(); | 190 | m_pluginManager->save(); |
190 | 191 | ||
191 | cfg.setGroup( "Autostart" ); | 192 | cfg.setGroup( "Autostart" ); |
192 | m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); | 193 | m_autoStart = m_guiMisc->CheckBoxAuto->isChecked(); |
@@ -194,30 +195,29 @@ void TodayConfig::writeConfig() { | |||
194 | m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); | 195 | m_autoStartTimer = m_guiMisc->SpinBoxTime->value(); |
195 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); | 196 | cfg.writeEntry( "autostartdelay", m_autoStartTimer ); |
196 | m_iconSize = m_guiMisc->SpinBoxIconSize->value(); | 197 | m_iconSize = m_guiMisc->SpinBoxIconSize->value(); |
197 | 198 | ||
198 | cfg.setGroup( "General" ); | 199 | cfg.setGroup( "General" ); |
199 | cfg.writeEntry( "IconSize", m_iconSize ); | 200 | cfg.writeEntry( "IconSize", m_iconSize ); |
200 | cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); | 201 | cfg.writeEntry( "HideBanner", m_guiMisc->CheckBoxHide->isChecked() ); |
201 | cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); | 202 | cfg.writeEntry( "checkinterval", m_guiMisc->SpinRefresh->value()*1000 ); |
202 | 203 | ||
203 | // set autostart settings | 204 | // set autostart settings |
204 | setAutoStart(); | 205 | setAutoStart(); |
205 | 206 | ||
206 | OPluginItem::List lst = m_pluginManager->managedPlugins(); | 207 | OPluginItem::List managedLst = m_pluginManager->managedPlugins(); |
207 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 208 | for ( OPluginItem::List::Iterator it = managedLst.begin(); it != managedLst.end(); ++it ) { |
208 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | 209 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
209 | if ( iface->guiPart()->configWidget(this) != 0l ) { | 210 | if ( m_configMap.contains( iface ) ) |
210 | iface->guiPart()->configWidget(this)->writeConfig(); | 211 | m_configMap[iface]->writeConfig(); |
211 | } | ||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | void TodayConfig::moveSelectedUp() { | 216 | void TodayConfig::moveSelectedUp() { |
217 | QListViewItem *item = m_appletListView->selectedItem(); | 217 | QListViewItem *item = m_appletListView->selectedItem(); |
218 | if ( item && item->itemAbove() ) { | 218 | if ( item && item->itemAbove() ) { |
219 | item->itemAbove()->moveItem( item ); | 219 | item->itemAbove()->moveItem( item ); |
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||