[Konsole-devel] [Bug 120998] dcop setEncoding does not work
Kurt V.Hindenburg
kurt.hindenburg at kdemail.net
Sat May 13 14:43:45 UTC 2006
------- 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=120998
kurt.hindenburg kdemail net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From kurt.hindenburg kdemail net 2006-05-13 16:43 -------
SVN commit 540465 by hindenburg:
Fix DCOP call setEncoding. I pray KDE4 will have better encoding coding.
BUG: 120998
M +25 -44 konsole.cpp
--- branches/KDE/3.5/kdebase/konsole/konsole/konsole.cpp #540464:540465
@ -845,6 +845,7 @
}
}
+// Called via menu
void Konsole::slotSetEncoding()
{
if (!se) return;
@ -2612,9 +2613,7 @
activateSession(oldSession);
}
-// Set session encoding; don't use any menu items.
-// System's encoding list may change, so search for encoding string.
-// FIXME: A lot of duplicate code from slotSetSessionEncoding
+// Called by newSession and DCOP function below
void Konsole::setSessionEncoding( const QString &encoding, TESession *session )
{
if ( encoding.isEmpty() )
@ -2632,58 +2631,39 @
// Encoding was found; now try to figure out which Encoding menu item
// it corresponds to.
int i = 0;
+ bool found_encoding = false;
QStringList encodingNames = KGlobal::charsets()->descriptiveEncodingNames();
- QStringList::Iterator it = encodingNames.begin();
- while ( it != encodingNames.end() &&
- KGlobal::charsets()->encodingForName(*it) != encoding )
+ QStringList::ConstIterator it = encodingNames.begin();
+ QString t_encoding = encoding.lower();
+
+ while ( it != encodingNames.end() && !found_encoding )
{
+ if ( QString::compare( KGlobal::charsets()->encodingForName(*it),
+ t_encoding ) == 0 ) {
+ found_encoding = true;
+ }
i++; it++;
}
- i++; // Take into account the first entry: Default
- //kdDebug()<<"setSessionEncoding="<<encoding<<"; "<<i<<endl;
+ // BR114535 : Remove jis7 due to infinite loop.
+ if ( enc == "jis7" ) {
+ kdWarning()<<"Encoding Japanese (jis7) currently does not work! BR114535"<<endl;
+ return;
+ }
- session->setEncodingNo( i );
- session->getEmulation()->setCodec(qtc);
- if (se == session)
+ if ( found_encoding )
+ {
+ session->setEncodingNo( i );
+ session->getEmulation()->setCodec(qtc);
+ if (se == session)
activateSession(se);
-
+ }
}
+// Called via DCOP only
void Konsole::slotSetSessionEncoding(TESession *session, const QString &encoding)
{
- if (!selectSetEncoding)
- makeGUI();
-
- if ( !selectSetEncoding ) // when action/settings=false
- return;
-
- QStringList items = selectSetEncoding->items();
-
- QString enc;
- unsigned int i = 0;
- for(QStringList::ConstIterator it = items.begin();
- it != items.end(); ++it, ++i)
- {
- if ((*it).find(encoding) != -1)
- {
- enc = *it;
- break;
- }
- }
- if (i >= items.count())
- return;
-
- bool found = false;
- enc = KGlobal::charsets()->encodingForName(enc);
- QTextCodec * qtc = KGlobal::charsets()->codecForName(enc, found);
- if(!found)
- return;
-
- session->setEncodingNo( i + 1 ); // Take into account Default
- session->getEmulation()->setCodec(qtc);
- if (se == session)
- activateSession(se);
+ setSessionEncoding( encoding, session );
}
void Konsole::slotGetSessionSchema(TESession *session, QString &schema)
@ -3575,6 +3555,7 @
if (s) setSchema(s);
}
+// Called via main.cpp for session manager.
void Konsole::setEncoding(int index)
{
if ( selectSetEncoding ) {
More information about the konsole-devel
mailing list