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

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kernel
From:       Teo Mrnjavac <teo () kde ! org>
Date:       2010-11-10 13:42:31
Message-ID: 20101110134232.004CCAC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1195141 by mrnjavac:

Added Open Collaboration Services related members needed for the social about dialog \
to KAboutData.

 M  +65 -0     kaboutdata.cpp  
 M  +120 -0    kaboutdata.h  


--- trunk/KDE/kdelibs/kdecore/kernel/kaboutdata.cpp #1195140:1195141
@@ -3,6 +3,7 @@
  * 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 Téo 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
@@ -59,6 +60,7 @@
    KLocalizedString _task;
    QString _emailAddress;
    QString _webAddress;
+   QString _ocsUsername;
 
    QString _nameNoop;
 };
@@ -75,6 +77,20 @@
    d->_webAddress = QString::fromUtf8(_webAddress);
 }
 
+KAboutPerson::KAboutPerson( 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);
+   d->_webAddress = QString::fromUtf8(_webAddress);
+   d->_ocsUsername = QString::fromUtf8( _ocsUsername );
+}
+
 KAboutPerson::KAboutPerson( const QString &_name, const QString &_email )
   : d(new Private)
 {
@@ -121,6 +137,11 @@
    return d->_webAddress;
 }
 
+QString
+KAboutPerson::ocsUsername() const
+{
+    return d->_ocsUsername;
+}
 
 KAboutPerson&
 KAboutPerson::operator=(const KAboutPerson& other)
@@ -404,6 +425,8 @@
     bool customAuthorTextEnabled;
 
     QString organizationDomain;
+    QString _ocsProviderId;
+    QString _ocsProviderFile;
 
     // Everything dr.konqi needs, we store as utf-8, so we
     // can just give it a pointer, w/o any allocations.
@@ -503,6 +526,17 @@
 }
 
 KAboutData &
+KAboutData::addAuthor( const KLocalizedString &name,
+                       const KLocalizedString &task,
+                       const QByteArray &emailAddress,
+                       const QByteArray &webAddress,
+                       const QByteArray &ocsUsername )
+{
+  d->_authorList.append(KAboutPerson(name,task,emailAddress,webAddress,ocsUsername));
 +  return *this;
+}
+
+KAboutData &
 KAboutData::addCredit( const KLocalizedString &name,
                        const KLocalizedString &task,
                        const QByteArray &emailAddress,
@@ -513,6 +547,17 @@
 }
 
 KAboutData &
+KAboutData::addCredit( const KLocalizedString &name,
+                       const KLocalizedString &task,
+                       const QByteArray &emailAddress,
+                       const QByteArray &webAddress,
+                       const QByteArray &ocsUsername )
+{
+  d->_creditList.append(KAboutPerson(name,task,emailAddress,webAddress,ocsUsername));
 +  return *this;
+}
+
+KAboutData &
 KAboutData::setTranslator( const KLocalizedString& name,
                            const KLocalizedString& emailAddress )
 {
@@ -577,6 +622,14 @@
 }
 
 KAboutData &
+KAboutData::setOcsProvider(const QByteArray &_ocsProviderId, const QByteArray \
&_ocsProviderFile ) +{
+    d->_ocsProviderId = QString::fromUtf8( _ocsProviderId );
+    d->_ocsProviderFile = QString::fromUtf8( _ocsProviderFile );
+    return *this;
+}
+
+KAboutData &
 KAboutData::setVersion( const QByteArray &_version )
 {
   d->_version = _version;
@@ -729,6 +782,18 @@
 }
 
 QString
+        KAboutData::ocsProviderId() const
+{
+    return d->_ocsProviderId;
+}
+
+QString
+        KAboutData::ocsProviderFile() const
+{
+    return d->_ocsProviderFile;
+}
+
+QString
 KAboutData::version() const
 {
    return QString::fromUtf8(d->_version);
--- trunk/KDE/kdelibs/kdecore/kernel/kaboutdata.h #1195140:1195141
@@ -2,6 +2,7 @@
  * 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 Téo 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
@@ -85,6 +86,25 @@
                            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 KAboutPerson( 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
      */
@@ -127,6 +147,13 @@
      */
     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 KAboutData to construct translator data.
@@ -290,6 +317,37 @@
                            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.
+     *
+     */
+    KAboutData &addAuthor( const KLocalizedString &name,
+                           const KLocalizedString &task,
+                           const QByteArray &emailAddress,
+                           const QByteArray &webAddress,
+                           const QByteArray &ocsUsername );
+
+    /**
      * Defines a person that deserves credit.
      *
      * You can call this function as many times as you need. Each entry
@@ -317,6 +375,37 @@
                            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.
+     *
+     */
+    KAboutData &addCredit( const KLocalizedString &name,
+                           const KLocalizedString &task,
+                           const QByteArray &emailAddress,
+                           const QByteArray &webAddress,
+                           const QByteArray &ocsUsername );
+
+    /**
      * @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
@@ -434,6 +523,24 @@
     KAboutData &setProgramLogo(const QVariant& image);
 
     /**
+     * Specifies an Open Collaboration Services provider.
+     *
+     * Use this if you need to override the default provider or load
+     * a custom provider file different from the default one that
+     * comes with KDE.
+     *
+     * If this method is not used, all the KAboutPerson OCS usernames
+     * will be used with the openDesktop.org entry from the default
+     * provider file, and if a provider file is not specified the
+     * provider ID must be present in the default provider file.
+     *
+     * @param providerId The provider ID as defined in the provider file.
+     * @param providerFile The path of the custom provider file to load
+     *        for use with the defined providerId.
+     */
+    KAboutData &setOcsProvider( const QByteArray &providerId, const QByteArray \
&providerFile = QByteArray() ); +
+    /**
      * Defines the program version string.
      *
      * @param version The program version.
@@ -605,6 +712,19 @@
     QVariant programLogo() const;
 
     /**
+     * Returns the chosen Open Collaboration Services provider ID.
+     * @return the provider ID.
+     */
+    QString ocsProviderId() const;
+
+    /**
+     * Returns the location of an Open Collaboration Services
+     * provider file which contains the needed provider ID.
+     * @return the provider file location.
+     */
+    QString ocsProviderFile() const;
+
+    /**
      * Returns the program's version.
      * @return the version string.
      */


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

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