changeset 15637:29c817466160 draft

Removed Konsole namespaces.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 24 Jan 2012 00:26:22 +0100
parents 462e0f609d01
children 95a3b4c4a729
files libqterminal/BlockArray.cpp libqterminal/BlockArray.h libqterminal/Character.h libqterminal/CharacterColor.h libqterminal/Emulation.cpp libqterminal/Emulation.h libqterminal/Filter.cpp libqterminal/Filter.h libqterminal/History.cpp libqterminal/History.h libqterminal/KeyboardTranslator.cpp libqterminal/KeyboardTranslator.h libqterminal/PseudoTerminal.cpp libqterminal/PseudoTerminal.h libqterminal/Pty.cpp libqterminal/Pty.h libqterminal/QTerminal.cpp libqterminal/QTerminal.h libqterminal/Screen.cpp libqterminal/Screen.h libqterminal/ScreenWindow.cpp libqterminal/ScreenWindow.h libqterminal/Session.cpp libqterminal/Session.h libqterminal/ShellCommand.cpp libqterminal/ShellCommand.h libqterminal/TerminalCharacterDecoder.cpp libqterminal/TerminalCharacterDecoder.h libqterminal/TerminalDisplay.cpp libqterminal/TerminalDisplay.h libqterminal/Vt102Emulation.cpp libqterminal/Vt102Emulation.h libqterminal/k3process.cpp libqterminal/kpty.cpp libqterminal/libqterminal.pro
diffstat 35 files changed, 592 insertions(+), 752 deletions(-) [+]
line wrap: on
line diff
--- a/libqterminal/BlockArray.cpp
+++ b/libqterminal/BlockArray.cpp
@@ -34,8 +34,6 @@
 #include <stdio.h>
 
 
-using namespace Konsole;
-
 static int blocksize = 0;
 
 BlockArray::BlockArray()
--- a/libqterminal/BlockArray.h
+++ b/libqterminal/BlockArray.h
@@ -25,14 +25,9 @@
 
 #include <unistd.h>
 
-//#error Do not use in KDE 2.1
-
 #define BlockSize (1 << 12)
 #define ENTRIES   ((BlockSize - sizeof(size_t) ) / sizeof(unsigned char))
 
-namespace Konsole
-{
-
 struct Block {
     Block() { size = 0; }
     unsigned char data[ENTRIES];
@@ -120,6 +115,4 @@
 
 };
 
-}
-
 #endif
--- a/libqterminal/Character.h
+++ b/libqterminal/Character.h
@@ -31,9 +31,6 @@
 // Local
 #include "CharacterColor.h"
 
-namespace Konsole
-{
-
 typedef unsigned char LineProperty;
 
 static const int LINE_DEFAULT		= 0;
@@ -204,7 +201,5 @@
     QHash<ushort,ushort*> extendedCharTable;
 };
 
-}
-
 #endif // CHARACTER_H
 
--- a/libqterminal/CharacterColor.h
+++ b/libqterminal/CharacterColor.h
@@ -28,9 +28,6 @@
 // Qt
 #include <QtGui/QColor>
 
-namespace Konsole
-{
-
 /** 
  * An entry in a terminal display's color palette. 
  *
@@ -291,8 +288,5 @@
   }
 }
 
-
-}
-
 #endif // CHARACTERCOLOR_H
 
--- a/libqterminal/Emulation.cpp
+++ b/libqterminal/Emulation.cpp
@@ -49,19 +49,6 @@
 #include "TerminalCharacterDecoder.h"
 #include "ScreenWindow.h"
 
-using namespace Konsole;
-
-/* ------------------------------------------------------------------------- */
-/*                                                                           */
-/*                               Emulation                                  */
-/*                                                                           */
-/* ------------------------------------------------------------------------- */
-
-//#define CNTL(c) ((c)-'@')
-
-/*!
-*/
-
 Emulation::Emulation() :
   _currentScreen(0),
   _codec(0),
--- a/libqterminal/Emulation.h
+++ b/libqterminal/Emulation.h
@@ -30,15 +30,11 @@
 
 // Qt 
 #include <QtGui/QKeyEvent>
-//#include <QPointer>
+
 #include <QtCore/QTextCodec>
 #include <QtCore/QTextStream>
 #include <QtCore/QTimer>
 
-
-namespace Konsole
-{
-
 class KeyboardTranslator;
 class HistoryType;
 class Screen;
@@ -460,6 +456,4 @@
   
 };
 
-}
-
 #endif // ifndef EMULATION_H
--- a/libqterminal/Filter.cpp
+++ b/libqterminal/Filter.cpp
@@ -34,15 +34,9 @@
 #include <QtCore/QSharedData>
 #include <QtCore>
 
-// KDE
-//#include <KLocale>
-//#include <KRun>
-
 // Konsole
 #include "TerminalCharacterDecoder.h"
 
-using namespace Konsole;
-
 FilterChain::~FilterChain()
 {
     QMutableListIterator<Filter*> iter(*this);
--- a/libqterminal/Filter.h
+++ b/libqterminal/Filter.h
@@ -33,9 +33,6 @@
 // Local
 #include "Character.h"
 
-namespace Konsole
-{
-
 /**
  * A filter processes blocks of text looking for certain patterns (such as URLs or keywords from a list)
  * and marks the areas which match the filter's patterns as 'hotspots'.
@@ -379,5 +376,4 @@
     QList<int>* _linePositions;
 };
 
-}
 #endif //FILTER_H
--- a/libqterminal/History.cpp
+++ b/libqterminal/History.cpp
@@ -37,8 +37,6 @@
 // Reasonable line size
 #define LINE_SIZE	1024
 
-using namespace Konsole;
-
 /*
    An arbitrary long scroll.
 
--- a/libqterminal/History.h
+++ b/libqterminal/History.h
@@ -20,8 +20,8 @@
     02110-1301  USA.
 */
 
-#ifndef TEHISTORY_H
-#define TEHISTORY_H
+#ifndef HISTORY_H
+#define HISTORY_H
 
 // Qt
 #include <QtCore/QBitRef>
@@ -32,13 +32,6 @@
 #include "BlockArray.h"
 #include "Character.h"
 
-namespace Konsole
-{
-
-#if 1
-/*
-   An extendable tmpfile(1) based buffer.
-*/
 
 class HistoryFile
 {
@@ -75,7 +68,6 @@
   //when readWriteBalance goes below this threshold, the file will be mmap'ed automatically
   static const int MAP_THRESHOLD = -1000;
 };
-#endif
 
 //////////////////////////////////////////////////////////////////////
 
@@ -124,7 +116,6 @@
 
 };
 
-#if 1
 
 //////////////////////////////////////////////////////////////////////
 // File-based history (e.g. file log, no limitation in length)
@@ -209,7 +200,6 @@
 
 };*/
 
-#endif
 
 //////////////////////////////////////////////////////////////////////
 // Nothing-based history (no history :-)
@@ -306,7 +296,7 @@
   size_t m_size;
 };
 
