X2Go dev team | 20 Mar 14:46 2013

x2goclient2.git - master (branch) updated: 110bbeba16404474f940ea66658b818dcbea220a

The branch, master has been updated
       via  110bbeba16404474f940ea66658b818dcbea220a (commit)
      from  fd0ba68dad5db7ecd7608623c64811ee58d64895 (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 110bbeba16404474f940ea66658b818dcbea220a
Author: Oleksandr Shneyder <o.shneyder@...>
Date:   Wed Mar 20 14:45:43 2013 +0100

    continue developing

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

Summary of changes:
 messagebox.h         |    1 +
 sessionlistframe.cpp |    1 +
 sessionlistframe.ui  |    2 +-
 sessionselecter.cpp  |   45 +++++++++++++++++++++++++++++++++++----------
 sessionselecter.h    |   13 +++++++++++--
 x2gosession.cpp      |   36 ++++++++++++++++++++++++++++++------
 x2gosession.h        |    1 +
 x2gosessiondata.cpp  |    2 +-
 8 files changed, 81 insertions(+), 20 deletions(-)

The diff of changes is:
diff --git a/messagebox.h b/messagebox.h
index da40703..7348ccf 100644
--- a/messagebox.h
+++ b/messagebox.h
 <at>  <at>  -38,6 +38,7  <at>  <at>  protected:
     QEventLoop* loop;
 private slots:
     void slotResize(QResizeEvent* event);
+protected slots:
     void slotYesClicked();
     void slotNoClicked();
     void slotOkClicked();
diff --git a/sessionlistframe.cpp b/sessionlistframe.cpp
index 923347a..661b72c 100644
--- a/sessionlistframe.cpp
+++ b/sessionlistframe.cpp
 <at>  <at>  -30,6 +30,7  <at>  <at>  SessionListFrame::SessionListFrame(QWidget* parent, Qt::WindowFlags f): QFrame(p
             "border-bottom: 0px transparent;border-right: 0px transparent; border-left: 0px transparent");
     treeWidget->verticalScrollBar()->setStyleSheet("border-image:
url(:/svg/transparent.svg);border-top: 0px transparent; "
             "border-bottom: 0px transparent;border-right: 0px transparent; border-left: 0px transparent");
+
     for(int i=0; i<treeWidget->header()->count(); ++i)
         treeWidget->headerItem()->setBackgroundColor(i,QColor(0xed,0xed,0xed,255));
     checkBox->setChecked(false);
diff --git a/sessionlistframe.ui b/sessionlistframe.ui
index ec14d94..0c38cee 100644
--- a/sessionlistframe.ui
+++ b/sessionlistframe.ui
 <at>  <at>  -68,7 +68,7  <at>  <at> 
       <bool>true</bool>
      </attribute>
      <attribute name="headerStretchLastSection">
-      <bool>false</bool>
+      <bool>true</bool>
      </attribute>
      <column>
       <property name="text">
diff --git a/sessionselecter.cpp b/sessionselecter.cpp
index 208c20e..d1d6851 100644
--- a/sessionselecter.cpp
+++ b/sessionselecter.cpp
 <at>  <at>  -23,15 +23,19  <at>  <at> 

 #include "x2goapplication.h"
 #include "workarea.h"
+#include "profile.h"
+
 #include <QDateTime>

-SessionSelecter::SessionSelecter(const QList<X2GoSessionData>& sessions)
+SessionSelecter::SessionSelecter(const QList<X2GoSessionData>& sessions, Profile* profile)
 {
+    this->sessions=(QList< X2GoSessionData >*)&sessions;
     pbNo->hide();
     pbYes->setText(tr("Resume selected"));
     pbYes->setEnabled(false);
     pbOk->setText(tr("New session"));
     lPixmap->hide();
+    lText->setText("<b>"+profile->get_profileName()+"</b><br><br>"+tr("Select X2Go session to resume:"));
     listFrame=new SessionListFrame(frame);
     vlDisplayLayout->insertWidget(1,listFrame);
     foreach (X2GoSessionData data, sessions)
 <at>  <at>  -42,36 +46,38  <at>  <at>  SessionSelecter::SessionSelecter(const QList<X2GoSessionData>& sessions)
             name=X2GoApplication::instance()->getReadableAppName(data.get_command());
         if(name.length()<=0)
             name=data.get_command();
-        item->setText(0, name);
+        item->setText(NAME, name);
         switch(data.get_sessionType())
         {
         case X2GoSessionData::DESKTOP:
-            item->setText(1, tr("Desktop"));
+            item->setText(TYPE, tr("Desktop"));
             break;
         case X2GoSessionData::ROOTLESS:
-            item->setText(1, tr("Single application"));
+            item->setText(TYPE, tr("Single application"));
             break;
         case X2GoSessionData::SHADOW:
             break;
         }
         if(data.get_status()=="S")
         {
-            item->setText(2, tr("Suspended"));
+            item->setText(STATUS, tr("Suspended"));
         }
         else
         {
-            item->setText(2, tr("Running"));
+            item->setText(STATUS, tr("Running"));
         }
-        item->setText(3,data.get_display());
+        item->setText(DISPLAY, data.get_display());

         QDateTime dt=QDateTime::fromString(data.get_creationTime(), Qt::ISODate);
-        item->setText(4,dt.toString(Qt::SystemLocaleShortDate));
-        item->setText(5,data.get_clientIp());
-        item->setText(6,data.get_sessionId());
+        item->setText(CRTIME, dt.toString(Qt::SystemLocaleShortDate));
+        item->setText(CLIENT, data.get_clientIp());
+        item->setText(ID, data.get_sessionId());
     }
     for(int i=0; i<listFrame->treeWidget->header()->count(); ++i)
         listFrame->treeWidget->resizeColumnToContents(i);
     connect(listFrame->treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(slotEnableButton()));
+    connect(listFrame->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
+            this, SLOT(slotSessionDoubleClicked(QTreeWidgetItem*,int)));
 }

 void SessionSelecter::slotEnableButton()
 <at>  <at>  -93,3 +99,22  <at>  <at>  MessageBox::Buttons SessionSelecter::exec()
     X2GoApplication::instance()->get_workArea()->setEnabled(false);
     return (MessageBox::Buttons)loop->exec();
 }
+
+X2GoSessionData* SessionSelecter::getSelectedSession()
+{
+    if(listFrame->treeWidget->selectedItems().count()<=0)
+        return 0;
+    QString id=listFrame->treeWidget->selectedItems()[0]->text(ID);
+    for(int i=0; i<sessions->count(); ++i)
+    {
+        if((*sessions)[i].get_sessionId()==id)
+            return &((*sessions)[i]);
+    }
+    return 0;
+}
+
+
+void SessionSelecter::slotSessionDoubleClicked(QTreeWidgetItem*, int)
+{
+    slotYesClicked();
+}
diff --git a/sessionselecter.h b/sessionselecter.h
index 4a333c7..dfb93fd 100644
--- a/sessionselecter.h
+++ b/sessionselecter.h
 <at>  <at>  -24,18 +24,27  <at>  <at>  class SessionListFrame;/********************************************************
 
 #include "messagebox.h"
 #include "x2gosessiondata.h"
+#include "x2goapplication.h"
+
+class Profile;
 class SessionListFrame;
+class QTreeWidgetItem;
+
 class SessionSelecter: public MessageBox
 {
     Q_OBJECT
 public:
-    SessionSelecter(const QList< X2GoSessionData >& sessions);
+    enum {NAME, TYPE, STATUS, DISPLAY, CRTIME, CLIENT, ID};
+    SessionSelecter(const QList< X2GoSessionData >& sessions, Profile* profile);
     ~SessionSelecter();
     virtual Buttons exec();
+    X2GoSessionData* getSelectedSession();
 private:
     SessionListFrame* listFrame;
-public slots:
+    QList< X2GoSessionData >* sessions;
+private slots:
     void slotEnableButton();
+    void slotSessionDoubleClicked ( QTreeWidgetItem*, int );
 };

 #endif // SESSIONSELECTER_H
diff --git a/x2gosession.cpp b/x2gosession.cpp
index bce8864..e1df84b 100644
--- a/x2gosession.cpp
+++ b/x2gosession.cpp
 <at>  <at>  -75,7 +75,7  <at>  <at>  void X2GoSession::startSession()
 }

 
-void X2GoSession::slotSshConnectionFailed(int, QString)
+void X2GoSession::setSessionNotRunning()
 {
     status=NOTRUNNING;
     emit signalStatusChanged(status);
 <at>  <at>  -86,6 +86,12  <at>  <at>  void X2GoSession::slotSshConnectionFailed(int, QString)
     }
 }

+
+void X2GoSession::slotSshConnectionFailed(int, QString)
+{
+    setSessionNotRunning();
+}
+
 void X2GoSession::slotListSessions(bool success, QString answer, int id)
 {
     if(!success)
 <at>  <at>  -114,15 +120,33  <at>  <at>  void X2GoSession::slotListSessions(bool success, QString answer, int id)
         }
     }
     selectSession(sessions);
-
-
 }
+
 void X2GoSession::selectSession(const QList<X2GoSessionData>& sessions)
 {
-    SessionSelecter* sel=new SessionSelecter(sessions);
-    sel->exec();
+    SessionSelecter* sel=new SessionSelecter(sessions, profile);
+    switch(sel->exec())
+    {
+    case MessageBox::OK:
+        createNewSession();
+        break;
+    case MessageBox::YES:
+        if(!sel->getSelectedSession())
+        {
+            qDebug()<<"selected session is NULL, aborting...";
+            setSessionNotRunning();
+        }
+        else
+        {
+            resumeSession(*(sel->getSelectedSession()));
+        }
+        break;
+    default:
+        qDebug()<<"canceling session";
+        setSessionNotRunning();
+        break;
+    }
     delete sel;
-
 }

 
diff --git a/x2gosession.h b/x2gosession.h
index 81589c0..870073f 100644
--- a/x2gosession.h
+++ b/x2gosession.h
 <at>  <at>  -41,6 +41,7  <at>  <at>  public:
     void startSession();
     void resumeSession(const X2GoSessionData& sessionData);
     void createNewSession();
+    void setSessionNotRunning();
 private:
     void selectSession(const QList<X2GoSessionData> & sessions);
 public slots:
diff --git a/x2gosessiondata.cpp b/x2gosessiondata.cpp
index 164fb5b..2bc3840 100644
--- a/x2gosessiondata.cpp
+++ b/x2gosessiondata.cpp
 <at>  <at>  -57,7 +57,7  <at>  <at>  X2GoSessionData X2GoSessionData::getSessionFromString(const QString& string)
     s.set_sessionId(lst[1]);
     s.set_display(lst[2]);
     s.set_server(lst[3]);
-    s.set_server(lst[4]);
+    s.set_status(lst[4]);
     s.set_creationTime(lst[5]);
     s.set_cookie(lst[6]);
     s.set_clientIp(lst[7]);

hooks/post-receive

Gmane