Diffstat (limited to 'noncore/apps/opie-sheet/sortdlg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-sheet/sortdlg.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/apps/opie-sheet/sortdlg.cpp b/noncore/apps/opie-sheet/sortdlg.cpp index c60be0d..c2cdec8 100644 --- a/noncore/apps/opie-sheet/sortdlg.cpp +++ b/noncore/apps/opie-sheet/sortdlg.cpp | |||
@@ -8,25 +8,25 @@ | |||
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Opie Sheet (formerly Sheet/Qt) | 11 | * Opie Sheet (formerly Sheet/Qt) |
12 | * by Serdar Ozler <sozler@sitebest.com> | 12 | * by Serdar Ozler <sozler@sitebest.com> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qradiobutton.h> | 16 | #include <qradiobutton.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | #include "sortdlg.h" | 18 | #include "sortdlg.h" |
19 | 19 | ||
20 | SortDialog::SortDialog(QWidget *parent=0) | 20 | SortDialog::SortDialog(QWidget *parent) |
21 | :QDialog(parent, 0, TRUE) | 21 | :QDialog(parent, 0, TRUE) |
22 | { | 22 | { |
23 | // Main widget | 23 | // Main widget |
24 | tabs=new QTabWidget(this); | 24 | tabs=new QTabWidget(this); |
25 | widgetSort=new QWidget(tabs); | 25 | widgetSort=new QWidget(tabs); |
26 | widgetOptions=new QWidget(tabs); | 26 | widgetOptions=new QWidget(tabs); |
27 | tabs->addTab(widgetSort, tr("&Sort")); | 27 | tabs->addTab(widgetSort, tr("&Sort")); |
28 | tabs->addTab(widgetOptions, tr("&Options")); | 28 | tabs->addTab(widgetOptions, tr("&Options")); |
29 | 29 | ||
30 | // Sort tab | 30 | // Sort tab |
31 | comboFieldA=createFieldCombo(tr("&Sort by"), 10); | 31 | comboFieldA=createFieldCombo(tr("&Sort by"), 10); |
32 | groupOrderA=createOrderButtons(10); | 32 | groupOrderA=createOrderButtons(10); |
@@ -169,24 +169,25 @@ int SortDialog::exec(Sheet *s) | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | if (swap) | 171 | if (swap) |
172 | for (int col=col1; col<=col2; ++col) | 172 | for (int col=col1; col<=col2; ++col) |
173 | s->swapCells(j-1, col, j, col); | 173 | s->swapCells(j-1, col, j, col); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | return QDialog::Accepted; | 176 | return QDialog::Accepted; |
177 | } | 177 | } |
178 | return QDialog::Rejected; | 178 | return QDialog::Rejected; |
179 | } | 179 | } |
180 | 180 | ||
181 | int SortDialog::compareItems(QTableItem *item1, QTableItem *item2, int descending=0, bool caseSensitive=TRUE) | 181 | int SortDialog::compareItems(QTableItem *item1, QTableItem *item2, |
182 | int descending, bool caseSensitive) | ||
182 | { | 183 | { |
183 | int result=0; | 184 | int result=0; |
184 | if (item1) | 185 | if (item1) |
185 | { | 186 | { |
186 | if (item2) result=(caseSensitive ? item1->text().compare(item2->text()) : item1->text().upper().compare(item2->text().upper())); | 187 | if (item2) result=(caseSensitive ? item1->text().compare(item2->text()) : item1->text().upper().compare(item2->text().upper())); |
187 | else result=-1; | 188 | else result=-1; |
188 | } | 189 | } |
189 | else | 190 | else |
190 | if (item2) result=1; | 191 | if (item2) result=1; |
191 | return (descending ? -result : result); | 192 | return (descending ? -result : result); |
192 | } | 193 | } |