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

List:       kde-core-devel
Subject:    [PATCH] Adding "forum.kde.org" and "UserBase" to the help menu
From:       "Friedrich W. H. Kossebau" <kossebau () kde ! org>
Date:       2008-12-08 17:03:51
Message-ID: 200812081803.52888.kossebau () kde ! org
[Download RAW message or body]

Hi,

IMHO we should add two entries to each program's help menu, even for 4.2:
* for UserBase
* for forum.kde.org

[Why for 4.2?]
Fixes two missing but important links between our products and the newest 
social services. Would be sad to have six more month without them, especially 
now with everybody jumping to KDE4. And wasn't the leading idea from this 
year's Akademy to improve community structures? [KCW] Let's do it! :)

Would be also sad because such a lot of work has been put into these both 
services.
But how should Aunt Lilly and all the other users know about it? She might use 
$searchservice, but we should help her and tell what we, the KDE creators, do 
recommend. Especially because e.g. UserBase is not in the results for some 
random search terms of Aunt Lilly (besides userbase) I tried.

It also adds to ways to give back (UserBase content, knowledge exchange at 
forum) and might help to increase the community, as it is a (okay, two) click 
away from every menu, which also means discoveribility!

[Please look at the patch attached]
It basically adds two more entries to the help menu: One for a link to some 
online docs (UserBase as default) and one for a link to a forum 
(forum.kde.org as default). The basic features are:
f1) supports KAuthorized::authorizeKAction (with XMLGUI)
f2) links can be controlled by distributions/admins via KConfig
    (if they really think they need to provide their own support center)
f3) general url or parameterized url for program specific pages

[Questions (especially to Anne, Rob, Jayant):]
a) How can we support f3 with the services?
forum.kde.org:
Can there be a service call/url for forum.kde.org which takes the appName from 
KAboutData [KAD] ("kwrite", "okteta", etc.) as parameter and then jumps to 
the proper forum? Something 
like "http://forum.kde.org/forum.php?tag=$appName"?
UserBase:
By tradition the program specific pages are to be found at 
http://userbase.kde.org/$UntranslatedProgramName[_(langcode)]. But 
$UntranslatedProgramName ("KWrite", "Okteta", etc.) is not available from 
KAboutData or elsewhere in the code, only the appname or the translated 
ProgramName. So without changing KAboutData, could there be some support on 
UserBase to redirect from http://userbase.kde.org/$appName to 
http://userbase.kde.org/$UntranslatedProgramName? Like adding such redirect 
pages manually?
b) What would be proper names for the menu entries and the config keys?
The patch contains:
menu entries: "Online &Documentation", "Discussion &Forum"
Group: "Help", 
Keys: "WebDocsGeneral", "WebDocsAppSpecific", "WebForumGeneral", "WebForumAppSpecific"
c) What about 3-party/non-core KDE programs? Their developers might want to 
use their own forums and wikis. E.g. KOffice and Amarok? Where should they 
control the links? By adding the urls as properties to KAboutData, like it is 
done with the homepage url?
d) What do you think?

[KCW]
http://akademy2008.kde.org/conference/presentation/40.php
[KAD] 
http://api.kde.org/4.x-api/kdelibs-apidocs/kdecore/html/classKAboutData.html

Adds two strings to translate.

Cheers
Friedrich
-- 
Okteta - KDE 4 Hex Editor - http://utils.kde.org/projects/okteta

["addingForumAndUserBaseToHelpMenu.patch" (text/x-diff)]

Index: kdelibs/kdeui/actions/kstandardaction.h
===================================================================
--- kdelibs/kdeui/actions/kstandardaction.h	(Revision 893751)
+++ kdelibs/kdeui/actions/kstandardaction.h	(Arbeitskopie)
@@ -152,7 +152,7 @@
     Preferences, ConfigureToolbars,
 
     // Help Menu
-    Help, HelpContents, WhatsThis, ReportBug, AboutApp, AboutKDE,
+    Help, HelpContents, WhatsThis, WebHelpContents, WebForum, ReportBug, AboutApp, \
AboutKDE,  TipofDay,
 
     // Other standard actions
@@ -560,6 +560,18 @@
   KDEUI_EXPORT KAction *whatsThis(const QObject *recvr, const char *slot, QObject \
*parent);  
   /**
+   * Open a webbrowser for the default wiki page, e.g. \
"http://userbase.kde.org/$AppName". +   * @since 4.2
+   */
+  KDEUI_EXPORT KAction *webHelpContents(const QObject *recvr, const char *slot, \
QObject *parent); +
+  /**
+   * Open a webbrowser for a discussion forum, e.g. "http://forum.kde.org".
+   * @since 4.2
+   */
+  KDEUI_EXPORT KAction *webForum(const QObject *recvr, const char *slot, QObject \
*parent); +
+  /**
    * Display "Tip of the Day"
    */
   KDEUI_EXPORT KAction *tipOfDay(const QObject *recvr, const char *slot, QObject \
                *parent);
Index: kdelibs/kdeui/actions/kstandardaction.cpp
===================================================================
--- kdelibs/kdeui/actions/kstandardaction.cpp	(Revision 893751)
+++ kdelibs/kdeui/actions/kstandardaction.cpp	(Arbeitskopie)
@@ -599,6 +599,16 @@
   return KStandardAction::create( WhatsThis, recvr, slot, parent );
 }
 
+KAction *webHelpContents( const QObject *recvr, const char *slot, QObject *parent )
+{
+  return KStandardAction::create( WebHelpContents, recvr, slot, parent );
+}
+
+KAction *webForum( const QObject *recvr, const char *slot, QObject *parent )
+{
+  return KStandardAction::create( WebForum, recvr, slot, parent );
+}
+
 KAction *tipOfDay( const QObject *recvr, const char *slot, QObject *parent )
 {
   return KStandardAction::create( TipofDay, recvr, slot, parent );
Index: kdelibs/kdeui/actions/kstandardaction_p.h
===================================================================
--- kdelibs/kdeui/actions/kstandardaction_p.h	(Revision 893751)
+++ kdelibs/kdeui/actions/kstandardaction_p.h	(Arbeitskopie)
@@ -110,6 +110,8 @@
   { Help,          KStandardShortcut::Help, "help", 0, 0, "help-contents" },
   { HelpContents,  KStandardShortcut::Help, "help_contents", I18N_NOOP("%1 \
&Handbook"), 0, "help-contents" },  { WhatsThis,     KStandardShortcut::WhatsThis, \
"help_whats_this", I18N_NOOP("What's &This?"), 0, "help-contextual" }, +  { \
WebHelpContents, KStandardShortcut::AccelNone, "help_web_contents", I18N_NOOP("Online \
&Documentation"), 0, "help-contents" }, +  { WebForum,      \
KStandardShortcut::AccelNone, "help_web_forum", I18N_NOOP("Discussion &Forum"), 0, \
"meeting-attending" },  { TipofDay,      KStandardShortcut::TipofDay, \
"help_show_tip", I18N_NOOP("Tip of the &Day"), 0, "help-hint" },  { ReportBug,     \
KStandardShortcut::ReportBug, "help_report_bug", I18N_NOOP("&Report Bug..."), 0, \
"tools-report-bug" },  { SwitchApplicationLanguage, \
KStandardShortcut::SwitchApplicationLanguage, "switch_application_language", \
                I18N_NOOP("Switch Application &Language..."), 0, 0 },
Index: kdelibs/kdeui/xmlgui/ui_standards.rc
===================================================================
--- kdelibs/kdeui/xmlgui/ui_standards.rc	(Revision 893751)
+++ kdelibs/kdeui/xmlgui/ui_standards.rc	(Arbeitskopie)
@@ -174,6 +174,8 @@
   <Menu name="help"><text>&amp;Help</text>
     <Action name="help_contents"/>
     <Action name="help_whats_this"/>
+    <Action name="help_web_contents"/>
+    <Action name="help_web_forum"/>
     <Separator/>
     <MergeLocal/>
     <Action name="help_show_tip"/>
Index: kdelibs/kdeui/widgets/khelpmenu.cpp
===================================================================
--- kdelibs/kdeui/widgets/khelpmenu.cpp	(Revision 893751)
+++ kdelibs/kdeui/widgets/khelpmenu.cpp	(Arbeitskopie)
@@ -36,6 +36,7 @@
 #include <kapplication.h>
 #include <kauthorized.h>
 #include <kbugreport.h>
+#include <kconfiggroup.h>
 #include <kdialog.h>
 #include <kguiitem.h>
 #include <khbox.h>
@@ -69,6 +70,8 @@
         mBugReport = 0;
         mHandBookAction = 0;
         mWhatsThisAction = 0;
+        mWebHandBookAction = 0;
+        mWebForumAction = 0;
         mReportBugAction = 0;
         mAboutAppAction = 0;
         mAboutKDEAction = 0;
@@ -94,7 +97,11 @@
 
     bool mShowWhatsThis;
 
-    KAction *mHandBookAction, *mWhatsThisAction;
+    KAction *mHandBookAction;
+    KAction *mWhatsThisAction;
+    KAction *mWebHandBookAction;
+    KAction *mWebForumAction;
+
     QAction *mReportBugAction, *mSwitchApplicationLanguageAction, *mAboutAppAction, \
*mAboutKDEAction;  
     const KAboutData *mAboutData;
@@ -123,6 +130,8 @@
     actions->addAction(KStandardAction::HelpContents, this, \
SLOT(appHelpActivated()));  if (showWhatsThis)
       actions->addAction(KStandardAction::WhatsThis, this, \
SLOT(contextHelpActivated())); +    \
actions->addAction(KStandardAction::WebHelpContents, this, \
SLOT(appWebHelpActivated())); +    actions->addAction(KStandardAction::WebForum, \
                this, SLOT(appWebForumActivated()));
     actions->addAction(KStandardAction::ReportBug, this, SLOT(reportBug()));
     actions->addAction(KStandardAction::SwitchApplicationLanguage, this, \
                SLOT(switchApplicationLanguage()));
     actions->addAction(KStandardAction::AboutApp, this, SLOT(aboutApplication()));
@@ -165,7 +174,22 @@
       d->mMenu->addAction(d->mWhatsThisAction);
       need_separator = true;
     }
