void Ledger::readFile(QTextStream *inputStream) { if(inputStream){ if( !(validFile = readCsv(inputStream)) ){ clear(); setHorizontalHeaderLabels(QStringList("Error")); appendRow(static_cast<QStandardItem*>(new LedgerItem::QStandardItem("Invalid File Format"))); } computeTotal(); } else{ appendRow(constructEmptyRow()); validFile = true; } undoStack->setClean(); // setup signals connect(this,&QAbstractItemModel::dataChanged, this,&Ledger::computeTotal); connect(this,&QAbstractItemModel::rowsRemoved, this,&Ledger::computeTotal); connect(this,&QAbstractItemModel::rowsInserted,this,&Ledger::computeTotal); connect(undoStack,&QUndoStack::cleanChanged, this,&Ledger::sendChangeSignal); }
void fullDisplayList(Gui_t gui, Entries entries) { char validatedString[40], totalString[40]; int windowOpen; get(gui -> listWindowObject, MUIA_Window_Open, & windowOpen); if (windowOpen) { /* Create the new list */ buildList(gui, entries, TRUE, TRUE, & gui -> entrySA); /* calculate the new totals */ sprintf(validatedString, getString(MSG_VALIDATED), computeValidatedTotal(entries)); set(gui -> liValidatedObject, MUIA_FrameTitle, validatedString); sprintf(totalString, getString(MSG_TOTAL), computeTotal(entries)); set(gui -> liTotalObject, MUIA_FrameTitle, validatedString); /* Redraw the list */ simpleDisplayList(gui, entries); } }