summaryrefslogtreecommitdiffstats
path: root/tdecore/tdeglobalsettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdecore/tdeglobalsettings.cpp')
-rw-r--r--tdecore/tdeglobalsettings.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/tdecore/tdeglobalsettings.cpp b/tdecore/tdeglobalsettings.cpp
index 3411fd1b0..e2fbac2c7 100644
--- a/tdecore/tdeglobalsettings.cpp
+++ b/tdecore/tdeglobalsettings.cpp
@@ -66,6 +66,8 @@ TQString* TDEGlobalSettings::s_videosPath = 0;
TQString* TDEGlobalSettings::s_musicPath = 0;
TQString* TDEGlobalSettings::s_downloadPath = 0;
TQString* TDEGlobalSettings::s_picturesPath = 0;
+TQString* TDEGlobalSettings::s_templatesPath = 0;
+TQString* TDEGlobalSettings::s_publicSharePath = 0;
TQFont *TDEGlobalSettings::_generalFont = 0;
TQFont *TDEGlobalSettings::_fixedFont = 0;
TQFont *TDEGlobalSettings::_toolBarFont = 0;
@@ -87,7 +89,8 @@ TDEGlobalSettings::KMouseSettings *TDEGlobalSettings::s_mouseSettings = 0;
// helper function for reading xdg user dirs: it is required in order to take
// care of locale stuff
-void readXdgUserDirs(TQString *desktop, TQString *documents, TQString *videos, TQString *music, TQString *download, TQString *pictures)
+void readXdgUserDirs(TQString *desktop, TQString *documents, TQString *videos, TQString *music,
+ TQString *download, TQString *pictures, TQString *templates, TQString *publicShare)
{
TQFile f( TQDir::homeDirPath() + "/.config/user-dirs.dirs" );
@@ -113,6 +116,10 @@ void readXdgUserDirs(TQString *desktop, TQString *documents, TQString *videos, T
*music = line.remove("XDG_VIDEOS_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath());
else if (line.startsWith("XDG_PICTURES_DIR="))
*pictures = line.remove("XDG_PICTURES_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath());
+ else if (line.startsWith("XDG_TEMPLATES_DIR="))
+ *templates = line.remove("XDG_TEMPLATES_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath());
+ else if (line.startsWith("XDG_PUBLICSHARE_DIR="))
+ *publicShare = line.remove("XDG_PUBLICSHARE_DIR=").remove("\"").replace("$HOME", TQDir::homeDirPath());
line = s.readLine();
}
@@ -531,12 +538,14 @@ void TDEGlobalSettings::initStatic() // should be called initPaths(). Don't put
s_musicPath = new TQString();
s_downloadPath = new TQString();
s_picturesPath = new TQString();
-
+ s_templatesPath = new TQString();
+ s_publicSharePath = new TQString();
TDEConfigGroup g( TDEGlobal::config(), "Paths" );
// Read desktop and documents path using XDG_USER_DIRS
- readXdgUserDirs(s_desktopPath, s_documentPath, s_musicPath, s_videosPath, s_downloadPath, s_picturesPath);
+ readXdgUserDirs(s_desktopPath, s_documentPath, s_musicPath, s_videosPath,
+ s_downloadPath, s_picturesPath, s_templatesPath, s_publicSharePath);
if (s_desktopPath->isEmpty() == true) {
*s_desktopPath = TQDir::homeDirPath() + "/Desktop/";
@@ -566,6 +575,14 @@ void TDEGlobalSettings::initStatic() // should be called initPaths(). Don't put
if ( !s_picturesPath->endsWith("/"))
s_picturesPath->append('/');
+ *s_templatesPath = TQDir::cleanDirPath( *s_templatesPath );
+ if ( !s_templatesPath->endsWith("/"))
+ s_templatesPath->append('/');
+
+ *s_publicSharePath = TQDir::cleanDirPath( *s_publicSharePath );
+ if ( !s_publicSharePath->endsWith("/"))
+ s_publicSharePath->append('/');
+
// Trash Path - TODO remove in KDE4 (tdeio_trash can't use it for interoperability reasons)
*s_trashPath = *s_desktopPath + i18n("Trash") + "/";
*s_trashPath = g.readPathEntry( "Trash" , *s_trashPath);
@@ -638,6 +655,10 @@ void TDEGlobalSettings::rereadPathSettings()
s_downloadPath = 0L;
delete s_musicPath;
s_musicPath = 0L;
+ delete s_templatesPath;
+ s_templatesPath = 0L;
+ delete s_publicSharePath;
+ s_publicSharePath = 0L;
}
TDEGlobalSettings::KMouseSettings & TDEGlobalSettings::mouseSettings()