summaryrefslogtreecommitdiffstats
path: root/konsole
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2019-06-13 12:54:41 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2019-06-13 12:54:41 +0900
commit1663e522eb81968907e14c8d8b65b95b63bcc852 (patch)
tree92eb6a1e808b1801b7e6aaace86061d7cf97bcc4 /konsole
parentf82cd10b368371ff820fac5550026b2e43642f29 (diff)
downloadtdebase-1663e522eb81968907e14c8d8b65b95b63bcc852.tar.gz
tdebase-1663e522eb81968907e14c8d8b65b95b63bcc852.zip
Fixed some session's dcop calls in konsolepart. This relates to bug 2537.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'konsole')
-rw-r--r--konsole/konsole/TECommon.h6
-rw-r--r--konsole/konsole/konsole_part.cpp89
-rw-r--r--konsole/konsole/konsole_part.h11
-rw-r--r--konsole/konsole/session.cpp1
-rw-r--r--konsole/konsole/session.h1
5 files changed, 96 insertions, 12 deletions
diff --git a/konsole/konsole/TECommon.h b/konsole/konsole/TECommon.h
index 6b3c6621b..a48e82c63 100644
--- a/konsole/konsole/TECommon.h
+++ b/konsole/konsole/TECommon.h
@@ -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,
diff --git a/konsole/konsole/konsole_part.cpp b/konsole/konsole/konsole_part.cpp
index 1c0067bb9..64fdfb700 100644
--- a/konsole/konsole/konsole_part.cpp
+++ b/konsole/konsole/konsole_part.cpp
@@ -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"
diff --git a/konsole/konsole/konsole_part.h b/konsole/konsole/konsole_part.h
index 766e4e5d5..39b037b67 100644
--- a/konsole/konsole/konsole_part.h
+++ b/konsole/konsole/konsole_part.h
@@ -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
diff --git a/konsole/konsole/session.cpp b/konsole/konsole/session.cpp
index a6103da4f..dcfe9fee4 100644
--- a/konsole/konsole/session.cpp
+++ b/konsole/konsole/session.cpp
@@ -825,6 +825,7 @@ TQString TESession::keytab()
void TESession::setKeytab(const TQString &keytab)
{
setKeymap(keytab);
+ emit updateSessionKeytab(this, keytab);
emit updateSessionConfig(this);
}
diff --git a/konsole/konsole/session.h b/konsole/konsole/session.h
index bfcafdf47..03b5941dd 100644
--- a/konsole/konsole/session.h
+++ b/konsole/konsole/session.h
@@ -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 );