Commit c24f030a authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa
Browse files

Clean up Kerfuffle a little.

Move BatchExtract to app, as it does not really look like
library code, but rather application code.

This, on its turn, made it sometimes necessary to fix some
forward declarations and also made me optimize some others.

svn path=/trunk/KDE/kdeutils/ark/; revision=1114210
parent 26b7536d
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )
set( ark_SRCS main.cpp
mainwindow.cpp
set(ark_SRCS
batchextract.cpp
main.cpp
mainwindow.cpp
)
kde4_add_app_icon(ark_SRCS "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/utilities-file-archiver.png")
......@@ -20,7 +22,7 @@ macro_log_feature( LIBKONQ_FOUND "LIBKONQ" "libkonq library" "kdebase" FALSE ""
if (LIBKONQ_FOUND)
set(extracthere_SRCS extractHereDndPlugin.cpp)
set(extracthere_SRCS batchextract.cpp extractHereDndPlugin.cpp)
kde4_add_plugin(extracthere WITH_PREFIX ${extracthere_SRCS})
target_link_libraries(extracthere kerfuffle ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} ${LIBKONQ_LIBRARY} )
include_directories(${LIBKONQ_INCLUDE_DIR})
......
......@@ -2,6 +2,7 @@
* ark -- archiver for the KDE project
*
* Copyright (C) 2008 Harald Hvaal <haraldhv@stud.ntnu.no>
* Copyright (C) 2009-2010 Raphael Kubo da Costa <kubito@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -27,10 +28,10 @@
#include "batchextract.h"
#include "archive.h"
#include "extractiondialog.h"
#include "jobs.h"
#include "queries.h"
#include "kerfuffle/archive.h"
#include "kerfuffle/extractiondialog.h"
#include "kerfuffle/jobs.h"
#include "kerfuffle/queries.h"
#include <KDebug>
#include <KGlobal>
......@@ -45,8 +46,6 @@
#include <QPointer>
#include <QTimer>
namespace Kerfuffle
{
BatchExtract::BatchExtract()
: m_autoSubfolder(false),
m_preservePaths(true),
......@@ -93,10 +92,11 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive)
connect(job, SIGNAL(percent(KJob*, unsigned long)),
this, SLOT(forwardProgress(KJob *, unsigned long)));
connect(job, SIGNAL(userQuery(Query*)), this, SLOT(slotUserQuery(Query*)));
connect(job, SIGNAL(userQuery(Kerfuffle::Query*)),
this, SLOT(slotUserQuery(Kerfuffle::Query*)));
}
void BatchExtract::slotUserQuery(Query *query)
void BatchExtract::slotUserQuery(Kerfuffle::Query *query)
{
query->execute();
}
......@@ -283,6 +283,5 @@ bool BatchExtract::showExtractDialog()
return true;
}
}
#include <batchextract.moc>
......@@ -2,6 +2,7 @@
* ark -- archiver for the KDE project
*
* Copyright (C) 2008 Harald Hvaal <haraldhv@stud.ntnu.no>
* Copyright (C) 2009-2010 Raphael Kubo da Costa <kubito@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -28,8 +29,6 @@
#ifndef BATCHEXTRACT_H
#define BATCHEXTRACT_H
#include "kerfuffle_export.h"
#include <kcompositejob.h>
#include <KUrl>
......@@ -42,6 +41,7 @@ namespace Kerfuffle
{
class Archive;
class Query;
}
/**
* This class schedules the extraction of all given compressed archives.
......@@ -51,7 +51,7 @@ class Query;
*
* @author Harald Hvaal <haraldhv@stud.ntnu.no>
*/
class KERFUFFLE_EXPORT BatchExtract : public KCompositeJob
class BatchExtract : public KCompositeJob
{
Q_OBJECT
......@@ -68,14 +68,14 @@ public:
/**
* Creates an ExtractJob for the given @p archive and puts it on the queue.
*
*
* If necessary, the destination directory for the archive is created.
*
* @param archive The archive that will be extracted.
*
* @see setAutoSubfolder
*/
void addExtraction(Archive* archive);
void addExtraction(Kerfuffle::Archive* archive);
/**
* A wrapper that calls slotStartJob() when the event loop has started.
......@@ -209,7 +209,7 @@ private slots:
/**
* Shows a query dialog, which may happen when a file already exists.
*/
void slotUserQuery(Query *query);
void slotUserQuery(Kerfuffle::Query *query);
/**
* Does the real work for start() and extracts all scheduled files.
......@@ -224,12 +224,11 @@ private:
QMap<KJob*, QPair<QString, QString> > m_fileNames;
bool m_autoSubfolder;
QList<Archive*> m_inputs;
QList<Kerfuffle::Archive*> m_inputs;
QString m_destinationFolder;
QStringList m_failedFiles;
bool m_preservePaths;
bool m_openDestinationAfterExtraction;
};
}
#endif // BATCHEXTRACT_H
......@@ -20,10 +20,11 @@
*/
#include "extractHereDndPlugin.h"
#include "batchextract.h"
#include <QMenu>
#include <krun.h>
#include "kerfuffle/archive.h"
#include "kerfuffle/batchextract.h"
#include <KPluginFactory>
#include <KPluginLoader>
......@@ -31,8 +32,6 @@
#include <KLocale>
#include <kfileitemlistproperties.h>
using Kerfuffle::BatchExtract;
K_PLUGIN_FACTORY(ExtractHerePluginFactory,
registerPlugin<ExtractHereDndPlugin>();
)
......
......@@ -21,7 +21,7 @@
*/
#include "mainwindow.h"
#include "kerfuffle/batchextract.h"
#include "batchextract.h"
#include "kerfuffle/addtoarchive.h"
#include <KAboutData>
......@@ -34,7 +34,6 @@
#include <QFileInfo>
using Kerfuffle::AddToArchive;
using Kerfuffle::BatchExtract;
int main(int argc, char **argv)
{
......
......@@ -15,7 +15,6 @@ set(kerfuffle_SRCS
adddialog.cpp
queries.cpp
addtoarchive.cpp
batchextract.cpp
cliinterface.cpp
)
......
......@@ -76,7 +76,7 @@ signals:
void entryRemoved(const QString & entry);
void error(const QString& errorMessage, const QString& details);
void newEntry(const ArchiveEntry &);
void userQuery(Query*);
void userQuery(Kerfuffle::Query*);
};
class KERFUFFLE_EXPORT ListJob: public Job
......
......@@ -655,7 +655,7 @@ void ArchiveModel::slotEntryRemoved(const QString & path)
}
}
void ArchiveModel::slotUserQuery(Query *query)
void ArchiveModel::slotUserQuery(Kerfuffle::Query *query)
{
query->execute();
}
......@@ -802,7 +802,8 @@ KJob* ArchiveModel::setArchive(Kerfuffle::Archive *archive)
connect(job, SIGNAL(result(KJob *)),
this, SLOT(slotLoadingFinished(KJob *)));
connect(job, SIGNAL(userQuery(Query*)), this, SLOT(slotUserQuery(Query*)));
connect(job, SIGNAL(userQuery(Kerfuffle::Query*)),
this, SLOT(slotUserQuery(Kerfuffle::Query*)));
emit loadingStarted();
......@@ -824,8 +825,8 @@ ExtractJob* ArchiveModel::extractFiles(const QList<QVariant>& files, const QStri
{
Q_ASSERT(m_archive);
ExtractJob *newJob = m_archive->copyFiles(files, destinationDir, options);
connect(newJob, SIGNAL(userQuery(Query*)),
this, SLOT(slotUserQuery(Query*)));
connect(newJob, SIGNAL(userQuery(Kerfuffle::Query*)),
this, SLOT(slotUserQuery(Kerfuffle::Query*)));
return newJob;
}
......@@ -837,8 +838,8 @@ AddJob* ArchiveModel::addFiles(const QStringList & filenames, const CompressionO
AddJob *job = m_archive->addFiles(filenames, options);
connect(job, SIGNAL(newEntry(const ArchiveEntry&)),
this, SLOT(slotNewEntry(const ArchiveEntry&)));
connect(job, SIGNAL(userQuery(Query*)),
this, SLOT(slotUserQuery(Query*)));
connect(job, SIGNAL(userQuery(Kerfuffle::Query*)),
this, SLOT(slotUserQuery(Kerfuffle::Query*)));
return job;
......@@ -857,8 +858,8 @@ DeleteJob* ArchiveModel::deleteFiles(const QList<QVariant> & files)
connect(job, SIGNAL(finished(KJob*)),
this, SLOT(slotCleanupEmptyDirs()));
connect(job, SIGNAL(userQuery(Query*)),
this, SLOT(slotUserQuery(Query*)));
connect(job, SIGNAL(userQuery(Kerfuffle::Query*)),
this, SLOT(slotUserQuery(Kerfuffle::Query*)));
return job;
}
return 0;
......
......@@ -25,10 +25,13 @@
#include <QAbstractItemModel>
#include <kjobtrackerinterface.h>
#include "kerfuffle/archive.h"
#include "kerfuffle/queries.h"
using Kerfuffle::ArchiveEntry;
using Kerfuffle::Query;
namespace Kerfuffle
{
class Query;
}
class ArchiveNode;
class ArchiveDirNode;
......@@ -83,7 +86,7 @@ private slots:
void slotNewEntry(const ArchiveEntry& entry);
void slotLoadingFinished(KJob *job);
void slotEntryRemoved(const QString & path);
void slotUserQuery(Query *query);
void slotUserQuery(Kerfuffle::Query *query);
void slotCleanupEmptyDirs();
private:
......
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