Check-in Number:
|
3881 | |
Date: |
2002-Dec-16 13:11:40 (local)
2002-Dec-16 12:11:40 (UTC) |
User: | ms |
Branch: | |
Comment: |
Removed hardcoded tasks, implemented dynamic account loading, renamed conf
file, corrected comment and empty line handling in load ops. |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/as/as-gui/TODO 1.44 -> 1.45
--- TODO 2002/12/16 10:26:03 1.44
+++ TODO 2002/12/16 12:11:40 1.45
@@ -36,7 +36,6 @@
IDs in as_const.h much better choosing, so they make sense
Make edit control window optional through preferences
Add customizable column ordering by click and drag
-Add new data fields to getRowdata() and setRowdata()
Vor darueberknallen ein Datei, gib mal ne Warning
Preferences
|
|
ossp-pkg/as/as-gui/as_assist.cpp 1.69 -> 1.70
--- as_assist.cpp 2002/12/16 09:58:34 1.69
+++ as_assist.cpp 2002/12/16 12:11:40 1.70
@@ -111,6 +111,7 @@
m_pPrefs->setString(TITRAQ_PREFUSER, Username);
else
m_pPrefs->setString(TITRAQ_PREFUSER, TITRAQ_DEFUSER);
+ m_pPrefs->setString(TITRAQ_PREFACCOUNTS, TITRAQ_DEFACCOUNTS);
m_pPrefs->setString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE);
m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE);
m_pPrefs->setString(TITRAQ_PREFVIEW, TITRAQ_DEFVIEW);
@@ -736,16 +737,9 @@
if (m_pTaskentries == NULL) // Sanity check
throw Genexcept("Main window task entries creation failed.");
- // Populate the stringlist with fresh tasks
- *m_pTaskentries << trUtf8("titraq") << trUtf8("opgui")
- << trUtf8("email") << trUtf8("admin")
- << trUtf8("pmod") << trUtf8("psod")
- << trUtf8("brainstorming") << trUtf8("communication")
- << trUtf8("evaluation") << trUtf8("holiday")
- << trUtf8("implementation") << trUtf8("maintainance")
- << trUtf8("prepare") << trUtf8("perform")
- << trUtf8("visit") << trUtf8("meeting")
- << trUtf8("troubleshooting") << trUtf8("weekly");
+ // 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
// Make the combobox task edit
m_pTasks = new QComboBox(true, m_pCenframe, "Tasks");
|
|
ossp-pkg/as/as-gui/as_const.h 1.24 -> 1.25
--- as_const.h 2002/12/16 09:58:34 1.24
+++ as_const.h 2002/12/16 12:11:40 1.25
@@ -34,13 +34,15 @@
// General preferences
-#define TITRAQ_PREFNAME "as_gui.conf"
+#define TITRAQ_PREFNAME ".asgui"
#define TITRAQ_APPTITLE "AS Gui"
#define TITRAQ_PREFVER "0.5"
#define TITRAQ_PREFUSER "user"
#define TITRAQ_DEFUSER "username"
#define TITRAQ_PREFASFILE "asfile"
#define TITRAQ_DEFASFILE "/e/dev/as"
+#define TITRAQ_PREFACCOUNTS "accounts"
+#define TITRAQ_DEFACCOUNTS "dis.txt"
#define TITRAQ_PREFSTYLE "uistyle"
#define TITRAQ_PREFVIEW "view"
#define TITRAQ_DEFVIEW "normal"
|
|
ossp-pkg/as/as-gui/as_dataop.cpp 1.24 -> 1.25
--- as_dataop.cpp 2002/12/16 10:45:25 1.24
+++ as_dataop.cpp 2002/12/16 12:11:40 1.25
@@ -45,7 +45,73 @@
#include <iostream>
//
-// Convenience method to load accounting data from a file
+// Convenience method to load accounts from a file
+//
+void Titraqform::loadAccounts(QFile &Fileobj)
+{
+ if (Fileobj.isOpen()) { // Check state of file
+ Fileobj.flush(); // Begin processing file cleanly
+ QTextStream Account(&Fileobj); // Convert data to stream
+ this->loadAccounts(Account); // Pass off to do the real work
+ }
+ else {
+ if (!Fileobj.open(IO_ReadOnly)) // Try to open file
+ throw Genexcept("Could not open account file.");
+ else
+ Fileobj.flush(); // Begin processing file cleanly
+ QTextStream Account(&Fileobj); // Convert data to stream
+ this->loadAccounts(Account); // Pass off to do the real work
+ Fileobj.close(); // Finish fileop by closing
+ }
+}
+
+//
+// Load accounts themselves data from a stream
+//
+void Titraqform::loadAccounts(QTextStream &Tstream)
+{
+ 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()) {
+ Line = trUtf8(""); // Empty line for later inspection
+ Line = Tstream.readLine(); // Get a new line to examine
+ }
+
+ // Strip out extra line feeds in stream
+ while (Line.isEmpty() && !Tstream.atEnd()) {
+ Tstream.skipWhiteSpace(); // Strip and get
+ Line = Tstream.readLine(); // the new line
+ if (Line.at(0) == QChar('#')) // Remove comments
+ Line = trUtf8("");
+ }
+
+ // Set the accounts choices by linewise reading from the input
+ // stream and parsing the corresponding account fields out of it
+ while (!Line.isEmpty()) {
+ QString Temp; // For reading from stream
+ QTextStream Asline(&Line, IO_ReadOnly); // Convert a single line
+
+ Asline.skipWhiteSpace(); // Remove whitespaces
+ Asline >> Temp; // Copy revision indicator
+
+ if (Temp == QString(QChar('R'))) { // Copy the account field
+ Asline >> Temp; // to temporary for transfer
+ *m_pTaskentries << Temp; // to internal account bank
+ }
+
+ Line = trUtf8(""); // Clear line for next round
+ while (Line.isEmpty() && !Tstream.atEnd()) {
+ Tstream.skipWhiteSpace(); // Strip and get
+ Line = Tstream.readLine(); // the new line
+ if (Line.at(0) == QChar('#')) // Remove comments
+ Line = trUtf8("");
+ }
+ }
+}
+
+//
+// Convenience method to load personal data from a file
//
void Titraqform::loadData(QFile &Fileobj)
{
@@ -56,15 +122,17 @@
}
else {
if (!Fileobj.open(IO_ReadOnly)) // Try to open file
- throw Genexcept("Could not read open accounting file.");
- QTextStream Asentry(&Fileobj); // Convert data to stream
- this->loadData(Asentry); // Pass off to do the real work
- Fileobj.close(); // Finish fileop by closing
+ throw Genexcept("Could not open personal data file.");
+ else
+ Fileobj.flush(); // Begin processing file cleanly
+ QTextStream Asentry(&Fileobj); // Convert data to stream
+ this->loadData(Asentry); // Pass off to do the real work
+ Fileobj.close(); // Finish fileop by closing
}
}
//
-// Load accounting data from a stream
+// Load personal data from a stream
//
void Titraqform::loadData(QTextStream &Tstream)
{
@@ -78,8 +146,12 @@
QPixmap Staterror(s_kpcStaterror_xpm);
// Strip out extra line feeds at stream start
- while (Line.isEmpty() && !Tstream.atEnd())
- Line = Tstream.readLine();
+ while (Line.isEmpty() && !Tstream.atEnd()) {
+ Tstream.skipWhiteSpace(); // Strip and get
+ Line = Tstream.readLine(); // the new line
+ if (Line.at(0) == QChar('#')) // Remove comments
+ Line = trUtf8("");
+ }
// Optimize viewing by repainting cells only once after processing
m_pMaintable->setUpdatesEnabled(false);
|
|
ossp-pkg/as/as-gui/as_gui.h 1.54 -> 1.55
--- as_gui.h 2002/12/13 23:42:37 1.54
+++ as_gui.h 2002/12/16 12:11:40 1.55
@@ -211,8 +211,10 @@
void setupColumns(void); // Arrange and configure columns
// Data processing
- void loadData(QFile &); // Load accounting data from file
- void loadData(QTextStream &); // Load accounting data from stream
+ void loadAccounts(QFile &); // Load accounts from file
+ void loadAccounts(QTextStream &); // Load accounts from stream
+ void loadData(QFile &); // Load personal data from file
+ void loadData(QTextStream &); // Load personal data from stream
void saveData(QFile &); // Save accounting data to file
void saveData(QTextStream &); // Save accounting data to stream
};
|
|