[Konversation-devel] [Bug 147481] channel encoding toolbar widget update lag

Peter Simonsson peter.simonsson at gmail.com
Sat Jul 7 12:32:49 CEST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=147481         
peter.simonsson gmail com changed:

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



------- Additional Comments From peter.simonsson gmail com  2007-07-07 12:32 -------
SVN commit 684831 by psn:

* Add encoding to do the same as charset.
* Make encoding/charset a bit more verbose.
* Add latin1 as an alias for iso-8859-1.
* Update the view containers actions when switching encoding.

BUG:147481


 M  +2 -1      irccharsets.cpp  
 M  +23 -2     outputfilter.cpp  
 M  +2 -1      outputfilter.h  
 M  +7 -0      server.cpp  
 M  +3 -0      server.h  


--- branches/extragear/kde3/network/konversation/src/irccharsets.cpp #684830:684831
 @ -138,7 +138,8  @
 
         // setup m_shortNameAliases
         // use only [a-z0-9] for keys!
-        m_shortNameAliases[ "unicode" ] = "utf8";
+        m_shortNameAliases["unicode"] = "utf8";
+        m_shortNameAliases["latin1"] = "iso-8859-1";
 
         // setup m_shortNames, m_descriptiveNames, m_simplifiedShortNames
         QRegExp reSimplify( "[^a-zA-Z0-9]" );
--- branches/extragear/kde3/network/konversation/src/outputfilter.cpp #684830:684831
 @ -313,7 +313,8  @
             else if(command == "reconnect")  emit reconnectServer();
             else if(command == "disconnect") emit disconnectServer();
             else if(command == "prefs")    result = parsePrefs(parameter);
-            else if(command == "charset")  parseCharset(parameter);
+            else if(command == "charset")  result = parseCharset(parameter);
+            else if(command == "encoding")  result = parseCharset(parameter);
             else if(command == "setkey")   result = parseSetKey(parameter);
             else if(command == "delkey")   result = parseDelKey(parameter);
             else if(command == "dns")      result = parseDNS(parameter);
 @ -1711,11 +1712,31  @
         return result;
     }
 
-    void OutputFilter::parseCharset(const QString& charset)
+    OutputFilterResult OutputFilter::parseCharset(const QString& charset)
     {
+        OutputFilterResult result;
+
+        if (charset.isEmpty ())
+        {
+            result = info (i18n("Current encoding is: %1")
+                    .arg(m_server->getIdentity()->getCodec()->name()));
+            return result;
+        }
+
         QString shortName = Konversation::IRCCharsets::self()->ambiguousNameToShortName(charset);
+
         if(!shortName.isEmpty())
+        {
             m_server->getIdentity()->setCodecName(shortName);
+            emit encodingChanged();
+            result = info (i18n("Switched to %1 encoding.").arg(shortName));
+        }
+        else
+        {
+            result = error(i18n("%1 isn't a valid encoding.").arg (charset));
+        }
+
+        return result;
     }
 
     OutputFilterResult OutputFilter::parseSetKey(const QString& parameter)
--- branches/extragear/kde3/network/konversation/src/outputfilter.h #684830:684831
 @ -93,6 +93,7  @
             void connectToServer(const QString& server, const QString& port, const QString& password);
 
             void showView(ChatWindow* view);
+            void encodingChanged ();
 
 
         public slots:
 @ -146,7 +147,7  @
             OutputFilterResult parsePrefs(const QString& parameter);
             OutputFilterResult parseOmsg(const QString& parameter);
             OutputFilterResult parseOnotice(const QString& parameter);
-            void parseCharset(const QString& charset);
+            OutputFilterResult parseCharset(const QString& charset);
             void parseCycle();
             OutputFilterResult parseSetKey(const QString& parameter);
             OutputFilterResult parseDelKey(const QString& parameter);
--- branches/extragear/kde3/network/konversation/src/server.cpp #684830:684831
 @ -282,6 +282,7  @
         this, SLOT(requestUnban(const QString&,const QString&)));
     connect(outputFilter, SIGNAL(openRawLog(bool)), this, SLOT(addRawLog(bool)));
     connect(outputFilter, SIGNAL(closeRawLog()), this, SLOT(closeRawLog()));
+    connect(outputFilter, SIGNAL(encodingChanged()), this, SLOT(updateEncoding()));
 
    // ViewContainer
     connect(this, SIGNAL(showView(ChatWindow*)), getViewContainer(), SLOT(showView(ChatWindow*)));
 @ -3457,6 +3458,12  @
     m_messageCount = 0;
 }
 
+void Server::updateEncoding()
+{
+    if(getViewContainer() && getViewContainer()->getFrontView())
+        getViewContainer()->updateViewEncoding(getViewContainer()->getFrontView());
+}
+
 #include "server.moc"
 
 // kate: space-indent on; tab-width 4; indent-width 4; mixed-indent off; replace-tabs on;
--- branches/extragear/kde3/network/konversation/src/server.h #684830:684831
 @ -503,6 +503,9  @
          */
         void resetMessageCount();
 
+        /// Update the encoding shown in the mainwindow's actions
+        void updateEncoding();
+
     protected:
         // constants
         static const int BUFFER_LEN=513;


More information about the Konversation-devel mailing list