Commit 3f888394 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Prepare some debug

parent 3a4831f3
......@@ -52,6 +52,7 @@ KoQuaZipStore::KoQuaZipStore(const QString &_filename, KoStore::Mode _mode, cons
, dd(new Private())
{
Q_D(KoStore);
debugStore << "KoQuaZipStore" << _filename;
d->localFileName = _filename;
dd->archive = new QuaZip(_filename);
init(appIdentification);
......@@ -63,6 +64,7 @@ KoQuaZipStore::KoQuaZipStore(QIODevice *dev, KoStore::Mode _mode, const QByteArr
, dd(new Private())
{
Q_D(KoStore);
debugStore << "KoQuaZipStore" << dev;
dd->archive = new QuaZip(dev);
init(appIdentification);
}
......@@ -118,6 +120,7 @@ qint64 KoQuaZipStore::write(const char *_data, qint64 _len)
QStringList KoQuaZipStore::directoryList() const
{
debugStore << dd->archive->getFileNameList();
return dd->archive->getFileNameList();
}
......@@ -154,6 +157,7 @@ void KoQuaZipStore::init(const QByteArray &appIdentification)
}
}
else {
debugStore << dd->archive->getEntriesCount() << dd->archive->getFileNameList();
d->good = dd->archive->getEntriesCount();
}
}
......@@ -193,6 +197,7 @@ bool KoQuaZipStore::openWrite(const QString &name)
bool KoQuaZipStore::openRead(const QString &name)
{
Q_D(KoStore);
QString fixedPath = name;
fixedPath.replace("//", "/");
......@@ -205,14 +210,16 @@ bool KoQuaZipStore::openRead(const QString &name)
fixedPath = currentPath() + '/' + fixedPath;
}
debugStore << "openRead" << name << fixedPath << currentPath();
if (!dd->archive->setCurrentFile(fixedPath)) {
warnStore << "\t\tCould not set current file" << dd->archive->getZipError();
qWarning() << "\t\tCould not set current file" << dd->archive->getZipError();
return false;
}
dd->currentFile = new QuaZipFile(dd->archive);
if (!dd->currentFile->open(QIODevice::ReadOnly)) {
warnStore << "\t\t\tBut could not open!!!" << dd->archive->getZipError();
qWarning() << "\t\t\tBut could not open!!!" << dd->archive->getZipError();
return false;
}
d->stream = dd->currentFile;
......@@ -235,18 +242,21 @@ bool KoQuaZipStore::closeRead()
return true;
}
bool KoQuaZipStore::enterRelativeDirectory(const QString &)
bool KoQuaZipStore::enterRelativeDirectory(const QString &path)
{
debugStore << "enterRelativeDirectory()" << path;
return true;
}
bool KoQuaZipStore::enterAbsoluteDirectory(const QString &path)
{
debugStore << "enterAbsoluteDirectory()" << path;
QString fixedPath = path;
fixedPath.replace("//", "/");
if (fixedPath.isEmpty()) {
return true;
fixedPath = "/";
}
QuaZipDir currentDir (dd->archive, fixedPath);
return currentDir.exists();
......@@ -256,5 +266,8 @@ bool KoQuaZipStore::fileExists(const QString &absPath) const
{
QString fixedPath = absPath;
fixedPath.replace("//", "/");
debugStore << "fileExists()" << fixedPath << dd->archive->getFileNameList().contains(fixedPath);
return dd->archive->getFileNameList().contains(fixedPath);
}
......@@ -120,6 +120,8 @@ bool KoStore::open(const QString & _name)
// This also converts from relative to absolute, i.e. merges the currentPath()
d->fileName = d->toExternalNaming(_name);
debugStore << "KOStore" << _name << d->fileName;
if (d->isOpen) {
warnStore << "Store is already opened, missing close";
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment