View Issue Details

IDProjectCategoryView StatusLast Update
0000166QElectroTechwebsitepublic2021-02-15 00:53
ReporterKristian Assigned Toblack_sun_2012  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformallOSallOS Versionall
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 Files

Activities

scorpio810_mantis

2018-11-25 10:00

administrator   ~0000357

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/");
 }

custom_tbt.diff (1,517 bytes)   

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/");
 }
 
diff --git a/sources/ui/configpage/generalconfigurationpage.ui b/sources/ui/configpage/generalconfigurationpage.ui
index .. 100644
--- a/sources/ui/configpage/generalconfigurationpage.ui
+++ b/sources/ui/configpage/generalconfigurationpage.ui
@@ -41,7 +41,7 @@
       </size>
      </property>
      <property name="currentIndex">
-      <number>0</number>
+      <number>2</number>
      </property>
      <widget class="QWidget" name="tab_3">
       <attribute name="title">
custom_tbt.diff (1,517 bytes)   

scorpio810_mantis

2018-11-25 10:57

administrator   ~0000358

Last edited: 2018-11-25 10:57

Fixed by 5605 commit

Issue History

Date Modified Username Field Change
2018-11-22 10:21 Kristian New Issue
2018-11-22 10:21 Kristian Tag Attached: menu
2018-11-25 10:00 scorpio810_mantis File Added: custom_tbt.diff
2018-11-25 10:00 scorpio810_mantis Note Added: 0000357
2018-11-25 10:01 scorpio810_mantis Assigned To => black_sun_2012
2018-11-25 10:01 scorpio810_mantis Status new => assigned
2018-11-25 10:03 scorpio810_mantis Note Edited: 0000357
2018-11-25 10:57 scorpio810_mantis Note Added: 0000358
2018-11-25 10:57 scorpio810_mantis Note Edited: 0000358
2018-11-25 12:03 scorpio810_mantis Status assigned => resolved
2018-11-25 12:03 scorpio810_mantis Resolution open => fixed
2018-11-25 12:03 scorpio810_mantis Fixed in Version => SVN/trunk
2021-02-15 00:47 user245 Product Version SVN/branches/0.x => SVN/trunk
2021-02-15 00:53 user245 Category other => website