listing methods for all installed types of containments and for all containments of a given type
svn path=/trunk/KDE/kdelibs/; revision=948427
This commit is contained in:
parent
4f0a9c1b2f
commit
5ef5f88b7e
@ -855,6 +855,14 @@ int Containment::desktop() const
|
|||||||
|
|
||||||
KPluginInfo::List Containment::listContainments(const QString &category,
|
KPluginInfo::List Containment::listContainments(const QString &category,
|
||||||
const QString &parentApp)
|
const QString &parentApp)
|
||||||
|
{
|
||||||
|
return listContainmentsOfType(QString(), category, parentApp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KPluginInfo::List Containment::listContainmentsOfType(const QString &type,
|
||||||
|
const QString &category,
|
||||||
|
const QString &parentApp)
|
||||||
{
|
{
|
||||||
QString constraint;
|
QString constraint;
|
||||||
|
|
||||||
@ -864,6 +872,14 @@ KPluginInfo::List Containment::listContainments(const QString &category,
|
|||||||
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
|
constraint.append("[X-KDE-ParentApp] == '").append(parentApp).append("'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!type.isEmpty()) {
|
||||||
|
if (!constraint.isEmpty()) {
|
||||||
|
constraint.append(" and ");
|
||||||
|
}
|
||||||
|
|
||||||
|
constraint.append("'").append(type).append("' ~in [X-Plasma-ContainmentCategories] ~in '");
|
||||||
|
}
|
||||||
|
|
||||||
if (!category.isEmpty()) {
|
if (!category.isEmpty()) {
|
||||||
if (!constraint.isEmpty()) {
|
if (!constraint.isEmpty()) {
|
||||||
constraint.append(" and ");
|
constraint.append(" and ");
|
||||||
@ -888,6 +904,21 @@ KPluginInfo::List Containment::listContainmentsForMimetype(const QString &mimety
|
|||||||
return KPluginInfo::fromServices(offers);
|
return KPluginInfo::fromServices(offers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList Containment::listContainmentTypes()
|
||||||
|
{
|
||||||
|
KPluginInfo::List containmentInfos = listContainments();
|
||||||
|
QSet<QString> types;
|
||||||
|
|
||||||
|
foreach (const KPluginInfo &containmentInfo, containmentInfos) {
|
||||||
|
QStringList theseTypes = containmentInfo.service()->property("X-Plasma-ContainmentCategories").toStringList();
|
||||||
|
foreach (const QString &type, theseTypes) {
|
||||||
|
types.insert(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return types.toList();
|
||||||
|
}
|
||||||
|
|
||||||
void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
{
|
{
|
||||||
//kDebug() << immutability() << Mutable << (immutability() == Mutable);
|
//kDebug() << immutability() << Mutable << (immutability() == Mutable);
|
||||||
|
@ -143,9 +143,9 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
/**
|
/**
|
||||||
* Returns a list of all known containments.
|
* Returns a list of all known containments.
|
||||||
*
|
*
|
||||||
* @param category Only applets matchin this category will be returned.
|
* @param category Only containments matching this category will be returned.
|
||||||
* Useful in conjunction with knownCategories.
|
* Useful in conjunction with knownCategories.
|
||||||
* If "Misc" is passed in, then applets without a
|
* If "Miscelaneous" is passed in, then applets without a
|
||||||
* Categories= entry are also returned.
|
* Categories= entry are also returned.
|
||||||
* If an empty string is passed in, all applets are
|
* If an empty string is passed in, all applets are
|
||||||
* returned.
|
* returned.
|
||||||
@ -159,6 +159,34 @@ class PLASMA_EXPORT Containment : public Applet
|
|||||||
static KPluginInfo::List listContainments(const QString &category = QString(),
|
static KPluginInfo::List listContainments(const QString &category = QString(),
|
||||||
const QString &parentApp = QString());
|
const QString &parentApp = QString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of all known Containments that match the parameters.
|
||||||
|
*
|
||||||
|
* @param type Only Containments with this string in X-Plasma-ContainmentCategories
|
||||||
|
* in their .desktop files will be returned. Common values are panel and
|
||||||
|
* desktop
|
||||||
|
* @param category Only applets matchin this category will be returned.
|
||||||
|
* Useful in conjunction with knownCategories.
|
||||||
|
* If "Miscelaneous" is passed in, then applets without a
|
||||||
|
* Categories= entry are also returned.
|
||||||
|
* If an empty string is passed in, all applets are
|
||||||
|
* returned.
|
||||||
|
* @param parentApp the application to filter applets on. Uses the
|
||||||
|
* X-KDE-ParentApp entry (if any) in the plugin info.
|
||||||
|
* The default value of QString() will result in a
|
||||||
|
* list containing only applets not specifically
|
||||||
|
* registered to an application.
|
||||||
|
* @return list of applets
|
||||||
|
**/
|
||||||
|
static KPluginInfo::List listContainmentsOfType(const QString &type,
|
||||||
|
const QString &category = QString(),
|
||||||
|
const QString &parentApp = QString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a list of all known types of Containments on this system
|
||||||
|
*/
|
||||||
|
static QStringList listContainmentTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all known applets associated with a certain mimetype
|
* Returns a list of all known applets associated with a certain mimetype
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user