[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: KCModule::init()
From: Frerich Raabe <frerichraabe () gmx ! de>
Date: 2001-10-10 18:39:11
[Download RAW message or body]
On Sunday 07 October 2001 18:20, Carsten Pfeiffer wrote:
> What about using a KDE namespace for kdelibs classes?
Something like this?
- Frerich
["kaboutdata-namespace-port.diff" (text/x-diff)]
Index: kaboutdata.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kaboutdata.cpp,v
retrieving revision 1.14
diff -u -3 -p -r1.14 kaboutdata.cpp
--- kaboutdata.cpp 2001/06/04 03:43:52 1.14
+++ kaboutdata.cpp 2001/09/06 23:52:58
@@ -26,14 +26,16 @@
#include <qfile.h>
#include <qtextstream.h>
+using namespace KDE;
+
QString
-KAboutPerson::name() const
+AboutPerson::name() const
{
return QString::fromUtf8(mName);
}
QString
-KAboutPerson::task() const
+AboutPerson::task() const
{
if (mTask)
return i18n(mTask);
@@ -42,40 +44,40 @@ KAboutPerson::task() const
}
QString
-KAboutPerson::emailAddress() const
+AboutPerson::emailAddress() const
{
return QString::fromUtf8(mEmailAddress);
}
QString
-KAboutPerson::webAddress() const
+AboutPerson::webAddress() const
{
return QString::fromUtf8(mWebAddress);
}
-KAboutTranslator::KAboutTranslator(const QString & name,
+AboutTranslator::AboutTranslator(const QString & name,
const QString & emailAddress)
{
mName=name;
mEmail=emailAddress;
}
-QString KAboutTranslator::name() const
+QString AboutTranslator::name() const
{
return mName;
}
-QString KAboutTranslator::emailAddress() const
+QString AboutTranslator::emailAddress() const
{
return mEmail;
}
-class KAboutDataPrivate
+class AboutData::Private
{
public:
- KAboutDataPrivate()
+ Private()
: translatorName("_: NAME OF TRANSLATORS\nYour names")
, translatorEmail("_: EMAIL OF TRANSLATORS\nYour emails")
{};
@@ -85,7 +87,7 @@ public:
-KAboutData::KAboutData( const char *appName,
+AboutData::AboutData( const char *appName,
const char *programName,
const char *version,
const char *shortDescription,
@@ -104,7 +106,7 @@ KAboutData::KAboutData( const char *appN
mHomepageAddress( homePageAddress ),
mBugEmailAddress( bugsEmailAddress )
{
- d = new KAboutDataPrivate;
+ d = new Private;
if( appName ) {
const char *p = strrchr(appName, '/');
@@ -116,41 +118,41 @@ KAboutData::KAboutData( const char *appN
mAppName = 0;
}
-KAboutData::~KAboutData()
+AboutData::~AboutData()
{
delete d;
}
void
-KAboutData::addAuthor( const char *name, const char *task,
+AboutData::addAuthor( const char *name, const char *task,
const char *emailAddress, const char *webAddress )
{
- mAuthorList.append(KAboutPerson(name,task,emailAddress,webAddress));
+ mAuthorList.append(AboutPerson(name,task,emailAddress,webAddress));
}
void
-KAboutData::addCredit( const char *name, const char *task,
+AboutData::addCredit( const char *name, const char *task,
const char *emailAddress, const char *webAddress )
{
- mCreditList.append(KAboutPerson(name,task,emailAddress,webAddress));
+ mCreditList.append(AboutPerson(name,task,emailAddress,webAddress));
}
void
-KAboutData::setTranslator( const char *name, const char *emailAddress)
+AboutData::setTranslator( const char *name, const char *emailAddress)
{
d->translatorName=name;
d->translatorEmail=emailAddress;
}
void
-KAboutData::setLicenseText( const char *licenseText )
+AboutData::setLicenseText( const char *licenseText )
{
mLicenseText = licenseText;
mLicenseKey = License_Custom;
}
void
-KAboutData::setLicenseTextFile( const QString &file )
+AboutData::setLicenseTextFile( const QString &file )
{
mLicenseText = qstrdup(QFile::encodeName(file));
mLicenseKey = License_File;
@@ -158,13 +160,13 @@ KAboutData::setLicenseTextFile( const QS
const char *
-KAboutData::appName() const
+AboutData::appName() const
{
return mAppName;
}
QString
-KAboutData::programName() const
+AboutData::programName() const
{
if (mProgramName && *mProgramName)
return i18n(mProgramName);
@@ -173,13 +175,13 @@ KAboutData::programName() const
}
QString
-KAboutData::version() const
+AboutData::version() const
{
return QString::fromLatin1(mVersion);
}
QString
-KAboutData::shortDescription() const
+AboutData::shortDescription() const
{
if (mShortDescription)
return i18n(mShortDescription);
@@ -188,33 +190,33 @@ KAboutData::shortDescription() const
}
QString
-KAboutData::homepage() const
+AboutData::homepage() const
{
return QString::fromLatin1(mHomepageAddress);
}
QString
-KAboutData::bugAddress() const
+AboutData::bugAddress() const
{
return QString::fromLatin1(mBugEmailAddress);
}
-const QValueList<KAboutPerson>
-KAboutData::authors() const
+const QValueList<AboutPerson>
+AboutData::authors() const
{
return mAuthorList;
}
-const QValueList<KAboutPerson>
-KAboutData::credits() const
+const QValueList<AboutPerson>
+AboutData::credits() const
{
return mCreditList;
}
-const QValueList<KAboutTranslator>
-KAboutData::translators() const
+const QValueList<AboutTranslator>
+AboutData::translators() const
{
- QValueList<KAboutTranslator> personList;
+ QValueList<AboutTranslator> personList;
if(d->translatorName == 0)
return personList;
@@ -254,14 +256,14 @@ KAboutData::translators() const
QString name=*nit;
- personList.append(KAboutTranslator( name, email));
+ personList.append(AboutTranslator( name, email));
}
return personList;
}
QString
-KAboutData::aboutTranslationTeam()
+AboutData::aboutTranslationTeam()
{
return i18n("replace this with information about your translation team",
"<p>KDE is translated into many languages thanks to the work "
@@ -271,7 +273,7 @@ KAboutData::aboutTranslationTeam()
}
QString
-KAboutData::otherText() const
+AboutData::otherText() const
{
if (mOtherText)
return i18n(mOtherText);
@@ -281,7 +283,7 @@ KAboutData::otherText() const
QString
-KAboutData::license() const
+AboutData::license() const
{
QString l;
QString f;
Index: kaboutdata.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kaboutdata.h,v
retrieving revision 1.17
diff -u -3 -p -r1.17 kaboutdata.h
--- kaboutdata.h 2001/01/10 16:52:37 1.17
+++ kaboutdata.h 2001/09/06 23:52:59
@@ -22,20 +22,19 @@
#include <qvaluelist.h>
#include <qstring.h>
-#ifndef _KABOUTDATA_H_
-#define _KABOUTDATA_H_
+#ifndef _KDE_ABOUTDATA_H
+#define _KDE_ABOUTDATA_H
-class KAboutPersonPrivate;
-class KAboutDataPrivate;
+namespace KDE {
/**
* This structure is used to store information about a person or developer.
* It can store the person's name, a task, an email address and a
* link to a homepage. This class is intended for use in the
- * @ref KAboutProgram class, but it can be used elsewhere as well.
+ * @ref AboutProgram class, but it can be used elsewhere as well.
* Normally you should at least define the person's name.
*/
-class KAboutPerson
+class AboutPerson
{
public:
/**
@@ -51,7 +50,7 @@ public:
*
* @param _webAddress Homepage of the person.
*/
- KAboutPerson( const char *_name, const char *_task,
+ AboutPerson( const char *_name, const char *_task,
const char *_emailAddress, const char *_webAddress )
{
mName = _name;
@@ -62,7 +61,7 @@ public:
/**
* @internal - don't use. Required by QValueList
*/
- KAboutPerson() {}
+ AboutPerson() {}
/**
* The person's name
@@ -90,22 +89,23 @@ private:
const char *mEmailAddress;
const char *mWebAddress;
- KAboutPersonPrivate *d;
+ class Private;
+ Private *d;
};
/**
* This structure is used to store information about a translator.
* It can store the translator's name and an email address.
- * This class is intended for use in the @ref KAboutProgram class,
+ * This class is intended for use in the @ref AboutProgram class,
* but it can be used elsewhere as well.
* Normally you should at least define the translator's name.
*
- * It's not possible to use @ref KAboutPerson for this, because
- * KAboutPerson stores internaly only const char* pointers, but the
+ * It's not possible to use @ref AboutPerson for this, because
+ * AboutPerson stores internaly only const char* pointers, but the
* translator information is generated dynamically from the translation
* of a dummy string.
*/
-class KAboutTranslator
+class AboutTranslator
{
public:
/**
@@ -115,7 +115,7 @@ public:
*
* @param emailAddress The email address of the person.
*/
- KAboutTranslator(const QString & name=QString::null,
+ AboutTranslator(const QString & name=QString::null,
const QString & emailAddress=QString::null);
/**
@@ -138,10 +138,10 @@ private:
* This class is used to store information about a program. It can store
* such values a version number, program name, homepage, email address
* for bug reporting, multiple authors and contributors
- * (using @ref KAboutPerson), license and copyright information.
+ * (using @ref AboutPerson), license and copyright information.
*
* Currently, the values set here are shown by the "About" box
- * (see @ref KAboutDialog), used by the bug report dialog (see @ref KBugReport),
+ * (see @ref AboutDialog), used by the bug report dialog (see @ref KBugReport),
* and by the help shown on command line (see @ref KCmdLineArguments).
*
* @short Holds information needed by the "About" box and other
@@ -149,7 +149,7 @@ private:
* @author Espen Sand (espen@kde.org), David Faure (faure@kde.org)
* @version $Id: kaboutdata.h,v 1.17 2001/01/10 16:52:37 faure Exp $
*/
-class KAboutData
+class AboutData
{
public:
enum LicenseKey
@@ -201,7 +201,7 @@ class KAboutData
* @param bugsEmailAddress The bug report email address string.
*
*/
- KAboutData( const char *appName,
+ AboutData( const char *appName,
const char *programName,
const char *version,
const char *shortDescription = 0,
@@ -212,7 +212,7 @@ class KAboutData
const char *bugsEmailAddress = "submit@bugs.kde.org"
);
- ~KAboutData();
+ ~AboutData();
/**
* Defines an author. You can call this function as many times you
@@ -277,7 +277,7 @@ class KAboutData
* default strings above are added to the applications po file
* automatically.
*
- * @see KAboutTranslator
+ * @see AboutTranslator
*/
void setTranslator(const char* name, const char* emailAddress);
@@ -336,17 +336,17 @@ class KAboutData
/**
* @return author information (list of persons).
*/
- const QValueList<KAboutPerson> authors() const;
+ const QValueList<AboutPerson> authors() const;
/**
* @return credit information (list of persons).
*/
- const QValueList<KAboutPerson> credits() const;
+ const QValueList<AboutPerson> credits() const;
/**
* @return translators information (list of persons)
*/
- const QValueList<KAboutTranslator> translators() const;
+ const QValueList<AboutTranslator> translators() const;
/**
* @return a message about the translation team
@@ -384,12 +384,20 @@ class KAboutData
const char *mOtherText;
const char *mHomepageAddress;
const char *mBugEmailAddress;
- QValueList<KAboutPerson> mAuthorList;
- QValueList<KAboutPerson> mCreditList;
+ QValueList<AboutPerson> mAuthorList;
+ QValueList<AboutPerson> mCreditList;
const char *mLicenseText;
- KAboutDataPrivate *d;
+ class Private;
+ Private *d;
};
+};
+
+#ifndef KDE_NO_COMPAT
+typedef KDE::AboutPerson KAboutPerson;
+typedef KDE::AboutTranslator KAboutTranslator;
+typedef KDE::AboutData KAboutData;
#endif
+#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic