From eeae53f59df4d79d0399c2217a165ff2fab754db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 17 Mar 2022 09:54:21 +0100 Subject: Replace the use of the old API TQString::data(). The definition of -UTQT_NO_COMPAT is no longer needed. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- kmymoney2/converter/mymoneygncreader.cpp | 105 ++++++++++++++++--------------- 1 file changed, 53 insertions(+), 52 deletions(-) (limited to 'kmymoney2/converter/mymoneygncreader.cpp') diff --git a/kmymoney2/converter/mymoneygncreader.cpp b/kmymoney2/converter/mymoneygncreader.cpp index 14d7b03..7e30f41 100644 --- a/kmymoney2/converter/mymoneygncreader.cpp +++ b/kmymoney2/converter/mymoneygncreader.cpp @@ -236,9 +236,9 @@ TQString GncObject::hide (TQString data, unsigned int anonClass) { // dump current object data values // only called if gncdebug set void GncObject::debugDump () { uint i; - tqDebug ("Object %s", m_elementName.latin1()); + tqDebug(TQString("Object %1").arg(m_elementName)); for (i = 0; i < m_dataElementListCount; i++) { - tqDebug ("%s = %s", m_dataElementList[i].latin1(), m_v.at(i)->latin1()); + tqDebug(TQString("%1 = %2").arg(m_dataElementList[i]).arg(*(m_v.at(i)))); } } //***************************************************************** @@ -409,7 +409,7 @@ void GncCountData::terminate () { if (i != 0) { if (m_countType == "budget") pMain->setBudgetsFound(true); else if (m_countType.left(7) == "gnc:Gnc") pMain->setSmallBusinessFound(true); - else if (pMain->xmldebug) tqDebug ("Unknown count type %s", m_countType.latin1()); + else if (pMain->xmldebug) tqDebug(TQString("Unknown count type %1").arg(m_countType)); } return ; } @@ -887,7 +887,7 @@ bool XmlReader::startDocument() { bool XmlReader::startElement (const TQString&, const TQString&, const TQString& elName , const TQXmlAttributes& elAttrs) { try { - if (pMain->gncdebug) tqDebug ("XML start - %s", elName.latin1()); + if (pMain->gncdebug) tqDebug(TQString("XML start - %1").arg(elName)); #ifdef _GNCFILEANON int i; TQString spaces; @@ -938,9 +938,9 @@ bool XmlReader::startElement (const TQString&, const TQString&, const TQString& #ifndef _GNCFILEANON // we can't pass on exceptions here coz the XML reader won't catch them and we just abort KMessageBox::error(0, i18n("Import failed:\n\n%1").arg(e->what()), PACKAGE); - tqFatal ("%s", e->what().latin1()); + tqFatal(e->what()); #else - tqFatal ("%s", e->latin1()); + tqFatal(e); #endif // _GNCFILEANON } return true; // to keep compiler happy @@ -948,7 +948,7 @@ bool XmlReader::startElement (const TQString&, const TQString&, const TQString& bool XmlReader::endElement( const TQString&, const TQString&, const TQString&elName ) { try { - if (pMain->xmldebug) tqDebug ("XML end - %s", elName.latin1()); + if (pMain->xmldebug) tqDebug(TQString("XML end - %1").arg(elName)); #ifdef _GNCFILEANON TQString spaces; switch (lastType) { @@ -973,9 +973,9 @@ bool XmlReader::endElement( const TQString&, const TQString&, const TQString&elN #ifndef _GNCFILEANON // we can't pass on exceptions here coz the XML reader won't catch them and we just abort KMessageBox::error(0, i18n("Import failed:\n\n%1").arg(e->what()), PACKAGE); - tqFatal ("%s", e->what().latin1()); + tqFatal(e->what()); #else - tqFatal ("%s", e->latin1()); + tqFatal(e); #endif // _GNCFILEANON } return (true); // to keep compiler happy @@ -985,7 +985,7 @@ bool XmlReader::characters (const TQString &data) { if (pMain->xmldebug) tqDebug ("XML Data received - %d bytes", data.length()); TQString pData = data.stripWhiteSpace(); // data may contain line feeds and indentation spaces if (!pData.isEmpty()) { - if (pMain->developerDebug) tqDebug ("XML Data - %s", pData.latin1()); + if (pMain->developerDebug) tqDebug(TQString("XML Data - %1").arg(pData)); m_co->storeData (pData); //go store it #ifdef _GNCFILEANON TQString anonData = m_co->getData (); @@ -1063,7 +1063,7 @@ void MyMoneyGncReader::readFile(TQIODevice* pDevice, IMyMoneySerialize* storage) ft.commit(); } catch (MyMoneyException *e) { KMessageBox::error(0, i18n("Import failed:\n\n%1").arg(e->what()), PACKAGE); - tqFatal ("%s", e->what().latin1()); + tqFatal(e->what()); } // end catch signalProgress (0, 1, i18n("Import complete")); // switch off progress bar delete m_xr; @@ -1085,7 +1085,7 @@ void MyMoneyGncReader::readFile(TQString in, TQString out) { try { m_xr->processFile (&pDevice); } catch (MyMoneyException *e) { - tqFatal ("%s", e->latin1()); + tqFatal(e); } // end catch delete m_xr; pDevice.close(); @@ -1149,7 +1149,7 @@ void MyMoneyGncReader::convertCommodity (const GncCommodity *gcm) { m_storage->addSecurity(equ); //assign the gnucash id as the key into the map to find our id - if (gncdebug) tqDebug ("mapping, key = %s, id = %s", gcm->id().latin1(), equ.id().data()); + if (gncdebug) tqDebug(TQString("mapping, key = %1, id = %2").arg(gcm->id()).arg(equ.id())); m_mapEquities[gcm->id().utf8()] = equ.id(); } signalProgress (++m_commodityCount, 0); @@ -1168,8 +1168,8 @@ void MyMoneyGncReader::convertPrice (const GncPrice *gpr) { m_storage->addPrice (exchangeRate); } else { MyMoneySecurity e = m_storage->security(m_mapEquities[gpr->commodity()->id().utf8()]); - if (gncdebug) tqDebug ("Searching map, key = %s, found id = %s", - gpr->commodity()->id().latin1(), e.id().data()); + if (gncdebug) tqDebug(TQString("Searching map, key = %1, found id = %2"). + arg(gpr->commodity()->id()).arg(e.id())); e.setTradingCurrency (gpr->currency()->id().utf8()); MyMoneyPrice stockPrice(e.id(), gpr->currency()->id().utf8(), gpr->priceDate(), rate, i18n("Imported History")); m_storage->addPrice (stockPrice); @@ -1272,12 +1272,12 @@ void MyMoneyGncReader::convertAccount (const GncAccount* gac) { m_stockList.append (gac->id()); // set the equity type MyMoneySecurity e = m_storage->security (m_mapEquities[gac->commodity()->id().utf8()]); - if (gncdebug) tqDebug ("Acct equity search, key = %s, found id = %s", - gac->commodity()->id().latin1(), e.id().data()); + if (gncdebug) tqDebug(TQString("Acct equity search, key = %1, found id = %2"). + arg(gac->commodity()->id()).arg(e.id())); acc.setCurrencyId (e.id()); // actually, the security id if ("MUTUAL" == gac->type()) { e.setSecurityType (MyMoneySecurity::SECURITY_MUTUALFUND); - if (gncdebug) tqDebug ("Setting %s to mutual", e.name().latin1()); + if (gncdebug) tqDebug(TQString("Setting %1 to mutual").arg(e.name())); m_storage->modifySecurity (e); } // See if he wants online quotes for this account @@ -1313,9 +1313,10 @@ void MyMoneyGncReader::convertAccount (const GncAccount* gac) { m_storage->addAccount(acc); m_mapIds[gac->id().utf8()] = acc.id(); // to link gnucash id to ours for tx posting - if (gncdebug) tqDebug("Gnucash account %s has id of %s, type of %s, parent is %s", - gac->id().latin1(), acc.id().data(), - KMyMoneyUtils::accountTypeToString(acc.accountType()).latin1(), acc.parentAccountId().data()); + if (gncdebug) tqDebug(TQString("Gnucash account %1 has id of %2, type of %3, parent is %4"). + arg(gac->id()).arg(acc.id()). + arg(KMyMoneyUtils::accountTypeToString(acc.accountType())). + arg(acc.parentAccountId())); signalProgress (++m_accountCount, 0); return ; @@ -1403,9 +1404,9 @@ void MyMoneyGncReader::convertSplit (const GncSplit *gsp) { splitAccount = m_storage->account (kmmAccountId); // print some data so we can maybe identify this split later // TODO : prints personal data - //if (gncdebug) tqDebug ("Split data - gncid %s, kmmid %s, memo %s, value %s, recon state %s", - // gsp->acct().latin1(), kmmAccountId.data(), gsp->memo().latin1(), gsp->value().latin1(), - // gsp->recon().latin1()); + //if (gncdebug) tqDebug(TQString("Split data - gncid %1, kmmid %2, memo %3, value %4, recon state %5"). + // arg(gsp->acct()).arg(kmmAccountId).arg(gsp->memo()).arg(gsp->value()). + // arg(gsp->recon())); // payee id split.setPayeeId (m_txPayeeId.utf8()); // reconciled state and date @@ -1467,9 +1468,9 @@ void MyMoneyGncReader::convertSplit (const GncSplit *gsp) { // we can't use m_storage->security coz security list is not built yet m_storage->currency(m_txCommodity); // will throw exception if not currency e.setTradingCurrency (m_txCommodity); - if (gncdebug) tqDebug ("added price for %s, %s date %s", - e.name().latin1(), newPrice.toString().latin1(), - TQString(m_txDatePosted.toString(Qt::ISODate)).latin1()); + if (gncdebug) tqDebug(TQString("added price for %1, %2 date %3"). + arg(e.name()).arg(newPrice.toString()). + arg(m_txDatePosted.toString(Qt::ISODate))); m_storage->modifySecurity(e); MyMoneyPrice dealPrice (e.id(), m_txCommodity, m_txDatePosted, newPrice, i18n("Imported Transaction")); m_storage->addPrice (dealPrice); @@ -1631,8 +1632,8 @@ void MyMoneyGncReader::convertTemplateSplit (const TQString& schedName, const Gn } // all data read, now check we have everything if ((bFoundStringCreditFormula) && (bFoundStringDebitFormula) && (bFoundGuidAccountId)) { - if (gncdebug) tqDebug ("Found valid slot; credit %s, debit %s, acct %s", - gncCreditFormula.latin1(), gncDebitFormula.latin1(), gncAccountId.latin1()); + if (gncdebug) tqDebug(TQString("Found valid slot; credit %1, debit %2, acct %3"). + arg(gncCreditFormula).arg(gncDebitFormula).arg(gncAccountId)); validSlotCount++; } // validate numeric, work out sign @@ -1657,7 +1658,7 @@ void MyMoneyGncReader::convertTemplateSplit (const TQString& schedName, const Gn exFormula = numericTest; } } else { - if (gncdebug) tqDebug ("%s is not numeric", numericTest.latin1()); + if (gncdebug) tqDebug(TQString("%1 is not numeric").arg(numericTest)); nonNumericFormula = true; } split.setValue (exFormula); @@ -1901,7 +1902,7 @@ void MyMoneyGncReader::terminate () { // this code is just temporary to show us what is in the file. if (gncdebug) tqDebug("%d accounts found in the GnuCash file", (unsigned int)m_mapIds.count()); for (map_accountIds::Iterator it = m_mapIds.begin(); it != m_mapIds.end(); ++it) { - if (gncdebug) tqDebug("key = %s, value = %s", it.key().data(), it.data().data()); + if (gncdebug) tqDebug(TQString("key = %1, value = %2").arg(it.key()).arg(it.data())); } // first step is to implement the users investment option, now we // have all the accounts available @@ -1919,34 +1920,34 @@ void MyMoneyGncReader::terminate () { if ((*acc).parentAccountId() == m_storage->asset().id()) { MyMoneyAccount assets = m_storage->asset(); m_storage->addAccount(assets, (*acc)); - if (gncdebug) tqDebug("Account id %s is a child of the main asset account", (*acc).id().data()); + if (gncdebug) tqDebug(TQString("Account id %1 is a child of the main asset account").arg((*acc).id())); } else if ((*acc).parentAccountId() == m_storage->liability().id()) { MyMoneyAccount liabilities = m_storage->liability(); m_storage->addAccount(liabilities, (*acc)); - if (gncdebug) tqDebug("Account id %s is a child of the main liability account", (*acc).id().data()); + if (gncdebug) tqDebug(TQString("Account id %1 is a child of the main liability account").arg((*acc).id())); } else if ((*acc).parentAccountId() == m_storage->income().id()) { MyMoneyAccount incomes = m_storage->income(); m_storage->addAccount(incomes, (*acc)); - if (gncdebug) tqDebug("Account id %s is a child of the main income account", (*acc).id().data()); + if (gncdebug) tqDebug(TQString("Account id %1 is a child of the main income account").arg((*acc).id())); } else if ((*acc).parentAccountId() == m_storage->expense().id()) { MyMoneyAccount expenses = m_storage->expense(); m_storage->addAccount(expenses, (*acc)); - if (gncdebug) tqDebug("Account id %s is a child of the main expense account", (*acc).id().data()); + if (gncdebug) tqDebug(TQString("Account id %1 is a child of the main expense account").arg((*acc).id())); } else if ((*acc).parentAccountId() == m_storage->equity().id()) { MyMoneyAccount equity = m_storage->equity(); m_storage->addAccount(equity, (*acc)); - if (gncdebug) tqDebug("Account id %s is a child of the main equity account", (*acc).id().data()); + if (gncdebug) tqDebug(TQString("Account id %1 is a child of the main equity account").arg((*acc).id())); } else if ((*acc).parentAccountId() == m_rootId) { - if (gncdebug) tqDebug("Account id %s is a child of root", (*acc).id().data()); + if (gncdebug) tqDebug(TQString("Account id %1 is a child of root").arg((*acc).id())); } else { // it is not under one of the main accounts, so find gnucash parent TQString parentKey = (*acc).parentAccountId(); - if (gncdebug) tqDebug ("acc %s, parent %s", (*acc).id().data(), - (*acc).parentAccountId().data()); + if (gncdebug) tqDebug(TQString("acc %1, parent %2").arg((*acc).id()). + arg((*acc).parentAccountId())); map_accountIds::Iterator id = m_mapIds.find(parentKey); if (id != m_mapIds.end()) { - if (gncdebug) tqDebug("Setting account id %s's parent account id to %s", - (*acc).id().data(), id.data().data()); + if (gncdebug) tqDebug(TQString("Setting account id %1's parent account id to %1"). + arg((*acc).id()).arg(id.data())); MyMoneyAccount parent = m_storage->account(id.data()); parent = checkConsistency (parent, (*acc)); m_storage->addAccount (parent, (*acc)); @@ -2074,13 +2075,13 @@ TQString MyMoneyGncReader::buildReportSection (const TQString& source) { } if (more) s.append (i18n("\n\nPress More for further information")); } else { // we need to retrieve the posted messages for this source - if (gncdebug) tqDebug("Building messages for source %s", source.latin1()); + if (gncdebug) tqDebug(TQString("Building messages for source %1").arg(source)); unsigned int i, j; for (i = 0; i < m_messageList.count(); i++) { GncMessageArgs *m = m_messageList.at(i); if (m->source == source) { - if (gncdebug) tqDebug("%s", TQString("build text source %1, code %2, argcount %3") - .arg(m->source).arg(m->code).arg(m->args.count()).data()); + if (gncdebug) tqDebug(TQString("build text source %1, code %2, argcount %3") + .arg(m->source).arg(m->code).arg(m->args.count())); TQString ss = GncMessages::text (m->source, m->code); // add variable args. the .arg function seems always to replace the // lowest numbered placeholder it finds, so translating messages @@ -2090,7 +2091,7 @@ TQString MyMoneyGncReader::buildReportSection (const TQString& source) { } } } - if (gncdebug) tqDebug ("%s", s.latin1()); + if (gncdebug) tqDebug(s); return (static_cast(s)); PASS } @@ -2220,9 +2221,9 @@ void MyMoneyGncReader::checkInvestmentOption (TQString stockId) { invAcc.setParentAccountId (parentKey); // intersperse it between old parent and child stock acct m_storage->addAccount (invAcc); m_mapIds [invAcc.id()] = invAcc.id(); // so stock account gets parented (again) to investment account later - if (gncdebug) tqDebug ("Created investment account %s as id %s, parent %s", invAcc.name().data(), invAcc.id().data(), - invAcc.parentAccountId().data()); - if (gncdebug) tqDebug ("Setting stock %s, id %s, as child of %s", stockAcc.name().data(), stockAcc.id().data(), invAcc.id().data()); + if (gncdebug) tqDebug(TQString("Created investment account %1 as id %2, parent %3").arg(invAcc.name()).arg(invAcc.id()). + arg(invAcc.parentAccountId())); + if (gncdebug) tqDebug(TQString("Setting stock %1, id %2, as child of %3").arg(stockAcc.name()).arg(stockAcc.id()).arg(invAcc.id())); stockAcc.setParentAccountId (invAcc.id()); m_storage->addAccount(invAcc, stockAcc); // investment option 1 creates a single investment account for all stocks @@ -2243,8 +2244,8 @@ void MyMoneyGncReader::checkInvestmentOption (TQString stockId) { singleInvAcc.setParentAccountId (m_storage->asset().id()); m_storage->addAccount (singleInvAcc); m_mapIds [singleInvAcc.id()] = singleInvAcc.id(); // so stock account gets parented (again) to investment account later - if (gncdebug) tqDebug ("Created investment account %s as id %s, parent %s, reparenting stock", - singleInvAcc.name().data(), singleInvAcc.id().data(), singleInvAcc.parentAccountId().data()); + if (gncdebug) tqDebug(TQString("Created investment account %1 as id %2, parent %3, reparenting stock"). + arg(singleInvAcc.name()).arg(singleInvAcc.id()).arg(singleInvAcc.parentAccountId())); singleInvAccId = singleInvAcc.id(); } else { // the account has already been created singleInvAcc = m_storage->account (singleInvAccId); @@ -2397,8 +2398,8 @@ void MyMoneyGncReader::postMessage (const TQString& source, const unsigned int c // get the number of args this message requires const unsigned int argCount = GncMessages::argCount (source, code); if ((gncdebug) && (argCount != argList.count())) - tqDebug("%s", TQString("MyMoneyGncReader::postMessage debug: Message %1, code %2, requires %3 arguments, got %4") - .arg(source).arg(code).arg(argCount).arg(argList.count()).data()); + tqDebug(TQString("MyMoneyGncReader::postMessage debug: Message %1, code %2, requires %3 arguments, got %4") + .arg(source).arg(code).arg(argCount).arg(argList.count())); // store the arguments for (i = 0; i < argCount; i++) { if (i > argList.count()) m->args.append(TQString()); -- cgit v1.2.1