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

List:       kde-core-devel
Subject:    Re: Fwd: [PATCH] configurable discouragement of emailing authors
From:       Clarence Dang <dang () kde ! org>
Date:       2005-02-17 9:56:34
Message-ID: 200502172055.19060.dang () kde ! org
[Download RAW message or body]

On Wed, 16 Feb 2005 03:12 am, Waldo Bastian wrote:
> On Tuesday 15 February 2005 15:17, Stephan Kulow wrote:
> > Am Tuesday 15 February 2005 14:44 schrieb David Faure:
> > > What do you think? Can we maybe come up with a better sentence, or is
> > > it better to have it configurable per application since authors might
> > > indeed feel differently about it?
> >
> > I would say if bug reporting address is similiar to the maintainer, then
> > the sentense should be supressed in any case. I'm not a big fan of the
> > proposed API though ;(
>
> What about something like the attached patch? Similar change required to
> kcmdlineargs.cpp
>
Yes, I like that better.  However, I would still like to be able to either 
give application-specific support instructions or turn off the text entirely.  
See attachment.

Cheers,
Clarence


["kaboutdata-custom_author_text.diff" (text/x-diff)]

Index: kdecore/kaboutdata.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kaboutdata.cpp,v
retrieving revision 1.24
diff -u -p -r1.24 kaboutdata.cpp
--- kdecore/kaboutdata.cpp	31 Dec 2004 16:21:12 -0000	1.24
+++ kdecore/kaboutdata.cpp	17 Feb 2005 09:42:35 -0000
@@ -79,6 +79,7 @@ public:
         , translatorEmail("_: EMAIL OF TRANSLATORS\nYour emails")
         , productName(0)
         , programLogo(0)
+        , customAuthorTextEnabled(false)
         {}
     ~KAboutDataPrivate()
         {
@@ -88,6 +89,8 @@ public:
     const char *translatorEmail;
     const char *productName;
     QImage* programLogo;
+    QString customAuthorPlainText, customAuthorRichText;
+    bool customAuthorTextEnabled;
 };
 
 
@@ -444,3 +447,40 @@ KAboutData::copyrightStatement() const
   else
      return QString::null;
 }
+
+QString
+KAboutData::customAuthorPlainText() const
+{
+  return d->customAuthorPlainText;
+}
+
+QString
+KAboutData::customAuthorRichText() const
+{
+  return d->customAuthorRichText;
+}
+
+bool
+KAboutData::customAuthorTextEnabled() const
+{
+  return d->customAuthorTextEnabled;
+}
+    
+void
+KAboutData::setCustomAuthorText(const QString &plainText, const QString &richText)
+{
+  d->customAuthorPlainText = plainText;
+  d->customAuthorRichText = richText;
+
+  d->customAuthorTextEnabled = true;
+}
+    
+void
+KAboutData::unsetCustomAuthorText()
+{
+  d->customAuthorPlainText = QString::null;
+  d->customAuthorRichText = QString::null;
+
+  d->customAuthorTextEnabled = false;
+}
+
Index: kdecore/kaboutdata.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kaboutdata.h,v
retrieving revision 1.41
diff -u -p -r1.41 kaboutdata.h
--- kdecore/kaboutdata.h	13 Oct 2004 13:03:41 -0000	1.41
+++ kdecore/kaboutdata.h	17 Feb 2005 09:42:37 -0000
@@ -540,6 +540,52 @@ class KDECORE_EXPORT KAboutData
      */
     QString copyrightStatement() const;
 
+    /**
+     * Returns the plain text displayed around the list of authors instead
+     * of the default message telling users to send bug reports to bugAddress().
+     *
+     * @return the plain text displayed around the list of authors instead
+     *         of the default message.  Can be QString::null.
+     */
+    QString customAuthorPlainText() const;
+
+    /**
+     * Returns the rich text displayed around the list of authors instead
+     * of the default message telling users to send bug reports to bugAddress().
+     *
+     * @return the rich text displayed around the list of authors instead
+     *         of the default message.  Can be QString::null.
+     */
+    QString customAuthorRichText() const;
+
+    /**
+     * Returns whether custom text should be displayed around the list of
+     * authors.
+     *
+     * @return whether custom text should be displayed around the list of
+     *         authors.
+     */
+    bool customAuthorTextEnabled() const;
+    
+    /**
+     * Sets the custom text displayed around the list of authors instead
+     * of the default message telling users to send bug reports to bugAddress().
+     *
+     * @param plainText The plain text.
+     * @param richText The rich text.
+     *
+     * Both parameters can be QString::null to not display any message at
+     * all.  Call unsetCustomAuthorText() to revert to the default mesage.
+     */
+    void setCustomAuthorText(const QString &plainText, const QString &richText);
+    
+    /**
+     * Clears any custom text displayed around the list of authors and falls
+     * back to the default message telling users to send bug reports to
+     * bugAddress().
+     */
+    void unsetCustomAuthorText();
+    
   private:
     const char *mAppName;
     const char *mProgramName;
