ossp-pkg/as/as-gui/as_assist.cpp 1.86 -> 1.87
--- 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.")));
+
+}
|
|