[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdenlive/Applications/16.08] src: Check frameworks version to decide if we need to handle file over
From: Jean-Baptiste Mardelle <jb () kdenlive ! org>
Date: 2016-07-31 20:48:47
Message-ID: E1bTxfD-0007za-L8 () code ! kde ! org
[Download RAW message or body]
Git commit 8073a2c1525d988b895a9b726d686334513e4fc9 by Jean-Baptiste Mardelle.
Committed on 31/07/2016 at 20:42.
Pushed by mardelle into branch 'Applications/16.08'.
Check frameworks version to decide if we need to handle file overwrite by ourselves
M +6 -0 src/bin/generators/generators.cpp
M +7 -3 src/project/projectmanager.cpp
http://commits.kde.org/kdenlive/8073a2c1525d988b895a9b726d686334513e4fc9
diff --git a/src/bin/generators/generators.cpp b/src/bin/generators/generators.cpp
index f644ac7..03f1479 100644
--- a/src/bin/generators/generators.cpp
+++ b/src/bin/generators/generators.cpp
@@ -30,8 +30,10 @@
#include <QLabel>
#include <QDialogButtonBox>
#include <QFileDialog>
+
#include <KRecentDirs>
#include <KMessageBox>
+#include "kxmlgui_version.h"
Generators::Generators(Monitor *monitor, const QString &path, QWidget *parent) :
QDialog(parent)
@@ -161,11 +163,15 @@ QUrl Generators::getSavedClip(QString clipFolder)
}
QUrl url = QFileDialog::getSaveFileUrl(this, i18n("Save clip"), \
QUrl::fromLocalFile(clipFolder), i18n("MLT playlist (*.mlt)")); if (url.isValid()) {
+#if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5
+ // Since Plasma 5.7 (release at same time as KF 5.23,
+ // the file dialog manages the overwrite check
if (QFile::exists(url.path())) {
if (KMessageBox::warningYesNo(this, i18n("Output file already exists. Do \
you want to overwrite it?")) != KMessageBox::Yes) { return getSavedClip(url.path());
}
}
+#endif
Mlt::Tractor trac(*m_producer->profile());
m_producer->set("length", m_timePos->getValue());
m_producer->set_in_and_out(0, m_timePos->getValue() - 1);
diff --git a/src/project/projectmanager.cpp b/src/project/projectmanager.cpp
index fc84dd4..8da2de3 100644
--- a/src/project/projectmanager.cpp
+++ b/src/project/projectmanager.cpp
@@ -321,7 +321,6 @@ bool ProjectManager::saveFileAs()
fd.setMimeTypeFilters(QStringList()<<QStringLiteral("application/x-kdenlive"));
fd.setAcceptMode(QFileDialog::AcceptSave);
fd.setFileMode(QFileDialog::AnyFile);
- fd.setOption(QFileDialog::DontConfirmOverwrite, false);
fd.setDefaultSuffix(QStringLiteral("kdenlive"));
if (fd.exec() != QDialog::Accepted) {
return false;
@@ -331,12 +330,17 @@ bool ProjectManager::saveFileAs()
}
QString outputFile = fd.selectedFiles().at(0);
- /*if (QFile::exists(outputFile)) {
+#if KXMLGUI_VERSION_MINOR < 23 && KXMLGUI_VERSION_MAJOR == 5
+ // Since Plasma 5.7 (release at same time as KF 5.23,
+ // the file dialog manages the overwrite check
+ if (QFile::exists(outputFile)) {
// Show the file dialog again if the user does not want to overwrite the \
file
if (KMessageBox::questionYesNo(pCore->window(), i18n("File %1 already \
exists.\nDo you want to overwrite it?", outputFile)) == KMessageBox::No) { return \
saveFileAs(); }
- }*/
+ }
+#endif
+
bool ok = false;
QDir cacheDir = m_project->getCacheDir(CacheBase, &ok);
if (ok) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic