kremotecontrol
profileserver.cpp
Go to the documentation of this file.
61 ProfileServer::ProfileXmlContentHandler *handler = new ProfileServer::ProfileXmlContentHandler(KUrl::fromLocalFile(KGlobal::dirs()->findResource("data",QLatin1String( "kremotecontrol/profiles/profile.xsd" ))));
62 foreach( Profile *profile, handler->loadProfilesFromFiles(KGlobal::dirs()->findAllResources("data", QLatin1String( "kremotecontrol/profiles/*.profile.xml" )))){
103 KREMOTECONTROL_EXPORT QList<ProfileActionTemplate> ProfileServer::actionTemplateList(const QString& remote, Profile* profile) {
106 kDebug() << "got template" << actionTemplate.actionTemplateId() << "with button" << actionTemplate.buttonName();
129 const QStringList theFiles = KGlobal::dirs()->findAllResources("data", QLatin1String( "kremotecontrol/profiles/*.profile.xml" ));
136 void ProfileServer::ProfileXmlContentHandler::handleMessage(QtMsgType type, const QString& description, const QUrl& identifier, const QSourceLocation& sourceLocation) {
142 kDebug() << "Error validating xml file " << sourceLocation.uri().toString() << " Message " << document.toPlainText();
145 ProfileServer::ProfileSupportedByRemote KREMOTECONTROL_EXPORT ProfileServer::isProfileAvailableForRemote(Profile* profile, const Remote& remote) {
178 QList<Profile*> ProfileServer::ProfileXmlContentHandler::loadProfilesFromFiles(const QStringList& files) {
206 description = rootElement.namedItem(QLatin1String( "description" )).toElement().text().trimmed();
209 QString version = rootElement.namedItem(QLatin1String( "version" )).toElement().text().trimmed();
211 Profile *profile = new Profile(profileId, i18n(name.toUtf8().data()) ,version, author, i18n(description.toUtf8().data()));
220 kDebug() << " Error on line " << errorLine << "Column " << errorColumn << " Message" << errorMsg;
225 ProfileActionTemplate ProfileServer::ProfileXmlContentHandler::parseAction(QDomNode actionNode, const QString& profileId) {
229 QString actionId = actionNode.attributes().namedItem(QLatin1String( "id" )).nodeValue().trimmed();
234 QString value = actionNode.namedItem(QLatin1String( "autostart" )).toElement().text().trimmed();
238 repeat = QVariant(actionNode.namedItem(QLatin1String( "repeat" )).toElement().text().trimmed()).toBool();
241 QString actionName = actionNode.attributes().namedItem(QLatin1String( "name" )).nodeValue().trimmed();
243 QString description = actionNode.attributes().namedItem(QLatin1String( "description" )).nodeValue().trimmed();
246 QString ifMultiTag = actionNode.namedItem(QLatin1String( "ifmulti" )).toElement().text().trimmed();
270 functionName = "script:" + execNode.namedItem(QLatin1String( "scripttext" )).toElement().text().trimmed();
280 QDomNodeList attributeNodes = execNode.namedItem(QLatin1String( "arguments" )).toElement().elementsByTagName(QLatin1String( "argument" ));
283 QString typeString = attributeNode.attributes().namedItem(QLatin1String( "type" )).nodeValue().trimmed();
285 QString description = attributeNode.toElement().attributes().namedItem(QLatin1String( "comment" )).nodeValue().trimmed();
288 QString value = attributeNode.toElement().namedItem(QLatin1String( "default" )).toElement().text().trimmed();
306 kDebug() << "creating action template" << actionName << serviceName << nodeName << interfaceName << functionName << actionType;
Definition: argument.h:27
Definition: action.h:34
bool validateFile(const QString &fileName)
Definition: profileserver.cpp:127
Definition: profileactiontemplate.h:31
Definition: profileserver.h:36
ProfileXmlContentHandler(const QUrl &schema)
Definition: profileserver.cpp:117
void addTemplate(const ProfileActionTemplate &actionTemplate)
Definition: profile.cpp:72
Definition: action.h:34
QString actionTemplateId() const
Definition: profileactiontemplate.cpp:62
~ProfileXmlContentHandler()
Definition: profileserver.cpp:123
Definition: action.h:34
Definition: prototype.h:28
Definition: remotecontrol.h:35
virtual void handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, const QSourceLocation &sourceLocation)
Definition: profileserver.cpp:136
Definition: profileserver.h:38
Definition: action.h:34
QString buttonName() const
Definition: profileactiontemplate.cpp:103
ProfileServer::ProfileSupportedByRemote isProfileAvailableForRemote(Profile *profile, const Remote &remote)
Definition: profileserver.cpp:145
QList< ProfileActionTemplate > actionTemplates() const
Definition: profile.cpp:76
QList< Profile * > loadProfilesFromFiles(const QStringList &files)
Definition: profileserver.cpp:178
Profile * parseFile(const QString &fileName)
Definition: profileserver.cpp:191
Definition: action.h:34
Definition: profile.h:26
Definition: remotecontrolbutton.h:30
Definition: remote.h:32
QList< ProfileActionTemplate > actionTemplateList(const QString &remote, Profile *profile)
Definition: profileserver.cpp:103
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:07:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.