[X2Go-Commits] x2goclient2.git - master (branch) updated: 48611f11e64cd0a26dbd92483c522b711068d0d1

X2Go dev team git-admin at x2go.org
Tue Apr 2 17:55:27 CEST 2013


The branch, master has been updated
       via  48611f11e64cd0a26dbd92483c522b711068d0d1 (commit)
      from  110bbeba16404474f940ea66658b818dcbea220a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 48611f11e64cd0a26dbd92483c522b711068d0d1
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Tue Apr 2 17:54:30 2013 +0200

    x2goclient can start and resume x2go sessions now

-----------------------------------------------------------------------

Summary of changes:
 sessionlistframe.ui          |    7 +-
 sessionselecter.cpp          |    5 +-
 sessionselecter.h            |    2 +-
 sessionstatusframe.ui        |    2 +-
 sessionstatusframestatus.cpp |   13 +-
 sessionstatusframestatus.ui  |    4 +-
 sshprocess.cpp               |    2 +-
 x2goapplication.cpp          |    2 +-
 x2gosession.cpp              |  449 ++++++++++++++++++++++++++++++++++++++++--
 x2gosession.h                |   28 ++-
 x2gosessiondata.cpp          |    2 +-
 x2gosessiondata.h            |    3 +-
 12 files changed, 479 insertions(+), 40 deletions(-)

The diff of changes is:
diff --git a/sessionlistframe.ui b/sessionlistframe.ui
index 0c38cee..1da36ff 100644
--- a/sessionlistframe.ui
+++ b/sessionlistframe.ui
@@ -82,7 +82,7 @@
      </column>
      <column>
       <property name="text">
-       <string>Status</string>
+       <string>State</string>
       </property>
      </column>
      <column>
@@ -97,6 +97,11 @@
      </column>
      <column>
       <property name="text">
+       <string>Color depth</string>
+      </property>
+     </column>
+     <column>
+      <property name="text">
        <string>Client IP</string>
       </property>
      </column>
diff --git a/sessionselecter.cpp b/sessionselecter.cpp
index d1d6851..b935ece 100644
--- a/sessionselecter.cpp
+++ b/sessionselecter.cpp
@@ -67,9 +67,8 @@ SessionSelecter::SessionSelecter(const QList<X2GoSessionData>& sessions, Profile
             item->setText(STATUS, tr("Running"));
         }
         item->setText(DISPLAY, data.get_display());
-
-        QDateTime dt=QDateTime::fromString(data.get_creationTime(), Qt::ISODate);
-        item->setText(CRTIME, dt.toString(Qt::SystemLocaleShortDate));
+        item->setText(DEPTH, QString::number(data.get_colorDepth()));
+        item->setText(CRTIME, data.get_creationTime().toString(Qt::SystemLocaleShortDate));
         item->setText(CLIENT, data.get_clientIp());
         item->setText(ID, data.get_sessionId());
     }
diff --git a/sessionselecter.h b/sessionselecter.h
index dfb93fd..fcb8e9f 100644
--- a/sessionselecter.h
+++ b/sessionselecter.h
@@ -34,7 +34,7 @@ class SessionSelecter: public MessageBox
 {
     Q_OBJECT
 public:
-    enum {NAME, TYPE, STATUS, DISPLAY, CRTIME, CLIENT, ID};
+    enum {NAME, TYPE, STATUS, DISPLAY, CRTIME, DEPTH, CLIENT, ID};
     SessionSelecter(const QList< X2GoSessionData >& sessions, Profile* profile);
     ~SessionSelecter();
     virtual Buttons exec();
diff --git a/sessionstatusframe.ui b/sessionstatusframe.ui
index b748ad4..6c9db4c 100644
--- a/sessionstatusframe.ui
+++ b/sessionstatusframe.ui
@@ -43,7 +43,7 @@
         <string notr="true">border-image:url(:svg/frame.svg);border-top:5px;border-left:5px;border-right:5px;border-bottom:5px</string>
        </property>
        <property name="text">
-        <string>Status</string>
+        <string>Session status</string>
        </property>
        <property name="checkable">
         <bool>true</bool>
diff --git a/sessionstatusframestatus.cpp b/sessionstatusframestatus.cpp
index 9178742..6ae8b4a 100644
--- a/sessionstatusframestatus.cpp
+++ b/sessionstatusframestatus.cpp
@@ -64,15 +64,18 @@ void SessionStatusFrameStatus::setSession(X2GoSession* session)
             SLOT(slotSessionStatusChanged(X2GoSession::SessionStatus)));
     this->session=session;
     slotSessionStatusChanged(session->get_status());
-    lServer->setText(session->get_profile()->get_server());
-    lLogin->setText(session->get_profile()->get_user());
-    lSID->setText(QString::null);
-    lDisplay->setText(QString::null);
-    lCrTime->setText(QString::null);
 }
 
 void SessionStatusFrameStatus::slotSessionStatusChanged(X2GoSession::SessionStatus status)
 {
+    lServer->setText(session->get_profile()->get_server());
+    lLogin->setText(session->get_profile()->get_user());
+    lSID->setText(session->get_sessionData().get_sessionId());
+    lDisplay->setText(session->get_sessionData().get_display());
+    if(!session->get_sessionData().get_creationTime().isNull())
+        lCrTime->setText(session->get_sessionData().get_creationTime().toString(Qt::DefaultLocaleShortDate));
+    else
+        lCrTime->setText(QString::null);
     switch(status)
     {
     case X2GoSession::NOTRUNNING:
diff --git a/sessionstatusframestatus.ui b/sessionstatusframestatus.ui
index 9a89d54..cab7ebb 100644
--- a/sessionstatusframestatus.ui
+++ b/sessionstatusframestatus.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>624</width>
-    <height>257</height>
+    <height>258</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -182,7 +182,7 @@
         <string notr="true">border-top:0px;border-left:0px;border-right:0px;border-bottom:0px</string>
        </property>
        <property name="text">
-        <string>Status:</string>
+        <string>State:</string>
        </property>
       </widget>
      </item>
diff --git a/sshprocess.cpp b/sshprocess.cpp
index f382f64..2d4ddb1 100644
--- a/sshprocess.cpp
+++ b/sshprocess.cpp
@@ -232,7 +232,7 @@ void SshProcess::tunnelLoop()
     }
     listen(serverSocket,5);
     addrlen=sizeof(struct sockaddr_in);
-    QTimer* timer=new QTimer();
+    QTimer* timer=new QTimer(this);
     connect(timer,SIGNAL(timeout()),this,SLOT(slotCheckNewConnection()));
     timer->start(100);
     emit signalSshTunnelOk(pid);
diff --git a/x2goapplication.cpp b/x2goapplication.cpp
index fe67f1c..c42cbb3 100644
--- a/x2goapplication.cpp
+++ b/x2goapplication.cpp
@@ -153,7 +153,7 @@ void X2GoApplication::slotInitApplication()
     clientConfig->loadConfigFiles();
     if(!clientConfig->parseCommandLineArguments(arguments()))
     {
-        QMessageBox::critical(0,tr("Error"), tr("Error parsing command line arguments"));
+        QMessageBox::critical(0,tr("Error"), tr("Error parsing command line arguments")+arguments().join(":"));
         exit(-1);
         return;
     }
diff --git a/x2gosession.cpp b/x2gosession.cpp
index e1df84b..fd29f14 100644
--- a/x2gosession.cpp
+++ b/x2gosession.cpp
@@ -28,16 +28,22 @@
 #include "x2gobroker.h"
 #include "sessionselecter.h"
 
+#include <QDesktopWidget>
+#include <QFileInfo>
+#include <QDir>
+#include <QProcess>
+
 X2GoSession::X2GoSession(Profile* profile)
 {
     this->profile=profile;
     status=NOTRUNNING;
     sshConnection=0;
+    nxproxy=0;
 }
 
 X2GoSession::~X2GoSession()
 {
-
+    terminateConnections();
 }
 
 
@@ -53,8 +59,7 @@ void X2GoSession::slotStartSession()
 }
 void X2GoSession::startSession()
 {
-    if(sshConnection)
-        delete sshConnection;
+    resetSession();
     QString proxyPassword;
     if(X2GoApplication::instance()->get_broker() && profile->get_useBrokerPassForProxy())
         proxyPassword=X2GoApplication::instance()->get_broker()->get_password();
@@ -74,28 +79,68 @@ void X2GoSession::startSession()
     sshConnection->start();
 }
 
