[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Missing KServiceType Info
From: ian geiser <geiseri () yahoo ! com>
Date: 2005-02-08 16:01:20
Message-ID: 200502081101.26458.geiseri () yahoo ! com
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
On Tuesday 08 February 2005 09:06 am, David Faure wrote:
> > All this confusion seems like overkill, basicly all i
> > really wanted to do was get the possible properties for each service via
> > some API.
>
> KServiceType::propertyNames is supposed to be that.
I have attached some sample code that displays:
servicetypetest: Get props for: 'KDevelop/Plugin' from kdevelopplugin.desktop
servicetypetest: Found Property: Name
servicetypetest: Found Property: Comment
servicetypetest: Found Property: Icon
My understanding of the KServiceType tells me that it should give me this:
servicetypetest: Get props for: 'KDevelop/Plugin' from kdevelopplugin.desktop
servicetypetest: X-KDevelop-Version
servicetypetest: X-KDevelop-Scope
servicetypetest: X-KDevelop-Mode
servicetypetest: X-KDevelop-Plugin-Version
servicetypetest: X-KDevelop-Plugin-Homepage
servicetypetest: X-KDevelop-Plugin-License
servicetypetest: X-KDevelop-Plugin-BugsEmailAddress
servicetypetest: X-KDevelop-Plugin-Copyright
servicetypetest: X-KDevelop-Properties
servicetypetest: X-KDevelop-ProgrammingLanguages
servicetypetest: X-KDevelop-Args
servicetypetest: Found Property: Name
servicetypetest: Found Property: Comment
servicetypetest: Found Property: Icon
I have attached the sample code. I am assuming that I am missing some point
here that will tie this all together ;)
Cheers
-ian reinhart geiser
["servicetypetest.cpp" (text/x-c++src)]
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kservicetype.h>
#include <kdebug.h>
static const char description[] = I18N_NOOP("A KDE Application");
static const char version[] = "0.1";
static KCmdLineOptions options[] =
{
KCmdLineLastOption
};
QStringList getProps( KServiceType::Ptr ptr)
{
if( !ptr->isValid() ) return QStringList();
kdDebug() << "Get props for: '" << ptr->name() << "' from " << \
ptr->desktopEntryPath() << endl; QStringList list;
KServiceType::Ptr parent = ptr->parentType();
if(parent) list += getProps(parent);
list += ptr->propertyNames();
return list;
}
int main(int argc, char **argv)
{
KAboutData about("servicetypetest", I18N_NOOP("servicetypetest"), version, \
description,
KAboutData::License_GPL, "(C) 2004 ian reinhart geiser", 0, 0, \
"geiseri@sourcextreme.com"); about.addAuthor( "ian reinhart geiser", 0, \
"geiseri@sourcextreme.com" ); KCmdLineArgs::init(argc, argv, &about);
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication app;
QStringList props = getProps( KServiceType::serviceType("KDevelop/Plugin") );
QStringList::ConstIterator propIdx = props.begin();
for( ; propIdx != props.end(); ++propIdx)
{
kdDebug() << "Found Property: " << *propIdx << endl;
}
return 0;
}
["sttest.pro" (text/plain)]
INSTALLS += target
SOURCES += servicetypetest.cpp
KDELIB=$$system(kde-config --expandvars --install lib)
KDEPREFIX=$$system(kde-config --prefix)
KDEINCLUDE=$$KDEPREFIX/include/kde $$KDEPREFIX/include
TEMPLATE = app
LIBS += -lkdeui -lkdecore -lkio
INCLUDEPATH = $$KDEINCLUDE
QMAKE_LIBDIR = $$KDELIB
CONFIG += debug warn_on
[Attachment #7 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic