changeset 13644:8afea6b9e6df

Removed unused methods.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Tue, 23 Aug 2011 11:02:09 +0200
parents 0281f7082e4f
children 484a487f3999
files gui/src/terminal/LinuxTerminalEmulation.cpp gui/src/terminal/Pty.cpp gui/src/terminal/Pty.h gui/src/terminal/kprocess.cpp gui/src/terminal/kprocess.h
diffstat 5 files changed, 3 insertions(+), 156 deletions(-) [+]
line wrap: on
line diff
--- a/gui/src/terminal/LinuxTerminalEmulation.cpp	Tue Aug 23 02:41:09 2011 +0200
+++ b/gui/src/terminal/LinuxTerminalEmulation.cpp	Tue Aug 23 11:02:09 2011 +0200
@@ -8,9 +8,9 @@
     {
       assert (0);
     }
-  dup2 (fds, 0);
-  dup2 (fds, 1);
-  dup2 (fds, 2);
+  dup2 (fds, STDIN_FILENO);
+  dup2 (fds, STDOUT_FILENO);
+  dup2 (fds, STDERR_FILENO);
 
   m_pty = new Pty (fdm);
   connect (m_pty, SIGNAL(receivedData(QByteArray)),
--- a/gui/src/terminal/Pty.cpp	Tue Aug 23 02:41:09 2011 +0200
+++ b/gui/src/terminal/Pty.cpp	Tue Aug 23 11:02:09 2011 +0200
@@ -36,46 +36,10 @@
 #include "kpty.h"
 #include "kptydevice.h"
 
-int
-Pty::start (const QString & program,
-            const QStringList & programArguments)
-{
-  clearProgram ();
-  setProgram (program.toLatin1 (), programArguments.mid (1));
-
-  struct::termios ttmode;
-  pty ()->tcGetAttr (&ttmode);
-  if (!_xonXoff)
-    ttmode.c_iflag &= ~(IXOFF | IXON);
-  else
-    ttmode.c_iflag |= (IXOFF | IXON);
-
-
-  pty ()->tcSetAttr(&ttmode);
-
-  KProcess::start ();
-
-  if (!waitForStarted ())
-    return -1;
-  return 0;
-}
 
 Pty::Pty (int masterFd, QObject * parent):
 KPtyProcess (masterFd, parent)
 {
-  init ();
-}
-
-Pty::Pty (QObject * parent):KPtyProcess (parent)
-{
-  init ();
-}
-
-void
-Pty::init ()
-{
-  _xonXoff = true;
-
   connect (pty (), SIGNAL (readyRead ()), this, SLOT (dataReceived ()));
   setPtyChannels (KPtyProcess::AllChannels);
 }
@@ -97,20 +61,3 @@
 {
   emit receivedData (pty ()->readAll ());
 }
-
-void
-Pty::setupChildProcess ()
-{
-  KPtyProcess::setupChildProcess ();
-
-  // reset all signal handlers
-  // this ensures that terminal applications respond to 
-  // signals generated via key sequences such as Ctrl+C
-  // (which sends SIGINT)
-  struct sigaction action;
-  sigemptyset (&action.sa_mask);
-  action.sa_handler = SIG_DFL;
-  action.sa_flags = 0;
-  for (int signal = 1; signal < NSIG; signal++)
-    sigaction (signal, &action, 0L);
-}
--- a/gui/src/terminal/Pty.h	Tue Aug 23 02:41:09 2011 +0200
+++ b/gui/src/terminal/Pty.h	Tue Aug 23 11:02:09 2011 +0200
@@ -50,39 +50,12 @@
 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.
-     */
-  explicit Pty (QObject * parent = 0);
-
-    /** 
      * Construct a process using an open pty master.
      * See KPtyProcess::KPtyProcess()
      */
   explicit Pty (int ptyMasterFd, QObject * parent = 0);
-
    ~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.
-     */
-  int start (const QString & program,
-             const QStringList & arguments);
-
   public slots:
     /** 
      * Sends data to the process currently controlling the 
@@ -99,16 +72,10 @@
      */
   void receivedData (const QByteArray& data);
 
-protected:
-  void setupChildProcess ();
-
 private slots:
   // called when data is received from the terminal process
   void dataReceived ();
 
-private:
-  void init ();
-  bool _xonXoff;
 };
 
 #endif // PTY_H
--- a/gui/src/terminal/kprocess.cpp	Tue Aug 23 02:41:09 2011 +0200
+++ b/gui/src/terminal/kprocess.cpp	Tue Aug 23 11:02:09 2011 +0200
@@ -126,54 +126,8 @@
   return d->outputChannelMode;
 }
 
-#define DUMMYENV "_KPROCESS_DUMMY_="
 
-void
-KProcess::setEnvironmentVariable (const QString & name, const QString & value, bool overwrite)
-{
-  QStringList env = environment ();
-  if (env.isEmpty ())
-    {
-      env = systemEnvironment ();
-      env.removeAll (QString::fromLatin1 (DUMMYENV));
-    }
-  QString fname (name);
-  fname.append (QLatin1Char ('='));
-  for (QStringList::Iterator it = env.begin (); it != env.end (); ++it)
-    if ((*it).startsWith (fname))
-      {
-	if (overwrite)
-	  {
-	    *it = fname.append (value);
-	    setEnvironment (env);
-	  }
-	return;
-      }
-  env.append (fname.append (value));
-  setEnvironment (env);
-}
 
-void
-KProcess::unsetEnvironmentVariable (const QString & name)
-{
-  QStringList env = environment ();
-  if (env.isEmpty ())
-    {
-      env = systemEnvironment ();
-      env.removeAll (QString::fromLatin1 (DUMMYENV));
-    }
-  QString fname (name);
-  fname.append (QLatin1Char ('='));
-  for (QStringList::Iterator it = env.begin (); it != env.end (); ++it)
-    if ((*it).startsWith (fname))
-      {
-	env.erase (it);
-	if (env.isEmpty ())
-	  env.append (QString::fromLatin1 (DUMMYENV));
-	setEnvironment (env);
-	return;
-      }
-}
 
 void
 KProcess::setProgram (const QString & exe, const QStringList & args)
--- a/gui/src/terminal/kprocess.h	Tue Aug 23 02:41:09 2011 +0200
+++ b/gui/src/terminal/kprocess.h	Tue Aug 23 11:02:09 2011 +0200
@@ -93,27 +93,6 @@
      */
   OutputChannelMode outputChannelMode () const;
 
-    /**
-     * Adds the variable @p name to the process' environment.
-     *
-     * This function must be called before starting the process.
-     *
-     * @param name the name of the environment variable
-     * @param value the new value for the environment variable
-     * @param overwrite if @c false and the environment variable is already
-     *   set, the old value will be preserved
-     */
-  void setEnvironmentVariable (const QString & name, const QString & value, bool overwrite =
-	       true);
-
-    /**
-     * Removes the variable @p name from the process' environment.
-     *
-     * This function must be called before starting the process.
-     *
-     * @param name the name of the environment variable
-     */
-  void unsetEnvironmentVariable (const QString & name);
 
     /**
      * Set the program and the command line arguments.