Bug 147481 - channel encoding toolbar widget update lag
Summary: channel encoding toolbar widget update lag
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: 1.0.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-03 05:06 UTC by Lars DIECKOW
Modified: 2007-07-07 12:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars DIECKOW 2007-07-03 05:06:42 UTC
Version:           1.0.1 (using KDE 3.5.7 "release 10.1" , openSUSE )
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.18.2-34-default

To reproduce:
Join a channel. Make the toolbar visible and edit it to contain the channel encoding toolbar dropdown list. Make note of what it says at the moment, quite likely "utf8" on a modern system.

Type the command
    /charset iso-8859-1

What should happen:
Change is reflected immediately in the toolbar widget.

What really happens:
The widget only updates if you right-click on the channel tab.
Comment 1 Peter Simonsson 2007-07-07 12:32:46 UTC
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;