[Konversation-devel] [Bug 226377] Human-readable channel mode announcements don't get translated properly

Travis McHenry wordsizzle at gmail.com
Tue Mar 2 04:52:46 CET 2010


https://bugs.kde.org/show_bug.cgi?id=226377


Travis McHenry <wordsizzle at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Travis McHenry <wordsizzle gmail com>  2010-03-02 04:52:45 ---
commit c46b1b0e94c19a9df5f044ad65645034c17358f0
Author: Travis McHenry <wordsizzle at gmail.com>
Date:   Mon Mar 1 20:46:02 2010 -0700

    Fix the translations for the channel modes

    Previously the channel modes were loaded into the hash at runtime.
    Now, we load it when it's needed, coincidentally after KInstance
    has been started, so the i18n() calls now work.
    BUG:226377

diff --git a/src/common.cpp b/src/common.cpp
index 87aac43..f8e740c 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -31,7 +31,7 @@ namespace Konversation
         "([-.\\d\\w]+@[-.\\d\\w]{2,}\\.[\\w]{2,})");
     static QRegExp tdlPattern("(.*)\\.(\\w+),$");

-    QHash<QChar,QString> initChanModesHash()
+    void initChanModesHash()
     {
         QHash<QChar,QString> myHash;

@@ -47,14 +47,15 @@ namespace Konversation
         myHash.insert('c', i18n("no colors allowed"));
         myHash.insert('l', i18n("user throttling"));

-        return myHash;
+        m_modesHash = myHash;
     }

-    const QHash<QChar,QString> ChanModes::m_hash = initChanModesHash();
-
     QHash<QChar,QString> getChannelModesHash()
     {
-        return ChanModes::m_hash;
+        if(m_modesHash.isEmpty())
+            initChanModesHash();
+
+        return m_modesHash;
     }

     QString removeIrcMarkup(const QString& text)
diff --git a/src/common.h b/src/common.h
index c0b56ca..c30c9ab 100644
--- a/src/common.h
+++ b/src/common.h
@@ -49,11 +49,6 @@ namespace Konversation
         CreateNewConnection
     };

-    struct ChanModes
-    {
-        static const QHash<QChar,QString> m_hash;
-    };
-
     struct TextUrlData
     {
         QList<QPair<int, int> > urlRanges;
@@ -74,6 +69,7 @@ namespace Konversation
     bool isUtf8(const QByteArray& text);
     uint colorForNick(const QString& nickname);

+    static QHash<QChar,QString> m_modesHash;
     QHash<QChar,QString> getChannelModesHash();

     QString sterilizeUnicode(const QString& s);

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Konversation-devel mailing list