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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/libkopete
From:       Thiago Macieira <thiago () kde ! org>
Date:       2009-02-06 13:46:14
Message-ID: 1233927974.305472.18657.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 922100 by thiago:

Move this code into a K_GLOBAL_STATIC. There are two problems with
this code:

The first is that it calls i18n() before KLocale and KComponentData
have initialised. That means we never get any translation.

The second is that it causes the QIconvCodec in Qt to initialise
before the locale system in libc is initialised (that's done inside
QCoreApplication's constructor). This means this thread is confined to
ASCII, thereby causing all X11 key translations to be broken.

This sounds like a solution to bug 182996, but my symptom was wildly
different: I had the problem in any and every text input. Please
retest the bug's symptom and close if it's fixed.

CCBUG:182996

 M  +24 -10    kopeteutils.cpp  


--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteutils.cpp #922099:922100
@@ -34,19 +34,33 @@
 #include "kopeteutils.h"
 #include "kopeteuiglobal.h"
 
-static const QString notifyConnectionLost_DefaultMessage = i18n("You have been \
                disconnected.");
-static const QString notifyConnectionLost_DefaultCaption = i18n("Connection Lost.");
-static const QString notifyConnectionLost_DefaultExplanation = i18n("Kopete lost the \
channel used to talk to the instant messaging system.\nThis can be because either \
your internet access went down, the service is experiencing problems, or the service \
disconnected you because you tried to connect with the same account from another \
                location. Try connecting again later.");
-
-static const QString notifyCannotConnect_DefaultMessage = i18n("Cannot connect with \
                the instant messaging server or peers.");
-static const QString notifyCannotConnect_DefaultCaption = i18n("Cannot connect.");
-static const QString notifyCannotConnect_DefaultExplanation = i18n("This means \
Kopete cannot reach the instant messaging server or peers.\nThis can be because \
either your internet access is down or the server is experiencing problems. Try \
                connecting again later.");
-
 namespace Kopete
 {
 namespace Utils
 {
 
+struct DefaultStrings
+{
+    DefaultStrings() :
+        notifyConnectionLost_DefaultMessage(i18n("You have been disconnected.")),
+        notifyConnectionLost_DefaultCaption(i18n("Connection Lost.")),
+        notifyConnectionLost_DefaultExplanation(i18n("Kopete lost the channel used \
to talk to the instant messaging system.\nThis can be because either your internet \
access went down, the service is experiencing problems, or the service disconnected \
you because you tried to connect with the same account from another location. Try \
connecting again later.")), +
+        notifyCannotConnect_DefaultMessage(i18n("Cannot connect with the instant \
messaging server or peers.")), +        \
notifyCannotConnect_DefaultCaption(i18n("Cannot connect.")), +        \
notifyCannotConnect_DefaultExplanation(i18n("This means Kopete cannot reach the \
instant messaging server or peers.\nThis can be because either your internet access \
is down or the server is experiencing problems. Try connecting again later.")) +    {
+    }
+    const QString notifyConnectionLost_DefaultMessage;
+    const QString notifyConnectionLost_DefaultCaption;
+    const QString notifyConnectionLost_DefaultExplanation;
+
+    const QString notifyCannotConnect_DefaultMessage;
+    const QString notifyCannotConnect_DefaultCaption;
+    const QString notifyCannotConnect_DefaultExplanation;
+};
+K_GLOBAL_STATIC(DefaultStrings, defaultStrings)
+
 void notify( QPixmap pic, const QString &eventid, const QString &caption, const \
QString &message, const QString explanation, const QString debugInfo)  {
 	Q_UNUSED(caption);
@@ -75,7 +89,7 @@
 	if (!account)
 		return;
 
-	notify( account->accountIcon(32), QString::fromLatin1("connection_lost"), \
caption.isEmpty() ? notifyConnectionLost_DefaultCaption : caption, message.isEmpty() \
? notifyConnectionLost_DefaultMessage : message, explanation.isEmpty() ? \
notifyConnectionLost_DefaultExplanation : explanation, debugInfo); +	notify( \
account->accountIcon(32), QString::fromLatin1("connection_lost"), caption.isEmpty() ? \
defaultStrings->notifyConnectionLost_DefaultCaption : caption, message.isEmpty() ? \
defaultStrings->notifyConnectionLost_DefaultMessage : message, explanation.isEmpty() \
? defaultStrings->notifyConnectionLost_DefaultExplanation : explanation, debugInfo);  \
}  
 void notifyCannotConnect( const Account *account, const QString explanation, const \
QString debugInfo) @@ -85,7 +99,7 @@
 	if (!account)
 		return;
 
-	notify( account->accountIcon(), QString::fromLatin1("cannot_connect"), \
notifyCannotConnect_DefaultCaption, notifyCannotConnect_DefaultMessage, \
notifyCannotConnect_DefaultExplanation, debugInfo); +	notify( account->accountIcon(), \
QString::fromLatin1("cannot_connect"), \
defaultStrings->notifyCannotConnect_DefaultCaption, \
defaultStrings->notifyCannotConnect_DefaultMessage, \
defaultStrings->notifyCannotConnect_DefaultExplanation, debugInfo);  }
 
 } // end ns ErrorNotifier


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

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