OSSP CVS Repository

ossp - Check-in [3958]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3958
Date: 2003-Jan-28 17:41:15 (local)
2003-Jan-28 16:41:15 (UTC)
User:ms
Branch:
Comment: Implemented initial file loading by shell argument, and cleaned up some other small problems.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/ChangeLog      1.15 -> 1.16     3 inserted, 0 deleted
ossp-pkg/as/as-gui/TODO      1.62 -> 1.63     1 inserted, 0 deleted
ossp-pkg/as/as-gui/as_assist.cpp      1.84 -> 1.85     36 inserted, 2 deleted
ossp-pkg/as/as-gui/as_gui.cpp      1.34 -> 1.35     6 inserted, 1 deleted
ossp-pkg/as/as-gui/as_gui.h      1.62 -> 1.63     1 inserted, 0 deleted
ossp-pkg/as/as-gui/as_main.cpp      1.11 -> 1.12     1 inserted, 1 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.90 -> 1.91     1 inserted, 0 deleted

ossp-pkg/as/as-gui/ChangeLog 1.15 -> 1.16

--- ChangeLog    2003/01/27 17:56:56     1.15
+++ ChangeLog    2003/01/28 16:41:15     1.16
@@ -1,5 +1,8 @@
 Geschichte des OSSP titraq in Vorwaerts Cronordnung
 
+030128 Added missing MIME icon entries for synciiop and syncsoap
+       Implemented initial file loading by shell argument
+
 030127 Changed date and time from ISO format to AS specific
        Added logic to dim and undim icons on (non)empty documents
        Improved intuitiveness of a newDoc operation by appending a default row


ossp-pkg/as/as-gui/TODO 1.62 -> 1.63

--- TODO 2003/01/27 17:56:56     1.62
+++ TODO 2003/01/28 16:41:15     1.63
@@ -50,6 +50,7 @@
 Soll mehr intuitive, mit sekondaer/dritte Keycolumn
 CRC und Rev sollen nicht in gleiche Methode berechnet
 No need to have upd slots for non-changeable upd controls
+Use argc and argv to open a task file on startup
 
 Win32
 -----


ossp-pkg/as/as-gui/as_assist.cpp 1.84 -> 1.85

--- as_assist.cpp        2003/01/24 18:22:03     1.84
+++ as_assist.cpp        2003/01/28 16:41:15     1.85
@@ -211,6 +211,8 @@
     QMimeSourceFactory::defaultFactory()->setPixmap("rowadd", QPixmap(s_kpcRowadd_xpm));
     QMimeSourceFactory::defaultFactory()->setPixmap("rowdel", QPixmap(s_kpcRowdel_xpm));
     QMimeSourceFactory::defaultFactory()->setPixmap("refresh", QPixmap(s_kpcRefresh_xpm));
+    QMimeSourceFactory::defaultFactory()->setPixmap("synciiop", QPixmap(s_kpcSync_xpm));
+    QMimeSourceFactory::defaultFactory()->setPixmap("syncsoap", QPixmap(s_kpcSync_xpm));
 
     // File new action
     m_pFilenewact = new QAction(trUtf8("New File"), QPixmap(s_kpcFilenew_xpm), trUtf8("&New..."), CTRL+Key_N, this, "New");
@@ -341,7 +343,7 @@
     if (m_pSynciiopact == NULL) // Sanity check
         throw Genexcept("Main window synchronize IIOP action creation failed.");
     connect(m_pSynciiopact, SIGNAL(activated()), this, SLOT(syncIiop()));
-    const char *kszSynciioptext = "<p><img source=\"synchronize\"> "
+    const char *kszSynciioptext = "<p><img source=\"synciiop\"> "
                                   "Click this button to <em>synchronize the data</em>. "
                                   "Your changed entries will be sent to the server. "
                                   "You can also select the <b>Synchronize</b> command "
@@ -355,7 +357,7 @@
     if (m_pSyncsoapact == NULL) // Sanity check
         throw Genexcept("Main window synchronize SOAP action creation failed.");
     connect(m_pSyncsoapact, SIGNAL(activated()), this, SLOT(syncSoap()));
-    const char *kszSyncsoaptext = "<p><img source=\"synchronize\"> "
+    const char *kszSyncsoaptext = "<p><img source=\"syncsoap\"> "
                                   "Click this button to <em>synchronize the data</em>. "
                                   "Your changed entries will be sent to the server. "
                                   "You can also select the <b>Synchronize</b> command "
@@ -1032,3 +1034,35 @@
     this->updEdit(m_pMaintable->currentRow());      // Update edit controls
     m_pMaintable->setDirty(false);                  // Reset to clean data
 }
