OSSP CVS Repository

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

Check-in Number: 4032
Date: 2003-Feb-13 21:41:37 (local)
2003-Feb-13 20:41:37 (UTC)
User:ms
Branch:
Comment: Modified class Panel accept operation to apply changes immediately, and added logic to activate file extension switch, using preference value from panel.
Tickets:
Inspections:
Files:
ossp-pkg/as/as-gui/as_const.h      1.51 -> 1.52     1 inserted, 1 deleted
ossp-pkg/as/as-gui/as_slot.cpp      1.120 -> 1.121     51 inserted, 12 deleted

ossp-pkg/as/as-gui/as_const.h 1.51 -> 1.52

--- as_const.h   2003/02/13 18:22:32     1.51
+++ as_const.h   2003/02/13 20:41:37     1.52
@@ -44,7 +44,7 @@
 #define TITRAQ_PREFUSER         "user"
 #define TITRAQ_DEFUSER          "username"
 #define TITRAQ_PREFASFILE       "asfile"
-#define TITRAQ_DEFASFILE        "~/.as/events.as"
+#define TITRAQ_DEFASFILE        "~/.as/events"
 #define TITRAQ_PREFACCOUNTS     "accounts"
 #define TITRAQ_DEFACCOUNTS      "~/.as/accounts"
 #define TITRAQ_PREFSTYLE        "uistyle"


ossp-pkg/as/as-gui/as_slot.cpp 1.120 -> 1.121

--- as_slot.cpp  2003/02/13 19:49:02     1.120
+++ as_slot.cpp  2003/02/13 20:41:37     1.121
@@ -40,6 +40,14 @@
 #include <qmenudata.h>
 #include <qdatastream.h>
 
+// Qt style headers
+#include <qcdestyle.h>
+#include <qsgistyle.h>
+#include <qmotifstyle.h>
+#include <qmotifplusstyle.h>
+#include <qplatinumstyle.h>
+#include <qwindowsstyle.h>
+
 // User interface
 #include "as_gui.h"             // Main classes
 #include "as_except.h"          // Exception classes
@@ -393,6 +401,10 @@
         if (Openas.startsWith(TITRAQ_HOMEDIRTOK))
             Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
 
+        // Conditionally use a unique extension like '.as' if user prefers
+        if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON))
+            Openas += TITRAQ_FEXTENSION;
+
         // This dialog asks which file the user wants to open
         QString Filestring = QFileDialog::getOpenFileName(Openas,
             trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"),
@@ -470,6 +482,10 @@
     if (Openas.startsWith(TITRAQ_HOMEDIRTOK))
         Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
 
+    // Conditionally use a unique extension like '.as' if user prefers
+    if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON))
+        Openas += TITRAQ_FEXTENSION;
+
     // 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()) {
@@ -488,9 +504,12 @@
             }
         }
         else {
-            QString Extension = TITRAQ_FEXTENSION;  // Logic to handle
-            if (!Filestring.endsWith(Extension))    // AS file extension
-                Filestring += Extension;            // insertion
+            // Conditionally use a unique extension like '.as' if user prefers
+            if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON)) {
+                QString Extension = TITRAQ_FEXTENSION;  // Logic to handle
+                if (!Filestring.endsWith(Extension))    // AS file extension
+                    Filestring += Extension;            // insertion
+            }
             this->setFilename(Filestring);  // Set filename of object first
             this->saveFile();               // Finish by calling the save action
         }
@@ -513,6 +532,10 @@
     if (Openas.startsWith(TITRAQ_HOMEDIRTOK))
         Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
 
+    // Conditionally use a unique extension like '.as' if user prefers
+    if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON))
+        Openas += TITRAQ_FEXTENSION;
+
     nResult = 1;            // We loop on this dialog only if an indecisive user
     while (nResult > 0) {   // is hesitant to overwrite a file over and over again
         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);
@@ -532,9 +555,13 @@
                 }
             }
             else {
-                QString Extension = TITRAQ_FEXTENSION;  // Logic to handle
-                if (!Filestring.endsWith(Extension))    // AS file extension
-                    Filestring += Extension;            // insertion
+
+                // Conditionally use a unique extension like '.as' if user prefers
+                if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON)) {
+                    QString Extension = TITRAQ_FEXTENSION;  // Logic to handle
+                    if (!Filestring.endsWith(Extension))    // AS file extension
+                        Filestring += Extension;            // insertion
+                }
                 this->setFilename(Filestring);  // Set filename of object first
                 nResult = 0;                    // Reset our loop control
                 this->saveFile();               // Finish by calling the save action
@@ -1176,18 +1203,30 @@
             m_pSyncact->setEnabled(false);
 
         // Get the selected style which can be more complicated due to mapping...
-        if (pUserpanel->getStyle() == TITRAQ_STRCDE)
+        if (pUserpanel->getStyle() == TITRAQ_STRCDE) {
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
-        else if (pUserpanel->getStyle() == TITRAQ_STRSGI)
+            qApp->setStyle(new QCDEStyle);
+        }
+        else if (pUserpanel->getStyle() == TITRAQ_STRSGI) {
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI);
-        else if (pUserpanel->getStyle() == TITRAQ_STRMOTIF)
+            qApp->setStyle(new QSGIStyle);
+        }
+        else if (pUserpanel->getStyle() == TITRAQ_STRMOTIF) {
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF);
-        else if (pUserpanel->getStyle() == TITRAQ_STRMPLUS)
+            qApp->setStyle(new QMotifStyle);
+        }
+        else if (pUserpanel->getStyle() == TITRAQ_STRMPLUS) {
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS);
-        else if (pUserpanel->getStyle() == TITRAQ_STRPLAT)
+            qApp->setStyle(new QMotifPlusStyle);
+        }
+        else if (pUserpanel->getStyle() == TITRAQ_STRPLAT) {
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT);
-        else if (pUserpanel->getStyle() == TITRAQ_STRMSOFT)
+            qApp->setStyle(new QPlatinumStyle);
+        }
+        else if (pUserpanel->getStyle() == TITRAQ_STRMSOFT) {
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMSOFT);
+            qApp->setStyle(new QWindowsStyle);
+        }
         else // My personal favourite ;-)
             m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
     }

CVSTrac 2.0.1