Пример #1
0
Session::Session(Profile prof, QString cmd, QStringList args) :
    _shellProcess(0)
   , _emulation(0)
   , _monitorActivity(false)
   , _monitorSilence(false)
   , _notifiedActivity(false)
   , _autoClose(true)
   , _wantedClose(false)
   , _silenceSeconds(10)
   , _addToUtmp(false)  // disabled by default because of a bug encountered on certain systems
                        // which caused Konsole to hang when closing a tab and then opening a new
                        // one.  A 'QProcess destroyed while still running' warning was being
                        // printed to the terminal.  Likely a problem in KPty::logout() 
                        // or KPty::login() which uses a QProcess to start /usr/bin/utempter 
   , _flowControl(true)
   , _fullScripting(false)
   , _sessionId(0)
   , _hasDarkBackground(false)
{
    _sessionId = ++lastSessionId;

    //create teletype for I/O with shell process
    _shellProcess = new MyPty(prof, cmd, args);

    //create emulation backend
    _emulation = new Vt102Emulation();

    connect( _emulation, SIGNAL( titleChanged( int, const QString & ) ),
           this, SLOT( setUserTitle( int, const QString & ) ) );
    connect( _emulation, SIGNAL( stateSet(int) ),
           this, SLOT( activityStateSet(int) ) );
    connect( _emulation, SIGNAL( changeTabTextColorRequest( int ) ),
           this, SIGNAL( changeTabTextColorRequest( int ) ) );
    connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString&)),
           this, SIGNAL( profileChangeCommandReceived(const QString&)) );
    // TODO
    // connect( _emulation,SIGNAL(imageSizeChanged(int,int)) , this ,
    //        SLOT(onEmulationSizeChange(int,int)) );

    //connect teletype to emulation backend
    _shellProcess->setUtf8Mode(_emulation->utf8());

    connect( _shellProcess,SIGNAL(received(const char*,int)),this,
            SLOT(onReceiveBlock(const char*,int)) );
    connect( _emulation,SIGNAL(sendData(const char*,int)),_shellProcess,
            SLOT(send(const char*,int)) );
    //connect( _emulation,SIGNAL(lockPtyRequest(bool)),_shellProcess,SLOT(lockPty(bool)) );
    //connect( _emulation,SIGNAL(useUtf8Request(bool)),_shellProcess,SLOT(setUtf8Mode(bool)) );


    connect( _shellProcess,SIGNAL(done(int)), this, SLOT(done(int)) );

    //setup timer for monitoring session activity
    _monitorTimer = new QTimer(this);
    _monitorTimer->setSingleShot(true);
    connect(_monitorTimer, SIGNAL(timeout()), this, SLOT(monitorTimerDone()));
}
Пример #2
0
TESession::TESession(TEWidget* _te, const TQString &_term, ulong _winId, const TQString &_sessionId, const TQString &_initial_cwd)
   : DCOPObject( _sessionId.latin1() )
   , sh(0)
   , connected(true)
   , monitorActivity(false)
   , monitorSilence(false)
   , notifiedActivity(false)
   , masterMode(false)
   , autoClose(true)
   , wantedClose(false)
   , schema_no(0)
   , font_no(3)
   , silence_seconds(10)
   , add_to_utmp(true)
   , xon_xoff(false)
   , pgm(TQString())
   , args(TQStrList())
   , sessionId(_sessionId)
   , cwd("")
   , initial_cwd(_initial_cwd)
   , zmodemBusy(false)
   , zmodemProc(0)
   , zmodemProgress(0)
   , encoding_no(0)
{
  //kdDebug(1211)<<"TESession ctor() new TEPty"<<endl;
  te = _te;
  //kdDebug(1211)<<"TESession ctor() new TEmuVt102"<<endl;
  em = new TEmuVt102(te);
  font_h = te-> fontHeight();
  font_w = te-> fontWidth();
  TQObject::connect(te,TQT_SIGNAL(changedContentSizeSignal(int,int)),
                   this,TQT_SLOT(onContentSizeChange(int,int)));
  TQObject::connect(te,TQT_SIGNAL(changedFontMetricSignal(int,int)),
                   this,TQT_SLOT(onFontMetricChange(int,int)));

  term = _term;
  winId = _winId;
  iconName = "konsole";

  setPty( new TEPty() );

  connect( em, TQT_SIGNAL( changeTitle( int, const TQString & ) ),
           this, TQT_SLOT( setUserTitle( int, const TQString & ) ) );
  connect( em, TQT_SIGNAL( notifySessionState(int) ),
           this, TQT_SLOT( notifySessionState(int) ) );
  monitorTimer = new TQTimer(this);
  connect(monitorTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(monitorTimerDone()));

  connect( em, TQT_SIGNAL( zmodemDetected() ), this, TQT_SLOT(slotZModemDetected()));

  connect( em, TQT_SIGNAL( changeTabTextColor( int ) ),
           this, TQT_SLOT( changeTabTextColor( int ) ) );

  //kdDebug(1211)<<"TESession ctor() done"<<endl;
}
Пример #3
0
TerminalModel::TerminalModel(KPty *kpty) :
    _shellProcess(0)
  , _emulation(0)
  , _monitorActivity(false)
  , _monitorSilence(false)
  , _notifiedActivity(false)
  , _autoClose(true)
  , _wantedClose(false)
  , _silenceSeconds(10)
  , _addToUtmp(false)
  , _fullScripting(false)
  , _hasDarkBackground(false)
{
    _kpty = kpty;

    //create emulation backend
    _emulation = new Vt102Emulation();
    connect( _emulation, SIGNAL( stateSet(int) ),
             this, SLOT( activityStateSet(int) ) );
    connect( _emulation, SIGNAL( changeTabTextColorRequest( int ) ),
             this, SIGNAL( changeTabTextColorRequest( int ) ) );
    connect( _emulation, SIGNAL(profileChangeCommandReceived(const QString&)),
             this, SIGNAL( profileChangeCommandReceived(const QString&)) );
    // TODO
    // connect( _emulation,SIGNAL(imageSizeChanged(int,int)) , this ,
    //        SLOT(onEmulationSizeChange(int,int)) );

    _selfListener = new SelfListener(kpty->masterFd());
    _selfListener->start();
    connect( _selfListener, SIGNAL(recvData(const char*,int)),
             this, SLOT(onReceiveBlock(const char*,int)), Qt::BlockingQueuedConnection);

    connect( _emulation, SIGNAL(sendData(const char*,int))
             ,this,SLOT(sendData(const char*,int)));

    //connect( _emulation,SIGNAL(lockPtyRequest(bool)),_shellProcess,SLOT(lockPty(bool)) );
    //connect( _emulation,SIGNAL(useUtf8Request(bool)),_shellProcess,SLOT(setUtf8Mode(bool)) );


    //connect( _shellProcess,SIGNAL(done(int)), this, SLOT(done(int)) );

    //setup timer for monitoring session activity
    _monitorTimer = new QTimer(this);
    _monitorTimer->setSingleShot(true);
    connect(_monitorTimer, SIGNAL(timeout()), this, SLOT(monitorTimerDone()));
}