[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH] Allow application to use a website for documentation.
From:       Tom Albers <tomalbers () kde ! nl>
Date:       2008-08-20 22:25:36
Message-ID: 2890744.6pY9FjkY8T () kde ! nl
[Download RAW message or body]

Forgot the attachment and a question.

I would like to stop the browser from starting when the user has no internet \
connection, but that would require a dependency on Solid and I've doubts that \
dependency is wanted in this area of kdelibs. If anyone has a good idea for that, let \
me know...

Best,

Toma


["documentation.diff" (text/x-diff)]

Index: kdecore/kernel/kaboutdata.cpp
===================================================================
--- kdecore/kernel/kaboutdata.cpp	(revision 850129)
+++ kdecore/kernel/kaboutdata.cpp	(working copy)
@@ -392,6 +392,7 @@
     KLocalizedString _copyrightStatement;
     KLocalizedString _otherText;
     QString _homepageAddress;
+    QString _documentationAddress;
     QList<KAboutPerson> _authorList;
     QList<KAboutPerson> _creditList;
     QList<KAboutLicense> _licenseList;
@@ -625,6 +626,13 @@
 }
 
 KAboutData &
+KAboutData::setDocumentationAddress( const QByteArray &_documentation )
+{
+  d->_documentationAddress = QString::fromUtf8(_documentation);
+  return *this;
+}
+
+KAboutData &
 KAboutData::setBugAddress( const QByteArray &_bugAddress )
 {
   d->_bugEmailAddress = _bugAddress;
@@ -753,6 +761,12 @@
 }
 
 QString
+KAboutData::documentationAddress() const
+{
+   return d->_documentationAddress;
+}
+
+QString
 KAboutData::bugAddress() const
 {
    return QString::fromUtf8(d->_bugEmailAddress);
Index: kdecore/kernel/kaboutdata.h
===================================================================
--- kdecore/kernel/kaboutdata.h	(revision 850129)
+++ kdecore/kernel/kaboutdata.h	(working copy)
@@ -504,6 +504,16 @@
     KAboutData &setHomepage( const QByteArray &homepage );
 
     /**
+     * Defines the programs documentation address. 
+     *
+     * @param docaddress The program documentation address.
+     *        Start the address with "http://". "http://wiki.kde.org/mailody"
+     *        is correct but "wiki.kde.org/mailody" is not.
+     * @since 4.1.1
+     */
+    KAboutData &setDocumentationAddress( const QByteArray &docaddress );
+
+    /**
      * Defines the address where bug reports should be sent.
      *
      * @param bugAddress The bug report email address string.
@@ -637,6 +647,14 @@
     QString homepage() const;
 
     /**
+     * Returns the applications documentation address.
+     * @return the applications documenation URL. Can be QString() if
+     *         not set.
+     * @since 4.1.1
+     */
+    QString documentationAddress() const;
+
+    /**
      * Returns the email address for bugs.
      * @return the email address where to report bugs.
      */
Index: kdeui/widgets/khelpmenu.cpp
===================================================================
--- kdeui/widgets/khelpmenu.cpp	(revision 850129)
+++ kdeui/widgets/khelpmenu.cpp	(working copy)
@@ -236,7 +236,14 @@
 
 void KHelpMenu::appHelpActivated()
 {
-  KToolInvocation::invokeHelp();
+  if ( !d->mAboutData || d->mAboutData->documentationAddress().isEmpty() )
+  {
+    KToolInvocation::invokeHelp();
+  } 
+  else
+  {
+    KToolInvocation::invokeBrowser( d->mAboutData->documentationAddress() );
+  }
 }
 
 
Index: kdeui/widgets/khelpmenu.h
===================================================================
--- kdeui/widgets/khelpmenu.h	(revision 850129)
+++ kdeui/widgets/khelpmenu.h	(working copy)
@@ -186,6 +186,9 @@
      * Opens the help page for the application. The application name is
      * used as a key to determine what to display and the system will attempt
      * to open \<appName\>/index.html.
+     *
+     * If the documentAddress is set in the KAboutData, the system will not
+     * open KHelpCenter, but a browser with that address.
      */
     void appHelpActivated();
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic