-rw-r--r-- | libopie2/opiecore/opluginloader.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opiecore/opluginloader.cpp b/libopie2/opiecore/opluginloader.cpp index c2dc239..3d286e5 100644 --- a/libopie2/opiecore/opluginloader.cpp +++ b/libopie2/opiecore/opluginloader.cpp | |||
@@ -193,65 +193,65 @@ bool OPluginItem::isEnabled()const { | |||
193 | return m_enabled; | 193 | return m_enabled; |
194 | } | 194 | } |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * \brief return the position of a plugin. | 197 | * \brief return the position of a plugin. |
198 | * return the position of the item | 198 | * return the position of the item |
199 | * -1 is the default value and means normally that the whole items are unsorted. | 199 | * -1 is the default value and means normally that the whole items are unsorted. |
200 | * Higher numbers belong to an upper position. With plugins with the postions 20,19,5,3 | 200 | * Higher numbers belong to an upper position. With plugins with the postions 20,19,5,3 |
201 | * the item with pos 20 would be the first in the list returned by the OGenericPluginLoader | 201 | * the item with pos 20 would be the first in the list returned by the OGenericPluginLoader |
202 | * | 202 | * |
203 | * @see OGenericPluginLoader::allAvailable | 203 | * @see OGenericPluginLoader::allAvailable |
204 | * @see OGenericPluginLoader::filtered | 204 | * @see OGenericPluginLoader::filtered |
205 | */ | 205 | */ |
206 | int OPluginItem::position()const{ | 206 | int OPluginItem::position()const{ |
207 | return m_pos; | 207 | return m_pos; |
208 | } | 208 | } |
209 | 209 | ||
210 | /** | 210 | /** |
211 | * \brief set the name of a plugin | 211 | * \brief set the name of a plugin |
212 | * Set the name of the Plugin Item | 212 | * Set the name of the Plugin Item |
213 | * @param name | 213 | * @param name |
214 | */ | 214 | */ |
215 | void OPluginItem::setName( const QString& name ) { | 215 | void OPluginItem::setName( const QString& name ) { |
216 | m_name = name; | 216 | m_name = name; |
217 | } | 217 | } |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * \brief set the path of a plugin | 220 | * \brief set the path of a plugin |
221 | * Set the path of Plugin Item. The path must be absolute. | 221 | * Set the path of Plugin Item. The path must be absolute. |
222 | * @param name The path of the plugin | 222 | * @param name The path of the plugin |
223 | */ | 223 | */ |
224 | void OPluginItem::setPath( const QString& name ) { | 224 | void OPluginItem::setPath( const QString& name ) { |
225 | m_name = name; | 225 | m_path = name; |
226 | } | 226 | } |
227 | 227 | ||
228 | /** | 228 | /** |
229 | * \brief enable or disable the to load attribute | 229 | * \brief enable or disable the to load attribute |
230 | * Set the Enabled attribute. Such changes won't be saved. If you want to save it | 230 | * Set the Enabled attribute. Such changes won't be saved. If you want to save it |
231 | * use a OPluginManager to configure your plugins manually or Opie::Ui::OPluginConfig | 231 | * use a OPluginManager to configure your plugins manually or Opie::Ui::OPluginConfig |
232 | * for a graphical frontend. | 232 | * for a graphical frontend. |
233 | * | 233 | * |
234 | * @param enabled Enable or Disable the Enabled Attribute | 234 | * @param enabled Enable or Disable the Enabled Attribute |
235 | */ | 235 | */ |
236 | void OPluginItem::setEnabled( bool enabled ) { | 236 | void OPluginItem::setEnabled( bool enabled ) { |
237 | m_enabled = enabled; | 237 | m_enabled = enabled; |
238 | } | 238 | } |
239 | 239 | ||
240 | /** | 240 | /** |
241 | * \brief Set the position. | 241 | * \brief Set the position. |
242 | * Set the position | 242 | * Set the position |
243 | * @param pos The position | 243 | * @param pos The position |
244 | * | 244 | * |
245 | * @see position() | 245 | * @see position() |
246 | */ | 246 | */ |
247 | void OPluginItem::setPosition( int pos ) { | 247 | void OPluginItem::setPosition( int pos ) { |
248 | m_pos = pos; | 248 | m_pos = pos; |
249 | } | 249 | } |
250 | 250 | ||
251 | 251 | ||
252 | 252 | ||
253 | /** | 253 | /** |
254 | * \brief create a PluginLoader | 254 | * \brief create a PluginLoader |
255 | * | 255 | * |
256 | * Create a PluginLoader autoDelete is set to false | 256 | * Create a PluginLoader autoDelete is set to false |
257 | * | 257 | * |
@@ -794,65 +794,65 @@ void OPluginManager::load() { | |||
794 | if ( m_loader ) | 794 | if ( m_loader ) |
795 | m_plugins = m_loader->allAvailable( m_loader->isSorted() ); | 795 | m_plugins = m_loader->allAvailable( m_loader->isSorted() ); |
796 | 796 | ||
797 | /* fast and normal route if we did not crash... */ | 797 | /* fast and normal route if we did not crash... */ |
798 | if ( crashedPath.isEmpty() ) | 798 | if ( crashedPath.isEmpty() ) |
799 | return; | 799 | return; |
800 | 800 | ||
801 | /* lets try to find the plugin path and this way the associated item */ | 801 | /* lets try to find the plugin path and this way the associated item */ |
802 | for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) | 802 | for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) |
803 | if ( (*it).path() == crashedPath ) { | 803 | if ( (*it).path() == crashedPath ) { |
804 | m_crashed = *it; | 804 | m_crashed = *it; |
805 | break; | 805 | break; |
806 | } | 806 | } |
807 | } | 807 | } |
808 | 808 | ||
809 | 809 | ||
810 | /** | 810 | /** |
811 | * \brief Save the values and this way make it available. | 811 | * \brief Save the values and this way make it available. |
812 | * | 812 | * |
813 | * Save the current set of data. A call to @see OGenericPluginLoader::filtered | 813 | * Save the current set of data. A call to @see OGenericPluginLoader::filtered |
814 | * now would return your saved changes. | 814 | * now would return your saved changes. |
815 | */ | 815 | */ |
816 | void OPluginManager::save() { | 816 | void OPluginManager::save() { |
817 | QMap<QString, QStringList> excluded; // map for path to excluded name | 817 | QMap<QString, QStringList> excluded; // map for path to excluded name |
818 | QMap<QString, QStringList> positions; // if positions matter contains splitted up by dirs | 818 | QMap<QString, QStringList> positions; // if positions matter contains splitted up by dirs |
819 | bool sorted = m_loader ? m_loader->isSorted() : m_isSorted; | 819 | bool sorted = m_loader ? m_loader->isSorted() : m_isSorted; |
820 | 820 | ||
821 | /* | 821 | /* |
822 | * We will create some maps for the groups to include positions a | 822 | * We will create some maps for the groups to include positions a |
823 | */ | 823 | */ |
824 | for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) { | 824 | for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) { |
825 | OPluginItem item = *it; | 825 | OPluginItem item = *it; |
826 | QString path = QFileInfo( item.path() ).filePath(); | 826 | QString path = QFileInfo( item.path() ).dirPath(true); |
827 | if ( sorted ) { | 827 | if ( sorted ) { |
828 | positions[path].append( item.name() ); | 828 | positions[path].append( item.name() ); |
829 | positions[path].append( QString::number( item.position() ) ); | 829 | positions[path].append( QString::number( item.position() ) ); |
830 | } | 830 | } |
831 | 831 | ||
832 | if ( !item.isEnabled() ) | 832 | if ( !item.isEnabled() ) |
833 | excluded[path].append( item.name() ); | 833 | excluded[path].append( item.name() ); |
834 | } | 834 | } |
835 | 835 | ||
836 | /* | 836 | /* |
837 | * The code below wouldn't work because we can't delete groups/keys from the config | 837 | * The code below wouldn't work because we can't delete groups/keys from the config |
838 | * ### for ODP make Config right! | 838 | * ### for ODP make Config right! |
839 | */ | 839 | */ |
840 | // if ( excluded.isEmpty() && positions.isEmpty() ) return; | 840 | // if ( excluded.isEmpty() && positions.isEmpty() ) return; |
841 | /* | 841 | /* |
842 | * Now safe for each path | 842 | * Now safe for each path |
843 | */ | 843 | */ |
844 | OConfig cfg( configName() ); | 844 | OConfig cfg( configName() ); |
845 | 845 | ||
846 | /* safe excluded items */ | 846 | /* safe excluded items */ |
847 | for ( QMap<QString, QStringList>::Iterator it = excluded.begin(); it != excluded.end(); ++it ) { | 847 | for ( QMap<QString, QStringList>::Iterator it = excluded.begin(); it != excluded.end(); ++it ) { |
848 | OConfigGroupSaver saver( &cfg, it.key() ); | 848 | OConfigGroupSaver saver( &cfg, it.key() ); |
849 | cfg.writeEntry("Excluded", it.data(), ',' ); | 849 | cfg.writeEntry("Excluded", it.data(), ',' ); |
850 | } | 850 | } |
851 | 851 | ||
852 | /* safe positions we could also see if positions.contains(path) and remove/write in the above loop | 852 | /* safe positions we could also see if positions.contains(path) and remove/write in the above loop |
853 | * ### Write a Test Suite that can profile these runs... | 853 | * ### Write a Test Suite that can profile these runs... |
854 | */ | 854 | */ |
855 | for ( QMap<QString, QStringList>::Iterator it = positions.begin(); it != positions.end(); ++it ) { | 855 | for ( QMap<QString, QStringList>::Iterator it = positions.begin(); it != positions.end(); ++it ) { |
856 | OConfigGroupSaver saver( &cfg, it.key() ); | 856 | OConfigGroupSaver saver( &cfg, it.key() ); |
857 | cfg.writeEntry("Positions", it.data(), '.' ); | 857 | cfg.writeEntry("Positions", it.data(), '.' ); |
858 | } | 858 | } |