MantisBT - QElectroTech
View Issue Details
0000166QElectroTechotherpublic2018-11-22 10:212018-11-25 12:03
ReporterKristian 
Assigned Toblack_sun_2012 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformallOSallOS Versionall
Product VersionSVN/branches/0.x 
Target VersionFixed in VersionSVN/trunk 
Summary0000166: Make path to user defined templates configurable
DescriptionWe are working in a team using the same library of a common user collection shared on a network drive. Configuring that folder in settings is very convenient as we are all up to date.



The sme feature would be nice to have for the templates.



Existing: Setting / General / Collection --> User collection path

New: Setting / General / Templates --> User templates path



Thanks in advance

Tagsmenu
Attached Filesdiff custom_tbt.diff (1,517) 2018-11-25 10:00
https://qelectrotech.org/bugtracker/file_download.php?file_id=80&type=bug

Notes
(0000357)
scorpio810   
2018-11-25 10:00   
(Last edited: 2018-11-25 10:03)
Thanks Kristian to report it.
A possible patch, but only work on unix system like linux macOS.
I think we need to add new QFileDialog widget in settings for chose user templates.

diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp
index .. 100644
--- a/sources/qetapp.cpp
+++ b/sources/qetapp.cpp
@@ -491,7 +491,7 @@
         }
     }
     else if (m_user_custom_elements_dir != "default") {
-		return m_user_custom_elements_dir;
+		return m_user_custom_elements_dir + "/elements/";
     }
     
     return(configDir() + "elements/");
@@ -559,6 +559,27 @@
     templates collection.
 */
 QString QETApp::customTitleBlockTemplatesDir() {
+		if (m_user_custom_elements_dir.isEmpty())
+	{
+			QSettings settings;
+			QString path = settings.value("elements-collections/custom-collection-path", "default").toString();

+			if (path != "default" && !path.isEmpty())
+			{
+				QDir dir(path);
+				if (dir.exists())
+				{
+					m_user_custom_elements_dir = path;
+					return m_user_custom_elements_dir;
+				}
+			}
+		else {
+			m_user_custom_elements_dir = "default";
+		}
+	}
+	else if (m_user_custom_elements_dir != "default") {
+		return (m_user_custom_elements_dir + "/titleblocks/");
+	}
+	
     return(configDir() + "titleblocks/");
 }


(0000358)
scorpio810   
2018-11-25 10:57   
Fixed by 5605 commit


Issue History
2018-11-22 10:21KristianNew Issue
2018-11-22 10:21KristianTag Attached: menu
2018-11-25 10:00scorpio810File Added: custom_tbt.diff
2018-11-25 10:00scorpio810Note Added: 0000357
2018-11-25 10:01scorpio810Assigned To => black_sun_2012
2018-11-25 10:01scorpio810Statusnew => assigned
2018-11-25 10:03scorpio810Note Edited: 0000357bug_revision_view_page.php?bugnote_id=357#r208
2018-11-25 10:57scorpio810Note Added: 0000358
2018-11-25 10:57scorpio810Note Edited: 0000358bug_revision_view_page.php?bugnote_id=358#r210
2018-11-25 12:03scorpio810Statusassigned => resolved
2018-11-25 12:03scorpio810Resolutionopen => fixed
2018-11-25 12:03scorpio810Fixed in Version => SVN/trunk