Index: ossp-pkg/as/as-gui/as_assist.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v rcsdiff -q -kk '-r1.86' '-r1.87' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_assist.cpp,v' 2>/dev/null --- as_assist.cpp 2003/01/28 16:42:10 1.86 +++ as_assist.cpp 2003/01/28 17:33:55 1.87 @@ -1043,24 +1043,40 @@ { // 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 + int nRet = 0; // Holds the return value 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 - m_pStatbar->message(trUtf8(QString("The file ") + qApp->argv()[nIter] + QString(" does not exist."))); + this->setFilename(qApp->argv()[nIter]); // Store inital filename + if (QFile::exists(*getFilename())) + return ++nRet; // Handled the filename + else + ++nRet; } } + if (nRet > 0) + return -1; // Return a general initial file error } return nRet; // Return the number of unhandled arguments } + +// +// Opens an inital event data file if one exists +// +void Titraqform::setupInitdata(int nFilearg) +{ + // Logic left over from setupCmdargs to help decide what our cmd parsing did + if (nFilearg == 0) // Args handled, no initial file + m_pStatbar->message(trUtf8("Ready")); // Signal a ready condition + else if (nFilearg > 0) { // Args handled, found initial file + QFile Initial; // Initial event data file to edit + 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()); + } + else // The inital file name does not correspond to a file + m_pStatbar->message(trUtf8(QString("The file ") + *this->getFilename() + QString(" does not exist."))); + +} Index: ossp-pkg/as/as-gui/as_dataop.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_dataop.cpp,v rcsdiff -q -kk '-r1.35' '-r1.36' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_dataop.cpp,v' 2>/dev/null --- as_dataop.cpp 2003/01/27 17:56:56 1.35 +++ as_dataop.cpp 2003/01/28 17:33:55 1.36 @@ -294,6 +294,7 @@ m_pMaintable->setUpdatesEnabled(true); // Update and repaint m_pMaintable->setNumRows(nIter); // No excess rows m_pMaintable->setCurrentCell(nIter - 1, 0); // Move focus to last row + m_pMaintable->ensureCellVisible(nIter - 1, 0); // Scroll please if (!bValid) throw Genexcept("Warning: invalid accounting data."); Index: ossp-pkg/as/as-gui/as_gui.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v rcsdiff -q -kk '-r1.35' '-r1.36' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.cpp,v' 2>/dev/null --- as_gui.cpp 2003/01/28 16:41:15 1.35 +++ as_gui.cpp 2003/01/28 17:33:55 1.36 @@ -41,8 +41,6 @@ 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; @@ -53,6 +51,7 @@ // Atenzione! Order is very important in the following sequence. // FIXME: Reorganize this procedural mess into self contained objects try { + int nUnhandled; // Holds number of unhandled cmd args setupPrefs(); // Load general preferences setupActions(); // Create and initialize actions setupMenubar(); // Create and initialize menu bar @@ -63,7 +62,9 @@ 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 + + nUnhandled = setupCmdargs(); // Parse the command line, and init file + setupInitdata(nUnhandled); // Possibly open an inital event data file } catch (Genexcept& Genex) { Genex.reportErr(); @@ -87,10 +88,6 @@ // // Lock down window size // setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, // (QSizePolicy::SizeType)0, 0, 0, sizePolicy().hasHeightForWidth())); - - // 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 } // Index: ossp-pkg/as/as-gui/as_gui.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v rcsdiff -q -kk '-r1.63' '-r1.64' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_gui.h,v' 2>/dev/null --- as_gui.h 2003/01/28 16:41:15 1.63 +++ as_gui.h 2003/01/28 17:33:55 1.64 @@ -247,6 +247,7 @@ void setupColumns(void); // Arrange and configure columns void enableIface(bool); // [En/dis]able most ui pieces int setupCmdargs(void); // Parse the command line args + void setupInitdata(int); // Opens an inital event data file // Data processing void loadAccounts(QFile &); // Load accounts from file Index: ossp-pkg/as/as-gui/as_slot.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v rcsdiff -q -kk '-r1.91' '-r1.92' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null --- as_slot.cpp 2003/01/28 16:41:16 1.91 +++ as_slot.cpp 2003/01/28 17:33:55 1.92 @@ -163,7 +163,6 @@ m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal); m_pMaintable->setDirty(); // Set data to dirty state m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn()); - m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please // Update relevant data fields for all new rows for (int nIter = 1; nIter <= nTotal; nIter++) { @@ -373,7 +372,6 @@ // 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