Index: kdecore/kcmdlineargs.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kcmdlineargs.cpp,v
retrieving revision 1.98
diff -u -p -r1.98 kcmdlineargs.cpp
--- kdecore/kcmdlineargs.cpp	27 Jan 2005 12:01:36 -0000	1.98
+++ kdecore/kcmdlineargs.cpp	17 Feb 2005 09:42:39 -0000
@@ -608,12 +608,19 @@ KCmdLineArgs::parseAllArgs()
 	     } else {
 		 printQ( i18n("%1 was written by somebody who wants to remain \
anonymous.").arg(about->programName()) );  }
-	     if (!about->bugAddress().isEmpty())
+	     if (about)
 	     {
-		if (about->bugAddress() == "submit@bugs.kde.org")
-		    printQ( i18n( "Please use http://bugs.kde.org to report bugs, do not mail the \
                authors directly.\n" ) );
-		else
-		    printQ( i18n( "Please use %1 to report bugs, do not mail the authors \
directly.\n" ).arg(about->bugAddress()) ); +                if \
(!about->customAuthorTextEnabled()) +                {
+		  if (about->bugAddress().isEmpty() || about->bugAddress() == \
"submit@bugs.kde.org") +		      printQ( i18n( "Please use http://bugs.kde.org to \
report bugs.\n" ) ); +		  else
+		      printQ( i18n( "Please use %1 to report bugs.\n" ).arg(about->bugAddress()) \
); +                }
+                else if (!about->customAuthorPlainText().isEmpty())
+                {
+                    printQ(about->customAuthorPlainText());
+                }
 	     }
 	     exit(0);
          } else {
Index: kdeui/kaboutapplication.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kaboutapplication.cpp,v
retrieving revision 1.20
diff -u -p -r1.20 kaboutapplication.cpp
--- kdeui/kaboutapplication.cpp	27 Dec 2004 00:00:08 -0000	1.20
+++ kdeui/kaboutapplication.cpp	17 Feb 2005 09:42:44 -0000
@@ -105,12 +105,29 @@ void KAboutApplication::buildDialog( con
       i18n("A&uthor") : i18n("A&uthors");
     KAboutContainer *authorPage = addScrolledContainerPage( authorPageTitle );
 
-    KActiveLabel* activeLabel = new KActiveLabel( authorPage );
-    if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == \
                "submit@bugs.kde.org")
-       activeLabel->setText( i18n( "Please use <a \
href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs, do not mail the \
                authors directly." ) );
-    else
-       activeLabel->setText( i18n( "Please use <a href=\"mailto:%1\">%1</a> to \
report bugs, do not mail the authors directly.\n" \
                ).arg(aboutData->bugAddress()).arg(aboutData->bugAddress()) );
-    authorPage->addWidget( activeLabel );
+    if (!aboutData->customAuthorTextEnabled() || \
!aboutData->customAuthorRichText().isEmpty ()) +    {
+      KActiveLabel* activeLabel = new KActiveLabel( authorPage );
+      if (!aboutData->customAuthorTextEnabled())
+      {
+        if (aboutData->bugAddress().isEmpty() || aboutData->bugAddress() == \
"submit@bugs.kde.org") +        {
+           activeLabel->setText( i18n( "Please use <a \
href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to report bugs." ) ); +        }
+        else
+        {
+           QString url = aboutData->bugAddress();
+           if (!url.startsWith("http:") && !url.startsWith("https:"))
+              url.prepend("mailto:");
+           activeLabel->setText( i18n( "Please use <a href=\"%1\">%2</a> to report \
bugs.\n" ).arg(url).arg(aboutData->bugAddress()) ); +        }
+      }
+      else
+      {
+        activeLabel->setText(aboutData->customAuthorRichText());
+      }
+      authorPage->addWidget( activeLabel );
+    }
 
     QValueList<KAboutPerson>::ConstIterator it;
     for (it = aboutData->authors().begin();



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

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