diff --git a/ark/app/mainwindow.cpp b/ark/app/mainwindow.cpp
index 4723e4a3..4c7d08a9 100644
--- a/ark/app/mainwindow.cpp
+++ b/ark/app/mainwindow.cpp
@@ -251,9 +251,10 @@ void MainWindow::newArchive()
kDebug() << "Supported mimetypes are" << mimeTypes.join( QLatin1String( " " ));
- const KUrl saveFileUrl =
- KFileDialog::getSaveUrl(KUrl("kfiledialog:///ArkNewDir"),
- mimeTypes.join(QLatin1String(" ")));
+ const KUrl saveFileUrl = KFileDialog::getSaveUrl(
+ KUrl("kfiledialog:///ArkNewDir"),
+ mimeTypes.join(QLatin1String(" "))
+ );
m_openArgs.metaData()[QLatin1String( "createNewArchive" )] = QLatin1String( "true" );
diff --git a/ark/part/part.cpp b/ark/part/part.cpp
index 7e04b9b6..fa35f7bf 100644
--- a/ark/part/part.cpp
+++ b/ark/part/part.cpp
@@ -390,29 +390,37 @@ KAboutData* Part::createAboutData()
bool Part::openFile()
{
- const QString localFile(localFilePath());
+ const QString localFile = localFilePath();
const QFileInfo localFileInfo(localFile);
const bool creatingNewArchive =
arguments().metaData()[QLatin1String("createNewArchive")] == QLatin1String("true");
if (localFileInfo.isDir()) {
- KMessageBox::error(NULL, i18nc("@info",
- "%1 is a directory.",
- localFile));
+ KMessageBox::error(
+ NULL,
+ i18nc("@info", "%1 is a directory.", localFile)
+ );
return false;
}
if (creatingNewArchive) {
if (localFileInfo.exists()) {
- int overwrite = KMessageBox::questionYesNo(NULL, i18nc("@info", "The archive %1 already exists. Would you like to open it instead?", localFile), i18nc("@title:window", "File Exists"), KGuiItem(i18n("Open File")), KStandardGuiItem::cancel());
-
+ int overwrite = KMessageBox::questionYesNo(
+ NULL,
+ i18nc("@info", "The archive %1 already exists. Would you like to open it instead?", localFile),
+ i18nc("@title:window", "File Exists"), KGuiItem(i18n("Open File")), KStandardGuiItem::cancel()
+ );
if (overwrite == KMessageBox::No) {
return false;
}
}
} else {
if (!localFileInfo.exists()) {
- KMessageBox::sorry(NULL, i18nc("@info", "The archive %1 was not found.", localFile), i18nc("@title:window", "Error Opening Archive"));
+ KMessageBox::sorry(
+ NULL,
+ i18nc("@info", "The archive %1 was not found.", localFile),
+ i18nc("@title:window", "Error Opening Archive")
+ );
return false;
}
}
@@ -440,7 +448,7 @@ bool Part::openFile()
QStringList mimeComments(mimeTypes.values());
mimeComments.sort();
- bool ok;
+ bool ok = false;
QString item;
if (creatingNewArchive) {
@@ -465,7 +473,11 @@ bool Part::openFile()
}
if (!archive) {
- KMessageBox::sorry(NULL, i18nc("@info", "Ark was not able to open the archive %1. No plugin capable of handling the file was found.", localFile), i18nc("@title:window", "Error Opening Archive"));
+ KMessageBox::sorry(
+ NULL,
+ i18nc("@info", "Ark was not able to open the archive %1. No plugin capable of handling the file was found.", localFile),
+ i18nc("@title:window", "Error Opening Archive")
+ );
return false;
}
@@ -499,7 +511,11 @@ void Part::slotLoadingFinished(KJob *job)
{
if (job->error() != KJob::NoError) {
if (arguments().metaData()[QLatin1String( "createNewArchive" )] != QLatin1String( "true" )) {
- KMessageBox::sorry(NULL, i18nc("@info", "Loading the archive %1 failed with the following error: %2", localFilePath(), job->errorText()), i18nc("@title:window", "Error Opening Archive"));
+ KMessageBox::sorry(
+ NULL,
+ i18nc("@info", "Loading the archive %1 failed with the following error: %2", localFilePath(), job->errorText()),
+ i18nc("@title:window", "Error Opening Archive")
+ );
// The file failed to open, so reset the open archive, info panel and caption.
m_model->setArchive(NULL);
@@ -585,8 +601,7 @@ void Part::slotPreviewExtracted(KJob *job)
// if there's an error or an overwrite dialog,
// the preview dialog will be launched anyway
if (!job->error()) {
- const ArchiveEntry& entry =
- m_model->entryForIndex(m_view->selectionModel()->currentIndex());
+ const ArchiveEntry& entry = m_model->entryForIndex(m_view->selectionModel()->currentIndex());
ExtractJob *extractJob = qobject_cast(job);
Q_ASSERT(extractJob);
@@ -799,8 +814,7 @@ void Part::slotAddFiles(const QStringList& filesToAdd, const QString& path)
return;
}
- connect(job, SIGNAL(result(KJob*)),
- this, SLOT(slotAddFilesDone(KJob*)));
+ connect(job, SIGNAL(result(KJob*)), this, SLOT(slotAddFilesDone(KJob*)));
registerJob(job);
job->start();
}
@@ -842,6 +856,8 @@ void Part::slotAddFilesDone(KJob* job)
{
if (job->error() != KJob::NoError) {
KMessageBox::error(widget(), job->errorString());
+ } else {
+ setModified();
}
}
@@ -849,6 +865,8 @@ void Part::slotDeleteFilesDone(KJob* job)
{
if (job->error() != KJob::NoError) {
KMessageBox::error(widget(), job->errorString());
+ } else {
+ setModified();
}
}
@@ -869,8 +887,7 @@ void Part::slotDeleteFiles()
}
DeleteJob *job = m_model->deleteFiles(selectedFilesWithChildren());
- connect(job, SIGNAL(result(KJob*)),
- this, SLOT(slotDeleteFilesDone(KJob*)));
+ connect(job, SIGNAL(result(KJob*)), this, SLOT(slotDeleteFilesDone(KJob*)));
registerJob(job);
job->start();
}
@@ -899,15 +916,20 @@ void Part::saveSplitterSizes()
void Part::slotSaveAs()
{
- KUrl saveUrl = KFileDialog::getSaveUrl(KUrl(QLatin1String( "kfiledialog:///ArkSaveAs/" ) + url().fileName()), QString(), widget());
+ KUrl saveUrl = KFileDialog::getSaveUrl(
+ KUrl(QLatin1String( "kfiledialog:///ArkSaveAs/" ) + url().fileName()),
+ QString(),
+ widget()
+ );
if ((saveUrl.isValid()) && (!saveUrl.isEmpty())) {
if (KIO::NetAccess::exists(saveUrl, KIO::NetAccess::DestinationSide, widget())) {
- int overwrite = KMessageBox::warningContinueCancel(widget(),
- i18nc("@info", "An archive named %1 already exists. Are you sure you want to overwrite it?", saveUrl.fileName()),
- QString(),
- KStandardGuiItem::overwrite());
-
+ int overwrite = KMessageBox::warningContinueCancel(
+ widget(),
+ i18nc("@info", "An archive named %1 already exists. Are you sure you want to overwrite it?", saveUrl.fileName()),
+ QString(),
+ KStandardGuiItem::overwrite()
+ );
if (overwrite != KMessageBox::Continue) {
return;
}
@@ -917,9 +939,10 @@ void Part::slotSaveAs()
if (!QFile::exists(localFilePath())) {
if (url().isLocalFile()) {
- KMessageBox::error(widget(),
- i18nc("@info", "The archive %1 cannot be copied to the specified location. The archive does not exist anymore.", localFilePath()));
-
+ KMessageBox::error(
+ widget(),
+ i18nc("@info", "The archive %1 cannot be copied to the specified location. The archive does not exist anymore.", localFilePath())
+ );
return;
} else {
srcUrl = url();
@@ -929,8 +952,10 @@ void Part::slotSaveAs()
KIO::Job *copyJob = KIO::file_copy(srcUrl, saveUrl, -1, KIO::Overwrite);
if (!KIO::NetAccess::synchronousRun(copyJob, widget())) {
- KMessageBox::error(widget(),
- i18nc("@info", "The archive could not be saved as %1. Try saving it to another location.", saveUrl.pathOrUrl()));
+ KMessageBox::error(
+ widget(),
+ i18nc("@info", "The archive could not be saved as %1. Try saving it to another location.", saveUrl.pathOrUrl())
+ );
}
}
}
diff --git a/ark/part/part.h b/ark/part/part.h
index 291bdb7b..750c10b7 100644
--- a/ark/part/part.h
+++ b/ark/part/part.h
@@ -55,10 +55,11 @@ public:
Part(QWidget *parentWidget, QObject *parent, const QVariantList &);
~Part();
+
static KAboutData* createAboutData();
- virtual bool openFile();
- virtual bool saveFile();
+ bool openFile() final;
+ bool saveFile() final;
bool isBusy() const;