The code which realizes full functionality ListView Control
in Control Panel has been added.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@435 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/ListConnInfo.h b/rfb/ListConnInfo.h
index 4eacadd..029f2a4 100644
--- a/rfb/ListConnInfo.h
+++ b/rfb/ListConnInfo.h
@@ -23,21 +23,17 @@
 namespace rfb {
 
   struct ListConnInfo  {
-    ListConnInfo() {
-      Clear();
-    };
+    ListConnInfo() {}
 
     void Clear() {
       conn.clear();
       IP_address.clear();
       time_conn.clear();
       status.clear();
-    };
-
-    bool Empty() {
-      return conn.empty();
     }
 
+    bool Empty() { return conn.empty();}
+
     void iBegin() {
       ci = conn.begin();
       Ii = IP_address.begin();
@@ -45,9 +41,7 @@
       si = status.begin();
     }
 
-    bool iEnd() {
-      return ci == conn.end();
-    }
+    bool iEnd() { return ci == conn.end();}
 
     void iNext() {
       ci++;
@@ -57,17 +51,15 @@
     }
 
     void addInfo(DWORD Conn, char* IP, char* Time, int Status) {
-      conn.push_front(Conn);
-      IP_address.push_front(IP);
-      time_conn.push_front(Time);
-      status.push_front(Status);
+      conn.push_back(Conn);
+      IP_address.push_back(strDup(IP));
+      time_conn.push_back(strDup(Time));
+      status.push_back(Status);
     }
 
     void iGetCharInfo(char* buf[3]) {
-      if (Empty())
-        return;
-      buf[0] = (*Ii);
-      buf[1] = (*ti);
+      buf[0] = *Ii;
+      buf[1] = *ti;
       switch (*si) {
       case 0:
         buf[2] = strDup("Full control");
@@ -80,23 +72,37 @@
         break;
       default:
         buf[2] = strDup("Unknown");
-      };
+      }
     }
 
-    DWORD iGetConn() { return *ci;};
+    DWORD iGetConn() { return *ci;}
 
-    int iGetStatus() { return *si;};
+    int iGetStatus() { return *si;}
 
+    void Copy(ListConnInfo* InputList) {
+      Clear();
+      if (InputList->Empty()) return;
+      for (InputList->iBegin(); !InputList->iEnd(); InputList->iNext()) {
+        iAdd(InputList);
+      }
+    }
+
+    void iAdd (ListConnInfo* InputList) {
+      char* buf[3];
+      InputList->iGetCharInfo(buf);
+      addInfo(InputList->iGetConn(), buf[0], buf[1], InputList->iGetStatus());
+    }
+
+  private:
     std::list<DWORD> conn;
     std::list<char*> IP_address;
     std::list<char*> time_conn;
     std::list<int> status;
     std::list<DWORD>::iterator ci;
-    std::list<char*>::iterator Ii, ti;
+    std::list<char*>::iterator Ii;
+    std::list<char*>::iterator ti;
     std::list<int>::iterator si;
-
   };
-
-}
+};
 #endif
 
diff --git a/rfb/VNCSConnectionST.cxx b/rfb/VNCSConnectionST.cxx
index 514ea10..dce1a56 100644
--- a/rfb/VNCSConnectionST.cxx
+++ b/rfb/VNCSConnectionST.cxx
@@ -667,3 +667,10 @@
   sock->inStream().setTimeout(timeoutms);
   sock->outStream().setTimeout(timeoutms);
 }
+
+char* VNCSConnectionST::getStartTime()
+{
+  char* result = ctime(&startTime);
+  result[24] = '\0';
+  return result; 
+}
diff --git a/rfb/VNCSConnectionST.h b/rfb/VNCSConnectionST.h
index faf5488..784ac29 100644
--- a/rfb/VNCSConnectionST.h
+++ b/rfb/VNCSConnectionST.h
@@ -103,7 +103,7 @@
 
     void approveConnectionOrClose(bool accept, const char* reason);
 
-    char* getStartTime() { return ctime(&startTime); }
+    char* getStartTime();
 
   private:
     // SConnection callbacks
diff --git a/rfb/VNCServerST.cxx b/rfb/VNCServerST.cxx
index ae71a37..c25543d 100644
--- a/rfb/VNCServerST.cxx
+++ b/rfb/VNCServerST.cxx
@@ -508,15 +508,14 @@
   comparer->clear();
 }
 
-bool VNCServerST::getConnInfo(ListConnInfo * listConn)
+void VNCServerST::getConnInfo(ListConnInfo * listConn)
 {
   listConn->Clear();
   if (clients.empty())
-    return false;
-  std::list<VNCSConnectionST*>::iterator ci;
-  for (ci = clients.begin(); ci != clients.end(); ci++) {
-    listConn->addInfo((DWORD)(*ci), (*ci)->getSock()->getPeerAddress(),
-                      (*ci)->getStartTime(), 4);
-  }
-  return true;
+    return;
+  int s=0;
+  std::list<VNCSConnectionST*>::iterator i;
+  for (i = clients.begin(); i != clients.end(); i++)
+    listConn->addInfo((DWORD)(*i), (*i)->getSock()->getPeerAddress(),
+                      (*i)->getStartTime(), s++);
 }
\ No newline at end of file
diff --git a/rfb/VNCServerST.h b/rfb/VNCServerST.h
index b3e62a9..596eaab 100644
--- a/rfb/VNCServerST.h
+++ b/rfb/VNCServerST.h
@@ -189,7 +189,7 @@
     // are used, to save memory.
     void setEconomicTranslate(bool et) { useEconomicTranslate = et; }
 
-    bool getConnInfo(ListConnInfo * listConn);
+    void getConnInfo(ListConnInfo * listConn);
 
   protected: