[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: PATCH to make minicli use all KURIFilterPlugins
From: Neil Stevens <neil () qualityassistant ! com>
Date: 2002-10-29 1:28:12
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday October 28, 2002 01:48, David Faure wrote:
> Neil wrote:
> > I figure the easiest
> > stopgap solution is to use the existing filter iterator to produce a
> > QStringList of all installed filters. Then remove ikws, and we're
> > happy.
>
> Yes - and remove localdomainurifilter if !final.
> So the best would be to do that iteration once on start, and store the
> two QStringLists, ready to use for parseLine(). I'd happily approve a
> patch doing that ;)
How about centralizing the pre-made list with the filters themselves, like
so?
(Patch in two parts, as it modifies KURIFiler and KDesktop)
- --
Neil Stevens - neil@qualityassistant.com
"The nearest I can make it out, 'Love your Enemies' means, 'Hate your
Friends'." - Benjamin Franklin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9veQsf7mnligQOmERAsK/AJ0ctLj1mzVemg01z/+F6m4TS/z04QCeM/g7
hytFa+JIQijUH754cwY0xGo=
=qFMp
-----END PGP SIGNATURE-----
["kdesktop-minicli-filters" (text/x-diff)]
Index: minicli.cpp
===================================================================
RCS file: /home/kde/kdebase/kdesktop/minicli.cpp,v
retrieving revision 1.134
diff -u -r1.134 minicli.cpp
--- minicli.cpp 2002/08/21 00:24:12 1.134
+++ minicli.cpp 2002/10/29 01:21:37
@@ -537,10 +537,10 @@
else
{
m_filterData->setData( cmd );
- QStringList filters;
- filters << "kurisearchfilter" << "kshorturifilter";
- if( final )
- filters << "localdomainurifilter";
+ QStringList filters = KURIFilter::self()->plugins();
+ if( !final )
+ filters.remove("localdomainurifilter");
+ filters.remove("kuriikwsfilter");
KURIFilter::self()->filterURI( *(m_filterData), filters );
m_IconName = m_filterData->iconName();
if( m_IconName.isEmpty() || m_IconName == "unknown" )
["kurifilter-filters" (text/x-diff)]
Index: kurifilter.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kurifilter.cpp,v
retrieving revision 1.30
diff -u -r1.30 kurifilter.cpp
--- kurifilter.cpp 2002/06/19 17:46:01 1.30
+++ kurifilter.cpp 2002/10/28 22:57:24
@@ -169,6 +169,13 @@
}
//******************************************** KURIFilter \
********************************************** +class KURIFilterPrivate
+{
+public:
+ KURIFilterPrivate() {};
+ QStringList plugins;
+};
+
KURIFilter *KURIFilter::m_self = 0;
KStaticDeleter<KURIFilter> kurifiltersd;
@@ -182,12 +189,15 @@
KURIFilter::KURIFilter()
{
m_lstPlugins.setAutoDelete(true);
+ d = new KURIFilterPrivate;
loadPlugins();
}
KURIFilter::~KURIFilter()
{
m_self = 0;
+ delete d;
+ d = 0;
}
bool KURIFilter::filterURI( KURIFilterData& data, const QStringList& filters )
@@ -265,20 +275,29 @@
return QPtrListIterator<KURIFilterPlugin>(m_lstPlugins);
};
+QStringList KURIFilter::plugins() const
+{
+ return d->plugins;
+}
+
void KURIFilter::loadPlugins()
{
+ d->plugins.clear();
+
KTrader::OfferList offers = KTrader::self()->query( "KURIFilter/Plugin" );
KTrader::OfferList::ConstIterator it = offers.begin();
KTrader::OfferList::ConstIterator end = offers.end();
for (; it != end; ++it )
{
- KURIFilterPlugin *plugin =
- KParts::ComponentFactory::createInstanceFromService<KURIFilterPlugin>( *it,
- \
0,
- (*it)->desktopEntryName().latin1() );
- if ( plugin )
- m_lstPlugins.append( plugin );
+ KURIFilterPlugin *plugin =
+ KParts::ComponentFactory::createInstanceFromService<KURIFilterPlugin>( \
*it, + 0, (*it)->desktopEntryName().latin1() );
+ if ( plugin )
+ {
+ d->plugins.append(plugin->name());
+ m_lstPlugins.append( plugin );
+ }
}
// NOTE: Plugin priority is now determined by
// the entry in the .desktop files...
Index: kurifilter.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/kurifilter.h,v
retrieving revision 1.26
diff -u -r1.26 kurifilter.h
--- kurifilter.h 2002/10/20 22:38:27 1.26
+++ kurifilter.h 2002/10/28 22:57:24
@@ -562,6 +562,15 @@
*/
QPtrListIterator<KURIFilterPlugin> pluginsIterator() const;
+ /**
+ * Return a list of all loaded plugins
+ *
+ * @since 3.1
+ *
+ * @return a QStringList of plugins
+ */
+ QStringList plugins() const;
+
protected:
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic