r21819 by craig - #14667: Ask user to supply a templates folder if none is set when savings as template

scribus-commit scribus-commit at lists.scribus.net
Sun Mar 12 19:04:41 UTC 2017


Author: craig
Date: Sun Mar 12 19:04:41 2017
New Revision: 21819

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21819
Log:
#14667: Ask user to supply a templates folder if none is set when savings as template

Modified:
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21819&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp	(original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp	Sun Mar 12 19:04:41 2017
@@ -11,6 +11,7 @@
 #include "satdialog.h"
 
 #include "scpaths.h"
+#include "ui/scmessagebox.h"
 #include "scribuscore.h"
 #include "scribusdoc.h"
 #include "scribusview.h"
@@ -125,16 +126,19 @@
 	QString userTemplatesDir = ScPaths::instance().userTemplateDir(true);
 	PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
 	QString oldCollect = dirs->get("collect", ".");
-	QString templatesDir = ".";
 	if (userTemplatesDir.isEmpty())
-		templatesDir = ScPaths::instance().templateDir();
-	else
-	{
-		if (userTemplatesDir.right(1) == "/")
-			userTemplatesDir.chop(1);
-		templatesDir = userTemplatesDir;
-	}
-	dirs->set("collect", templatesDir);
+	{
+		ScMessageBox::warning(doc->scMW(), QObject::tr("No User Template Location Defined"), "<qt>" +
+										QObject::tr("You have not defined a location to save document templates to. Please go to Scribus application Preferences and define a location in the Paths section.") + "</qt>",
+										QMessageBox::Ok,	// GUI default
+										QMessageBox::Ok);	// batch default
+		return;
+	}
+
+	if (userTemplatesDir.right(1) == "/")
+		userTemplatesDir.chop(1);
+
+	dirs->set("collect", userTemplatesDir);
 	if (doc->scMW()->fileCollect().isEmpty())
 		return;
 	if (oldCollect != ".")

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21819&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h	(original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.h	Sun Mar 12 19:04:41 2017
@@ -43,8 +43,8 @@
 	Q_OBJECT
 
 public:
-	MenuSAT() {};
-    ~MenuSAT() {};
+	MenuSAT() {}
+	~MenuSAT() {}
 
 public slots:
 	void RunSATPlug(ScribusDoc*);




More information about the scribus-commit mailing list