Index: ossp-pkg/as/as-gui/as_const.h RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v rcsdiff -q -kk '-r1.51' '-r1.52' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_const.h,v' 2>/dev/null --- 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" Index: ossp-pkg/as/as-gui/as_slot.cpp RCS File: /v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v rcsdiff -q -kk '-r1.120' '-r1.121' -u '/v/ossp/cvs/ossp-pkg/as/as-gui/as_slot.cpp,v' 2>/dev/null --- 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 #include +// Qt style headers +#include +#include +#include +#include +#include +#include + // 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); }