Check-in Number:
|
3886 | |
Date: |
2002-Dec-16 18:13:17 (local)
2002-Dec-16 17:13:17 (UTC) |
User: | ms |
Branch: | |
Comment: |
Preserve user preferred sort order and don't set dirty flag on renumber ops. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/as/as-gui/as_assist.cpp 1.73 -> 1.74
--- as_assist.cpp 2002/12/16 16:23:36 1.73
+++ as_assist.cpp 2002/12/16 17:13:17 1.74
@@ -129,6 +129,7 @@
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->setString(TITRAQ_PREFREMOTELOG, TITRAQ_DEFREMOTELOG);
m_pPrefs->setString(TITRAQ_PREFLOCALLOG, TITRAQ_DEFLOCALLOG);
m_pPrefs->flush(); // Write the new conf file
|
|
ossp-pkg/as/as-gui/as_const.h 1.27 -> 1.28
--- as_const.h 2002/12/16 16:05:57 1.27
+++ as_const.h 2002/12/16 17:13:17 1.28
@@ -112,6 +112,7 @@
#define TITRAQ_PREFREMCOLWIDTH "remarkcolwidth"
#define TITRAQ_DEFREMCOLWIDTH 120
+// Column appearance preferences
#define TITRAQ_PREFFILEBAR "filetoolbar"
#define TITRAQ_DEFFILEBAR true
#define TITRAQ_PREFEDITBAR "edittoolbar"
@@ -121,6 +122,10 @@
#define TITRAQ_PREFWHATBAR "whattoolbar"
#define TITRAQ_DEFWHATBAR true
+// Other value preferences
+#define TITRAQ_PREFSORT "sortorder"
+#define TITRAQ_DEFSORT TITRAQ_IDXDATE
+
// Other string constants
#define TITRAQ_DATEZERO "0000-00-00"
#define TITRAQ_SEPARATORTOK " "
|
|
ossp-pkg/as/as-gui/as_dataop.cpp 1.25 -> 1.26
--- as_dataop.cpp 2002/12/16 12:11:40 1.25
+++ as_dataop.cpp 2002/12/16 17:13:17 1.26
@@ -249,9 +249,6 @@
else
m_pMaintable->setPixmap(nIter, TITRAQ_IDXSTATUS, Staterror);
- // Insert a line number dynamically
- m_pMaintable->setText(nIter, TITRAQ_IDXLINE, (QString::number(nIter)).rightJustify(4, QChar('0')));
-
nIter++; // The big increment
Line = trUtf8(""); // Clear line for next round
@@ -263,12 +260,19 @@
}
}
+ // Start sorting order correctly according to user preferences
+ m_pMaintable->sortColumn((int)m_pPrefs->getNumber(TITRAQ_PREFSORT, TITRAQ_DEFSORT));
+
+ // Write nonsaving line numbers for all rows
+ for (int nIter = m_pMaintable->numRows() - 1; nIter >= 0; nIter--)
+ m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0')));
+
m_pMaintable->setUpdatesEnabled(true); // Update and repaint
m_pMaintable->setNumRows(nIter); // No excess rows
m_pMaintable->setCurrentCell(nIter - 1, 0); // Move focus to last row
if (!bValid)
- throw Genexcept("Warning, invalid accounting data.");
+ throw Genexcept("Warning: invalid accounting data.");
}
//
|
|
ossp-pkg/as/as-gui/as_slot.cpp 1.64 -> 1.65
--- as_slot.cpp 2002/12/16 16:23:36 1.64
+++ as_slot.cpp 2002/12/16 17:13:17 1.65
@@ -1256,6 +1256,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());
+
// Set frame geometry preferences
m_pPrefs->setNumber(TITRAQ_PREFFRAMEWIDTH, (long)this->width());
m_pPrefs->setNumber(TITRAQ_PREFFRAMEHEIGHT, (long)this->height());
|
|
ossp-pkg/as/as-gui/as_table.cpp 1.13 -> 1.14
--- as_table.cpp 2002/12/13 19:36:24 1.13
+++ as_table.cpp 2002/12/16 17:13:17 1.14
@@ -105,9 +105,21 @@
if (this->numRows() > 0) {
// If a cell was edited, emit a signal indicating so
// We can't rely on valueChanged for unknown reasons
- if (nText != this->text(nRow, nCol))
+ if (nText != this->text(nRow, nCol) && nCol != TITRAQ_IDXLINE)
emit textEdited();
QTable::setText(nRow, nCol, nText);
}
}
+
+// Overridden member hack to allow externally connected control
+// widgets to influence dirty or clean state of table data
+void TiTable::sortColumn(int nCol, bool bAscend, bool bWhole)
+{
+ this->setSortcol(nCol);
+ QTable::sortColumn(nCol, bAscend, true);
+
+ // Write nonsaving line numbers for all rows
+ for (int nIter = this->numRows() - 1; nIter >= 0; nIter--)
+ this->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0')));
+}
|
|
ossp-pkg/as/as-gui/as_table.h 1.9 -> 1.10
--- as_table.h 2002/12/16 16:05:57 1.9
+++ as_table.h 2002/12/16 17:13:17 1.10
@@ -38,10 +38,15 @@
class TiTable : public QTable
{
Q_OBJECT
+
+private:
+ int m_nSortcol;
+
public:
// Try to match QTable's default constructor with an initializer list
TiTable(QWidget *pParent = 0, const char *szName = 0) : QTable(pParent, szName)
{
+ m_nSortcol = 0;
horizontalHeader()->installEventFilter(this);
this->setEdition(); // Reset edition state
};
@@ -54,10 +59,12 @@
// Accessor methods
const int getEdition(void) {return m_nEdit;}; // Which edited column was confirmed
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;};
// Overridden accessors
void setText(int, int, const QString &);
- void sortColumn(int nCol, bool bAscend, bool bWhole = true) {QTable::sortColumn(nCol, bAscend, true);};
+ void sortColumn(int nCol, bool bAscend = true, bool bWhole = true);
// virtual QTableItem *item(int nRow, int nCol) const {QTable::item(nRow, nCol);};
// Deny a cell special handling of the focus rectangle
|
|