summaryrefslogtreecommitdiffstats
path: root/kmymoney2/mymoney/storage/mymoneystoragexml.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
commitfecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch)
tree6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/mymoney/storage/mymoneystoragexml.cpp
parentdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff)
downloadkmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz
kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/mymoney/storage/mymoneystoragexml.cpp')
-rw-r--r--kmymoney2/mymoney/storage/mymoneystoragexml.cpp334
1 files changed, 167 insertions, 167 deletions
diff --git a/kmymoney2/mymoney/storage/mymoneystoragexml.cpp b/kmymoney2/mymoney/storage/mymoneystoragexml.cpp
index e8027d1..49e0739 100644
--- a/kmymoney2/mymoney/storage/mymoneystoragexml.cpp
+++ b/kmymoney2/mymoney/storage/mymoneystoragexml.cpp
@@ -22,10 +22,10 @@
// ----------------------------------------------------------------------------
// QT Includes
-#include <qfile.h>
-#include <qdom.h>
-#include <qmap.h>
-#include <qxml.h>
+#include <tqfile.h>
+#include <tqdom.h>
+#include <tqmap.h>
+#include <tqxml.h>
// ----------------------------------------------------------------------------
// KDE Includes
@@ -52,49 +52,49 @@ class MyMoneyStorageXML::Private
public:
Private() {}
- QMap<QString, MyMoneyInstitution> iList;
- QMap<QString, MyMoneyAccount> aList;
- QMap<QString, MyMoneyTransaction> tList;
- QMap<QString, MyMoneyPayee> pList;
- QMap<QString, MyMoneySchedule> sList;
- QMap<QString, MyMoneySecurity> secList;
- QMap<QString, MyMoneyReport> rList;
- QMap<QString, MyMoneyBudget> bList;
- QMap<MyMoneySecurityPair, MyMoneyPriceEntries> prList;
+ TQMap<TQString, MyMoneyInstitution> iList;
+ TQMap<TQString, MyMoneyAccount> aList;
+ TQMap<TQString, MyMoneyTransaction> tList;
+ TQMap<TQString, MyMoneyPayee> pList;
+ TQMap<TQString, MyMoneySchedule> sList;
+ TQMap<TQString, MyMoneySecurity> secList;
+ TQMap<TQString, MyMoneyReport> rList;
+ TQMap<TQString, MyMoneyBudget> bList;
+ TQMap<MyMoneySecurityPair, MyMoneyPriceEntries> prList;
- QString m_fromSecurity;
- QString m_toSecurity;
+ TQString m_fromSecurity;
+ TQString m_toSecurity;
};
-class MyMoneyXmlContentHandler : public QXmlContentHandler
+class MyMoneyXmlContentHandler : public TQXmlContentHandler
{
public:
MyMoneyXmlContentHandler(MyMoneyStorageXML* reader);
virtual ~MyMoneyXmlContentHandler() {}
- virtual void setDocumentLocator (QXmlLocator * locator) { m_loc = locator; }
+ virtual void setDocumentLocator (TQXmlLocator * locator) { m_loc = locator; }
virtual bool startDocument (void);
virtual bool endDocument (void);
- virtual bool startPrefixMapping(const QString & prefix, const QString & uri);
- virtual bool endPrefixMapping(const QString & prefix);
- virtual bool startElement(const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts);
- virtual bool endElement(const QString & namespaceURI, const QString & localName, const QString & qName);
- virtual bool characters(const QString & ch);
- virtual bool ignorableWhitespace(const QString & ch);
- virtual bool processingInstruction(const QString & target, const QString & data);
- virtual bool skippedEntity(const QString & name);
- virtual QString errorString(void);
+ virtual bool startPrefixMapping(const TQString & prefix, const TQString & uri);
+ virtual bool endPrefixMapping(const TQString & prefix);
+ virtual bool startElement(const TQString & namespaceURI, const TQString & localName, const TQString & qName, const TQXmlAttributes & atts);
+ virtual bool endElement(const TQString & namespaceURI, const TQString & localName, const TQString & qName);
+ virtual bool characters(const TQString & ch);
+ virtual bool ignorableWhitespace(const TQString & ch);
+ virtual bool processingInstruction(const TQString & target, const TQString & data);
+ virtual bool skippedEntity(const TQString & name);
+ virtual TQString errorString(void);
private:
MyMoneyStorageXML* m_reader;
- QXmlLocator* m_loc;
+ TQXmlLocator* m_loc;
int m_level;
int m_elementCount;
- QDomDocument m_doc;
- QDomElement m_baseNode;
- QDomElement m_currNode;
- QString m_errMsg;
+ TQDomDocument m_doc;
+ TQDomElement m_baseNode;
+ TQDomElement m_currNode;
+ TQString m_errMsg;
};
MyMoneyXmlContentHandler::MyMoneyXmlContentHandler(MyMoneyStorageXML* reader) :
@@ -117,28 +117,28 @@ bool MyMoneyXmlContentHandler::endDocument(void)
return true;
}
-bool MyMoneyXmlContentHandler::skippedEntity (const QString & /* name */)
+bool MyMoneyXmlContentHandler::skippedEntity (const TQString & /* name */)
{
- // qDebug(QString("Skipped entity '%1'").arg(name));
+ // qDebug(TQString("Skipped entity '%1'").tqarg(name));
return true;
}
-bool MyMoneyXmlContentHandler::startPrefixMapping (const QString& /*prefix */, const QString & /* uri */)
+bool MyMoneyXmlContentHandler::startPrefixMapping (const TQString& /*prefix */, const TQString & /* uri */)
{
- // qDebug(QString("start prefix '%1', '%2'").arg(prefix).arg(uri));
+ // qDebug(TQString("start prefix '%1', '%2'").tqarg(prefix).tqarg(uri));
return true;
}
-bool MyMoneyXmlContentHandler::endPrefixMapping (const QString& /* prefix */)
+bool MyMoneyXmlContentHandler::endPrefixMapping (const TQString& /* prefix */)
{
- // qDebug(QString("end prefix '%1'").arg(prefix));
+ // qDebug(TQString("end prefix '%1'").tqarg(prefix));
return true;
}
-bool MyMoneyXmlContentHandler::startElement (const QString& /* namespaceURI */, const QString& /* localName */, const QString& qName, const QXmlAttributes & atts)
+bool MyMoneyXmlContentHandler::startElement (const TQString& /* namespaceURI */, const TQString& /* localName */, const TQString& qName, const TQXmlAttributes & atts)
{
if(m_level == 0) {
- QString s = qName.lower();
+ TQString s = qName.lower();
if(s == "transaction"
|| s == "account"
|| s == "price"
@@ -162,28 +162,28 @@ bool MyMoneyXmlContentHandler::startElement (const QString& /* namespaceURI */,
} else if(s == "transactions") {
qDebug("reading transactions");
if(atts.count()) {
- int count = atts.value(QString("count")).toUInt();
+ int count = atts.value(TQString("count")).toUInt();
m_reader->signalProgress(0, count, i18n("Loading transactions..."));
m_elementCount = 0;
}
} else if(s == "accounts") {
qDebug("reading accounts");
if(atts.count()) {
- int count = atts.value(QString("count")).toUInt();
+ int count = atts.value(TQString("count")).toUInt();
m_reader->signalProgress(0, count, i18n("Loading accounts..."));
m_elementCount = 0;
}
} else if(s == "securities") {
qDebug("reading securities");
if(atts.count()) {
- int count = atts.value(QString("count")).toUInt();
+ int count = atts.value(TQString("count")).toUInt();
m_reader->signalProgress(0, count, i18n("Loading securities..."));
m_elementCount = 0;
}
} else if(s == "reports") {
qDebug("reading reports");
if(atts.count()) {
- int count = atts.value(QString("count")).toUInt();
+ int count = atts.value(TQString("count")).toUInt();
m_reader->signalProgress(0, count, i18n("Loading reports..."));
m_elementCount = 0;
}
@@ -192,14 +192,14 @@ bool MyMoneyXmlContentHandler::startElement (const QString& /* namespaceURI */,
m_elementCount = 0;
} else if(s == "pricepair") {
if(atts.count()) {
- m_reader->d->m_fromSecurity = atts.value(QString("from"));
- m_reader->d->m_toSecurity = atts.value(QString("to"));
+ m_reader->d->m_fromSecurity = atts.value(TQString("from"));
+ m_reader->d->m_toSecurity = atts.value(TQString("to"));
}
}
} else {
m_level++;
- QDomElement node = m_doc.createElement(qName);
+ TQDomElement node = m_doc.createElement(qName);
for(int i=0; i < atts.count(); ++i) {
node.setAttribute(atts.qName(i), atts.value(i));
}
@@ -209,12 +209,12 @@ bool MyMoneyXmlContentHandler::startElement (const QString& /* namespaceURI */,
return true;
}
-bool MyMoneyXmlContentHandler::endElement(const QString& /* namespaceURI */, const QString& /* localName */, const QString& qName)
+bool MyMoneyXmlContentHandler::endElement(const TQString& /* namespaceURI */, const TQString& /* localName */, const TQString& qName)
{
bool rc = true;
- QString s = qName.lower();
+ TQString s = qName.lower();
if(m_level) {
- m_currNode = m_currNode.parentNode().toElement();
+ m_currNode = m_currNode.tqparentNode().toElement();
m_level--;
if(!m_level) {
try {
@@ -265,18 +265,18 @@ bool MyMoneyXmlContentHandler::endElement(const QString& /* namespaceURI */, con
MyMoneyPrice p(m_reader->d->m_fromSecurity, m_reader->d->m_toSecurity, m_baseNode);
m_reader->d->prList[MyMoneySecurityPair(m_reader->d->m_fromSecurity, m_reader->d->m_toSecurity)][p.date()] = p;
} else {
- m_errMsg = i18n("Unknown XML tag %1 found in line %2").arg(qName).arg(m_loc->lineNumber());
+ m_errMsg = i18n("Unknown XML tag %1 found in line %2").tqarg(qName).tqarg(m_loc->lineNumber());
kdWarning() << m_errMsg << endl;
rc = false;
}
m_reader->signalProgress(++m_elementCount, 0);
} catch(MyMoneyException* e) {
- m_errMsg = i18n("Exception while creating a %1 element: %2").arg(s).arg(e->what());
+ m_errMsg = i18n("Exception while creating a %1 element: %2").tqarg(s).tqarg(e->what());
kdWarning() << m_errMsg << endl;
delete e;
rc = false;
}
- m_doc = QDomDocument();
+ m_doc = TQDomDocument();
}
} else {
if(s == "institutions") {
@@ -334,22 +334,22 @@ bool MyMoneyXmlContentHandler::endElement(const QString& /* namespaceURI */, con
return rc;
}
-bool MyMoneyXmlContentHandler::characters(const QString& /* ch */)
+bool MyMoneyXmlContentHandler::characters(const TQString& /* ch */)
{
return true;
}
-bool MyMoneyXmlContentHandler::ignorableWhitespace(const QString& /* ch */)
+bool MyMoneyXmlContentHandler::ignorableWhitespace(const TQString& /* ch */)
{
return true;
}
-bool MyMoneyXmlContentHandler::processingInstruction(const QString& /* target */, const QString& /* data */)
+bool MyMoneyXmlContentHandler::processingInstruction(const TQString& /* target */, const TQString& /* data */)
{
return true;
}
-QString MyMoneyXmlContentHandler::errorString(void)
+TQString MyMoneyXmlContentHandler::errorString(void)
{
return m_errMsg;
}
@@ -373,7 +373,7 @@ MyMoneyStorageXML::~MyMoneyStorageXML()
}
// Function to read in the file, send to XML parser.
-void MyMoneyStorageXML::readFile(QIODevice* pDevice, IMyMoneySerialize* storage)
+void MyMoneyStorageXML::readFile(TQIODevice* pDevice, IMyMoneySerialize* storage)
{
Q_CHECK_PTR(storage);
Q_CHECK_PTR(pDevice);
@@ -382,20 +382,20 @@ void MyMoneyStorageXML::readFile(QIODevice* pDevice, IMyMoneySerialize* storage)
m_storage = storage;
- m_doc = new QDomDocument;
+ m_doc = new TQDomDocument;
Q_CHECK_PTR(m_doc);
qDebug("reading file");
- // creating the QXmlInputSource object based on a QIODevice object
+ // creating the TQXmlInputSource object based on a TQIODevice object
// reads all data of the underlying object into memory. I have not
// found an object that reads on the fly. I tried to derive one myself,
// but there could be a severe problem with decoding when reading
// blocks of data and not a stream. So I left it the way it is. (ipwizard)
- QXmlInputSource xml(pDevice);
+ TQXmlInputSource xml(pDevice);
qDebug("start parsing file");
MyMoneyXmlContentHandler mmxml(this);
- QXmlSimpleReader reader;
+ TQXmlSimpleReader reader;
reader.setContentHandler(&mmxml);
if(!reader.parse(&xml, false)) {
@@ -421,7 +421,7 @@ void MyMoneyStorageXML::readFile(QIODevice* pDevice, IMyMoneySerialize* storage)
signalProgress(-1, -1);
}
-void MyMoneyStorageXML::writeFile(QIODevice* qf, IMyMoneySerialize* storage)
+void MyMoneyStorageXML::writeFile(TQIODevice* qf, IMyMoneySerialize* storage)
{
Q_CHECK_PTR(qf);
Q_CHECK_PTR(storage);
@@ -432,67 +432,67 @@ void MyMoneyStorageXML::writeFile(QIODevice* qf, IMyMoneySerialize* storage)
m_storage = storage;
// qDebug("XMLWRITER: Starting file write");
- m_doc = new QDomDocument("KMYMONEY-FILE");
+ m_doc = new TQDomDocument("KMYMONEY-FILE");
Q_CHECK_PTR(m_doc);
- QDomProcessingInstruction instruct = m_doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"");
+ TQDomProcessingInstruction instruct = m_doc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"");
m_doc->appendChild(instruct);
- QDomElement mainElement = m_doc->createElement("KMYMONEY-FILE");
+ TQDomElement mainElement = m_doc->createElement("KMYMONEY-FILE");
m_doc->appendChild(mainElement);
- QDomElement fileInfo = m_doc->createElement("FILEINFO");
+ TQDomElement fileInfo = m_doc->createElement("FILEINFO");
writeFileInformation(fileInfo);
mainElement.appendChild(fileInfo);
- QDomElement userInfo = m_doc->createElement("USER");
+ TQDomElement userInfo = m_doc->createElement("USER");
writeUserInformation(userInfo);
mainElement.appendChild(userInfo);
- QDomElement institutions = m_doc->createElement("INSTITUTIONS");
+ TQDomElement institutions = m_doc->createElement("INSTITUTIONS");
writeInstitutions(institutions);
mainElement.appendChild(institutions);
- QDomElement payees = m_doc->createElement("PAYEES");
+ TQDomElement payees = m_doc->createElement("PAYEES");
writePayees(payees);
mainElement.appendChild(payees);
- QDomElement accounts = m_doc->createElement("ACCOUNTS");
+ TQDomElement accounts = m_doc->createElement("ACCOUNTS");
writeAccounts(accounts);
mainElement.appendChild(accounts);
- QDomElement transactions = m_doc->createElement("TRANSACTIONS");
+ TQDomElement transactions = m_doc->createElement("TRANSACTIONS");
writeTransactions(transactions);
mainElement.appendChild(transactions);
- QDomElement keyvalpairs = writeKeyValuePairs(m_storage->pairs());
+ TQDomElement keyvalpairs = writeKeyValuePairs(m_storage->pairs());
mainElement.appendChild(keyvalpairs);
- QDomElement schedules = m_doc->createElement("SCHEDULES");
+ TQDomElement schedules = m_doc->createElement("SCHEDULES");
writeSchedules(schedules);
mainElement.appendChild(schedules);
- QDomElement equities = m_doc->createElement("SECURITIES");
+ TQDomElement equities = m_doc->createElement("SECURITIES");
writeSecurities(equities);
mainElement.appendChild(equities);
- QDomElement currencies = m_doc->createElement("CURRENCIES");
+ TQDomElement currencies = m_doc->createElement("CURRENCIES");
writeCurrencies(currencies);
mainElement.appendChild(currencies);
- QDomElement prices = m_doc->createElement("PRICES");
+ TQDomElement prices = m_doc->createElement("PRICES");
writePrices(prices);
mainElement.appendChild(prices);
- QDomElement reports = m_doc->createElement("REPORTS");
+ TQDomElement reports = m_doc->createElement("REPORTS");
writeReports(reports);
mainElement.appendChild(reports);
- QDomElement budgets = m_doc->createElement("BUDGETS");
+ TQDomElement budgets = m_doc->createElement("BUDGETS");
writeBudgets(budgets);
mainElement.appendChild(budgets);
- QTextStream stream(qf);
- stream.setEncoding(QTextStream::UnicodeUTF8);
+ TQTextStream stream(qf);
+ stream.setEncoding(TQTextStream::UnicodeUTF8);
stream << m_doc->toString();
delete m_doc;
@@ -508,36 +508,36 @@ void MyMoneyStorageXML::writeFile(QIODevice* qf, IMyMoneySerialize* storage)
m_storage = NULL;
}
-bool MyMoneyStorageXML::readFileInformation(const QDomElement& fileInfo)
+bool MyMoneyStorageXML::readFileInformation(const TQDomElement& fileInfo)
{
signalProgress(0, 3, i18n("Loading file information..."));
bool rc = true;
- QDomElement temp = findChildElement("CREATION_DATE", fileInfo);
- if (temp == QDomElement()) {
+ TQDomElement temp = findChildElement("CREATION_DATE", fileInfo);
+ if (temp == TQDomElement()) {
rc = false;
}
- QString strDate = QStringEmpty(temp.attribute("date"));
+ TQString strDate = TQStringEmpty(temp.attribute("date"));
m_storage->setCreationDate(stringToDate(strDate));
signalProgress(1, 0);
temp = findChildElement("LAST_MODIFIED_DATE", fileInfo);
- if (temp == QDomElement()) {
+ if (temp == TQDomElement()) {
rc = false;
}
- strDate = QStringEmpty(temp.attribute("date"));
+ strDate = TQStringEmpty(temp.attribute("date"));
m_storage->setLastModificationDate(stringToDate(strDate));
signalProgress(2, 0);
temp = findChildElement("VERSION", fileInfo);
- if (temp == QDomElement()) {
+ if (temp == TQDomElement()) {
rc = false;
}
- QString strVersion = QStringEmpty(temp.attribute("id"));
+ TQString strVersion = TQStringEmpty(temp.attribute("id"));
fileVersionRead = strVersion.toUInt(NULL, 16);
temp = findChildElement("FIXVERSION", fileInfo);
- if (temp != QDomElement()) {
- QString strFixVersion = QStringEmpty(temp.attribute("id"));
+ if (temp != TQDomElement()) {
+ TQString strFixVersion = TQStringEmpty(temp.attribute("id"));
m_storage->setFileFixVersion (strFixVersion.toUInt());
}
// FIXME The old version stuff used this rather odd number
@@ -549,33 +549,33 @@ bool MyMoneyStorageXML::readFileInformation(const QDomElement& fileInfo)
return rc;
}
-void MyMoneyStorageXML::writeFileInformation(QDomElement& fileInfo)
+void MyMoneyStorageXML::writeFileInformation(TQDomElement& fileInfo)
{
- QDomElement creationDate = m_doc->createElement("CREATION_DATE");
+ TQDomElement creationDate = m_doc->createElement("CREATION_DATE");
creationDate.setAttribute("date", dateToString(m_storage->creationDate()));
fileInfo.appendChild(creationDate);
- QDomElement lastModifiedDate = m_doc->createElement("LAST_MODIFIED_DATE");
+ TQDomElement lastModifiedDate = m_doc->createElement("LAST_MODIFIED_DATE");
lastModifiedDate.setAttribute("date", dateToString(m_storage->lastModificationDate()));
fileInfo.appendChild(lastModifiedDate);
- QDomElement version = m_doc->createElement("VERSION");
+ TQDomElement version = m_doc->createElement("VERSION");
version.setAttribute("id", "1");
fileInfo.appendChild(version);
- QDomElement fixVersion = m_doc->createElement("FIXVERSION");
+ TQDomElement fixVersion = m_doc->createElement("FIXVERSION");
fixVersion.setAttribute("id", m_storage->fileFixVersion());
fileInfo.appendChild(fixVersion);
}
-void MyMoneyStorageXML::writeUserInformation(QDomElement& userInfo)
+void MyMoneyStorageXML::writeUserInformation(TQDomElement& userInfo)
{
MyMoneyPayee user = m_storage->user();
userInfo.setAttribute("name", user.name());
userInfo.setAttribute("email", user.email());
- QDomElement address = m_doc->createElement("ADDRESS");
+ TQDomElement address = m_doc->createElement("ADDRESS");
address.setAttribute("street", user.address());
address.setAttribute("city", user.city());
address.setAttribute("county", user.state());
@@ -585,22 +585,22 @@ void MyMoneyStorageXML::writeUserInformation(QDomElement& userInfo)
userInfo.appendChild(address);
}
-bool MyMoneyStorageXML::readUserInformation(const QDomElement& userElement)
+bool MyMoneyStorageXML::readUserInformation(const TQDomElement& userElement)
{
bool rc = true;
signalProgress(0, 1, i18n("Loading user information..."));
MyMoneyPayee user;
- user.setName(QStringEmpty(userElement.attribute("name")));
- user.setEmail(QStringEmpty(userElement.attribute("email")));
+ user.setName(TQStringEmpty(userElement.attribute("name")));
+ user.setEmail(TQStringEmpty(userElement.attribute("email")));
- QDomElement addressNode = findChildElement("ADDRESS", userElement);
+ TQDomElement addressNode = findChildElement("ADDRESS", userElement);
if(!addressNode.isNull()) {
- user.setAddress(QStringEmpty(addressNode.attribute("street")));
- user.setCity(QStringEmpty(addressNode.attribute("city")));
- user.setState(QStringEmpty(addressNode.attribute("county")));
- user.setPostcode(QStringEmpty(addressNode.attribute("zipcode")));
- user.setTelephone(QStringEmpty(addressNode.attribute("telephone")));
+ user.setAddress(TQStringEmpty(addressNode.attribute("street")));
+ user.setCity(TQStringEmpty(addressNode.attribute("city")));
+ user.setState(TQStringEmpty(addressNode.attribute("county")));
+ user.setPostcode(TQStringEmpty(addressNode.attribute("zipcode")));
+ user.setTelephone(TQStringEmpty(addressNode.attribute("telephone")));
}
m_storage->setUser(user);
@@ -609,41 +609,41 @@ bool MyMoneyStorageXML::readUserInformation(const QDomElement& userElement)
return rc;
}
-void MyMoneyStorageXML::writeInstitutions(QDomElement& institutions)
+void MyMoneyStorageXML::writeInstitutions(TQDomElement& institutions)
{
- const QValueList<MyMoneyInstitution> list = m_storage->institutionList();
- QValueList<MyMoneyInstitution>::ConstIterator it;
+ const TQValueList<MyMoneyInstitution> list = m_storage->institutionList();
+ TQValueList<MyMoneyInstitution>::ConstIterator it;
institutions.setAttribute("count", list.count());
for(it = list.begin(); it != list.end(); ++it)
writeInstitution(institutions, *it);
}
-void MyMoneyStorageXML::writeInstitution(QDomElement& institution, const MyMoneyInstitution& i)
+void MyMoneyStorageXML::writeInstitution(TQDomElement& institution, const MyMoneyInstitution& i)
{
i.writeXML(*m_doc, institution);
}
-void MyMoneyStorageXML::writePayees(QDomElement& payees)
+void MyMoneyStorageXML::writePayees(TQDomElement& payees)
{
- const QValueList<MyMoneyPayee> list = m_storage->payeeList();
- QValueList<MyMoneyPayee>::ConstIterator it;
+ const TQValueList<MyMoneyPayee> list = m_storage->payeeList();
+ TQValueList<MyMoneyPayee>::ConstIterator it;
payees.setAttribute("count", list.count());
for(it = list.begin(); it != list.end(); ++it)
writePayee(payees, *it);
}
-void MyMoneyStorageXML::writePayee(QDomElement& payee, const MyMoneyPayee& p)
+void MyMoneyStorageXML::writePayee(TQDomElement& payee, const MyMoneyPayee& p)
{
p.writeXML(*m_doc, payee);
}
-void MyMoneyStorageXML::writeAccounts(QDomElement& accounts)
+void MyMoneyStorageXML::writeAccounts(TQDomElement& accounts)
{
- QValueList<MyMoneyAccount> list;
+ TQValueList<MyMoneyAccount> list;
m_storage->accountList(list);
- QValueList<MyMoneyAccount>::ConstIterator it;
+ TQValueList<MyMoneyAccount>::ConstIterator it;
accounts.setAttribute("count", list.count()+5);
writeAccount(accounts, m_storage->asset());
@@ -660,20 +660,20 @@ void MyMoneyStorageXML::writeAccounts(QDomElement& accounts)
}
}
-void MyMoneyStorageXML::writeAccount(QDomElement& account, const MyMoneyAccount& p)
+void MyMoneyStorageXML::writeAccount(TQDomElement& account, const MyMoneyAccount& p)
{
p.writeXML(*m_doc, account);
}
-void MyMoneyStorageXML::writeTransactions(QDomElement& transactions)
+void MyMoneyStorageXML::writeTransactions(TQDomElement& transactions)
{
MyMoneyTransactionFilter filter;
filter.setReportAllSplits(false);
- QValueList<MyMoneyTransaction> list;
+ TQValueList<MyMoneyTransaction> list;
m_storage->transactionList(list, filter);
transactions.setAttribute("count", list.count());
- QValueList<MyMoneyTransaction>::ConstIterator it;
+ TQValueList<MyMoneyTransaction>::ConstIterator it;
signalProgress(0, list.count(), i18n("Saving transactions..."));
@@ -685,15 +685,15 @@ void MyMoneyStorageXML::writeTransactions(QDomElement& transactions)
}
}
-void MyMoneyStorageXML::writeTransaction(QDomElement& transaction, const MyMoneyTransaction& tx)
+void MyMoneyStorageXML::writeTransaction(TQDomElement& transaction, const MyMoneyTransaction& tx)
{
tx.writeXML(*m_doc, transaction);
}
-void MyMoneyStorageXML::writeSchedules(QDomElement& scheduled)
+void MyMoneyStorageXML::writeSchedules(TQDomElement& scheduled)
{
- const QValueList<MyMoneySchedule> list = m_storage->scheduleList();
- QValueList<MyMoneySchedule>::ConstIterator it;
+ const TQValueList<MyMoneySchedule> list = m_storage->scheduleList();
+ TQValueList<MyMoneySchedule>::ConstIterator it;
scheduled.setAttribute("count", list.count());
for(it = list.begin(); it != list.end(); ++it)
@@ -702,86 +702,86 @@ void MyMoneyStorageXML::writeSchedules(QDomElement& scheduled)
}
}
-void MyMoneyStorageXML::writeSchedule(QDomElement& scheduledTx, const MyMoneySchedule& tx)
+void MyMoneyStorageXML::writeSchedule(TQDomElement& scheduledTx, const MyMoneySchedule& tx)
{
tx.writeXML(*m_doc, scheduledTx);
}
-void MyMoneyStorageXML::writeSecurities(QDomElement& equities)
+void MyMoneyStorageXML::writeSecurities(TQDomElement& equities)
{
- const QValueList<MyMoneySecurity> securityList = m_storage->securityList();
+ const TQValueList<MyMoneySecurity> securityList = m_storage->securityList();
equities.setAttribute("count", securityList.count());
if(securityList.size())
{
- for(QValueList<MyMoneySecurity>::ConstIterator it = securityList.begin(); it != securityList.end(); ++it)
+ for(TQValueList<MyMoneySecurity>::ConstIterator it = securityList.begin(); it != securityList.end(); ++it)
{
writeSecurity(equities, (*it));
}
}
}
-void MyMoneyStorageXML::writeSecurity(QDomElement& securityElement, const MyMoneySecurity& security)
+void MyMoneyStorageXML::writeSecurity(TQDomElement& securityElement, const MyMoneySecurity& security)
{
security.writeXML(*m_doc, securityElement);
}
-void MyMoneyStorageXML::writeCurrencies(QDomElement& currencies)
+void MyMoneyStorageXML::writeCurrencies(TQDomElement& currencies)
{
- const QValueList<MyMoneySecurity> currencyList = m_storage->currencyList();
+ const TQValueList<MyMoneySecurity> currencyList = m_storage->currencyList();
currencies.setAttribute("count", currencyList.count());
if(currencyList.size())
{
- for(QValueList<MyMoneySecurity>::ConstIterator it = currencyList.begin(); it != currencyList.end(); ++it)
+ for(TQValueList<MyMoneySecurity>::ConstIterator it = currencyList.begin(); it != currencyList.end(); ++it)
{
writeSecurity(currencies, (*it));
}
}
}
-void MyMoneyStorageXML::writeReports(QDomElement& parent)
+void MyMoneyStorageXML::writeReports(TQDomElement& tqparent)
{
- const QValueList<MyMoneyReport> list = m_storage->reportList();
- QValueList<MyMoneyReport>::ConstIterator it;
- parent.setAttribute("count", list.count());
+ const TQValueList<MyMoneyReport> list = m_storage->reportList();
+ TQValueList<MyMoneyReport>::ConstIterator it;
+ tqparent.setAttribute("count", list.count());
signalProgress(0, list.count(), i18n("Saving reports..."));
unsigned i = 0;
for(it = list.begin(); it != list.end(); ++it)
{
- (*it).writeXML(*m_doc, parent);
+ (*it).writeXML(*m_doc, tqparent);
signalProgress(++i, 0);
}
}
-void MyMoneyStorageXML::writeBudgets(QDomElement& parent)
+void MyMoneyStorageXML::writeBudgets(TQDomElement& tqparent)
{
- const QValueList<MyMoneyBudget> list = m_storage->budgetList();
- QValueList<MyMoneyBudget>::ConstIterator it;
- parent.setAttribute("count", list.count());
+ const TQValueList<MyMoneyBudget> list = m_storage->budgetList();
+ TQValueList<MyMoneyBudget>::ConstIterator it;
+ tqparent.setAttribute("count", list.count());
signalProgress(0, list.count(), i18n("Saving budgets..."));
unsigned i = 0;
for(it = list.begin(); it != list.end(); ++it)
{
- writeBudget(parent, (*it));
+ writeBudget(tqparent, (*it));
signalProgress(++i, 0);
}
}
-void MyMoneyStorageXML::writeBudget(QDomElement& budget, const MyMoneyBudget& b)
+void MyMoneyStorageXML::writeBudget(TQDomElement& budget, const MyMoneyBudget& b)
{
b.writeXML(*m_doc, budget);
}
-QDomElement MyMoneyStorageXML::findChildElement(const QString& name, const QDomElement& root)
+TQDomElement MyMoneyStorageXML::findChildElement(const TQString& name, const TQDomElement& root)
{
- QDomNode child = root.firstChild();
+ TQDomNode child = root.firstChild();
while(!child.isNull())
{
if(child.isElement())
{
- QDomElement childElement = child.toElement();
+ TQDomElement childElement = child.toElement();
if(name == childElement.tagName())
{
return childElement;
@@ -790,29 +790,29 @@ QDomElement MyMoneyStorageXML::findChildElement(const QString& name, const QDomE
child = child.nextSibling();
}
- return QDomElement();
+ return TQDomElement();
}
-QDomElement MyMoneyStorageXML::writeKeyValuePairs(const QMap<QString, QString> pairs)
+TQDomElement MyMoneyStorageXML::writeKeyValuePairs(const TQMap<TQString, TQString> pairs)
{
if(m_doc)
{
- QDomElement keyValPairs = m_doc->createElement("KEYVALUEPAIRS");
+ TQDomElement keyValPairs = m_doc->createElement("KEYVALUEPAIRS");
- QMap<QString, QString>::const_iterator it;
+ TQMap<TQString, TQString>::const_iterator it;
for(it = pairs.begin(); it != pairs.end(); ++it)
{
- QDomElement pair = m_doc->createElement("PAIR");
+ TQDomElement pair = m_doc->createElement("PAIR");
pair.setAttribute("key", it.key());
pair.setAttribute("value", it.data());
keyValPairs.appendChild(pair);
}
return keyValPairs;
}
- return QDomElement();
+ return TQDomElement();
}
-void MyMoneyStorageXML::writePrices(QDomElement& prices)
+void MyMoneyStorageXML::writePrices(TQDomElement& prices)
{
const MyMoneyPriceList list = m_storage->priceList();
MyMoneyPriceList::ConstIterator it;
@@ -820,7 +820,7 @@ void MyMoneyStorageXML::writePrices(QDomElement& prices)
for(it = list.begin(); it != list.end(); ++it)
{
- QDomElement price = m_doc->createElement("PRICEPAIR");
+ TQDomElement price = m_doc->createElement("PRICEPAIR");
price.setAttribute("from", it.key().first);
price.setAttribute("to", it.key().second);
writePricePair(price, *it);
@@ -828,29 +828,29 @@ void MyMoneyStorageXML::writePrices(QDomElement& prices)
}
}
-void MyMoneyStorageXML::writePricePair(QDomElement& price, const MyMoneyPriceEntries& p)
+void MyMoneyStorageXML::writePricePair(TQDomElement& price, const MyMoneyPriceEntries& p)
{
MyMoneyPriceEntries::ConstIterator it;
for(it = p.begin(); it != p.end(); ++it) {
- QDomElement entry = m_doc->createElement("PRICE");
+ TQDomElement entry = m_doc->createElement("PRICE");
writePrice(entry, *it);
price.appendChild(entry);
}
}
-void MyMoneyStorageXML::writePrice(QDomElement& price, const MyMoneyPrice& p)
+void MyMoneyStorageXML::writePrice(TQDomElement& price, const MyMoneyPrice& p)
{
price.setAttribute("date", p.date().toString(Qt::ISODate));
- price.setAttribute("price", p.rate(QString()).toString());
+ price.setAttribute("price", p.rate(TQString()).toString());
price.setAttribute("source", p.source());
}
-void MyMoneyStorageXML::setProgressCallback(void(*callback)(int, int, const QString&))
+void MyMoneyStorageXML::setProgressCallback(void(*callback)(int, int, const TQString&))
{
m_progressCallback = callback;
}
-void MyMoneyStorageXML::signalProgress(int current, int total, const QString& msg)
+void MyMoneyStorageXML::signalProgress(int current, int total, const TQString& msg)
{
if(m_progressCallback != 0)
(*m_progressCallback)(current, total, msg);
@@ -860,23 +860,23 @@ void MyMoneyStorageXML::signalProgress(int current, int total, const QString& ms
This convenience function returns all of the remaining data in the
device.
- @note It's copied from the original Qt sources and modified to
+ @note It's copied from the original TQt sources and modified to
fix a problem with KFilterDev that does not correctly return
atEnd() status in certain circumstances which caused our
application to lock at startup.
*/
-QByteArray QIODevice::readAll()
+TQByteArray TQIODevice::readAll()
{
if ( isDirectAccess() ) {
// we know the size
int n = size()-at(); // ### fix for 64-bit or large files?
int totalRead = 0;
- QByteArray ba( n );
+ TQByteArray ba( n );
char* c = ba.data();
while ( n ) {
int r = readBlock( c, n );
if ( r < 0 )
- return QByteArray();
+ return TQByteArray();
n -= r;
c += r;
totalRead += r;
@@ -892,13 +892,13 @@ QByteArray QIODevice::readAll()
// read until we reach the end
const int blocksize = 512;
int nread = 0;
- QByteArray ba;
+ TQByteArray ba;
int r = 1;
while ( !atEnd() && r != 0) {
ba.resize( nread + blocksize );
r = readBlock( ba.data()+nread, blocksize );
if ( r < 0 )
- return QByteArray();
+ return TQByteArray();
nread += r;
}
ba.resize( nread );