-rw-r--r-- | noncore/apps/opie-sheet/ChangeLog | 11 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/opie-sheet.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sheet.cpp | 32 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sheet.h | 4 |
5 files changed, 36 insertions, 16 deletions
diff --git a/noncore/apps/opie-sheet/ChangeLog b/noncore/apps/opie-sheet/ChangeLog index c12a6db..90060e2 100644 --- a/noncore/apps/opie-sheet/ChangeLog +++ b/noncore/apps/opie-sheet/ChangeLog @@ -1,5 +1,14 @@ +October 08, 2002 + + * Release 1.0.2 (by thufir) + - Fixed bug #250 (exhibiting re-calculation error in multi-level calculation). (by thufir) + +October 06, 2002 + + - Fixed data edit box clear problem. (by thufir) + October 05, 2002 - - Fixed bug #252. (by thufir) + - Fixed bug #252 (starting up in 'mouse button' mode). (by thufir) August 31, 2002 diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index 2f07bae..b9f8e57 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp @@ -196,4 +196,5 @@ void MainWindow::selectorFileNew(const DocLnk &lnkDoc) if (currentDoc) delete currentDoc; currentDoc = new DocLnk(lnkDoc); + editData->clear(); listSheets.clear(); comboSheets->clear(); @@ -534,5 +535,5 @@ void MainWindow::slotHelpAbout() dialogAbout.setCaption(tr("About Opie Sheet")); - QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.1\nRelease Date: July 04, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); + QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout); label.setGeometry(dialogAbout.rect()); label.setAlignment(Qt::AlignCenter | Qt::WordBreak); diff --git a/noncore/apps/opie-sheet/opie-sheet.control b/noncore/apps/opie-sheet/opie-sheet.control index 38f9083..cc322bb 100644 --- a/noncore/apps/opie-sheet/opie-sheet.control +++ b/noncore/apps/opie-sheet/opie-sheet.control @@ -4,5 +4,5 @@ Section: opie/applications Maintainer: Serdar Ozler <sozler@sitebest.com> Architecture: arm -Version: 1.0.1 +Version: 1.0.2 Depends: opie-base ($QPE_VERSION) License: Public Domain diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp index be4046b..c2563c2 100644 --- a/noncore/apps/opie-sheet/sheet.cpp +++ b/noncore/apps/opie-sheet/sheet.cpp @@ -89,5 +89,5 @@ void Sheet::slotCellChanged(int row, int col) if (cellData) cellData->data=text(row, col); for (cellData=sheetData.first(); cellData; cellData=sheetData.next()) - setText(cellData->row, cellData->col, dataParser(cellData->data)); + setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); emit sheetModified(); } @@ -103,6 +103,6 @@ void Sheet::swapCells(int row1, int col1, int row2, int col2) cellData1->data=cellData2->data; cellData2->data=tempData; - setText(cellData1->row, cellData1->col, dataParser(cellData1->data)); - setText(cellData2->row, cellData2->col, dataParser(cellData2->data)); + setText(cellData1->row, cellData1->col, dataParser(findCellName(cellData1->row, cellData1->col), cellData1->data)); + setText(cellData2->row, cellData2->col, dataParser(findCellName(cellData2->row, cellData2->col), cellData2->data)); emit sheetModified(); } @@ -167,5 +167,5 @@ double Sheet::calculateVariable(const QString &variable) int row, col; - return (findRowColumn(variable, &row, &col, TRUE) ? text(row, col).toDouble() : 0); + return (findRowColumn(variable, &row, &col, TRUE) ? dataParser(variable, text(row, col)).toDouble() : 0); } @@ -421,9 +421,11 @@ QString Sheet::dataParserHelper(const QString &data) } -QString Sheet::dataParser(const QString &data) +QString Sheet::dataParser(const QString &cell, const QString &data) { QString strippedData(data); strippedData.replace(QRegExp("\\s"), ""); if (strippedData.isEmpty() || strippedData[0]!='=') return data; + if (listDataParser.find(cell)!=listDataParser.end()) return "0"; + listDataParser.append(cell); strippedData=dataParserHelper(strippedData.remove(0, 1).upper().replace(QRegExp(":"), ",")); @@ -436,4 +438,5 @@ QString Sheet::dataParser(const QString &data) } while (!tempParameter.isNull()); + listDataParser.remove(cell); return result.mid(1); } @@ -540,7 +543,7 @@ void Sheet::viewportMouseReleaseEvent(QMouseEvent *e) selectionNo=-1; if (oldSelection.topRow()==oldSelection.bottomRow() && oldSelection.leftCol()==oldSelection.rightCol()) - emit cellClicked(getHeaderString(oldSelection.leftCol()+1)+QString::number(oldSelection.topRow()+1)); + emit cellClicked(findCellName(oldSelection.topRow(), oldSelection.leftCol())); else - emit cellClicked(getHeaderString(oldSelection.leftCol()+1)+QString::number(oldSelection.topRow()+1)+','+getHeaderString(oldSelection.rightCol()+1)+QString::number(oldSelection.bottomRow()+1)); + emit cellClicked(findCellName(oldSelection.topRow(), oldSelection.leftCol())+','+findCellName(oldSelection.bottomRow(), oldSelection.rightCol())); } else @@ -548,4 +551,9 @@ void Sheet::viewportMouseReleaseEvent(QMouseEvent *e) } +QString Sheet::findCellName(int row, int col) +{ + return (getHeaderString(col+1)+QString::number(row+1)); +} + void Sheet::copySheetData(QList<typeCellData> *destSheetData) { @@ -577,5 +585,5 @@ void Sheet::setSheetData(QList<typeCellData> *srcSheetData) *newCellData=*tempCellData; sheetData.append(newCellData); - setText(newCellData->row, newCellData->col, dataParser(newCellData->data)); + setText(newCellData->row, newCellData->col, dataParser(findCellName(newCellData->row, newCellData->col), newCellData->data)); } emit sheetModified(); @@ -757,5 +765,5 @@ void Sheet::editPaste(bool onlyContents) cellData->col+=col1; } - setText(cellData->row, cellData->col, dataParser(cellData->data)); + setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); emit sheetModified(); } @@ -780,5 +788,5 @@ void Sheet::insertRows(int no, bool allColumns) { updateCell(tempCellData->row-no, tempCellData->col); - setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data)); + setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); } emit sheetModified(); @@ -806,5 +814,5 @@ void Sheet::insertColumns(int no, bool allRows) { updateCell(tempCellData->row, tempCellData->col-no); - setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data)); + setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); } emit sheetModified(); @@ -833,5 +841,5 @@ void Sheet::dataFindReplace(const QString &findStr, const QString &replaceStr, b { tempCellData->data=cellItem->text().replace(QRegExp(findStr, matchCase), replaceStr); - setText(tempCellData->row, tempCellData->col, dataParser(tempCellData->data)); + setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); } if (!replace || !replaceAll) break; diff --git a/noncore/apps/opie-sheet/sheet.h b/noncore/apps/opie-sheet/sheet.h index f78a684..f4e9d38 100644 --- a/noncore/apps/opie-sheet/sheet.h +++ b/noncore/apps/opie-sheet/sheet.h @@ -48,8 +48,10 @@ class Sheet: public QTable QList<typeCellData> sheetData, clipboardData; QString pressedCell, releasedCell, sheetName; + QStringList listDataParser; // Private functions int getOperatorPriority(char oper); bool findRowColumn(const QString &variable, int *row, int *col, bool giveError=FALSE); + QString findCellName(int row, int col); bool findRange(const QString &variable1, const QString &variable2, int *row1, int *col1, int *row2, int *col2); double calculateVariable(const QString &variable); @@ -58,5 +60,5 @@ class Sheet: public QTable QString popStringStack(QStack<QString> *stackStrings); QString getParameter(const QString ¶meters, int paramNo, bool giveError=FALSE, const QString funcName=""); - QString dataParser(const QString &data); + QString dataParser(const QString &cell, const QString &data); QString dataParserHelper(const QString &data); typeCellData *createCellData(int row, int col); |