1 // |
1 // |
2 // OSSP asgui - Accounting system graphical user interface |
2 // OSSP asgui - Accounting system graphical user interface |
3 // Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/) |
3 // Copyright (c) 2002-2008 The OSSP Project (http://www.ossp.org/) |
4 // Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com> |
4 // Copyright (c) 2002-2008 Ralf S. Engelschall <rse@engelschall.com> |
5 // Copyright (c) 2002-2004 Michael Schloh von Bennewitz <michael@schloh.com> |
5 // Copyright (c) 2002-2008 Michael Schloh von Bennewitz <michael@schloh.com> |
6 // Copyright (c) 2002-2004 Cable & Wireless Telecommunications Services GmbH |
6 // Copyright (c) 2002-2008 Cable & Wireless Telecommunications Services GmbH |
7 // |
7 // |
8 // This file is part of OSSP asgui, an accounting system graphical user |
8 // This file is part of OSSP asgui, an accounting system graphical user |
9 // interface which can be found at http://www.ossp.org/pkg/tool/asgui/. |
9 // interface which can be found at http://asgui.europalab.com/. |
10 // |
10 // |
11 // Permission to use, copy, modify, and distribute this software for |
11 // Permission to use, copy, modify, and distribute this software for |
12 // any purpose with or without fee is hereby granted, provided that |
12 // any purpose with or without fee is hereby granted, provided that |
13 // the above copyright notice and this permission notice appear in all |
13 // the above copyright notice and this permission notice appear in all |
14 // copies. |
14 // copies. |
27 // SUCH DAMAGE. |
27 // SUCH DAMAGE. |
28 // |
28 // |
29 // as_slot.cpp: ISO C++ implementation |
29 // as_slot.cpp: ISO C++ implementation |
30 // |
30 // |
31 |
31 |
|
32 #define QT3_SUPPORT |
|
33 |
32 // system headers |
34 // system headers |
33 #include <memory> |
35 #include <memory> |
34 #include <cstring> |
36 #include <cstring> |
35 |
37 |
36 // Qt headers |
38 // Qt headers |
37 #include <qfiledialog.h> |
39 #include <q3filedialog.h> |
38 #include <qcombobox.h> |
40 #include <qcombobox.h> |
39 #include <qclipboard.h> |
41 #include <qclipboard.h> |
40 #include <qmenudata.h> |
42 #include <qmenudata.h> |
41 #include <qdatastream.h> |
43 #include <qdatastream.h> |
42 #include <qstatusbar.h> |
44 #include <qstatusbar.h> |
43 #include <qaction.h> |
45 #include <qaction.h> |
44 #include <qpopupmenu.h> |
46 #include <q3popupmenu.h> |
45 |
47 |
46 // Qt style headers |
48 // Qt style headers |
47 #include <qcdestyle.h> |
49 #include <qcdestyle.h> |
48 #include <qsgistyle.h> |
50 #include <qcleanlooksstyle.h> |
|
51 #include <qcommonstyle.h> |
49 #include <qmotifstyle.h> |
52 #include <qmotifstyle.h> |
50 #include <qmotifplusstyle.h> |
53 #include <qplastiquestyle.h> |
51 #include <qplatinumstyle.h> |
54 #include <qwindowscestyle.h> |
|
55 #include <qwindowsmobilestyle.h> |
52 #include <qwindowsstyle.h> |
56 #include <qwindowsstyle.h> |
|
57 #include <qwindowsvistastyle.h> |
|
58 #include <qwindowsxpstyle.h> |
|
59 |
|
60 //Added by qt3to4: |
|
61 #include <QPixmap> |
|
62 #include <QCloseEvent> |
|
63 #include <Q3TextStream> |
|
64 #include <Q3MemArray> |
|
65 #include <Q3Action> |
53 |
66 |
54 // User interface |
67 // User interface |
55 #include "as_const.h" // Application constants |
68 #include "as_const.h" // Application constants |
56 #include "as_except.h" // Exception classes |
69 #include "as_except.h" // Exception classes |
57 #include "as_tableitem.h" // For our custom table items |
70 #include "as_tableitem.h" // For our custom table items |
120 QString Selection; // Will receive the clipboard text |
133 QString Selection; // Will receive the clipboard text |
121 QClipboard *pClip = NULL; // Will reference the global clipboard |
134 QClipboard *pClip = NULL; // Will reference the global clipboard |
122 |
135 |
123 pClip = QApplication::clipboard(); // Prime the clips |
136 pClip = QApplication::clipboard(); // Prime the clips |
124 Selection = pClip->text(QClipboard::Clipboard); // Windows and Unix |
137 Selection = pClip->text(QClipboard::Clipboard); // Windows and Unix |
125 nRows = Selection.contains(QChar('\n')); // How many rows |
138 nRows = Selection.count(QChar('\n')); // How many rows |
126 if (Selection != NULL && nRows > 0) { // Ignore empty clipboards |
139 if (Selection.isNull() && nRows > 0) { // Ignore empty clipboards |
127 this->addEntry(nRows); // Reuse slot |
140 this->addEntry(nRows); // Reuse slot |
128 setRowdata(Selection); // Use accessor |
141 setRowdata(Selection); // Use accessor |
129 |
142 |
130 // Update line numbers for this new row and all subsequent rows |
143 // Update line numbers for this new row and all subsequent rows |
131 for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++) |
144 for (int nIter = m_pMaintable->currentRow(); nIter < m_pMaintable->numRows(); nIter++) |
145 // |
158 // |
146 // Append a blank row entry |
159 // Append a blank row entry |
147 // |
160 // |
148 void Titraqform::addEntry(int nRows) |
161 void Titraqform::addEntry(int nRows) |
149 { |
162 { |
150 QTableSelection Select; // Highlighted text |
163 Q3TableSelection Select; // Highlighted text |
151 int nTotal = 0; // Total row select |
164 int nTotal = 0; // Total row select |
152 int nCurrent = 0; // Current row |
165 int nCurrent = 0; // Current row |
153 std::auto_ptr<AS::Uuid> pGuid(new AS::Uuid); // For GUID production |
166 std::auto_ptr<AS::Uuid> pGuid(new AS::Uuid); // For GUID production |
154 |
167 |
155 // Decide how many rows to add |
168 // Decide how many rows to add |
178 for (int nIter = 0; nIter < nTotal; nIter++) { |
191 for (int nIter = 0; nIter < nTotal; nIter++) { |
179 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W'))); |
192 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W'))); |
180 m_pMaintable->setPixmap(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm)); |
193 m_pMaintable->setPixmap(Select.topRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm)); |
181 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); |
194 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); |
182 pGuid->genId(); |
195 pGuid->genId(); |
183 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, pGuid->getString()); |
196 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXGUID, QString::fromStdString(pGuid->getString())); |
184 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "0"); // 0 = invalid entry |
197 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXCRC, "0"); // 0 = invalid entry |
185 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "0"); // Entry not revised |
198 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXREV, "0"); // Entry not revised |
186 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); |
199 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); |
187 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTART, "00:00"); |
200 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXSTART, "00:00"); |
188 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXFINISH, "00:00"); |
201 m_pMaintable->setText(Select.topRow() + nIter, TITRAQ_IDXFINISH, "00:00"); |
208 for (int nIter = 1; nIter <= nTotal; nIter++) { |
221 for (int nIter = 1; nIter <= nTotal; nIter++) { |
209 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W'))); |
222 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QString(QChar('W'))); |
210 m_pMaintable->setPixmap(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm)); |
223 m_pMaintable->setPixmap(Select.bottomRow() + nIter, TITRAQ_IDXSTATUS, QPixmap(s_kpcStatwarn_xpm)); |
211 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); |
224 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXUSER, m_pPrefs->getString(TITRAQ_PREFUSER, TITRAQ_DEFUSER)); |
212 pGuid->genId(); |
225 pGuid->genId(); |
213 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, pGuid->getString()); |
226 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXGUID, QString::fromStdString(pGuid->getString())); |
214 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, "0"); |
227 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXCRC, "0"); |
215 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, "0"); |
228 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXREV, "0"); |
216 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); |
229 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXDATE, QDate::currentDate().toString(Qt::ISODate)); |
217 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTART, "00:00"); |
230 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXSTART, "00:00"); |
218 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXFINISH, "00:00"); |
231 m_pMaintable->setText(Select.bottomRow() + nIter, TITRAQ_IDXFINISH, "00:00"); |
267 // |
280 // |
268 // Delete a row entry |
281 // Delete a row entry |
269 // |
282 // |
270 void Titraqform::delEntry(int nRows) |
283 void Titraqform::delEntry(int nRows) |
271 { |
284 { |
272 QTableSelection Select = m_pMaintable->selection(0); // Highlighted text |
285 Q3TableSelection Select = m_pMaintable->selection(0); // Highlighted text |
273 int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total row select |
286 int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total row select |
274 QMemArray<int> Rowselect(nTotal); // Row array |
287 Q3MemArray<int> Rowselect(nTotal); // Row array |
275 |
288 |
276 // Calculate rows to delete from selection highlight |
289 // Calculate rows to delete from selection highlight |
277 for (int nIter = 0; nIter < nTotal; ++nIter) |
290 for (int nIter = 0; nIter < nTotal; ++nIter) |
278 Rowselect[nIter] = Select.topRow() + nIter; |
291 Rowselect[nIter] = Select.topRow() + nIter; |
279 |
292 |
422 QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); |
435 QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); |
423 if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) |
436 if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) |
424 Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); |
437 Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); |
425 |
438 |
426 // This dialog asks which file the user wants to open |
439 // This dialog asks which file the user wants to open |
427 QString Filestring = QFileDialog::getOpenFileName(Openas, |
440 QString Filestring = Q3FileDialog::getOpenFileName(Openas, |
428 trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), |
441 trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), |
429 this, trUtf8("ChooserDialog"), trUtf8("Choose a file to open"), NULL, false); |
442 this, trUtf8("ChooserDialog"), trUtf8("Choose a file to open"), NULL, false); |
430 |
443 |
431 // We might have a filename to work on, so do something with it |
444 // We might have a filename to work on, so do something with it |
432 if (!Filestring.isEmpty()) { |
445 if (!Filestring.isEmpty()) { |
502 QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); |
515 QString Openas = m_pPrefs->getString(TITRAQ_PREFASDIR, TITRAQ_DEFASDIR); |
503 if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) |
516 if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) |
504 Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); |
517 Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); |
505 |
518 |
506 // And then get the name of the selected file to save to |
519 // And then get the name of the selected file to save to |
507 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); |
520 QString Filestring = Q3FileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false); |
508 if (!Filestring.isEmpty()) { |
521 if (!Filestring.isEmpty()) { |
509 if (QFile::exists(Filestring)) { |
522 if (QFile::exists(Filestring)) { |
510 nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) |
523 nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) |
511 + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), |
524 + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), |
512 trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); |
525 trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); |
549 if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) |
562 if (Openas.startsWith(TITRAQ_HOMEDIRTOK)) |
550 Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); |
563 Openas = QDir::homeDirPath() + Openas.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); |
551 |
564 |
552 nResult = 1; // We loop on this dialog only if an indecisive user |
565 nResult = 1; // We loop on this dialog only if an indecisive user |
553 while (nResult > 0) { // is hesitant to overwrite a file over and over again |
566 while (nResult > 0) { // is hesitant to overwrite a file over and over again |
554 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); |
567 QString Filestring = Q3FileDialog::getSaveFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false); |
555 if (!Filestring.isEmpty()) { |
568 if (!Filestring.isEmpty()) { |
556 if (QFile::exists(Filestring)) { |
569 if (QFile::exists(Filestring)) { |
557 nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) |
570 nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) |
558 + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), |
571 + ' ' + asgui_version.v_short, trUtf8(TITRAQ_OVERWRITE), |
559 trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); |
572 trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); |
1359 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL), true); |
1372 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTATCOL), true); |
1360 m_pStatusedit->show(); |
1373 m_pStatusedit->show(); |
1361 } |
1374 } |
1362 |
1375 |
1363 // Make sure switch take place right away and sizes are handled |
1376 // Make sure switch take place right away and sizes are handled |
1364 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTATCOL)); |
1377 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTATCOL)); |
1365 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1378 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1366 } |
1379 } |
1367 |
1380 |
1368 // |
1381 // |
1369 // View menu show line numbers column |
1382 // View menu show line numbers column |
1381 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL), true); |
1394 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXLCOL), true); |
1382 m_pLineedit->show(); |
1395 m_pLineedit->show(); |
1383 } |
1396 } |
1384 |
1397 |
1385 // Make sure switch take place right away and sizes are handled |
1398 // Make sure switch take place right away and sizes are handled |
1386 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXLCOL)); |
1399 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXLCOL)); |
1387 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1400 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1388 } |
1401 } |
1389 |
1402 |
1390 // |
1403 // |
1391 // View menu show users column |
1404 // View menu show users column |
1404 m_pUseredit->show(); |
1417 m_pUseredit->show(); |
1405 } |
1418 } |
1406 |
1419 |
1407 // Make sure switch take place right away and sizes are handled |
1420 // Make sure switch take place right away and sizes are handled |
1408 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1421 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1409 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXUCOL)); |
1422 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXUCOL)); |
1410 } |
1423 } |
1411 |
1424 |
1412 // |
1425 // |
1413 // View menu show GUIDs column |
1426 // View menu show GUIDs column |
1414 // |
1427 // |
1425 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL), true); |
1438 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXGCOL), true); |
1426 m_pGuidedit->show(); |
1439 m_pGuidedit->show(); |
1427 } |
1440 } |
1428 |
1441 |
1429 // Make sure switch take place right away and sizes are handled |
1442 // Make sure switch take place right away and sizes are handled |
1430 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXGCOL)); |
1443 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXGCOL)); |
1431 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1444 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1432 } |
1445 } |
1433 |
1446 |
1434 // |
1447 // |
1435 // View menu show CRC column |
1448 // View menu show CRC column |
1447 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL), true); |
1460 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXCCOL), true); |
1448 m_pCrcedit->show(); |
1461 m_pCrcedit->show(); |
1449 } |
1462 } |
1450 |
1463 |
1451 // Make sure switch take place right away and sizes are handled |
1464 // Make sure switch take place right away and sizes are handled |
1452 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXCCOL)); |
1465 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXCCOL)); |
1453 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1466 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1454 } |
1467 } |
1455 |
1468 |
1456 // |
1469 // |
1457 // View menu show Rev column |
1470 // View menu show Rev column |
1469 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL), true); |
1482 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREVCOL), true); |
1470 m_pRevedit->show(); |
1483 m_pRevedit->show(); |
1471 } |
1484 } |
1472 |
1485 |
1473 // Make sure switch take place right away and sizes are handled |
1486 // Make sure switch take place right away and sizes are handled |
1474 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREVCOL)); |
1487 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREVCOL)); |
1475 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1488 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1476 } |
1489 } |
1477 |
1490 |
1478 // |
1491 // |
1479 // View menu show dates column |
1492 // View menu show dates column |
1491 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL), true); |
1504 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXDCOL), true); |
1492 m_pDateedit->show(); |
1505 m_pDateedit->show(); |
1493 } |
1506 } |
1494 |
1507 |
1495 // Make sure switch take place right away and sizes are handled |
1508 // Make sure switch take place right away and sizes are handled |
1496 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXDCOL)); |
1509 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXDCOL)); |
1497 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1510 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1498 } |
1511 } |
1499 |
1512 |
1500 // |
1513 // |
1501 // View menu show start time column |
1514 // View menu show start time column |
1513 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL), true); |
1526 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL), true); |
1514 m_pStarttime->show(); |
1527 m_pStarttime->show(); |
1515 } |
1528 } |
1516 |
1529 |
1517 // Make sure switch take place right away and sizes are handled |
1530 // Make sure switch take place right away and sizes are handled |
1518 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL)); |
1531 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL)); |
1519 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1532 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1520 } |
1533 } |
1521 |
1534 |
1522 // |
1535 // |
1523 // View menu show finish time column |
1536 // View menu show finish time column |
1535 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL), true); |
1548 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXFCOL), true); |
1536 m_pEndtime->show(); |
1549 m_pEndtime->show(); |
1537 } |
1550 } |
1538 |
1551 |
1539 // Make sure switch take place right away and sizes are handled |
1552 // Make sure switch take place right away and sizes are handled |
1540 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXFCOL)); |
1553 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXFCOL)); |
1541 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1554 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1542 } |
1555 } |
1543 |
1556 |
1544 // |
1557 // |
1545 // View menu show Amounts column |
1558 // View menu show Amounts column |
1557 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL), true); |
1570 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXACOL), true); |
1558 m_pAmount->show(); |
1571 m_pAmount->show(); |
1559 } |
1572 } |
1560 |
1573 |
1561 // Make sure switch take place right away and sizes are handled |
1574 // Make sure switch take place right away and sizes are handled |
1562 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXACOL)); |
1575 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXACOL)); |
1563 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1576 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1564 } |
1577 } |
1565 |
1578 |
1566 // |
1579 // |
1567 // View menu show tasks column |
1580 // View menu show tasks column |
1579 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXTCOL), true); |
1592 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXTCOL), true); |
1580 m_pTasks->show(); |
1593 m_pTasks->show(); |
1581 } |
1594 } |
1582 |
1595 |
1583 // Make sure switch take place right away and sizes are handled |
1596 // Make sure switch take place right away and sizes are handled |
1584 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXTCOL)); |
1597 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXTCOL)); |
1585 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1598 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1586 } |
1599 } |
1587 |
1600 |
1588 // |
1601 // |
1589 // View menu show Remarks column |
1602 // View menu show Remarks column |
1601 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL), true); |
1614 m_pColspopup->setItemChecked(m_pColspopup->idAt(TITRAQ_IDXREMCOL), true); |
1602 m_pRemark->show(); |
1615 m_pRemark->show(); |
1603 } |
1616 } |
1604 |
1617 |
1605 // Make sure switch take place right away and sizes are handled |
1618 // Make sure switch take place right away and sizes are handled |
1606 m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREMCOL)); |
1619 //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREMCOL)); |
1607 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1620 this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next |
1608 } |
1621 } |
1609 |
1622 |
1610 // |
1623 // |
1611 // Generate a local formatted report |
1624 // Generate a local formatted report |
1724 return; |
1737 return; |
1725 } |
1738 } |
1726 |
1739 |
1727 // Fill account log object(s) to marshall and transmit |
1740 // Fill account log object(s) to marshall and transmit |
1728 int nRow = m_pMaintable->currentRow(); |
1741 int nRow = m_pMaintable->currentRow(); |
1729 QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows |
1742 Q3TableSelection Select = m_pMaintable->selection(0); // Capture selected rows |
1730 int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected |
1743 int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected |
1731 |
1744 |
1732 // Remember, CORBA::stri_dup creates smart pointers |
1745 // Remember, CORBA::stri_dup creates smart pointers |
1733 for (int nIter = 0; nIter < nTotal; nIter++) { |
1746 for (int nIter = 0; nIter < nTotal; nIter++) { |
1734 Singlerow.szUser = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER)); |
1747 Singlerow.szUser = CORBA::string_dup(m_pMaintable->text(Select.topRow() + nIter, TITRAQ_IDXUSER)); |
1783 QString Endpoint; |
1796 QString Endpoint; |
1784 Endpoint = TITRAQ_PREFIXHTTP + m_pPrefs->getString(TITRAQ_PREFSOAPHOST, TITRAQ_DEFSOAPHOST); |
1797 Endpoint = TITRAQ_PREFIXHTTP + m_pPrefs->getString(TITRAQ_PREFSOAPHOST, TITRAQ_DEFSOAPHOST); |
1785 SOAPProxy Proxy(Endpoint.ascii()); |
1798 SOAPProxy Proxy(Endpoint.ascii()); |
1786 |
1799 |
1787 // Fill account log object(s) to marshall and transmit |
1800 // Fill account log object(s) to marshall and transmit |
1788 QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows |
1801 Q3TableSelection Select = m_pMaintable->selection(0); // Capture selected rows |
1789 int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected |
1802 int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total rows selected |
1790 |
1803 |
1791 // Iterate through the selection of row entries to transmit |
1804 // Iterate through the selection of row entries to transmit |
1792 for (int nRowiter = 0; nRowiter < nTotal; nRowiter++) { |
1805 for (int nRowiter = 0; nRowiter < nTotal; nRowiter++) { |
1793 QString Syncthis = m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXUSER); |
1806 QString Syncthis = m_pMaintable->text(Select.topRow() + nRowiter, TITRAQ_IDXUSER); |
1877 m_pPrefs->setNumber(TITRAQ_PREFFRAMEWIDTH, (long)this->width()); |
1890 m_pPrefs->setNumber(TITRAQ_PREFFRAMEWIDTH, (long)this->width()); |
1878 m_pPrefs->setNumber(TITRAQ_PREFFRAMEHEIGHT, (long)this->height()); |
1891 m_pPrefs->setNumber(TITRAQ_PREFFRAMEHEIGHT, (long)this->height()); |
1879 |
1892 |
1880 // Remember main window layout and doc positions |
1893 // Remember main window layout and doc positions |
1881 QString Laystring; |
1894 QString Laystring; |
1882 QTextStream Laystream(&Laystring, IO_WriteOnly); |
1895 Q3TextStream Laystream(&Laystring, QIODevice::WriteOnly); |
1883 Laystream << *this; // Persist the main window |
1896 //Laystream << *this; // Persist the main window |
1884 m_pPrefs->setString(TITRAQ_PREFFRAMELAY, Laystring); |
1897 m_pPrefs->setString(TITRAQ_PREFFRAMELAY, Laystring); |
1885 } |
1898 } |
1886 |
1899 |
1887 // |
1900 // |
1888 // Get help on Titraq functionality |
1901 // Get help on Titraq functionality |
1991 // Get the selected style which can be more complicated due to mapping... |
2004 // Get the selected style which can be more complicated due to mapping... |
1992 if (pPrefpanel->getStyle() == TITRAQ_STRCDE) { |
2005 if (pPrefpanel->getStyle() == TITRAQ_STRCDE) { |
1993 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE); |
2006 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE); |
1994 qApp->setStyle(new QCDEStyle); |
2007 qApp->setStyle(new QCDEStyle); |
1995 } |
2008 } |
1996 else if (pPrefpanel->getStyle() == TITRAQ_STRSGI) { |
2009 //else if (pPrefpanel->getStyle() == TITRAQ_STRSGI) { // Not supported |
1997 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI); |
2010 // m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLESGI); |
1998 qApp->setStyle(new QSGIStyle); |
2011 // qApp->setStyle(new QSGIStyle); |
1999 } |
2012 //} |
2000 else if (pPrefpanel->getStyle() == TITRAQ_STRMOTIF) { |
2013 else if (pPrefpanel->getStyle() == TITRAQ_STRMOTIF) { |
2001 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF); |
2014 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMOTIF); |
2002 qApp->setStyle(new QMotifStyle); |
2015 qApp->setStyle(new QMotifStyle); |
2003 } |
2016 } |
2004 else if (pPrefpanel->getStyle() == TITRAQ_STRMPLUS) { |
2017 //else if (pPrefpanel->getStyle() == TITRAQ_STRMPLUS) { // Not supported |
2005 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS); |
2018 // m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS); |
2006 qApp->setStyle(new QMotifPlusStyle); |
2019 // qApp->setStyle(new QMotifPlusStyle); |
2007 } |
2020 //} |
2008 else if (pPrefpanel->getStyle() == TITRAQ_STRPLAT) { |
2021 //else if (pPrefpanel->getStyle() == TITRAQ_STRPLAT) { // Not supported |
2009 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT); |
2022 // m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEPLAT); |
2010 qApp->setStyle(new QPlatinumStyle); |
2023 // qApp->setStyle(new QPlatinumStyle); |
2011 } |
2024 //} |
2012 else if (pPrefpanel->getStyle() == TITRAQ_STRMSOFT) { |
2025 else if (pPrefpanel->getStyle() == TITRAQ_STRMSOFT) { |
2013 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMSOFT); |
2026 m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMSOFT); |
2014 qApp->setStyle(new QWindowsStyle); |
2027 qApp->setStyle(new QWindowsStyle); |
2015 } |
2028 } |
2016 else // My personal favourite ;-) |
2029 else // My personal favourite ;-) |