head 1.145; access; symbols AS_AFTER_RESTRUCTURING:1.28; locks; strict; comment @// @; 1.145 date 2004.08.24.21.42.16; author ms; state Exp; branches; next 1.144; 1.144 date 2004.08.20.17.47.07; author ms; state Exp; branches; next 1.143; 1.143 date 2004.08.13.12.36.03; author ms; state Exp; branches; next 1.142; 1.142 date 2004.08.12.16.23.26; author ms; state Exp; branches; next 1.141; 1.141 date 2004.05.27.21.48.41; author ms; state Exp; branches; next 1.140; 1.140 date 2004.05.27.21.42.26; author ms; state Exp; branches; next 1.139; 1.139 date 2003.11.20.11.31.20; author ms; state Exp; branches; next 1.138; 1.138 date 2003.04.28.16.47.26; author ms; state Exp; branches; next 1.137; 1.137 date 2003.03.05.20.27.34; author ms; state Exp; branches; next 1.136; 1.136 date 2003.02.28.18.07.42; author ms; state Exp; branches; next 1.135; 1.135 date 2003.02.28.17.12.24; author ms; state Exp; branches; next 1.134; 1.134 date 2003.02.27.13.57.47; author ms; state Exp; branches; next 1.133; 1.133 date 2003.02.25.09.29.58; author ms; state Exp; branches; next 1.132; 1.132 date 2003.02.21.23.40.20; author ms; state Exp; branches; next 1.131; 1.131 date 2003.02.21.15.04.04; author ms; state Exp; branches; next 1.130; 1.130 date 2003.02.21.10.11.36; author ms; state Exp; branches; next 1.129; 1.129 date 2003.02.20.16.46.38; author ms; state Exp; branches; next 1.128; 1.128 date 2003.02.19.18.23.16; author ms; state Exp; branches; next 1.127; 1.127 date 2003.02.17.17.19.33; author ms; state Exp; branches; next 1.126; 1.126 date 2003.02.14.19.27.03; author ms; state Exp; branches; next 1.125; 1.125 date 2003.02.14.17.31.55; author ms; state Exp; branches; next 1.124; 1.124 date 2003.02.14.09.18.25; author ms; state Exp; branches; next 1.123; 1.123 date 2003.02.13.21.50.35; author ms; state Exp; branches; next 1.122; 1.122 date 2003.02.13.21.12.36; author ms; state Exp; branches; next 1.121; 1.121 date 2003.02.13.20.41.37; author ms; state Exp; branches; next 1.120; 1.120 date 2003.02.13.19.49.02; author ms; state Exp; branches; next 1.119; 1.119 date 2003.02.13.18.22.32; author ms; state Exp; branches; next 1.118; 1.118 date 2003.02.12.19.33.05; author ms; state Exp; branches; next 1.117; 1.117 date 2003.02.11.14.19.57; author ms; state Exp; branches; next 1.116; 1.116 date 2003.02.08.18.10.09; author ms; state Exp; branches; next 1.115; 1.115 date 2003.02.07.16.37.55; author ms; state Exp; branches; next 1.114; 1.114 date 2003.02.06.16.47.19; author ms; state Exp; branches; next 1.113; 1.113 date 2003.02.06.15.55.01; author ms; state Exp; branches; next 1.112; 1.112 date 2003.02.05.12.54.22; author ms; state Exp; branches; next 1.111; 1.111 date 2003.02.05.11.33.27; author ms; state Exp; branches; next 1.110; 1.110 date 2003.02.04.20.32.46; author ms; state Exp; branches; next 1.109; 1.109 date 2003.02.04.19.30.31; author ms; state Exp; branches; next 1.108; 1.108 date 2003.02.03.21.41.42; author ms; state Exp; branches; next 1.107; 1.107 date 2003.02.03.21.14.58; author ms; state Exp; branches; next 1.106; 1.106 date 2003.02.03.14.12.09; author ms; state Exp; branches; next 1.105; 1.105 date 2003.02.03.11.04.23; author ms; state Exp; branches; next 1.104; 1.104 date 2003.02.03.10.57.57; author ms; state Exp; branches; next 1.103; 1.103 date 2003.01.31.18.48.57; author ms; state Exp; branches; next 1.102; 1.102 date 2003.01.31.18.37.01; author ms; state Exp; branches; next 1.101; 1.101 date 2003.01.31.18.03.36; author ms; state Exp; branches; next 1.100; 1.100 date 2003.01.31.14.03.03; author ms; state Exp; branches; next 1.99; 1.99 date 2003.01.30.23.48.00; author ms; state Exp; branches; next 1.98; 1.98 date 2003.01.30.23.17.06; author ms; state Exp; branches; next 1.97; 1.97 date 2003.01.30.22.40.35; author ms; state Exp; branches; next 1.96; 1.96 date 2003.01.30.22.02.41; author ms; state Exp; branches; next 1.95; 1.95 date 2003.01.30.20.26.03; author ms; state Exp; branches; next 1.94; 1.94 date 2003.01.30.18.14.51; author ms; state Exp; branches; next 1.93; 1.93 date 2003.01.30.14.36.01; author ms; state Exp; branches; next 1.92; 1.92 date 2003.01.28.17.33.55; author ms; state Exp; branches; next 1.91; 1.91 date 2003.01.28.16.41.16; author ms; state Exp; branches; next 1.90; 1.90 date 2003.01.27.17.56.56; author ms; state Exp; branches; next 1.89; 1.89 date 2003.01.27.14.43.44; author ms; state Exp; branches; next 1.88; 1.88 date 2003.01.27.13.24.26; author ms; state Exp; branches; next 1.87; 1.87 date 2003.01.24.19.44.40; author ms; state Exp; branches; next 1.86; 1.86 date 2003.01.24.18.22.03; author ms; state Exp; branches; next 1.85; 1.85 date 2003.01.24.16.32.18; author ms; state Exp; branches; next 1.84; 1.84 date 2003.01.23.18.04.45; author ms; state Exp; branches; next 1.83; 1.83 date 2003.01.23.14.38.47; author ms; state Exp; branches; next 1.82; 1.82 date 2003.01.22.23.57.01; author ms; state Exp; branches; next 1.81; 1.81 date 2003.01.22.19.20.30; author ms; state Exp; branches; next 1.80; 1.80 date 2003.01.22.11.36.53; author ms; state Exp; branches; next 1.79; 1.79 date 2003.01.21.12.38.01; author ms; state Exp; branches; next 1.78; 1.78 date 2003.01.16.08.37.40; author ms; state Exp; branches; next 1.77; 1.77 date 2003.01.16.08.32.31; author ms; state Exp; branches; next 1.76; 1.76 date 2003.01.16.08.26.29; author ms; state Exp; branches; next 1.75; 1.75 date 2002.12.20.17.42.10; author ms; state Exp; branches; next 1.74; 1.74 date 2002.12.20.15.13.52; author ms; state Exp; branches; next 1.73; 1.73 date 2002.12.19.20.46.26; author ms; state Exp; branches; next 1.72; 1.72 date 2002.12.19.13.23.35; author ms; state Exp; branches; next 1.71; 1.71 date 2002.12.19.11.25.19; author ms; state Exp; branches; next 1.70; 1.70 date 2002.12.18.15.47.18; author ms; state Exp; branches; next 1.69; 1.69 date 2002.12.18.14.50.58; author ms; state Exp; branches; next 1.68; 1.68 date 2002.12.18.12.36.16; author ms; state Exp; branches; next 1.67; 1.67 date 2002.12.17.14.08.33; author ms; state Exp; branches; next 1.66; 1.66 date 2002.12.16.17.37.39; author ms; state Exp; branches; next 1.65; 1.65 date 2002.12.16.17.13.17; author ms; state Exp; branches; next 1.64; 1.64 date 2002.12.16.16.23.36; author ms; state Exp; branches; next 1.63; 1.63 date 2002.12.16.16.05.57; author ms; state Exp; branches; next 1.62; 1.62 date 2002.12.16.10.45.25; author ms; state Exp; branches; next 1.61; 1.61 date 2002.12.13.23.42.37; author ms; state Exp; branches; next 1.60; 1.60 date 2002.12.13.21.25.32; author ms; state Exp; branches; next 1.59; 1.59 date 2002.12.13.20.50.18; author ms; state Exp; branches; next 1.58; 1.58 date 2002.12.13.18.55.09; author ms; state Exp; branches; next 1.57; 1.57 date 2002.12.13.17.44.42; author ms; state Exp; branches; next 1.56; 1.56 date 2002.12.13.11.46.38; author ms; state Exp; branches; next 1.55; 1.55 date 2002.12.12.21.13.29; author ms; state Exp; branches; next 1.54; 1.54 date 2002.12.12.20.52.13; author ms; state Exp; branches; next 1.53; 1.53 date 2002.12.12.16.18.54; author ms; state Exp; branches; next 1.52; 1.52 date 2002.12.12.13.27.22; author ms; state Exp; branches; next 1.51; 1.51 date 2002.12.12.13.20.43; author ms; state Exp; branches; next 1.50; 1.50 date 2002.12.12.12.45.46; author ms; state Exp; branches; next 1.49; 1.49 date 2002.12.12.12.19.48; author ms; state Exp; branches; next 1.48; 1.48 date 2002.12.11.17.15.35; author ms; state Exp; branches; next 1.47; 1.47 date 2002.12.11.16.00.47; author ms; state Exp; branches; next 1.46; 1.46 date 2002.12.10.14.23.58; author ms; state Exp; branches; next 1.45; 1.45 date 2002.12.10.12.06.56; author ms; state Exp; branches; next 1.44; 1.44 date 2002.12.10.00.00.57; author ms; state Exp; branches; next 1.43; 1.43 date 2002.12.05.18.03.53; author ms; state Exp; branches; next 1.42; 1.42 date 2002.12.05.16.08.21; author ms; state Exp; branches; next 1.41; 1.41 date 2002.12.05.14.51.29; author ms; state Exp; branches; next 1.40; 1.40 date 2002.12.04.23.22.52; author ms; state Exp; branches; next 1.39; 1.39 date 2002.12.04.21.35.55; author ms; state Exp; branches; next 1.38; 1.38 date 2002.12.04.21.31.26; author ms; state Exp; branches; next 1.37; 1.37 date 2002.12.04.21.03.16; author ms; state Exp; branches; next 1.36; 1.36 date 2002.12.04.20.30.54; author ms; state Exp; branches; next 1.35; 1.35 date 2002.12.04.18.56.59; author ms; state Exp; branches; next 1.34; 1.34 date 2002.12.04.14.50.08; author ms; state Exp; branches; next 1.33; 1.33 date 2002.12.04.11.34.08; author ms; state Exp; branches; next 1.32; 1.32 date 2002.12.03.19.07.55; author ms; state Exp; branches; next 1.31; 1.31 date 2002.12.03.17.05.11; author ms; state Exp; branches; next 1.30; 1.30 date 2002.12.02.18.10.19; author ms; state Exp; branches; next 1.29; 1.29 date 2002.12.02.13.25.36; author ms; state Exp; branches; next 1.28; 1.28 date 2002.11.28.20.44.36; author ms; state Exp; branches; next 1.27; 1.27 date 2002.11.28.10.31.33; author ms; state Exp; branches; next 1.26; 1.26 date 2002.11.27.23.07.38; author ms; state Exp; branches; next 1.25; 1.25 date 2002.11.27.22.44.48; author ms; state Exp; branches; next 1.24; 1.24 date 2002.11.27.18.40.15; author ms; state Exp; branches; next 1.23; 1.23 date 2002.11.26.23.26.07; author ms; state Exp; branches; next 1.22; 1.22 date 2002.11.26.22.22.53; author ms; state Exp; branches; next 1.21; 1.21 date 2002.11.26.21.18.48; author ms; state Exp; branches; next 1.20; 1.20 date 2002.11.26.20.38.19; author ms; state Exp; branches; next 1.19; 1.19 date 2002.11.26.20.25.16; author ms; state Exp; branches; next 1.18; 1.18 date 2002.11.26.19.33.37; author ms; state Exp; branches; next 1.17; 1.17 date 2002.11.26.19.09.58; author ms; state Exp; branches; next 1.16; 1.16 date 2002.11.26.17.34.02; author ms; state Exp; branches; next 1.15; 1.15 date 2002.11.26.17.23.51; author ms; state Exp; branches; next 1.14; 1.14 date 2002.11.26.14.10.32; author ms; state Exp; branches; next 1.13; 1.13 date 2002.11.25.15.45.06; author ms; state Exp; branches; next 1.12; 1.12 date 2002.11.25.11.40.07; author ms; state Exp; branches; next 1.11; 1.11 date 2002.11.24.23.11.56; author ms; state Exp; branches; next 1.10; 1.10 date 2002.11.22.21.51.58; author ms; state Exp; branches; next 1.9; 1.9 date 2002.11.22.21.14.27; author ms; state Exp; branches; next 1.8; 1.8 date 2002.11.22.19.42.25; author ms; state Exp; branches; next 1.7; 1.7 date 2002.11.22.11.46.32; author ms; state Exp; branches; next 1.6; 1.6 date 2002.11.21.15.37.08; author ms; state Exp; branches; next 1.5; 1.5 date 2002.11.20.11.06.32; author ms; state Exp; branches; next 1.4; 1.4 date 2002.11.19.20.29.08; author ms; state Exp; branches; next 1.3; 1.3 date 2002.11.19.19.42.14; author ms; state Exp; branches; next 1.2; 1.2 date 2002.11.19.08.17.44; author ms; state Exp; branches; next 1.1; 1.1 date 2002.11.18.22.38.04; author ms; state Exp; branches; next ; desc @@ 1.145 log @Replace read only attribute reset to endEdit() to fix in place edition bug (causing in place edition to totally fail). @ text @// // OSSP asgui - Accounting system graphical user interface // Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/) // Copyright (c) 2002-2004 Ralf S. Engelschall // Copyright (c) 2002-2004 Michael Schloh von Bennewitz // Copyright (c) 2002-2004 Cable & Wireless Telecommunications Services GmbH // // This file is part of OSSP asgui, an accounting system graphical user // interface which can be found at http://www.ossp.org/pkg/tool/asgui/. // // Permission to use, copy, modify, and distribute this software for // any purpose with or without fee is hereby granted, provided that // the above copyright notice and this permission notice appear in all // copies. // // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF // USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. // // as_slot.cpp: ISO C++ implementation // // system headers #include #include // Qt headers #include #include #include #include #include #include #include #include // Qt style headers #include #include #include #include #include #include // User interface #include "as_const.h" // Application constants #include "as_except.h" // Exception classes #include "as_tableitem.h" // For our custom table items #include "as_generic.h" // Generic classes #include "as_uuid.h" // UUID classes #include "as_datedit.h" // Derived from QDateEdit #include "as_amount.h" // Derived from QTimeEdit #include "as_crc.h" // Useful Qualistring class #include "as_pref.h" // For Preferences class #include "as_panel.h" // For Prefpanel class #include "as_reportpanel.h" // For Reportpanel class #include "as_helpanel.h" // For Helpanel class #include "as_sfile.h" // For Simplefile class #include "as_table.h" // For TiTable class // RPC headers #ifdef HAVE_ESOAP #include #endif // HAVE_ESOAP #ifdef HAVE_MICO #include #include "as_stub.h" // CORBA stubs and skeletons #endif // HAVE_MICO // Icon pixel maps #include "as_gfx/cwlogo.xpm" // static const char *s_kpcCwlogo_xpm[] #include "as_gfx/ossplogo.xpm" // static const char *s_kpcOssplogo_xpm[] #include "as_gfx/statok.xpm" // static const char *s_kpcStatokay_xpm[] #include "as_gfx/staterr.xpm" // static const char *s_kpcStaterror_xpm[] #include "as_gfx/statwrn.xpm" // static const char *s_kpcStatwarn_xpm[] #include "as_gfx/statvoid.xpm" // static const char *s_kpcStatvoid_xpm[] // // Cut an entry // void Titraqform::cutEntry(void) { this->copyEntry(); // Reuse slot this->delEntry(); // Reuse slot } // // Copy an entry // void Titraqform::copyEntry(void) { QString Selection; // Will hold the selected text QClipboard *pClip; // Will reference the global clipboard // Initialize data and clipboard handle Selection = getRowdata(); // Use accessor pClip = QApplication::clipboard(); Q_ASSERT(!Selection.isNull()); pClip->setText(Selection, QClipboard::Selection); // Doesn't work on Windows pClip->setText(Selection, QClipboard::Clipboard); // Works on both equally } // // Paste an entry // void Titraqform::pasteEntry(void) { int nRows = 0; // Paste so many rows as are stored QString Selection; // Will receive the clipboard text QClipboard *pClip = NULL; // Will reference the global clipboard pClip = QApplication::clipboard(); // Prime the clips Selection = pClip->text(QClipboard::Clipboard); // Windows and Unix nRows = Selection.contains(QChar('\n')); // How many rows if (Selection != NULL && nRows > 0) { // Ignore empty clipboards this->addEntry(nRows); // Reuse slot setRowdata(Selection); // Use accessor // Update line numbers for this new row and all subsequent rows for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++) m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0'))); // Do basic data validation to warn against missing fields for (int nIter = 0; nIter < nRows; nIter++) this->validateRow(m_pMaintable->currentRow() + nIter, 0); m_pStatbar->message(QString::number(nRows) + trUtf8(" rows pasted"), 4000); updEdit(m_pMaintable->currentRow()); // Reflect in the update controls } else // Well, I guess the user tried to paste an empty clipboard m_pStatbar->message(trUtf8("The clipboard is empty"), 4000); } // // Append a blank row entry // void Titraqform::addEntry(int nRows) { QTableSelection Select; // Highlighted text int nTotal = 0; // Total row select int nCurrent = 0; // Current row std::auto_ptr pGuid(new AS::Uuid); // For GUID production // Decide how many rows to add Select = m_pMaintable->selection(0); if (nRows > 0) nTotal = nRows; else nTotal = Select.bottomRow() - Select.topRow() + 1; // Optimize viewing by repainting cells only once after processing m_pMaintable->setUpdatesEnabled(false); // Add a row after selection and focus to the new row if (Select.bottomRow() + 1 != m_pMaintable->numRows()) { // Add upwards m_pMaintable->insertRows(Select.topRow(), nTotal); m_pMaintable->setDirty(); // Set data to dirty state m_pMaintable->setCurrentCell(Select.topRow(), m_pMaintable->currentColumn()); // According to Trolltech, insertRows() "clears the selection(s)". // They are pretty wrong about that, so unfortunately we'll have to // take care of the dirty work ourselves with a clearSelection(). m_pMaintable->clearSelection(false); m_pMaintable->selectRow(m_pMaintable->currentRow()); // Update relevant data fields for all new rows for (int nIter = 0; nIter < nTotal; nIter++) { m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W'))); m_pMaintable->setPixmap(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm)); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); pGuid->genId(); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, pGuid->getString()); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "0"); // 0 = invalid entry m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "0"); // Entry not revised m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTART, "00:00"); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXFINISH, "00:00"); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXAMOUNT, "00:00"); // m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXTASK, "/"); // m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREMARK, "Remark"); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "1"); // 0 = invalid entry this->calcCrc(Select.topRow() + nIter, -1); } } else { // Special case on last row add downwards m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal); m_pMaintable->setDirty(); // Set data to dirty state m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn()); // According to Trolltech, insertRows() "clears the selection(s)". // They are pretty wrong about that, so unfortunately we'll have to // take care of the dirty work ourselves with a clearSelection(). m_pMaintable->clearSelection(false); m_pMaintable->selectRow(m_pMaintable->currentRow()); // Update relevant data fields for all new rows for (int nIter = 1; nIter <= nTotal; nIter++) { m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W'))); m_pMaintable->setPixmap(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm)); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); pGuid->genId(); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, pGuid->getString()); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, "0"); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, "0"); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTART, "00:00"); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXFINISH, "00:00"); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXAMOUNT, "00:00"); // m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXTASK, "/"); // m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREMARK, "Remark"); this->calcCrc(Select.bottomRow() + nIter, -1); } } // Update line numbers for this new row and all subsequent rows for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++) m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0'))); updEdit(m_pMaintable->currentRow()); // Reflect in the update controls m_pStatusedit->setPixmap(QPixmap(s_kpcStatwarn_xpm)); // Show pixmap m_pMaintable->setUpdatesEnabled(true); // Turn updates back on m_pMaintable->repaintContents(true); // Do a general repaint of table m_pMaintable->ensureCellVisible(m_pMaintable->currentRow() + nTotal - 1, m_pMaintable->currentColumn()); m_pMaintable->ensureCellVisible(m_pMaintable->currentRow(), m_pMaintable->currentColumn()); // In case we added the first and only row entry, // do post state adjustments like icon undimming if (m_pMaintable->numRows() == 1) { m_pDelrowact->setEnabled(true); m_pRefreshact->setEnabled(true); m_pCutact->setEnabled(true); m_pCopyact->setEnabled(true); // Brighten all the edit controls also m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); // And optionally the RPC actions, too #if defined HAVE_MICO || defined HAVE_ESOAP m_pSyncact->setEnabled(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON) | m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON)); #endif // HAVE_MICO || defined HAVE_ESOAP } } // // Delete a row entry // void Titraqform::delEntry(int nRows) { QTableSelection Select = m_pMaintable->selection(0); // Highlighted text int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total row select QMemArray Rowselect(nTotal); // Row array // Calculate rows to delete from selection highlight for (int nIter = 0; nIter < nTotal; ++nIter) Rowselect[nIter] = Select.topRow() + nIter; // Remove the row at selection and focus to the next row if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) { m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn()); m_pMaintable->removeRows(Rowselect); m_pMaintable->setDirty(); // Set data to dirty state } else { // Special case to handle removing of only row or last row m_pMaintable->removeRows(Rowselect); m_pMaintable->setDirty(); // Set data to dirty state } // Update line numbers for this new row and all subsequent rows for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++) m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter)); // In case we removed the last remaining row, // do post state adjustments like icon dimming if (m_pMaintable->numRows() <= 0) { m_pDelrowact->setEnabled(false); m_pRefreshact->setEnabled(false); m_pCutact->setEnabled(false); m_pCopyact->setEnabled(false); // Dim all the edit controls also m_pStatusedit->setPixmap(s_kpcStatvoid_xpm); m_pLineedit->setEnabled(false); m_pUseredit->setEnabled(false); m_pGuidedit->setEnabled(false); m_pCrcedit->setEnabled(false); m_pRevedit->setEnabled(false); m_pDateedit->setEnabled(false); m_pStarttime->setEnabled(false); m_pEndtime->setEnabled(false); m_pAmount->setEnabled(false); m_pTasks->setEnabled(false); m_pRemark->setEnabled(false); // And optionally dim the RPC actions #if defined HAVE_MICO || defined HAVE_ESOAP m_pSyncact->setEnabled(false); #endif // HAVE_MICO || defined HAVE_ESOAP } } // // Refresh the display of all data items // void Titraqform::refreshDisplay(void) { int nIter = 0; // Matrix iterator int nRows = m_pMaintable->numRows(); // Total number of rows // Sweep through matrix validating linewise // data and updating line numbers for all rows while (nIter < nRows) { this->validateRow(nIter, 0); m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter).rightJustify(4, QChar('0'))); nIter++; } m_pMaintable->repaintContents(false); // Do a general repaint of table m_pStatbar->message(trUtf8("Display was refreshed"), 4000); // Announce result } // // Make and display a new document window // void Titraqform::newDoc(void) { int nResult = 0; // Holds return value from save first messagebox // Check modification state of current data if (m_pMaintable->isDirty()) { nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { case 0: // First button selected, so save first this->saveFile(); // Save changes first break; case 1: // Second button selected, so don't save break; case 2: // Third button selected, so return sofort default: m_pStatbar->message(trUtf8("New aborted"), 4000); return; break; } } if (!m_pMaintable->isDirty() || nResult == 1) { // Check modification state // Fall through to implicit new doc code this->setCaption(trUtf8("No file name")); m_pStatbar->message(trUtf8("New document"), 4000); this->enableIface(true); // Enable the interface m_pMaintable->setNumRows(0); // Remove all data in table this->setFilename(""); // Signal a closed doc state this->addEntry(1); // Default new op adds a row m_pMaintable->setDirty(false); // Start out clean } } // // Open and display an existing document // void Titraqform::openDoc(void) { int nResult = 0; // Holds return value from save first messagebox // // This block will guide the user to saving the contents of the timesheet // before losing them in an open operation. The question and dialog box will // not be raised if no open timesheet exists or if it was just serialized. // if (m_pMaintable->isDirty()) { // Check modification state nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { case 0: // Save first this->saveFile(); // Save changes first break; case 1: // Don't save first but do load break; case 2: // Don't do a load timesheet default: m_pStatbar->message(trUtf8("Loading aborted"), 4000); return; break; } } // // This block ensures that conditions of first block logic were met if // applicable. If so, the user gives a file name to open or cancels the // operation. The corresponding file will be opened, and if this is // unsuccessful then the post state is exactly the same as the pre state. // if (!m_pMaintable->isDirty() || nResult == 1) { // Check modification state // Make sure we correctly get the name of the default file to open QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); // This dialog asks which file the user wants to open 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); // We might have a filename to work on, so do something with it if (!Filestring.isEmpty()) { QFile Filetemp(Filestring); // File to load try { if (Filetemp.exists() && validateData(Filetemp)) { // Be extra sure setFilename(Filestring); // Set the new file name m_pMaintable->setNumRows(0); // Clear out old data m_pMaintable->setDirty(false); // Reset dirty flag loadData(Filetemp); // Pass to helper method this->setCaption(Filestring); // Caption in the titlebar m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); this->enableIface(true); // Turn on the lights this->setOpen(true); // Indicate doc is open } } catch (Genexcept& Genex) { // Crap, we failed m_pStatbar->message(trUtf8("Loading failed"), 4000); Genex.reportErr(); return; } } else // An empty filename returning from the file dialog means cancel m_pStatbar->message(trUtf8("Loading aborted"), 4000); } } // // Serialize current state to the current file // void Titraqform::saveFile(void) { QString Fname; Simplefile Filevents; try { Fname = *this->getFilename(); // First time saves are really just saveName in disguise if (Fname.isEmpty()) { try { this->saveName(); // Try to 'save as' return; // and short circuit } catch (Genexcept& Genex) { // Genex.reportErr(); // Report the error return; // and short circuit } } Filevents.setName(Fname); // Construct a file to write if (m_pPrefs->getBool(TITRAQ_PREFBAKON, TITRAQ_DEFBAKON)) Filevents.makeBackup(); // Back up to filename.bak this->saveData(Filevents); // Pass to helper method } catch (Genexcept& Genex) { Genex.reportErr(); } // Reset and give output to main window this->setCaption(Fname); m_pStatbar->message(trUtf8("File %1 saved").arg(Fname), 4000); m_pMaintable->setDirty(false); // Set the clean state to allow close } // // Serialize current state to a selected file // void Titraqform::saveAs(void) { int nResult = 0; // For checking user's answer // Make sure we correctly get the name of the default file to open QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); 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, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); switch (nResult) { case 0: // Overwrite contents this->setFilename(Filestring); this->saveFile(); break; case 1: // Don't overwrite default: break; } } else { // 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 } } else // User did not select a valid file and push okay button m_pStatbar->message(trUtf8("Saving aborted"), 4000); } // // Implicitly serialize current state to a selected file // The main difference with saveAs is that this uses exceptions // void Titraqform::saveName(void) { int nResult = 0; // For checking user's answer // Make sure we correctly get the name of the default file to open QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); 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); if (!Filestring.isEmpty()) { if (QFile::exists(Filestring)) { nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); switch (nResult) { case 0: // Overwrite contents this->setFilename(Filestring); this->saveFile(); break; case 1: // Don't overwrite default: break; } } else { // 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 } } else { // User did not select a valid file and push okay button m_pStatbar->message(trUtf8("Saving aborted"), 4000); throw Genexcept(TITRAQ_SAVECANCELLED); } } } // // Close current document, and then quit the application // void Titraqform::quitApp(void) { int nResult = 0; if (m_pMaintable->isDirty()) { nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { // Maybe save before closing case 0: // Save first this->saveFile(); // Save changes first break; case 1: // Don't save first m_pMaintable->setDirty(false); break; case 2: // Do nothing default: return; // Go away without closing break; } } // We should be clean now, but double check just in case if (!m_pMaintable->isDirty()) qApp->quit(); } // // Close current document, displaying in main window // void Titraqform::closeEvent(QCloseEvent *pClosit) { int nResult = 0; if (!this->isOpen()) // Short circuit if user qApp->quit(); // selects close twice // Check modification state of current data if (m_pMaintable->isDirty()) { nResult = QMessageBox::information(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short, trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { // Maybe save before closing case 0: // Save first this->saveFile(); // Save changes first break; case 1: // Don't save first m_pMaintable->setDirty(false); break; case 2: // Do nothing default: pClosit->ignore(); return; // Go away without closing break; } } if (!m_pMaintable->isDirty()) { // Check again // Fall through to implicit close code this->setCaption(QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short); try { // There might be problems, so wrap these last ops with error handling QString Lightsout; // It's late, go to bed if (this->isOpen()) Lightsout = trUtf8("Closed document ") + *this->getFilename(); this->setOpen(false); // Set doc state to closed this->enableIface(false); // Turn off the lights m_pStatbar->message(Lightsout, 4000); } catch (Genexcept& Genex) { Genex.reportErr(); } } pClosit->ignore(); // Finish off by not closing } // // Edit menu select all entries // void Titraqform::selAll(void) { Prototype Unimp; Unimp.doMbox(); } // // Edit a table entry in place, without the usual edit controls // void Titraqform::inplaceEdit(int nRow, int nCol, int nButton, const QPoint &Mousepos) { // Table read only attribute must be reset here, so that editing can take // place. Otherwise calls to editCell are ignored (for obvious reasons). m_pMaintable->setReadOnly(false); // After editCell() is called, beginEdit() and endEdit() execute. The read // only attribute is reset in endEdit() to return everything to normal. m_pMaintable->editCell(nRow, nCol); m_pMaintable->setEdition(nCol); } // // Update the edit controls widget sizes // void Titraqform::updSizes(int nSection, int nOldsize, int nNewsize) { switch (nSection) { case TITRAQ_IDXALLCTRLS: if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTATUS) > 0) m_pStatusedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTATUS) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXLINE) > 0) m_pLineedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXLINE) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) > 0) m_pUseredit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXGUID) > 0) m_pGuidedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXGUID) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXCRC) > 0) m_pCrcedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXCRC) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREV) > 0) m_pRevedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREV) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) > 0) m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) > 0) m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) > 0) m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) > 0) m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING); if (m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) > 0) m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING); // if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXRCOL))) // m_pRemark->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREMARK) - TITRAQ_SPACING); break; case TITRAQ_IDXSTATUS: m_pStatusedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTATUS) - TITRAQ_SPACING); break; case TITRAQ_IDXLINE: m_pLineedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXLINE) - TITRAQ_SPACING); break; case TITRAQ_IDXUSER: m_pUseredit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) - TITRAQ_SPACING); break; case TITRAQ_IDXGUID: m_pGuidedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXGUID) - TITRAQ_SPACING); break; case TITRAQ_IDXCRC: m_pCrcedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXCRC) - TITRAQ_SPACING); break; case TITRAQ_IDXREV: m_pRevedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREV) - TITRAQ_SPACING); break; case TITRAQ_IDXDATE: m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING); break; case TITRAQ_IDXSTART: m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING); break; case TITRAQ_IDXFINISH: m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING); break; case TITRAQ_IDXAMOUNT: m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING); break; case TITRAQ_IDXTASK: m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING); break; case TITRAQ_IDXREMARK: // m_pRemark->setFixedWidth(nNewsize); break; default: throw Genexcept("Unrecognized main window column header."); break; } // As a last and redundant step, adjust size of first visible control switch(this->getFirstcol()) { case TITRAQ_IDXSTATUS: m_pStatusedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTATUS) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXLINE: m_pLineedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXLINE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXUSER: m_pUseredit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXGUID: m_pGuidedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXGUID) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXCRC: m_pCrcedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXCRC) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXREV: m_pRevedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREV) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXDATE: m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXSTART: m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXFINISH: m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXAMOUNT: m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXTASK: m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; default: // Probably no columns are visible? break; } } // // What to do if a data cell is modified // void Titraqform::dataChanged(int nRow, int nCol) { if (nCol != TITRAQ_IDXSTATUS && nCol != TITRAQ_IDXLINE) m_pMaintable->setDirty(); // Mark this timesheet dirty, changes pending save } // // Convenience member calculates CRC for current row // void Titraqform::calcCrc(void) { this->calcCrc(-1, -1); } // // Calculates CRC for the specified row, fires when data is changed // void Titraqform::calcCrc(int nRow, int nCol) { if (nCol != TITRAQ_IDXSTATUS && nCol != TITRAQ_IDXLINE \ && m_pMaintable->numRows() > 0) { U32 Testcrc, Valcrc; QString Crcstr; std::auto_ptrpWholerow(new Qualistring); int nRealrow = -1; // Build the data that will be used in testing CRC calculation nRealrow = (nRow >= 0) ? nRow : m_pMaintable->currentRow(); *pWholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER); for (int nIter = TITRAQ_IDXUSER + 1; nIter < TITRAQ_IDXTAIL; nIter++) if (nIter != TITRAQ_IDXCRC) // Don't checksum the checksum! *pWholerow += m_pMaintable->text(nRealrow, nIter); // Update the checksum and revision only if necessary Testcrc = pWholerow->getCrc(); // FIXME: This thing is not very unportable, because toUInt != U32 if (Testcrc != m_pMaintable->text(nRealrow, TITRAQ_IDXCRC).toUInt()) { // // Bump the revision number of our entry to control conflicts // nNewrev = m_pMaintable->text(nRealrow, TITRAQ_IDXREV).toInt() + 1; // m_pMaintable->setText(nRealrow, TITRAQ_IDXREV, QString::number(nNewrev)); // Build the data that will be used in setting CRC calculation *pWholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER); for (int nIter = TITRAQ_IDXUSER + 1; nIter < TITRAQ_IDXTAIL; nIter++) if (nIter != TITRAQ_IDXCRC) // Don't checksum the checksum! *pWholerow += m_pMaintable->text(nRealrow, nIter); Valcrc = pWholerow->getCrc(); // Finally set the checksum to its new value Crcstr = QString::number(Valcrc, 16).rightJustify(8, '0'); m_pMaintable->setText(nRealrow, TITRAQ_IDXCRC, "0x" + Crcstr); m_pCrcedit->setText("0x" + Crcstr); } } } // // Gets a hit on every table click // void Titraqform::onClick(int nRow, int nCol, int nButton, const QPoint &Mousepos) { // Give the clueless user some hints when clicking an empty timesheet if (m_pMaintable->numRows() <= 0) m_pStatbar->message(trUtf8("Empty timesheet, add entries first please"), 2000); } // // Update the edit controls contents // void Titraqform::updEdit(int nRow, int nCol) { // Why is the app sending negative row signal? I don't know yet, // so add in this nasty hack to fend off the debug spew on stderr if (m_pMaintable->numRows() > 0 && nRow >= 0) { // Field strings to check for validity and process QString Textline(m_pMaintable->text(nRow, TITRAQ_IDXLINE)); QString Textuser(m_pMaintable->text(nRow, TITRAQ_IDXUSER)); QString Textguid(m_pMaintable->text(nRow, TITRAQ_IDXGUID)); QString Textcrc(m_pMaintable->text(nRow, TITRAQ_IDXCRC)); QString Textrev(m_pMaintable->text(nRow, TITRAQ_IDXREV)); QString Textdate(m_pMaintable->text(nRow, TITRAQ_IDXDATE)); QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXSTART)); QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXFINISH)); QString Textamount(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); QString Texttask(m_pMaintable->text(nRow, TITRAQ_IDXTASK)); QString Textremark(m_pMaintable->text(nRow, TITRAQ_IDXREMARK)); // Reset the edition state member m_pMaintable->setEdition(); // Set text of member edit controls if (m_pMaintable->text(nRow, TITRAQ_IDXSTATUS).isEmpty()) // If row is empty m_pStatusedit->setPixmap(s_kpcStatvoid_xpm); // add a placeholder else m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); m_pLineedit->setText(Textline); m_pUseredit->setText(Textuser); m_pGuidedit->setText(Textguid); m_pCrcedit->setText(Textcrc); m_pRevedit->setText(Textrev); // QRegExp Shorten("/(\\w+)$"); // For stripping prefix off the current task // Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash m_pRemark->setText(Textremark); m_pTasks->setCurrentText(Texttask); // Date field not suitable for empty string text if (Textdate == ".") m_pDateedit->setDate(QDate::currentDate()); else if (Textdate.isEmpty()) m_pDateedit->setDate(QDate::fromString("0000-00-00", Qt::ISODate)); else m_pDateedit->setDate(QDate::fromString(Textdate, Qt::ISODate)); // Start time not suitable for empty string text if (Textstart == ".") m_pStarttime->setTime(QTime::currentTime()); else if (Textstart.isEmpty()) m_pStarttime->setTime(QTime::QTime(0, 0)); else m_pStarttime->setTime(QTime::fromString(Textstart, Qt::ISODate)); // Finish time not suitable for empty string text if (Textfinish == ".") m_pEndtime->setTime(QTime::currentTime()); else if (Textfinish.isEmpty()) m_pEndtime->setTime(QTime::QTime(0, 0)); else m_pEndtime->setTime(QTime::fromString(Textfinish, Qt::ISODate)); // Amount time not suitable for empty string text if (Textamount == ".") { int nDifference = m_pStarttime->time().secsTo(m_pEndtime->time()); m_pAmount->setTime(QTime(0, 0).addSecs(nDifference)); } else if (Textamount.isEmpty()) m_pAmount->setTime(QTime::QTime(0, 0)); else m_pAmount->setTime(QTime::fromString(Textamount, Qt::ISODate)); } } // // Validate current row of the matrix // void Titraqform::validateRow(void) { this->validateRow(-1, -1); } // // Validate specified row of the matrix // void Titraqform::validateRow(int nRow, int nCol) { int nRealrow = -1; if (!this->isOpen()) { // If no data is loaded then short circuit m_pStatbar->message(trUtf8("Timesheet contains no data"), 4000); return; } nRealrow = (nRow >= 0) ? nRow : m_pMaintable->currentRow(); QString Statis = m_pMaintable->text(nRealrow, TITRAQ_IDXSTATUS); // Get text // Review whole data validity, and set pixmap accordingly if (m_pMaintable->text(nRealrow, TITRAQ_IDXUSER).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXGUID).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXCRC).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXREV).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXDATE).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXSTART).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXAMOUNT).isEmpty() || m_pMaintable->text(nRealrow, TITRAQ_IDXTASK).isEmpty()) { // No K&R style to show where actual code begins if (Statis.startsWith(QString("W"))) { // Conditionally set pixmap to avoid overhead // FIXME: Next line commented out, and I see that this algorythm needs help // m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRealrow, TITRAQ_IDXSTATUS)); } else if (!Statis.startsWith(QString("E"))) { // Conditionally set pixmap to avoid overhead m_pMaintable->setText(nRealrow, TITRAQ_IDXSTATUS, Statis.replace(TITRAQ_IDXSTATERROR, sizeof(char), 'E')); m_pMaintable->setPixmap(nRealrow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm)); m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRealrow, TITRAQ_IDXSTATUS)); } } else { if (!Statis.startsWith(QString("O"))) { // Conditionally set pixmap to avoid overhead m_pMaintable->setText(nRealrow, TITRAQ_IDXSTATUS, Statis.replace(TITRAQ_IDXSTATERROR, sizeof(char), 'O')); m_pMaintable->setPixmap(nRealrow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm)); m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRealrow, TITRAQ_IDXSTATUS)); } } // Test for blank user field, and set to default if so if (m_pMaintable->text(nRealrow, TITRAQ_IDXUSER).isEmpty()) m_pMaintable->setText(nRealrow, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); // Test for blank date field, and set to default if so if (m_pMaintable->text(nRealrow, TITRAQ_IDXDATE) == ".") m_pMaintable->setText(nRealrow, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); // Test for blank start field, and set to default if so if (m_pMaintable->text(nRealrow, TITRAQ_IDXSTART) == ".") m_pMaintable->setText(nRealrow, TITRAQ_IDXSTART, QTime::currentTime().toString("hh:mm")); // Test for blank finish field, and set to default if so if (m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH) == ".") m_pMaintable->setText(nRealrow, TITRAQ_IDXFINISH, QTime::currentTime().toString("hh:mm")); // Test for blank amount field, and set to default if so if (m_pMaintable->text(nRealrow, TITRAQ_IDXAMOUNT) == ".") { QTime Begin = QTime::fromString(m_pMaintable->text(nRealrow, TITRAQ_IDXSTART), Qt::ISODate); QTime End = QTime::fromString(m_pMaintable->text(nRealrow, TITRAQ_IDXFINISH), Qt::ISODate); QString Diff = QTime(0, 0).addSecs(Begin.secsTo(End)).toString("hh:mm"); m_pMaintable->setText(nRealrow, TITRAQ_IDXAMOUNT, Diff); } } // // Update the current line number column item // void Titraqform::updateLine(const QString &Instring) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXLINE, Instring); } // // Update the current user column item // void Titraqform::updateUser(const QString &Instring) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXUSER, Instring); } // // Update the current GUID column item // void Titraqform::updateGuid(const QString &Instring) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXGUID, Instring); } // // Update the current CRC column item // void Titraqform::updateCrc(const QString &Instring) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXCRC, Instring); } // // Update the current rev column item // void Titraqform::updateRev(const QString &Instring) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXREV, Instring); } // // Update the current date column item // void Titraqform::updateDate(const QDate &Dateup) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, Dateup.toString(Qt::ISODate)); } // // Update the current start column item // void Titraqform::updateStart(const QTime &Startup) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXSTART, Startup.toString("hh:mm")); } // // Update the current finish column item // void Titraqform::updateFinish(const QTime &Finishup) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXFINISH, Finishup.toString("hh:mm")); } // // Update the current amount column item // void Titraqform::updateAmount(const QTime &Amountup) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXAMOUNT, Amountup.toString("hh:mm")); } // // Update the current task column item // void Titraqform::updateTask(const QString &Taskup) { // // FIXME: Broken // RtTableItem *pTask = NULL; // pTask = static_cast(m_pMaintable->item(m_pMaintable->currentRow(), TITRAQ_IDXTASK)); // pTask->setText(Taskup); // Don't try to use the Taskup string, because it ignores autocompletion m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXTASK, m_pTasks->currentText()); } // // Update the current remark column item // void Titraqform::updateRemark(const QString &Remarkup) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXREMARK, Remarkup); } // // Confirm any recent editions on a whole row // void Titraqform::confirmEdit(void) { RtTableItem *pTask = NULL; // Task item is a derived class // Conversions from edit control data formats to native tabular format m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, m_pDateedit->date().toString(Qt::ISODate)); m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXSTART, m_pStarttime->time().toString(Qt::ISODate)); m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXFINISH, m_pEndtime->time().toString(Qt::ISODate)); m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXAMOUNT, m_pAmount->time().toString(Qt::ISODate)); // Specially handle task fields pTask = static_cast(m_pMaintable->item(m_pMaintable->currentRow(), TITRAQ_IDXTASK)); pTask->setText(m_pTasks->currentText()); m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXREMARK, m_pRemark->text()); } // // Edit menu configure preferences // void Titraqform::configPrefs(void) { QString Templine; // Used for preferences resetting Prefpanel *pUserpanel = NULL; // The user preferences panel itself // Create a new preferences panel window pUserpanel = new Prefpanel(this, "Userprefpanel"); connect(pUserpanel, SIGNAL(applied(void)), SLOT(applyPrefs(void))); // Set default values to appear in initialized panel widgets pUserpanel->setAccounts(m_pPrefs->getString(TITRAQ_PREFACCOUNTS, TITRAQ_DEFACCOUNTS)); pUserpanel->setEvents(m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR)); pUserpanel->setUser(m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); pUserpanel->setHome(m_pPrefs->getString(TITRAQ_PREFHOME, TITRAQ_DEFHOME)); pUserpanel->setCorbahost(m_pPrefs->getString(TITRAQ_PREFCORBHOST, TITRAQ_DEFCORBHOST)); pUserpanel->setSoaphost(m_pPrefs->getString(TITRAQ_PREFSOAPHOST, TITRAQ_DEFSOAPHOST)); #ifdef HAVE_MICO pUserpanel->setCorbaon(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON)); #else pUserpanel->setCorbaon(false); pUserpanel->lockCorba(); #endif #ifdef HAVE_ESOAP pUserpanel->setSoapon(m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON)); #else pUserpanel->setSoapon(false); pUserpanel->lockSoap(); #endif pUserpanel->setBackon(m_pPrefs->getBool(TITRAQ_PREFBAKON, TITRAQ_DEFBAKON)); pUserpanel->setExtendon(m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON)); pUserpanel->setDetailon(m_pPrefs->getBool(TITRAQ_PREFDETAILON, TITRAQ_DEFDETAILON)); pUserpanel->setSignaton(m_pPrefs->getBool(TITRAQ_PREFSIGNATON, TITRAQ_DEFSIGNATON)); // Set default style which can be more complicated due to mapping... switch (m_pPrefs->getNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE)) { case TITRAQ_STYLECDE: pUserpanel->setStyle(TITRAQ_STRCDE); break; case TITRAQ_STYLESGI: pUserpanel->setStyle(TITRAQ_STRSGI); break; case TITRAQ_STYLEMOTIF: pUserpanel->setStyle(TITRAQ_STRMOTIF); break; case TITRAQ_STYLEMPLUS: pUserpanel->setStyle(TITRAQ_STRMPLUS); break; case TITRAQ_STYLEPLAT: pUserpanel->setStyle(TITRAQ_STRPLAT); break; case TITRAQ_STYLEMSOFT: pUserpanel->setStyle(TITRAQ_STRMSOFT); break; default: pUserpanel->setStyle(TITRAQ_STRCDE); // My personal favourite ;-) break; } // Colour preferences int nRed, nGreen, nBlue; QColorGroup Origcolour, Altcolour; const QColor Origlight = QColor(TITRAQ_DEFLIGHTRED, TITRAQ_DEFLIGHTGREEN, TITRAQ_DEFLIGHTBLUE); const QColor Origdark = QColor(TITRAQ_DEFDARKRED, TITRAQ_DEFDARKGREEN, TITRAQ_DEFDARKBLUE); const QColor Altlight = QColor(TITRAQ_DEFLTALTRED, TITRAQ_DEFLTALTGREEN, TITRAQ_DEFLTALTBLUE); const QColor Altdark = QColor(TITRAQ_DEFDKALTRED, TITRAQ_DEFDKALTGREEN, TITRAQ_DEFDKALTBLUE); // Set colours to revert to if user screws up and wants out Origcolour.setColor(QColorGroup::Foreground, Origlight); Origcolour.setColor(QColorGroup::Background, Origdark); pUserpanel->setOrigcolour(&Origcolour); Altcolour.setColor(QColorGroup::Foreground, Altlight); Altcolour.setColor(QColorGroup::Background, Altdark); pUserpanel->setAltcolour(&Altcolour); // Set colour preferences saved from last session nRed = m_pPrefs->getNumber(TITRAQ_PREFLIGHTRED, TITRAQ_DEFLIGHTRED); nGreen = m_pPrefs->getNumber(TITRAQ_PREFLIGHTGREEN, TITRAQ_DEFLIGHTGREEN); nBlue = m_pPrefs->getNumber(TITRAQ_PREFLIGHTBLUE, TITRAQ_DEFLIGHTBLUE); const QColor Lightshade = QColor(nRed, nGreen, nBlue); pUserpanel->setLight(&Lightshade); nRed = m_pPrefs->getNumber(TITRAQ_PREFDARKRED, TITRAQ_DEFDARKRED); nGreen = m_pPrefs->getNumber(TITRAQ_PREFDARKGREEN, TITRAQ_DEFDARKGREEN); nBlue = m_pPrefs->getNumber(TITRAQ_PREFDARKBLUE, TITRAQ_DEFDARKBLUE); const QColor Darkshade = QColor(nRed, nGreen, nBlue); pUserpanel->setDark(&Darkshade); // Modal panel handler if (pUserpanel->exec() == QDialog::Accepted) this->applyPrefs(pUserpanel); // Dispose Panel object delete pUserpanel; } // // View menu normal // void Titraqform::normalView(void) { // All view types except normal are disabled until implemention, so // this body can remain empty, causing nothing to happen on selection. } // // View menu editing // void Titraqform::editingView(void) { // All view types except normal are disabled until implemention, so // this body can remain empty, causing nothing to happen on selection. } // // View menu timing // void Titraqform::timingView(void) { // All view types except normal are disabled until implemention, so // this body can remain empty, causing nothing to happen on selection. } // // View menu show file toolbar // void Titraqform::showFilebar(void) { if (m_pFiletools->isVisible()) { m_pFiletools->hide(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXFILEBAR), false); } else { m_pFiletools->show(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXFILEBAR), true); } } // // View menu show edit toolbar // void Titraqform::showEditbar(void) { if (m_pEdittools->isVisible()) { m_pEdittools->hide(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXEDITBAR), false); } else { m_pEdittools->show(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXEDITBAR), true); } } // // View menu show view toolbar // void Titraqform::showViewbar(void) { if (m_pViewtools->isVisible()) { m_pViewtools->hide(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXVIEWBAR), false); } else { m_pViewtools->show(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXVIEWBAR), true); } } // // View menu show prefs toolbar // void Titraqform::showPrefsbar(void) { if (m_pPrefstools->isVisible()) { m_pPrefstools->hide(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXPREFBAR), false); } else { m_pPrefstools->show(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXPREFBAR), true); } } // // View menu show whats this toolbar // void Titraqform::showWhatsbar(void) { if (m_pWhatstools->isVisible()) { m_pWhatstools->hide(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXWHATBAR), false); } else { m_pWhatstools->show(); m_pTbarspopup->setItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXWHATBAR), true); } } // // View menu show status column // void Titraqform::showStatcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXSTATUS); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL), false); m_pStatusedit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXSTATUS); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL), true); m_pStatusedit->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTATCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show line numbers column // void Titraqform::showLinecol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXLINE); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL), false); m_pLineedit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXLINE); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL), true); m_pLineedit->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXLCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show users column // void Titraqform::showUsercol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXUSER); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL), false); m_pUseredit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXUSER); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL), true); m_pUseredit->show(); } // Make sure switch take place right away and sizes are handled this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXUCOL)); } // // View menu show GUIDs column // void Titraqform::showGuidcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXGUID); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL), false); m_pGuidedit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXGUID); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL), true); m_pGuidedit->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXGCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show CRC column // void Titraqform::showCrccol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXCRC); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL), false); m_pCrcedit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXCRC); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL), true); m_pCrcedit->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXCCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show Rev column // void Titraqform::showRevcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXREV); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL), false); m_pRevedit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXREV); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL), true); m_pRevedit->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREVCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show dates column // void Titraqform::showDatecol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXDATE); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL), false); m_pDateedit->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXDATE); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL), true); m_pDateedit->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXDCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show start time column // void Titraqform::showStartcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXSTART); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL), false); m_pStarttime->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXSTART); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL), true); m_pStarttime->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show finish time column // void Titraqform::showFinishcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXFINISH); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL), false); m_pEndtime->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXFINISH); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL), true); m_pEndtime->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXFCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show Amounts column // void Titraqform::showAmountcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL))) { m_pMaintable->hideColumn(TITRAQ_IDXAMOUNT); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL), false); m_pAmount->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXAMOUNT); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL), true); m_pAmount->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXACOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show tasks column // void Titraqform::showTaskcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXTCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXTASK); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXTCOL), false); m_pTasks->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXTASK); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXTCOL), true); m_pTasks->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXTCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // View menu show Remarks column // void Titraqform::showRemarkcol(void) { // Test if column is currently shown, conditionally show or hide it if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL))) { m_pMaintable->hideColumn(TITRAQ_IDXREMARK); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL), false); m_pRemark->hide(); } else { m_pMaintable->showColumn(TITRAQ_IDXREMARK); m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL), true); m_pRemark->show(); } // Make sure switch take place right away and sizes are handled m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREMCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } // // Generate a local formatted report // void Titraqform::genReport(void) { try { // Create and execute a new local report window std::auto_ptr pReport(new AS::Reportpanel (m_pMaintable, m_pPrefs, this, "Locreportpanel")); pReport->exec(); delete pReport.release(); // Technically unnecessary, smart pointer } catch (Genexcept& Genex) { Genex.reportErr(); return; } } // // Syncronize data with server using IIOP // void Titraqform::syncIiop(void) { #ifdef HAVE_MICO // Short circuit if user has disabled CORBA transmission in prefs if (!m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON)) return; char **ppcInargv = NULL; // Parameters to the ORB CORBA::ORB_var Orb; // The ORB iself CORBA::Object_var Nameobj; // Name service reference CosNaming::NamingContext_var Namectx; // COSS ns context CosNaming::Name Cosname; // Our requested obj name CORBA::Object_var Objcaster; // Generic CORBA object Asdatabase_var Asdbase; // Casted object to ASDB Astuple Singlerow; // A single row of AS data QString *pOrbargv = new QString(TITRAQ_ORBINIT); int nCount = pOrbargv->contains(' '); int nNamesize = 0; // Build a false incoming argv with which we initialize the ORB ppcInargv = new char *[nCount + 3]; // 3 = arg0 + last section + COSS host *ppcInargv = new char[strlen(*qApp->argv() + 2)]; // For cmd name strcpy(ppcInargv[0], *qApp->argv()); // Copy cmd name for (int nIter = 0; nIter <= nCount; nIter++) { QString Section = pOrbargv->section(' ', nIter, nIter); ppcInargv[nIter + 1] = new char[strlen(Section.ascii() + 2)]; strcpy(ppcInargv[nIter + 1], Section.ascii()); } // Build the single string COSS naming host name with associated port number *pOrbargv = TITRAQ_COSSPART1 + m_pPrefs->getString(TITRAQ_PREFCORBHOST, TITRAQ_DEFCORBHOST) + TITRAQ_COSSPART2; nNamesize = strlen(pOrbargv->ascii()); ppcInargv[nCount + 2] = new char[nNamesize]; strcpy(ppcInargv[nCount + 2], pOrbargv->ascii()); try { // Initialization of the ORB and COSS naming service nCount = nCount + 3; // Raise the count to include app, last sec, COSS Orb = CORBA::ORB_init(nCount, ppcInargv, "mico-local-orb"); Nameobj = Orb->resolve_initial_references("NameService"); Namectx = CosNaming::NamingContext::_narrow(Nameobj); if (CORBA::is_nil(Namectx)) { // Verify sanity m_pStatbar->message(trUtf8("Could not find the COSS naming service")); qWarning("Could not find the COSS naming service\n"); } // Clean up our dynamically allocated array for (int nIter = 0; nIter < nCount; nIter++) delete ppcInargv[nIter]; delete ppcInargv; // Free the array itself delete pOrbargv; // Free the intermediate string // Prepare the COSS name request Cosname.length(1); Cosname[0].id = CORBA::string_dup("Asdatabase"); Cosname[0].kind = CORBA::string_dup(""); try { // Resolve to a CORBA object Objcaster = Namectx->resolve(Cosname); } catch (CosNaming::NamingContext::NotFound &Cossex) { m_pStatbar->message(trUtf8("NotFound exception thrown")); qWarning("NotFound exception thrown\n"); return; } catch (CosNaming::NamingContext::CannotProceed &Cossex) { m_pStatbar->message(trUtf8("CannotProceed exception thrown")); qWarning("CannotProceed exception thrown\n"); return; } catch (CosNaming::NamingContext::InvalidName &Cossex) { m_pStatbar->message(trUtf8("InvalidName exception thrown")); qWarning("InvalidName exception thrown\n"); return; } // Cast the generic CORBA object to a AS database type Asdbase = Asdatabase::_narrow(Objcaster); if (CORBA::is_nil(Asdbase)) { // Verify sanity m_pStatbar->message(trUtf8("Could not find the AS database")); qWarning("Could not find the AS database\n"); return; } // Open an account object on the remote server Account_var Account = Asdbase->Open("/tmp/events.as"); if (CORBA::is_nil(Account)) { // Verify sanity m_pStatbar->message(trUtf8("Could not create an account object on the server")); qWarning("Could not create an account object on the server\n"); return; } // Fill account log object(s) to marshall and transmit int nRow = m_pMaintable->currentRow(); QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected // Remember, CORBA::stri_dup creates smart pointers for (int nIter = 0; nIter < nTotal; nIter++) { Singlerow.szUser = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER)); Singlerow.szGuid = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXGUID)); Singlerow.szCrc = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXCRC).remove("0x")); Singlerow.szRev = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREV)); Singlerow.szDate = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE)); Singlerow.szStart = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART)); Singlerow.szFinish = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH)); Singlerow.szAmount = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXAMOUNT)); // Singlerow.nRev = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREV).toUInt(); // Singlerow.nDate = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXDATE).toUInt(); // Singlerow.nStart = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXSTART).toUInt(); // Singlerow.nFinish = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXFINISH).toUInt(); // Singlerow.nAmount = m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXAMOUNT).toUInt(); Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXTASK)); Singlerow.szRemark = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXREMARK)); Account->Log(Singlerow); // Finally transmit to server } m_pStatbar->message(trUtf8("Successful transmission of accounting data")); } catch (const CORBA::Exception &Corbex) { m_pStatbar->message(trUtf8("Caught CORBA exception: %1").arg(Corbex._repoid())); qWarning("Caught CORBA exception: %s", Corbex._repoid()); } catch (...) { qWarning("Caught unknown exception\n"); } #endif // HAVE_MICO } // // Syncronize data with server using SOAP // void Titraqform::syncSoap(void) { #ifdef HAVE_ESOAP // Short circuit if user has disabled SOAP transmission in prefs if (!m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON)) return; USING_EASYSOAP_NAMESPACE try { SOAPMethod Logmeth("Log", TITRAQ_SOAPSPACE); // SOAP namespace SOAPString Clistr; // Outgoing parameter to marshall int nCrc; // SOAP unmarshalled return value // Build the single string SOAP end point which look like this: // "http://www.europalab.com/cgi-bin/asdbserv" QString Endpoint; Endpoint = TITRAQ_PREFIXHTTP + m_pPrefs->getString(TITRAQ_PREFSOAPHOST, TITRAQ_DEFSOAPHOST); SOAPProxy Proxy(Endpoint.ascii()); // Fill account log object(s) to marshall and transmit QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected // Iterate through the selection of row entries to transmit for (int nRowiter = 0; nRowiter < nTotal; nRowiter++) { QString Syncthis = m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXUSER); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXGUID); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXCRC).remove("0x"); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXREV); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXDATE); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXSTART); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXFINISH); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXAMOUNT); Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXTASK); Syncthis += ' ' + ('"' + m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXREMARK)) + '"'; Clistr = Syncthis; // Build RPC parameter Logmeth.AddParameter("Tuple") << Clistr; // Prepare for marshalling const SOAPResponse &Logresp = Proxy.Execute(Logmeth); Logresp.GetReturnValue() >> nCrc; } m_pStatbar->message(trUtf8("Successful transmission, CRC returned %1").arg(nCrc)); } catch (SOAPException& Soapex) { // Announce the exception we received m_pStatbar->message(trUtf8("Caught SOAP exception: %1").arg(Soapex.What().Str())); qDebug("Caught SOAP exception: %s", Soapex.What().Str()); } catch (...) { qDebug("Caught unknown exception\n"); } #endif // HAVE_ESOAP } // // Save user preferences // void Titraqform::savePrefs(void) { // Get check status from column menu and pass it to prefs handler m_pPrefs->setBool(TITRAQ_PREFSTATCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL))); m_pPrefs->setBool(TITRAQ_PREFLCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL))); m_pPrefs->setBool(TITRAQ_PREFUCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL))); m_pPrefs->setBool(TITRAQ_PREFGCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL))); m_pPrefs->setBool(TITRAQ_PREFCCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL))); m_pPrefs->setBool(TITRAQ_PREFREVCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL))); m_pPrefs->setBool(TITRAQ_PREFDCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL))); m_pPrefs->setBool(TITRAQ_PREFSTARTCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL))); m_pPrefs->setBool(TITRAQ_PREFFCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL))); m_pPrefs->setBool(TITRAQ_PREFACOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL))); m_pPrefs->setBool(TITRAQ_PREFFCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL))); m_pPrefs->setBool(TITRAQ_PREFREMCOLON, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL))); // Get check status from toolbar menu and pass it to prefs handler m_pPrefs->setBool(TITRAQ_PREFFILEBAR, m_pTbarspopup->isItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXFILEBAR))); m_pPrefs->setBool(TITRAQ_PREFEDITBAR, m_pTbarspopup->isItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXEDITBAR))); m_pPrefs->setBool(TITRAQ_PREFVIEWBAR, m_pTbarspopup->isItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXVIEWBAR))); m_pPrefs->setBool(TITRAQ_PREFPREFBAR, m_pTbarspopup->isItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXPREFBAR))); m_pPrefs->setBool(TITRAQ_PREFWHATBAR, m_pTbarspopup->isItemChecked(m_pTbarspopup->idAt(TITRAQ_IDXWHATBAR))); // Get column widths from main table and pass it to prefs handler if (m_pMaintable->columnWidth(TITRAQ_IDXSTATUS) > 0) m_pPrefs->setNumber(TITRAQ_PREFSTATCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXSTATUS)); if (m_pMaintable->columnWidth(TITRAQ_IDXLINE) > 0) m_pPrefs->setNumber(TITRAQ_PREFLCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXLINE)); if (m_pMaintable->columnWidth(TITRAQ_IDXUSER) > 0) m_pPrefs->setNumber(TITRAQ_PREFUCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXUSER)); if (m_pMaintable->columnWidth(TITRAQ_IDXGUID) > 0) m_pPrefs->setNumber(TITRAQ_PREFGCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXGUID)); if (m_pMaintable->columnWidth(TITRAQ_IDXCRC) > 0) m_pPrefs->setNumber(TITRAQ_PREFCCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXCRC)); if (m_pMaintable->columnWidth(TITRAQ_IDXREV) > 0) m_pPrefs->setNumber(TITRAQ_PREFREVCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXREV)); if (m_pMaintable->columnWidth(TITRAQ_IDXDATE) > 0) m_pPrefs->setNumber(TITRAQ_PREFDCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXDATE)); if (m_pMaintable->columnWidth(TITRAQ_IDXSTART) > 0) m_pPrefs->setNumber(TITRAQ_PREFSTARTCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXSTART)); if (m_pMaintable->columnWidth(TITRAQ_IDXFINISH) > 0) m_pPrefs->setNumber(TITRAQ_PREFFCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXFINISH)); if (m_pMaintable->columnWidth(TITRAQ_IDXAMOUNT) > 0) m_pPrefs->setNumber(TITRAQ_PREFACOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXAMOUNT)); if (m_pMaintable->columnWidth(TITRAQ_IDXTASK) > 0) m_pPrefs->setNumber(TITRAQ_PREFTCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXTASK)); if (m_pMaintable->columnWidth(TITRAQ_IDXREMARK) > 0) m_pPrefs->setNumber(TITRAQ_PREFREMCOLWIDTH, (long)m_pMaintable->columnWidth(TITRAQ_IDXREMARK)); // Get sorting order and direction from table and pass it to prefs handler m_pPrefs->setNumber(TITRAQ_PREFSORTCOL, (long)m_pMaintable->getSortcol()); m_pPrefs->setBool(TITRAQ_PREFSORTDIR, (long)m_pMaintable->getSortdir()); // Set frame geometry preferences m_pPrefs->setNumber(TITRAQ_PREFFRAMEWIDTH, (long)this->width()); m_pPrefs->setNumber(TITRAQ_PREFFRAMEHEIGHT, (long)this->height()); // Remember main window layout and doc positions QString Laystring; QTextStream Laystream(&Laystring, IO_WriteOnly); Laystream << *this; // Persist the main window m_pPrefs->setString(TITRAQ_PREFFRAMELAY, Laystring); } // // Get help on Titraq functionality // void Titraqform::helpContents(void) { try { // Create and execute a new help contents window std::auto_ptr pHelpcont(new AS::Helpanel(TITRAQ_REFHELP, this, "Helpanel")); pHelpcont->exec(); delete pHelpcont.release(); // Technically unnecessary, smart pointer } catch (Genexcept& Genex) { Genex.reportErr(); return; } } // // Learn more about this program itself // void Titraqform::aboutTitraq(void) { QString Namever = QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short; QMessageBox *pCwmsg = new QMessageBox(Namever, QObject::trUtf8("The as-gui is a time and task-based accounting\n" "system that acts as both a work-like punch card and\n" "time tracker. Development of as-gui is sponsored by\n" "Cable & Wireless Telecommunications Services GmbH."), QMessageBox::NoIcon, QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton, QMessageBox::NoButton, NULL, "Titraqmessage", true, Qt::WStyle_NormalBorder); pCwmsg->setIconPixmap(QPixmap(s_kpcCwlogo_xpm)); pCwmsg->exec(); } // // Learn more about the OSSP // void Titraqform::aboutOSSP(void) { QString Namever = QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short; QMessageBox *pOsspmsg = new QMessageBox(Namever, QObject::trUtf8("The open source software project (OSSP) is\n" "a collective effort aimed at implementing\n" "high-quality Unix software components,\n" "ranging from networking, multi-threading\n" "and algorithmic libraries to networking\n" "servers and development tools."), QMessageBox::NoIcon, QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton, QMessageBox::NoButton, NULL, "Osspmessage", true, Qt::WStyle_NormalBorder); pOsspmsg->setIconPixmap(QPixmap(s_kpcOssplogo_xpm)); pOsspmsg->exec(); } // // Learn more about this program and Qt // void Titraqform::aboutQt(void) { QMessageBox::aboutQt(this, QString(TITRAQ_APPTITLE) + ' ' + asgui_version.v_short); } // // Apply preference values from a signal emitting object // void Titraqform::applyPrefs(void) { Prefpanel *pPan = (Prefpanel *)QObject::sender(); this->applyPrefs(pPan); } // // Accept preference values from a inbound Panel object // void Titraqform::applyPrefs(Prefpanel *pPrefpanel) { m_pPrefs->setString(TITRAQ_PREFACCOUNTS, pPrefpanel->getAccounts()); m_pPrefs->setString(TITRAQ_PREFASDIR, pPrefpanel->getEvents()); m_pPrefs->setString(TITRAQ_PREFUSER, pPrefpanel->getUser()); m_pPrefs->setString(TITRAQ_PREFHOME, pPrefpanel->getHome()); m_pPrefs->setString(TITRAQ_PREFCORBHOST, pPrefpanel->getCorbahost()); m_pPrefs->setString(TITRAQ_PREFSOAPHOST, pPrefpanel->getSoaphost()); m_pPrefs->setBool(TITRAQ_PREFCORBON, pPrefpanel->getCorbaon()); m_pPrefs->setBool(TITRAQ_PREFSOAPON, pPrefpanel->getSoapon()); m_pPrefs->setBool(TITRAQ_PREFBAKON, pPrefpanel->getBackon()); m_pPrefs->setBool(TITRAQ_PREFEXTENDON, pPrefpanel->getExtendon()); m_pPrefs->setBool(TITRAQ_PREFDETAILON, pPrefpanel->getDetailon()); m_pPrefs->setBool(TITRAQ_PREFSIGNATON, pPrefpanel->getSignaton()); m_pPrefs->setNumber(TITRAQ_PREFLIGHTRED, pPrefpanel->getLight()->red()); m_pPrefs->setNumber(TITRAQ_PREFLIGHTGREEN, pPrefpanel->getLight()->green()); m_pPrefs->setNumber(TITRAQ_PREFLIGHTBLUE, pPrefpanel->getLight()->blue()); m_pPrefs->setNumber(TITRAQ_PREFDARKRED, pPrefpanel->getDark()->red()); m_pPrefs->setNumber(TITRAQ_PREFDARKGREEN, pPrefpanel->getDark()->green()); m_pPrefs->setNumber(TITRAQ_PREFDARKBLUE, pPrefpanel->getDark()->blue()); // Dim the lights if no RPC transports are available if (this->isOpen()) m_pSyncact->setEnabled(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON) | m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON)); else m_pSyncact->setEnabled(false); // Get the selected style which can be more complicated due to mapping... if (pPrefpanel->getStyle() == TITRAQ_STRCDE) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE); qApp->setStyle(new QCDEStyle); } else if (pPrefpanel->getStyle() == TITRAQ_STRSGI) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI); qApp->setStyle(new QSGIStyle); } else if (pPrefpanel->getStyle() == TITRAQ_STRMOTIF) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF); qApp->setStyle(new QMotifStyle); } else if (pPrefpanel->getStyle() == TITRAQ_STRMPLUS) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS); qApp->setStyle(new QMotifPlusStyle); } else if (pPrefpanel->getStyle() == TITRAQ_STRPLAT) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT); qApp->setStyle(new QPlatinumStyle); } else if (pPrefpanel->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); } @ 1.144 log @Unload validation of personal data file from load logic, move new validation block to validateData, change all cases of preexisting validateData to new name validateRow, test for valid data from now on before calling loadData, and place read data file error strings in constants header. @ text @d685 2 d688 3 d692 1 a693 1 m_pMaintable->setReadOnly(true); @ 1.143 log @use standard english punctuation @ text @d136 1 a136 1 this->validateData(m_pMaintable->currentRow() + nIter, 0); d335 1 a335 1 this->validateData(nIter, 0); d433 1 a433 4 setFilename(Filestring); // Set the new file name m_pMaintable->setNumRows(0); // Clear out old data m_pMaintable->setDirty(false); // Reset dirty flag QFile Filetemp(Filestring); // File to load d435 10 a444 4 loadData(Filetemp); // Pass to helper method this->setCaption(Filestring); // Caption in the titlebar m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); this->enableIface(true); // Turn on the lights a447 1 this->setOpen(false); d952 1 a952 1 // Validate current row of matrix data d954 1 a954 1 void Titraqform::validateData(void) d956 1 a956 1 this->validateData(-1, -1); d960 1 a960 1 // Validate specified row of matrix data d962 1 a962 1 void Titraqform::validateData(int nRow, int nCol) @ 1.142 log @work around a Trolltech bug causing erroneous row selections in member m_pMaintable of class Titraqform @ text @d171 1 a171 1 // According to Trolltech, insertRows() ''clears the selection(s)´´. d201 1 a201 1 // According to Trolltech, insertRows() ''clears the selection(s)´´. @ 1.141 log @Modernize copyright text in source and graphic headers. @ text @d171 6 d201 6 @ 1.140 log @Correct file names in source headers. @ text @d3 4 a6 4 // Copyright (c) 2002-2003 The OSSP Project (http://www.ossp.org/) // Copyright (c) 2002-2003 Ralf S. Engelschall // Copyright (c) 2002-2003 Michael Schloh von Bennewitz // Copyright (c) 2002-2003 Cable & Wireless Telecommunications Services GmbH @ 1.139 log @Handle the time consuming bureaucracy of changing a company name. @ text @d29 1 a29 1 // titslot.cpp: ISO C++ implementation @ 1.138 log @Fixed a bug, causing a cancelled focus operation on rowadd. @ text @a3 1 // Copyright (c) 2002-2003 Cable & Wireless Deutschland (http://www.cw.com/de/) d6 1 d1891 4 a1894 5 QObject::trUtf8("The as-gui is a time and task-based\n" "accounting system that acts as both a\n" "work-like punch card and time tracker.\n" "Development of as-gui is sponsored by\n" "Cable & Wireless Deutschland GmbH."), @ 1.137 log @Use the new documentation contents in the help panel class to fill the HTML help browser window. @ text @d223 2 @ 1.136 log @Corrected SOAP string transmission logic, especially remark field. @ text @d1872 1 a1872 1 std::auto_ptr pHelpcont(new AS::Helpanel(this, "Helpanel")); d1889 1 a1889 1 QObject::trUtf8("AS-GUI is a time and task-based\n" d1892 1 a1892 1 "Development of AS-GUI is sponsored by\n" @ 1.135 log @Changed CRC calculation string algorhythm to pad with '0' to 8 places. @ text @d1773 9 a1781 2 for (int nColiter = TITRAQ_IDXUSER + 1; nColiter < TITRAQ_IDXTAIL; nColiter++) Syncthis += ' ' + m_pMaintable->text(Select.topRow() + nRowiter, nColiter); @ 1.134 log @Hook in new help contents browser logic on activation of helpContents signal. @ text @d813 1 d841 3 a843 2 m_pMaintable->setText(nRealrow, TITRAQ_IDXCRC, "0x" + QString::number(Valcrc, 16)); m_pCrcedit->setText("0x" + QString::number(Valcrc, 16)); @ 1.133 log @Hook in alternate colours for windows users. @ text @d66 1 d1862 9 a1870 2 Prototype Unimp; Unimp.doMbox(); @ 1.132 log @Add new detailed listing and signature prefs, and correct accidentally reversed light and dark buttons. @ text @d1186 1 a1186 1 QColorGroup Origcolour; d1189 2 d1196 3 @ 1.131 log @Last touches to colour dialogs and preferences. @ text @d1156 2 d1191 2 a1192 2 Origcolour.setColor(QColorGroup::Background, Origlight); Origcolour.setColor(QColorGroup::Foreground, Origdark); d1933 2 @ 1.130 log @Implemented user-defined row shading colours, acessible in preferences panel and elsewhere. @ text @d1182 1 a1182 1 // Set default colours d1184 10 @ 1.129 log @Use exceptions when handling report generation errors. @ text @d1182 13 d1921 6 @ 1.128 log @Added necessary coupling between report panel and table and preferences to get local reports working. Fixed some strings, and removed hard coded text in favour of pref values. @ text @d1561 10 a1570 6 Reportpanel *pReport = NULL; // The local report panel // Create a new local report window pReport = new Reportpanel(m_pMaintable, m_pPrefs, this, "Locreportpanel"); pReport->exec(); // Modal panel handler delete pReport; // Dispose Panel object @ 1.127 log @Implemented local report generating slot, and use new class Reportpanel. @ text @d1564 1 a1564 1 pReport = new Reportpanel(this, "Locreportpanel"); @ 1.126 log @Added logic to include prefs pixmap in both menu and toolbar, removed optional 'this' parameter from all calls to connect(), ripped out more header includes from monolithic interface header, made call of prefs panel an instance of class QAction, changed .bak file message text in class Prefpanel, and renamed default RPC hosts to show what a proper format is. @ text @d61 1 d65 1 d1561 6 a1566 2 Prototype Unimp; Unimp.doMbox(); @ 1.125 log @Moved preference data application from panel items to own method, added applyPrefs logic, and a new proxy method to handle applied signals, and reorganized file incusion in throughout to loosen source file coupling. @ text @d42 3 a54 1 #include "as_gui.h" // Main classes d1261 15 d1771 2 @ 1.124 log @Get rid of double newline, add the synchronize action button to the view toolbar where it belongs, and remove the separator between the columns and views selectors. @ text @d53 1 d60 1 d63 1 d1129 1 d1179 2 a1180 18 if (pUserpanel->exec() == QDialog::Accepted) { m_pPrefs->setString(TITRAQ_PREFACCOUNTS, pUserpanel->getAccounts()); m_pPrefs->setString(TITRAQ_PREFASDIR, pUserpanel->getEvents()); m_pPrefs->setString(TITRAQ_PREFUSER, pUserpanel->getUser()); m_pPrefs->setString(TITRAQ_PREFHOME, pUserpanel->getHome()); m_pPrefs->setString(TITRAQ_PREFCORBHOST, pUserpanel->getCorbahost()); m_pPrefs->setString(TITRAQ_PREFSOAPHOST, pUserpanel->getSoaphost()); m_pPrefs->setBool(TITRAQ_PREFCORBON, pUserpanel->getCorbaon()); m_pPrefs->setBool(TITRAQ_PREFSOAPON, pUserpanel->getSoapon()); m_pPrefs->setBool(TITRAQ_PREFBAKON, pUserpanel->getBackon()); m_pPrefs->setBool(TITRAQ_PREFEXTENDON, pUserpanel->getExtendon()); // Dim the lights if no RPC transports are available if (this->isOpen()) m_pSyncact->setEnabled(m_pPrefs->getBool(TITRAQ_PREFCORBON, TITRAQ_DEFCORBON) | m_pPrefs->getBool(TITRAQ_PREFSOAPON, TITRAQ_DEFSOAPON)); else m_pSyncact->setEnabled(false); d1182 1 a1182 28 // Get the selected style which can be more complicated due to mapping... if (pUserpanel->getStyle() == TITRAQ_STRCDE) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE); qApp->setStyle(new QCDEStyle); } else if (pUserpanel->getStyle() == TITRAQ_STRSGI) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI); qApp->setStyle(new QSGIStyle); } else if (pUserpanel->getStyle() == TITRAQ_STRMOTIF) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF); qApp->setStyle(new QMotifStyle); } else if (pUserpanel->getStyle() == TITRAQ_STRMPLUS) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS); qApp->setStyle(new QMotifPlusStyle); } else if (pUserpanel->getStyle() == TITRAQ_STRPLAT) { m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT); 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); } d1853 61 @ 1.123 log @Fixed bug in class Simplefile, trying to save to non-open file, and added code to conditionally save backup files based new user preferences. @ text @d1714 1 a1714 1 qWarning("Caught CORBA exception: %s\n", Corbex._repoid()); @ 1.122 log @Remove default event file insert, and instead default to event directory. @ text @d457 2 a458 1 Filevents.makeBackup(); // Back up to filename.bak @ 1.121 log @Modified class Panel accept operation to apply changes immediately, and added logic to activate file extension switch, using preference value from panel. @ text @d400 1 a400 1 QString Openas = m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE); a403 4 // Conditionally use a unique extension like '.as' if user prefers if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON)) Openas += TITRAQ_FEXTENSION; d477 1 a477 1 QString Openas = m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE); a480 4 // Conditionally use a unique extension like '.as' if user prefers if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON)) Openas += TITRAQ_FEXTENSION; d523 1 a523 1 QString Openas = m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE); a526 4 // Conditionally use a unique extension like '.as' if user prefers if (m_pPrefs->getBool(TITRAQ_PREFEXTENDON, TITRAQ_DEFEXTENDON)) Openas += TITRAQ_FEXTENSION; d1128 1 a1128 1 pUserpanel->setEvents(m_pPrefs->getString(TITRAQ_PREFASFILE, TITRAQ_DEFASFILE)); d1176 1 a1176 1 m_pPrefs->setString(TITRAQ_PREFASFILE, pUserpanel->getEvents()); @ 1.120 log @Lots of small changes and improvements to RPC options, menus, and action, resulting in better usability and more stable RPC functionality. @ text @d43 8 d404 4 d485 4 d507 6 a512 3 QString Extension = TITRAQ_FEXTENSION; // Logic to handle if (!Filestring.endsWith(Extension)) // AS file extension Filestring += Extension; // insertion d535 4 d558 7 a564 3 QString Extension = TITRAQ_FEXTENSION; // Logic to handle if (!Filestring.endsWith(Extension)) // AS file extension Filestring += Extension; // insertion d1206 1 a1206 1 if (pUserpanel->getStyle() == TITRAQ_STRCDE) d1208 3 a1210 1 else if (pUserpanel->getStyle() == TITRAQ_STRSGI) d1212 3 a1214 1 else if (pUserpanel->getStyle() == TITRAQ_STRMOTIF) d1216 3 a1218 1 else if (pUserpanel->getStyle() == TITRAQ_STRMPLUS) d1220 3 a1222 1 else if (pUserpanel->getStyle() == TITRAQ_STRPLAT) d1224 3 a1226 1 else if (pUserpanel->getStyle() == TITRAQ_STRMSOFT) d1228 2 @ 1.119 log @Lots of RPC changes including disable and enablement according to compile time transport availability, multi row spanning with SOAP transmission, and solve security problems by making CORBA and SOAP hosts user configurable. @ text @d230 4 a233 6 #ifdef HAVE_MICO m_pSynciiopact->setEnabled(true); #endif // HAVE_MICO #ifdef HAVE_ESOAP m_pSyncsoapact->setEnabled(true); #endif // HAVE_ESOAP d288 3 a290 6 #ifdef HAVE_MICO m_pSynciiopact->setEnabled(false); #endif // HAVE_MICO #ifdef HAVE_ESOAP m_pSyncsoapact->setEnabled(false); #endif // HAVE_ESOAP d1171 7 d1563 4 d1700 4 @ 1.118 log @Completed working logic of preferences class Panel. @ text @d34 1 d1123 1 d1125 5 d1131 4 d1561 2 a1562 3 int nNada = 0; // Some false parameters char **ppcNada = NULL; // to fake out the ORB CORBA::ORB_var Orb; // The ORB d1572 22 d1596 2 a1597 1 Orb = CORBA::ORB_init(nNada, ppcNada, "mico-local-orb"); d1605 6 d1697 1 a1697 4 const char *pSpace = "http://soap.europalab.com/asdb"; const char *pEndpoint = "http://www.europalab.com/cgi-bin/asdbserv"; SOAPProxy Proxy(pEndpoint); SOAPMethod Logmeth("Log", pSpace); // SOAP remote method name d1701 9 a1709 6 // A quasi diff summary to transmit to the server QString Syncthis; int nRow = m_pMaintable->currentRow(); Syncthis += m_pMaintable->text(nRow, TITRAQ_IDXUSER); for (int nIter = TITRAQ_IDXUSER + 1; nIter < TITRAQ_IDXTAIL; nIter++) Syncthis += ' ' + m_pMaintable->text(nRow, nIter); d1711 10 a1720 4 Clistr = Syncthis; // Build RPC parameter Logmeth.AddParameter("Tuple") << Clistr; // Prepare for marshalling const SOAPResponse &Logresp = Proxy.Execute(Logmeth); Logresp.GetReturnValue() >> nCrc; d1725 1 a1725 1 qDebug("Caught SOAP exception: %s\n", Soapex.What().Str()); @ 1.117 log @Hard coded left alignment into task table items, made amount control appearance and behaviour consistent with amount table items, and split remote host name and switches out of prefs panel paths page to its own remote page. @ text @d1109 2 a1110 1 Prefpanel *pUserpanel = NULL; d1115 38 a1152 1 // Handle panel modality d1154 26 a1179 2 // pvData = pUserpanel->getData(); // setPrefs(pvData); @ 1.116 log @Implemented a class Simplefile to decouple simple file operations from app. @ text @a873 1 m_pAmount->setText(Textamount); d904 1 a904 1 m_pAmount->setText(QTime(0, 0).addSecs(nDifference).toString("hh:mm")); d907 1 a907 1 m_pAmount->setText(QString("00:00")); d909 1 a909 1 m_pAmount->setText(Textamount); d1057 1 a1057 1 void Titraqform::updateAmount(const QString &Amountup) d1059 1 a1059 2 // Ignore incoming data and use widget managed data because its easier m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXAMOUNT, m_pAmount->text()); d1095 1 a1095 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXAMOUNT, m_pAmount->text()); @ 1.115 log @Added new preferences panel class, made consistent destructor signatures. @ text @d49 3 a51 2 #include "as_crc.h" // Useful qualistring class #include "as_panel.h" // For prefpanel class d435 1 a435 2 QFile Filevents, Filebak; QTextStream Streamevents, Streambak; d452 3 a454 15 Filevents.setName(Fname); // Construct a file to back up and write // Make a backup before overwriting if (Filevents.exists()) { Filevents.open(IO_ReadOnly); Filebak.setName(Fname + ".bak"); Filebak.open(IO_WriteOnly); Streamevents.setDevice(&Filevents); Streambak.setDevice(&Filebak); Streambak << Streamevents.read(); Filevents.close(); Filebak.close(); } this->saveData(Filevents); // Pass to helper method @ 1.114 log @Fixed tab completion bug in which table entry misses text after expansion. @ text @d50 1 d1123 11 a1133 2 Prototype Unimp; Unimp.doMbox(); @ 1.113 log @Begin treating quit op on an edited doc as a special case to avoid loss. @ text @d1085 2 a1086 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXTASK, Taskup); @ 1.112 log @Allow transmission of multiple entries. @ text @d567 31 @ 1.111 log @Remember to fix a bounds flaw, and choose a more reasonable RPC server events file name. @ text @d1515 1 a1515 1 Account_var Account = Asdbase->Open("events.as"); d1522 1 a1522 1 // Fill an account object to marshall and transmit d1524 22 a1545 15 Singlerow.szUser = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXUSER)); Singlerow.szGuid = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXGUID)); Singlerow.szCrc = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXCRC).remove("0x")); Singlerow.szRev = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXREV)); Singlerow.szDate = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXDATE)); Singlerow.szStart = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXSTART)); Singlerow.szFinish = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXFINISH)); Singlerow.szAmount = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); // Singlerow.nRev = m_pMaintable->text(nRow, TITRAQ_IDXREV).toUInt(); // Singlerow.nDate = m_pMaintable->text(nRow, TITRAQ_IDXDATE).toUInt(); // Singlerow.nStart = m_pMaintable->text(nRow, TITRAQ_IDXSTART).toUInt(); // Singlerow.nFinish = m_pMaintable->text(nRow, TITRAQ_IDXFINISH).toUInt(); // Singlerow.nAmount = m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT).toUInt(); Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXTASK)); Singlerow.szRemark = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXREMARK)); a1546 1 Account->Log(Singlerow); // Finally transmit to server @ 1.110 log @RPC modifications, mostly completing the AS data tuples used by CORBA during marshalling and transmission. @ text @d1515 1 a1515 1 Account_var Account = Asdbase->Open("/tmp/corbadb.txt"); // Security problem! @ 1.109 log @Implemented auto field completion for start and finish and auto subtraction for amount, added period for GUID replacement, and added version text to widget labels. @ text @d1524 14 a1537 4 Singlerow.nDate = m_pMaintable->text(nRow, TITRAQ_IDXDATE).toInt(); Singlerow.nTime = m_pMaintable->text(nRow, TITRAQ_IDXSTART).toInt(); Singlerow.szName = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXUSER)); Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(nRow, TITRAQ_IDXTASK)); @ 1.108 log @Old titraq name slipped through the cracks. @ text @d325 3 a327 3 nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); d368 3 a370 3 nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); d492 3 a494 2 nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE), trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); d536 3 a538 2 nResult = QMessageBox::warning(this, trUtf8(TITRAQ_APPTITLE), trUtf8(TITRAQ_OVERWRITE), trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); d578 3 a580 3 nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); d599 1 a599 1 this->setCaption(TITRAQ_APPTITLE); d858 6 a863 2 // Members not suitable for empty string text if (!Textdate.isEmpty()) d865 6 a871 2 m_pDateedit->setDate(QDate::currentDate()); if (!Textstart.isEmpty()) d873 6 a879 2 m_pStarttime->setTime(QTime::QTime(0, 0)); if (!Textfinish.isEmpty()) d881 8 d890 1 a890 1 m_pEndtime->setTime(QTime::QTime(0, 0)); d917 1 a917 1 // Quick review of data validity, and set pixmaps accordingly d945 24 d1661 2 a1662 1 QMessageBox *pCwmsg = new QMessageBox("AS Accounting System", d1681 2 a1682 1 QMessageBox *pOsspmsg = new QMessageBox("AS Accounting System", d1702 1 a1702 1 QMessageBox::aboutQt(this, "AS Accounting System"); @ 1.107 log @Implemented a quality string class including CRC32 generation logic, used throghout for checksum computation, added automatic fake CRC field detection and correction on load operations, and backed out inconsistent date and time field format changes. @ text @d1616 1 a1616 1 QObject::trUtf8("As-gui is a time and task-based\n" d1619 1 a1619 1 "Development of titraq is sponsored by\n" @ 1.106 log @Back out logic to recognize '-', '+', and '=' as separator symbols. @ text @d32 3 d49 1 d161 1 a161 1 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString("yyyy.MM.dd")); d185 1 a185 1 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString("yyyy.MM.dd")); d770 2 a771 2 Q_UINT16 Valcrc, Testcrc; QString Wholerow; a772 1 // int nNewrev = -1; d776 1 a776 1 Wholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER); d779 1 a779 1 Wholerow += ' ' + m_pMaintable->text(nRealrow, nIter); d782 3 a784 1 Testcrc = qChecksum(Wholerow.ascii(), Wholerow.length()); d792 1 a792 1 Wholerow = m_pMaintable->text(nRealrow, TITRAQ_IDXUSER); d795 1 a795 1 Wholerow += ' ' + m_pMaintable->text(nRealrow, nIter); d797 3 a799 3 // Finally set the checksum to its new value Valcrc = qChecksum(Wholerow.ascii(), Wholerow.length()); m_pMaintable->setText(nRealrow, TITRAQ_IDXCRC, QString::number(Valcrc)); @ 1.105 log @Deny pasting of empty data and adding of zero rows. The add entry operation is intended for this and already available. @ text @d965 1 a965 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, Dateup.toString("yyyy.MM.dd")); @ 1.104 log @Extra help for beginning users. @ text @d100 6 a105 5 pClip = QApplication::clipboard(); // Prime the clips if (Selection = pClip->text(QClipboard::Clipboard)) { // Windows and Unix nRows = Selection.contains(QChar('\n')); // How many rows this->addEntry(nRows); // Reuse slot setRowdata(Selection); // Use accessor @ 1.103 log @Close remaining release problems. @ text @d799 10 a863 2 else m_pStatbar->message(trUtf8("Empty timesheet, add entries first please"), 4000); @ 1.102 log @Applied the same fix for open op to new op. @ text @d1601 2 a1602 2 QMessageBox *pCwmsg = new QMessageBox("OSSP titraq", QObject::trUtf8("OSSP titraq is a time and task-based\n" d1620 1 a1620 1 QMessageBox *pOsspmsg = new QMessageBox("OSSP titraq", d1640 1 a1640 1 QMessageBox::aboutQt(this, "OSSP titraq"); @ 1.101 log @Fixed all logical combinations of opening a new document and the tree of subdecisions following the operation. @ text @d316 1 a316 1 int nResult = 0; d326 1 a326 1 this->saveFile(); // Save changes first d332 1 d337 11 a347 8 // Fall through to implicit new doc code this->enableIface(true); // Enable the interface m_pMaintable->setNumRows(0); // Remove all data in table this->setCaption(trUtf8("No file name")); m_pStatbar->message(trUtf8("New document"), 4000); this->setOpen(); // Signal an open doc state this->addEntry(1); // Default new op adds a row m_pMaintable->setDirty(false); // Start out clean d355 1 a355 1 int nResult = 0; // Holds return value from save first messagebox @ 1.100 log @Fix logic when calling saveFile, but returning in a dirty state. @ text @d341 1 a341 1 this->setFilename(QString("")); d353 21 a373 43 // 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 // Check modification state of current data if (m_pMaintable->isDirty()) { nResult = QMessageBox::information(this, trUtf8(TITRAQ_APPTITLE), trUtf8(TITRAQ_SAVEFIRST), trUtf8("&Save"), trUtf8("&Discard"), trUtf8("Cancel"), 0, 2); switch (nResult) { case 0: // Save first this->saveFile(); // Save changes first setFilename(Filestring); // Set the new file name m_pMaintable->setNumRows(0); // Clear out old data try { loadData(Filetemp); // Pass to helper method } catch (Genexcept& Genex) { Genex.reportErr(); return; } break; case 1: // Don't save first but do load setFilename(Filestring); // Set the new file name m_pMaintable->setNumRows(0); // Clear out old data try { loadData(Filetemp); // Pass to helper method } catch (Genexcept& Genex) { Genex.reportErr(); return; } break; case 2: // Don't do a load timesheet default: break; } d375 21 a395 1 else { d398 2 d402 3 d406 3 a408 1 catch (Genexcept& Genex) { d413 2 a414 5 // Fall through to implicit open code this->setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); this->enableIface(true); // Turn on the lights a415 2 else m_pStatbar->message(trUtf8("Loading aborted"), 4000); @ 1.99 log @Fixed open document but empty timesheet debug text spew bug, and improved user interface by adding more clue messages and denying flawed ops. @ text @d207 15 d437 1 a437 1 Genex.reportErr(); // Report the error d576 1 d586 14 a599 12 // Fall through to implicit close code this->setCaption(TITRAQ_APPTITLE); try { // There might be problems, so wrap these last ops with error handling QString Lightsout; // It's late, go to bed if (this->isOpen()) Lightsout = trUtf8("Closed document ") + *this->getFilename(); this->setOpen(false); // Set doc state to closed this->enableIface(false); // Turn off the lights m_pStatbar->message(Lightsout, 4000); } catch (Genexcept& Genex) { Genex.reportErr(); d601 1 a601 1 pClosit->ignore(); // Finish off by not closing @ 1.98 log @Fixed void clipboard bug, and improved main form and edit control behaviour when last row of an open document is removed. @ text @d781 15 a795 1 // QRegExp Shorten("/(\\w+)$"); // For stripping prefix off the current task d797 2 a798 12 // Field strings to check for validity and process QString Textline(m_pMaintable->text(nRow, TITRAQ_IDXLINE)); QString Textuser(m_pMaintable->text(nRow, TITRAQ_IDXUSER)); QString Textguid(m_pMaintable->text(nRow, TITRAQ_IDXGUID)); QString Textcrc(m_pMaintable->text(nRow, TITRAQ_IDXCRC)); QString Textrev(m_pMaintable->text(nRow, TITRAQ_IDXREV)); QString Textdate(m_pMaintable->text(nRow, TITRAQ_IDXDATE)); QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXSTART)); QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXFINISH)); QString Textamount(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); QString Texttask(m_pMaintable->text(nRow, TITRAQ_IDXTASK)); QString Textremark(m_pMaintable->text(nRow, TITRAQ_IDXREMARK)); d800 10 a809 2 // Reset the edition state member m_pMaintable->setEdition(); d811 2 a812 10 // Set text of member edit controls if (m_pMaintable->text(nRow, TITRAQ_IDXSTATUS).isEmpty()) // If row is empty m_pStatusedit->setPixmap(s_kpcStatvoid_xpm); // add a placeholder else m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); m_pLineedit->setText(Textline); m_pUseredit->setText(Textuser); m_pGuidedit->setText(Textguid); m_pCrcedit->setText(Textcrc); m_pRevedit->setText(Textrev); d814 3 a816 4 m_pAmount->setText(Textamount); // Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash m_pTasks->setCurrentText(Texttask); m_pRemark->setText(Textremark); d818 14 a831 11 // Members not suitable for empty string text if (!Textdate.isEmpty()) m_pDateedit->setDate(QDate::fromString(Textdate, Qt::ISODate)); else m_pDateedit->setDate(QDate::currentDate()); if (!Textstart.isEmpty()) m_pStarttime->setTime(QTime::fromString(Textstart, Qt::ISODate)); else m_pStarttime->setTime(QTime::QTime(0, 0)); if (!Textfinish.isEmpty()) m_pEndtime->setTime(QTime::fromString(Textfinish, Qt::ISODate)); d833 1 a833 1 m_pEndtime->setTime(QTime::QTime(0, 0)); @ 1.97 log @Improve close event handling, and announce this event to the user. @ text @d98 1 a98 1 QClipboard *pClip; // Will reference the global clipboard d100 1 d114 1 d117 2 d251 16 @ 1.96 log @Fixed dirty data double check on implicit save ops, fixed close event method, and plugged holes where no exception handling existed for an except condition. @ text @d553 1 d555 1 a555 1 m_pStatbar->message(trUtf8("Closed document ") + *this->getFilename(), 4000); d558 1 d825 1 a825 1 if (!m_pMaintable->numRows() > 0) { // If no rows exist then short circuit @ 1.95 log @Implemented writing and testing of a data version symbol. @ text @d306 1 a306 1 this->setFilename(""); d393 1 a393 1 Fname = QString(*this->getFilename()); d395 1 a395 1 // First time saves are really just saveAs in disguise d397 8 a404 2 this->saveAs(); return; d468 1 a468 1 else { d471 46 d551 11 a561 3 this->enableIface(false); // Turn off the lights this->setOpen(false); // Set doc state to closed pClosit->ignore(); // Finish off by not closing @ 1.94 log @Fixed a bug and found a new one. @ text @d343 1 d354 1 d370 1 @ 1.93 log @Day date section focus is the default value, and happily removed a hackful zero date placeholder. @ text @a307 1 this->updEdit(1); // Update edit controls @ 1.92 log @Fix the initial data loading a little more, and remove the logic from the first level gui object. @ text @a37 1 //#include d45 1 d735 1 a735 1 m_pDateedit->setDate(*m_pDatezero); a843 3 if (Dateup == *m_pDatezero) // Complete the already nasty hack m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, trUtf8(TITRAQ_DATEZERO)); else @ 1.91 log @Implemented initial file loading by shell argument, and cleaned up some other small problems. @ text @a165 1 m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please a374 1 m_pMaintable->ensureCellVisible(m_pMaintable->currentRow(), 0); @ 1.90 log @Break the orthogonal data format and include new token separators '-' and '='. Also, add automatic file backup code back in again. @ text @d376 1 @ 1.89 log @Fixed a subtle bug in a split else block, and added code to append file extension to new saves. @ text @d37 1 d388 3 d393 1 d399 16 a414 3 // Try to open a file for writing to QFile Filetemp(Fname); this->saveData(Filetemp); // Pass to helper method @ 1.88 log @New logic automatically adds the first row to new documents, and controls some icon dimming and undimming according to if the document is empty or not. @ text @d435 4 a438 1 else d441 1 @ 1.87 log @Rename files, and do cleanups. @ text @d195 15 d239 15 d307 3 a309 1 this->updEdit(0); // Update edit controls @ 1.86 log @Made file and directory handling more generic. @ text @d52 1 a52 1 #include "asdb.h" // CORBA stubs and skeletons @ 1.85 log @Implemented checksum in all forms, and implemented a revision management system that is so primitive that I commented it out until further design. @ text @d286 7 a292 1 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); d382 7 a388 2 // 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); @ 1.84 log @Make RPC menus even more useful by transmitting the current selection instead of the last entry (duh). @ text @d149 2 a150 2 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "0"); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "0"); d157 2 d182 1 d581 48 d683 9 a691 1 // Validate one row of matrix data d695 2 d702 2 a703 1 QString Statis = m_pMaintable->text(nRow, TITRAQ_IDXSTATUS); // Get text d706 9 a714 9 if (m_pMaintable->text(nRow, TITRAQ_IDXUSER).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXGUID).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXCRC).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXREV).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXDATE).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXSTART).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXFINISH).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT).isEmpty() || m_pMaintable->text(nRow, TITRAQ_IDXTASK).isEmpty()) d718 1 a718 1 // m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); d721 3 a723 3 m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(TITRAQ_IDXSTATERROR, sizeof(char), 'E')); m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm)); m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); d728 3 a730 3 m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(TITRAQ_IDXSTATERROR, sizeof(char), 'O')); m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm)); m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); d1329 2 a1330 2 Syncthis += m_pMaintable->text(nRow, 0); for (int nIter = 1; nIter < TITRAQ_IDXTAIL; nIter++) @ 1.83 log @Fix current file overwriting bug. @ text @d1228 6 a1233 6 int nLastrow = m_pMaintable->numRows() - 1; Singlerow.nDate = m_pMaintable->text(nLastrow, TITRAQ_IDXDATE).toInt(); Singlerow.nTime = m_pMaintable->text(nLastrow, TITRAQ_IDXSTART).toInt(); Singlerow.szName = CORBA::string_dup(m_pMaintable->text(nLastrow, TITRAQ_IDXUSER)); Singlerow.szTask = CORBA::string_dup(m_pMaintable->text(nLastrow, TITRAQ_IDXTASK)); Singlerow.szRemark = CORBA::string_dup(m_pMaintable->text(nLastrow, TITRAQ_IDXREMARK)); d1266 2 a1267 2 int nLastrow = m_pMaintable->numRows() - 1; Syncthis += m_pMaintable->text(nLastrow, 0); d1269 1 a1269 1 Syncthis += ' ' + m_pMaintable->text(nLastrow, nIter); @ 1.82 log @Made CORBA and/or SOAP connections options of autoconf, so remote reporting is compiled into the client only when desired. @ text @d390 2 a391 1 saveFile(); // Finish off by calling the save action @ 1.81 log @Implement primitive UUID generation on new entry. @ text @a38 5 // RPC headers #include #include #include "asdb.h" // CORBA stubs and skeletons d46 9 d124 1 a124 1 auto_ptr pGuid(new AS::Uuid); // For GUID production d1163 1 d1244 1 d1252 1 d1283 1 @ 1.80 log @Use a more orthogonal solution for control updates on add and paste operations. @ text @d49 1 d120 1 d143 4 a146 3 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, "."); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "."); m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "."); a153 1 updEdit(Select.topRow()); // Reflect in the update controls d166 4 a169 3 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, "."); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, "."); m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, "."); a176 1 updEdit(Select.bottomRow() + 1); // Reflect in the update controls d183 1 a184 7 // char szGuitext[37]; // uuid_t Guid; // // uuid_generate(Guid); // uuid_unparse(Guid, szGuitext); // m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXGUID, szGuitext); @ 1.79 log @Bugfix for very inconvenient edit control update failure. @ text @d106 2 d151 1 d174 1 a180 1 updEdit(Select.topRow()); // Reflect in the update controls d274 1 a274 1 this->updEdit(0, 0); // Update edit controls @ 1.78 log @Add logic to connect and syncronize with a CORBA server. Hard code usage of MICO libraries into build configuration. @ text @d177 1 @ 1.77 log @Add logic to connect and syncronize with a SOAP server. Hard code usage of EasySOAP libraries into build configuration. @ text @d41 2 d1159 80 a1238 2 Prototype Unimp; Unimp.doMbox(); d1272 3 @ 1.76 log @Add GUI cod framework, graphics, and stub methods for server syncrhonization. @ text @d39 3 d1166 27 a1192 2 Prototype Unimp; Unimp.doMbox(); @ 1.75 log @Fixed sorting and added sort direction handling. @ text @d1141 27 @ 1.74 log @Fixed data loading bug, causing overwriting of last row with first row's data. @ text @d1190 3 a1192 2 // Get sorting order from matrix table and pass it to prefs handler m_pPrefs->setNumber(TITRAQ_PREFSORT, (long)m_pMaintable->getSortcol()); @ 1.73 log @Added full close document and disable handling, added new dimmed icons for showing disabled state, fixed status edit control pixmap redraw, fixed remaining edit pixmap on old data, fixed get/set empy Rowdata for cut/copy/paste ops, fixed member filename corruption and data loss problem, optimized addRow and pasteRow graphic drawing, added better file name handling by accessors, and streamlined widget enablement logic in slots. @ text @d265 1 a265 8 // Reset widget text of edit controls m_pDateedit->setDate(*m_pDatezero); m_pStarttime->setTime(QTime::QTime(0, 0)); m_pEndtime->setTime(QTime::QTime(0, 0)); m_pAmount->setText(NULL); m_pTasks->setCurrentText(NULL); m_pRemark->setText(NULL); @ 1.72 log @Fixed member filename corruption and data loss problem. @ text @a88 3 // Optimize viewing by repainting cells only once after processing m_pMaintable->setUpdatesEnabled(false); a101 2 m_pMaintable->setUpdatesEnabled(true); // Update and repaint d181 2 a182 2 m_pMaintable->setUpdatesEnabled(true); // Turn updates back on m_pMaintable->repaintContents(false); // Repaint viewport d230 1 a230 1 m_pMaintable->repaintContents(true); // Do a general repaint of table a249 27 // Reset widget text values before blanking table m_pDateedit->setDate(*m_pDatezero); m_pStarttime->setTime(QTime::QTime(0, 0)); m_pEndtime->setTime(QTime::QTime(0, 0)); m_pAmount->setText(NULL); m_pTasks->setCurrentText(NULL); m_pRemark->setText(NULL); m_pMaintable->setEnabled(true); // Enable the table first m_pMaintable->setNumRows(0); // Remove all data in table m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); this->updEdit(0, 0); // Reset edit controls this->setCaption(trUtf8("No file name")); m_pStatbar->message(trUtf8("New document"), 4000); *m_szFilename = ""; // Blank the file name m_pMaintable->setDirty(false); // Reset data to clean state d251 1 a251 19 case 1: // Second button selected, so don't save first but do new m_pMaintable->setEnabled(true); // Enable the table first m_pMaintable->setNumRows(0); // Remove all data in table m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); this->updEdit(0, 0); // Reset edit controls this->setCaption(trUtf8("No file name")); m_pStatbar->message(trUtf8("New document"), 4000); *m_szFilename = ""; // Blank the file name m_pMaintable->setDirty(false); // Reset data to clean state d253 1 a253 1 case 2: // Third button selected, so don't do a new timesheet d255 1 d259 14 a272 27 else { // Data is already up to date // Reset widget text values before blanking table m_pDateedit->setDate(*m_pDatezero); m_pStarttime->setTime(QTime::QTime(0, 0)); m_pEndtime->setTime(QTime::QTime(0, 0)); m_pAmount->setText(NULL); m_pTasks->setCurrentText(NULL); m_pRemark->setText(NULL); m_pMaintable->setEnabled(true); // Enable the table first m_pMaintable->setNumRows(0); // Remove all data in table m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); this->updEdit(0, 0); // Reset edit controls this->setCaption(trUtf8("No file name")); m_pStatbar->message(trUtf8("New document"), 4000); *m_szFilename = ""; // Blank the file name m_pMaintable->setDirty(false); // Reset data to clean state } d294 1 a294 1 m_szFilename->operator=(Filestring); a301 16 // Reset and give output to main window this->setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); m_pMaintable->setEnabled(true); // Enable the table first m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); m_pMaintable->setDirty(false); // Set the clean state d304 1 a304 1 m_szFilename->operator=(Filestring); a311 16 // Reset and give output to main window this->setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); m_pMaintable->setEnabled(true); // Enable the table first m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); m_pMaintable->setDirty(false); // Set the clean state d319 2 a320 2 m_szFilename->operator=(Filestring); m_pMaintable->setNumRows(0); // Clear out old data d322 1 a322 1 loadData(Filetemp); // Pass to helper method a326 16 // Reset and give output to main window this->setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); m_pMaintable->setEnabled(true); // Enable the table first m_pLineedit->setEnabled(true); m_pUseredit->setEnabled(true); m_pGuidedit->setEnabled(true); m_pCrcedit->setEnabled(true); m_pRevedit->setEnabled(true); m_pDateedit->setEnabled(true); m_pStarttime->setEnabled(true); m_pEndtime->setEnabled(true); m_pAmount->setEnabled(true); m_pTasks->setEnabled(true); m_pRemark->setEnabled(true); m_pMaintable->setDirty(false); // Set the clean state d328 5 d343 1 a343 8 // First time saves are really just saveAs in disguise if (m_szFilename->isEmpty()) { saveAs(); return; } // Try to open a file for writing to QFile Filetemp(*m_szFilename); d345 9 a353 1 saveData(Filetemp); // Pass to helper method d359 2 a360 2 this->setCaption(*m_szFilename); m_pStatbar->message(trUtf8("File %1 saved").arg(*m_szFilename), 4000); d379 1 a379 1 *m_szFilename = Filestring; d403 3 d412 1 a412 1 switch (nResult) { d414 1 a414 3 this->saveFile(); // Save changes first m_pMaintable->setDirty(false); // Reset data to clean state pClosit->accept(); // then close timesheet d416 1 a416 3 case 1: // Don't save first but close m_pMaintable->setDirty(false); // Reset data to clean state pClosit->accept(); // Close timesheet d418 1 a418 1 case 2: // Don't close d421 1 d425 5 a429 4 else { // Data is already up to date m_pMaintable->setDirty(false); // Reset data to clean state pClosit->accept(); } @ 1.71 log @Fixed two bugs, added placeholder pixmap to avoid stale data reference, and removed incorrect pixmap logic when reading a problem row with warning on. @ text @d278 3 d298 3 d330 3 d476 1 a476 2 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); d478 1 a478 2 *m_szFilename = Filestring; if (QFile::exists(*m_szFilename)) { d483 1 @ 1.70 log @Fixed control status pixmap to match corresponding row in matrix. @ text @d51 1 d693 4 a696 1 m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); d747 2 a748 1 m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, TITRAQ_IDXSTATUS)); @ 1.69 log @Fixed row shade logic and moved dirty flag to TiTable class. @ text @d135 1 d157 1 d176 2 d235 1 a235 1 m_pStatbar->message(trUtf8("Refreshed display"), 4000); // Announce result a675 1 QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS)); d692 1 a692 1 m_pStatusedit->setPixmap(m_pMaintable->pixmap(nRow, nCol)); d742 4 a745 1 if (!Statis.startsWith(QString("E"))) { // Conditionally set pixmap to avoid overhead d748 1 d755 1 @ 1.68 log @Optimize data validation algorythm for speed, using a sneaky technique by writing unviewable control text to the status bitmap field. @ text @d130 1 a130 1 this->setDirty(); // Set data to dirty state d150 1 a150 1 this->setDirty(); // Set data to dirty state d202 1 a202 1 this->setDirty(); // Set data to dirty state d206 1 a206 1 this->setDirty(); // Set data to dirty state d230 2 a231 1 this->repaint(); // Do a general repaint of viewable area d242 1 a242 1 if (this->isDirty()) { d273 1 a273 1 this->setDirty(false); // Reset data to clean state d290 1 a290 1 this->setDirty(false); // Reset data to clean state d319 1 a319 1 this->setDirty(false); // Reset data to clean state d334 1 a334 1 if (this->isDirty()) { d365 1 a365 1 this->setDirty(false); // Set the clean state d391 1 a391 1 this->setDirty(false); // Set the clean state d422 1 a422 1 this->setDirty(false); // Set the clean state d451 1 a451 1 this->setDirty(false); // Set the clean state to allow close d495 1 a495 1 if (this->isDirty()) { d503 1 a503 1 this->setDirty(false); // Reset data to clean state d507 1 a507 1 this->setDirty(false); // Reset data to clean state d517 1 a517 1 this->setDirty(false); // Reset data to clean state d658 1 a658 1 void Titraqform::dataChanged(void) d660 2 a661 1 setDirty(); // Mark this timesheet dirty, changes pending save d740 1 a740 1 m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(0, sizeof(char), 'E')); d746 1 a746 1 m_pMaintable->setText(nRow, TITRAQ_IDXSTATUS, Statis.replace(0, sizeof(char), 'O')); a749 1 m_pStatbar->message(trUtf8("Refreshed display"), 4000); // Announce result @ 1.67 log @Fix some hard to find bad saving problems, add file extension filter, and make file op exception strings more descriptive. @ text @d719 6 a724 14 if (m_pMaintable->numRows() > 0) { // Field strings to check for validity and process QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS)); QString Textline(m_pMaintable->text(nRow, TITRAQ_IDXLINE)); QString Textuser(m_pMaintable->text(nRow, TITRAQ_IDXUSER)); QString Textguid(m_pMaintable->text(nRow, TITRAQ_IDXGUID)); QString Textcrc(m_pMaintable->text(nRow, TITRAQ_IDXCRC)); QString Textrev(m_pMaintable->text(nRow, TITRAQ_IDXREV)); QString Textdate(m_pMaintable->text(nRow, TITRAQ_IDXDATE)); QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXSTART)); QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXFINISH)); QString Textamount(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); QString Texttask(m_pMaintable->text(nRow, TITRAQ_IDXTASK)); QString Textremark(m_pMaintable->text(nRow, TITRAQ_IDXREMARK)); d726 13 a738 5 // Quick review of data validity, and set pixmaps accordingly if (Textuser.isEmpty() || Textguid.isEmpty() || Textcrc.isEmpty() || Textrev.isEmpty() || Textdate.isEmpty() || Textstart.isEmpty() || Textfinish.isEmpty() || Textamount.isEmpty() || Texttask.isEmpty()) { m_pStatusedit->setPixmap(QPixmap(s_kpcStaterror_xpm)); d741 4 a744 2 else { m_pStatusedit->setPixmap(QPixmap(s_kpcStatokay_xpm)); d748 1 @ 1.66 log @Implement Darueberknallen protection. @ text @d101 1 a101 1 for (int nIter = 0; nIter <= nRows; nIter++) d140 1 a140 1 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, trUtf8(TITRAQ_DATEZERO)); d161 1 a161 1 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, trUtf8(TITRAQ_DATEZERO)); d328 1 a328 1 QString Filestring = QFileDialog::getOpenFileName("/e/dev/as", QString::null, this, trUtf8("Chooser Dialog"), trUtf8("Choose a file to open")); d461 2 a462 1 QString Filestring = QFileDialog::getSaveFileName(QString::null, QString::null, this); @ 1.65 log @Preserve user preferred sort order and don't set dirty flag on renumber ops. @ text @d458 2 d464 14 a477 1 saveFile(); // Finish off by calling the save action @ 1.64 log @Add missing view switch menu item, and use a slightly better display rendering algorythm. @ text @d1259 3 @ 1.63 log @Implemented joined column sorting. Implemented refreshDisplay, and add action to appropriate edit and view menus. @ text @d219 2 a220 1 int nIter = m_pMaintable->numRows(); // Iterate through total rows d224 1 a224 1 while (--nIter >= 0) { d227 1 @ 1.62 log @Implement missing logic for remaining new field linewise load and save ops. @ text @d215 17 d910 15 @ 1.61 log @Smooth out transition from closed to open document state, and add placeholding pixmap. Fixed row add and paste logic to include initialization and validation. Implement cut and past of user data. Fix cut and paste line feed bug. Disable edit controls until first document is created. @ text @d95 6 @ 1.60 log @Better initialization by disabling edit controls until a new document. @ text @d88 2 a89 3 Selection = pClip->text(QClipboard::Clipboard); // Windows and Unix nRows = Selection.contains(QChar('\n')); // How many rows this->addEntry(nRows); // Reuse slot d91 3 a93 1 if (Selection) d95 5 d111 1 d113 8 a120 1 nTotal = Select.bottomRow() - Select.topRow() + 1; d126 15 d147 15 d166 1 a166 11 m_pMaintable->setText(nIter, TITRAQ_IDXLINE, QString::number(nIter)); updateUser(m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); updateGuid("."); updateCrc("."); updateRev("."); updateDate(*m_pDatezero); updateStart(QTime::QTime(0, 0)); updateFinish(QTime::QTime(0, 0)); updateAmount(trUtf8("00:00")); d174 3 d233 1 d246 1 d250 1 d263 1 d279 1 d292 1 d327 12 d353 12 d384 12 a704 8 } // // Update the current status column item // void Titraqform::updateStatus(const QString &Instring) { m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXSTATUS, Instring); @ 1.59 log @Implemented basic validation logic, reflected by pixmaps in both table and edit control. @ text @d197 11 d212 11 d239 11 d599 26 a624 24 // Field strings to check for validity and process QString Textstat(m_pMaintable->text(nRow, TITRAQ_IDXSTATUS)); QString Textline(m_pMaintable->text(nRow, TITRAQ_IDXLINE)); QString Textuser(m_pMaintable->text(nRow, TITRAQ_IDXUSER)); QString Textguid(m_pMaintable->text(nRow, TITRAQ_IDXGUID)); QString Textcrc(m_pMaintable->text(nRow, TITRAQ_IDXCRC)); QString Textrev(m_pMaintable->text(nRow, TITRAQ_IDXREV)); QString Textdate(m_pMaintable->text(nRow, TITRAQ_IDXDATE)); QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXSTART)); QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXFINISH)); QString Textamount(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); QString Texttask(m_pMaintable->text(nRow, TITRAQ_IDXTASK)); QString Textremark(m_pMaintable->text(nRow, TITRAQ_IDXREMARK)); // Quick review of data validity, and set pixmaps accordingly if (Textuser.isEmpty() || Textguid.isEmpty() || Textcrc.isEmpty() || Textrev.isEmpty() || Textdate.isEmpty() || Textstart.isEmpty() || Textfinish.isEmpty() || Textamount.isEmpty() || Texttask.isEmpty()) { m_pStatusedit->setPixmap(QPixmap(s_kpcStaterror_xpm)); m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStaterror_xpm)); } else { m_pStatusedit->setPixmap(QPixmap(s_kpcStatokay_xpm)); m_pMaintable->setPixmap(nRow, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatokay_xpm)); a625 8 } // // Validation overloaded convenience method // void Titraqform::validateData(void) { validateData(m_pMaintable->currentRow(), 0); @ 1.58 log @Added initialization data for new field members, and fixed in place advance logic even more. @ text @d48 3 d120 4 d165 4 d534 1 a534 1 m_pStatusedit->setText(Textstat); d559 40 @ 1.57 log @Fix display of initialized cells, initialize new cells, and add a shift tab event handler. @ text @d117 5 d606 1 a606 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, Dateup.toString(Qt::ISODate)); @ 1.56 log @Render status pixmaps more efficiently and add quote logic to load and save remark column. @ text @d117 4 a120 4 // updateDate(*m_pDatezero); // updateStart(QTime::QTime(0, 0)); // updateFinish(QTime::QTime(0, 0)); // updateAmount(trUtf8("00:00")); d517 14 a530 12 if (!Textstat.isEmpty()) m_pStatusedit->setText(Textstat); if (!Textline.isEmpty()) m_pLineedit->setText(Textline); if (!Textuser.isEmpty()) m_pUseredit->setText(Textuser); if (!Textguid.isEmpty()) m_pGuidedit->setText(Textguid); if (!Textcrc.isEmpty()) m_pCrcedit->setText(Textcrc); if (!Textrev.isEmpty()) m_pRevedit->setText(Textrev); d533 2 d537 2 d541 2 a542 9 if (!Textamount.isNull()) m_pAmount->setText(Textamount); if (!Texttask.isNull()) { // Process task combo box to compress text length // Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash m_pTasks->setCurrentText(Texttask); } if (!Textremark.isNull()) m_pRemark->setText(Textremark); d609 1 a609 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXSTART, Startup.toString(Qt::ISODate)); d617 1 a617 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXFINISH, Finishup.toString(Qt::ISODate)); @ 1.55 log @Implement persistent frame layout and dock positions. @ text @a34 1 #include d37 1 @ 1.54 log @Many layout and preference changes to support more flexibility. @ text @d1069 6 @ 1.53 log @Remove clean state handling to TiTable subclass and generalize add row logic to remove two conditions. @ text @d379 1 a379 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL))) d381 1 a381 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL))) d383 1 a383 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL))) d385 1 a385 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL))) d387 1 a387 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL))) d389 1 a389 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL))) d391 1 a391 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL))) d393 1 a393 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL))) d395 1 a395 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL))) d397 1 a397 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL))) d399 1 a399 1 if (m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXTCOL))) d1022 12 a1033 12 m_pPrefs->setBool(TITRAQ_PREFSTATCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL))); m_pPrefs->setBool(TITRAQ_PREFLCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL))); m_pPrefs->setBool(TITRAQ_PREFUCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXUCOL))); m_pPrefs->setBool(TITRAQ_PREFGCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL))); m_pPrefs->setBool(TITRAQ_PREFCCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL))); m_pPrefs->setBool(TITRAQ_PREFREVCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL))); m_pPrefs->setBool(TITRAQ_PREFDCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL))); m_pPrefs->setBool(TITRAQ_PREFSTARTCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL))); m_pPrefs->setBool(TITRAQ_PREFFCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL))); m_pPrefs->setBool(TITRAQ_PREFACOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL))); m_pPrefs->setBool(TITRAQ_PREFFCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL))); m_pPrefs->setBool(TITRAQ_PREFREMCOL, m_pColspopup->isItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL))); d1039 30 @ 1.52 log @Fixed bug on safely closing unclean documents. @ text @d89 1 a89 1 if (Selection) { a90 2 this->setDirty(true); // Set dirty state } d102 13 a114 31 if (nRows == -1) { // Assume a user selection range Select = m_pMaintable->selection(0); nTotal = Select.bottomRow() - Select.topRow() + 1; // Add a row after selection and focus to the new row if (Select.bottomRow() + 1 != m_pMaintable->numRows()) { // Add upwards m_pMaintable->insertRows(Select.topRow(), nTotal); this->setDirty(true); // Set data to dirty state m_pMaintable->setCurrentCell(Select.topRow(), m_pMaintable->currentColumn()); } else { // Special case on last row add downwards m_pMaintable->insertRows(Select.bottomRow() + 1, nTotal); this->setDirty(true); // Set data to dirty state m_pMaintable->setCurrentCell(Select.bottomRow() + 1, m_pMaintable->currentColumn()); m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please } } else { // Do not count a user selection nTotal = nRows; nCurrent = m_pMaintable->currentRow(); // Add a row after selection and focus to the new row if (nCurrent + 1 != m_pMaintable->numRows()) { // Add upwards m_pMaintable->insertRows(nCurrent, nTotal); this->setDirty(false); // Reset data to clean state m_pMaintable->setCurrentCell(nCurrent, m_pMaintable->currentColumn()); } else { // Special case on last row add downwards m_pMaintable->insertRows(nCurrent + 1, nTotal); this->setDirty(false); // Reset data to clean state m_pMaintable->setCurrentCell(nCurrent + 1, m_pMaintable->currentColumn()); m_pMaintable->ensureCellVisible(m_pMaintable->numRows() - 1, 0); // Scroll please } d147 1 a147 1 this->setDirty(true); // Set data to dirty state d151 1 a151 1 this->setDirty(true); // Set data to dirty state d333 1 a334 1 this->setDirty(false); // Reset data to clean state d337 1 a338 1 this->setDirty(false); // Reset data to clean state d347 1 a348 1 this->setDirty(false); // Reset data to clean state d488 1 a488 1 void Titraqform::dataChanged(int nRow, int nCol) a550 1 setDirty(); // Mark this timesheet dirty, changes pending save a558 1 setDirty(); // Mark this timesheet dirty, changes pending save a566 1 setDirty(); // Mark this timesheet dirty, changes pending save a574 1 setDirty(); // Mark this timesheet dirty, changes pending save a582 1 setDirty(); // Mark this timesheet dirty, changes pending save a590 1 setDirty(); // Mark this timesheet dirty, changes pending save d599 1 a599 2 if (Dateup == *m_pDatezero) { // Complete the already nasty hack setDirty(); // Mark this timesheet dirty, changes pending save d601 1 a601 3 } else { setDirty(); // Mark this timesheet dirty, changes pending save a602 1 } a609 1 setDirty(); // Mark this timesheet dirty, changes pending save a617 1 setDirty(); // Mark this timesheet dirty, changes pending save a626 1 setDirty(); // Mark this timesheet dirty, changes pending save a639 1 setDirty(); // Mark this timesheet dirty, changes pending save a647 1 setDirty(); // Mark this timesheet dirty, changes pending save @ 1.51 log @Implement connections for matrix text fields with edit control widgets. @ text @d189 1 a189 1 case 0: // Save first d203 1 a203 1 case 1: // Don't save first but do new d207 1 a207 1 case 2: // Don't do a new timesheet d506 1 a506 1 // d571 1 d580 1 d589 1 d598 1 d607 1 d616 1 d625 2 a626 1 if (Dateup == *m_pDatezero) // Complete the already nasty hack d628 3 a630 1 else d632 1 d640 1 d649 1 d659 1 d673 1 d682 1 @ 1.50 log @Implement persistent toolbar preferences. @ text @d521 6 d537 12 a550 1 a552 1 a554 1 a556 1 d564 48 @ 1.49 log @Load column view preferences on init, and save them on exit. @ text @d992 5 @ 1.48 log @Fix bottom control layout by detecting first viewable column and adjusting control size accordingly. @ text @d975 20 @ 1.47 log @Add line number and status columns. Make all columns ausblendbar. Activate column menu selectors. @ text @d399 24 a422 12 m_pStatusedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTATUS) - TITRAQ_SPACING + TITRAQ_SPACING / 2); m_pLineedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXLINE) - TITRAQ_SPACING); m_pUseredit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) - TITRAQ_SPACING); m_pGuidedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXGUID) - TITRAQ_SPACING); m_pCrcedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXCRC) - TITRAQ_SPACING); m_pRevedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREV) - TITRAQ_SPACING); m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING); m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING); m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING); m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING); m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING); // m_pRemark->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREMARK) - TITRAQ_SPACING); d425 1 a425 1 m_pStatusedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTATUS) - TITRAQ_SPACING + TITRAQ_SPACING / 2); d464 39 d727 1 a727 1 // Make sure switch take place right away d729 1 d749 1 a749 1 // Make sure switch take place right away d751 1 d771 2 a772 1 // Make sure switch take place right away d793 1 a793 1 // Make sure switch take place right away d795 1 d815 1 a815 1 // Make sure switch take place right away d817 1 d837 1 a837 1 // Make sure switch take place right away d839 1 d859 1 a859 1 // Make sure switch take place right away d861 1 d881 1 a881 1 // Make sure switch take place right away d883 1 d903 1 a903 1 // Make sure switch take place right away d905 1 d925 1 a925 1 // Make sure switch take place right away d927 1 d947 1 a947 1 // Make sure switch take place right away d949 1 d969 1 a969 1 // Make sure switch take place right away d971 1 @ 1.46 log @Now all data fields are in the view table as well. @ text @d37 1 d399 3 a401 1 m_pUseredit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) - TITRAQ_SPACING + TITRAQ_SPACING / 2); d412 6 d419 1 a419 1 m_pUseredit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXUSER) - TITRAQ_SPACING + TITRAQ_SPACING / 2); d664 14 a677 2 Prototype Unimp; Unimp.doMbox(); d685 14 a698 2 Prototype Unimp; Unimp.doMbox(); d706 14 a719 2 Prototype Unimp; Unimp.doMbox(); d727 14 a740 2 Prototype Unimp; Unimp.doMbox(); d748 14 a761 2 Prototype Unimp; Unimp.doMbox(); d769 14 a782 2 Prototype Unimp; Unimp.doMbox(); d790 14 a803 2 Prototype Unimp; Unimp.doMbox(); d811 14 a824 2 Prototype Unimp; Unimp.doMbox(); d832 14 a845 2 Prototype Unimp; Unimp.doMbox(); d853 14 a866 2 Prototype Unimp; Unimp.doMbox(); d874 14 a887 2 Prototype Unimp; Unimp.doMbox(); d895 14 a908 2 Prototype Unimp; Unimp.doMbox(); @ 1.45 log @In order to prepare for missing data format implementations, replace last globals with constants, remove unused constants, and remove incomplete task truncating until a better solution is found. @ text @d398 5 a402 1 m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); d409 12 d422 1 a422 1 m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); d651 9 d669 9 d687 1 a687 1 // View menu show Dates column d689 1 a689 1 void Titraqform::showDatecol(void) d696 1 a696 1 // View menu show Users column d698 1 a698 1 void Titraqform::showUsercol(void) d705 1 a705 1 // View menu show Tasks column d707 1 a707 1 void Titraqform::showTaskcol(void) d714 1 a714 1 // View menu show Start time column d723 1 a723 1 // View menu show Finish time column d735 9 @ 1.44 log @Changed key bindings and exit without save logic, removed error messages on new document generation. @ text @d442 1 a442 1 QRegExp Shorten("/(\\w+)$"); // For stripping prefix off the current task d468 1 a468 1 Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash @ 1.43 log @Completed dirty data state conditionals. @ text @d190 9 d211 8 a218 1 else { // Data is already up to date a456 2 else m_pDateedit->setDate(*m_pDatezero); a459 2 else m_pStarttime->setTime(QTime::QTime(0, 0)); a462 2 else m_pEndtime->setTime(QTime::QTime(0, 0)); d464 2 a465 1 m_pAmount->setText(Textamount); d467 4 a470 3 // Process the task combo box to compress text length Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash m_pTasks->setCurrentText(Texttask); d472 2 a473 1 m_pRemark->setText(Textremark); @ 1.42 log @Complete introduction of dirty data state handling, and repair build also. @ text @d88 1 a88 1 if (Selection) d90 2 d109 1 d114 1 d125 1 d130 1 d166 1 d168 1 a168 1 else // Special case to handle removing of only row or last row d170 2 d191 1 d195 1 d202 1 a202 1 else // Data is already up to date d204 2 a205 2 this->setDirty(false); // Reset data to clean state d209 1 a209 1 // Choose a file using a handy file dialog d211 1 a211 1 void Titraqform::chooseFile(void) d213 1 d215 1 d217 56 a272 13 m_szFilename->operator=(Filestring); m_pMaintable->setNumRows(0); // Clear out old data QFile Filetemp(Filestring); // File to load try { loadData(Filetemp); // Pass to helper method } catch (Genexcept& Genex) { Genex.reportErr(); } // Reset and give output to main window this->setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); this->setDirty(false); // Set the clean state d337 1 d341 1 d349 1 a349 1 else // Data is already up to date d351 2 a352 2 this->setDirty(false); // Reset data to clean state @ 1.41 log @Flush dirty state saving changes without considering broken build. @ text @d193 2 d293 2 a355 1 // d357 2 a358 1 void Titraqform::updSizes(int nSection, int nOldsize, int nNewsize) d360 1 a360 31 switch (nSection) { case TITRAQ_IDXALLCTRLS: m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING); m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING); m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING); m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING); // m_pRemark->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXREMARK) - TITRAQ_SPACING); break; case TITRAQ_IDXDATE: m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); break; case TITRAQ_IDXSTART: m_pStarttime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXSTART) - TITRAQ_SPACING); break; case TITRAQ_IDXFINISH: m_pEndtime->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXFINISH) - TITRAQ_SPACING); break; case TITRAQ_IDXAMOUNT: m_pAmount->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXAMOUNT) - TITRAQ_SPACING); break; case TITRAQ_IDXTASK: m_pTasks->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXTASK) - TITRAQ_SPACING); break; case TITRAQ_IDXREMARK: // m_pRemark->setFixedWidth(nNewsize); break; default: throw Genexcept("Unrecognized main window column header."); break; } @ 1.40 log @Implement multirow edition including complete cut copy and paste. @ text @d170 23 a192 1 m_pMaintable->setNumRows(0); // Get rid of any data in table d267 2 d270 18 a287 3 if (!this->isDirty()) { pClosit->accept(); return; d289 1 a289 7 // Ask user to acknowlege a possibly data-damaging close event switch(QMessageBox::information(this, "OSSP titraq", trUtf8("The document has been\nchanged since the last save.")), trUtf8("Save Now"), trUtf8("Cancel"), trUtf8("Leave Anyway"), 0, 1) { case 0: saveFile(); a290 9 break; case 1: default: // Just for sanity pClosit->ignore(); break; case 2: pClosit->accept(); break; } d315 38 @ 1.39 log @Whoops, repaired reverse selection and then delete operation. @ text @d80 1 a83 1 this->addEntry(); // Reuse slot d85 2 d89 1 a89 1 setRowdata(Selection); // Use accessor d95 1 a95 1 void Titraqform::addEntry(void) d97 17 a113 10 int nCurrentrow = 0; // Add a row after selection and focus to the new row if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) { // Add upwards m_pMaintable->insertRows(m_pMaintable->currentRow()); m_pMaintable->setCurrentCell(m_pMaintable->currentRow() - 2, m_pMaintable->currentColumn()); updateDate(*m_pDatezero); updateStart(QTime::QTime(0, 0)); updateFinish(QTime::QTime(0, 0)); updateAmount(trUtf8("00:00")); d115 13 a127 7 else { // Special case on last row add downwards m_pMaintable->insertRows(m_pMaintable->currentRow() + 1); m_pMaintable->setCurrentCell(m_pMaintable->currentRow() + 1, m_pMaintable->currentColumn()); updateDate(*m_pDatezero); updateStart(QTime::QTime(0, 0)); updateFinish(QTime::QTime(0, 0)); updateAmount(trUtf8("00:00")); d130 5 d146 1 a146 1 void Titraqform::delEntry(void) @ 1.38 log @Enable multirow deletions. @ text @d138 1 a138 1 m_pMaintable->setCurrentCell(m_pMaintable->currentRow() + 1, m_pMaintable->currentColumn()); @ 1.37 log @Add cross application edition. @ text @d128 8 d139 1 a139 1 m_pMaintable->removeRow(m_pMaintable->currentRow() - 1); d142 1 a142 1 m_pMaintable->removeRow(m_pMaintable->currentRow()); @ 1.36 log @Various edition repairs and improvements. @ text @d71 2 a72 1 pClip->setText(Selection, QClipboard::Clipboard); d84 1 a84 1 Selection = pClip->text(); // Copy data @ 1.35 log @Implemented row by row editing, introduced working cut copy and paste methods. @ text @d381 5 d402 2 d409 5 a413 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXTASK, m_pTasks->currentText()); @ 1.34 log @Fix row add logic, and automatically fill in date and time values. @ text @d36 1 d54 2 a55 2 Prototype Unimp; Unimp.doMbox(); d63 9 a71 2 Prototype Unimp; Unimp.doMbox(); d79 8 a86 2 Prototype Unimp; Unimp.doMbox(); @ 1.33 log @Correct dynamic refresh behaviour of table data from edit widgets. @ text @d80 2 d83 1 a83 1 if (m_pMaintable->currentRow() + 1 != m_pMaintable->numRows()) { d85 5 a89 1 m_pMaintable->setCurrentCell(m_pMaintable->currentRow() - 3, m_pMaintable->currentColumn()); d91 2 a92 2 else // Special case to handle adding an only row or last row m_pMaintable->insertRows(m_pMaintable->currentRow() + 1); { d94 4 d331 4 a334 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXDATE, Dateup.toString(Qt::ISODate)); @ 1.32 log @Implement rudimentary bottom widget edit connections to main table text cells. @ text @d343 1 a343 1 void Titraqform::updateAmount(int nAmountup) d345 2 a346 1 m_pMaintable->setText(m_pMaintable->currentRow(), TITRAQ_IDXAMOUNT, trUtf8("%1").arg(nAmountup)); @ 1.31 log @Added TiTable object to MOC Mapping, added normal view menu again, added ugly edition state member flag, fixed double click table header resize bug, added auto advance in place edit feature. @ text @d317 48 @ 1.30 log @Added GUID generation logic, and build configuration changes to support it. @ text @d232 1 d289 3 d340 9 d353 2 a354 2 // All other view types are disabled until implemention, so this // body can remain empty, causing nothing to happen on selection. d362 2 a363 2 Prototype Unimp; Unimp.doMbox(); @ 1.29 log @Logic changes to correct the buildconf after CVS restructure. @ text @d89 7 @ 1.28 log @Massive build configuration preparation, added boilerplate header text, and cleaned up whitespace. @ text @d38 4 a41 4 #include "titraq.h" // Main classes #include "titrex.h" // Exception classes #include "titabitem.h" // For our custom table items #include "generic.h" // Generic classes d44 2 a45 2 #include "gfx/cwlogo.xpm" // static const char *s_kpcCwlogo_xpm[] #include "gfx/ossplogo.xpm" // static const char *s_kpcOssplogo_xpm[] @ 1.27 log @Column adjustment. @ text @d1 31 @ 1.26 log @Fixed current file save logic, smoothed edit controls, and corrected name of edition layout. @ text @d204 1 a204 1 m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2 + 1); d212 1 a212 1 m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2 + 1); @ 1.25 log @Added eventhandler to catch illegal double clicks, minimized layout of edition controls, changes to slot arrangement. @ text @d89 1 d204 1 a204 1 m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); d212 1 a212 1 m_pDateedit->setFixedWidth(m_pMaintable->horizontalHeader()->sectionSize(TITRAQ_IDXDATE) - TITRAQ_SPACING + TITRAQ_SPACING / 2); @ 1.24 log @Implement in place editing, with intuitive error safety features. @ text @d197 38 d274 1 a274 1 // Confirm any recent editions on a single row @ 1.23 log @Implemented edition controls, corrected amount formatting, and corrected file format saving. @ text @d187 10 @ 1.22 log @Corrected add row on empty table special case, and added an ugly hack to allow for invalid zero dates. @ text @d195 2 a196 2 QString Textstart(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); QString Textfinish(m_pMaintable->text(nRow, TITRAQ_IDXAMOUNT)); d230 7 @ 1.21 log @Doch, use a push button to confirm edition of a task tuple. @ text @d16 1 d79 1 a79 1 m_pMaintable->setNumRows(0); // Get rid of any data in table d204 1 a204 1 m_pDateedit->setDate(QDate::currentDate()); @ 1.20 log @Remove all push button widgets, since the enhanced edit tool has the same functionality built in. Also remove the writeData callback, to favor a better approach. @ text @d225 7 d245 2 a246 2 Prototype Unimp; Unimp.doMbox(); @ 1.19 log @Toolbar showing and hiding on demand. @ text @a73 9 // Write current data to a meta device // void Titraqform::writeEntry(void) { Prototype Unimp; Unimp.doMbox(); } // @ 1.18 log @Improved date and time processing and validation, including missing or defaults values. @ text @d202 6 a207 6 QString Textdate(m_pMaintable->text(nRow, TITRAQ_INDEXDATE)); QString Textstart(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT)); QString Textfinish(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT)); QString Textamount(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT)); QString Texttask(m_pMaintable->text(nRow, TITRAQ_INDEXTASK)); QString Textremark(m_pMaintable->text(nRow, TITRAQ_INDEXREMARK)); d265 8 a272 2 Prototype Unimp; Unimp.doMbox(); d280 8 a287 2 Prototype Unimp; Unimp.doMbox(); d295 8 a302 2 Prototype Unimp; Unimp.doMbox(); @ 1.17 log @Corrected add entry logic, and implemented remove entry logic. @ text @a47 4 // // Add a row to end of table and focuses to it // m_pMaintable->setNumRows(m_pMaintable->numRows() + 1); // m_pMaintable->setCurrentCell(m_pMaintable->numRows(), 0); d211 2 d216 2 d221 2 d224 1 a224 2 if (!Textamount.isEmpty()) m_pAmount->setText(Textamount); d227 1 a227 1 Texttask.remove(0, Shorten.search(Texttask) + 1); // Strip leading slash d230 1 a230 2 if (!Textremark.isEmpty()) m_pRemark->setText(Textremark); @ 1.16 log @Implement rudimentary add entry. @ text @a15 1 d48 13 a60 3 // Adds a new row to end of table and focuses to it m_pMaintable->setNumRows(m_pMaintable->numRows() + 1); m_pMaintable->setCurrentCell(m_pMaintable->numRows(), 0); d68 7 a74 2 Prototype Unimp; Unimp.doMbox(); @ 1.15 log @Add several missing edit actions, icons for them, and restructure view menu according to thl+ms mui+gui brainstorming. @ text @d49 3 a51 9 Prototype Unimp; Unimp.doMbox(); // if (!pTable->text().isEmpty()) { // QTableRow *pRow = new QTableRow; // pRow->setText(0, NULL); // pRow->setText(1, NULL); // pRow->setText(2, NULL); // pRow->setText(3, NULL); // } @ 1.14 log @Add edit toolbar to eventually replace bottom button matrix, and correct edit control update logic to avoid needlessly updating controls from empty fields. @ text @d18 28 a45 1 // Add a blank row entry to the current data window d61 1 a61 1 // Delete a row entry from the current data window a181 27 // Edit menu cut // void Titraqform::cut(void) { Prototype Unimp; Unimp.doMbox(); } // // Edit menu copy // void Titraqform::copy(void) { Prototype Unimp; Unimp.doMbox(); } // // Edit menu paste // void Titraqform::paste(void) { Prototype Unimp; Unimp.doMbox(); } // d235 19 a253 1 // View menu normal d255 1 a255 1 void Titraqform::normalView(void) d262 82 a343 1 // View menu editing d345 1 a345 1 void Titraqform::editingView(void) d352 1 a352 1 // View menu timing d354 1 a354 1 void Titraqform::timingView(void) @ 1.13 log @Add AmountBox class to introduce missing functionality from QSpinBox, and implement most edit control updates. @ text @d56 1 a56 2 // The only way in Qt 3.X to clear rows efficiently m_pMaintable->setNumRows(0); // Get rid of any data in table a194 1 QString Tasktext; // For searching through prefixed task text d197 19 a215 4 m_pDateedit->setDate(QDate::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXDATE), Qt::ISODate)); m_pStarttime->setTime(QTime::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT), Qt::ISODate)); m_pEndtime->setTime(QTime::fromString(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT), Qt::ISODate)); m_pAmount->setText(m_pMaintable->text(nRow, TITRAQ_INDEXAMOUNT)); d218 2 a219 2 Tasktext = m_pMaintable->text(nRow, TITRAQ_INDEXTASK); Tasktext.remove(0, Shorten.search(Tasktext) + 1); // Add one to strip leading slash d221 2 a222 2 m_pTasks->setCurrentText(Tasktext); m_pRemark->setText(m_pMaintable->text(nRow, TITRAQ_INDEXREMARK)); @ 1.12 log @Connection of edit signals to prototype. @ text @d3 2 d194 1 a194 1 void Titraqform::updEdit(int, int) d196 14 a209 2 Prototype Unimp; Unimp.doMbox(); @ 1.11 log @Implemented table data saving to a local file, and began new accessor method group with setDirty(). @ text @d190 9 @ 1.10 log @Some final fine tunes before putting the pig to bed. @ text @d73 2 a74 1 setCaption(Filestring); d76 1 d95 5 a99 3 if (!Filetemp.open(IO_WriteOnly)) { m_pStatbar->message(QString(trUtf8("Could not write to %1")).arg(*m_szFilename), 4000); return; d101 4 a104 11 // Serialize file contents and write to text line QTextStream Filestream(&Filetemp); Filestream << m_pRemark->text(); Filetemp.close(); // Reset the text line, and give output to main window m_pRemark->setEdited(FALSE); setCaption(*m_szFilename); m_pStatbar->message(QString(trUtf8("File %1 saved")).arg(*m_szFilename), 4000); m_bDirt = false; // Set the clean state to allow a close operation a150 8 } // // Check to see if state has changed since last save // bool Titraqform::isDirty(void) { return m_bDirt; @ 1.9 log @Improved account table viewing and movement, fixed whatsthis text and images, refitted columns to new text dimensions. @ text @d55 1 a55 2 m_pMaintable->setNumRows(0); // Get rid of any data in table m_pMaintable->setNumRows(1); // ...and then add them back in d63 1 a63 1 QString Filestring = QFileDialog::getOpenFileName("/export/home/mschloh/tmp/bifftest/ms.txt", QString::null, this, trUtf8("Chooser Dialog"), trUtf8("Choose a file to open")); @ 1.8 log @Added exceptions to data ops, completed main static file loading logic, and removed hard coded table limits. @ text @d55 2 a56 2 m_pMaintable->setNumRows(0); // Get rid of any data in table m_pMaintable->setNumRows(g_knBlocks); // ...and then add them back in @ 1.7 log @Start using real AS data, correct load logic, and move data operations to tidatops. @ text @d6 2 d54 3 a56 4 Prototype Unimp; Unimp.doMbox(); // Titraqform *pNewform = new Titraqform; // pNewform->show(); d66 8 a73 2 QFile Filetemp(Filestring); // File to load loadData(Filetemp); // Pass to helper method @ 1.6 log @Consistency fix, and repair slots for opening and saving to local files. @ text @a1 1 #include d63 7 a69 3 QString Filestring = QFileDialog::getOpenFileName("/e/dev/as", QString::null, this, trUtf8("Chooser Dialog"), trUtf8("Choose a file to open")); if (!Filestring.isEmpty()) loadData(Filestring); a71 17 } // // Load accounting data into main window // void Titraqform::loadData(const QString &Filestring) { QFile Filetemp(Filestring); // File to load if (!Filetemp.open(IO_ReadOnly)) // Need a wrapped exception here return; QTextStream Textstream(&Filetemp); // Convert the file contents to a stream m_pRemark->setText(Textstream.read()); m_pRemark->setEdited(false); setCaption(Filestring); m_pStatbar->message(trUtf8("Loaded document ") + Filestring, 4000); @ 1.5 log @Save time and resources by loading pixmaps on demand only. Removed some icons to unclutter the screen estate. @ text @d31 1 a31 1 // Choose a file using a handy file dialog d62 1 a62 1 void Titraqform::choose(void) d64 1 a64 1 QString Filestring = QFileDialog::getOpenFileName(QString::null, QString::null, this); d66 1 a66 1 load(Filestring); d74 1 a74 1 void Titraqform::load(const QString &Filestring) d91 1 a91 1 void Titraqform::save(void) d99 1 a99 2 // Try to read the status text, and write it to a file QString Statustext = m_pRemark->text(); d108 1 a108 1 Filestream << Statustext; d127 1 a127 2 m_pRemark->setText(*m_szFilename); save(); // Finish off by calling the save action d151 1 a151 1 save(); @ 1.4 log @Added edit and view drop down menus, enhanced existing ones. @ text @d9 4 d247 9 d258 1 a258 1 void Titraqform::about(void) d270 1 a270 1 pCwmsg->setIconPixmap(QPixmap(*m_pCwlogo)); d290 1 a290 1 pOsspmsg->setIconPixmap(QPixmap(*m_pOssplogo)); @ 1.3 log @Radical optimization of widget initialization and refresh. Removal of excess baggage in daily table. Addition of editing section. Apply new image logic. Reworked layouts. Improved task selection. @ text @d171 72 @ 1.2 log @Add CW logo and rework message boxes under the help menu. @ text @d78 2 a79 2 m_pStatus->setText(Textstream.read()); m_pStatus->setEdited(false); d96 1 a96 1 QString Statustext = m_pStatus->text(); d109 1 a109 1 m_pStatus->setEdited(FALSE); d124 1 a124 1 m_pStatus->setText(*m_szFilename); d185 1 a185 1 pCwmsg->setIconPixmap(QPixmap(*m_pCwicon)); d205 1 a205 1 pOsspmsg->setIconPixmap(QPixmap(*m_pOsspicon)); @ 1.1 log @Move slot logic to its own file, making the pig widget even slimmer. @ text @d175 2 a176 2 QMessageBox::about(this, "OSSP titraq", trUtf8("OSSP titraq is a time and task-based\n" d178 9 a186 1 "nwork-like punch card and time tracker.")); d194 2 a195 2 QMessageBox::about(this, "OSSP", trUtf8("The open source software project (OSSP) is\n" d200 7 a206 1 "servers and development tools.")); @