summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-28 22:49:15 (UTC)
committer zecke <zecke>2004-05-28 22:49:15 (UTC)
commit08998f34ec77062224dc0783be78d9e6e3bf7910 (patch) (unidiff)
treeef7855f9ead12b408e9b4b3ca7f6f8f58466016f
parente15f3bb9f0a652076050ddcfb0c31a16ae845373 (diff)
downloadopie-08998f34ec77062224dc0783be78d9e6e3bf7910.zip
opie-08998f34ec77062224dc0783be78d9e6e3bf7910.tar.gz
opie-08998f34ec77062224dc0783be78d9e6e3bf7910.tar.bz2
Make harlekin happy. AkA uncomitted code
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/opluginloader.cpp18
-rw-r--r--libopie2/opiecore/opluginloader.h1
2 files changed, 16 insertions, 3 deletions
diff --git a/libopie2/opiecore/opluginloader.cpp b/libopie2/opiecore/opluginloader.cpp
index 2aca382..87e24d4 100644
--- a/libopie2/opiecore/opluginloader.cpp
+++ b/libopie2/opiecore/opluginloader.cpp
@@ -556,25 +556,24 @@ OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorte
556 556
557 if ( m_isSorted ) { 557 if ( m_isSorted ) {
558 QStringList pos = cfg.readListEntry( "Positions", '.' ); 558 QStringList pos = cfg.readListEntry( "Positions", '.' );
559 QStringList::Iterator it = pos.begin(); 559 QStringList::Iterator it = pos.begin();
560 while ( it != pos.end() ) 560 while ( it != pos.end() )
561 positionMap.insert( *it++, (*it++).toInt() ); 561 positionMap.insert( *it++, (*it++).toInt() );
562 } 562 }
563 563
564 564
565 565
566 566
567 QStringList list = dir.entryList(); 567 QStringList list = dir.entryList();
568 QStringList::Iterator it;
569 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 568 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
570 QString str = unlibify( *it ); 569 QString str = unlibify( *it );
571 OPluginItem item( str, _dir + "/" + *it ); 570 OPluginItem item( str, _dir + "/" + *it );
572 571
573 bool ex = excludedMap.contains( str ); 572 bool ex = excludedMap.contains( str );
574 /* 573 /*
575 * if disabled but we should show all mark it as disabled 574 * if disabled but we should show all mark it as disabled
576 * else continue because we don't want to add the item 575 * else continue because we don't want to add the item
577 * else if sorted we assign the right position 576 * else if sorted we assign the right position
578 */ 577 */
579 if ( ex && !disabled) 578 if ( ex && !disabled)
580 item.setEnabled( false ); 579 item.setEnabled( false );
@@ -663,25 +662,25 @@ OPluginLoader::~OPluginLoader() {
663} 662}
664 663
665/** 664/**
666 * \brief C'Tor using a OGenericPluginLoader 665 * \brief C'Tor using a OGenericPluginLoader
667 * The C'tor. Pass your OGenericPluginLoader to manage 666 * The C'tor. Pass your OGenericPluginLoader to manage
668 * OGenericPluginLoader::allAvailable plugins. 667 * OGenericPluginLoader::allAvailable plugins.
669 * 668 *
670 * 669 *
671 * @param loader A Pointer to your OGenericPluginLoader 670 * @param loader A Pointer to your OGenericPluginLoader
672 * @param name The name 671 * @param name The name
673 */ 672 */
674OPluginManager::OPluginManager( OGenericPluginLoader* loader) 673OPluginManager::OPluginManager( OGenericPluginLoader* loader)
675 : m_loader( loader ) 674 : m_loader( loader ), m_isSorted( false )
676{ 675{
677} 676}
678 677
679/** 678/**
680 * \brief Overloaded c'tor using a List of Plugins and a type name 679 * \brief Overloaded c'tor using a List of Plugins and a type name
681 * Overloaded Constructor to work with a 'Type' of plugins 680 * Overloaded Constructor to work with a 'Type' of plugins
682 * and a correspending list of those. In this case calling load 681 * and a correspending list of those. In this case calling load
683 * is a no operation. 682 * is a no operation.
684 * 683 *
685 * @param name The name of your plugin ('today','inputmethods','applets') 684 * @param name The name of your plugin ('today','inputmethods','applets')
686 * @param lst A List with plugins of your type to manage 685 * @param lst A List with plugins of your type to manage
687 * @param isSorted If the List should be treated sorted 686 * @param isSorted If the List should be treated sorted
@@ -862,17 +861,30 @@ void OPluginManager::save() {
862/** 861/**
863 * @internal 862 * @internal
864 */ 863 */
865QString OPluginManager::configName()const { 864QString OPluginManager::configName()const {
866 QString str = m_loader ? m_loader->name() : m_cfgName; 865 QString str = m_loader ? m_loader->name() : m_cfgName;
867 return str + "odpplugins"; 866 return str + "odpplugins";
868} 867}
869 868
870/** 869/**
871 * @internal.. replace in m_plugins by path... this is linear search O(n/2) 870 * @internal.. replace in m_plugins by path... this is linear search O(n/2)
872 */ 871 */
873void OPluginManager::replace( const OPluginItem& item ) { 872void OPluginManager::replace( const OPluginItem& item ) {
874// ### fixme 873 OPluginItem _item;
874
875 /* for all plugins */
876 for ( OPluginItem::List::Iterator it=m_plugins.begin();it != m_plugins.end(); ++it ) {
877 _item = *it;
878 /* if path and name are the same we will remove, readd and return */
879 if ( _item.path() == item.path() &&
880 _item.name() == item.name() ) {
881 it = m_plugins.remove( it );
882 m_plugins.append( item );
883 return;
884 }
885
886 }
875} 887}
876 888
877} 889}
878} 890}
diff --git a/libopie2/opiecore/opluginloader.h b/libopie2/opiecore/opluginloader.h
index 2f9ec2a..740551c 100644
--- a/libopie2/opiecore/opluginloader.h
+++ b/libopie2/opiecore/opluginloader.h
@@ -148,24 +148,25 @@ public:
148 * \brief A class to manage order and activation of plugins 148 * \brief A class to manage order and activation of plugins
149 * 149 *
150 * Manage order and activation. This is used by the Opie::Ui::OPluginConfig 150 * Manage order and activation. This is used by the Opie::Ui::OPluginConfig
151 * This class controls the activation and order of plugins depending 151 * This class controls the activation and order of plugins depending
152 * on the OPluginLoader you supply. 152 * on the OPluginLoader you supply.
153 * You must call load() and save after construnction an instance 153 * You must call load() and save after construnction an instance
154 * 154 *
155 * @see Opie::Ui::OPluginConfig 155 * @see Opie::Ui::OPluginConfig
156 * 156 *
157 */ 157 */
158class OPluginManager { 158class OPluginManager {
159public: 159public:
160 typedef QValueList<OPluginManager*> List;
160 OPluginManager( OGenericPluginLoader* ); 161 OPluginManager( OGenericPluginLoader* );
161 OPluginManager( const QString& name, const OPluginItem::List&, bool isSorted = false ); 162 OPluginManager( const QString& name, const OPluginItem::List&, bool isSorted = false );
162 virtual ~OPluginManager(); 163 virtual ~OPluginManager();
163 164
164 OPluginItem crashedPlugin()const; 165 OPluginItem crashedPlugin()const;
165 166
166 OPluginItem::List managedPlugins()const; 167 OPluginItem::List managedPlugins()const;
167 168
168 void setPosition( const OPluginItem& ); 169 void setPosition( const OPluginItem& );
169 void enable( const OPluginItem& ); 170 void enable( const OPluginItem& );
170 void disable( const OPluginItem& ); 171 void disable( const OPluginItem& );
171 void setEnabled( const OPluginItem&, bool = true); 172 void setEnabled( const OPluginItem&, bool = true);