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

Add -DKDE_DEFAULT_DEBUG_AREA, so that we can omit the debug area number

when calling kDebug().

svn path=/trunk/KDE/kdeutils/ark/; revision=987309
parent 7b011ddd
project(ark)
add_subdirectory( part )
add_subdirectory( app )
add_subdirectory( plugins )
add_subdirectory( kerfuffle )
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1601)
add_subdirectory(part)
add_subdirectory(app)
add_subdirectory(plugins)
add_subdirectory(kerfuffle)
......@@ -69,7 +69,7 @@ void ExtractHereDndPlugin::setup(const KFileItemListProperties& popupMenuInfo,
QString extractHereMessage = i18n("Extract here");
if (!Kerfuffle::supportedMimeTypes().contains(popupMenuInfo.mimeType())) {
kDebug(1601) << "Unsupported file" << popupMenuInfo.mimeType() << Kerfuffle::supportedMimeTypes();
kDebug() << "Unsupported file" << popupMenuInfo.mimeType() << Kerfuffle::supportedMimeTypes();
return;
}
......
......@@ -166,23 +166,23 @@ int main(int argc, char **argv)
}
if (args->isSet("autosubfolder")) {
kDebug(1601) << "Setting autosubfolder";
kDebug() << "Setting autosubfolder";
batchJob->setAutoSubfolder(true);
}
if (args->isSet("subfolder")) {
kDebug(1601) << "Setting subfolder to " << args->getOption("subfolder");
kDebug() << "Setting subfolder to " << args->getOption("subfolder");
batchJob->setSubfolder(args->getOption("subfolder"));
}
if (args->isSet("autodestination")) {
QString autopath = QFileInfo(args->url(0).path()).path();
kDebug(1601) << "By autodestination, setting path to " << autopath;
kDebug() << "By autodestination, setting path to " << autopath;
batchJob->setDestinationFolder(autopath);
}
if (args->isSet("destination")) {
kDebug(1601) << "Setting destination to " << args->getOption("destination");
kDebug() << "Setting destination to " << args->getOption("destination");
batchJob->setDestinationFolder(args->getOption("destination"));
}
......@@ -211,6 +211,6 @@ int main(int argc, char **argv)
}
}
kDebug(1601) << "Entering application loop";
kDebug() << "Entering application loop";
return application.exec();
}
......@@ -76,7 +76,7 @@ MainWindow::~MainWindow()
void MainWindow::dragEnterEvent(QDragEnterEvent * event)
{
kDebug(1601) << event;
kDebug() << event;
Interface *iface = qobject_cast<Interface*>(m_part);
if (iface->isBusy()) return;
......@@ -89,7 +89,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent * event)
void MainWindow::dropEvent(QDropEvent * event)
{
kDebug(1601) << event;
kDebug() << event;
Interface *iface = qobject_cast<Interface*>(m_part);
if (iface->isBusy()) return;
......@@ -105,7 +105,7 @@ void MainWindow::dropEvent(QDropEvent * event)
void MainWindow::dragMoveEvent(QDragMoveEvent * event)
{
kDebug(1601) << event;
kDebug() << event;
Interface *iface = qobject_cast<Interface*>(m_part);
if (iface->isBusy()) return;
......@@ -230,7 +230,7 @@ void MainWindow::newArchive()
Q_ASSERT(iface);
QStringList mimeTypes = iface->supportedWriteMimeTypes();
kDebug(1601) << "Supported mimetypes are" << mimeTypes.join(" ");
kDebug() << "Supported mimetypes are" << mimeTypes.join(" ");
QString saveFile = KFileDialog::getSaveFileName(KUrl("kfiledialog:///ArkNewDir"),
mimeTypes.join(" "));
......
......@@ -57,8 +57,8 @@ bool AddToArchive::showAddDialog(void)
bool ret = dialog->exec();
if (ret) {
kDebug(1601) << "Returned URL:" << dialog->selectedUrl();
kDebug(1601) << "Returned mime:" << dialog->currentMimeFilter();
kDebug() << "Returned URL:" << dialog->selectedUrl();
kDebug() << "Returned mime:" << dialog->currentMimeFilter();
setFilename(dialog->selectedUrl());
setMimeType(dialog->currentMimeFilter());
}
......@@ -86,7 +86,7 @@ bool AddToArchive::addInput(const KUrl& url)
// the returns should be preceded by emitResult().
void AddToArchive::start(void)
{
kDebug(1601);
kDebug();
Kerfuffle::CompressionOptions options;
......@@ -98,7 +98,7 @@ void AddToArchive::start(void)
Kerfuffle::Archive *archive;
if (!m_filename.isEmpty()) {
archive = Kerfuffle::factory(m_filename, m_mimeType);
kDebug(1601) << "Set filename to " + m_filename;
kDebug() << "Set filename to " + m_filename;
} else {
if (m_autoFilenameSuffix.isEmpty()) {
KMessageBox::error(NULL, i18n("You need to either supply a filename for the archive or a suffix (such as rar, tar.tz) with the --autofilename argument."));
......@@ -106,7 +106,7 @@ void AddToArchive::start(void)
}
if (m_firstPath.isEmpty()) {
kDebug(1601) << "Weird, this should not happen. no firstpath defined. aborting";
kDebug() << "Weird, this should not happen. no firstpath defined. aborting";
return;
}
......@@ -129,7 +129,7 @@ void AddToArchive::start(void)
finalName = base + '_' + QString::number(appendNumber) + '.' + m_autoFilenameSuffix;
}
kDebug(1601) << "Autoset filename to " + finalName;
kDebug() << "Autoset filename to " + finalName;
archive = Kerfuffle::factory(finalName, m_mimeType);
}
......@@ -141,7 +141,7 @@ void AddToArchive::start(void)
if (m_changeToFirstPath) {
if (m_firstPath.isEmpty()) {
kDebug(1601) << "Weird, this should not happen. no firstpath defined. aborting";
kDebug() << "Weird, this should not happen. no firstpath defined. aborting";
return;
}
......@@ -152,7 +152,7 @@ void AddToArchive::start(void)
}
options["GlobalWorkDir"] = stripDir.path();
kDebug(1601) << "Setting GlobalWorkDir to " << stripDir.path();
kDebug() << "Setting GlobalWorkDir to " << stripDir.path();
}
Kerfuffle::AddJob *job =
......@@ -168,7 +168,7 @@ void AddToArchive::start(void)
void AddToArchive::slotFinished(KJob *job)
{
kDebug(1601);
kDebug();
if (job->error()) {
KMessageBox::error(NULL, job->errorText());
......
......@@ -65,7 +65,7 @@ namespace Kerfuffle
{
Archive *factory(const QString & filename, const QString & requestedMimeType)
{
kDebug(1601) ;
kDebug() ;
qRegisterMetaType<ArchiveEntry>("ArchiveEntry");
......@@ -76,11 +76,11 @@ Archive *factory(const QString & filename, const QString & requestedMimeType)
KService::List offers = KMimeTypeTrader::self()->query(mimeType, "Kerfuffle/Plugin", "(exist Library)");
if (offers.isEmpty()) {
kDebug(1601) << "Trying to find the mimetype by looking at file content";
kDebug() << "Trying to find the mimetype by looking at file content";
int acc;
QString mimeType = KMimeType::findByFileContent(filename, &acc)->name();
kDebug(1601) << mimeType << acc;
kDebug() << mimeType << acc;
offers = KMimeTypeTrader::self()->query(mimeType, "Kerfuffle/Plugin", "(exist Library)");
}
......@@ -96,7 +96,7 @@ Archive *factory(const QString & filename, const QString & requestedMimeType)
KPluginFactory *factory = loader.factory();
#endif
kDebug(1601) << "Loading library " << libraryName ;
kDebug() << "Loading library " << libraryName ;
if (lib) {
ArchiveFactory *(*pluginFactory)() = (ArchiveFactory * (*)())lib->resolveFunction("pluginFactory");
if (pluginFactory) {
......@@ -106,9 +106,9 @@ Archive *factory(const QString & filename, const QString & requestedMimeType)
return arch;
}
}
kDebug(1601) << "Couldn't load library " << libraryName ;
kDebug() << "Couldn't load library " << libraryName ;
}
kDebug(1601) << "Couldn't find a library capable of handling " << filename ;
kDebug() << "Couldn't find a library capable of handling " << filename ;
return 0;
}
......@@ -131,7 +131,7 @@ QStringList supportedMimeTypes()
supported.append(mimeType);
}
kDebug(1601) << "Returning" << supported;
kDebug() << "Returning" << supported;
return supported;
}
......@@ -155,7 +155,7 @@ QStringList supportedWriteMimeTypes()
supported.append(mimeType);
}
kDebug(1601) << "Returning" << supported;
kDebug() << "Returning" << supported;
return supported;
}
......
......@@ -52,13 +52,13 @@ BatchExtract::BatchExtract()
BatchExtract::~BatchExtract()
{
kDebug(1601) << "Dying";
kDebug() << "Dying";
KIO::getJobTracker()->unregisterJob(this);
}
void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths, QString destinationFolder)
{
kDebug(1601);
kDebug();
QString autoDestination = destinationFolder;
......@@ -70,7 +70,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths
if (destinationDir.exists(subfolderName))
subfolderName = KIO::RenameDialog::suggestName(destinationFolder, subfolderName);
kDebug(1601) << "Auto-creating subfolder" << subfolderName << "under" << destinationFolder;
kDebug() << "Auto-creating subfolder" << subfolderName << "under" << destinationFolder;
destinationDir.mkdir(subfolderName);
autoDestination = destinationFolder + '/' + subfolderName;
......@@ -88,7 +88,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths
connect(job, SIGNAL(userQuery(Query*)), this, SLOT(slotUserQuery(Query*)));
kDebug(1601) << QString("Registering job from archive %1, to %2, preservePaths %3").arg(archive->fileName()).arg(autoDestination).arg(preservePaths);
kDebug() << QString("Registering job from archive %1, to %2, preservePaths %3").arg(archive->fileName()).arg(autoDestination).arg(preservePaths);
addSubjob(job);
m_fileNames[job] = qMakePair(archive->fileName(), destinationFolder);
......@@ -108,10 +108,10 @@ void BatchExtract::setAutoSubfolder(bool value)
void BatchExtract::start()
{
kDebug(1601);
kDebug();
if (!m_subfolder.isEmpty()) {
kDebug(1601) << "Creating subfolder" << m_subfolder;
kDebug() << "Creating subfolder" << m_subfolder;
QDir dest(m_destinationFolder);
dest.mkpath(m_subfolder);
m_destinationFolder += '/' + m_subfolder;
......@@ -139,16 +139,16 @@ void BatchExtract::start()
m_initialJobCount = subjobs().size();
if (!m_initialJobCount) return;
kDebug(1601) << "Starting first job";
kDebug() << "Starting first job";
subjobs().at(0)->start();
}
void BatchExtract::slotResult(KJob *job)
{
kDebug(1601);
kDebug();
if (job->error()) {
kDebug(1601) << "There was en error, " << job->errorText();
kDebug() << "There was en error, " << job->errorText();
setErrorText(job->errorText());
setError(job->error());
......@@ -167,10 +167,10 @@ void BatchExtract::slotResult(KJob *job)
}
if (!subjobs().size()) {
kDebug(1601) << "Finished, emitting the result";
kDebug() << "Finished, emitting the result";
emitResult();
} else {
kDebug(1601) << "Starting the next job";
kDebug() << "Starting the next job";
emit description(this,
i18n("Extracting file..."),
qMakePair(i18n("Source archive"), m_fileNames.value(subjobs().at(0)).first),
......@@ -189,7 +189,7 @@ void BatchExtract::forwardProgress(KJob *job, unsigned long percent)
bool BatchExtract::addInput(const KUrl& url)
{
kDebug(1601);
kDebug();
Kerfuffle::Archive *archive = Kerfuffle::factory(url.path());
if (archive == NULL) return false;
......@@ -214,7 +214,7 @@ void BatchExtract::setSubfolder(QString subfolder)
bool BatchExtract::showExtractDialog()
{
kDebug(1601);
kDebug();
QPointer<Kerfuffle::ExtractionDialog> dialog = new Kerfuffle::ExtractionDialog(NULL);
if (m_inputs.size() > 1) {
......
......@@ -81,7 +81,7 @@ bool CliInterface::list()
bool CliInterface::copyFiles(const QList<QVariant> & files, const QString & destinationDirectory, ExtractionOptions options)
{
kDebug(1601) ;
kDebug() ;
cacheParameterList();
m_mode = Copy;
......@@ -98,7 +98,7 @@ bool CliInterface::copyFiles(const QList<QVariant> & files, const QString & dest
//now replace the various elements in the list
for (int i = 0; i < args.size(); ++i) {
QString argument = args.at(i);
kDebug(1601) << "Processing argument " << argument;
kDebug() << "Processing argument " << argument;
if (argument == "$Archive") {
args[i] = filename();
......@@ -136,7 +136,7 @@ bool CliInterface::copyFiles(const QList<QVariant> & files, const QString & dest
//if we get a hint about this being a password protected archive, ask about
//the password in advance.
if (options.value("PasswordProtectedHint").toBool() && password().isEmpty()) {
kDebug(1601) << "Password hint enabled, querying user";
kDebug() << "Password hint enabled, querying user";
Kerfuffle::PasswordNeededQuery query(filename());
userQuery(&query);
......@@ -180,7 +180,7 @@ bool CliInterface::copyFiles(const QList<QVariant> & files, const QString & dest
QString rootNode;
if (options.contains("RootNode")) {
rootNode = options.value("RootNode").toString();
kDebug(1601) << "Set root node " << rootNode;
kDebug() << "Set root node " << rootNode;
}
if (!rootNode.isEmpty()) {
......@@ -211,7 +211,7 @@ bool CliInterface::copyFiles(const QList<QVariant> & files, const QString & dest
}
}
kDebug(1601) << "Setting current dir to " << destinationDirectory;
kDebug() << "Setting current dir to " << destinationDirectory;
QDir::setCurrent(destinationDirectory);
executeProcess(m_program, args);
......@@ -233,7 +233,7 @@ bool CliInterface::addFiles(const QStringList & files, const CompressionOptions&
QString globalWorkdir = options.value("GlobalWorkDir").toString();
if (!globalWorkdir.isEmpty()) {
kDebug(1601) << "GlobalWorkDir is set, changing dir to " << globalWorkdir;
kDebug() << "GlobalWorkDir is set, changing dir to " << globalWorkdir;
QDir::setCurrent(globalWorkdir);
}
......@@ -243,7 +243,7 @@ bool CliInterface::addFiles(const QStringList & files, const CompressionOptions&
//now replace the various elements in the list
for (int i = 0; i < args.size(); ++i) {
QString argument = args.at(i);
kDebug(1601) << "Processing argument " << argument;
kDebug() << "Processing argument " << argument;
if (argument == "$Archive") {
args[i] = filename();
......@@ -284,7 +284,7 @@ bool CliInterface::deleteFiles(const QList<QVariant> & files)
//now replace the various elements in the list
for (int i = 0; i < args.size(); ++i) {
QString argument = args.at(i);
kDebug(1601) << "Processing argument " << argument;
kDebug() << "Processing argument " << argument;
if (argument == "$Archive") {
args[i] = filename();
......@@ -312,7 +312,7 @@ bool CliInterface::deleteFiles(const QList<QVariant> & files)
bool CliInterface::createProcess()
{
kDebug(1601);
kDebug();
if (m_process) {
delete m_process;
......@@ -335,7 +335,7 @@ bool CliInterface::createProcess()
bool CliInterface::executeProcess(const QString& path, const QStringList & args)
{
kDebug(1601) << "Executing " << path << args;
kDebug() << "Executing " << path << args;
Q_ASSERT(!path.isEmpty());
m_process->setProgram(path, args);
......@@ -356,7 +356,7 @@ void CliInterface::processFinished(int exitCode, QProcess::ExitStatus exitStatus
Q_UNUSED(exitCode);
Q_UNUSED(exitStatus);
kDebug(1601);
kDebug();
//if the m_process pointer is gone, then there is nothing to worry
//about here
......@@ -385,7 +385,7 @@ void CliInterface::processFinished(int exitCode, QProcess::ExitStatus exitStatus
void CliInterface::failOperation()
{
kDebug(1601);
kDebug();
if (m_process)
m_process->terminate();
......@@ -479,7 +479,7 @@ void CliInterface::handleLine(const QString& line)
if (m_mode == Copy) {
if (checkForErrorMessage(line, WrongPasswordPatterns)) {
kDebug(1601) << "Wrong password!";
kDebug() << "Wrong password!";
error(i18n("Incorrect password."));
setPassword(QString());
failOperation();
......@@ -487,7 +487,7 @@ void CliInterface::handleLine(const QString& line)
}
if (checkForErrorMessage(line, ExtractionFailedPatterns)) {
kDebug(1601) << "Error in extraction!!";
kDebug() << "Error in extraction!!";
error(i18n("Extraction failed because of an unexpected error."));
failOperation();
return;
......@@ -527,7 +527,7 @@ bool CliInterface::checkForFileExistsMessage(const QString& line)
m_existsPattern.setPattern(m_param.value(FileExistsExpression).toString());
}
if (m_existsPattern.indexIn(line) != -1) {
kDebug(1601) << "Detected file existing!! Filename " << m_existsPattern.cap(1);
kDebug() << "Detected file existing!! Filename " << m_existsPattern.cap(1);
return true;
}
......@@ -544,10 +544,10 @@ bool CliInterface::handleFileExistsMessage(const QString& line)
Kerfuffle::OverwriteQuery query(QDir::current().path() + '/' + filename);
query.setNoRenameMode(true);
userQuery(&query);
kDebug(1601) << "Waiting response";
kDebug() << "Waiting response";
query.waitForResponse();
kDebug(1601) << "Finished response";
kDebug() << "Finished response";
QString responseToProcess;
QStringList choices = m_param.value(FileExistsInput).toStringList();
......@@ -567,7 +567,7 @@ bool CliInterface::handleFileExistsMessage(const QString& line)
responseToProcess += '\n';
kDebug(1601) << "Writing " << responseToProcess;
kDebug() << "Writing " << responseToProcess;
m_process->write(responseToProcess.toLocal8Bit());
......
......@@ -102,7 +102,7 @@ void ExtractionDialog::accept()
}
QString pathWithSubfolder = url().path(KUrl::AddTrailingSlash) + subfolder() + '/';
kDebug(1601) << pathWithSubfolder << " exists: " << KStandardDirs::exists(pathWithSubfolder);
kDebug() << pathWithSubfolder << " exists: " << KStandardDirs::exists(pathWithSubfolder);
if (extractToSubfolder() && KStandardDirs::exists(pathWithSubfolder)) {
int overWrite = KMessageBox::questionYesNo(NULL, i18n("The folder '%1' already exists. Are you sure you want to extract here?", pathWithSubfolder), i18n("Folder exists") , KGuiItem(i18n("Extract here")), KGuiItem(i18n("Cancel")));
if (overWrite == KMessageBox::No) {
......
......@@ -102,7 +102,7 @@ void Job::onEntryRemoved(const QString & path)
void Job::onFinished(bool result)
{
kDebug(1601);
kDebug();
m_interface->removeObserver(this);
setError(!result);
......@@ -120,10 +120,10 @@ void Job::onUserQuery(Query *query)
bool Job::doKill()
{
kDebug(1601);
kDebug();
bool ret = m_interface->doKill();
if (!ret)
kDebug(1601) << "Killing does not seem to be supported here.";
kDebug() << "Killing does not seem to be supported here.";
return ret;
}
......@@ -190,7 +190,7 @@ void ExtractJob::doWork()
fillInDefaultValues(m_options);
kDebug(1601) << "Starting extraction with selected files "
kDebug() << "Starting extraction with selected files "
<< m_files
<< " Destination dir " << m_destinationDir
<< " And options " << m_options
......@@ -211,7 +211,7 @@ void ExtractJob::fillInDefaultValues(ExtractionOptions& options)
AddJob::AddJob(const QStringList& files, const CompressionOptions& options , ReadWriteArchiveInterface *interface, QObject *parent)
: Job(interface, parent), m_files(files), m_options(options)
{
kDebug(1601);
kDebug();
}
void AddJob::doWork()
......
......@@ -44,7 +44,7 @@ QVariant Query::response()
void Query::waitForResponse()
{
kDebug(1601);
kDebug();
//if there is no response set yet, wait
if (!m_data.contains("response"))
......@@ -54,7 +54,7 @@ void Query::waitForResponse()
void Query::setResponse(QVariant response)
{
kDebug(1601);
kDebug();
m_data["response"] = response;
m_responseCondition.wakeAll();
......
......@@ -36,13 +36,13 @@ ThreadExecution::ThreadExecution(Kerfuffle::Job *job)
void ThreadExecution::run()
{
kDebug(1601) << "Run";
kDebug() << "Run";
m_job->doWork();
exec();
kDebug(1601) << "Finished exec";
kDebug() << "Finished exec";
}
}
......
......@@ -283,7 +283,7 @@ QVariant ArchiveModel::headerData(int section, Qt::Orientation, int role) const
{
if (role == Qt::DisplayRole) {
if (section >= m_showColumns.size()) {
kDebug(1601) << "WEIRD: showColumns.size = " << m_showColumns.size()
kDebug() << "WEIRD: showColumns.size = " << m_showColumns.size()
<< " and section = " << section;
return QVariant();
}
......@@ -397,7 +397,7 @@ int ArchiveModel::columnCount(const QModelIndex &parent) const
void ArchiveModel::sort(int column, Qt::SortOrder order)
{
kDebug(1601);
kDebug();
QList<ArchiveDirNode*> dirNodes;
m_rootNode->returnDirNodes(&dirNodes);
......@@ -437,7 +437,7 @@ QStringList ArchiveModel::mimeTypes() const
QMimeData * ArchiveModel::mimeData(const QModelIndexList & indexes) const
{
kDebug(1601) ;
kDebug() ;
//prepare the fallback kio_slave filenames
QStringList files;
bool noFallback = false;
......@@ -510,7 +510,7 @@ bool ArchiveModel::dropMimeData(const QMimeData * data, Qt::DropAction action, i
}
}
kDebug(1601) << "Dropped onto " << path;
kDebug() << "Dropped onto " << path;
#endif
......@@ -591,7 +591,7 @@ QModelIndex ArchiveModel::indexForNode(ArchiveNode *node)
void ArchiveModel::slotEntryRemoved(const QString & path)
{
// TODO: Do something
kDebug(1601) << "Removed node at path " << path;
kDebug() << "Removed node at path " << path;
ArchiveNode *entry = m_rootNode->findByPath(path.split('/', QString::SkipEmptyParts));
if (entry) {
ArchiveDirNode *parent = entry->parent();
......@@ -605,7 +605,7 @@ void ArchiveModel::slotEntryRemoved(const QString & path)
endRemoveRows();
} else
kDebug(1601) << "Did not find the removed node";
kDebug() << "Did not find the removed node";
}
void ArchiveModel::slotUserQuery(Query *query)
......@@ -630,7 +630,7 @@ void ArchiveModel::slotNewEntry(const ArchiveEntry& entry)
void ArchiveModel::newEntry(const ArchiveEntry& receivedEntry, InsertBehaviour behaviour)
{
if (receivedEntry[FileName].toString().isEmpty()) {
kDebug(1601) << "Weird, received empty entry (no filename) - skipping";
kDebug() << "Weird, received empty entry (no filename) - skipping";
return;
}
......@@ -664,7 +664,7 @@ void ArchiveModel::newEntry(const ArchiveEntry& receivedEntry, InsertBehaviour b
m_showColumns << toInsert;
endInsertColumns();
kDebug(1601) << "Show columns detected: " << m_showColumns;
kDebug() << "Show columns detected: " << m_showColumns;
}
......@@ -678,7 +678,7 @@ void ArchiveModel::newEntry(const ArchiveEntry& receivedEntry, InsertBehaviour b
return;
if (!entry.contains(InternalID))