Browse Source

Fixed some session's dcop calls in konsolepart. This relates to bug 2537.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/38/head
Michele Calgaro 8 months ago
parent
commit
1663e522eb
Signed by: MicheleC <michele.calgaro@yahoo.it> GPG Key ID: 2A75B7CA8ADED5CF
5 changed files with 96 additions and 12 deletions
  1. +4
    -2
      konsole/konsole/TECommon.h
  2. +81
    -8
      konsole/konsole/konsole_part.cpp
  3. +9
    -2
      konsole/konsole/konsole_part.h
  4. +1
    -0
      konsole/konsole/session.cpp
  5. +1
    -0
      konsole/konsole/session.h

+ 4
- 2
konsole/konsole/TECommon.h View File

@@ -149,8 +149,10 @@ inline bool operator != (cacol a, cacol b)
inline const TQColor color256(UINT8 u, const ColorEntry* base)
{
// 0.. 16: system colors
if (u < 8) return base[u+2 ].color; u -= 8;
if (u < 8) return base[u+2+BASE_COLORS].color; u -= 8;
if (u < 8) return base[u+2 ].color;
u -= 8;
if (u < 8) return base[u+2+BASE_COLORS].color;
u -= 8;

// 16..231: 6x6x6 rgb color cube
if (u < 216) return TQColor(255*((u/36)%6)/5,


+ 81
- 8
konsole/konsole/konsole_part.cpp View File

@@ -78,10 +78,18 @@ konsoleFactory::~konsoleFactory()

KParts::Part *konsoleFactory::createPartObject(TQWidget *parentWidget, const char *widgetName,
TQObject *parent, const char *name, const char *classname,
const TQStringList&)
const TQStringList &args)
{
// kdDebug(1211) << "konsoleFactory::createPart parentWidget=" << parentWidget << " parent=" << parent << endl;
KParts::Part *obj = new konsolePart(parentWidget, widgetName, parent, name, classname);
KParts::Part *obj;
if (args.count() > 0)
{
obj = new konsolePart(parentWidget, widgetName, parent, name, classname, args[0]);
}
else
{
obj = new konsolePart(parentWidget, widgetName, parent, name, classname);
}
return obj;
}

@@ -97,7 +105,8 @@ TDEInstance *konsoleFactory::instance()

#define DEFAULT_HISTORY_SIZE 1000

konsolePart::konsolePart(TQWidget *_parentWidget, const char *widgetName, TQObject *parent, const char *name, const char *classname)
konsolePart::konsolePart(TQWidget *_parentWidget, const char *widgetName, TQObject *parent, const char *name,
const char *classname, const TQString &title)
: KParts::ReadOnlyPart(parent, name)
,te(0)
,se(0)
@@ -115,6 +124,7 @@ konsolePart::konsolePart(TQWidget *_parentWidget, const char *widgetName, TQObje
,m_signals(0)
,m_options(0)
,m_popupMenu(0)
,s_title(title)
,b_useKonsoleSettings(false)
,b_autoDestroy(true)
,b_autoStartShell(true)
@@ -899,19 +909,24 @@ void konsolePart::slotSelectBell() {

void konsolePart::slotSetEncoding()
{
setEncoding(selectSetEncoding->currentText());
n_encoding = selectSetEncoding->currentItem();
se->setEncodingNo(selectSetEncoding->currentItem());
}

void konsolePart::setEncoding(const TQString &encoding)
{
if (!se) return;

bool found;
TQString enc = TDEGlobal::charsets()->encodingForName(selectSetEncoding->currentText());
TQString enc = TDEGlobal::charsets()->encodingForName(encoding);
TQTextCodec * qtc = TDEGlobal::charsets()->codecForName(enc, found);
if(!found)
{
kdDebug() << "Codec " << selectSetEncoding->currentText() << " not found!" << endl;
kdDebug() << "Codec " << encoding << " not found!" << endl;
qtc = TQTextCodec::codecForLocale();
}

n_encoding = selectSetEncoding->currentItem();
se->setEncodingNo(selectSetEncoding->currentItem());
se->getEmulation()->setCodec(qtc);
}

@@ -1105,7 +1120,14 @@ bool konsolePart::setPtyFd( int master_pty )
void konsolePart::newSession()
{
if ( se ) delete se;
se = new TESession(te, "xterm", parentWidget->winId());
if (!s_title.isEmpty())
{
se = new TESession(te, "xterm", parentWidget->winId(), s_title);
}
else
{
se = new TESession(te, "xterm", parentWidget->winId());
}
connect( se,TQT_SIGNAL(done(TESession*)),
this,TQT_SLOT(doneSession(TESession*)) );
connect( se,TQT_SIGNAL(openURLRequest(const TQString &)),
@@ -1120,6 +1142,14 @@ void konsolePart::newSession()
this, TQT_SIGNAL( receivedData( const TQString& ) ) );
connect( se, TQT_SIGNAL( forkedChild() ),
this, TQT_SIGNAL( forkedChild() ));
connect( se, TQT_SIGNAL(getSessionSchema(TESession*, TQString &)),
this, TQT_SLOT(slotGetSessionSchema(TESession*, TQString &)));
connect( se, TQT_SIGNAL(setSessionSchema(TESession*, const TQString &)),
this, TQT_SLOT(slotSetSessionSchema(TESession*, const TQString &)));
connect( se, TQT_SIGNAL(setSessionEncoding(TESession*, const TQString &)),
this, TQT_SLOT(slotSetSessionEncoding(TESession*, const TQString &)));
connect( se, TQT_SIGNAL(updateSessionKeytab(TESession *, const TQString &)),
this, TQT_SLOT(slotUpdateSessionKeytab(TESession *, const TQString &)));

// We ignore the following signals
//connect( se, TQT_SIGNAL(renameSession(TESession*,const TQString&)),
@@ -1168,4 +1198,47 @@ void konsolePart::sendInput( const TQString& text )
te->emitText( text );
}

void konsolePart::slotGetSessionSchema(TESession *session, TQString &schema)
{
int no = session->schemaNo();
ColorSchema* s = colors->find( no );
schema = s->relPath();
}

void konsolePart::slotSetSessionSchema(TESession *session, const TQString &schema)
{
ColorSchema* s = colors->find( schema );
setSchema(s);
}

void konsolePart::slotSetSessionEncoding(TESession *session, const TQString &encoding)
{
setEncoding(encoding);
const TQStringList &items = selectSetEncoding->items();
int index = items.findIndex(encoding);
if (index < 0)
{
TQString descriptiveEncoding = TDEGlobal::charsets()->descriptiveNameForEncoding(encoding.lower());
if (!descriptiveEncoding.isEmpty())
{
index = items.findIndex(descriptiveEncoding);
}
if (index < 0)
{
if (encoding == TQTextCodec::codecForLocale()->name())
{
index = 0;
}
}
}
selectSetEncoding->setCurrentItem(index);
n_encoding = index;
se->setEncodingNo(index);
}

void konsolePart::slotUpdateSessionKeytab(TESession *, const TQString &)
{
updateKeytabMenu();
}

#include "konsole_part.moc"

+ 9
- 2
konsole/konsole/konsole_part.h View File

@@ -70,7 +70,8 @@ class konsolePart: public KParts::ReadOnlyPart, public TerminalInterface, public
{
Q_OBJECT
public:
konsolePart(TQWidget *parentWidget, const char *widgetName, TQObject * parent, const char *name, const char *classname = 0);
konsolePart(TQWidget *parentWidget, const char *widgetName, TQObject * parent, const char *name,
const char *classname = 0, const TQString &title = TQString::null);
virtual ~konsolePart();

signals:
@@ -122,6 +123,10 @@ signals:
void slotUseKonsoleSettings();
void slotWordSeps();
void slotSetEncoding();
void slotGetSessionSchema(TESession *session, TQString &schema);
void slotSetSessionSchema(TESession *session, const TQString &schema);
void slotSetSessionEncoding(TESession *session, const TQString &encoding);
void slotUpdateSessionKeytab(TESession *session, const TQString &keytab);
void biggerFont();
void smallerFont();

@@ -136,6 +141,7 @@ signals:

void setSchema(ColorSchema* s);
void updateKeytabMenu();
void setEncoding(const TQString &encoding);

bool doOpenStream( const TQString& );
bool doWriteStream( const TQByteArray& );
@@ -170,7 +176,8 @@ signals:

TQFont defaultFont;

TQString pmPath; // pixmap path
TQString pmPath; // pixmap path
TQString s_title; // session title
TQString s_schema;
TQString s_tdeconfigSchema;
TQString s_word_seps; // characters that are considered part of a word


+ 1
- 0
konsole/konsole/session.cpp View File

@@ -825,6 +825,7 @@ TQString TESession::keytab()
void TESession::setKeytab(const TQString &keytab)
{
setKeymap(keytab);
emit updateSessionKeytab(this, keytab);
emit updateSessionConfig(this);
}



+ 1
- 0
konsole/konsole/session.h View File

@@ -166,6 +166,7 @@ signals:
void setSessionEncoding(TESession *session, const TQString &encoding);
void getSessionSchema(TESession *session, TQString &schema);
void setSessionSchema(TESession *session, const TQString &schema);
void updateSessionKeytab(TESession *session, const TQString &keytab);

private slots:
void onRcvBlock( const char* buf, int len );


Loading…
Cancel
Save