+void X2GoSession::slotSshConnectionOk(QString)
+{
+    qDebug()<<"SSH Connection established";
+    if(profile->get_desktop()=="SHADOW")
+    {
+        //get desktops
+        return;
+    }
+    if(profile->get_desktop()=="RDP" && profile->get_directRDP())
+    {
+        //start rdp session
+        return;
+    }
+    if(X2GoApplication::instance()->get_broker())
+    {
+        //start broker session;
+        return;
+    }
+    sshConnection->executeCommand("export HOSTNAME && x2golistsessions", this,SLOT (slotListSessions(bool, QString, int)));
+}
+
 
-void X2GoSession::setSessionNotRunning()
+void X2GoSession::resetSession()
 {
+    terminateConnections();
     status=NOTRUNNING;
     emit signalStatusChanged(status);
+}
+
+void X2GoSession::terminateConnections()
+{
+    notCheckExitStatus=true;
     if(sshConnection)
     {
         delete sshConnection;
         sshConnection=0;
     }
+    if(nxproxy)
+    {
+        if(nxproxy->state()==QProcess::Running)
+        {
+            qDebug()<<"terminating nxproxy";
+            nxproxy->terminate();
+            nxproxy->waitForFinished(3000);
+        }
+        delete nxproxy;
+        nxproxy=0;
+    }
+
 }
 
 
 void X2GoSession::slotSshConnectionFailed(int, QString)
 {
-    setSessionNotRunning();
+    resetSession();
 }
 
 void X2GoSession::slotListSessions(bool success, QString answer, int id)
 {
     if(!success)
     {
+        MessageBox::critical(tr("<b>Error:</b><br>")+answer, MessageBox::OK);
         slotSshConnectionFailed(id, answer);
         return;
     }
@@ -113,7 +158,7 @@ void X2GoSession::slotListSessions(bool success, QString answer, int id)
     }
     if(sessions.size()==1)
     {
-        if(sessions[0].get_status()=="S")
+        if(sessions[0].get_status()=="S" &&isColorDepthOk(sessions[0].get_colorDepth()))
         {
             resumeSession(sessions[0]);
             return;
@@ -134,49 +179,411 @@ void X2GoSession::selectSession(const QList<X2GoSessionData>& sessions)
         if(!sel->getSelectedSession())
         {
             qDebug()<<"selected session is NULL, aborting...";
-            setSessionNotRunning();
+            resetSession();
         }
         else
-        {
             resumeSession(*(sel->getSelectedSession()));
-        }
         break;
     default:
         qDebug()<<"canceling session";
-        setSessionNotRunning();
+        resetSession();
         break;
     }
     delete sel;
 }
 
 
-void X2GoSession::resumeSession(const X2GoSessionData& sessionData)
+void X2GoSession::createNewSession()
+{
+    newSession=true;
+    sessionData.set_status("S");
+    sessionData.set_server(profile->get_server());
+    sessionData.set_creationTime(QDateTime::currentDateTime());
+    sessionData.set_clientIp("localhost");
+    sessionData.set_command(profile->get_desktop());
+    sessionData.set_sessionType(X2GoSessionData::DESKTOP);
+    if(profile->get_rootless())
+        sessionData.set_sessionType(X2GoSessionData::ROOTLESS);
+    /*implement shadow
+     sessionData.set_sessionType(X2GoSessionData::SHADOW);*/
+    sessionData.set_fullscreen(profile->get_fullscreen());
+    QDesktopWidget wd;
+    sessionData.set_colorDepth(wd.depth());
+    emit signalStatusChanged(status);
+    initX2GoSession();
+}
+
+
+void X2GoSession::initX2GoSession()
 {
 
+    QString geometry;
+    if(profile->get_fullscreen())
+        geometry="fullscreen";
+    else
+        geometry=QString::number ( profile->get_displayWidth() ) +"x"+
+                 QString::number ( profile->get_displayHeight() );
+    QString link;
+    switch (profile->get_speed())
+    {
+    case Profile::MODEM:
+        link="modem";
+        break;
+    case Profile::ISDN:
+        link="isdn";
+        break;
+    case Profile::ADSL:
+        link="adsl";
+        break;
+    case Profile::WAN:
+        link="wan";
+        break;
+    case Profile::LAN:
+        link="lan";
+        break;
+    }
+    QString pack=profile->get_method()+"-"+QString::number(profile->get_quality());
+
+    QString cmd;
+
+    QString sessTypeStr;
+
+    if(newSession)
+    {
+
+        QDesktopWidget wd;
+        QString depth=QString::number ( wd.depth() );
+        sessTypeStr="D ";
+        if ( profile->get_rootless() )
+            sessTypeStr="R ";
+
+        /*implement shadow, published, DMCP, RDP session*/
+        QString xdmcpEnv;
+
+
+        QString dpiEnv;
+        if ( profile->get_changeDPI() )
+        {
+            dpiEnv="X2GODPI="+QString::number ( profile->get_dpi() ) +" ";
+        }
+        cmd=dpiEnv+xdmcpEnv+"x2gostartagent "+
+            geometry+" "+link+" "+pack+
+            " unix-kde-depth_"+depth+" "+profile->get_keyboardLayout()+" "+profile->get_keyboardModel()+" ";
+    }
+    else
+    {
+        cmd="x2goresume-session "+sessionData.get_sessionId()+" "+geometry+
+            " "+link+" "+pack+" "+profile->get_keyboardLayout()+
+            " "+profile->get_keyboardModel()+" ";
+    }
+    if ( profile->get_changeKeyboard())
+        cmd += "1 ";
+    else
+        cmd += "0 ";
+
+    if(newSession)
+    {
+        QFileInfo f ( profile->get_desktop() );
+        cmd+=sessTypeStr+f.fileName();
+        sshConnection->executeCommand(cmd, this, SLOT(slotX2GoAgentStarted(bool, QString, int)));
+    }
+    else
+        sshConnection->executeCommand(cmd, this, SLOT(slotSessionResumed(bool, QString, int)));
+    qDebug()<<cmd;
 }
 
-void X2GoSession::createNewSession()
+
+void X2GoSession::slotX2GoAgentStarted(bool success, QString answer, int id)
 {
+    qDebug()<<"x2gostartagent:"<<answer;
+    if(!success)
+    {
+        if(answer.indexOf("LIMIT")!=-1)
+            MessageBox::critical(tr("<b>Error:</b><br>")+tr("Sessions limit reached"), MessageBox::OK);
+        else
+            MessageBox::critical(tr("<b>Error:</b><br>")+answer, MessageBox::OK);
+        slotSshConnectionFailed(id, answer);
+        return;
+    }
+
+    answer.replace ( " ","" );
+    QStringList lst=answer.split ( '\n' );
 
+    sessionData.set_display(lst[0]);
+    sessionData.set_cookie(lst[1]);
+    sessionData.set_agentPid(lst[2]);
+    sessionData.set_sessionId(lst[3]);
+    sessionData.set_grPort(lst[4]);
+    sessionData.set_sndPort(lst[5]);
+    if ( lst.count() >6 )
+        sessionData.set_fsPort(lst[6]);
+    emit signalStatusChanged(status);
+    connectSession();
 }
 
-void X2GoSession::slotSshConnectionOk(QString)
+bool X2GoSession::isColorDepthOk(int sessionDepth)
 {
-    qDebug()<<"SSH Connection established";
-    if(profile->get_desktop()=="SHADOW")
+    QDesktopWidget wd;
+    if ( sessionDepth==0 )
+        return true;
+    if ( wd.depth()==sessionDepth )
+        return true;
+    if ( ( wd.depth() == 24 || wd.depth() == 32 ) && ( sessionDepth == 24 || sessionDepth == 32 ) )
+        return true;
+    return false;
+}
+
+void X2GoSession::resumeSession(X2GoSessionData data)
+{
+
+    if(!isColorDepthOk(data.get_colorDepth()))
     {
-        //get desktops
+        if(MessageBox::warning(
+                    tr ("<b>Warning</b><br>"
+                        "Your current color depth is "
+                        "different to the color depth of your "
+                        "x2go-session. This may cause problems "
+                        "reconnecting to this session and in most "
+                        "cases <b>you will loose the session</b> "
+                        "and have to start a new one! It's highly "
+                        "recommended to change the color depth of "
+                        "your Display to " ) +tr ( "24 or 32" ) +
+                    tr (
+                        " bit and restart your X-server before you "
+                        "reconnect to this x2go-session.<br>Resume "
+                        "this session anyway?" ),MessageBox::YES|MessageBox::NO)==MessageBox::NO)
+        {
+            resetSession();
+            return;
+        }
+    }
+    newSession=false;
+    sessionData=data;
+    status=RESUMING;
+    emit signalStatusChanged(status);
+    if(sessionData.get_status()=="R")
+    {
+        suspendSession();
         return;
     }
-    if(profile->get_desktop()=="RDP" && profile->get_directRDP())
+    initX2GoSession();
+}
+
+void X2GoSession::slotSessionResumed(bool success, QString answer, int id)
+{
+    qDebug()<<"x2goresume-session:"<<answer;
+    if(!success)
     {
-        //start rdp session
+        MessageBox::critical(tr("<b>Error:</b><br>")+answer, MessageBox::OK);
+        slotSshConnectionFailed(id, answer);
         return;
     }
-    if(X2GoApplication::instance()->get_broker())
+    answer.replace(" ","");
+    QStringList outputLines=answer.split("\n",QString::SkipEmptyParts);
+    foreach(QString line,outputLines)
     {
-        //start broker session;
+        if (line.indexOf("gr_port=")!=-1)
+        {
+            sessionData.set_grPort(line.replace("gr_port=",""));
+        }
+        if (line.indexOf("sound_port=")!=-1)
+        {
+            sessionData.set_sndPort(line.replace("sound_port=",""));;
+        }
+        if (line.indexOf("fs_port=")!=-1)
+        {
+            sessionData.set_fsPort(line.replace("fs_port=",""));
+        }
+    }
+    connectSession();
+}
+
+void X2GoSession::connectSession()
+{
+    localGraphicPort=sessionData.get_grPort();
+    int iport=localGraphicPort.toInt() +1000;
+    while ( iport == sessionData.get_sndPort().toInt() ||
+            iport == sessionData.get_fsPort().toInt() ||
+            X2GoApplication::isPortBusy(iport) )
+        ++iport;
+    localGraphicPort=QString::number ( iport );
+    sshConnection->startTunnel("localhost",sessionData.get_grPort().toInt(),"localhost",
+                               localGraphicPort.toInt(), false, this, SLOT(slotGrTunnelOk(int)),
+                               SLOT(slotGrTunnelFinished(bool, QString, int)));
+}
+
+void X2GoSession::slotGrTunnelFinished(bool success, QString answer, int )
+{
+    if (! success )
+    {
+        QString message=tr ( "<b>Error</b><br>Unable to create SSH tunnel:<br>" )
+                        +answer;
+        MessageBox::critical ( message, MessageBox::OK);
+        resetSession();
+    }
+}
+
+void X2GoSession::slotGrTunnelOk(int)
+{
+    qDebug()<<"tunnel ready, starting nxproxy";
+    QString nxroot=QDir::homePath() +"/.x2go";
+    QString dirpath=nxroot+"/S-"+sessionData.get_sessionId();
+    QDir d ( dirpath );
+    if ( !d.exists() )
+        if ( !d.mkpath ( dirpath ) )
+        {
+            QString message=tr ( "Unable to create folder:" ) +
+                            dirpath;
+            MessageBox::critical (message, MessageBox::OK);
+            resetSession();
+            return;
+        }
+    QFile file ( dirpath+"/options" );
+    if ( !file.open ( QIODevice::WriteOnly | QIODevice::Text ) )
+    {
+        QString message=tr ( "Unable to write file:" ) +
+                        dirpath+"/options";
+        MessageBox::critical ( message, MessageBox::OK);
+        resetSession();
         return;
     }
-    sshConnection->executeCommand("export HOSTNAME && x2golistsessions", this,SLOT (slotListSessions(bool, QString, int)));
+
+    QTextStream out ( &file );
+    out << "nx/nx,root="<<nxroot<<",connect=localhost,cookie="<<
+        sessionData.get_cookie()<<",port="
+        <<localGraphicPort<<",errors="<<dirpath<<"/sessions:"<<
+        sessionData.get_display();
+    file.close();
+
+    nxproxy=new QProcess;
+    notCheckExitStatus=false;
+    proxyErrString="";
+    QStringList env = QProcess::systemEnvironment();
+    QString x2golibpath="/usr/lib/x2go";
+    for ( int l=0; l<env.size(); ++l )
+    {
+        if ( env[l].indexOf ( "X2GO_LIB" ) ==0 )
+        {
+            x2golibpath=env[l].split ( "=" ) [1];
+        }
+    }
+    env << "LD_LIBRARY_PATH="+x2golibpath;
+    env << "NX_CLIENT="+QCoreApplication::applicationFilePath ();
+
+    nxproxy->setEnvironment ( env );
+    connect ( nxproxy,SIGNAL ( error ( QProcess::ProcessError ) ),this,
+              SLOT ( slotProxyError ( QProcess::ProcessError ) ) );
+    connect ( nxproxy,SIGNAL ( finished ( int,QProcess::ExitStatus ) ),this,
+              SLOT ( slotProxyFinished ( int,QProcess::ExitStatus ) ) );
+    connect ( nxproxy,SIGNAL ( readyReadStandardError() ),this,
+              SLOT ( slotProxyStderr() ) );
+    connect ( nxproxy,SIGNAL ( readyReadStandardOutput() ),this,
+              SLOT ( slotProxyStdout() ) );
+
+    QString proxyCmd="nxproxy -S nx/nx,options="+dirpath+"/options:"+
+                     sessionData.get_display();
+    qDebug()<<"starting nxproxy with: "<<proxyCmd<<endl;
+    nxproxy->start ( proxyCmd );
+
+
+#warning check, that proxy connection is ok!!!
+    //QTimer::singleShot ( 30000,this,SLOT ( slotRestartProxy() ) );
+}
+
+void X2GoSession::suspendSession()
+{
+}
+
+void X2GoSession::slotProxyError(QProcess::ProcessError )
+{
+    slotProxyFinished ( -1,QProcess::CrashExit );
+}
+
+void X2GoSession::slotProxyFinished(int, QProcess::ExitStatus )
+{
+    if(!notCheckExitStatus)
+        checkExitStatus();
+}
+
+void X2GoSession::checkExitStatus()
+{
+    sshConnection->executeCommand ( "x2gocmdexitmessage "+
+                                    sessionData.get_sessionId() , this, SLOT(slotStatusReturned(bool, QString)));
+}
+
+
+void X2GoSession::slotStatusReturned(bool success, QString errorMessage)
+{
+    if ( !success )
+    {
+        MessageBox::critical (tr ( "<b>Error</b><br>" )+errorMessage, MessageBox::OK);
+        resetSession();
+        return;
+    }
+    if ( errorMessage.indexOf ( "X2GORUNCOMMAND ERR NOEXEC:" ) !=-1 )
+    {
+        QString cmd=errorMessage;
+        cmd.replace ( "X2GORUNCOMMAND ERR NOEXEC:","" );
+        MessageBox::critical ( tr ( "<b>Error</b><br>" )+tr ( "Unable to execute: " ) + cmd, MessageBox::OK);
+    }
+    resetSession();
+}
+
+void X2GoSession::slotProxyStderr()
+{
+    QString reserr;
+    if ( nxproxy )
+        reserr= nxproxy->readAllStandardError();
+    proxyErrString+=reserr;
+
+
+    if ( proxyErrString.indexOf (
+                "Established X server connection" ) !=-1 )
+    {
+        status=RUNNING;
+        emit(signalStatusChanged(status));
+        if ( newSession )
+        {
+            runCommand();
+            newSession=false;
+        }
+    }
+}
+
+void X2GoSession::slotProxyStdout()
+{
+
+}
+
+void X2GoSession::runCommand()
+{
+    QString command;
+    QString sessionType="D";
+    bool rootless=false;
+    command=profile->get_desktop();
+    rootless=profile->get_rootless();
+    if ( rootless )
+        sessionType="R";
+
+    QString cmd;
+
+    command.replace ( " ","X2GO_SPACE_CHAR" );
+
+    cmd="setsid x2goruncommand "+sessionData.get_display()+" "+
+        sessionData.get_agentPid() + " " +
+        sessionData.get_sessionId()+" "+
+        sessionData.get_sndPort()+ " "+ command+" nosnd "+
+        sessionType +" 1> /dev/null 2>/dev/null & exit";
+
+    sshConnection->executeCommand ( cmd, this, SLOT(slotRunCommandFinished(bool, QString)));
+}
+
+void X2GoSession::slotRunCommandFinished(bool success, QString errorMessage)
+{
+    qDebug()<<errorMessage<<success;
+    if(!success)
+    {
+        MessageBox::critical(tr("<b>Error:</b><br>")+errorMessage, MessageBox::OK);
+        resetSession();
+    }
 }
diff --git a/x2gosession.h b/x2gosession.h
index 870073f..f5c37a2 100644
--- a/x2gosession.h
+++ b/x2gosession.h
@@ -22,6 +22,7 @@
 #define X2GOSESSION_H
 
 #include <QObject>
+#include <QProcess>
 #include "x2goapplication.h"
 #include "sshconnection.h"
 #include "x2gosessiondata.h"
@@ -39,19 +40,42 @@ public:
     X2GoSession(Profile* profile);
     virtual ~X2GoSession();
     void startSession();
-    void resumeSession(const X2GoSessionData& sessionData);
+    void resumeSession(X2GoSessionData data);
+    void suspendSession();
     void createNewSession();
-    void setSessionNotRunning();
+    void initX2GoSession();
+    void resetSession();
+    void terminateConnections();
 private:
     void selectSession(const QList<X2GoSessionData> & sessions);
+    bool isColorDepthOk(int sessionDepth);
+    void connectSession();
+    void runCommand();
 public slots:
     void slotStartSession();
 private slots:
     void slotSshConnectionOk(QString);
     void slotSshConnectionFailed(int, QString errorMessage);
     void slotListSessions(bool success, QString answer, int);
+    void slotX2GoAgentStarted(bool success, QString answer, int);
+    void slotSessionResumed(bool success, QString answer, int);
+    void slotGrTunnelFinished(bool success, QString answer, int);
+    void slotGrTunnelOk(int);
+    void slotProxyError ( QProcess::ProcessError err );
+    void slotProxyFinished ( int result,QProcess::ExitStatus st );
+    void slotRunCommandFinished(bool success, QString errorMessage);
+    void slotStatusReturned(bool success, QString errorMessage);
+    void slotProxyStderr();
+    void slotProxyStdout();
+    void checkExitStatus();
 signals:
     void signalStatusChanged(X2GoSession::SessionStatus status);
+private:
+    QString localGraphicPort;
+    QProcess* nxproxy;
+    QString proxyErrString;
+    bool newSession;
+    bool notCheckExitStatus;
 };
 
 #endif // X2GOSESSION_H
diff --git a/x2gosessiondata.cpp b/x2gosessiondata.cpp
index 2bc3840..a0e496d 100644
--- a/x2gosessiondata.cpp
+++ b/x2gosessiondata.cpp
@@ -58,7 +58,7 @@ X2GoSessionData X2GoSessionData::getSessionFromString(const QString& string)
     s.set_display(lst[2]);
     s.set_server(lst[3]);
     s.set_status(lst[4]);
-    s.set_creationTime(lst[5]);
+    s.set_creationTime(QDateTime::fromString(lst[5],Qt::ISODate));
     s.set_cookie(lst[6]);
     s.set_clientIp(lst[7]);
     s.set_grPort(lst[8]);
diff --git a/x2gosessiondata.h b/x2gosessiondata.h
index d96603d..d0e3759 100644
--- a/x2gosessiondata.h
+++ b/x2gosessiondata.h
@@ -23,6 +23,7 @@
 #define X2GOSESSIONDATA_H
 
 #include "x2goapplication.h"
+#include <QDateTime>
 class X2GoSessionData
 {
 public:
@@ -32,7 +33,7 @@ public:
     X2GO_PROPERTY(QString, display);
     X2GO_PROPERTY(QString, server);
     X2GO_PROPERTY(QString, status);
-    X2GO_PROPERTY(QString, creationTime);
+    X2GO_PROPERTY(QDateTime, creationTime);
     X2GO_PROPERTY(QString, cookie);
     X2GO_PROPERTY(QString, clientIp);
     X2GO_PROPERTY(QString, grPort);


hooks/post-receive
-- 
x2goclient2.git (X2Go Client 2 (rewrite of x2goclient.git))

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goclient2.git" (X2Go Client 2 (rewrite of x2goclient.git)).




More information about the x2go-commits mailing list