You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Resolves-rhbz-1065807-...

199 lines
8.4 KiB

11 years ago
From c309eed705edd358ba2db8b26d711d0f8ae41dca Mon Sep 17 00:00:00 2001
11 years ago
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 24 Feb 2014 11:38:13 +0000
11 years ago
Subject: [PATCH 3/4] Resolves: rhbz#1065807 use xdg ~/Templates for default
11 years ago
Template location
(if it exists)
Change-Id: I98fc9fd54d1f56c8bed24ce4d2ebf53756ded2cc
---
11 years ago
framework/source/services/pathsettings.cxx | 6 ++++
11 years ago
.../registry/data/org/openoffice/Office/Paths.xcu | 13 +++++++
shell/source/backends/desktopbe/desktopbackend.cxx | 21 ++++++++---
11 years ago
shell/source/backends/gconfbe/gconfaccess.cxx | 41 ++++++++++++++++------
11 years ago
shell/source/backends/gconfbe/gconfaccess.hxx | 1 +
11 years ago
5 files changed, 66 insertions(+), 16 deletions(-)
11 years ago
diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx
11 years ago
index 15fb3c0..bdb2949 100644
11 years ago
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
11 years ago
@@ -280,6 +280,12 @@ PathSettings::PathInfo PathSettings::impl_readNewFormat(const OUString& sPath)
11 years ago
// read the writeable path
xPath->getByName(CFGPROP_WRITEPATH) >>= aPathVal.sWritePath;
+ // avoid duplicates, by removing the writeable path from
+ // the user defined path list if it happens to be there too
+ OUStringList::iterator aI = aPathVal.lUserPaths.find(aPathVal.sWritePath);
+ if (aI != aPathVal.lUserPaths.end())
+ aPathVal.lUserPaths.erase(aI);
+
// read state props
xPath->getByName(CFGPROP_ISSINGLEPATH) >>= aPathVal.bIsSinglePath;
diff --git a/officecfg/registry/data/org/openoffice/Office/Paths.xcu b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
index 4b5ec7d..2ef605e 100644
--- a/officecfg/registry/data/org/openoffice/Office/Paths.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Paths.xcu
@@ -160,8 +160,21 @@
<node oor:name="InternalPaths">
<node oor:name="$(insturl)/@LIBO_SHARE_FOLDER@/template/$(vlang)" oor:op="fuse"/>
</node>
+ <!--
+ On unix check of we have a ~/Templates and use that as the write path.
+ On other platforms, or if ~/Templates doesn't exist, use the traditional
+ $(userurl)/template path.
+
+ If we end up using the new ~/Templates as the write path, we then want
+ to have $(userurl)/template in our userpath for any templates left behind
+ in that dir.
+ -->
<prop oor:name="WritePath">
<value>$(userurl)/template</value>
+ <value install:module="unixdesktop" oor:external="com.sun.star.configuration.backend.DesktopBackend TemplatePathVariable"/>
+ </prop>
+ <prop oor:name="UserPaths">
+ <value install:module="unixdesktop">$(userurl)/template</value>
</prop>
</node>
<node oor:name="UIConfig" oor:op="fuse" oor:mandatory="true">
diff --git a/shell/source/backends/desktopbe/desktopbackend.cxx b/shell/source/backends/desktopbe/desktopbackend.cxx
11 years ago
index 3e8e8c1..52d8358 100644
11 years ago
--- a/shell/source/backends/desktopbe/desktopbackend.cxx
+++ b/shell/source/backends/desktopbe/desktopbackend.cxx
11 years ago
@@ -154,11 +154,22 @@ css::uno::Any Default::getPropertyValue(OUString const & PropertyName)
11 years ago
css::beans::UnknownPropertyException, css::lang::WrappedTargetException,
css::uno::RuntimeException)
{
- if ( PropertyName == "EnableATToolSupport" || PropertyName == "ExternalMailer" || PropertyName == "SourceViewFontHeight"
- || PropertyName == "SourceViewFontName" || PropertyName == "WorkPathVariable" || PropertyName == "ooInetFTPProxyName"
- || PropertyName == "ooInetFTPProxyPort" || PropertyName == "ooInetHTTPProxyName" || PropertyName == "ooInetHTTPProxyPort"
- || PropertyName == "ooInetHTTPSProxyName" || PropertyName == "ooInetHTTPSProxyPort" || PropertyName == "ooInetNoProxy"
- || PropertyName == "ooInetProxyType" || PropertyName == "givenname" || PropertyName == "sn" )
+ if ( PropertyName == "EnableATToolSupport" ||
+ PropertyName == "ExternalMailer" ||
+ PropertyName == "SourceViewFontHeight" ||
+ PropertyName == "SourceViewFontName" ||
+ PropertyName == "TemplatePathVariable" ||
+ PropertyName == "WorkPathVariable" ||
+ PropertyName == "ooInetFTPProxyName" ||
+ PropertyName == "ooInetFTPProxyPort" ||
+ PropertyName == "ooInetHTTPProxyName" ||
+ PropertyName == "ooInetHTTPProxyPort" ||
+ PropertyName == "ooInetHTTPSProxyName" ||
+ PropertyName == "ooInetHTTPSProxyPort" ||
+ PropertyName == "ooInetNoProxy" ||
+ PropertyName == "ooInetProxyType" ||
+ PropertyName == "givenname" ||
+ PropertyName == "sn" )
{
return css::uno::makeAny(css::beans::Optional< css::uno::Any >());
}
diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
11 years ago
index de8eb29..0d407d6 100644
11 years ago
--- a/shell/source/backends/gconfbe/gconfaccess.cxx
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -23,6 +23,7 @@
#include <string.h>
#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
#include "osl/file.hxx"
#include "osl/security.hxx"
#include "osl/thread.h"
11 years ago
@@ -189,15 +190,8 @@ static OUString xdg_user_dir_lookup (const char *type)
11 years ago
if( osl::FileBase::E_None == aDocumentsDir.open() )
return aDocumentsDirURL;
}
- /* Special case desktop for historical compatibility */
- if (strcmp (type, "DESKTOP") == 0)
- {
- return aHomeDirURL + "/Desktop";
- }
- else
- {
- return aHomeDirURL + "/Documents";
- }
+ /* Use fallbacks historical compatibility if nothing else exists */
+ return aHomeDirURL + "/" + OUString::createFromAscii(type);
}
11 years ago
//------------------------------------------------------------------------------
@@ -317,11 +311,18 @@ uno::Any translateToOOo( const ConfigurationValue &rValue, GConfValue *pGconfVal
11 years ago
case SETTING_WORK_DIRECTORY:
{
- OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
+ OUString aDocumentsDirURL = xdg_user_dir_lookup("Documents");
return uno::makeAny( aDocumentsDirURL );
}
+ case SETTING_TEMPLATE_DIRECTORY:
+ {
+ OUString aTemplatesDirURL = xdg_user_dir_lookup("Templates");
+
+ return uno::makeAny( aTemplatesDirURL );
+ }
+
case SETTING_USER_GIVENNAME:
{
OUString aCompleteName( OStringToOUString(
11 years ago
@@ -392,7 +393,7 @@ sal_Bool SAL_CALL isDependencySatisfied( GConfClient* pClient, const Configurati
11 years ago
case SETTING_WORK_DIRECTORY:
{
- OUString aDocumentsDirURL = xdg_user_dir_lookup("DOCUMENTS");
+ OUString aDocumentsDirURL = xdg_user_dir_lookup("Documents");
osl::Directory aDocumentsDir( aDocumentsDirURL );
if( osl::FileBase::E_None == aDocumentsDir.open() )
11 years ago
@@ -400,6 +401,16 @@ sal_Bool SAL_CALL isDependencySatisfied( GConfClient* pClient, const Configurati
11 years ago
}
break;
+ case SETTING_TEMPLATE_DIRECTORY:
+ {
+ OUString aTemplatesDirURL = xdg_user_dir_lookup("Templates");
+ osl::Directory aTemplatesDir( aTemplatesDirURL );
+
+ if( osl::FileBase::E_None == aTemplatesDir.open() )
+ return sal_True;
+ }
+ break;
+
case SETTING_USER_GIVENNAME:
{
OUString aCompleteName( OStringToOUString(
11 years ago
@@ -563,6 +574,14 @@ ConfigurationValue const ConfigurationValues[] =
11 years ago
},
{
+ SETTING_TEMPLATE_DIRECTORY,
+ "/desktop/gnome/url-handlers/mailto/command", // dummy
+ RTL_CONSTASCII_STRINGPARAM("TemplatePathVariable"),
+ sal_True,
+ SETTING_TEMPLATE_DIRECTORY, // so that the existence of the dir can be checked
+ },
+
+ {
SETTING_USER_GIVENNAME,
"/desktop/gnome/url-handlers/mailto/command", // dummy
RTL_CONSTASCII_STRINGPARAM("givenname"),
diff --git a/shell/source/backends/gconfbe/gconfaccess.hxx b/shell/source/backends/gconfbe/gconfaccess.hxx
index 7f0a52a..3fcd217 100644
--- a/shell/source/backends/gconfbe/gconfaccess.hxx
+++ b/shell/source/backends/gconfbe/gconfaccess.hxx
@@ -47,6 +47,7 @@ enum ConfigurationSetting
SETTING_ENABLE_ACCESSIBILITY,
SETTING_MAILER_PROGRAM,
SETTING_WORK_DIRECTORY,
+ SETTING_TEMPLATE_DIRECTORY,
SETTING_SOURCEVIEWFONT_NAME,
SETTING_SOURCEVIEWFONT_HEIGHT,
SETTING_USER_GIVENNAME,
--
1.8.5.3