[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [PATCH] Use X-DocPath/DocPath in KToolInvocation::invokeHelp
From: Michael Leupold <lemma () confuego ! org>
Date: 2008-10-29 15:34:21
Message-ID: 200810291634.22975.lemma () confuego ! org
[Download RAW message or body]
Hi,
I recently had a problem with kwalletmanager. Basically the KDE Wallet system
has several components and just one manual for all of them. This documentation
is stored in help:/kwallet/index.html.
The following patch makes KToolInvocation query the sycoca for an X-DocPath or
a DocPath stored in the desktop file.
Regards,
Michael
["ktoolinvocation-help-docpath.diff" (text/x-patch)]
Index: kdelibs/kdecore/kernel/ktoolinvocation.cpp
===================================================================
--- kdelibs/kdecore/kernel/ktoolinvocation.cpp (Revision 875700)
+++ kdelibs/kdecore/kernel/ktoolinvocation.cpp (Arbeitskopie)
@@ -26,6 +26,7 @@
#include "kcomponentdata.h"
#include "kurl.h"
#include "kmessage.h"
+#include "kservice.h"
#include <klockfile.h>
#include <klocale.h>
@@ -247,15 +248,32 @@
QString url;
QString appname;
+ QString docPath;
if (_appname.isEmpty()) {
appname = QCoreApplication::instance()->applicationName();
} else
appname = _appname;
-
- if (!anchor.isEmpty())
+
+ KService::Ptr service(KService::serviceByDesktopName(appname));
+ if (service) {
+ docPath = service->property("X-DocPath", QVariant::String).toString();
+ if (docPath.isEmpty()) {
+ docPath = service->property("DocPath", QVariant::String).toString();
+ }
+ }
+ if (anchor.isEmpty()) {
+ if (docPath.isEmpty()) {
+ url = QString("help:/%1/index.html").arg(appname);
+ } else {
+ url = QString("help:/%1").arg(docPath);
+ }
+ } else {
+ if (!docPath.isEmpty()) {
+ // extract the appname from the docPath
+ appname = docPath.split("/").first();
+ }
url = QString("help:/%1?anchor=%2").arg(appname).arg(anchor);
- else
- url = QString("help:/%1/index.html").arg(appname);
+ }
QDBusInterface *iface = new QDBusInterface(QLatin1String("org.kde.khelpcenter"),
QLatin1String("/KHelpCenter"),
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic