[SCM] ktp-kded-integration-module packaging branch, master, updated. debian/15.12.1-2-382-gbd961c2

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:12:51 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-kded-module.git;a=commitdiff;h=e69018f

The following commit has been merged in the master branch:
commit e69018f074a22b273279a6b81554c5d5bf82cb03
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Mon Oct 24 14:18:26 2011 +0200

    Error dictionary for displaying human readable error strings
    
    Reviewed-by:
    REVIEW:
    BUG: 282205
---
 CMakeLists.txt                   |   1 +
 error-dictionary.cpp             | 156 +++++++++++++++++++++++++++++++++++++++
 autoaway.h => error-dictionary.h |  39 ++++------
 error-handler.cpp                |   4 +-
 4 files changed, 175 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 17fd7f8..4fad932 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,7 @@ include_directories (${KDE4_INCLUDES}
 )
 
 set (telepathy_module_SRCS
+     error-dictionary.cpp
      telepathy-kded-module-plugin.cpp
      global-presence.cpp
      telepathy-module.cpp
diff --git a/error-dictionary.cpp b/error-dictionary.cpp
new file mode 100644
index 0000000..401825a
--- /dev/null
+++ b/error-dictionary.cpp
@@ -0,0 +1,156 @@
+/*
+    Telepathy error dictionary - usable strings for dbus messages
+    Copyright (C) 2011  Martin Klapetek <martin.klapetek at gmail.com>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+
+#include "error-dictionary.h"
+
+#include <KLocalizedString>
+
+ErrorDictionary* ErrorDictionary::m_instance = NULL;
+
+ErrorDictionary* ErrorDictionary::instance()
+{
+    if (!m_instance) {
+        m_instance = new ErrorDictionary(0);
+    }
+
+    return m_instance;
+}
+
+
+ErrorDictionary::ErrorDictionary(QObject* parent = 0)
+    : QObject(parent)
+{
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.AlreadyConnected"),
+             i18n("Looks like you are already connected from other location and the server does not allow multiple connections"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.AuthenticationFailed"),
+             i18n("Authentication of your account failed (is your password correct?)"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Busy"),
+             i18n("The channel is too busy now to process your request. Try again in a few minutes"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cancelled"),
+             i18n("The connection was canceled on your request"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.Expired"),
+             i18n("The SSL/TLS certificate received from server is expired"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.FingerprintMismatch"),
+             i18n("The SSL/TLS certificate received from server has different fingerprint than expected"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.HostnameMismatch"),
+             i18n("The SSL/TLS certificate received from server has different hostname than expected"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.Insecure"),
+             i18n("The SSL/TLS certificate received from server uses too weak encryption"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.Invalid"),
+             i18n("The SSL/TLS certificate received from server is invalid"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.LimitExceeded"),
+             i18n("The SSL/TLS certificate received from server has exceeded length limit"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.NotActivated"),
+             i18n("The SSL/TLS certificate received from server has not been activated yet"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.NotProvided"),
+             i18n("The server did not provide any SSL/TLS certificate"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.Revoked"),
+             i18n("The SSL/TLS certificate received from server has been revoked"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.SelfSigned"),
+             i18n("The SSL/TLS certificate received from server was self-signed by the server and is untrusted"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Cert.Untrusted"),
+             i18n("The SSL/TLS certificate received from server was not signed by a trusted certificate authority"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Channel.Banned"),
+             i18n("You have been banned from the channel"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Channel.Full"),
+             i18n("The channel is full"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Channel.InviteOnly"),
+             i18n("The channel is invite-only"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Channel.Kicked"),
+             i18n("You have been kicked from the channel"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Confused"),
+             i18n("Congratulate yourself - you just reached an impossible situation"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ConnectionFailed"),
+             i18n("Could not estabilish connection"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ConnectionLost"),
+             i18n("Connection to server was lost"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ConnectionRefused"),
+             i18n("Server refused your connection"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ConnectionReplaced"),
+             i18n("Somewhere there is another client connecting with your account and your current connection is lost"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Disconnected"),
+             i18n("You have been disconnected"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.DoesNotExist"),
+             i18n("You apparently do not exist "));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.EmergencyCallsNotSupported"),
+             i18n("Sorry, emergency calls are not supported"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.EncryptionError"),
+             i18n("An encryption error has occured"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.EncryptionNotAvailable"),
+             i18n("Requested encryption is not available"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.InsufficientBalance"),
+             i18n("Your call credit is too low"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.InvalidArgument"),
+             i18n("An invalid argument was provided"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.InvalidHandle"),
+             i18n("The specified handle is unknown on this channel"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Media.CodecsIncompatible"),
+             i18n("You appear to not have any common codec with the other side"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Media.StreamingError"),
+             i18n("A streaming error has occured (probably not your network related)"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Media.UnsupportedType"),
+             i18n("The requested media stream type is not available"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NetworkError"),
+             i18n("There appears to be a problem with your network, check your connection"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NoAnswer"),
+             i18n("You were removed from the channel because you did not respond")); //FIXME: this sound bad
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NotAvailable"),
+             i18n("This capability is not available"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NotCapable"),
+             i18n("The contact does not have the requested capabilities"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NotImplemented"),
+             i18n("This operation is not implemented"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NotYet"),
+             i18n("This operation is not yet implemented"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.NotYours"),
+             i18n("The requested channel is already being handled by some other process"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Offline"),
+             i18n("This operation is unavailable as the contact is offline"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.PermissionDenied"),
+             i18n("You are not permitted to perform this operation"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.PickedUpElsewhere"),
+             i18n("Current call was picked up by another resource"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.RegistrationExists"),
+             i18n("Account with this username already exists"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Rejected"),
+             i18n("The receiver rejected your call"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ResourceUnavailable"),
+             i18n("There are insufficient resources (like free memory) to finish the operation at the moment"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ServiceBusy"),
+             i18n("Your request hit a busy resource somewhere along the way and the operation was unable to finish"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.ServiceConfused"),
+             i18n("An internal error has occured (known as the 'Confused service error')"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.SoftwareUpgradeRequired"),
+             i18n("You are using too old software. Please try updating all Telepathy packages to a newer version"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.Terminated"),
+             i18n("The channel was terminated for no apparent reason"));
+    m_dict.insert(QLatin1String("org.freedesktop.Telepathy.Error.WouldBreakAnonymity"),
+             i18n("This operation can not be finished as it would break your anonymity request"));
+}
+
+ErrorDictionary::~ErrorDictionary()
+{
+
+}
+
+QString ErrorDictionary::displayErrorMessage(const QString& dbusErrorName) const
+{
+    return m_dict.value(dbusErrorName);
+}
diff --git a/autoaway.h b/error-dictionary.h
similarity index 59%
copy from autoaway.h
copy to error-dictionary.h
index 9b55937..4a47536 100644
--- a/autoaway.h
+++ b/error-dictionary.h
@@ -1,5 +1,5 @@
 /*
-    Auto away-presence setter-class
+    Telepathy error dictionary - usable strings for dbus messages
     Copyright (C) 2011  Martin Klapetek <martin.klapetek at gmail.com>
 
     This library is free software; you can redistribute it and/or
@@ -18,36 +18,27 @@
 */
 
 
-#ifndef AUTOAWAY_H
-#define AUTOAWAY_H
+#ifndef ERROR_DICTIONARY_H
+#define ERROR_DICTIONARY_H
 
-#include "telepathy-kded-module-plugin.h"
+#include <QObject>
+#include <QHash>
 
-#include <TelepathyQt4/Presence>
-#include <TelepathyQt4/AccountManager>
-
-class GlobalPresence;
-
-class AutoAway : public TelepathyKDEDModulePlugin
+class ErrorDictionary : public QObject
 {
-    Q_OBJECT
 
 public:
-    AutoAway(GlobalPresence *globalPresence, QObject* parent = 0);
-    ~AutoAway();
-
-    void readConfig();
+    static ErrorDictionary *instance();
+    virtual ~ErrorDictionary();
 
-public Q_SLOTS:
-    void onSettingsChanged();
-
-private Q_SLOTS:
-    void timeoutReached(int);
-    void backFromIdle();
+    ///Returns an error message usable for displaying to the user
+    QString displayErrorMessage(const QString& dbusErrorName) const;
 
 private:
-    int m_awayTimeoutId;
-    int m_extAwayTimeoutId;
+    ErrorDictionary(QObject *parent);
+    QHash<QString, QString> m_dict;
+
+    static ErrorDictionary *m_instance;
 };
 
-#endif // AUTOAWAY_H
+#endif // ERROR_DICTIONARY_H
diff --git a/error-handler.cpp b/error-handler.cpp
index ada02cc..1f4f8ea 100644
--- a/error-handler.cpp
+++ b/error-handler.cpp
@@ -23,6 +23,8 @@
 #include <KNotification>
 #include <KAboutData>
 
+#include "error-dictionary.h"
+
 ErrorHandler::ErrorHandler(const Tp::AccountManagerPtr& am, QObject* parent)
     : QObject(parent)
 {
@@ -63,7 +65,7 @@ void ErrorHandler::handleErrors(const Tp::ConnectionStatus status)
                 showMessageToUser(i18n("Could not connect %1. There was a network error, check your connection", account->displayName()), ErrorHandler::SystemMessageError);
                 break;
             default:
-                showMessageToUser(i18n("An unexpected error has occurred with %1: '%2'", account->displayName(), account->connectionError()), ErrorHandler::SystemMessageError);
+                showMessageToUser(ErrorDictionary::instance()->displayErrorMessage(connectionError), ErrorHandler::SystemMessageError);
                 break;
         }
     }

-- 
ktp-kded-integration-module packaging



More information about the pkg-kde-commits mailing list