-#if 1 
+
 class HistoryTypeFile : public HistoryType
 {
 public:
@@ -337,8 +327,4 @@
   unsigned int m_nbLines;
 };
 
-#endif
-
-}
-
-#endif // TEHISTORY_H
+#endif // HISTORY_H
--- a/libqterminal/KeyboardTranslator.cpp
+++ b/libqterminal/KeyboardTranslator.cpp
@@ -35,9 +35,6 @@
 #include <QtCore>
 #include <QtGui>
 
-
-using namespace Konsole;
-
 //and this is default now translator - default.keytab from original Konsole
 const char* KeyboardTranslatorManager::defaultTranslatorText = 
 #include "ExtendedDefaultTranslator.h"
--- a/libqterminal/KeyboardTranslator.h
+++ b/libqterminal/KeyboardTranslator.h
@@ -110,9 +110,6 @@
 class QIODevice;
 class QTextStream;
 
-namespace Konsole
-{
-
 /** 
  * A convertor which maps between key sequences pressed by the user and the
  * character strings which should be sent to the terminal and commands
@@ -648,10 +645,6 @@
 }
 inline KeyboardTranslator::States KeyboardTranslator::Entry::stateMask() const { return _stateMask; }
 
-}
-
-Q_DECLARE_METATYPE(Konsole::KeyboardTranslator::Entry)
-Q_DECLARE_METATYPE(const Konsole::KeyboardTranslator*)
 
 #endif // KEYBOARDTRANSLATOR_H
 
new file mode 100644
--- /dev/null
+++ b/libqterminal/PseudoTerminal.cpp
@@ -0,0 +1,335 @@
+/*
+    This file is part of Konsole, an X terminal.
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301  USA.
+*/
+
+// Own
+#include "PseudoTerminal.h"
+
+// System
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <errno.h>
+#include <termios.h>
+
+// Qt
+#include <QtCore>
+
+// KDE
+#include "kpty.h"
+
+void PseudoTerminal::donePty()
+{
+  emit done(exitStatus());
+}
+
+void PseudoTerminal::setWindowSize(int lines, int cols)
+{
+  _windowColumns = cols;
+  _windowLines = lines;
+
+  if (pty()->masterFd() >= 0)
+    pty()->setWinSize(lines, cols);
+}
+QSize PseudoTerminal::windowSize() const
+{
+    return QSize(_windowColumns,_windowLines);
+}
+
+void PseudoTerminal::setXonXoff(bool enable)
+{
+  _xonXoff = enable;
+
+  if (pty()->masterFd() >= 0)
+  {
+    struct ::termios ttmode;
+    pty()->tcGetAttr(&ttmode);
+    if (!enable)
+      ttmode.c_iflag &= ~(IXOFF | IXON);
+    else
+      ttmode.c_iflag |= (IXOFF | IXON);
+    if (!pty()->tcSetAttr(&ttmode))
+      qWarning("Unable to set terminal attributes.");
+  }
+}
+
+void PseudoTerminal::setUtf8Mode(bool enable)
+{
+#ifdef IUTF8 // XXX not a reasonable place to check it.
+  _utf8 = enable;
+
+  if (pty()->masterFd() >= 0)
+  {
+    struct ::termios ttmode;
+    pty()->tcGetAttr(&ttmode);
+    if (!enable)
+      ttmode.c_iflag &= ~IUTF8;
+    else
+      ttmode.c_iflag |= IUTF8;
+    if (!pty()->tcSetAttr(&ttmode))
+      qWarning("Unable to set terminal attributes.");
+  }
+#endif
+}
+
+void PseudoTerminal::setErase(char erase)
+{
+  _eraseChar = erase;
+  
+  if (pty()->masterFd() >= 0)
+  {
+    struct ::termios ttmode;
+
+    pty()->tcGetAttr(&ttmode);
+
+    ttmode.c_cc[VERASE] = erase;
+
+    if (!pty()->tcSetAttr(&ttmode))
+      qWarning("Unable to set terminal attributes.");
+  }  
+}
+
+char PseudoTerminal::erase() const
+{
+	if (pty()->masterFd() >= 0)
+	{
+		qDebug() << "Getting erase char";
+		struct ::termios ttyAttributes;
+		pty()->tcGetAttr(&ttyAttributes);
+		return ttyAttributes.c_cc[VERASE];
+	}
+
+	return _eraseChar;
+}
+
+void PseudoTerminal::addEnvironmentVariables(const QStringList& environment)
+{
+    QListIterator<QString> iter(environment);
+    while (iter.hasNext())
+    {
+        QString pair = iter.next();
+
+        // split on the first '=' character
+        int pos = pair.indexOf('=');
+        
+        if ( pos >= 0 )
+        {
+            QString variable = pair.left(pos);
+            QString value = pair.mid(pos+1);
+
+            //kDebug() << "Setting environment pair" << variable <<
+            //    " set to " << value;
+
+            setEnvironment(variable,value);
+        }
+    }
+}
+
+int PseudoTerminal::start(const QString& program,
+               const QStringList& programArguments, 
+               const QStringList& environment, 
+               ulong winid, 
+               bool addToUtmp,
+               int masterFd,
+               int slaveFd
+//               const QString& dbusService,
+//               const QString& dbusSession)
+		)
+{
+  clearArguments();
+
+  setBinaryExecutable(program.toLatin1());
+
+  addEnvironmentVariables(environment);
+
+  QStringListIterator it( programArguments );
+  while (it.hasNext())
+    arguments.append( it.next().toUtf8() );
+
+//  if ( !dbusService.isEmpty() )
+//     setEnvironment("KONSOLE_DBUS_SERVICE",dbusService);
+//  if ( !dbusSession.isEmpty() )
+//     setEnvironment("KONSOLE_DBUS_SESSION", dbusSession);
+
+  setEnvironment("WINDOWID", QString::number(winid));
+
+  // unless the LANGUAGE environment variable has been set explicitly
+  // set it to a null string
+  // this fixes the problem where KCatalog sets the LANGUAGE environment
+  // variable during the application's startup to something which
+  // differs from LANG,LC_* etc. and causes programs run from
+  // the terminal to display mesages in the wrong language
+  //
+  // this can happen if LANG contains a language which KDE
+  // does not have a translation for
+  //
+  // BR:149300
+  if (!environment.contains("LANGUAGE"))
+      setEnvironment("LANGUAGE",QString());
+
+  setUsePty(All, addToUtmp, masterFd, slaveFd);
+
+  pty()->open();
+  
+  struct ::termios ttmode;
+  pty()->tcGetAttr(&ttmode);
+  if (!_xonXoff)
+    ttmode.c_iflag &= ~(IXOFF | IXON);
+  else
+    ttmode.c_iflag |= (IXOFF | IXON);
+#ifdef IUTF8 // XXX not a reasonable place to check it.
+  if (!_utf8)
+    ttmode.c_iflag &= ~IUTF8;
+  else
+    ttmode.c_iflag |= IUTF8;
+#endif
+
+  if (_eraseChar != 0)
+  	ttmode.c_cc[VERASE] = _eraseChar;
+  
+  if (!pty()->tcSetAttr(&ttmode))
+    qWarning("Unable to set terminal attributes.");
+  
+  pty()->setWinSize(_windowLines, _windowColumns);
+
+  if ( K3Process::start(NotifyOnExit, (Communication) (Stdin | Stdout)) == false )
+     return -1;
+
+  resume(); // Start...
+  return 0;
+
+}
+
+void PseudoTerminal::setWriteable(bool writeable)
+{
+  struct stat sbuf;
+  stat(pty()->ttyName(), &sbuf);
+  if (writeable)
+    chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP);
+  else
+    chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP|S_IWOTH));
+}
+
+PseudoTerminal::PseudoTerminal()
+    : _bufferFull(false),
+      _windowColumns(0),
+      _windowLines(0),
+      _eraseChar(0),
+      _xonXoff(true),
+      _utf8(true)
+{
+  connect(this, SIGNAL(receivedStdout(K3Process *, char *, int )),
+	  this, SLOT(dataReceived(K3Process *,char *, int)));
+  connect(this, SIGNAL(processExited(K3Process *)),
+          this, SLOT(donePty()));
+  connect(this, SIGNAL(wroteStdin(K3Process *)),
+          this, SLOT(writeReady()));
+  _pty = new KPty;
+
+  setUsePty(All, false, -1, -1); // utmp will be overridden later
+}
+
+PseudoTerminal::PseudoTerminal(int masterFd, int slaveFd)
+    : _bufferFull(false),
+      _windowColumns(0),
+      _windowLines(0),
+      _eraseChar(0),
+      _xonXoff(true),
+      _utf8(true)
+{
+  connect(this, SIGNAL(receivedStdout(K3Process *, char *, int )),
+          this, SLOT(dataReceived(K3Process *,char *, int)));
+  connect(this, SIGNAL(processExited(K3Process *)),
+          this, SLOT(donePty()));
+  connect(this, SIGNAL(wroteStdin(K3Process *)),
+          this, SLOT(writeReady()));
+  _pty = new KPty(masterFd, slaveFd);
+
+  setUsePty(All, false, masterFd, slaveFd); // utmp will be overridden later
+}
+
+PseudoTerminal::~PseudoTerminal()
+{
+    delete _pty;
+}
+
+void PseudoTerminal::writeReady()
+{
+  _pendingSendJobs.erase(_pendingSendJobs.begin());
+  _bufferFull = false;
+  doSendJobs();
+}
+
+void PseudoTerminal::doSendJobs() {
+  if(_pendingSendJobs.isEmpty())
+  {
+     emit bufferEmpty(); 
+     return;
+  }
+  
+  SendJob& job = _pendingSendJobs.first();
+
+  
+  if (!writeStdin( job.data(), job.length() ))
+  {
+    qWarning("Pty::doSendJobs - Could not send input data to terminal process.");
+    return;
+  }
+  _bufferFull = true;
+}
+
+void PseudoTerminal::appendSendJob(const char* s, int len)
+{
+  _pendingSendJobs.append(SendJob(s,len));
+}
+
+void PseudoTerminal::sendData(const char* s, int len)
+{
+  appendSendJob(s,len);
+  if (!_bufferFull)
+     doSendJobs();
+}
+
+void PseudoTerminal::dataReceived(K3Process *,char *buf, int len)
+{
+  emit receivedData(buf,len);
+}
+
+void PseudoTerminal::lockPty(bool lock)
+{
+  if (lock)
+    suspend();
+  else
+    resume();
+}
+
+int PseudoTerminal::foregroundProcessGroup() const
+{
+    int pid = tcgetpgrp(pty()->masterFd());
+
+    if ( pid != -1 )
+    {
+        return pid;
+    } 
+
+    return 0;
+}
+
new file mode 100644
--- /dev/null
+++ b/libqterminal/PseudoTerminal.h
@@ -0,0 +1,241 @@
+/*
+    This file is part of Konsole, KDE's terminal emulator. 
+    
+    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
+    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
+
+    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301  USA.
+*/
+
+#ifndef PTY_H
+#define PTY_H
+
+// Qt
+#include <QtCore/QStringList>
+#include <QtCore/QVector>
+#include <QtCore/QList>
+#include <QtCore>
+
+#include "k3process.h"
+
+/**
+ * The Pty class is used to start the terminal process, 
+ * send data to it, receive data from it and manipulate 
+ * various properties of the pseudo-teletype interface
+ * used to communicate with the process.
+ *
+ * To use this class, construct an instance and connect
+ * to the sendData slot and receivedData signal to
+ * send data to or receive data from the process.
+ *
+ * To start the terminal process, call the start() method
+ * with the program name and appropriate arguments. 
+ */
+class PseudoTerminal: public K3Process
+{
+Q_OBJECT
+
+  public:
+    
+    /** 
+     * Constructs a new Pty.
+     * 
+     * Connect to the sendData() slot and receivedData() signal to prepare
+     * for sending and receiving data from the terminal process.
+     *
+     * To start the terminal process, call the run() method with the 
+     * name of the program to start and appropriate arguments.
+     */
+    PseudoTerminal();
+    PseudoTerminal(int masterFd, int slaveFd);
+
+    ~PseudoTerminal();
+
+    /**
+     * Starts the terminal process.  
+     *
+     * Returns 0 if the process was started successfully or non-zero
+     * otherwise.
+     *
+     * @param program Path to the program to start
+     * @param arguments Arguments to pass to the program being started
+     * @param environment A list of key=value pairs which will be added
+     * to the environment for the new process.  At the very least this
+     * should include an assignment for the TERM environment variable.
+     * @param winid Specifies the value of the WINDOWID environment variable
+     * in the process's environment.
+     * @param addToUtmp Specifies whether a utmp entry should be created for
+     * the pty used.  See K3Process::setUsePty() 
+     * @param dbusService Specifies the value of the KONSOLE_DBUS_SERVICE 
+     * environment variable in the process's environment.
+     * @param dbusSession Specifies the value of the KONSOLE_DBUS_SESSION
+     * environment variable in the process's environment. 
+     */
+    int start( const QString& program, 
+               const QStringList& arguments, 
+               const QStringList& environment, 
+               ulong winid, 
+               bool addToUtmp,
+               int masterFd,
+               int slaveFd
+//               const QString& dbusService,
+//               const QString& dbusSession
+             );
+
+    /** TODO: Document me */
+    void setWriteable(bool writeable);
+
+    /** 
+     * Enables or disables Xon/Xoff flow control.
+     */
+    void setXonXoff(bool on);
+
+    /** 
+     * Sets the size of the window (in lines and columns of characters) 
+     * used by this teletype.
+     */
+    void setWindowSize(int lines, int cols);
+    
+    /** Returns the size of the window used by this teletype.  See setWindowSize() */
+    QSize windowSize() const;
+
+    /** TODO Document me */
+    void setErase(char erase);
+
+	/** */
+	char erase() const;
+
+    /**
+     * Returns the process id of the teletype's current foreground
+     * process.  This is the process which is currently reading
+     * input sent to the terminal via. sendData()
+     *
+     * If there is a problem reading the foreground process group,
+     * 0 will be returned.
+     */
+    int foregroundProcessGroup() const;
+   
+    /**
+     * Returns whether the buffer used to send data to the
+     * terminal process is full.
+     */
+    bool bufferFull() const { return _bufferFull; }
+
+
+  public slots:
+
+    /**
+     * Put the pty into UTF-8 mode on systems which support it.
+     */
+    void setUtf8Mode(bool on);
+
+    /**
+     * Suspend or resume processing of data from the standard 
+     * output of the terminal process.
+     *
+     * See K3Process::suspend() and K3Process::resume()
+     *
+     * @param lock If true, processing of output is suspended,
+     * otherwise processing is resumed.
+     */
+    void lockPty(bool lock);
+    
+    /** 
+     * Sends data to the process currently controlling the 
+     * teletype ( whose id is returned by foregroundProcessGroup() )
+     *
+     * @param buffer Pointer to the data to send.
+     * @param length Length of @p buffer.
+     */
+    void sendData(const char* buffer, int length);
+
+  signals:
+
+    /**
+     * Emitted when the terminal process terminates.
+     *
+     * @param exitCode The status code which the process exited with.
+     */
+    void done(int exitCode);
+
+    /**
+     * Emitted when a new block of data is received from
+     * the teletype.
+     *
+     * @param buffer Pointer to the data received.
+     * @param length Length of @p buffer
+     */
+    void receivedData(const char* buffer, int length);
+    
+    /**
+     * Emitted when the buffer used to send data to the terminal
+     * process becomes empty, i.e. all data has been sent.
+     */
+    void bufferEmpty();
+    
+
+  private slots:
+    
+    // called when terminal process exits
+    void donePty();
+    // called when data is received from the terminal process 
+    void dataReceived(K3Process*, char* buffer, int length);
+    // sends the first enqueued buffer of data to the
+    // terminal process
+    void doSendJobs();
+    // called when the terminal process is ready to
+    // receive more data
+    void writeReady();
+
+  private:
+    // takes a list of key=value pairs and adds them
+    // to the environment for the process
+    void addEnvironmentVariables(const QStringList& environment);
+
+    // enqueues a buffer of data to be sent to the 
+    // terminal process
+    void appendSendJob(const char* buffer, int length);
+   
+    // a buffer of data in the queue to be sent to the 
+    // terminal process 
+    class SendJob {
+	public:
+      		SendJob() {}
+      		SendJob(const char* b, int len) : buffer(len)
+		{
+			memcpy( buffer.data() , b , len );
+        }
+	
+		const char* data() const { return buffer.constData(); }
+		int length() const { return buffer.size(); }	
+	private:
+      		QVector<char> buffer;
+    };
+
+    QList<SendJob> _pendingSendJobs;
+    bool _bufferFull;
+
+    int  _windowColumns; 
+    int  _windowLines;
+    char _eraseChar;
+    bool _xonXoff;
+    bool _utf8;
+    KPty *_pty;
+};
+
+#endif // PTY_H
deleted file mode 100644
--- a/libqterminal/Pty.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
-    This file is part of Konsole, an X terminal.
-    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
-
-    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-    02110-1301  USA.
-*/
-
-// Own
-#include "Pty.h"
-
-// System
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <errno.h>
-#include <termios.h>
-
-// Qt
-#include <QtCore>
-
-// KDE
-//#include <KStandardDirs>
-//#include <KLocale>
-//#include <KDebug>
-#include "kpty.h"
-
-using namespace Konsole;
-
-void Pty::donePty()
-{
-  emit done(exitStatus());
-}
-
-void Pty::setWindowSize(int lines, int cols)
-{
-  _windowColumns = cols;
-  _windowLines = lines;
-
-  if (pty()->masterFd() >= 0)
-    pty()->setWinSize(lines, cols);
-}
-QSize Pty::windowSize() const
-{
-    return QSize(_windowColumns,_windowLines);
-}
-
-void Pty::setXonXoff(bool enable)
-{
-  _xonXoff = enable;
-
-  if (pty()->masterFd() >= 0)
-  {
-    struct ::termios ttmode;
-    pty()->tcGetAttr(&ttmode);
-    if (!enable)
-      ttmode.c_iflag &= ~(IXOFF | IXON);
-    else
-      ttmode.c_iflag |= (IXOFF | IXON);
-    if (!pty()->tcSetAttr(&ttmode))
-      qWarning("Unable to set terminal attributes.");
-  }
-}
-
-void Pty::setUtf8Mode(bool enable)
-{
-#ifdef IUTF8 // XXX not a reasonable place to check it.
-  _utf8 = enable;
-
-  if (pty()->masterFd() >= 0)
-  {
-    struct ::termios ttmode;
-    pty()->tcGetAttr(&ttmode);
-    if (!enable)
-      ttmode.c_iflag &= ~IUTF8;
-    else
-      ttmode.c_iflag |= IUTF8;
-    if (!pty()->tcSetAttr(&ttmode))
-      qWarning("Unable to set terminal attributes.");
-  }
-#endif
-}
-
-void Pty::setErase(char erase)
-{
-  _eraseChar = erase;
-  
-  if (pty()->masterFd() >= 0)
-  {
-    struct ::termios ttmode;
-
-    pty()->tcGetAttr(&ttmode);
-
-    ttmode.c_cc[VERASE] = erase;
-
-    if (!pty()->tcSetAttr(&ttmode))
-      qWarning("Unable to set terminal attributes.");
-  }  
-}
-
-char Pty::erase() const
-{
-	if (pty()->masterFd() >= 0)
-	{
-		qDebug() << "Getting erase char";
-		struct ::termios ttyAttributes;
-		pty()->tcGetAttr(&ttyAttributes);
-		return ttyAttributes.c_cc[VERASE];
-	}
-
-	return _eraseChar;
-}
-
-void Pty::addEnvironmentVariables(const QStringList& environment)
-{
-    QListIterator<QString> iter(environment);
-    while (iter.hasNext())
-    {
-        QString pair = iter.next();
-
-        // split on the first '=' character
-        int pos = pair.indexOf('=');
-        
-        if ( pos >= 0 )
-        {
-            QString variable = pair.left(pos);
-            QString value = pair.mid(pos+1);
-
-            //kDebug() << "Setting environment pair" << variable <<
-            //    " set to " << value;
-
-            setEnvironment(variable,value);
-        }
-    }
-}
-
-int Pty::start(const QString& program, 
-               const QStringList& programArguments, 
-               const QStringList& environment, 
-               ulong winid, 
-               bool addToUtmp,
-               int masterFd,
-               int slaveFd
-//               const QString& dbusService,
-//               const QString& dbusSession)
-		)
-{
-  clearArguments();
-
-  setBinaryExecutable(program.toLatin1());
-
-  addEnvironmentVariables(environment);
-
-  QStringListIterator it( programArguments );
-  while (it.hasNext())
-    arguments.append( it.next().toUtf8() );
-
-//  if ( !dbusService.isEmpty() )
-//     setEnvironment("KONSOLE_DBUS_SERVICE",dbusService);
-//  if ( !dbusSession.isEmpty() )
-//     setEnvironment("KONSOLE_DBUS_SESSION", dbusSession);
-
-  setEnvironment("WINDOWID", QString::number(winid));
-
-  // unless the LANGUAGE environment variable has been set explicitly
-  // set it to a null string
-  // this fixes the problem where KCatalog sets the LANGUAGE environment
-  // variable during the application's startup to something which
-  // differs from LANG,LC_* etc. and causes programs run from
-  // the terminal to display mesages in the wrong language
-  //
-  // this can happen if LANG contains a language which KDE
-  // does not have a translation for
-  //
-  // BR:149300
-  if (!environment.contains("LANGUAGE"))
-      setEnvironment("LANGUAGE",QString());
-
-  setUsePty(All, addToUtmp, masterFd, slaveFd);
-
-  pty()->open();
-  
-  struct ::termios ttmode;
-  pty()->tcGetAttr(&ttmode);
-  if (!_xonXoff)
-    ttmode.c_iflag &= ~(IXOFF | IXON);
-  else
-    ttmode.c_iflag |= (IXOFF | IXON);
-#ifdef IUTF8 // XXX not a reasonable place to check it.
-  if (!_utf8)
-    ttmode.c_iflag &= ~IUTF8;
-  else
-    ttmode.c_iflag |= IUTF8;
-#endif
-
-  if (_eraseChar != 0)
-  	ttmode.c_cc[VERASE] = _eraseChar;
-  
-  if (!pty()->tcSetAttr(&ttmode))
-    qWarning("Unable to set terminal attributes.");
-  
-  pty()->setWinSize(_windowLines, _windowColumns);
-
-  if ( K3Process::start(NotifyOnExit, (Communication) (Stdin | Stdout)) == false )
-     return -1;
-
-  resume(); // Start...
-  return 0;
-
-}
-
-void Pty::setWriteable(bool writeable)
-{
-  struct stat sbuf;
-  stat(pty()->ttyName(), &sbuf);
-  if (writeable)
-    chmod(pty()->ttyName(), sbuf.st_mode | S_IWGRP);
-  else
-    chmod(pty()->ttyName(), sbuf.st_mode & ~(S_IWGRP|S_IWOTH));
-}
-
-Pty::Pty()
-    : _bufferFull(false),
-      _windowColumns(0),
-      _windowLines(0),
-      _eraseChar(0),
-      _xonXoff(true),
-      _utf8(true)
-{
-  connect(this, SIGNAL(receivedStdout(K3Process *, char *, int )),
-	  this, SLOT(dataReceived(K3Process *,char *, int)));
-  connect(this, SIGNAL(processExited(K3Process *)),
-          this, SLOT(donePty()));
-  connect(this, SIGNAL(wroteStdin(K3Process *)),
-          this, SLOT(writeReady()));
-  _pty = new KPty;
-
-  setUsePty(All, false, -1, -1); // utmp will be overridden later
-}
-
-Pty::Pty(int masterFd, int slaveFd)
-    : _bufferFull(false),
-      _windowColumns(0),
-      _windowLines(0),
-      _eraseChar(0),
-      _xonXoff(true),
-      _utf8(true)
-{
-  connect(this, SIGNAL(receivedStdout(K3Process *, char *, int )),
-          this, SLOT(dataReceived(K3Process *,char *, int)));
-  connect(this, SIGNAL(processExited(K3Process *)),
-          this, SLOT(donePty()));
-  connect(this, SIGNAL(wroteStdin(K3Process *)),
-          this, SLOT(writeReady()));
-  _pty = new KPty(masterFd, slaveFd);
-
-  setUsePty(All, false, masterFd, slaveFd); // utmp will be overridden later
-}
-
-Pty::~Pty()
-{
-    delete _pty;
-}
-
-void Pty::writeReady()
-{
-  _pendingSendJobs.erase(_pendingSendJobs.begin());
-  _bufferFull = false;
-  doSendJobs();
-}
-
-void Pty::doSendJobs() {
-  if(_pendingSendJobs.isEmpty())
-  {
-     emit bufferEmpty(); 
-     return;
-  }
-  
-  SendJob& job = _pendingSendJobs.first();
-
-  
-  if (!writeStdin( job.data(), job.length() ))
-  {
-    qWarning("Pty::doSendJobs - Could not send input data to terminal process.");
-    return;
-  }
-  _bufferFull = true;
-}
-
-void Pty::appendSendJob(const char* s, int len)
-{
-  _pendingSendJobs.append(SendJob(s,len));
-}
-
-void Pty::sendData(const char* s, int len)
-{
-  appendSendJob(s,len);
-  if (!_bufferFull)
-     doSendJobs();
-}
-
-void Pty::dataReceived(K3Process *,char *buf, int len)
-{
-  emit receivedData(buf,len);
-}
-
-void Pty::lockPty(bool lock)
-{
-  if (lock)
-    suspend();
-  else
-    resume();
-}
-
-int Pty::foregroundProcessGroup() const
-{
-    int pid = tcgetpgrp(pty()->masterFd());
-
-    if ( pid != -1 )
-    {
-        return pid;
-    } 
-
-    return 0;
-}
-
-//#include "moc_Pty.cpp"
deleted file mode 100644
--- a/libqterminal/Pty.h
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
-    This file is part of Konsole, KDE's terminal emulator. 
-    
-    Copyright (C) 2007 by Robert Knight <robertknight@gmail.com>
-    Copyright (C) 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
-
-    Rewritten for QT4 by e_k <e_k at users.sourceforge.net>, Copyright (C)2008
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-    02110-1301  USA.
-*/
-
-#ifndef PTY_H
-#define PTY_H
-
-// Qt
-#include <QtCore/QStringList>
-#include <QtCore/QVector>
-#include <QtCore/QList>
-#include <QtCore>
-
-#include "k3process.h"
-
-
-namespace Konsole
-{
-
-/**
- * The Pty class is used to start the terminal process, 
- * send data to it, receive data from it and manipulate 
- * various properties of the pseudo-teletype interface
- * used to communicate with the process.
- *
- * To use this class, construct an instance and connect
- * to the sendData slot and receivedData signal to
- * send data to or receive data from the process.
- *
- * To start the terminal process, call the start() method
- * with the program name and appropriate arguments. 
- */
-class Pty: public K3Process
-{
-Q_OBJECT
-
-  public:
-    
-    /** 
-     * Constructs a new Pty.
-     * 
-     * Connect to the sendData() slot and receivedData() signal to prepare
-     * for sending and receiving data from the terminal process.
-     *
-     * To start the terminal process, call the run() method with the 
-     * name of the program to start and appropriate arguments.
-     */
-    Pty();
-    Pty(int masterFd, int slaveFd);
-
-    ~Pty();
-
-    /**
-     * Starts the terminal process.  
-     *
-     * Returns 0 if the process was started successfully or non-zero
-     * otherwise.
-     *
-     * @param program Path to the program to start
-     * @param arguments Arguments to pass to the program being started
-     * @param environment A list of key=value pairs which will be added
-     * to the environment for the new process.  At the very least this
-     * should include an assignment for the TERM environment variable.
-     * @param winid Specifies the value of the WINDOWID environment variable
-     * in the process's environment.
-     * @param addToUtmp Specifies whether a utmp entry should be created for
-     * the pty used.  See K3Process::setUsePty() 
-     * @param dbusService Specifies the value of the KONSOLE_DBUS_SERVICE 
-     * environment variable in the process's environment.
-     * @param dbusSession Specifies the value of the KONSOLE_DBUS_SESSION
-     * environment variable in the process's environment. 
-     */
-    int start( const QString& program, 
-               const QStringList& arguments, 
-               const QStringList& environment, 
-               ulong winid, 
-               bool addToUtmp,
-               int masterFd,
-               int slaveFd
-//               const QString& dbusService,
-//               const QString& dbusSession
-             );
-
-    /** TODO: Document me */
-    void setWriteable(bool writeable);
-
-    /** 
-     * Enables or disables Xon/Xoff flow control.
-     */
-    void setXonXoff(bool on);
-
-    /** 
-     * Sets the size of the window (in lines and columns of characters) 
-     * used by this teletype.
-     */
-    void setWindowSize(int lines, int cols);
-    
-    /** Returns the size of the window used by this teletype.  See setWindowSize() */
-    QSize windowSize() const;
-
-    /** TODO Document me */
-    void setErase(char erase);
-
-	/** */
-	char erase() const;
-
-    /**
-     * Returns the process id of the teletype's current foreground
-     * process.  This is the process which is currently reading
-     * input sent to the terminal via. sendData()
-     *
-     * If there is a problem reading the foreground process group,
-     * 0 will be returned.
-     */
-    int foregroundProcessGroup() const;
-   
-    /**
-     * Returns whether the buffer used to send data to the
-     * terminal process is full.
-     */
-    bool bufferFull() const { return _bufferFull; }
-
-
-  public slots:
-
-    /**
-     * Put the pty into UTF-8 mode on systems which support it.
-     */
-    void setUtf8Mode(bool on);
-
-    /**
-     * Suspend or resume processing of data from the standard 
-     * output of the terminal process.
-     *
-     * See K3Process::suspend() and K3Process::resume()
-     *
-     * @param lock If true, processing of output is suspended,
-     * otherwise processing is resumed.
-     */
-    void lockPty(bool lock);
-    
-    /** 
-     * Sends data to the process currently controlling the 
-     * teletype ( whose id is returned by foregroundProcessGroup() )
-     *
-     * @param buffer Pointer to the data to send.
-     * @param length Length of @p buffer.
-     */
-    void sendData(const char* buffer, int length);
-
-  signals:
-
-    /**
-     * Emitted when the terminal process terminates.
-     *
-     * @param exitCode The status code which the process exited with.
-     */
-    void done(int exitCode);
-
-    /**
-     * Emitted when a new block of data is received from
-     * the teletype.
-     *
-     * @param buffer Pointer to the data received.
-     * @param length Length of @p buffer
-     */
-    void receivedData(const char* buffer, int length);
-    
-    /**
-     * Emitted when the buffer used to send data to the terminal
-     * process becomes empty, i.e. all data has been sent.
-     */
-    void bufferEmpty();
-    
-
-  private slots:
-    
-    // called when terminal process exits
-    void donePty();
-    // called when data is received from the terminal process 
-    void dataReceived(K3Process*, char* buffer, int length);
-    // sends the first enqueued buffer of data to the
-    // terminal process
-    void doSendJobs();
-    // called when the terminal process is ready to
-    // receive more data
-    void writeReady();
-
-  private:
-    // takes a list of key=value pairs and adds them
-    // to the environment for the process
-    void addEnvironmentVariables(const QStringList& environment);
-
-    // enqueues a buffer of data to be sent to the 
-    // terminal process
-    void appendSendJob(const char* buffer, int length);
-   
-    // a buffer of data in the queue to be sent to the 
-    // terminal process 
-    class SendJob {
-	public:
-      		SendJob() {}
-      		SendJob(const char* b, int len) : buffer(len)
-		{
-			memcpy( buffer.data() , b , len );
-        }
-	
-		const char* data() const { return buffer.constData(); }
-		int length() const { return buffer.size(); }	
-	private:
-      		QVector<char> buffer;
-    };
-
-    QList<SendJob> _pendingSendJobs;
-    bool _bufferFull;
-
-    int  _windowColumns; 
-    int  _windowLines;
-    char _eraseChar;
-    bool _xonXoff;
-    bool _utf8;
-    KPty *_pty;
-};
-
-}
-
-#endif // PTY_H
--- a/libqterminal/QTerminal.cpp
+++ b/libqterminal/QTerminal.cpp
@@ -20,8 +20,6 @@
 #include "QTerminal.h"
 #include "pty.h"
 
