[PATCH] KAboutData::productName for KBugReport

Tobias Koenig tokoe at kde.org
Mon Nov 24 21:55:55 GMT 2003


Hi,

when using an application wich consists of different parts (like kontact
for example ;)) the 'Report Bugs' action in the help menu doesn't work
correctly from time to time since it has no support for components.

The attached patch adds an additional field productName, which is used
by KBugReport to set the name which is passed to Bugzilla.

Ok for commit? We would really need this patch in kontact...

Ciao,
Tobias
-- 
Can a government that shoots at reporters be democratic?
Separate politics from religion and economy!
-------------- next part --------------
Index: kdecore/kaboutdata.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kaboutdata.h,v
retrieving revision 1.34
diff -p -u -b -r1.34 kaboutdata.h
--- kdecore/kaboutdata.h	5 Oct 2003 19:34:26 -0000	1.34
+++ kdecore/kaboutdata.h	24 Nov 2003 21:51:31 -0000
@@ -333,12 +333,29 @@ class KAboutData
     void setLicenseTextFile( const QString &file );
 
     /**
+     * Defines the product name wich will be used in the KBugReport dialog.
+     * By default it's the appName, but you can overwrite it here to provide
+     * support for special components e.g. 'kontact/summary'.
+     *
+     * @param name The name of product
+     */
+    void setProductName( const char *name );
+
+    /**
      * Returns the application's internal name.
      * @return the internal program name.
      */
     const char *appName() const;
 
     /**
+     * Returns the application's product name, which will be used in KBugReport
+     * dialog. By default it returns appName(), otherwise the one which is set
+     * with setProductName()
+     * 
+     * @return the product name.
+     */
+    const char *productName() const;
+    /**
      * Returns the translated program name.
      * @return the program name (translated).
      */
Index: kdecore/kaboutdata.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kaboutdata.cpp,v
retrieving revision 1.17
diff -p -u -b -r1.17 kaboutdata.cpp
--- kdecore/kaboutdata.cpp	25 Apr 2003 18:10:57 -0000	1.17
+++ kdecore/kaboutdata.cpp	24 Nov 2003 21:51:32 -0000
@@ -80,6 +80,7 @@ public:
         {};
     const char *translatorName;
     const char *translatorEmail;
+    const char *productName;
 };
 
 
@@ -104,6 +105,7 @@ KAboutData::KAboutData( const char *appN
   mBugEmailAddress( bugsEmailAddress )
 {
    d = new KAboutDataPrivate;
+   d->productName = 0;
 
    if( appName ) {
      const char *p = strrchr(appName, '/');
@@ -155,6 +157,11 @@ KAboutData::setLicenseTextFile( const QS
   mLicenseKey = License_File;
 }
 
+void
+KAboutData::setProductName( const char *productName )
+{
+  d->productName = productName;
+}
 
 const char *
 KAboutData::appName() const
@@ -162,6 +169,15 @@ KAboutData::appName() const
    return mAppName;
 }
 
+const char *
+KAboutData::productName() const
+{
+   if (d->productName)
+      return d->productName;
+   else
+      return appName();
+}
+
 QString
 KAboutData::programName() const
 {
Index: kdeui/kbugreport.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/kbugreport.cpp,v
retrieving revision 1.84
diff -p -u -b -r1.84 kbugreport.cpp
--- kdeui/kbugreport.cpp	13 Oct 2003 19:50:37 -0000	1.84
+++ kdeui/kbugreport.cpp	24 Nov 2003 21:51:33 -0000
@@ -152,7 +152,7 @@ KBugReport::KBugReport( QWidget * parent
   d->appcombo->insertStrList((const char**)packages);
   connect(d->appcombo, SIGNAL(activated(int)), SLOT(appChanged(int)));
   d->appname = QString::fromLatin1( m_aboutData
-                                    ? m_aboutData->appName()
+                                    ? m_aboutData->productName()
                                     : qApp->name() );
   glay->addWidget( d->appcombo, row, 1 );
   int index = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20031124/f9a0c75e/attachment.sig>


More information about the kde-core-devel mailing list