+    if (KAuthorized::authorizeKAction("help_web_contents"))
+    {
+      d->mWebHandBookAction = new KAction(KIcon("help-contents"), i18n("Online \
&Documentation"), d->mMenu); +      connect(d->mWebHandBookAction, \
SIGNAL(triggered(bool)), this, SLOT(appWebHelpActivated())); +      \
d->mMenu->addAction(d->mWebHandBookAction); +      need_separator = true;
+    }
 
+    if (KAuthorized::authorizeKAction("help_web_forum"))
+    {
+      d->mWebForumAction = new KAction(KIcon("meeting-attending"), i18n("Discussion \
&Forum"), d->mMenu); +      connect(d->mWebForumAction, SIGNAL(triggered(bool)), \
this, SLOT(appWebForumActivated())); +      d->mMenu->addAction(d->mWebForumAction);
+      need_separator = true;
+    }
+
     if (KAuthorized::authorizeKAction("help_report_bug") && aboutData && \
!aboutData->bugAddress().isEmpty() )  {
       if (need_separator)
@@ -215,6 +239,14 @@
       return d->mWhatsThisAction;
     break;
 
+    case menuWebHelpContents:
+      return d->mWebHandBookAction;
+    break;
+
+    case menuWebForum:
+      return d->mWebForumAction;
+    break;
+
     case menuReportBug:
       return d->mReportBugAction;
     break;
@@ -240,7 +272,29 @@
   KToolInvocation::invokeHelp();
 }
 
+void KHelpMenu::appWebHelpActivated()
+{
+  KConfigGroup configGroup( KGlobal::config(), "Help" );
+  // TODO: add some variables for lowcase/Camelcase translated/unstranslated \
variants +  // Should this be configurable by KAboutData?
+  const QString url = d->mAboutData ?
+    configGroup.readEntry( "WebDocsAppSpecific", \
"http://userbase.kde.org/%1").arg(d->mAboutData->programName()) : +    \
configGroup.readEntry( "WebDocsGeneral", "http://userbase.kde.org/");  
+  KToolInvocation::invokeBrowser( url );
+}
+
+void KHelpMenu::appWebForumActivated()
+{
+  KConfigGroup configGroup( KGlobal::config(), "Help" );
+  // TODO: see appWebHelpActivated
+  const QString url = /*d->mAboutData ?
+    configGroup.readEntry( "WebForumAppSpecific", \
"http://forum.kde.org/%1").arg(d->mAboutData->programName()) :*/ +    \
configGroup.readEntry( "WebForumGeneral", "http://forum.kde.org/"); +
+  KToolInvocation::invokeBrowser( url );
+}
+
 void KHelpMenu::aboutApplication()
 {
   if (receivers(SIGNAL(showAboutApplication())) > 0)
Index: kdelibs/kdeui/widgets/khelpmenu.h
===================================================================
--- kdelibs/kdeui/widgets/khelpmenu.h	(Revision 893751)
+++ kdelibs/kdeui/widgets/khelpmenu.h	(Arbeitskopie)
@@ -170,7 +170,9 @@
       menuAboutApp = 2,
       menuAboutKDE = 3,
       menuReportBug = 4,
-      menuSwitchLanguage = 5
+      menuSwitchLanguage = 5,
+      menuWebHelpContents = 6,
+      menuWebForum = 7
     };
 
     /**
@@ -195,6 +197,18 @@
     void contextHelpActivated();
 
     /**
+     * Starts a webbrowser to load the online help page for the application.
+     * @since 4.2
+     */
+    void appWebHelpActivated();
+
+    /**
+     * Starts a webbrowser to load the online forum for the application.
+     * @since 4.2
+     */
+    void appWebForumActivated();
+
+    /**
      * Opens an application specific dialog box.
      *
      * The method will try to open the about box using the following steps:



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

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