diff -r e8292658d5b3 -r c1941114ca88 as_slot.cpp --- a/as_slot.cpp Fri Nov 28 14:20:00 2008 +0100 +++ b/as_slot.cpp Fri Dec 05 23:14:02 2008 +0100 @@ -1,12 +1,12 @@ // // 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 +// Copyright (c) 2002-2008 The OSSP Project (http://www.ossp.org/) +// Copyright (c) 2002-2008 Ralf S. Engelschall +// Copyright (c) 2002-2008 Michael Schloh von Bennewitz +// Copyright (c) 2002-2008 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/. +// interface which can be found at http://asgui.europalab.com/. // // Permission to use, copy, modify, and distribute this software for // any purpose with or without fee is hereby granted, provided that @@ -29,27 +29,40 @@ // as_slot.cpp: ISO C++ implementation // +#define QT3_SUPPORT + // system headers #include #include // Qt headers -#include +#include #include #include #include #include #include #include -#include +#include // Qt style headers #include -#include +#include +#include #include -#include -#include +#include +#include +#include #include +#include +#include + +//Added by qt3to4: +#include +#include +#include +#include +#include // User interface #include "as_const.h" // Application constants @@ -122,8 +135,8 @@ 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 + nRows = Selection.count(QChar('\n')); // How many rows + if (Selection.isNull() && nRows > 0) { // Ignore empty clipboards this->addEntry(nRows); // Reuse slot setRowdata(Selection); // Use accessor @@ -147,7 +160,7 @@ // void Titraqform::addEntry(int nRows) { - QTableSelection Select; // Highlighted text + Q3TableSelection Select; // Highlighted text int nTotal = 0; // Total row select int nCurrent = 0; // Current row std::auto_ptr pGuid(new AS::Uuid); // For GUID production @@ -180,7 +193,7 @@ 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_IDXGUID, QString::fromStdString(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)); @@ -210,7 +223,7 @@ 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_IDXGUID, QString::fromStdString(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)); @@ -269,9 +282,9 @@ // void Titraqform::delEntry(int nRows) { - QTableSelection Select = m_pMaintable->selection(0); // Highlighted text + Q3TableSelection Select = m_pMaintable->selection(0); // Highlighted text int nTotal = Select.bottomRow() - Select.topRow() + 1; // Total row select - QMemArray Rowselect(nTotal); // Row array + Q3MemArray Rowselect(nTotal); // Row array // Calculate rows to delete from selection highlight for (int nIter = 0; nIter < nTotal; ++nIter) @@ -424,7 +437,7 @@ 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, + QString Filestring = Q3FileDialog::getOpenFileName(Openas, trUtf8("Accounting Data (*.as);;Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to open"), NULL, false); @@ -504,7 +517,7 @@ 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); + 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); if (!Filestring.isEmpty()) { if (QFile::exists(Filestring)) { nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) @@ -551,7 +564,7 @@ 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); + 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); if (!Filestring.isEmpty()) { if (QFile::exists(Filestring)) { nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) @@ -1361,7 +1374,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTATCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTATCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1383,7 +1396,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXLCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXLCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1406,7 +1419,7 @@ // 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)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXUCOL)); } // @@ -1427,7 +1440,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXGCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXGCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1449,7 +1462,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXCCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXCCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1471,7 +1484,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREVCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREVCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1493,7 +1506,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXDCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXDCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1515,7 +1528,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXSTARTCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1537,7 +1550,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXFCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXFCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1559,7 +1572,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXACOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXACOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1581,7 +1594,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXTCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXTCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1603,7 +1616,7 @@ } // Make sure switch take place right away and sizes are handled - m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREMCOL)); + //m_pColspopup->updateItem(m_pColspopup->idAt(TITRAQ_IDXREMCOL)); this->updSizes(TITRAQ_IDXALLCTRLS, 0, 0); // Update size of this and next } @@ -1726,7 +1739,7 @@ // Fill account log object(s) to marshall and transmit int nRow = m_pMaintable->currentRow(); - QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows + Q3TableSelection 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 @@ -1785,7 +1798,7 @@ SOAPProxy Proxy(Endpoint.ascii()); // Fill account log object(s) to marshall and transmit - QTableSelection Select = m_pMaintable->selection(0); // Capture selected rows + Q3TableSelection 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 @@ -1879,8 +1892,8 @@ // Remember main window layout and doc positions QString Laystring; - QTextStream Laystream(&Laystring, IO_WriteOnly); - Laystream << *this; // Persist the main window + Q3TextStream Laystream(&Laystring, QIODevice::WriteOnly); + //Laystream << *this; // Persist the main window m_pPrefs->setString(TITRAQ_PREFFRAMELAY, Laystring); } @@ -1993,22 +2006,22 @@ 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_STRSGI) { // Not supported + // 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_STRMPLUS) { // Not supported + // m_pPrefs->setNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLEMPLUS); + // qApp->setStyle(new QMotifPlusStyle); + //} + //else if (pPrefpanel->getStyle() == TITRAQ_STRPLAT) { // Not supported + // 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);