Check-in Number:
|
3911 | |
Date: |
2002-Dec-20 18:42:10 (local)
2002-Dec-20 17:42:10 (UTC) |
User: | ms |
Branch: | |
Comment: |
Fixed sorting and added sort direction handling. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/as/as-gui/as_assist.cpp 1.78 -> 1.79
--- as_assist.cpp 2002/12/20 15:13:52 1.78
+++ as_assist.cpp 2002/12/20 17:42:10 1.79
@@ -135,7 +135,8 @@
m_pPrefs->setString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE);
m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
m_pPrefs->setString(TITRAQ_PREFVIEW, TITRAQ_DEFVIEW);
- m_pPrefs->setNumber(TITRAQ_PREFSORT, TITRAQ_DEFSORT);
+ m_pPrefs->setNumber(TITRAQ_PREFSORTCOL, TITRAQ_DEFSORTCOL);
+ m_pPrefs->setBool(TITRAQ_PREFSORTDIR, TITRAQ_DEFSORTDIR);
m_pPrefs->setString(TITRAQ_PREFREMOTELOG, TITRAQ_DEFREMOTELOG);
m_pPrefs->setString(TITRAQ_PREFLOCALLOG, TITRAQ_DEFLOCALLOG);
m_pPrefs->flush(); // Write the new conf file
@@ -560,6 +561,10 @@
m_pMaintable->horizontalHeader()->setClickEnabled(true); // Allow click signals
m_pMaintable->horizontalHeader()->setTracking(false); // No continuous tracking
m_pMaintable->setColumnStretchable(TITRAQ_IDXTAIL - 1, true);
+
+ // Allow for user determined data sorting and use saved values
+ m_pMaintable->setSortcol((int)m_pPrefs->getNumber(TITRAQ_PREFSORTCOL, TITRAQ_DEFSORTCOL));
+ m_pMaintable->setSortdir(m_pPrefs->getBool(TITRAQ_PREFSORTDIR, TITRAQ_DEFSORTDIR));
m_pMaintable->setSorting(true);
// Table header row
|
|
ossp-pkg/as/as-gui/as_const.h 1.32 -> 1.33
--- as_const.h 2002/12/18 14:50:58 1.32
+++ as_const.h 2002/12/20 17:42:10 1.33
@@ -125,8 +125,10 @@
#define TITRAQ_DEFWHATBAR true
// Other value preferences
-#define TITRAQ_PREFSORT "sortorder"
-#define TITRAQ_DEFSORT TITRAQ_IDXDATE
+#define TITRAQ_PREFSORTCOL "sortordering"
+#define TITRAQ_DEFSORTCOL TITRAQ_IDXDATE
+#define TITRAQ_PREFSORTDIR "sortascending"
+#define TITRAQ_DEFSORTDIR true
// Other string constants
#define TITRAQ_DATEZERO "0000-00-00"
|
|
ossp-pkg/as/as-gui/as_dataop.cpp 1.31 -> 1.32
--- as_dataop.cpp 2002/12/20 15:13:52 1.31
+++ as_dataop.cpp 2002/12/20 17:42:10 1.32
@@ -262,8 +262,11 @@
}
}
- // Start sorting order correctly according to user preferences
- m_pMaintable->sortColumn((int)m_pPrefs->getNumber(TITRAQ_PREFSORT, TITRAQ_DEFSORT));
+ // Start sorting order and direction correctly according to user preferences
+ int nSortcol = (int)m_pPrefs->getNumber(TITRAQ_PREFSORTCOL, TITRAQ_DEFSORTCOL);
+ bool bSortdir = m_pPrefs->getBool(TITRAQ_PREFSORTDIR, TITRAQ_DEFSORTDIR);
+ m_pMaintable->setSortdir(!bSortdir); // Hack! Fake sortdir so we start right
+ m_pMaintable->sortColumn(nSortcol, bSortdir);
// Write nonsaving line numbers for all rows
for (int nIter = m_pMaintable->numRows() - 1; nIter >= 0; nIter--)
|
|
ossp-pkg/as/as-gui/as_slot.cpp 1.74 -> 1.75
--- as_slot.cpp 2002/12/20 15:13:52 1.74
+++ as_slot.cpp 2002/12/20 17:42:10 1.75
@@ -1187,8 +1187,9 @@
if (m_pMaintable->columnWidth(TITRAQ_IDXREMARK) > 0)
m_pPrefs->setNumber(TITRAQ_PREFREMCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXREMARK));
- // Get sorting order from matrix table and pass it to prefs handler
- m_pPrefs->setNumber(TITRAQ_PREFSORT, (long)m_pMaintable->getSortcol());
+ // Get sorting order and direction from table and pass it to prefs handler
+ m_pPrefs->setNumber(TITRAQ_PREFSORTCOL, (long)m_pMaintable->getSortcol());
+ m_pPrefs->setBool(TITRAQ_PREFSORTDIR, (long)m_pMaintable->getSortdir());
// Set frame geometry preferences
m_pPrefs->setNumber(TITRAQ_PREFFRAMEWIDTH, (long)this->width());
|
|
ossp-pkg/as/as-gui/as_table.cpp 1.17 -> 1.18
--- as_table.cpp 2002/12/18 14:50:58 1.17
+++ as_table.cpp 2002/12/20 17:42:10 1.18
@@ -116,8 +116,14 @@
// widgets to influence dirty or clean state of table data
void TiTable::sortColumn(int nCol, bool bAscend, bool bWhole)
{
+ // Guard against a repeat sort behaviour
+ if (nCol == this->getSortcol() && bAscend == this->getSortdir())
+ this->setSortdir(!bAscend);
+ else
+ this->setSortdir(bAscend);
+
this->setSortcol(nCol);
- QTable::sortColumn(nCol, bAscend, true);
+ QTable::sortColumn(nCol, this->getSortdir(), true);
// Write nonsaving line numbers for all rows
for (int nIter = this->numRows() - 1; nIter >= 0; nIter--)
|
|
ossp-pkg/as/as-gui/as_table.h 1.13 -> 1.14
--- as_table.h 2002/12/18 14:50:58 1.13
+++ as_table.h 2002/12/20 17:42:10 1.14
@@ -41,6 +41,7 @@
private:
int m_nSortcol; // To track current sort column
+ int m_bSortdir; // To track current sort direction
bool m_bDirt; // To track dirty and clean states
public:
@@ -48,6 +49,7 @@
TiTable(QWidget *pParent = 0, const char *szName = 0) : QTable(pParent, szName)
{
this->setSortcol(0);
+ this->setSortdir(true);
this->setDirty(false);
this->setEdition(); // Reset edition state
horizontalHeader()->installEventFilter(this);
@@ -65,6 +67,8 @@
void setEdition(const int nEdit = -1) {m_nEdit = nEdit;}; // Set edition status
const int getSortcol(void) {return m_nSortcol;};
void setSortcol(const int nColin) {m_nSortcol = nColin;};
+ const bool getSortdir(void) {return m_bSortdir;};
+ void setSortdir(const bool bDirection) {m_bSortdir = bDirection;};
// Overridden accessors
void setText(int, int, const QString &);
|
|