Commit 39939f81 authored by Ragnar Thomsen's avatar Ragnar Thomsen
Browse files

Add some debug info and comments

parent 9a4a61b0
......@@ -272,7 +272,7 @@ void MainWindow::newArchive()
const QStringList mimeTypes = Kerfuffle::supportedWriteMimeTypes();
qCDebug(ARK) << "Supported mimetypes are" << mimeTypes.join( QLatin1String(" "));
// qCDebug(ARK) << "Supported mimetypes are" << mimeTypes.join( QLatin1String(" "));
QFileDialog dlg(this);
dlg.setMimeTypeFilters(mimeTypes);
......
......@@ -67,7 +67,7 @@ static KService::List findPluginOffers(const QString& filename, const QString& f
{
KService::List offers;
qCDebug(KERFUFFLE) << "Find plugin offers for" << filename << "and mime" << fixedMimeType;
qCDebug(KERFUFFLE) << "Find plugin offers for" << filename << "with mime" << fixedMimeType;
const QString mimeType = fixedMimeType.isEmpty() ? determineMimeType(filename) : fixedMimeType;
......@@ -93,6 +93,8 @@ Archive *Archive::create(const QString &fileName, QObject *parent)
Archive *Archive::create(const QString &fileName, const QString &fixedMimeType, QObject *parent)
{
qCDebug(KERFUFFLE) << "Going to create archive" << fileName;
qRegisterMetaType<ArchiveEntry>("ArchiveEntry");
const KService::List offers = findPluginOffers(fileName, fixedMimeType);
......@@ -130,6 +132,8 @@ Archive::Archive(ReadOnlyArchiveInterface *archiveInterface, QObject *parent)
m_isPasswordProtected(false),
m_isSingleFolderArchive(false)
{
qCDebug(KERFUFFLE) << "Created archive instance";
Q_ASSERT(archiveInterface);
archiveInterface->setParent(this);
}
......@@ -155,6 +159,8 @@ KJob* Archive::create()
ListJob* Archive::list()
{
qCDebug(KERFUFFLE) << "Going to list files";
ListJob *job = new ListJob(m_iface, this);
job->setAutoDelete(false);
......@@ -168,6 +174,8 @@ ListJob* Archive::list()
DeleteJob* Archive::deleteFiles(const QList<QVariant> & files)
{
qCDebug(KERFUFFLE) << "Going to delete files" << files;
if (m_iface->isReadOnly()) {
return 0;
}
......@@ -178,6 +186,7 @@ DeleteJob* Archive::deleteFiles(const QList<QVariant> & files)
AddJob* Archive::addFiles(const QStringList & files, const CompressionOptions& options)
{
qCDebug(KERFUFFLE) << "Going to add files" << files << "with options" << options;
Q_ASSERT(!m_iface->isReadOnly());
AddJob *newJob = new AddJob(files, options, static_cast<ReadWriteArchiveInterface*>(m_iface), this);
connect(newJob, &AddJob::result, this, &Archive::onAddFinished);
......
......@@ -180,6 +180,7 @@ ListJob::ListJob(ReadOnlyArchiveInterface *interface, QObject *parent)
, m_isPasswordProtected(false)
, m_extractedFilesSize(0)
{
qCDebug(KERFUFFLE) << "ListJob started";
connect(this, &ListJob::newEntry, this, &ListJob::onNewEntry);
}
......@@ -241,6 +242,7 @@ ExtractJob::ExtractJob(const QVariantList& files, const QString& destinationDir,
, m_destinationDir(destinationDir)
, m_options(options)
{
qCDebug(KERFUFFLE) << "ExtractJob started";
setDefaultOptions();
}
......@@ -297,10 +299,13 @@ AddJob::AddJob(const QStringList& files, const CompressionOptions& options , Rea
, m_files(files)
, m_options(options)
{
qCDebug(KERFUFFLE) << "AddJob started";
}
void AddJob::doWork()
{
qCDebug(KERFUFFLE) << "AddJob doing work";
emit description(this, i18np("Adding a file", "Adding %1 files", m_files.count()));
ReadWriteArchiveInterface *m_writeInterface =
......
......@@ -387,6 +387,8 @@ void Part::selectionChanged()
bool Part::openFile()
{
qCDebug(PART) << "Attempting to open archive" << localFilePath();
const QString localFile(localFilePath());
const QFileInfo localFileInfo(localFile);
const bool creatingNewArchive =
......@@ -455,6 +457,7 @@ bool Part::openFile()
return false;
}
// Delete archive and point to a new one
archive.reset(Kerfuffle::Archive::create(localFile, mimeTypes.key(item), m_model));
}
......
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