[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: [plasma-framework] src/plasma: if path is passed, pick the tail
From:       Aleix Pol <aleixpol () kde ! org>
Date:       2016-02-29 21:02:04
Message-ID: CACcA1RpaJuFsV2ETgawYTh8j0kn9jCykt1OsU9u_KrHocr2hMw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


El dia 29 febr. 2016 5:34 p. m., "Marco Martin" <notmart@gmail.com> va
escriure:
>
> Git commit 40b99a91222f59a6172b8673536c3c15c0458bf6 by Marco Martin.
> Committed on 29/02/2016 at 16:31.
> Pushed by mart into branch 'master'.
>
> if path is passed, pick the tail
>
> PluginLoader::loadApplet works both by passing a simple plugin
> name and a full path of a plasmoid package.
>
> However, when loading the optional C++ plugin, we have to look
> in the standard plasmoid plugin path, so only consider the
> tail of the path name, as is guaranteed that part is equal to
> the plugin name.
>
> BUG:359902
> Change-Id: Ic7300b7c12d7693bcb5590e29de780109a8ff81c
>
> M  +4    -2    src/plasma/pluginloader.cpp
>
>
http://commits.kde.org/plasma-framework/40b99a91222f59a6172b8673536c3c15c0458bf6
>
> diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp
> index 6691980..0915e46 100644
> --- a/src/plasma/pluginloader.cpp
> +++ b/src/plasma/pluginloader.cpp
> @@ -186,11 +186,13 @@ Applet *PluginLoader::loadApplet(const QString
&name, uint appletId, const QVari
>      }
>
>
> +    //if name wasn't a path, pluginName == name
> +    const QString pluginName = name.split('/').last();
>
>      // Look for C++ plugins first
> -    auto filter = [&name](const KPluginMetaData &md) -> bool
> +    auto filter = [&pluginName](const KPluginMetaData &md) -> bool
>      {
> -        return md.pluginId() == name;
> +        return md.pluginId() == pluginName;
>      };
>      QVector<KPluginMetaData> plugins =
KPluginLoader::findPlugins(PluginLoaderPrivate::s_plasmoidsPluginDir,
filter);
>

Use splitRef, or even better, lastIndexOf+midRef.

Aleix

[Attachment #5 (text/html)]

<p dir="ltr"><br>
El dia 29 febr. 2016 5:34 p. m., &quot;Marco Martin&quot; &lt;<a \
href="mailto:notmart@gmail.com">notmart@gmail.com</a>&gt; va escriure:<br> &gt;<br>
&gt; Git commit 40b99a91222f59a6172b8673536c3c15c0458bf6 by Marco Martin.<br>
&gt; Committed on 29/02/2016 at 16:31.<br>
&gt; Pushed by mart into branch &#39;master&#39;.<br>
&gt;<br>
&gt; if path is passed, pick the tail<br>
&gt;<br>
&gt; PluginLoader::loadApplet works both by passing a simple plugin<br>
&gt; name and a full path of a plasmoid package.<br>
&gt;<br>
&gt; However, when loading the optional C++ plugin, we have to look<br>
&gt; in the standard plasmoid plugin path, so only consider the<br>
&gt; tail of the path name, as is guaranteed that part is equal to<br>
&gt; the plugin name.<br>
&gt;<br>
&gt; BUG:359902<br>
&gt; Change-Id: Ic7300b7c12d7693bcb5590e29de780109a8ff81c<br>
&gt;<br>
&gt; M   +4      -2      src/plasma/pluginloader.cpp<br>
&gt;<br>
&gt; <a href="http://commits.kde.org/plasma-framework/40b99a91222f59a6172b8673536c3c15 \
c0458bf6">http://commits.kde.org/plasma-framework/40b99a91222f59a6172b8673536c3c15c0458bf6</a><br>
 &gt;<br>
&gt; diff --git a/src/plasma/pluginloader.cpp b/src/plasma/pluginloader.cpp<br>
&gt; index 6691980..0915e46 100644<br>
&gt; --- a/src/plasma/pluginloader.cpp<br>
&gt; +++ b/src/plasma/pluginloader.cpp<br>
&gt; @@ -186,11 +186,13 @@ Applet *PluginLoader::loadApplet(const QString &amp;name, \
uint appletId, const QVari<br> &gt;         }<br>
&gt;<br>
&gt;<br>
&gt; +      //if name wasn&#39;t a path, pluginName == name<br>
&gt; +      const QString pluginName = name.split(&#39;/&#39;).last();<br>
&gt;<br>
&gt;         // Look for C++ plugins first<br>
&gt; -      auto filter = [&amp;name](const KPluginMetaData &amp;md) -&gt; bool<br>
&gt; +      auto filter = [&amp;pluginName](const KPluginMetaData &amp;md) -&gt; \
bool<br> &gt;         {<br>
&gt; -            return md.pluginId() == name;<br>
&gt; +            return md.pluginId() == pluginName;<br>
&gt;         };<br>
&gt;         QVector&lt;KPluginMetaData&gt; plugins = \
KPluginLoader::findPlugins(PluginLoaderPrivate::s_plasmoidsPluginDir, filter);<br> \
&gt;</p> <p dir="ltr">Use splitRef, or even better, lastIndexOf+midRef.</p>
<p dir="ltr">Aleix <br>
</p>


[Attachment #6 (text/plain)]

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic