diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp --- a/kmymoney/kmymoney.cpp +++ b/kmymoney/kmymoney.cpp @@ -438,14 +438,6 @@ } } - void ungetString(QIODevice *qfile, char *buf, int len) - { - buf = &buf[len-1]; - while (len--) { - qfile->ungetChar(*buf--); - } - } - bool applyFileFixes() { const auto blocked = MyMoneyFile::instance()->blockSignals(true); @@ -758,13 +750,6 @@ file.close(); - // There's a problem with the KFilterDev and KGPGFile classes: - // One supports the at(n) member but not ungetch() together with - // read() and the other does not provide an at(n) method but - // supports read() that considers the ungetch() buffer. QFile - // supports everything so this is not a problem. We solve the problem - // for now by keeping track of which method can be used. - auto haveAt = true; auto isEncrypted = false; emit q->kmmFilePlugin(preOpen); @@ -778,7 +763,6 @@ sFileHeader == QString("\205\002")) { // PGP binary? if (KGPGFile::GPGAvailable()) { qfile = new KGPGFile(fileName); - haveAt = false; isEncrypted = true; } else { throw MYMONEYEXCEPTION(QString::fromLatin1("%1").arg(i18n("GPG is not available for decryption of file %1", fileName))); @@ -797,10 +781,7 @@ if (qfile->read(qbaFileHeader.data(), 8) != 8) throw MYMONEYEXCEPTION(sFileToShort); - if (haveAt) - qfile->seek(0); - else - ungetString(qfile, qbaFileHeader.data(), 8); + qfile->seek(0); // Ok, we got the first block of 8 bytes. Read in the two // unsigned long int's by preserving endianess. This is @@ -834,10 +815,7 @@ if (qfile->read(qbaFileHeader.data(), 70) != 70) throw MYMONEYEXCEPTION(sFileToShort); - if (haveAt) - qfile->seek(0); - else - ungetString(qfile, qbaFileHeader.data(), 70); + qfile->seek(0); IMyMoneyOperationsFormat* pReader = nullptr; QRegExp kmyexp("");