[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kturtle/Applications/16.12] src: Remove existance checks on saving
From:       Pino Toscano <pino () kde ! org>
Date:       2016-12-04 10:20:49
Message-ID: E1cDTub-0008Bp-TM () code ! kde ! org
[Download RAW message or body]

Git commit acb376348fa0baa5d1eab39f08d0a55d2baaf0b0 by Pino Toscano.
Committed on 04/12/2016 at 10:19.
Pushed by pino into branch 'Applications/16.12'.

Remove existance checks on saving

QFileDialog does that by default already, so when saving on an existing
file there were two confirmation dialogs (one by QFileDialog, and the
second manually done by kturtle).

M  +0    -6    src/editor.cpp
M  +0    -20   src/mainwindow.cpp

https://commits.kde.org/kturtle/acb376348fa0baa5d1eab39f08d0a55d2baaf0b0

diff --git a/src/editor.cpp b/src/editor.cpp
index a5790cb..030a4c2 100644
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -264,12 +264,6 @@ bool Editor::saveFileAs()
                                            QString("%1 (*.turtle);;%2 \
(*)").arg(i18n("Turtle code files")).arg(i18n("All files"))  );
     if (url.isEmpty()) return false;
-    KIO::StatJob *job = KIO::stat(url, KIO::StatJob::SourceSide, 0);
-    if (job->exec() &&
-		KMessageBox::warningContinueCancel(this,
-			i18n("Are you sure you want to overwrite %1?", url.fileName()), i18n("Overwrite \
                Existing File"),
-			KGuiItem(i18n("&Overwrite")), KStandardGuiItem::cancel(), i18n("&Overwrite")
-			) != KMessageBox::Continue) return false;
 	bool result = saveFile(url);
 	return result;
 }
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e318eb8..cc3e145 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1029,14 +1029,6 @@ void MainWindow::exportToPng()
 					       QString("%1 (*.png);;%2 (*)").arg(i18n("PNG Images")).arg(i18n("All \
files")));  if (url.isEmpty())
 		return;
-	KIO::StatJob *job = KIO::stat(url, KIO::StatJob::SourceSide, 0);
-	if (job->exec() &&
-	    KMessageBox::warningContinueCancel(this,
-			i18n("Are you sure you want to overwrite %1?", url.fileName()),
-			i18n("Overwrite Existing File"),KGuiItem(i18n("&Overwrite")),
-			KStandardGuiItem::cancel(), i18n("&Overwrite")) != KMessageBox::Continue) {
-		return;
-	}
 	// get our image from the canvas and save to png
 	QImage pict = canvas->getPicture();
 	if (url.isLocalFile()) {
@@ -1053,12 +1045,6 @@ void MainWindow::exportToSvg()
 	QString path = QFileDialog::getSaveFileName(this, i18n("Save as SVG"), QString(), \
QString("%1 (.*svg);;%2 (*)").arg(i18n("Scalable Vector Graphics")).arg(i18n("All \
files")));  if (path.isEmpty())
 		return;
-	if (QFile::exists(path) &&
-	    KMessageBox::warningContinueCancel(this,
-			i18n("Are you sure you want to overwrite %1?", path),
-			i18n("Overwrite Existing File"),KGuiItem(i18n("&Overwrite")),
-			KStandardGuiItem::cancel(), i18n("&Overwrite")) != KMessageBox::Continue)
-		return;
 	canvas->saveAsSvg(windowTitle(), path);
 }
 
@@ -1069,12 +1055,6 @@ void MainWindow::exportToHtml()
 	QString path = QFileDialog::getSaveFileName(this, i18n("Save code as HTML"), \
QString(), QString("*.html|%1\n*|%2").arg(i18n("HTML documents")).arg(i18n("All \
files")));  if (path.isEmpty())
 		return;
-	if (QFile::exists(path) &&
-	    KMessageBox::warningContinueCancel(this,
-			i18n("Are you sure you want to overwrite %1?", path),
-			i18n("Overwrite Existing File"),KGuiItem(i18n("&Overwrite")),
-			KStandardGuiItem::cancel(), i18n("&Overwrite")) != KMessageBox::Continue)
-		return;
 	QSaveFile file(path);
 	if (!file.open(QIODevice::WriteOnly))
 		return;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic