Page MenuHomePhorge

No OneTemporary

diff --git a/staging/kde4support/src/CMakeLists.txt b/staging/kde4support/src/CMakeLists.txt
index 9b555e89a1..b37d6a972e 100644
--- a/staging/kde4support/src/CMakeLists.txt
+++ b/staging/kde4support/src/CMakeLists.txt
@@ -1,159 +1,161 @@
set(libkde4support_SRCS
kdecore/klibloader.cpp
kdecore/ktemporaryfile.cpp
kdecore/ktempdir.cpp
kdecore/kmd5.cpp
kdecore/kmimetype.cpp
kdecore/kmimetyperepository.cpp
kdecore/ksavefile.cpp
kdecore/k3socks.cpp
kdecore/k3sockssocketdevice.cpp
kdecore/k3socketdevice.cpp
kdecore/k3bufferedsocket.cpp
kdecore/k3clientsocketbase.cpp
kdecore/k3resolver.cpp
kdecore/k3resolvermanager.cpp
kdecore/k3resolverworkerbase.cpp
kdecore/k3resolverstandardworkers.cpp
kdecore/k3reverseresolver.cpp
kdecore/k3serversocket.cpp
kdecore/k3socketaddress.cpp
kdecore/k3socketbase.cpp
kdecore/k3streamsocket.cpp
kdecore/k3socketbuffer.cpp
kdecore/netsupp.cpp
kdecore/kascii.cpp
+ kdecore/k4aboutdata.cpp
kdeui/kapplication.cpp
kdeui/kcolorchoosermode.cpp
kdeui/kcolordialog.cpp
kdeui/kcolorhelpers.cpp
kdeui/kcolorvalueselector.cpp
kdeui/khuesaturationselect.cpp
kdeui/ksessionmanager.cpp
kdeui/kfadewidgeteffect.cpp
kdeui/kicon.cpp
kdeui/knumvalidator.cpp
kdeui/karrowbutton.cpp
kdeui/ksplashscreen.cpp
kdeui/kdialogbuttonbox.cpp
kdeui/kprogressdialog.cpp
kdeui/kmenubar.cpp
kdeui/kstatusbar.cpp
kdeui/ksystemtrayicon.cpp
kdeui/kuniqueapplication.cpp
kdeui/khbox.cpp
kdeui/kvbox.cpp
)
if (Q_OS_WIN)
set(libkde4support_SRCS ${libkde4support_SRCS} kernel/kapplication_win.cpp)
endif (Q_OS_WIN)
include_directories(
${CMAKE_SOURCE_DIR}/kdecore/kernel/ # for KComponentData
${CMAKE_BINARY_DIR}/kdecore/
${CMAKE_SOURCE_DIR}/kdecore/config/
${CMAKE_SOURCE_DIR}/kdecore/io/
${CMAKE_SOURCE_DIR}/kdecore/util/
${CMAKE_SOURCE_DIR}/kdecore/localization/
${KDE4_KDEUI_INCLUDES}
${kcoreaddons_SOURCE_DIR}/src/randomness # for KRandom
${kcoreaddons_SOURCE_DIR}/src/io # for KBackup
${kcoreaddons_BINARY_DIR}/src
${ki18n_SOURCE_DIR}/src
${ki18n_BINARY_DIR}/src
${kconfig_BINARY_DIR}/src/core # ksharedconfig.h
${kconfig_SOURCE_DIR}/src/core
${kservice_BINARY_DIR}/src
${kservice_SOURCE_DIR}/src/sycoca
${kservice_SOURCE_DIR}/src/services
${kwidgets_BINARY_DIR}/src
${kwidgets_SOURCE_DIR}/src/icons # kiconloader
${kwidgets_SOURCE_DIR}/src/utils # kglobalsettings
${kwidgets_SOURCE_DIR}/src/widgets # kpushbutton
${kwidgetsaddons_BINARY_DIR}/src
${kwidgetsaddons_SOURCE_DIR}/src
${kauth_BINARY_DIR}/src
${kauth_SOURCE_DIR}/src # kpushbutton -> kauthaction
${kinterprocesswindowing_BINARY_DIR}/src
${kinterprocesswindowing_SOURCE_DIR}/src
)
# Configure checks for network/ but also for netsupp.*
include(ConfigureChecks.cmake)
configure_file(config-network.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-network.h )
configure_file(config-kde4support.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kde4support.h )
configure_file(kdemacros.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h )
add_library(kde4support ${libkde4support_SRCS})
generate_export_header(kde4support)
target_link_libraries(kde4support ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY} kdecore kcoreaddons kwidgetsaddons kwidgets kauth kdeui ki18n ${X11_LIBRARIES} ${QtMimeTypes_LIBRARY})
set_target_properties(kde4support PROPERTIES VERSION ${ECM_VERSION_STRING} SOVERSION ${ECM_SOVERSION})
install(TARGETS kde4support EXPORT kdelibsLibraryTargets ${ECM_TARGET_DEFAULT_ARGS})
install(FILES
kdecore/klibloader.h
kdecore/ktemporaryfile.h
kdecore/ktempdir.h
kdecore/kmd5.h
kdecore/ksavefile.h
kdecore/k3bufferedsocket.h
kdecore/k3clientsocketbase.h
kdecore/k3resolver.h
kdecore/k3reverseresolver.h
kdecore/k3serversocket.h
kdecore/k3socketaddress.h
kdecore/k3socketbase.h
kdecore/k3socketdevice.h
kdecore/k3socks.h
kdecore/k3sockssocketdevice.h
kdecore/k3streamsocket.h
kdecore/kconfiggroup_kurl.h
kdecore/kmimetype.h
kdecore/kgenericfactory.h
kdecore/kgenericfactory.tcc
kdecore/ktypelist.h
kdecore/kascii.h
+ kdecore/k4aboutdata.h
kdeui/kapplication.h
kdeui/kcolorchoosermode.h
kdeui/kcolordialog.h
kdeui/kcolorvalueselector.h
kdeui/khuesaturationselect.h
kdeui/ksessionmanager.h
kdeui/kfadewidgeteffect.h
kdeui/kicon.h
kdeui/knumvalidator.h
kdeui/karrowbutton.h
kdeui/ksplashscreen.h
kdeui/kdialogbuttonbox.h
kdeui/kprogressdialog.h
kdeui/kmenubar.h
kdeui/kstatusbar.h
kdeui/ksystemtrayicon.h
kdeui/kuniqueapplication.h
kdeui/khbox.h
kdeui/kvbox.h
${CMAKE_CURRENT_BINARY_DIR}/kde4support_export.h
${CMAKE_CURRENT_BINARY_DIR}/kdemacros.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
)
install( FILES kdeui/40.colors kdeui/Oxygen.colors kdeui/Web.colors kdeui/Royal.colors kdeui/Rainbow.colors
DESTINATION ${CONFIG_INSTALL_DIR}/colors)
if (NOT X11_FOUND)
# install our copy of the rgb.txt named colors list on systems without X11
install(FILES kdeui/rgb.txt DESTINATION ${DATA_INSTALL_DIR}/kdeui)
endif (NOT X11_FOUND)
# kparts/*.h
install(FILES
kparts/componentfactory.h
kparts/genericfactory.h
DESTINATION ${INCLUDE_INSTALL_DIR}/kparts COMPONENT Devel
)
diff --git a/staging/kde4support/src/kdecore/k4aboutdata.cpp b/staging/kde4support/src/kdecore/k4aboutdata.cpp
new file mode 100644
index 0000000000..6bc87e4e85
--- /dev/null
+++ b/staging/kde4support/src/kdecore/k4aboutdata.cpp
@@ -0,0 +1,955 @@
+/*
+ * This file is part of the KDE Libraries
+ * Copyright (C) 2000 Espen Sand (espen@kde.org)
+ * Copyright (C) 2006 Nicolas GOUTTE <goutte@kde.org>
+ * Copyright (C) 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
+ * Copyright (C) 2010 Teo Mrnjavac <teo@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "k4aboutdata.h"
+
+#include "qstandardpaths.h"
+#include <QtCore/QFile>
+#include <QtCore/QTextStream>
+#include <QtCore/QSharedData>
+#include <QtCore/QVariant>
+#include <QtCore/QList>
+#include <QHash>
+
+// PORTING HACK (KDE5 TODO: clean up)
+#define i18nc(a,b) QObject::tr(b, a)
+
+// -----------------------------------------------------------------------------
+// Design notes:
+//
+// These classes deal with a lot of text, some of which needs to be
+// marked for translation. Since at the time when these object and calls are
+// made the translation catalogs are usually still not initialized, the
+// translation has to be delayed. This is achieved by using KLocalizedString
+// for translatable strings. KLocalizedStrings are produced by ki18n* calls,
+// instead of the more usuall i18n* calls which produce QString by trying to
+// translate immediately.
+//
+// All the non-translatable string arguments to methods are taken QByteArray,
+// all the translatable are KLocalizedString. The getter methods always return
+// proper QString: the non-translatable strings supplied by the code are
+// treated with QString::fromUtf8(), those coming from the outside with
+// QTextCodec::toUnicode(), and translatable strings are finalized to QStrings
+// at the point of getter calls (i.e. delayed translation).
+// -----------------------------------------------------------------------------
+
+class K4AboutPerson::Private
+{
+public:
+ KLocalizedString _name;
+ KLocalizedString _task;
+ QString _emailAddress;
+ QString _webAddress;
+ QString _ocsUsername;
+
+ QString _nameNoop;
+};
+
+K4AboutPerson::K4AboutPerson( const KLocalizedString &_name,
+ const KLocalizedString &_task,
+ const QByteArray &_emailAddress,
+ const QByteArray &_webAddress )
+ : d(new Private)
+{
+ d->_name = _name;
+ d->_task = _task;
+ d->_emailAddress = QString::fromUtf8(_emailAddress.data());
+ d->_webAddress = QString::fromUtf8(_webAddress.data());
+}
+
+K4AboutPerson::K4AboutPerson( const KLocalizedString &_name,
+ const KLocalizedString &_task,
+ const QByteArray &_emailAddress,
+ const QByteArray &_webAddress,
+ const QByteArray &_ocsUsername )
+ : d(new Private)
+{
+ d->_name = _name;
+ d->_task = _task;
+ d->_emailAddress = QString::fromUtf8(_emailAddress.data());
+ d->_webAddress = QString::fromUtf8(_webAddress.data());
+ d->_ocsUsername = QString::fromUtf8( _ocsUsername.data() );
+}
+
+K4AboutPerson::K4AboutPerson( const QString &_name, const QString &_email )
+ : d(new Private)
+{
+ d->_nameNoop = _name;
+ d->_emailAddress = _email;
+}
+
+K4AboutPerson::K4AboutPerson(const K4AboutPerson& other): d(new Private)
+{
+ *d = *other.d;
+}
+
+K4AboutPerson::~K4AboutPerson()
+{
+ delete d;
+}
+
+QString K4AboutPerson::name() const
+{
+ if (!d->_nameNoop.isEmpty())
+ return d->_nameNoop;
+ return d->_name.toString();
+}
+
+QString K4AboutPerson::task() const
+{
+ if (!d->_task.isEmpty())
+ return d->_task.toString();
+ return QString();
+}
+
+QString K4AboutPerson::emailAddress() const
+{
+ return d->_emailAddress;
+}
+
+
+QString K4AboutPerson::webAddress() const
+{
+ return d->_webAddress;
+}
+
+QString K4AboutPerson::ocsUsername() const
+{
+ return d->_ocsUsername;
+}
+
+K4AboutPerson &K4AboutPerson::operator=(const K4AboutPerson& other)
+{
+ *d = *other.d;
+ return *this;
+}
+
+
+
+class K4AboutLicense::Private : public QSharedData
+{
+public:
+ Private( enum K4AboutData::LicenseKey licenseType, const K4AboutData *aboutData );
+ Private( const QString &pathToFile, const K4AboutData *aboutData );
+ Private( const KLocalizedString &licenseText, const K4AboutData *aboutData );
+ Private( const Private& other);
+public:
+ enum K4AboutData::LicenseKey _licenseKey;
+ KLocalizedString _licenseText;
+ QString _pathToLicenseTextFile;
+ // needed for access to the possibly changing copyrightStatement()
+ const K4AboutData * _aboutData;
+};
+
+K4AboutLicense::Private::Private( enum K4AboutData::LicenseKey licenseType, const K4AboutData *aboutData )
+ : QSharedData(),
+ _licenseKey( licenseType ),
+ _aboutData( aboutData )
+{
+}
+
+K4AboutLicense::Private::Private( const QString &pathToFile, const K4AboutData *aboutData )
+ : QSharedData(),
+ _licenseKey( K4AboutData::License_File ),
+ _pathToLicenseTextFile( pathToFile ),
+ _aboutData( aboutData )
+{
+}
+
+K4AboutLicense::Private::Private( const KLocalizedString &licenseText, const K4AboutData *aboutData )
+ : QSharedData(),
+ _licenseKey( K4AboutData::License_Custom ),
+ _licenseText( licenseText ),
+ _aboutData( aboutData )
+{
+}
+
+K4AboutLicense::Private::Private(const K4AboutLicense::Private& other)
+ : QSharedData(other),
+ _licenseKey( other._licenseKey ),
+ _licenseText( other._licenseText ),
+ _pathToLicenseTextFile( other._pathToLicenseTextFile ),
+ _aboutData( other._aboutData )
+{}
+
+
+K4AboutLicense::K4AboutLicense( enum K4AboutData::LicenseKey licenseType, const K4AboutData *aboutData )
+ : d(new Private(licenseType,aboutData))
+{
+}
+
+K4AboutLicense::K4AboutLicense( const QString &pathToFile, const K4AboutData *aboutData )
+ : d(new Private(pathToFile,aboutData))
+{
+}
+
+K4AboutLicense::K4AboutLicense( const KLocalizedString &licenseText, const K4AboutData *aboutData )
+ : d(new Private(licenseText,aboutData))
+{
+}
+
+K4AboutLicense::K4AboutLicense(const K4AboutLicense& other)
+ : d(other.d)
+{
+}
+
+K4AboutLicense::~K4AboutLicense()
+{}
+
+QString K4AboutLicense::text() const
+{
+ QString result;
+
+ const QString lineFeed = QString::fromLatin1( "\n\n" );
+
+ if (d->_aboutData && !d->_aboutData->copyrightStatement().isEmpty()) {
+ result = d->_aboutData->copyrightStatement() + lineFeed;
+ }
+
+ bool knownLicense = false;
+ QString pathToFile;
+ switch ( d->_licenseKey )
+ {
+ case K4AboutData::License_File:
+ pathToFile = d->_pathToLicenseTextFile;
+ break;
+ case K4AboutData::License_GPL_V2:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/GPL_V2"));
+ break;
+ case K4AboutData::License_LGPL_V2:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/LGPL_V2"));
+ break;
+ case K4AboutData::License_BSD:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/BSD"));
+ break;
+ case K4AboutData::License_Artistic:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/ARTISTIC"));
+ break;
+ case K4AboutData::License_QPL_V1_0:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/QPL_V1.0"));
+ break;
+ case K4AboutData::License_GPL_V3:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/GPL_V3"));
+ break;
+ case K4AboutData::License_LGPL_V3:
+ knownLicense = true;
+ pathToFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("LICENSES/LGPL_V3"));
+ break;
+ case K4AboutData::License_Custom:
+ if (!d->_licenseText.isEmpty()) {
+ result = d->_licenseText.toString();
+ break;
+ }
+ // fall through
+ default:
+ result += QObject::tr("No licensing terms for this program have been specified.\n"
+ "Please check the documentation or the source for any\n"
+ "licensing terms.\n");
+ }
+
+ if (knownLicense) {
+ result += QObject::tr("This program is distributed under the terms of the %1.").arg(name(K4AboutData::ShortName));
+ if (!pathToFile.isEmpty()) {
+ result += lineFeed;
+ }
+ }
+
+ if (!pathToFile.isEmpty()) {
+ QFile file(pathToFile);
+ if (file.open(QIODevice::ReadOnly)) {
+ QTextStream str(&file);
+ result += str.readAll();
+ }
+ }
+
+ return result;
+}
+
+
+QString K4AboutLicense::name(K4AboutData::NameFormat formatName) const
+{
+ QString licenseShort;
+ QString licenseFull;
+
+ switch (d->_licenseKey) {
+ case K4AboutData::License_GPL_V2:
+ licenseShort = i18nc("@item license (short name)","GPL v2");
+ licenseFull = i18nc("@item license","GNU General Public License Version 2");
+ break;
+ case K4AboutData::License_LGPL_V2:
+ licenseShort = i18nc("@item license (short name)","LGPL v2");
+ licenseFull = i18nc("@item license","GNU Lesser General Public License Version 2");
+ break;
+ case K4AboutData::License_BSD:
+ licenseShort = i18nc("@item license (short name)","BSD License");
+ licenseFull = i18nc("@item license","BSD License");
+ break;
+ case K4AboutData::License_Artistic:
+ licenseShort = i18nc("@item license (short name)","Artistic License");
+ licenseFull = i18nc("@item license","Artistic License");
+ break;
+ case K4AboutData::License_QPL_V1_0:
+ licenseShort = i18nc("@item license (short name)","QPL v1.0");
+ licenseFull = i18nc("@item license","Q Public License");
+ break;
+ case K4AboutData::License_GPL_V3:
+ licenseShort = i18nc("@item license (short name)","GPL v3");
+ licenseFull = i18nc("@item license","GNU General Public License Version 3");
+ break;
+ case K4AboutData::License_LGPL_V3:
+ licenseShort = i18nc("@item license (short name)","LGPL v3");
+ licenseFull = i18nc("@item license","GNU Lesser General Public License Version 3");
+ break;
+ case K4AboutData::License_Custom:
+ case K4AboutData::License_File:
+ licenseShort = licenseFull = i18nc("@item license","Custom");
+ break;
+ default:
+ licenseShort = licenseFull = i18nc("@item license","Not specified");
+ }
+
+ const QString result =
+ (formatName == K4AboutData::ShortName ) ? licenseShort :
+ (formatName == K4AboutData::FullName ) ? licenseFull :
+ QString();
+
+ return result;
+}
+
+
+K4AboutLicense &K4AboutLicense::operator=(const K4AboutLicense& other)
+{
+ d = other.d;
+ return *this;
+}
+
+K4AboutData::LicenseKey K4AboutLicense::key() const
+{
+ return d->_licenseKey;
+}
+
+K4AboutLicense K4AboutLicense::byKeyword(const QString &rawKeyword)
+{
+ // Setup keyword->enum dictionary on first call.
+ // Use normalized keywords, by the algorithm below.
+ static QHash<QByteArray, K4AboutData::LicenseKey> ldict;
+ if (ldict.isEmpty()) {
+ ldict.insert("gpl", K4AboutData::License_GPL);
+ ldict.insert("gplv2", K4AboutData::License_GPL_V2);
+ ldict.insert("gplv2+", K4AboutData::License_GPL_V2);
+ ldict.insert("lgpl", K4AboutData::License_LGPL);
+ ldict.insert("lgplv2", K4AboutData::License_LGPL_V2);
+ ldict.insert("lgplv2+", K4AboutData::License_LGPL_V2);
+ ldict.insert("bsd", K4AboutData::License_BSD);
+ ldict.insert("artistic", K4AboutData::License_Artistic);
+ ldict.insert("qpl", K4AboutData::License_QPL);
+ ldict.insert("qplv1", K4AboutData::License_QPL_V1_0);
+ ldict.insert("qplv10", K4AboutData::License_QPL_V1_0);
+ ldict.insert("gplv3", K4AboutData::License_GPL_V3);
+ ldict.insert("gplv3+", K4AboutData::License_GPL_V3);
+ ldict.insert("lgplv3", K4AboutData::License_LGPL_V3);
+ ldict.insert("lgplv3+", K4AboutData::License_LGPL_V3);
+ }
+
+ // Normalize keyword.
+ QString keyword = rawKeyword;
+ keyword = keyword.toLower();
+ keyword.remove(QLatin1Char(' '));
+ keyword.remove(QLatin1Char('.'));
+
+ K4AboutData::LicenseKey license = ldict.value(keyword.toLatin1(),
+ K4AboutData::License_Custom);
+ return K4AboutLicense(license, 0);
+}
+
+
+class K4AboutData::Private
+{
+public:
+ Private()
+ : customAuthorTextEnabled(false)
+ {}
+ QByteArray _appName;
+ KLocalizedString _programName;
+ KLocalizedString _shortDescription;
+ QByteArray _catalogName;
+ KLocalizedString _copyrightStatement;
+ KLocalizedString _otherText;
+ QString _homepageAddress;
+ QList<K4AboutPerson> _authorList;
+ QList<K4AboutPerson> _creditList;
+ QList<K4AboutLicense> _licenseList;
+ KLocalizedString translatorName;
+ KLocalizedString translatorEmail;
+ QString productName;
+ QString programIconName;
+ QVariant programLogo;
+ KLocalizedString customAuthorPlainText, customAuthorRichText;
+ bool customAuthorTextEnabled;
+
+ QString organizationDomain;
+ QByteArray _ocsProviderUrl;
+
+ // Everything dr.konqi needs, we store as utf-8, so we
+ // can just give it a pointer, w/o any allocations.
+ QByteArray _translatedProgramName; // ### I don't see it ever being translated, and I did not change that
+ QByteArray _version;
+ QByteArray _bugEmailAddress;
+};
+
+
+K4AboutData::K4AboutData( const QByteArray &_appName,
+ const QByteArray &_catalogName,
+ const KLocalizedString &_programName,
+ const QByteArray &_version,
+ const KLocalizedString &_shortDescription,
+ enum LicenseKey licenseType,
+ const KLocalizedString &_copyrightStatement,
+ const KLocalizedString &text,
+ const QByteArray &homePageAddress,
+ const QByteArray &bugsEmailAddress
+ )
+ : d(new Private)
+{
+ d->_appName = _appName;
+ int p = d->_appName.indexOf('/');
+ if (p >= 0) {
+ d->_appName = d->_appName.mid(p + 1);
+ }
+
+ d->_catalogName = _catalogName;
+ d->_programName = _programName;
+ if (!d->_programName.isEmpty()) // KComponentData("klauncher") gives empty program name
+ d->_translatedProgramName = _programName.toString().toUtf8();
+ d->_version = _version;
+ d->_shortDescription = _shortDescription;
+ d->_licenseList.append(K4AboutLicense(licenseType,this));
+ d->_copyrightStatement = _copyrightStatement;
+ d->_otherText = text;
+ d->_homepageAddress = QString::fromLatin1(homePageAddress.data());
+ d->_bugEmailAddress = bugsEmailAddress;
+
+ if (d->_homepageAddress.contains(QLatin1String("http://"))) {
+ const int dot = d->_homepageAddress.indexOf(QLatin1Char('.'));
+ if (dot >= 0) {
+ d->organizationDomain = d->_homepageAddress.mid(dot + 1);
+ const int slash = d->organizationDomain.indexOf(QLatin1Char('/'));
+ if (slash >= 0)
+ d->organizationDomain.truncate(slash);
+ }
+ else {
+ d->organizationDomain = QString::fromLatin1("kde.org");
+ }
+ }
+ else {
+ d->organizationDomain = QString::fromLatin1("kde.org");
+ }
+}
+
+K4AboutData::~K4AboutData()
+{
+ delete d;
+}
+
+K4AboutData::K4AboutData(const K4AboutData& other): d(new Private)
+{
+ *d = *other.d;
+ QList<K4AboutLicense>::iterator it = d->_licenseList.begin(), itEnd = d->_licenseList.end();
+ for ( ; it != itEnd; ++it) {
+ K4AboutLicense& al = *it;
+ al.d.detach();
+ al.d->_aboutData = this;
+ }
+}
+
+K4AboutData &K4AboutData::operator=(const K4AboutData& other)
+{
+ if (this != &other) {
+ *d = *other.d;
+ QList<K4AboutLicense>::iterator it = d->_licenseList.begin(), itEnd = d->_licenseList.end();
+ for ( ; it != itEnd; ++it) {
+ K4AboutLicense& al = *it;
+ al.d.detach();
+ al.d->_aboutData = this;
+ }
+ }
+ return *this;
+}
+
+K4AboutData &K4AboutData::addAuthor( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress )
+{
+ d->_authorList.append(K4AboutPerson(name,task,emailAddress,webAddress));
+ return *this;
+}
+
+K4AboutData &K4AboutData::addAuthor( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress,
+ const QByteArray &ocsUsername )
+{
+ d->_authorList.append(K4AboutPerson(name,task,emailAddress,webAddress,ocsUsername));
+ return *this;
+}
+
+K4AboutData &K4AboutData::addCredit( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress )
+{
+ d->_creditList.append(K4AboutPerson(name,task,emailAddress,webAddress));
+ return *this;
+}
+
+K4AboutData &K4AboutData::addCredit( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress,
+ const QByteArray &ocsUsername )
+{
+ d->_creditList.append(K4AboutPerson(name,task,emailAddress,webAddress,ocsUsername));
+ return *this;
+}
+
+K4AboutData &K4AboutData::setTranslator( const KLocalizedString& name,
+ const KLocalizedString& emailAddress )
+{
+ d->translatorName = name;
+ d->translatorEmail = emailAddress;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setLicenseText( const KLocalizedString &licenseText )
+{
+ d->_licenseList[0] = K4AboutLicense(licenseText,this);
+ return *this;
+}
+
+K4AboutData &K4AboutData::addLicenseText( const KLocalizedString &licenseText )
+{
+ // if the default license is unknown, overwrite instead of append
+ K4AboutLicense &firstLicense = d->_licenseList[0];
+ if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == License_Unknown) {
+ firstLicense = K4AboutLicense(licenseText,this);
+ } else {
+ d->_licenseList.append(K4AboutLicense(licenseText,this));
+ }
+ return *this;
+}
+
+K4AboutData &K4AboutData::setLicenseTextFile( const QString &pathToFile )
+{
+ d->_licenseList[0] = K4AboutLicense(pathToFile,this);
+ return *this;
+}
+
+K4AboutData &K4AboutData::addLicenseTextFile( const QString &pathToFile )
+{
+ // if the default license is unknown, overwrite instead of append
+ K4AboutLicense &firstLicense = d->_licenseList[0];
+ if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == License_Unknown) {
+ firstLicense = K4AboutLicense(pathToFile,this);
+ } else {
+ d->_licenseList.append(K4AboutLicense(pathToFile,this));
+ }
+ return *this;
+}
+
+K4AboutData &K4AboutData::setAppName( const QByteArray &_appName )
+{
+ d->_appName = _appName;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setProgramName( const KLocalizedString &_programName )
+{
+ d->_programName = _programName;
+ translateInternalProgramName();
+ return *this;
+}
+
+K4AboutData &K4AboutData::setOcsProvider(const QByteArray &_ocsProviderUrl )
+{
+ d->_ocsProviderUrl = _ocsProviderUrl;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setVersion( const QByteArray &_version )
+{
+ d->_version = _version;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setShortDescription( const KLocalizedString &_shortDescription )
+{
+ d->_shortDescription = _shortDescription;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setCatalogName( const QByteArray &_catalogName )
+{
+ d->_catalogName = _catalogName;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setLicense( LicenseKey licenseKey)
+{
+ d->_licenseList[0] = K4AboutLicense(licenseKey,this);
+ return *this;
+}
+
+K4AboutData &K4AboutData::addLicense( LicenseKey licenseKey)
+{
+ // if the default license is unknown, overwrite instead of append
+ K4AboutLicense &firstLicense = d->_licenseList[0];
+ if (d->_licenseList.count() == 1 && firstLicense.d->_licenseKey == License_Unknown) {
+ firstLicense = K4AboutLicense(licenseKey,this);
+ } else {
+ d->_licenseList.append(K4AboutLicense(licenseKey,this));
+ }
+ return *this;
+}
+
+K4AboutData &K4AboutData::setCopyrightStatement( const KLocalizedString &_copyrightStatement )
+{
+ d->_copyrightStatement = _copyrightStatement;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setOtherText( const KLocalizedString &_otherText )
+{
+ d->_otherText = _otherText;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setHomepage( const QByteArray &_homepage )
+{
+ d->_homepageAddress = QString::fromLatin1(_homepage.data());
+ return *this;
+}
+
+K4AboutData &K4AboutData::setBugAddress( const QByteArray &_bugAddress )
+{
+ d->_bugEmailAddress = _bugAddress;
+ return *this;
+}
+
+K4AboutData &K4AboutData::setOrganizationDomain( const QByteArray &domain )
+{
+ d->organizationDomain = QString::fromLatin1(domain.data());
+ return *this;
+}
+
+K4AboutData &K4AboutData::setProductName( const QByteArray &_productName )
+{
+ d->productName = QString::fromUtf8(_productName.data());
+ return *this;
+}
+
+QString K4AboutData::appName() const
+{
+ return QString::fromUtf8(d->_appName.data());
+}
+
+QString K4AboutData::productName() const
+{
+ if (!d->productName.isEmpty())
+ return d->productName;
+ return appName();
+}
+
+QString K4AboutData::programName() const
+{
+ if (!d->_programName.isEmpty())
+ return d->_programName.toString();
+ return QString();
+}
+
+/// @internal
+/// Return the program name. It is always pre-allocated.
+/// Needed for KCrash in particular.
+const char* K4AboutData::internalProgramName() const
+{
+ return d->_translatedProgramName.constData();
+}
+
+/// @internal
+/// KCrash should call as few things as possible and should avoid e.g. malloc()
+/// because it may deadlock. Since i18n() needs it, when KLocale is available
+/// the i18n() call will be done here in advance.
+void K4AboutData::translateInternalProgramName() const
+{
+ d->_translatedProgramName.clear();
+#pragma message("KDE5 FIXME: This code must be replaced by something with KLocalizedString")
+#if 0
+ if( KLocale::global())
+ d->_translatedProgramName = programName().toUtf8();
+#endif
+}
+
+QString K4AboutData::programIconName() const
+{
+ return d->programIconName.isEmpty() ? appName() : d->programIconName;
+}
+
+K4AboutData &K4AboutData::setProgramIconName( const QString &iconName )
+{
+ d->programIconName = iconName;
+ return *this;
+}
+
+QVariant K4AboutData::programLogo() const
+{
+ return d->programLogo;
+}
+
+K4AboutData &K4AboutData::setProgramLogo(const QVariant& image)
+{
+ d->programLogo = image ;
+ return *this;
+}
+
+QString K4AboutData::ocsProviderUrl() const
+{
+ if( !d->_ocsProviderUrl.isEmpty() )
+ return QString::fromUtf8( d->_ocsProviderUrl.data() );
+ return QString();
+}
+
+QString K4AboutData::version() const
+{
+ return QString::fromUtf8(d->_version.data());
+}
+
+/// @internal
+/// Return the untranslated and uninterpreted (to UTF8) string
+/// for the version information. Used in particular for KCrash.
+const char* K4AboutData::internalVersion() const
+{
+ return d->_version.constData();
+}
+
+QString K4AboutData::shortDescription() const
+{
+ if (!d->_shortDescription.isEmpty())
+ return d->_shortDescription.toString();
+ return QString();
+}
+
+QString K4AboutData::catalogName() const
+{
+ if (!d->_catalogName.isEmpty())
+ return QString::fromUtf8(d->_catalogName.data());
+ // Fallback to appname for catalog name if empty.
+ return QString::fromUtf8(d->_appName.data());
+}
+
+QString K4AboutData::homepage() const
+{
+ return d->_homepageAddress;
+}
+
+QString K4AboutData::bugAddress() const
+{
+ return QString::fromUtf8(d->_bugEmailAddress.data());
+}
+
+QString K4AboutData::organizationDomain() const
+{
+ return d->organizationDomain;
+}
+
+
+/// @internal
+/// Return the untranslated and uninterpreted (to UTF8) string
+/// for the bug mail address. Used in particular for KCrash.
+const char* K4AboutData::internalBugAddress() const
+{
+ if (d->_bugEmailAddress.isEmpty())
+ return 0;
+ return d->_bugEmailAddress.constData();
+}
+
+QList<K4AboutPerson> K4AboutData::authors() const
+{
+ return d->_authorList;
+}
+
+QList<K4AboutPerson> K4AboutData::credits() const
+{
+ return d->_creditList;
+}
+
+#define NAME_OF_TRANSLATORS "Your names"
+#define EMAIL_OF_TRANSLATORS "Your emails"
+QList<K4AboutPerson> K4AboutData::translators() const
+{
+ QList<K4AboutPerson> personList;
+#pragma message("KDE5 TODO: What about this code ?")
+#if 0
+ KLocale *tmpLocale = NULL;
+ if (KLocale::global()) {
+ // There could be many catalogs loaded into the global locale,
+ // e.g. in systemsettings. The tmp locale is needed to make sure we
+ // use the translators name from this aboutdata's catalog, rather than
+ // from any other loaded catalog.
+ tmpLocale = new KLocale(*KLocale::global());
+ tmpLocale->setActiveCatalog(catalogName());
+ }
+#endif
+ QString translatorName;
+ if (!d->translatorName.isEmpty()) {
+ translatorName = d->translatorName.toString();
+ }
+ else {
+ translatorName = qi18nc("NAME OF TRANSLATORS", NAME_OF_TRANSLATORS).toString(); //toString(tmpLocale);
+ }
+
+ QString translatorEmail;
+ if (!d->translatorEmail.isEmpty()) {
+ translatorEmail = d->translatorEmail.toString();
+ }
+ else {
+ translatorEmail = qi18nc("EMAIL OF TRANSLATORS", EMAIL_OF_TRANSLATORS).toString(); //toString(tmpLocale);
+ }
+#if 0
+ delete tmpLocale;
+#endif
+ if ( translatorName.isEmpty() || translatorName == QString::fromUtf8( NAME_OF_TRANSLATORS ) )
+ return personList;
+
+ const QStringList nameList(translatorName.split(QString(QLatin1Char(','))));
+
+ QStringList emailList;
+ if( !translatorEmail.isEmpty() && translatorEmail != QString::fromUtf8( EMAIL_OF_TRANSLATORS ) )
+ {
+ emailList = translatorEmail.split(QString(QLatin1Char(',')), QString::KeepEmptyParts);
+ }
+
+ QStringList::const_iterator nit;
+ QStringList::const_iterator eit = emailList.constBegin();
+
+ for( nit = nameList.constBegin(); nit != nameList.constEnd(); ++nit )
+ {
+ QString email;
+ if ( eit != emailList.constEnd() )
+ {
+ email = *eit;
+ ++eit;
+ }
+
+ personList.append( K4AboutPerson( (*nit).trimmed(), email.trimmed() ) );
+ }
+
+ return personList;
+}
+
+QString K4AboutData::aboutTranslationTeam()
+{
+ return i18nc("replace this with information about your translation team",
+ "<p>KDE is translated into many languages thanks to the work "
+ "of the translation teams all over the world.</p>"
+ "<p>For more information on KDE internationalization "
+ "visit <a href=\"http://l10n.kde.org\">http://l10n.kde.org</a></p>"
+ );
+}
+
+QString K4AboutData::otherText() const
+{
+ if (!d->_otherText.isEmpty())
+ return d->_otherText.toString();
+ return QString();
+}
+
+QString K4AboutData::license() const
+{
+ return d->_licenseList.at(0).text();
+}
+
+QString K4AboutData::licenseName( NameFormat formatName ) const
+{
+ return d->_licenseList.at(0).name(formatName);
+}
+
+QList<K4AboutLicense> K4AboutData::licenses() const
+{
+ return d->_licenseList;
+}
+
+QString K4AboutData::copyrightStatement() const
+{
+ if (!d->_copyrightStatement.isEmpty())
+ return d->_copyrightStatement.toString();
+ return QString();
+}
+
+QString K4AboutData::customAuthorPlainText() const
+{
+ if (!d->customAuthorPlainText.isEmpty())
+ return d->customAuthorPlainText.toString();
+ return QString();
+}
+
+QString K4AboutData::customAuthorRichText() const
+{
+ if (!d->customAuthorRichText.isEmpty())
+ return d->customAuthorRichText.toString();
+ return QString();
+}
+
+bool K4AboutData::customAuthorTextEnabled() const
+{
+ return d->customAuthorTextEnabled;
+}
+
+K4AboutData &K4AboutData::setCustomAuthorText( const KLocalizedString &plainText,
+ const KLocalizedString &richText )
+{
+ d->customAuthorPlainText = plainText;
+ d->customAuthorRichText = richText;
+
+ d->customAuthorTextEnabled = true;
+
+ return *this;
+}
+
+K4AboutData &K4AboutData::unsetCustomAuthorText()
+{
+ d->customAuthorPlainText = KLocalizedString();
+ d->customAuthorRichText = KLocalizedString();
+
+ d->customAuthorTextEnabled = false;
+
+ return *this;
+}
+
diff --git a/staging/kde4support/src/kdecore/k4aboutdata.h b/staging/kde4support/src/kdecore/k4aboutdata.h
new file mode 100644
index 0000000000..663b444cc1
--- /dev/null
+++ b/staging/kde4support/src/kdecore/k4aboutdata.h
@@ -0,0 +1,980 @@
+/*
+ * This file is part of the KDE Libraries
+ * Copyright (C) 2000 Espen Sand (espen@kde.org)
+ * Copyright (C) 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
+ * Copyright (C) 2010 Teo Mrnjavac <teo@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef K4ABOUTDATA_H
+#define K4ABOUTDATA_H
+
+#include <kde4support_export.h>
+#include <klocale.h>
+// Qt
+#include <QtCore/QString>
+#include <QtCore/QSharedDataPointer>
+
+template <class T> class QList;
+class QVariant;
+class K4AboutData;
+
+/**
+ * This class 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 home page. This class is intended for use in the
+ * K4AboutData class, but it can be used elsewhere as well.
+ * Normally you should at least define the person's name.
+ * Creating a K4AboutPerson object by yourself is relatively useless,
+ * but the K4AboutData methods K4AboutData::authors() and K4AboutData::credits()
+ * return lists of K4AboutPerson data objects which you can examine.
+ *
+ * Example usage within a main(), retrieving the list of people involved
+ * with a program and re-using data from one of them:
+ *
+ * @code
+ * K4AboutData about("khello", "khello", ki18n("KHello"), "0.1",
+ * ki18n("A KDE version of Hello, world!"),
+ * K4AboutData::License_LGPL,
+ * ki18n("Copyright (C) 2003 Developer"));
+ *
+ * about.addAuthor(ki18n("Joe Developer"), ki18n("developer"), "joe@host.com", 0);
+ * QList<K4AboutPerson> people = about.authors();
+ * about.addCredit(people[0].name(), people[0].task());
+ * @endcode
+ *
+ * @note Instead of the more usual i18n calls, for translatable text the ki18n
+ * calls are used to produce KLocalizedStrings, which can delay the translation
+ * lookup. This is necessary because the translation catalogs are usually not
+ * yet initialized at the point where K4AboutData is constructed.
+ *
+ * @bc KDE4
+ */
+class KDECORE_EXPORT K4AboutPerson
+{
+ friend class K4AboutData;
+public:
+ /**
+ * Convenience constructor
+ *
+ * @param name The name of the person.
+ *
+ * @param task The task of this person.
+ *
+ * @param emailAddress The email address of the person.
+ *
+ * @param webAddress Home page of the person.
+ */
+ explicit K4AboutPerson( const KLocalizedString &name,
+ const KLocalizedString &task = KLocalizedString(),
+ const QByteArray &emailAddress = QByteArray(),
+ const QByteArray &webAddress = QByteArray() );
+
+ /**
+ * Convenience constructor with Open Collaboration Services data
+ *
+ * @param name The name of the person.
+ *
+ * @param task The task of this person.
+ *
+ * @param emailAddress The email address of the person.
+ *
+ * @param webAddress Home page of the person.
+ *
+ * @param ocsUsername Open Collaboration Services username of the person.
+ */
+ explicit K4AboutPerson( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress,
+ const QByteArray &ocsUsername ); //KDE5: merge into main ctor
+
+ /**
+ * Copy constructor. Performs a deep copy.
+ * @param other object to copy
+ */
+ K4AboutPerson(const K4AboutPerson& other);
+
+ ~K4AboutPerson();
+
+ /**
+ * Assignment operator. Performs a deep copy.
+ * @param other object to copy
+ */
+ K4AboutPerson& operator=(const K4AboutPerson& other);
+
+
+ /**
+ * The person's name
+ * @return the person's name (can be QString(), if it has been
+ * constructed with an empty name)
+ */
+ QString name() const;
+
+ /**
+ * The person's task
+ * @return the person's task (can be QString(), if it has been
+ * constructed with an empty task)
+ */
+ QString task() const;
+
+ /**
+ * The person's email address
+ * @return the person's email address (can be QString(), if it has been
+ * constructed with an empty email)
+ */
+ QString emailAddress() const;
+
+ /**
+ * The home page or a relevant link
+ * @return the persons home page (can be QString(), if it has been
+ * constructed with an empty home page)
+ */
+ QString webAddress() const;
+
+ /**
+ * The person's Open Collaboration Services username
+ * @return the persons OCS username (can be QString(), if it has been
+ * constructed with an empty username)
+ */
+ QString ocsUsername() const;
+
+private:
+ /**
+ * @internal Used by K4AboutData to construct translator data.
+ */
+ explicit K4AboutPerson( const QString &name, const QString &email );
+
+ class Private;
+ Private *const d;
+};
+
+class K4AboutLicense;
+
+// KDE5: refactor together with KComponentData.
+// Like changing all property names which contain Program or App.
+
+/**
+ * This class is used to store information about a program. It can store
+ * such values as version number, program name, home page, email address
+ * for bug reporting, multiple authors and contributors
+ * (using K4AboutPerson), license and copyright information.
+ *
+ * Currently, the values set here are shown by the "About" box
+ * (see K4AboutDialog), used by the bug report dialog (see KBugReport),
+ * and by the help shown on command line (see KCmdLineArgs).
+ * They are also used for the icon and the name of the program's windows.
+ *
+ * @note Instead of the more usual i18n calls, for translatable text the ki18n
+ * calls are used to produce KLocalizedStrings, which can delay the translation
+ * lookup. This is necessary because the translation catalogs are usually not
+ * yet initialized at the point where K4AboutData is constructed.
+ *
+ * @short Holds information needed by the "About" box and other
+ * classes.
+ * @author Espen Sand (espen@kde.org), David Faure (faure@kde.org)
+ */
+class KDECORE_EXPORT K4AboutData
+{
+ public:
+ /**
+ * Describes the license of the software.
+ */
+ enum LicenseKey // KDE5: move to K4AboutLicense, cut License_ prefix
+ {
+ License_Custom = -2,
+ License_File = -1,
+ License_Unknown = 0,
+ License_GPL = 1,
+ License_GPL_V2 = 1,
+ License_LGPL = 2,
+ License_LGPL_V2 = 2,
+ License_BSD = 3,
+ License_Artistic = 4,
+ License_QPL = 5,
+ License_QPL_V1_0 = 5,
+ License_GPL_V3 = 6,
+ License_LGPL_V3 = 7
+ };
+
+ /**
+ * Format of the license name.
+ */
+ enum NameFormat // KDE5: move to K4AboutLicense
+ {
+ ShortName,
+ FullName
+ };
+
+ public:
+ /**
+ * Constructor.
+ *
+ * @param appName The program name used internally. Example: "kedit"
+ *
+ * @param catalogName The translation catalog name; if null or empty, the
+ * @p appName will be used. You may want the catalog name to
+ * differ from program name, for example, when you want to group
+ * translations of several smaller utilities under the same catalog.
+ *
+ * @param programName A displayable program name string. This string
+ * should be marked for translation. Example: ki18n("KEdit")
+ *
+ * @param version The program version string.
+ *
+ * @param shortDescription A short description of what the program does.
+ * This string should be marked for translation.
+ * Example: ki18n("A simple text editor.")
+ *
+ * @param licenseType The license identifier. Use setLicenseText or
+ setLicenseTextFile if you use a license not predefined here.
+ *
+ * @param copyrightStatement A copyright statement, that can look like this:
+ * ki18n("Copyright (C) 1999-2000 Name"). The string specified here is
+ * taken verbatim; the author information from addAuthor is not used.
+ *
+ * @param otherText Some free form text, that can contain any kind of
+ * information. The text can contain newlines. This string
+ * should be marked for translation.
+ *
+ * @param homePageAddress The program homepage string.
+ * Start the address with "http://". "http://some.domain" is
+ * is correct, "some.domain" is not.
+ * IMPORTANT: if you set a home page address, this will change the "organization domain"
+ * of the application, which is used for automatic D-Bus registration.
+ * @see setOrganizationDomain
+ *
+ * @param bugsEmailAddress The bug report email address string.
+ * This defaults to the kde.org bug system.
+ *
+ */
+ K4AboutData( const QByteArray &appName,
+ const QByteArray &catalogName,
+ const KLocalizedString &programName,
+ const QByteArray &version,
+ const KLocalizedString &shortDescription = KLocalizedString(),
+ enum LicenseKey licenseType = License_Unknown,
+ const KLocalizedString &copyrightStatement = KLocalizedString(),
+ const KLocalizedString &otherText = KLocalizedString(),
+ const QByteArray &homePageAddress = QByteArray(),
+ const QByteArray &bugsEmailAddress = "submit@bugs.kde.org"
+ );
+
+ /**
+ * Copy constructor. Performs a deep copy.
+ * @param other object to copy
+ */
+ K4AboutData(const K4AboutData& other);
+
+ /**
+ * Assignment operator. Performs a deep copy.
+ * @param other object to copy
+ */
+ K4AboutData& operator=(const K4AboutData& other);
+
+ ~K4AboutData();
+
+ /**
+ * Defines an author.
+ *
+ * You can call this function as many times as you need. Each entry is
+ * appended to a list. The person in the first entry is assumed to be
+ * the leader of the project.
+ *
+ * @param name The developer's name. It should be marked for translation
+ * like this: ki18n("Developer Name")
+ *
+ * @param task What the person is responsible for. This text can contain
+ * newlines. It should be marked for translation like this:
+ * ki18n("Task description..."). Can be left empty.
+ *
+ * @param emailAddress An Email address where the person can be reached.
+ * Can be left empty.
+ *
+ * @param webAddress The person's homepage or a relevant link.
+ * Start the address with "http://". "http://some.domain" is
+ * correct, "some.domain" is not. Can be left empty.
+ *
+ */
+ K4AboutData &addAuthor( const KLocalizedString &name,
+ const KLocalizedString &task = KLocalizedString(),
+ const QByteArray &emailAddress = QByteArray(),
+ const QByteArray &webAddress = QByteArray() );
+
+ /**
+ * Defines an author.
+ *
+ * You can call this function as many times as you need. Each entry is
+ * appended to a list. The person in the first entry is assumed to be
+ * the leader of the project.
+ *
+ * @param name The developer's name. It should be marked for translation
+ * like this: ki18n("Developer Name")
+ *
+ * @param task What the person is responsible for. This text can contain
+ * newlines. It should be marked for translation like this:
+ * ki18n("Task description..."). Can be left empty.
+ *
+ * @param emailAddress An Email address where the person can be reached.
+ * Can be left empty.
+ *
+ * @param webAddress The person's homepage or a relevant link.
+ * Start the address with "http://". "http://some.domain" is
+ * correct, "some.domain" is not. Can be left empty.
+ *
+ * @param ocsUsername The person's Open Collaboration Services username.
+ * The provider can be optionally specified with @see setOcsProvider.
+ *
+ */
+ K4AboutData &addAuthor( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress,
+ const QByteArray &ocsUsername ); //KDE5: merge with addAuthor
+
+ /**
+ * Defines a person that deserves credit.
+ *
+ * You can call this function as many times as you need. Each entry
+ * is appended to a list.
+ *
+ * @param name The person's name. It should be marked for translation
+ * like this: ki18n("Contributor Name")
+ *
+ * @param task What the person has done to deserve the honor. The
+ * text can contain newlines. It should be marked for
+ * translation like this: ki18n("Task description...")
+ * Can be left empty.
+ *
+ * @param emailAddress An email address when the person can be reached.
+ * Can be left empty.
+ *
+ * @param webAddress The person's homepage or a relevant link.
+ * Start the address with "http://". "http://some.domain" is
+ * is correct, "some.domain" is not. Can be left empty.
+ *
+ */
+ K4AboutData &addCredit( const KLocalizedString &name,
+ const KLocalizedString &task = KLocalizedString(),
+ const QByteArray &emailAddress = QByteArray(),
+ const QByteArray &webAddress = QByteArray() );
+
+ /**
+ * Defines a person that deserves credit.
+ *
+ * You can call this function as many times as you need. Each entry
+ * is appended to a list.
+ *
+ * @param name The person's name. It should be marked for translation
+ * like this: ki18n("Contributor Name")
+ *
+ * @param task What the person has done to deserve the honor. The
+ * text can contain newlines. It should be marked for
+ * translation like this: ki18n("Task description...")
+ * Can be left empty.
+ *
+ * @param emailAddress An email address when the person can be reached.
+ * Can be left empty.
+ *
+ * @param webAddress The person's homepage or a relevant link.
+ * Start the address with "http://". "http://some.domain" is
+ * is correct, "some.domain" is not. Can be left empty.
+ *
+ * @param ocsUsername The person's Open Collaboration Services username.
+ * The provider can be optionally specified with @see setOcsProvider.
+ *
+ */
+ K4AboutData &addCredit( const KLocalizedString &name,
+ const KLocalizedString &task,
+ const QByteArray &emailAddress,
+ const QByteArray &webAddress,
+ const QByteArray &ocsUsername ); //KDE5: merge with addCredit
+
+ /**
+ * @brief Sets the name(s) of the translator(s) of the GUI.
+ *
+ * Since this depends on the language, just use a dummy text marked for
+ * translation.
+ *
+ * The canonical use is:
+ *
+ * \code
+ * setTranslator(ki18nc("NAME OF TRANSLATORS", "Your names"),
+ * ki18nc("EMAIL OF TRANSLATORS", "Your emails"));
+ * \endcode
+ *
+ * The translator can then translate this dummy text with his name
+ * or with a list of names separated with ",".
+ * If there is no translation or the application is used with the
+ * default language, this function call is ignored.
+ *
+ * @param name the name(s) of the translator(s)
+ * @param emailAddress the email address(es) of the translator(s)
+ * @see K4AboutTranslator
+ */
+ K4AboutData &setTranslator( const KLocalizedString& name,
+ const KLocalizedString& emailAddress );
+
+ /**
+ * Defines a license text, which is marked for translation.
+ *
+ * Example:
+ * \code
+ * setLicenseText( ki18n("This is my license") );
+ * \endcode
+ *
+ * @param license The license text.
+ */
+ K4AboutData &setLicenseText( const KLocalizedString &license );
+
+ /**
+ * Adds a license text, which is marked for translation.
+ *
+ * If there is only one unknown license set, e.g. by using the default
+ * parameter in the constructor, that one is replaced.
+ *
+ * Example:
+ * \code
+ * addLicenseText( ki18n("This is my license") );
+ * \endcode
+ *
+ * @param license The license text.
+ * @see setLicenseText, addLicense, addLicenseTextFile
+ * @since 4.1
+ */
+ K4AboutData &addLicenseText( const KLocalizedString &license );
+
+ /**
+ * Defines a license text by pointing to a file where it resides.
+ * The file format has to be plain text in an encoding compatible to the locale.
+ *
+ * @param file Path to the file in the local filesystem containing the license text.
+ */
+ K4AboutData &setLicenseTextFile( const QString &file );
+
+ /**
+ * Adds a license text by pointing to a file where it resides.
+ * The file format has to be plain text in an encoding compatible to the locale.
+ *
+ * If there is only one unknown license set, e.g. by using the default
+ * parameter in the constructor, that one is replaced.
+ *
+ * @param file Path to the file in the local filesystem containing the license text.
+ * @see addLicenseText, addLicense, setLicenseTextFile
+ * @since 4.1
+ */
+ K4AboutData &addLicenseTextFile( const QString &file );
+
+ /**
+ * Defines the program name used internally.
+ *
+ * @param appName The application name. Example: "kate".
+ */
+ K4AboutData &setAppName( const QByteArray &appName );
+
+ /**
+ * Defines the displayable program name string.
+ *
+ * @param programName The program name. This string should be
+ * marked for translation.
+ * Example: ki18n("Advanced Text Editor").
+ */
+ K4AboutData &setProgramName( const KLocalizedString &programName );
+
+ /**
+ * Defines the program icon.
+ *
+ * Use this if you need to have an application icon
+ * whose name is different than the application name.
+ *
+ * @param iconName name of the icon. Example: "accessories-text-editor"
+ * @see programIconName()
+ * @since 4.1
+ */
+ K4AboutData &setProgramIconName( const QString &iconName );
+
+ /**
+ * Defines the program logo.
+ *
+ * Use this if you need to have an application logo
+ * in AboutData other than the application icon.
+ *
+ * Because K4AboutData is in kdecore it cannot use QImage directly,
+ * so this is a QVariant that should contain a QImage.
+ *
+ * @param image logo image.
+ * @see programLogo()
+ */
+ K4AboutData &setProgramLogo(const QVariant& image);
+
+ /**
+ * Specifies an Open Collaboration Services provider by URL.
+ * A provider file must be available for the chosen provider.
+ *
+ * Use this if you need to override the default provider.
+ *
+ * If this method is not used, all the K4AboutPerson OCS usernames
+ * will be used with the openDesktop.org entry from the default
+ * provider file.
+ *
+ * @param providerUrl The provider URL as defined in the provider file.
+ */
+ K4AboutData &setOcsProvider( const QByteArray &providerUrl );
+
+ /**
+ * Defines the program version string.
+ *
+ * @param version The program version.
+ */
+ K4AboutData &setVersion( const QByteArray &version );
+
+ /**
+ * Defines a short description of what the program does.
+ *
+ * @param shortDescription The program description. This string should
+ * be marked for translation. Example: ki18n("An advanced text
+ * editor with syntax highlighting support.").
+ */
+ K4AboutData &setShortDescription( const KLocalizedString &shortDescription );
+
+ /**
+ * Defines the translation catalog that the program uses.
+ *
+ * @param catalogName The translation catalog name.
+ */
+ K4AboutData &setCatalogName( const QByteArray &catalogName );
+
+ /**
+ * Defines the license identifier.
+ *
+ * @param licenseKey The license identifier.
+ * @see addLicenseText, setLicenseText, setLicenseTextFile
+ */
+ K4AboutData &setLicense( LicenseKey licenseKey );
+
+ /**
+ * Adds a license identifier.
+ *
+ * If there is only one unknown license set, e.g. by using the default
+ * parameter in the constructor, that one is replaced.
+ *
+ * @param licenseKey The license identifier.
+ * @see setLicenseText, addLicenseText, addLicenseTextFile
+ * @since 4.1
+ */
+ K4AboutData &addLicense( LicenseKey licenseKey );
+
+ /**
+ * Defines the copyright statement to show when displaying the license.
+ *
+ * @param copyrightStatement A copyright statement, that can look like
+ * this: ki18n("Copyright (C) 1999-2000 Name"). The string specified here is
+ * taken verbatim; the author information from addAuthor is not used.
+ */
+ K4AboutData &setCopyrightStatement( const KLocalizedString &copyrightStatement );
+
+ /**
+ * Defines the additional text to show in the about dialog.
+ *
+ * @param otherText Some free form text, that can contain any kind of
+ * information. The text can contain newlines. This string
+ * should be marked for translation.
+ */
+ K4AboutData &setOtherText( const KLocalizedString &otherText );
+
+ /**
+ * Defines the program homepage.
+ *
+ * @param homepage The program homepage string.
+ * Start the address with "http://". "http://kate.kde.org"
+ * is correct but "kate.kde.org" is not.
+ */
+ K4AboutData &setHomepage( const QByteArray &homepage );
+
+ /**
+ * Defines the address where bug reports should be sent.
+ *
+ * @param bugAddress The bug report email address string.
+ * This defaults to the kde.org bug system.
+ */
+ K4AboutData &setBugAddress( const QByteArray &bugAddress );
+
+ /**
+ * Defines the Internet domain of the organization that wrote this application.
+ * The domain is set to kde.org by default, or the domain of the homePageAddress constructor argument,
+ * if set.
+ *
+ * Make sure to call setOrganizationDomain if your product is developed out of the
+ * kde.org version-control system.
+ *
+ * Used by the automatic registration to D-Bus done by KApplication and KUniqueApplication.
+ *
+ * IMPORTANT: if the organization domain is set, the .desktop file that describes your
+ * application should have an entry like X-DBUS-ServiceName=reversed_domain.kmyapp
+ * For instance kwrite passes "http://www.kate-editor.org" as the homePageAddress so it needs
+ * X-DBUS-ServiceName=org.kate-editor.kwrite in its kwrite.desktop file.
+ *
+ * @param domain the domain name, for instance kde.org, koffice.org, kdevelop.org, etc.
+ */
+ K4AboutData &setOrganizationDomain( const QByteArray &domain );
+
+ /**
+ * Defines the product name which 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. in the form 'product/component',
+ * such as 'kontact/summary'.
+ *
+ * @param name The name of product
+ */
+ K4AboutData &setProductName( const QByteArray &name );
+
+ /**
+ * Returns the application's internal name.
+ * @return the internal program name.
+ */
+ QString 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.
+ */
+ QString productName() const;
+
+ /**
+ * Returns the translated program name.
+ * @return the program name (translated).
+ */
+ QString programName() const;
+
+ /**
+ * Returns the domain name of the organization that wrote this application.
+ *
+ * Used by the automatic registration to D-Bus done by KApplication and KUniqueApplication.
+ */
+ QString organizationDomain() const;
+
+ /**
+ * @internal
+ * Provided for use by KCrash
+ */
+ const char* internalProgramName() const;
+
+ /**
+ * @internal
+ * Provided for use by KCrash
+ */
+ void translateInternalProgramName() const;
+
+ /**
+ * Returns the program's icon name.
+ *
+ * The default value is appName().
+ * Use setProgramIconName() if you need to have an icon
+ * whose name is different from the internal application name.
+ *
+ * @return the program's icon name.
+ * @see setProgramIconName()
+ * @since 4.1
+ */
+ QString programIconName() const;
+
+ /**
+ * Returns the program logo image.
+ *
+ * Because K4AboutData is in kdecore it cannot use QImage directly,
+ * so this is a QVariant containing a QImage.
+ *
+ * @return the program logo data, or a null image if there is
+ * no custom application logo defined.
+ */
+ QVariant programLogo() const;
+
+ /**
+ * Returns the chosen Open Collaboration Services provider URL.
+ * @return the provider URL.
+ */
+ QString ocsProviderUrl() const;
+
+ /**
+ * Returns the program's version.
+ * @return the version string.
+ */
+ QString version() const;
+
+ /**
+ * @internal
+ * Provided for use by KCrash
+ */
+ const char* internalVersion() const;
+
+ /**
+ * Returns a short, translated description.
+ * @return the short description (translated). Can be
+ * QString() if not set.
+ */
+ QString shortDescription() const;
+
+ /**
+ * Returns the program's translation catalog name.
+ * @return the catalog name.
+ */
+ QString catalogName() const;
+
+ /**
+ * Returns the application homepage.
+ * @return the application homepage URL. Can be QString() if
+ * not set.
+ */
+ QString homepage() const;
+
+ /**
+ * Returns the email address for bugs.
+ * @return the email address where to report bugs.
+ */
+ QString bugAddress() const;
+
+ /**
+ * @internal
+ * Provided for use by KCrash
+ */
+ const char* internalBugAddress() const;
+
+ /**
+ * Returns a list of authors.
+ * @return author information (list of persons).
+ */
+ QList<K4AboutPerson> authors() const;
+
+ /**
+ * Returns a list of persons who contributed.
+ * @return credit information (list of persons).
+ */
+ QList<K4AboutPerson> credits() const;
+
+ /**
+ * Returns a list of translators.
+ * @return translators information (list of persons)
+ */
+ QList<K4AboutPerson> translators() const;
+
+ /**
+ * Returns a message about the translation team.
+ * @return a message about the translation team
+ */
+ static QString aboutTranslationTeam();
+
+ /**
+ * Returns a translated, free form text.
+ * @return the free form text (translated). Can be QString() if not set.
+ */
+ QString otherText() const;
+
+ /**
+ * Returns the license. If the licenseType argument of the constructor has been
+ * used, any text defined by setLicenseText is ignored,
+ * and the standard text for the chosen license will be returned.
+ *
+ * @return The license text.
+ *
+ * @deprecated There could be multiple licenses, use licenses() instead.
+ */
+ QString license() const;
+
+ /**
+ * Returns the license name.
+ *
+ * @return The license name as a string.
+ *
+ * @deprecated There could be multiple licenses, use licenses() instead.
+ */
+ QString licenseName(NameFormat formatName) const;
+
+ /**
+ * Returns a list of licenses.
+ *
+ * @return licenses information (list of licenses)
+ * @since 4.1
+ */
+ QList<K4AboutLicense> licenses() const;
+
+ /**
+ * Returns the copyright statement.
+ * @return the copyright statement. Can be QString() if not set.
+ */
+ 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().
+ */
+ 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().
+ */
+ 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.
+ *
+ * Setting both to parameters to KLocalizedString() will cause no message to be
+ * displayed at all. Call unsetCustomAuthorText() to revert to the default
+ * message.
+ */
+ K4AboutData &setCustomAuthorText(const KLocalizedString &plainText,
+ const KLocalizedString &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().
+ */
+ K4AboutData &unsetCustomAuthorText();
+
+ private:
+
+ class Private;
+ Private *const d;
+};
+
+
+/**
+ * This class is used to store information about a license.
+ * The license can be one of some predefined, one given as text or one
+ * that can be loaded from a file. This class is used in the K4AboutData class.
+ * Explicitly creating a K4AboutLicense object is not possible.
+ * If the license is wanted for a KDE component having K4AboutData object,
+ * use K4AboutData::licenses() to get the licenses for that component.
+ * If the license is for a non-code resource and given by a keyword
+ * (e.g. in .desktop files), try using K4AboutLicense::byKeyword().
+ *
+ * @note Instead of the more usual i18n calls, for translatable text the ki18n
+ * calls are used to produce KLocalizedStrings, which can delay the translation
+ * lookup. This is necessary because the translation catalogs are usually not
+ * yet initialized at the point where K4AboutData is constructed.
+ */
+class KDECORE_EXPORT K4AboutLicense
+{
+ friend class K4AboutData;
+public:
+ /**
+ * Copy constructor. Performs a deep copy.
+ * @param other object to copy
+ */
+ K4AboutLicense(const K4AboutLicense& other);
+
+ ~K4AboutLicense();
+
+ /**
+ * Assignment operator. Performs a deep copy.
+ * @param other object to copy
+ */
+ K4AboutLicense& operator=(const K4AboutLicense& other);
+
+
+ /**
+ * Returns the full license text. If the licenseType argument of the
+ * constructor has been used, any text defined by setLicenseText is ignored,
+ * and the standard text for the chosen license will be returned.
+ *
+ * @return The license text.
+ */
+ QString text() const;
+
+ /**
+ * Returns the license name.
+ *
+ * @return The license name as a string.
+ */
+ QString name(K4AboutData::NameFormat formatName) const;
+
+ /**
+ * Returns the license key.
+ *
+ * @return The license key as element of K4AboutData::LicenseKey enum.
+ * @since 4.1
+ */
+ K4AboutData::LicenseKey key() const;
+
+ /**
+ * Fetch a known license by a keyword.
+ *
+ * Frequently the license data is provided by a terse keyword-like string,
+ * e.g. by a field in a .desktop file. Using this method, an application
+ * can get hold of a proper K4AboutLicense object, providing that the
+ * license is one of the several known to KDE, and use it to present
+ * more human-readable information to the user.
+ *
+ * Keywords are matched by stripping all whitespace and lowercasing.
+ * The known keywords correspond to the K4AboutData::LicenseKey enumeration,
+ * e.g. any of "LGPLV3", "LGPLv3", "LGPL v3" would match License_LGPL_V3.
+ * If there is no match for the keyword, a valid license object is still
+ * returned, with its name and text informing about a custom license,
+ * and its key equal to K4AboutData::License_Custom.
+ *
+ * @param keyword The license keyword.
+ * @return The license object.
+ *
+ * @see K4AboutData::LicenseKey
+ * @since 4.1
+ */
+ static K4AboutLicense byKeyword(const QString &keyword);
+
+private:
+ /**
+ * @internal Used by K4AboutData to construct a predefined license.
+ */
+ explicit K4AboutLicense( enum K4AboutData::LicenseKey licenseType, const K4AboutData *aboutData );
+ /**
+ * @internal Used by K4AboutData to construct license by given text
+ */
+ explicit K4AboutLicense( const QString &pathToFile, const K4AboutData *aboutData );
+ /**
+ * @internal Used by K4AboutData to construct license by given text
+ */
+ explicit K4AboutLicense( const KLocalizedString &licenseText, const K4AboutData *aboutData );
+
+ class Private;
+ QSharedDataPointer<Private> d;
+};
+
+#endif
+

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 9:32 AM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10075974
Default Alt Text
(70 KB)

Event Timeline