OSSP CVS Repository

ossp - Difference in ossp-pkg/as/as-gui/as_slot.cpp versions 1.118 and 1.119
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/as/as-gui/as_slot.cpp 1.118 -> 1.119

--- as_slot.cpp  2003/02/12 19:33:05     1.118
+++ as_slot.cpp  2003/02/13 18:22:32     1.119
@@ -31,6 +31,7 @@
 
 // system headers
 #include <memory>
+#include <cstring>
 
 // Qt headers
 #include <qfiledialog.h>
@@ -1119,8 +1120,18 @@
     pUserpanel->setHome(m_pPrefs->getString(TITRAQ_PREFHOME, TITRAQ_DEFHOME));
     pUserpanel->setCorbahost(m_pPrefs->getString(TITRAQ_PREFCORBHOST, TITRAQ_DEFCORBHOST));
     pUserpanel->setSoaphost(m_pPrefs->getString(TITRAQ_PREFSOAPHOST, TITRAQ_DEFSOAPHOST));
+#ifdef HAVE_MICO
     pUserpanel->setCorbaon(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON));
+#else
+    pUserpanel->setCorbaon(false);
+    pUserpanel->lockCorba();
+#endif
+#ifdef HAVE_ESOAP
     pUserpanel->setSoapon(m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON));
+#else
+    pUserpanel->setSoapon(false);
+    pUserpanel->lockSoap();
+#endif
     pUserpanel->setBackon(m_pPrefs->getBool(TITRAQ_PREFBAKON, TITRAQ_DEFBAKON));
     pUserpanel->setExtendon(m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON));
 
@@ -1547,9 +1558,8 @@
 void Titraqform::syncIiop(void)
 {
 #ifdef HAVE_MICO
-    int nNada = 0;          // Some false parameters
-    char **ppcNada = NULL;  // to fake out the ORB
-    CORBA::ORB_var Orb;     // The ORB
+    char **ppcInargv = NULL;    // Parameters to the ORB
+    CORBA::ORB_var Orb;         // The ORB iself
 
     CORBA::Object_var Nameobj;      // Name service reference
     CosNaming::NamingContext_var Namectx; // COSS ns context
@@ -1559,9 +1569,32 @@
     Asdatabase_var Asdbase;         // Casted object to ASDB
     Astuple Singlerow;              // A single row of AS data
 
+    QString *pOrbargv = new QString(TITRAQ_ORBINIT);
+    int nCount = pOrbargv->contains(' ');
+    int nNamesize = 0;
+
+    // Build a false incoming argv with which we initialize the ORB
+    ppcInargv = new char *[nCount + 3]; // 3 = arg0 + last section + COSS host
+    *ppcInargv = new char[strlen(*qApp->argv() + 2)]; // For cmd name
+    strcpy(ppcInargv[0], *qApp->argv());              // Copy cmd name
+    for (int nIter = 0; nIter <= nCount; nIter++) {
+        QString Section = pOrbargv->section(' ', nIter, nIter);
+        ppcInargv[nIter + 1] = new char[strlen(Section.ascii() + 2)];
+        strcpy(ppcInargv[nIter + 1], Section.ascii());
+    }
+
+    // Build the single string COSS naming host name with associated port number
+    *pOrbargv = TITRAQ_COSSPART1
+              + m_pPrefs->getString(TITRAQ_PREFCORBHOST, TITRAQ_DEFCORBHOST)
+              + TITRAQ_COSSPART2;
+    nNamesize = strlen(pOrbargv->ascii());
+    ppcInargv[nCount + 2] = new char[nNamesize];
+    strcpy(ppcInargv[nCount + 2], pOrbargv->ascii());
+
     try {
         // Initialization of the ORB and COSS naming service
-        Orb = CORBA::ORB_init(nNada, ppcNada, "mico-local-orb");
+        nCount = nCount + 3; // Raise the count to include app, last sec, COSS
+        Orb = CORBA::ORB_init(nCount, ppcInargv, "mico-local-orb");
         Nameobj = Orb->resolve_initial_references("NameService");
         Namectx = CosNaming::NamingContext::_narrow(Nameobj);
         if (CORBA::is_nil(Namectx)) { // Verify sanity
@@ -1569,6 +1602,12 @@
             qWarning("Could not find the COSS naming service\n");
         }
 
+        // Clean up our dynamically allocated array
+        for (int nIter = 0; nIter < nCount; nIter++)
+            delete ppcInargv[nIter];
+        delete ppcInargv; // Free the array itself
+        delete pOrbargv;  // Free the intermediate string
+
         // Prepare the COSS name request
         Cosname.length(1);
         Cosname[0].id = CORBA::string_dup("Asdatabase");
@@ -1655,29 +1694,35 @@
     USING_EASYSOAP_NAMESPACE
 
     try {
-        const char *pSpace    = "http://soap.europalab.com/asdb";
-        const char *pEndpoint = "http://www.europalab.com/cgi-bin/asdbserv";
-        SOAPProxy Proxy(pEndpoint);
-        SOAPMethod Logmeth("Log", pSpace);  // SOAP remote method name
+        SOAPMethod Logmeth("Log", TITRAQ_SOAPSPACE); // SOAP namespace
         SOAPString Clistr;                  // Outgoing parameter to marshall
         int nCrc;                           // SOAP unmarshalled return value
 
-        // A quasi diff summary to transmit to the server
-        QString Syncthis;
-        int nRow = m_pMaintable->currentRow();
-        Syncthis += m_pMaintable->text(nRow, TITRAQ_IDXUSER);
-        for (int nIter = TITRAQ_IDXUSER + 1; nIter < TITRAQ_IDXTAIL; nIter++)
-            Syncthis += ' ' + m_pMaintable->text(nRow, nIter);
+        // Build the single string SOAP end point which look like this:
+        //   "http://www.europalab.com/cgi-bin/asdbserv"
+        QString Endpoint;
+        Endpoint = TITRAQ_PREFIXHTTP + m_pPrefs->getString(TITRAQ_PREFSOAPHOST, TITRAQ_DEFSOAPHOST);
+        SOAPProxy Proxy(Endpoint.ascii());
 
-        Clistr = Syncthis;                          // Build RPC parameter
-        Logmeth.AddParameter("Tuple") << Clistr;    // Prepare for marshalling
-        const SOAPResponse &Logresp = Proxy.Execute(Logmeth);
-        Logresp.GetReturnValue() >> nCrc;
+        // Fill account log object(s) to marshall and transmit
+        QTableSelection Select = m_pMaintable->selection(0);    // Capture selected rows
+        int nTotal = Select.bottomRow() - Select.topRow() + 1;  // Total rows selected
+
+        // Iterate through the selection of row entries to transmit
+        for (int nRowiter = 0; nRowiter < nTotal; nRowiter++) {
+            QString Syncthis = m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXUSER);
+            for (int nColiter = TITRAQ_IDXUSER + 1; nColiter < TITRAQ_IDXTAIL; nColiter++)
+                Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, nColiter);
+            Clistr = Syncthis;                          // Build RPC parameter
+            Logmeth.AddParameter("Tuple") << Clistr;    // Prepare for marshalling
+            const SOAPResponse &Logresp = Proxy.Execute(Logmeth);
+            Logresp.GetReturnValue() >> nCrc;
+        }
         m_pStatbar->message(trUtf8("Successful transmission, CRC returned %1").arg(nCrc));
     }
     catch (SOAPException& Soapex) { // Announce the exception we received
         m_pStatbar->message(trUtf8("Caught SOAP exception: %1").arg(Soapex.What().Str()));
-        qDebug("Caught SOAP exception: %s\n", Soapex.What().Str());
+        qDebug("Caught SOAP exception: %s", Soapex.What().Str());
     }
     catch (...) {
         qDebug("Caught unknown exception\n");

CVSTrac 2.0.1