plugin badness

Koos Vriezen koos.vriezen at xs4all.nl
Tue Mar 16 20:15:10 GMT 2004


On Tue, Mar 16, 2004 at 07:36:08PM +0100, Koos Vriezen wrote:
> On Tue, Mar 16, 2004 at 12:57:47PM -0500, George Staikos wrote:
> > On Tuesday 16 March 2004 11:47, Koos Vriezen wrote:
> > > On Tue, Mar 16, 2004 at 07:11:10AM -0500, George Staikos wrote:
> > > > Why don't we add a new property to kparts that says to publish them to
> > > > remote sites who query for a list of plugins?
> > >
> > > Sounds fine with me. Btw, too bad you didn't react on this last mounth.
> > 
> >    Sorry, didn't think of it....
> 
> Branch should be reverted (why was it backported?). For HEAD, have you any
> ideas? Now we use Browser/View, should it be Browser/Embed or check for a
> property?
> For plugin name and mime, there should also something made for. Now
> pluginsinfo has multible entries like
> 
>   description=Shockwave Flash 6.0 r79
>   file=libflashplayer.so
>   mime=application/x-shockwave-flash:swf:Shockwave Flash;application/futuresplash:spl:FutureSplash Player
>   name=Shockwave Flash
> 
> Now how could a kpart present itself as more then one plugin more generally?
> Also using properies in .desktop files.. doesn't sound that dynamic...
> Hmm, what if we add a pluginsinfo property that points to this file. So if a
> part has this property, try open this file and register plugin as it used to be.

Attached this propery points to plugin info filename idea. Needs also a small change
in nspluginscan to add to ~/.kde/share/services/nsplugin.desktop
X-KDE-BrowserView-PluginsInfo=nsplugins/pluginsinfo

> Other ideas?
> 
> Koos
-------------- next part --------------
? kparts/.browserview.desktop.swp
Index: khtml/ecma/kjs_navigator.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_navigator.cpp,v
retrieving revision 1.67
diff -u -3 -p -r1.67 kjs_navigator.cpp
--- khtml/ecma/kjs_navigator.cpp	13 Feb 2004 15:22:40 -0000	1.67
+++ khtml/ecma/kjs_navigator.cpp	16 Mar 2004 20:10:14 -0000
@@ -244,38 +244,52 @@ PluginBase::PluginBase(ExecState *exec)
         KTrader::OfferList offers = KTrader::self()->query("Browser/View");
         KTrader::OfferList::iterator it;
         for ( it = offers.begin(); it != offers.end(); ++it ) {
-            PluginInfo *plugin = new PluginInfo;
 
-            plugin->name = (**it).name();
-            plugin->file = (**it).library();
-            plugin->desc = (**it).comment();
-
-            plugins->append( plugin );
-
-            // get mime types from string
-            QStringList types = (**it).serviceTypes();
-            QStringList::Iterator type;
-            for ( type=types.begin(); type!=types.end(); ++type ) {
-
-                // get mime information
-                QStringList tokens = QStringList::split(':', *type, true);
-                QStringList::Iterator token;
-                for ( token=tokens.begin(); token!=tokens.end(); ++token ) {
-                    KMimeType::Ptr mimePtr = KMimeType::mimeType(*token);
-                    QString name = (*mimePtr).name();
-                    if ( name != KMimeType::defaultMimeType() )
-                    {
-                        MimeClassInfo *mime = new MimeClassInfo;
-                        mime->type = name;
-                        mime->suffixes = (*mimePtr).patterns().join(", ");
-                        mime->desc = (*mimePtr).comment();
-
-                        mime->plugin = plugin;
-
-                        mimes->append( mime );
-                        plugin->mimes.append( mime );
-                    }
-               }
+            QVariant pluginsinfo = (**it).property( "X-KDE-BrowserView-PluginsInfo" );
+            if ( !pluginsinfo.isValid() )
+                continue;
+
+            // read configuration
+            KConfig kc( locate ("data", pluginsinfo.toString()) );
+            unsigned num = (unsigned int) kc.readNumEntry("number");
+            for ( unsigned n = 0; n < num; n++ ) {
+                kc.setGroup( QString::number(n) );
+                PluginInfo *plugin = new PluginInfo;
+
+                plugin->name = kc.readEntry("name");
+                plugin->file = kc.readPathEntry("file");
+                plugin->desc = kc.readEntry("description");
+
+                plugins->append( plugin );
+
+                // get mime types from string
+                QStringList types = QStringList::split( ';', kc.readEntry("mime") );
+                QStringList::Iterator type;
+                for ( type=types.begin(); type!=types.end(); ++type ) {
+
+                    // get mime information
+                    QStringList tokens = QStringList::split(':', *type, true);
+                    if ( tokens.count() < 3 ) // we need 3 items
+                        continue;
+
+                    MimeClassInfo *mime = new MimeClassInfo;
+                    QStringList::Iterator token = tokens.begin();
+                    mime->type = (*token).lower();
+                    //kdDebug(6070) << "mime->type=" << mime->type << endl;
+                    ++token;
+
+                    mime->suffixes = *token;
+                    ++token;
+
+                    mime->desc = *token;
+                    ++token;
+
+                    mime->plugin = plugin;
+
+                    mimes->append( mime );
+                    plugin->mimes.append( mime );
+
+                }
             }
         }
     }
Index: kparts/browserview.desktop
===================================================================
RCS file: /home/kde/kdelibs/kparts/browserview.desktop,v
retrieving revision 1.162
diff -u -3 -p -r1.162 browserview.desktop
--- kparts/browserview.desktop	14 Jan 2004 07:51:06 -0000	1.162
+++ kparts/browserview.desktop	16 Mar 2004 20:10:14 -0000
@@ -132,3 +132,8 @@ Type=bool
 # (famous bug).
 [PropertyDef::X-KDE-BrowserView-Built-Into]
 Type=QString
+
+#If the part has a plugin for KHTML navigator.plugins, it should mention
+#the file name to the plugin info file here relative to share/apps
+[PropertyDef::X-KDE-BrowserView-PluginsInfo]
+Type=QString


More information about the kfm-devel mailing list