From 81722cee37d8d8ff6e7862ab738661c174fbc2ec Mon Sep 17 00:00:00 2001
From: Juraj Fedel <wtxnh-scribus@yahoo.com.au>
Date: Sat, 10 Oct 2015 12:25:07 +0200
Subject: [PATCH 2/7] Error message wrong and too verbose

---
 scribus/scribusapp.cpp | 22 +++++++---------------
 scribus/scribusapp.h   |  1 -
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/scribus/scribusapp.cpp b/scribus/scribusapp.cpp
index f9b0eec..233eed5 100644
--- a/scribus/scribusapp.cpp
+++ b/scribus/scribusapp.cpp
@@ -235,7 +235,7 @@ void ScribusQApp::parseCommandLine()
 			}
 			prefsUserFile = QFile::decodeName(args[argi + 1].toLocal8Bit());
 			if (!QFileInfo(prefsUserFile).exists()) {
-				showError(prefsUserFile);
+				std::cout << tr("Preferenes file %1 does not exist, aborting.").arg(prefsUserFile).toLocal8Bit().data() << std::endl;
 				std::exit(EXIT_FAILURE);
 			} else {
 				++argi;
@@ -250,7 +250,7 @@ void ScribusQApp::parseCommandLine()
 			}
 			pythonScript = QFile::decodeName(args[argi + 1].toLocal8Bit());
 			if (!QFileInfo(pythonScript).exists()) {
-				showError(pythonScript);
+				std::cout << tr("Python script %1 does not exist, aborting.").arg(pythonScript).toLocal8Bit().data() << std::endl;
 				std::exit(EXIT_FAILURE);
 			} else {
 				++argi;
@@ -259,6 +259,10 @@ void ScribusQApp::parseCommandLine()
 			argi++;
 			break;
 		} else { //argument is not a known option, but either positional parameter or invalid.
+			if (arg.left(1) == "-") {
+				std::cout << tr("Invalid argument: %1").arg(arg).toLocal8Bit().data() << std::endl;
+				std::exit(EXIT_FAILURE);
+			}
 			break;
 		}
 	}
@@ -266,7 +270,7 @@ void ScribusQApp::parseCommandLine()
 	for ( ; argi<argsc; argi++) {
 		fileName = QFile::decodeName(args[argi].toLocal8Bit());
 		if (!QFileInfo(fileName).exists()) {
-			showError(fileName);
+			std::cout << tr("File %1 does not exist, aborting.").arg(fileName).toLocal8Bit().data() << std::endl;
 			std::exit(EXIT_FAILURE);
 		} else {
 			filesToLoad.append(fileName);
@@ -591,18 +595,6 @@ void ScribusQApp::showHeader()
 	endl(ts);
 }
 
-void ScribusQApp::showError(QString arg)
-{
-	showHeader();
-	if (arg.left(1) == "-" || arg.left(2) == "--") {
-		std::cout << tr("Invalid argument: %1").arg(arg).toLocal8Bit().data() << std::endl;
-	} else {
-		std::cout << tr("File %1 does not exist, aborting.").arg(arg).toLocal8Bit().data() << std::endl;
-	}
-	showUsage();
-	std::cout << tr("Scribus Version").toLocal8Bit().data() << " " << VERSION << std::endl;
-}
-
 void ScribusQApp::neverSplash(bool splashOff)
 {
 	QString prefsDir = ScPaths::getApplicationDataDir();
diff --git a/scribus/scribusapp.h b/scribus/scribusapp.h
index 0add48f..7fc9f7f 100644
--- a/scribus/scribusapp.h
+++ b/scribus/scribusapp.h
@@ -77,7 +77,6 @@ class SCRIBUS_API ScribusQApp : public QApplication
 	private:
 		ScribusCore* m_ScCore;
 		void showHeader();
-		void showError(QString arg);
 		void showVersion();
 		/*!
 		\author Franz Schmid
-- 
2.1.4

