OSSP CVS Repository

ossp - Check-in [4022]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4022
Date: 2003-Feb-11 23:17:17 (local)
2003-Feb-11 22:17:17 (UTC)
User:ms
Branch:
Comment: Implemented thl idea, sorted task listing. Began codeblock for dynamically placed task names.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/TODO      1.83 -> 1.84     0 inserted, 1 deleted
ossp-pkg/as/as-gui/as_dataop.cpp      1.46 -> 1.47     29 inserted, 2 deleted

ossp-pkg/as/as-gui/TODO 1.83 -> 1.84

--- TODO 2003/02/11 14:19:57     1.83
+++ TODO 2003/02/11 22:17:17     1.84
@@ -75,7 +75,6 @@
 cs:  line numberscould be referenced when entering accounts ala bash history ('!4' = record #4)
 mlelstv: 24:00 muss als Valideintrag im Finishfeld erlaubt
 thl: / should enable the user to search for something
-thl: sort accounting 'popup' list
 thl: using = should force a recalculation for a time field
 thl: using ~ should round a time field to the next quarter (configurable)
 


ossp-pkg/as/as-gui/as_dataop.cpp 1.46 -> 1.47

--- as_dataop.cpp        2003/02/11 14:19:57     1.46
+++ as_dataop.cpp        2003/02/11 22:17:17     1.47
@@ -29,6 +29,10 @@
 //  tidatops.cpp: ISO C++ implementation
 //
 
+// System headers
+#include <map>
+#include <string>
+
 // Qt general headers
 #include <qregexp.h>            // Portable regular expressions
 #include <qdatetime.h>
@@ -72,7 +76,13 @@
 //
 void Titraqform::loadAccounts(QTextStream &Tstream)
 {
-    QString Line; // Used for linewise editing and whitespace eating
+    using namespace std;                // Needed for hash tables with hmap
+    map<string, int> Hashnames;         // Hashtable for storing names
+    map<int, string> Hashnums;          // Hashtable for storing repetitions
+    map<string, int>::iterator Nameiter; // The hashtable name iterator
+    map<int, string>::iterator Numiter;  // The hashtable number iterator
+
+    QString Line;           // Used for linewise editing and whitespace eating
 
     // Eat lines until reading the start accounts token
     while (!Line.startsWith(trUtf8("%!AS-ACCOUNTS")) && !Tstream.atEnd()) {
@@ -99,7 +109,8 @@
 
         if (Temp == QString(QChar('R'))) {  // Copy the account field
             Asline >> Temp;                 // to temporary for transfer
-            *m_pTaskentries << Temp;        // to internal account bank
+            string Convstring = Temp;       // Convert to string (can't cast?)
+            Hashnames[Convstring] += Hashnames[Convstring];
         }
 
         Line = QString(""); // Clear line for next round
@@ -110,6 +121,22 @@
                 Line = QString("");
         }
     }
+
+//    Hashnames.insert(map<string, int>::value_type((string)QString, int));
+    for (Nameiter = Hashnames.begin(); Nameiter != Hashnames.end(); Nameiter++)
+        Hashnums[Nameiter->second] += Nameiter->first + '\n';
+
+// FIXME: Put this in loadData, to load custom and most used task names before
+// FIXME: default listings are sorted and inserted
+    for (Numiter = Hashnums.begin(); Numiter != Hashnums.end(); Numiter++) {
+
+        // Count the number of lines of sorted task names
+        int nNumlines = QString(Numiter->second).contains('\n');
+
+        // Iterate through the lines of task names, feeding them into the menu
+        for (int nIter = 0; nIter < nNumlines; nIter++)
+            *m_pTaskentries << QString(Numiter->second).section('\n', nIter, nIter);
+    }
 }
 
 //

CVSTrac 2.0.1