+
+//
+// Check command line arguments, and parse for an existing filename
+// Returns the number of unhandled arguments, possibly multiple filenames
+//
+int Titraqform::setupCmdargs(void)
+{
+    // If the user gives a filename argument to the shell, then open that file
+    int nNumargs = qApp->argc();    // Holds the number of cmd arguments
+    int nRet = qApp->argc() - 1;    // Holds the return value
+    QFile Initial;                  // Initial event data file to edit
+
+    if (nNumargs > 1) { // Warm up a nice cascade, to set my mind on four weeks of vacation
+        for (int nIter = 1; nIter < nNumargs; nIter++) {    // Salad in New Zealand
+            if (QChar(*qApp->argv()[nIter]) != '-') {       // Bunuelos in Colombia
+                if (QFile::exists(qApp->argv()[nIter])) {
+                    this->setFilename(qApp->argv()[nIter]); // Store inital filename
+                    Initial.setName(*this->getFilename());    // Initial file to load
+                    this->loadData(Initial);                // Pass to helper method
+                    enableIface(true);                      // Turn on the lights
+                    m_pStatbar->message(trUtf8("Loaded document ") + *this->getFilename(), 4000);
+                    m_pMaintable->ensureCellVisible(m_pMaintable->currentRow(), 0);
+                }
+                else { // The inital file name does not correspond to a file
+//                    qWarning((QString("The file ") + qApp->argv()[nIter] + QString(" does not exist.")).ascii());
+                    m_pStatbar->message(trUtf8(QString("The file ") + qApp->argv()[nIter] + QString(" does not exist.")));
+                }
+            }
+        }
+    }
+    return nRet; // Return the number of unhandled arguments
+}


ossp-pkg/as/as-gui/as_gui.cpp 1.34 -> 1.35

--- as_gui.cpp   2003/01/16 08:37:40     1.34
+++ as_gui.cpp   2003/01/28 16:41:15     1.35
@@ -41,6 +41,8 @@
 Titraqform::Titraqform(QWidget *pParent, const char *kszName, WFlags Flags) :
     QMainWindow(pParent, kszName, Flags)
 {
+    int nUnhandled; // Holds the number of unhandled command line arguments
+
     // Early initializations
     m_pFiletools = NULL;
     m_pEdittools = NULL;
@@ -61,6 +63,7 @@
         setupEditlay();         // Create and initialize edit controls
         setupColumns();         // Prepare columns for viewing, sorting
         enableIface(false);     // Start things off in a empty state
+        nUnhandled = setupCmdargs();         // Parse the command line, and init file
     }
     catch (Genexcept& Genex) {
         Genex.reportErr();
@@ -85,7 +88,9 @@
 //    setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0,
 //        (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth()));
 
-    m_pStatbar->message(trUtf8("Ready"));   // Signal a ready condition
+    // Logic left over from setupCmdargs to help decide what our cmd parsing did
+    if (nUnhandled == 0)                        // Args handled, no initial file
+        m_pStatbar->message(trUtf8("Ready"));   // Signal a ready condition
 }
 
 //


ossp-pkg/as/as-gui/as_gui.h 1.62 -> 1.63

--- as_gui.h     2003/01/24 16:32:18     1.62
+++ as_gui.h     2003/01/28 16:41:15     1.63
@@ -246,6 +246,7 @@
     void setupPieces(void);             // Assemble widget pieces
     void setupColumns(void);            // Arrange and configure columns
     void enableIface(bool);             // [En/dis]able most ui pieces
+    int setupCmdargs(void);             // Parse the command line args
 
     // Data processing
     void loadAccounts(QFile &);         // Load accounts from file


ossp-pkg/as/as-gui/as_main.cpp 1.11 -> 1.12

--- as_main.cpp  2002/12/19 20:46:26     1.11
+++ as_main.cpp  2003/01/28 16:41:16     1.12
@@ -34,7 +34,7 @@
 
 int main(int argc, char **argv)
 {
-    QApplication App(argc, argv);
+    QApplication App(argc, argv, QApplication::GuiClient);
 
     Titraqform Mainform;            // Main app window
     App.setMainWidget(&Mainform);


ossp-pkg/as/as-gui/as_slot.cpp 1.90 -> 1.91

--- as_slot.cpp  2003/01/27 17:56:56     1.90
+++ as_slot.cpp  2003/01/28 16:41:16     1.91
@@ -373,6 +373,7 @@
         // Fall through to implicit open code
         this->setCaption(Filestring);
         m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000);
+        m_pMaintable->ensureCellVisible(m_pMaintable->currentRow(), 0);
         this->enableIface(true);    // Turn on the lights
     }
     else

CVSTrac 2.0.1