OSSP CVS Repository

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

Check-in Number: 3944
Date: 2003-Jan-24 19:22:03 (local)
2003-Jan-24 18:22:03 (UTC)
User:ms
Branch:
Comment: Made file and directory handling more generic.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/ChangeLog      1.11 -> 1.12     1 inserted, 0 deleted
ossp-pkg/as/as-gui/as_assist.cpp      1.83 -> 1.84     7 inserted, 3 deleted
ossp-pkg/as/as-gui/as_const.h      1.33 -> 1.34     5 inserted, 4 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.85 -> 1.86     14 inserted, 3 deleted

ossp-pkg/as/as-gui/ChangeLog 1.11 -> 1.12

--- ChangeLog    2003/01/24 16:32:18     1.11
+++ ChangeLog    2003/01/24 18:22:03     1.12
@@ -4,6 +4,7 @@
        Removed sort on load to allow easier file diffs
        Allow only reasonable fields to transmit to server
        Improved invalid data signaling in both Titable and ctrls
+       Made account and event file and directory handling generic
 
 030123 Added logic to make IIOP and SOAP connections optional
        Fixed potentially disastrous bug with current file overwrite


ossp-pkg/as/as-gui/as_assist.cpp 1.83 -> 1.84

--- as_assist.cpp        2003/01/24 16:32:18     1.83
+++ as_assist.cpp        2003/01/24 18:22:03     1.84
@@ -52,6 +52,7 @@
 #include <qcombobox.h>
 #include <qlistbox.h>
 #include <qcursor.h>
+#include <qdir.h>
 
 // User interface
 #include "as_gui.h"             // Main classes
@@ -837,7 +838,7 @@
 
     // Configure attributes
     m_pAmount->setButtonSymbols(QSpinBox::PlusMinus);
-    m_pAmount->setSuffix(trUtf8(" Minutes"));
+    m_pAmount->setSuffix(trUtf8(" Mins"));
     m_pAmount->setEnabled(false);
 //    m_pAmount->setSpecialValueText(trUtf8("In progress"));
 
@@ -855,8 +856,11 @@
         throw Genexcept("Main window task entries creation failed.");
 
     // Populate the stringlist with fresh accounts, taken from filename in prefs
-    QFile Filetemp(m_pPrefs->getString(TITRAQ_PREFACCOUNTS, TITRAQ_PREFACCOUNTS));
-    this->loadAccounts(Filetemp);           // Load account helper method
+    QString Asdir = m_pPrefs->getString(TITRAQ_PREFACCOUNTS, TITRAQ_DEFACCOUNTS);
+    if (Asdir.startsWith(TITRAQ_HOMEDIRTOK))
+        Asdir = QDir::homeDirPath() + Asdir.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
+    QFile Filetemp(Asdir);
+    this->loadAccounts(Filetemp);   // Load account helper method
 
     // Make the combobox task edit
     m_pTasks = new QComboBox(true, m_pCenframe, "Tasks");


ossp-pkg/as/as-gui/as_const.h 1.33 -> 1.34

--- as_const.h   2002/12/20 17:42:10     1.33
+++ as_const.h   2003/01/24 18:22:03     1.34
@@ -44,9 +44,9 @@
 #define TITRAQ_PREFUSER         "user"
 #define TITRAQ_DEFUSER          "username"
 #define TITRAQ_PREFASFILE       "asfile"
-#define TITRAQ_DEFASFILE        "/e/dev/as"
+#define TITRAQ_DEFASFILE        "~/.as/events.as"
 #define TITRAQ_PREFACCOUNTS     "accounts"
-#define TITRAQ_DEFACCOUNTS      "/e/dev/as/accounts.txt"
+#define TITRAQ_DEFACCOUNTS      "~/.as/accounts"
 #define TITRAQ_PREFSTYLE        "uistyle"
 #define TITRAQ_PREFVIEW         "view"
 #define TITRAQ_DEFVIEW          "normal"
@@ -108,9 +108,9 @@
 #define TITRAQ_PREFFCOLWIDTH      "finishcolwidth"
 #define TITRAQ_DEFFCOLWIDTH       80
 #define TITRAQ_PREFACOLWIDTH      "amountcolwidth"
-#define TITRAQ_DEFACOLWIDTH       98
+#define TITRAQ_DEFACOLWIDTH       72
 #define TITRAQ_PREFTCOLWIDTH      "taskcolwidth"
-#define TITRAQ_DEFTCOLWIDTH       96
+#define TITRAQ_DEFTCOLWIDTH       148
 #define TITRAQ_PREFREMCOLWIDTH    "remarkcolwidth"
 #define TITRAQ_DEFREMCOLWIDTH     120
 
@@ -133,6 +133,7 @@
 // Other string constants
 #define TITRAQ_DATEZERO         "0000-00-00"
 #define TITRAQ_SEPARATORTOK     " "
+#define TITRAQ_HOMEDIRTOK       "~/"
 #define TITRAQ_SAVEFIRST        "The timesheet contains unsaved changes\nDo you want to save the changes or discard them?"
 #define TITRAQ_OVERWRITE        "A file already exists with the chosen name\nDo you want to overwrite it with new data?"
 


ossp-pkg/as/as-gui/as_slot.cpp 1.85 -> 1.86

--- as_slot.cpp  2003/01/24 16:32:18     1.85
+++ as_slot.cpp  2003/01/24 18:22:03     1.86
@@ -283,7 +283,13 @@
 void Titraqform::openDoc(void)
 {
     int nResult = 0;    // Holds return value from save first messagebox
-    QString Filestring = QFileDialog::getOpenFileName(m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE), trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to open"), NULL, false);
+
+    // Make sure we correctly get the name of the default file to open
+    QString Openas = m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE);
+    if (Openas.startsWith(TITRAQ_HOMEDIRTOK))
+        Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
+
+    QString Filestring = QFileDialog::getOpenFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to open"), NULL, false);
 
     if (!Filestring.isEmpty()) {
         QFile Filetemp(Filestring); // File to load
@@ -373,8 +379,13 @@
 {
     int nResult = 0; // For checking user's answer
 
-    // First get the selected file name to save to
-    QString Filestring = QFileDialog::getSaveFileName(m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE), trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false);
+    // Make sure we correctly get the name of the default file to open
+    QString Openas = m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE);
+    if (Openas.startsWith(TITRAQ_HOMEDIRTOK))
+        Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
+
+    // And then get the name of the selected file to save to
+    QString Filestring = QFileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false);
     if (!Filestring.isEmpty()) {
         if (QFile::exists(Filestring)) {
             nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE),

CVSTrac 2.0.1