-using namespace Konsole;
-
 QTerminal::QTerminal(QWidget *parent)
     : QWidget(parent) {
     setMinimumSize(600, 400);
--- a/libqterminal/QTerminal.h
+++ b/libqterminal/QTerminal.h
@@ -24,8 +24,6 @@
 #include "Session.h"
 #include "TerminalDisplay.h"
 
-using namespace Konsole;
-
 class QTerminal : public QWidget
 {
     Q_OBJECT
--- a/libqterminal/Screen.cpp
+++ b/libqterminal/Screen.cpp
@@ -39,8 +39,6 @@
 #include "konsole_wcwidth.h"
 #include "TerminalCharacterDecoder.h"
 
-using namespace Konsole;
-
 //FIXME: this is emulation specific. Use false for xterm, true for ANSI.
 //FIXME: see if we can get this from terminfo.
 #define BS_CLEARS false
--- a/libqterminal/Screen.h
+++ b/libqterminal/Screen.h
@@ -42,11 +42,6 @@
 #define MODE_NewLine   5
 #define MODES_SCREEN   6
 
-namespace Konsole
-{
-
-/*!
-*/
 struct ScreenParm
 {
   int mode[MODES_SCREEN];
@@ -657,6 +652,4 @@
     static Character defaultChar;
 };
 
-}
-
 #endif // SCREEN_H
--- a/libqterminal/ScreenWindow.cpp
+++ b/libqterminal/ScreenWindow.cpp
@@ -28,8 +28,6 @@
 // Konsole
 #include "Screen.h"
 
-using namespace Konsole;
-
 ScreenWindow::ScreenWindow(QObject* parent)
     : QObject(parent)
 	, _windowBuffer(0)
@@ -41,6 +39,7 @@
     , _scrollCount(0)
 {
 }
+
 ScreenWindow::~ScreenWindow()
 {
 	delete[] _windowBuffer;
@@ -293,4 +292,3 @@
     emit outputChanged(); 
 }
 
-//#include "moc_ScreenWindow.cpp"
--- a/libqterminal/ScreenWindow.h
+++ b/libqterminal/ScreenWindow.h
@@ -30,9 +30,6 @@
 // Konsole
 #include "Character.h"
 
-namespace Konsole
-{
-
 class Screen;
 
 /**
@@ -252,5 +249,4 @@
                        // the last call to resetScrollCount()
 };
 
-}
 #endif // SCREENWINDOW_H
--- a/libqterminal/Session.cpp
+++ b/libqterminal/Session.cpp
@@ -38,13 +38,11 @@
 #include <QtCore/QStringList>
 #include <QtCore>
 
-#include "Pty.h"
+#include "PseudoTerminal.h"
 #include "TerminalDisplay.h"
 #include "ShellCommand.h"
 #include "Vt102Emulation.h"
 
-using namespace Konsole;
-
 int Session::lastSessionId = 0;
 
 Session::Session(int masterFd, int slaveFd) :
@@ -79,9 +77,9 @@
 
     //create teletype for I/O with shell process
     if(_masterFd >= 0) {
-        _shellProcess = new Pty(_masterFd, _slaveFd);
+        _shellProcess = new PseudoTerminal(_masterFd, _slaveFd);
     } else {
-        _shellProcess = new Pty();
+        _shellProcess = new PseudoTerminal();
     }
 
     //create emulation backend
@@ -1029,4 +1027,3 @@
     }
 }
 
-//#include "moc_Session.cpp"
--- a/libqterminal/Session.h
+++ b/libqterminal/Session.h
@@ -35,13 +35,9 @@
 
 class KProcess;
 
-namespace Konsole
-{
-
 class Emulation;
-class Pty;
+class PseudoTerminal;
 class TerminalDisplay;
-//class ZModemDialog;
 
 /**
  * Represents a terminal session consisting of a pseudo-teletype and a terminal emulation.
@@ -489,7 +485,7 @@
 
   int            _uniqueIdentifier;
 
-  Pty*          _shellProcess;
+  PseudoTerminal*          _shellProcess;
   Emulation*    _emulation;
 
   QList<TerminalDisplay*> _views;
@@ -617,6 +613,4 @@
     int _masterMode;
 };
 
-}
-
 #endif
--- a/libqterminal/ShellCommand.cpp
+++ b/libqterminal/ShellCommand.cpp
@@ -25,9 +25,6 @@
 //some versions of gcc(4.3) require explicit include
 #include <cstdlib>
 
-
-using namespace Konsole;
-
 // expands environment variables in 'text'
 // function copied from kdelibs/kio/kio/kurlcompletion.cpp
 static bool expandEnv(QString& text);
--- a/libqterminal/ShellCommand.h
+++ b/libqterminal/ShellCommand.h
@@ -25,9 +25,6 @@
 // Qt
 #include <QtCore/QStringList>
 
-namespace Konsole
-{
-
 /** 
  * A class to parse and extract information about shell commands. 
  *
@@ -88,7 +85,5 @@
     QStringList _arguments;    
 };
 
-}
-
 #endif // SHELLCOMMAND_H
 
--- a/libqterminal/TerminalCharacterDecoder.cpp
+++ b/libqterminal/TerminalCharacterDecoder.cpp
@@ -27,9 +27,6 @@
 // Qt
 #include <QtCore/QTextStream>
 
-
-using namespace Konsole;
-
 PlainTextDecoder::PlainTextDecoder()
  : _output(0)
  , _includeTrailingWhitespace(true)
--- a/libqterminal/TerminalCharacterDecoder.h
+++ b/libqterminal/TerminalCharacterDecoder.h
@@ -28,9 +28,6 @@
 
 class QTextStream;
 
-namespace Konsole
-{
-
 /**
  * Base class for terminal character decoders
  *
@@ -134,6 +131,4 @@
 
 };
 
-}
-
 #endif
--- a/libqterminal/TerminalDisplay.cpp
+++ b/libqterminal/TerminalDisplay.cpp
@@ -48,8 +48,6 @@
 #include "ScreenWindow.h"
 #include "TerminalCharacterDecoder.h"
 
-using namespace Konsole;
-
 #ifndef loc
 #define loc(X,Y) ((Y)*_columns+(X))
 #endif
@@ -150,7 +148,7 @@
 
 // assert for i in [0..31] : vt100extended(vt100_graphics[i]) == i.
 
-unsigned short Konsole::vt100_graphics[32] =
+unsigned short vt100_graphics[32] =
 { // 0/8     1/9    2/10    3/11    4/12    5/13    6/14    7/15
   0x0020, 0x25C6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
   0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
@@ -2743,5 +2741,3 @@
   _lineSpacing = i;
   setVTFont(font()); // Trigger an update.
 }
-
-//#include "moc_TerminalDisplay.cpp"
--- a/libqterminal/TerminalDisplay.h
+++ b/libqterminal/TerminalDisplay.h
@@ -46,11 +46,6 @@
 class QHideEvent;
 class QWidget;
 
-//class KMenu;
-
-namespace Konsole
-{
-
 extern unsigned short vt100_graphics[32];
 
 class ScreenWindow;
@@ -760,6 +755,4 @@
     }
 };
 
-}
-
 #endif // TERMINALDISPLAY_H
--- a/libqterminal/Vt102Emulation.cpp
+++ b/libqterminal/Vt102Emulation.cpp
@@ -23,9 +23,6 @@
 // Own
 #include "Vt102Emulation.h"
 
-//#include <config-konsole.h>
-
-
 #if defined(__osf__) || defined(__APPLE__)
 #define AVOID_XKB
 #endif
@@ -59,7 +56,6 @@
 void scrolllock_set_on();
 #endif
 
-using namespace Konsole;
 
 /* VT102 Terminal Emulation
 
--- a/libqterminal/Vt102Emulation.h
+++ b/libqterminal/Vt102Emulation.h
@@ -47,9 +47,6 @@
 #define MODE_Ansi      (MODES_SCREEN+7)
 #define MODE_total     (MODES_SCREEN+8)
 
-namespace Konsole
-{
-
 struct DECpar
 {
   bool mode[MODE_total];
@@ -187,6 +184,4 @@
   
 };
 
-}
-
 #endif // VT102EMULATION_H
--- a/libqterminal/k3process.cpp
+++ b/libqterminal/k3process.cpp
@@ -65,10 +65,6 @@
 #include <QtCore/QFile>
 #include <QtCore/QSocketNotifier>
 
-//#include <kdebug.h>
-//#include <kstandarddirs.h>
-//#include <kuser.h>
-
 
 //////////////////
 // private data //
@@ -1072,5 +1068,3 @@
   return K3Process::start(runmode, comm);
 }
 
-
-//#include "moc_k3process.cpp"
--- a/libqterminal/kpty.cpp
+++ b/libqterminal/kpty.cpp
@@ -127,9 +127,6 @@
 # endif
 #endif
 
-//#include <kdebug.h>
-//#include <kstandarddirs.h>	// findExe
-
 #include <QtCore>
 
 // not defined on HP-UX for example
--- a/libqterminal/libqterminal.pro
+++ b/libqterminal/libqterminal.pro
@@ -24,7 +24,6 @@
            kpty.h \
            kpty_p.h \
            LineFont.h \
-           Pty.h \
            QTerminal.h \
            Screen.h \
            ScreenWindow.h \
@@ -32,7 +31,8 @@
            ShellCommand.h \
            TerminalCharacterDecoder.h \
            TerminalDisplay.h \
-           Vt102Emulation.h
+           Vt102Emulation.h \
+    PseudoTerminal.h
 SOURCES  = BlockArray.cpp \
            Emulation.cpp \
            Filter.cpp \
@@ -42,7 +42,6 @@
            KeyboardTranslator.cpp \
            konsole_wcwidth.cpp \
            kpty.cpp \
-           Pty.cpp \
            QTerminal.cpp \
            Screen.cpp \
            ScreenWindow.cpp \
@@ -50,4 +49,5 @@
            ShellCommand.cpp \
            TerminalCharacterDecoder.cpp \
            TerminalDisplay.cpp \
-           Vt102Emulation.cpp
+           Vt102Emulation.cpp \
+    PseudoTerminal.cpp