summaryrefslogtreecommitdiff
authorharlekin <harlekin>2004-05-29 17:11:23 (UTC)
committer harlekin <harlekin>2004-05-29 17:11:23 (UTC)
commitf568ff9c68bdc61cbc4482f9b2c6e1096cecaae0 (patch) (unidiff)
tree656b1216596c578ba672c2c0d25782d24110406a
parente163b479be800d0b388cf52d046adfc83f5cc1d8 (diff)
downloadopie-f568ff9c68bdc61cbc4482f9b2c6e1096cecaae0.zip
opie-f568ff9c68bdc61cbc4482f9b2c6e1096cecaae0.tar.gz
opie-f568ff9c68bdc61cbc4482f9b2c6e1096cecaae0.tar.bz2
fix path handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/opluginloader.cpp4
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
@@ -201,49 +201,49 @@ bool OPluginItem::isEnabled()const {
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 */
206int OPluginItem::position()const{ 206int 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 */
215void OPluginItem::setName( const QString& name ) { 215void 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 */
224void OPluginItem::setPath( const QString& name ) { 224void 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 */
236void OPluginItem::setEnabled( bool enabled ) { 236void 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 */
247void OPluginItem::setPosition( int pos ) { 247void OPluginItem::setPosition( int pos ) {
248 m_pos = pos; 248 m_pos = pos;
249} 249}
@@ -802,49 +802,49 @@ void OPluginManager::load() {
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 */
816void OPluginManager::save() { 816void 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 }