1 /***************************************************************************
3 copyright : (C) Mark Kretschmann
5 ***************************************************************************/
7 /***************************************************************************
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
14 ***************************************************************************/
16 #ifndef AKREGATOR_PLUGINMANAGER_H
17 #define AKREGATOR_PLUGINMANAGER_H
19 #include "akregatorpart_export.h"
22 #include <kservicetypetrader.h>
30 class AKREGATORPART_EXPORT PluginManager
35 * It will return a list of services that match your
36 * specifications. The only required parameter is the service
37 * type. This is something like 'text/plain' or 'text/html'. The
38 * constraint parameter is used to limit the possible choices
39 * returned based on the constraints you give it.
41 * The @p constraint language is rather full. The most common
42 * keywords are AND, OR, NOT, IN, and EXIST, all used in an
43 * almost spoken-word form. An example is:
45 * (Type == 'Service') and (('KParts/ReadOnlyPart' in ServiceTypes) or (exist Exec))
48 * The keys used in the query (Type, ServiceType, Exec) are all
49 * fields found in the .desktop files.
51 * @param constraint A constraint to limit the choices returned, QString() to
52 * get all services of the given @p servicetype
54 * @return A list of services that satisfy the query
55 * @see http://developer.kde.org/documentation/library/kdeqt/tradersyntax.html
57 static KService::List
query(const QString
&constraint
= QString());
60 * Load and instantiate plugin from query
61 * @param constraint A constraint to limit the choices returned, QString() to
62 * get all services of the given @p servicetype
63 * @return Pointer to Plugin, or NULL if error
64 * @see http://developer.kde.org/documentation/library/kdeqt/tradersyntax.html
66 static Akregator::Plugin
*createFromQuery(const QString
&constraint
= QString());
69 * Load and instantiate plugin from service
70 * @param service Pointer to KService
71 * @return Pointer to Plugin, or NULL if error
73 static Akregator::Plugin
*createFromService(const KService::Ptr
&service
, QObject
*parent
= Q_NULLPTR
);
76 * Remove library and delete plugin
77 * @param plugin Pointer to plugin
79 static void unload(Akregator::Plugin
*plugin
);
82 * Look up service for loaded plugin from store
83 * @param pointer Pointer to plugin
84 * @return KService, or 0 if not found
86 static KService::Ptr
getService(const Akregator::Plugin
*plugin
);
89 * Dump properties from a service to stdout for debugging
90 * @param service Pointer to KService
92 static void dump(const KService::Ptr
&service
);
95 * Show modal info dialog about plugin
96 * @param constraint A constraint to limit the choices returned
98 static void showAbout(const QString
&constraint
);
102 Akregator::Plugin
*plugin
;
103 KService::Ptr service
;
106 static std::vector
<StoreItem
>::iterator
lookupPlugin(const Akregator::Plugin
*plugin
);
109 static std::vector
<StoreItem
> m_store
;
112 } // namespace Akregator
114 #endif // AKREGATOR_PLUGINMANAGER_H