• Skip to content
  • Skip to link menu
  • KDE API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • KTp
error-dictionary.cpp
Go to the documentation of this file.
1 /*
2  Telepathy error dictionary - usable strings for dbus messages
3  Copyright (C) 2011 Martin Klapetek <martin.klapetek@gmail.com>
4  Copyright (C) 2011 Dario Freddi <dario.freddi@collabora.com>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 
22 #include "error-dictionary.h"
23 
24 #include <TelepathyQt/Constants>
25 
26 #include <KLocalizedString>
27 #include <KGlobal>
28 #include <KLocale>
29 #include <KDebug>
30 
31 namespace KTp
32 {
33 
34 QString ErrorDictionary::displayVerboseErrorMessage(const QString& dbusErrorName)
35 {
36  if (dbusErrorName == QLatin1String(TP_QT_ERROR_ALREADY_CONNECTED)) {
37  return i18nc("Verbose user visible error string", "Looks like you are already connected from other location and the server does not allow multiple connections");
38  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_AUTHENTICATION_FAILED)) {
39  return i18nc("Verbose user visible error string", "Authentication of your account failed (is your password correct?)");
40  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_BUSY)) {
41  return i18nc("Verbose user visible error string", "The channel is too busy now to process your request. Try again in a few minutes");
42  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CANCELLED)) {
43  return i18nc("Verbose user visible error string", "The connection was canceled on your request");
44  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_EXPIRED)) {
45  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server is expired");
46  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_FINGERPRINT_MISMATCH)) {
47  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server has different fingerprint than expected");
48  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_HOSTNAME_MISMATCH)) {
49  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server has different hostname than expected");
50  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_INSECURE)) {
51  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server uses too weak encryption");
52  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_INVALID)) {
53  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server is invalid");
54  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_LIMIT_EXCEEDED)) {
55  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server has exceeded length limit");
56  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_NOT_ACTIVATED)) {
57  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server has not been activated yet");
58  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_NOT_PROVIDED)) {
59  return i18nc("Verbose user visible error string", "The server did not provide any SSL/TLS certificate");
60  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_REVOKED)) {
61  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server has been revoked");
62  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_SELF_SIGNED)) {
63  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server was self-signed by the server and is untrusted");
64  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_UNTRUSTED)) {
65  return i18nc("Verbose user visible error string", "The SSL/TLS certificate received from server was not signed by a trusted certificate authority");
66  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_BANNED)) {
67  return i18nc("Verbose user visible error string", "You have been banned from the channel");
68  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_FULL)) {
69  return i18nc("Verbose user visible error string", "The channel is full");
70  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_INVITE_ONLY)) {
71  return i18nc("Verbose user visible error string", "The channel is invite-only");
72  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_KICKED)) {
73  return i18nc("Verbose user visible error string", "You have been kicked from the channel");
74  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONFUSED)) {
75  return i18nc("Verbose user visible error string", "An unexpected error has occurred");
76  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_FAILED)) {
77  return i18nc("Verbose user visible error string", "Could not establish connection");
78  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_LOST)) {
79  return i18nc("Verbose user visible error string", "Connection to server was lost");
80  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_REFUSED)) {
81  return i18nc("Verbose user visible error string", "Server refused your connection");
82  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_REPLACED)) {
83  return i18nc("Verbose user visible error string", "Somewhere there is another client connecting with your account and your current connection is lost");
84  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_DISCONNECTED)) {
85  return i18nc("Verbose user visible error string", "You have been disconnected");
86  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_DOES_NOT_EXIST)) {
87  return i18nc("Verbose user visible error string", "Selected user does not exist");
88  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_EMERGENCY_CALLS_NOT_SUPPORTED)) {
89  return i18nc("Verbose user visible error string", "Emergency calls are not supported");
90  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_ENCRYPTION_ERROR)) {
91  return i18nc("Verbose user visible error string", "An encryption error has occurred");
92  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_ENCRYPTION_NOT_AVAILABLE)) {
93  return i18nc("Verbose user visible error string", "Requested encryption is not available");
94  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_INVALID_ARGUMENT)) {
95  return i18nc("Verbose user visible error string", "An invalid argument was provided");
96  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_INVALID_HANDLE)) {
97  return i18nc("Verbose user visible error string", "The specified handle is unknown on this channel");
98  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NETWORK_ERROR)) {
99  return i18nc("Verbose user visible error string", "There appears to be a problem with your network, check your connection");
100  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NO_ANSWER)) {
101  return i18nc("Verbose user visible error string", "You were removed from the channel because you did not respond"); //FIXME: this sound bad
102  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_AVAILABLE)) {
103  return i18nc("Verbose user visible error string", "This capability is not available");
104  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_CAPABLE)) {
105  return i18nc("Verbose user visible error string", "The contact does not have the requested capabilities");
106  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_IMPLEMENTED)) {
107  return i18nc("Verbose user visible error string", "This operation is not implemented");
108  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_YET)) {
109  return i18nc("Verbose user visible error string", "This operation is not yet implemented");
110  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_YOURS)) {
111  return i18nc("Verbose user visible error string", "The requested channel is already being handled by some other process");
112  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_OFFLINE)) {
113  return i18nc("Verbose user visible error string", "This operation is unavailable for offline contacts");
114  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_PERMISSION_DENIED)) {
115  return i18nc("Verbose user visible error string", "You are not permitted to perform this operation");
116  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_PICKED_UP_ELSEWHERE)) {
117  return i18nc("Verbose user visible error string", "Current call was picked up by another resource");
118  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_REGISTRATION_EXISTS)) {
119  return i18nc("Verbose user visible error string", "Account with this username already exists");
120  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_REJECTED)) {
121  return i18nc("Verbose user visible error string", "The receiver rejected your call");
122  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_RESOURCE_UNAVAILABLE)) {
123  return i18nc("Verbose user visible error string", "There are insufficient resources (like free memory) to finish the operation at the moment");
124  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_SERVICE_BUSY)) {
125  return i18nc("Verbose user visible error string", "Your request hit a busy resource somewhere along the way and the operation was unable to finish");
126  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_SERVICE_CONFUSED)) {
127  return i18nc("Verbose user visible error string", "An internal error has occurred (known as the 'Confused service error')");
128  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_SOFTWARE_UPGRADE_REQUIRED)) {
129  return i18nc("Verbose user visible error string", "The installed libraries are too old. Please try updating all Telepathy packages to a newer version");
130  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_TERMINATED)) {
131  return i18nc("Verbose user visible error string", "The channel was terminated for no apparent reason");
132  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_WOULD_BREAK_ANONYMITY)) {
133  return i18nc("Verbose user visible error string", "This operation can not be finished as it would break your requested anonymity");
134  } else if (dbusErrorName == QLatin1String("org.freedesktop.DBus.Error.NoReply")) {
135  return i18nc("Verbose user visible error string", "Some of the IM components are not working correctly");
136  } else {
137  return i18nc("User visible error string", "An unknown error was encountered (%1), please report this", dbusErrorName);
138  }
139 }
140 
141 QString ErrorDictionary::displayShortErrorMessage(const QString& dbusErrorName)
142 {
143  if (dbusErrorName == QLatin1String(TP_QT_ERROR_ALREADY_CONNECTED)) {
144  return i18nc("Short user visible error string", "Connected elsewhere");
145  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_AUTHENTICATION_FAILED)) {
146  return i18nc("Short user visible error string", "Authentication failed");
147  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_BUSY)) {
148  return i18nc("Short user visible error string", "Channel too busy");
149  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CANCELLED)) {
150  return i18nc("Short user visible error string", "Cancelled by user");
151  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_EXPIRED)) {
152  return i18nc("Short user visible error string", "Certificate is expired");
153  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_FINGERPRINT_MISMATCH)) {
154  return i18nc("Short user visible error string", "Wrong certificate fingerprint");
155  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_HOSTNAME_MISMATCH)) {
156  return i18nc("Short user visible error string", "Wrong certificate hostname");
157  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_INSECURE)) {
158  return i18nc("Short user visible error string", "Too weak certificate encryption");
159  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_INVALID)) {
160  return i18nc("Short user visible error string", "Invalid certificate");
161  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_LIMIT_EXCEEDED)) {
162  return i18nc("Short user visible error string", "Certificate length limit exceeded");
163  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_NOT_ACTIVATED)) {
164  return i18nc("Short user visible error string", "Certificate not yet active");
165  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_NOT_PROVIDED)) {
166  return i18nc("Short user visible error string", "No certificate from server");
167  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_REVOKED)) {
168  return i18nc("Short user visible error string", "Certificate revoked");
169  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_SELF_SIGNED)) {
170  return i18nc("Short user visible error string", "Untrusted self-signed certificate");
171  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CERT_UNTRUSTED)) {
172  return i18nc("Short user visible error string", "Untrusted certificate");
173  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_BANNED)) {
174  return i18nc("Short user visible error string", "Banned from channel");
175  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_FULL)) {
176  return i18nc("Short user visible error string", "The channel is full");
177  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_INVITE_ONLY)) {
178  return i18nc("Short user visible error string", "The channel is invite-only");
179  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CHANNEL_KICKED)) {
180  return i18nc("Short user visible error string", "Kicked from channel");
181  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONFUSED)) {
182  return i18nc("Short user visible error string", "Something's seriously wrong");
183  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_FAILED)) {
184  return i18nc("Short user visible error string", "Connection failed");
185  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_LOST)) {
186  return i18nc("Short user visible error string", "Connection lost");
187  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_REFUSED)) {
188  return i18nc("Short user visible error string", "Connection refused");
189  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_CONNECTION_REPLACED)) {
190  return i18nc("Short user visible error string", "Connection stolen by other account");
191  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_DISCONNECTED)) {
192  return i18nc("Short user visible error string", "Disconnected");
193  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_DOES_NOT_EXIST)) {
194  return i18nc("Short user visible error string", "User does not exist");
195  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_EMERGENCY_CALLS_NOT_SUPPORTED)) {
196  return i18nc("Short user visible error string", "Emergency calls unsupported");
197  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_ENCRYPTION_ERROR)) {
198  return i18nc("Short user visible error string", "Encryption error");
199  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_ENCRYPTION_NOT_AVAILABLE)) {
200  return i18nc("Short user visible error string", "Encryption not available");
201  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_INVALID_ARGUMENT)) {
202  return i18nc("Short user visible error string", "Invalid argument");
203  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_INVALID_HANDLE)) {
204  return i18nc("Short user visible error string", "Invalid handle");
205  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NETWORK_ERROR)) {
206  return i18nc("Short user visible error string", "Network error");
207  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NO_ANSWER)) {
208  return i18nc("Short user visible error string", "Removed from channel");
209  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_AVAILABLE)) {
210  return i18nc("Short user visible error string", "Capability not available");
211  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_CAPABLE)) {
212  return i18nc("Short user visible error string", "Contact has no support");
213  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_IMPLEMENTED)) {
214  return i18nc("Short user visible error string", "Operation not implemented");
215  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_YET)) {
216  return i18nc("Short user visible error string", "Operation not yet implemented");
217  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_NOT_YOURS)) {
218  return i18nc("Short user visible error string", "Channel already being handled");
219  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_OFFLINE)) {
220  return i18nc("Short user visible error string", "Contact is offline");
221  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_PERMISSION_DENIED)) {
222  return i18nc("Short user visible error string", "Operation not permitted");
223  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_PICKED_UP_ELSEWHERE)) {
224  return i18nc("Short user visible error string", "Call picked by other resource");
225  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_REGISTRATION_EXISTS)) {
226  return i18nc("Short user visible error string", "Username already taken");
227  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_REJECTED)) {
228  return i18nc("Short user visible error string", "Call rejected");
229  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_RESOURCE_UNAVAILABLE)) {
230  return i18nc("Short user visible error string", "Insufficient resources");
231  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_SERVICE_BUSY)) {
232  return i18nc("Short user visible error string", "Service is busy");
233  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_SERVICE_CONFUSED)) {
234  return i18nc("Short user visible error string", "Internal error");
235  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_SOFTWARE_UPGRADE_REQUIRED)) {
236  return i18nc("Short user visible error string", "Software upgrade required");
237  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_TERMINATED)) {
238  return i18nc("Short user visible error string", "Channel terminated");
239  } else if (dbusErrorName == QLatin1String(TP_QT_ERROR_WOULD_BREAK_ANONYMITY)) {
240  return i18nc("Short user visible error string", "Anonymity break possible");
241  } else if (dbusErrorName == QLatin1String("org.freedesktop.DBus.Error.NoReply")) {
242  return i18nc("Short user visible error string", "Internal component error");
243  } else {
244  //print the error so users can send it in
245  kWarning() << "Unknown error encountered:" << dbusErrorName;
246  return i18nc("User visible error string", "Unknown error");
247  }
248 }
249 
250 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Mar 22 2013 10:58:52 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktp-common-internals API Reference

Skip menu "ktp-common-internals API Reference"
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal