-rw-r--r-- | noncore/apps/opie-sheet/opie-sheet.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-sheet/sortdlg.cpp | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/opie-sheet/opie-sheet.control b/noncore/apps/opie-sheet/opie-sheet.control index f772247..38f9083 100644 --- a/noncore/apps/opie-sheet/opie-sheet.control +++ b/noncore/apps/opie-sheet/opie-sheet.control @@ -1,10 +1,10 @@ -Files: bin/sheetqt apps/Applications/opie-sheet.desktop help/html/sheetqt.html help/html/sheetqt/* pics/opie-sheet/sheetqt.png +Files: bin/sheetqt apps/Applications/opie-sheet.desktop help/sheetqt.html help/sheetqt/* pics/opie-sheet/sheetqt.png Priority: optional Section: opie/applications Maintainer: Serdar Ozler <sozler@sitebest.com> Architecture: arm Version: 1.0.1 Depends: opie-base ($QPE_VERSION) License: Public Domain Description: Opie Sheet Spreadsheet software for Opie. diff --git a/noncore/apps/opie-sheet/sortdlg.cpp b/noncore/apps/opie-sheet/sortdlg.cpp index 4f18fd3..c60be0d 100644 --- a/noncore/apps/opie-sheet/sortdlg.cpp +++ b/noncore/apps/opie-sheet/sortdlg.cpp @@ -85,108 +85,108 @@ void SortDialog::directionChanged(int id) fillFieldCombo(comboFieldB); fillFieldCombo(comboFieldC); } void SortDialog::fillFieldCombo(QComboBox *combo) { combo->clear(); if (direction) for (int row=row1; row<=row2; ++row) combo->insertItem("Row "+QString::number(row+1)); else for (int col=col1; col<=col2; ++col) combo->insertItem("Column "+Sheet::getHeaderString(col+1)); } int SortDialog::exec(Sheet *s) { sheet=s; sheet->getSelection(&row1, &col1, &row2, &col2); direction=0; fillFieldCombo(comboFieldA); fillFieldCombo(comboFieldB); fillFieldCombo(comboFieldC); if (row1==row2 && col1==col2) { QMessageBox::warning(this, tr("Error"), tr("One cell cannot be sorted!")); return QDialog::Rejected; } if (QDialog::exec()==QDialog::Accepted) { - QString field1S=comboFieldA->currentText(), field2S=comboFieldA->currentText(), field3S=comboFieldA->currentText(); + QString field1S=comboFieldA->currentText(), field2S=comboFieldB->currentText(), field3S=comboFieldC->currentText(); field1S=field1S.mid(field1S.find(' ')+1); field2S=field2S.mid(field2S.find(' ')+1); field3S=field3S.mid(field3S.find(' ')+1); int field1, field2, field3; if (direction) { field1=field1S.toInt()-1; field2=field2S.toInt()-1; field3=field3S.toInt()-1; int i, j; for (i=col2; i>=col1; --i) for (j=col1+1; j<=i; ++j) { bool swap=FALSE; int compareResult=compareItems(s->item(field1, j-1), s->item(field1, j), groupOrderA->id(groupOrderA->selected()), checkCase->isChecked()); if (compareResult>0) swap=TRUE; else if (compareResult==0) { - compareResult=compareItems(s->item(field2, j-1), s->item(field2, j), groupOrderA->id(groupOrderB->selected()), checkCase->isChecked()); + compareResult=compareItems(s->item(field2, j-1), s->item(field2, j), groupOrderB->id(groupOrderB->selected()), checkCase->isChecked()); if (compareResult>0) swap=TRUE; else if (compareResult==0) { - compareResult=compareItems(s->item(field3, j-1), s->item(field3, j), groupOrderA->id(groupOrderC->selected()), checkCase->isChecked()); + compareResult=compareItems(s->item(field3, j-1), s->item(field3, j), groupOrderC->id(groupOrderC->selected()), checkCase->isChecked()); if (compareResult>0) swap=TRUE; } } if (swap) for (int row=row1; row<=row2; ++row) s->swapCells(row, j-1, row, j); } } else { field1=Sheet::getHeaderColumn(field1S)-1; field2=Sheet::getHeaderColumn(field2S)-1; field3=Sheet::getHeaderColumn(field3S)-1; int i, j; for (i=row2; i>=row1; --i) for (j=row1+1; j<=i; ++j) { bool swap=FALSE; int compareResult=compareItems(s->item(j-1, field1), s->item(j, field1), groupOrderA->id(groupOrderA->selected()), checkCase->isChecked()); if (compareResult>0) swap=TRUE; else if (compareResult==0) { - compareResult=compareItems(s->item(j-1, field2), s->item(j, field2), groupOrderA->id(groupOrderB->selected()), checkCase->isChecked()); + compareResult=compareItems(s->item(j-1, field2), s->item(j, field2), groupOrderB->id(groupOrderB->selected()), checkCase->isChecked()); if (compareResult>0) swap=TRUE; else if (compareResult==0) { - compareResult=compareItems(s->item(j-1, field3), s->item(j, field3), groupOrderA->id(groupOrderC->selected()), checkCase->isChecked()); + compareResult=compareItems(s->item(j-1, field3), s->item(j, field3), groupOrderC->id(groupOrderC->selected()), checkCase->isChecked()); if (compareResult>0) swap=TRUE; } } if (swap) for (int col=col1; col<=col2; ++col) s->swapCells(j-1, col, j, col); } } return QDialog::Accepted; } return QDialog::Rejected; } int SortDialog::compareItems(QTableItem *item1, QTableItem *item2, int descending=0, bool caseSensitive=TRUE) { int result=0; if (item1) { if (item2) result=(caseSensitive ? item1->text().compare(item2->text()) : item1->text().upper().compare(item2->text().upper())); else result=-1; } else if (item2) result=1; return (descending ? -result : result); } |