r17524 by craig - Add downloads and user dictionary paths to ScPath
scribus-commit
scribus-commit at lists.scribus.net
Tue May 29 20:26:46 UTC 2012
Author: craig
Date: Tue May 29 20:26:46 2012
New Revision: 17524
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17524
Log:
Add downloads and user dictionary paths to ScPath
Modified:
branches/Version14x/Scribus/scribus/scpaths.cpp
branches/Version14x/Scribus/scribus/scpaths.h
Modified: branches/Version14x/Scribus/scribus/scpaths.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17524&path=/branches/Version14x/Scribus/scribus/scpaths.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scpaths.cpp (original)
+++ branches/Version14x/Scribus/scribus/scpaths.cpp Tue May 29 20:26:46 2012
@@ -260,10 +260,12 @@
QString osxLibreOfficePath("/Applications/LibreOffice.app/Contents/share/extensions");
QString osxUserLibreOfficePath(QDir::homePath()+"/Applications/LibreOffice.app/Contents/share/extensions");
QString linuxLocalPath("/usr/local/share/hunspell/");
- QString linuxPath("/usr/share/hunspell/");
+ QString linuxHunspellPath("/usr/share/hunspell/");
+ QString linuxMyspellPath("/usr/share/myspell/");
QString windowsLOPath("LibreOffice 3.5/share/extensions");
QDir d;
QStringList spellDirs;
+ spellDirs.append(getUserDictDir(false));
spellDirs.append(m_shareDir + "dicts/spelling/");
#ifdef Q_OS_MAC
d.setPath(macPortsPath);
@@ -303,9 +305,12 @@
spellDirs.append(progFiles+windowsLOPath + "/" + dir + "/");
}
#elif defined(Q_WS_X11)
- d.setPath(linuxPath);
- if (d.exists())
- spellDirs.append(linuxPath);
+ d.setPath(linuxHunspellPath);
+ if (d.exists())
+ spellDirs.append(linuxHunspellPath);
+ d.setPath(linuxMyspellPath);
+ if (d.exists())
+ spellDirs.append(linuxMyspellPath);
d.setPath(linuxLocalPath);
if (d.exists())
spellDirs.append(linuxLocalPath);
@@ -412,6 +417,17 @@
#endif
}
+QString ScPaths::getUserDictDir(bool createIfNotExists)
+{
+ QDir userDictDirectory(getApplicationDataDir() + "dicts/");
+ if(createIfNotExists)
+ {
+ if (!userDictDirectory.exists())
+ userDictDirectory.mkpath(userDictDirectory.absolutePath());
+ }
+ return userDictDirectory.absolutePath()+"/";
+}
+
QString ScPaths::getUserDocumentDir(void)
{
#if defined(_WIN32)
@@ -442,6 +458,14 @@
return getApplicationDataDir();
}
+QString ScPaths::downloadDir()
+{
+ QDir downloadDirectory(getApplicationDataDir() + "downloads/");
+ if (!downloadDirectory.exists())
+ downloadDirectory.mkpath(downloadDirectory.absolutePath());
+ return downloadDirectory.absolutePath()+"/";
+}
+
QString ScPaths::getSpecialDir(int folder)
{
QString qstr;
Modified: branches/Version14x/Scribus/scribus/scpaths.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17524&path=/branches/Version14x/Scribus/scribus/scpaths.h
==============================================================================
--- branches/Version14x/Scribus/scribus/scpaths.h (original)
+++ branches/Version14x/Scribus/scribus/scpaths.h Tue May 29 20:26:46 2012
@@ -65,10 +65,15 @@
/** @brief Return path to application data dir*/
static QString getApplicationDataDir(void);
+ /** @brief Return path to application data dir for downloaded dictsionaries*/
+ static QString getUserDictDir(bool createIfNotExists);
+
/** @brief Return path to user documents*/
static QString getUserDocumentDir(void);
/** @brief Return path to directory used for temporary files*/
static QString getTempFileDir(void);
+ /** @brief Return path to directory used for downloaded (permanent) files*/
+ static QString downloadDir(void);
/** @brief Return path to Contents OSX subdirectory*/
QString bundleDir(void) const;
More information about the scribus-commit
mailing list