mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[DataPaths] Don't add trailing slash to paths
Qt API is not adding trailing slashes to dir paths either.
This commit is contained in:
parent
214279e3bb
commit
969f262cf8
@ -150,7 +150,7 @@ AdBlockSubscription* AdBlockManager::addSubscription(const QString &title, const
|
||||
}
|
||||
|
||||
QString fileName = QzTools::filterCharsFromFilename(title.toLower()) + ".txt";
|
||||
QString filePath = QzTools::ensureUniqueFilename(DataPaths::currentProfilePath() + "adblock/" + fileName);
|
||||
QString filePath = QzTools::ensureUniqueFilename(DataPaths::currentProfilePath() + "/adblock/" + fileName);
|
||||
|
||||
QByteArray data = QString("Title: %1\nUrl: %2\n[Adblock Plus 1.1.1]").arg(title, url).toLatin1();
|
||||
|
||||
@ -222,7 +222,7 @@ void AdBlockManager::load()
|
||||
return;
|
||||
}
|
||||
|
||||
QDir adblockDir(DataPaths::currentProfilePath() + "adblock");
|
||||
QDir adblockDir(DataPaths::currentProfilePath() + "/adblock");
|
||||
// Create if neccessary
|
||||
if (!adblockDir.exists()) {
|
||||
QDir(DataPaths::currentProfilePath()).mkdir("adblock");
|
||||
@ -261,7 +261,7 @@ void AdBlockManager::load()
|
||||
if (m_subscriptions.isEmpty()) {
|
||||
AdBlockSubscription* easyList = new AdBlockSubscription(tr("EasyList"), this);
|
||||
easyList->setUrl(QUrl(ADBLOCK_EASYLIST_URL));
|
||||
easyList->setFilePath(DataPaths::currentProfilePath() + "adblock/easylist.txt");
|
||||
easyList->setFilePath(DataPaths::currentProfilePath() + QLatin1String("/adblock/easylist.txt"));
|
||||
connect(easyList, SIGNAL(subscriptionUpdated()), mApp, SLOT(reloadUserStyleSheet()));
|
||||
|
||||
m_subscriptions.prepend(easyList);
|
||||
|
@ -458,7 +458,7 @@ AdBlockSubscription::~AdBlockSubscription()
|
||||
AdBlockCustomList::AdBlockCustomList(QObject* parent)
|
||||
: AdBlockSubscription(tr("Custom Rules"), parent)
|
||||
{
|
||||
setFilePath(DataPaths::currentProfilePath() + "adblock/customlist.txt");
|
||||
setFilePath(DataPaths::currentProfilePath() + QLatin1String("/adblock/customlist.txt"));
|
||||
}
|
||||
|
||||
void AdBlockCustomList::saveSubscription()
|
||||
|
@ -42,13 +42,10 @@ void DataPaths::setPortableVersion()
|
||||
d->m_paths[Config] = d->m_paths[AppData];
|
||||
|
||||
d->m_paths[Profiles] = d->m_paths[Config];
|
||||
d->m_paths[Profiles].first().append(QLatin1String("profiles/"));
|
||||
|
||||
d->m_paths[CrashLogs] = d->m_paths[Config];
|
||||
d->m_paths[CrashLogs].first().append(QLatin1String("crashlogs/"));
|
||||
d->m_paths[Profiles].first().append(QLatin1String("/profiles"));
|
||||
|
||||
d->m_paths[Temp] = d->m_paths[Config];
|
||||
d->m_paths[Temp].first().append(QLatin1String("tmp/"));
|
||||
d->m_paths[Temp].first().append(QLatin1String("/tmp"));
|
||||
}
|
||||
|
||||
// static
|
||||
@ -85,16 +82,16 @@ void DataPaths::init()
|
||||
|
||||
// AppData
|
||||
#if defined(Q_OS_MAC)
|
||||
m_paths[AppData].append(QApplication::applicationDirPath() + QLatin1String("../Resources/"));
|
||||
m_paths[AppData].append(QApplication::applicationDirPath() + QLatin1String("/../Resources"));
|
||||
#elif defined(Q_OS_UNIX) && !defined(NO_SYSTEM_DATAPATH)
|
||||
m_paths[AppData].append(USE_DATADIR "/");
|
||||
m_paths[AppData].append(USE_DATADIR);
|
||||
#else
|
||||
m_paths[AppData].append(QApplication::applicationDirPath() + QLatin1Char('/'));
|
||||
m_paths[AppData].append(QApplication::applicationDirPath());
|
||||
#endif
|
||||
|
||||
m_paths[Translations].append(m_paths[AppData].first() + QLatin1String("locale/"));
|
||||
m_paths[Themes].append(m_paths[AppData].first() + QLatin1String("themes/"));
|
||||
m_paths[Plugins].append(m_paths[AppData].first() + QLatin1String("plugins/"));
|
||||
m_paths[Translations].append(m_paths[AppData].first() + QLatin1String("/locale"));
|
||||
m_paths[Themes].append(m_paths[AppData].first() + QLatin1String("/themes"));
|
||||
m_paths[Plugins].append(m_paths[AppData].first() + QLatin1String("/plugins"));
|
||||
|
||||
// Config
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
||||
@ -106,29 +103,29 @@ void DataPaths::init()
|
||||
#endif
|
||||
// Backwards compatibility
|
||||
if (dataLocation.isEmpty()) {
|
||||
dataLocation = QDir::homePath() + QLatin1String("/.config/qupzilla/");
|
||||
dataLocation = QDir::homePath() + QLatin1String("/.config/qupzilla");
|
||||
}
|
||||
|
||||
QDir confPath = QDir(dataLocation);
|
||||
QDir homePath = QDir(QDir::homePath() + QLatin1String("/.qupzilla/"));
|
||||
QDir homePath = QDir(QDir::homePath() + QLatin1String("/.qupzilla"));
|
||||
|
||||
if (!homePath.exists()) {
|
||||
homePath = QDir::homePath() + QLatin1String("/.config/qupzilla/");
|
||||
homePath = QDir::homePath() + QLatin1String("/.config/qupzilla");
|
||||
}
|
||||
#else // Unix
|
||||
QDir confPath = QDir(QDir::homePath() + QLatin1String("/.config/qupzilla/"));
|
||||
QDir homePath = QDir(QDir::homePath() + QLatin1String("/.qupzilla/"));
|
||||
QDir confPath = QDir(QDir::homePath() + QLatin1String("/.config/qupzilla"));
|
||||
QDir homePath = QDir(QDir::homePath() + QLatin1String("/.qupzilla"));
|
||||
#endif
|
||||
|
||||
if (homePath.exists() && !confPath.exists()) {
|
||||
m_paths[Config].append(homePath.absolutePath() + QLatin1Char('/'));
|
||||
m_paths[Config].append(homePath.absolutePath());
|
||||
|
||||
qWarning() << "WARNING: Using deprecated configuration path" << homePath.absolutePath();
|
||||
qWarning() << "WARNING: This path may not be supported in future versions!";
|
||||
qWarning() << "WARNING: Please move your configuration into" << confPath.absolutePath();
|
||||
}
|
||||
else {
|
||||
m_paths[Config].append(confPath.absolutePath() + QLatin1Char('/'));
|
||||
m_paths[Config].append(confPath.absolutePath());
|
||||
}
|
||||
|
||||
// Make sure the Config path exists
|
||||
@ -136,35 +133,30 @@ void DataPaths::init()
|
||||
dir.mkpath(m_paths[Config].first());
|
||||
|
||||
// Profiles
|
||||
m_paths[Profiles].append(m_paths[Config].first() + QLatin1String("profiles/"));
|
||||
|
||||
// Crashlogs
|
||||
m_paths[CrashLogs].append(m_paths[Config].first() + QLatin1String("crashlogs/"));
|
||||
m_paths[Profiles].append(m_paths[Config].first() + QLatin1String("/profiles"));
|
||||
|
||||
// Temp
|
||||
#ifdef Q_OS_UNIX
|
||||
dir.mkpath(QDir::tempPath() + QLatin1String("/qupzilla/tmp"));
|
||||
m_paths[Temp].append(QDir::tempPath() + QLatin1String("/qupzilla/tmp/"));
|
||||
m_paths[Temp].append(QDir::tempPath() + QLatin1String("/qupzilla/tmp"));
|
||||
#else
|
||||
m_paths[Temp].append(m_paths[Config].first() + QLatin1String("tmp/"));
|
||||
m_paths[Temp].append(m_paths[Config].first() + QLatin1String("/tmp"));
|
||||
#endif
|
||||
|
||||
// We also allow to load data from Config path
|
||||
m_paths[Translations].append(m_paths[Config].first() + QLatin1String("locale/"));
|
||||
m_paths[Themes].append(m_paths[Config].first() + QLatin1String("themes/"));
|
||||
m_paths[Plugins].append(m_paths[Config].first() + QLatin1String("plugins/"));
|
||||
m_paths[Translations].append(m_paths[Config].first() + QLatin1String("/locale"));
|
||||
m_paths[Themes].append(m_paths[Config].first() + QLatin1String("/themes"));
|
||||
m_paths[Plugins].append(m_paths[Config].first() + QLatin1String("/plugins"));
|
||||
|
||||
#ifdef USE_LIBPATH
|
||||
m_paths[Plugins].append(QLatin1String(USE_LIBPATH "/qupzilla/"));
|
||||
m_paths[Plugins].append(QLatin1String(USE_LIBPATH "/qupzilla"));
|
||||
#else
|
||||
// FIXME: This should use QUPZILLA_PREFIX
|
||||
m_paths[Plugins].append(QLatin1String("/usr/lib/qupzilla/"));
|
||||
m_paths[Plugins].append(QLatin1String("/usr/lib/qupzilla"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void DataPaths::initCurrentProfile(const QString &profilePath)
|
||||
{
|
||||
Q_ASSERT(profilePath.endsWith('/'));
|
||||
|
||||
m_paths[CurrentProfile].append(profilePath);
|
||||
}
|
||||
|
@ -25,15 +25,14 @@ class DataPaths
|
||||
{
|
||||
public:
|
||||
enum Path {
|
||||
AppData, // /usr/share/qupzilla/ or . or ../Resources/
|
||||
Translations, // $AppData/locale/
|
||||
Themes, // $AppData/themes/
|
||||
Plugins, // $AppData/plugins/
|
||||
Config, // ~/.config/qupzilla/ or %LOCALAPPDATA%/qupzilla/ or $AppData/data (portable)
|
||||
Profiles, // $Config/profiles/
|
||||
CurrentProfile, // $Profiles/current_profile/
|
||||
CrashLogs, // $Config/crashlogs/
|
||||
Temp // $Config/tmp/
|
||||
AppData, // /usr/share/qupzilla or . or ../Resources
|
||||
Translations, // $AppData/locale
|
||||
Themes, // $AppData/themes
|
||||
Plugins, // $AppData/plugins
|
||||
Config, // ~/.config/qupzilla or %LOCALAPPDATA%/qupzilla or $AppData/data (portable)
|
||||
Profiles, // $Config/profiles
|
||||
CurrentProfile, // $Profiles/current_profile
|
||||
Temp // $Config/tmp
|
||||
};
|
||||
|
||||
explicit DataPaths();
|
||||
|
@ -225,7 +225,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
profileManager.initConfigDir();
|
||||
profileManager.initCurrentProfile(startProfile);
|
||||
|
||||
Settings::createSettings(DataPaths::currentProfilePath() + QLatin1String("settings.ini"));
|
||||
Settings::createSettings(DataPaths::currentProfilePath() + QLatin1String("/settings.ini"));
|
||||
|
||||
m_autoSaver = new AutoSaver(this);
|
||||
connect(m_autoSaver, SIGNAL(save()), this, SLOT(saveStateSlot()));
|
||||
@ -622,8 +622,8 @@ void MainApplication::loadTheme(const QString &name)
|
||||
const QStringList themePaths = DataPaths::allPaths(DataPaths::Themes);
|
||||
|
||||
foreach (const QString &path, themePaths) {
|
||||
const QString theme = path + name + "/";
|
||||
if (QFile::exists(theme + "main.css")) {
|
||||
const QString theme = QString("%1/%2").arg(path, name);
|
||||
if (QFile::exists(theme + "/main.css")) {
|
||||
activeThemePath = theme;
|
||||
break;
|
||||
}
|
||||
@ -631,10 +631,10 @@ void MainApplication::loadTheme(const QString &name)
|
||||
|
||||
if (activeThemePath.isEmpty()) {
|
||||
qWarning() << "Cannot load theme " << name;
|
||||
activeThemePath = DataPaths::path(DataPaths::Themes) + DEFAULT_THEME_NAME + QLatin1Char('/');
|
||||
activeThemePath = DataPaths::path(DataPaths::Themes) + DEFAULT_THEME_NAME;
|
||||
}
|
||||
|
||||
QFile cssFile(activeThemePath + "main.css");
|
||||
QFile cssFile(activeThemePath + "/main.css");
|
||||
cssFile.open(QFile::ReadOnly);
|
||||
QString css = cssFile.readAll();
|
||||
cssFile.close();
|
||||
@ -644,8 +644,8 @@ void MainApplication::loadTheme(const QString &name)
|
||||
* should be enough instead of loading special stylesheets
|
||||
*/
|
||||
#ifdef Q_OS_UNIX
|
||||
if (QFile(activeThemePath + "linux.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "linux.css");
|
||||
if (QFile(activeThemePath + "/linux.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "/linux.css");
|
||||
cssFile.open(QFile::ReadOnly);
|
||||
css.append(cssFile.readAll());
|
||||
cssFile.close();
|
||||
@ -653,8 +653,8 @@ void MainApplication::loadTheme(const QString &name)
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
if (QFile(activeThemePath + "mac.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "mac.css");
|
||||
if (QFile(activeThemePath + "/mac.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "/mac.css");
|
||||
cssFile.open(QFile::ReadOnly);
|
||||
css.append(cssFile.readAll());
|
||||
cssFile.close();
|
||||
@ -662,8 +662,8 @@ void MainApplication::loadTheme(const QString &name)
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
||||
if (QFile(activeThemePath + "windows.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "windows.css");
|
||||
if (QFile(activeThemePath + "/windows.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "/windows.css");
|
||||
cssFile.open(QFile::ReadOnly);
|
||||
css.append(cssFile.readAll());
|
||||
cssFile.close();
|
||||
@ -672,8 +672,8 @@ void MainApplication::loadTheme(const QString &name)
|
||||
|
||||
// RTL Support
|
||||
// Loading 'rtl.css' when layout is right to left!
|
||||
if (isRightToLeft() && QFile(activeThemePath + "rtl.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "rtl.css");
|
||||
if (isRightToLeft() && QFile(activeThemePath + "/rtl.css").exists()) {
|
||||
cssFile.setFileName(activeThemePath + "/rtl.css");
|
||||
cssFile.open(QFile::ReadOnly);
|
||||
css.append(cssFile.readAll());
|
||||
cssFile.close();
|
||||
@ -739,7 +739,7 @@ void MainApplication::backupSavedSessions()
|
||||
// session.dat.old - first backup
|
||||
// session.dat.old1 - second backup
|
||||
|
||||
const QString sessionFile = DataPaths::currentProfilePath() + QLatin1String("session.dat");
|
||||
const QString sessionFile = DataPaths::currentProfilePath() + QLatin1String("/session.dat");
|
||||
|
||||
if (!QFile::exists(sessionFile)) {
|
||||
return;
|
||||
@ -816,7 +816,7 @@ void MainApplication::saveSettings()
|
||||
qzSettings->saveSettings();
|
||||
AdBlockManager::instance()->save();
|
||||
IconProvider::instance()->saveIconsToDatabase();
|
||||
QFile::remove(DataPaths::currentProfilePath() + QLatin1String("WebpageIcons.db"));
|
||||
QFile::remove(DataPaths::currentProfilePath() + QLatin1String("/WebpageIcons.db"));
|
||||
Settings::syncSettings();
|
||||
}
|
||||
|
||||
@ -1109,7 +1109,7 @@ bool MainApplication::saveStateSlot()
|
||||
qupzilla_->tabWidget()->savePinnedTabs();
|
||||
}
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + QLatin1String("session.dat"));
|
||||
QFile file(DataPaths::currentProfilePath() + QLatin1String("/session.dat"));
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(data);
|
||||
file.close();
|
||||
|
@ -73,7 +73,7 @@ void ProfileManager::initConfigDir() const
|
||||
|
||||
void ProfileManager::initCurrentProfile(const QString &profileName)
|
||||
{
|
||||
QString profilePath = DataPaths::path(DataPaths::Profiles);
|
||||
QString profilePath = DataPaths::path(DataPaths::Profiles) + QLatin1Char('/');
|
||||
|
||||
if (profileName.isEmpty()) {
|
||||
profilePath.append(startingProfile());
|
||||
@ -82,7 +82,7 @@ void ProfileManager::initCurrentProfile(const QString &profileName)
|
||||
profilePath.append(profileName);
|
||||
}
|
||||
|
||||
DataPaths::setCurrentProfilePath(profilePath + QLatin1Char('/'));
|
||||
DataPaths::setCurrentProfilePath(profilePath);
|
||||
|
||||
updateCurrentProfile();
|
||||
connectDatabase();
|
||||
@ -126,9 +126,6 @@ bool ProfileManager::removeProfile(const QString &profileName)
|
||||
|
||||
QString ProfileManager::currentProfile() const
|
||||
{
|
||||
//const QString path = DataPaths::currentProfilePath();
|
||||
//return path.mid(path.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
|
||||
QString path = DataPaths::currentProfilePath();
|
||||
path = path.mid(0, path.size() - 1);
|
||||
return path.mid(path.lastIndexOf(QLatin1Char('/')) + 1);
|
||||
@ -136,13 +133,13 @@ QString ProfileManager::currentProfile() const
|
||||
|
||||
QString ProfileManager::startingProfile() const
|
||||
{
|
||||
QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("profiles.ini"), QSettings::IniFormat);
|
||||
QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat);
|
||||
return settings.value(QLatin1String("Profiles/startProfile"), QLatin1String("default")).toString();
|
||||
}
|
||||
|
||||
void ProfileManager::setStartingProfile(const QString &profileName)
|
||||
{
|
||||
QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("profiles.ini"), QSettings::IniFormat);
|
||||
QSettings settings(DataPaths::path(DataPaths::Profiles) + QLatin1String("/profiles.ini"), QSettings::IniFormat);
|
||||
settings.setValue(QLatin1String("Profiles/startProfile"), profileName);
|
||||
}
|
||||
|
||||
@ -249,7 +246,7 @@ void ProfileManager::copyDataToProfile()
|
||||
|
||||
void ProfileManager::connectDatabase()
|
||||
{
|
||||
const QString dbFile = DataPaths::currentProfilePath() + QLatin1String("browsedata.db");
|
||||
const QString dbFile = DataPaths::currentProfilePath() + QLatin1String("/browsedata.db");
|
||||
|
||||
// Reconnect
|
||||
if (m_databaseConnected) {
|
||||
|
@ -115,7 +115,7 @@ void CookieJar::restoreCookies()
|
||||
return;
|
||||
}
|
||||
|
||||
const QString cookiesFile = DataPaths::currentProfilePath() + QLatin1String("cookies.dat");
|
||||
const QString cookiesFile = DataPaths::currentProfilePath() + QLatin1String("/cookies.dat");
|
||||
QDateTime now = QDateTime::currentDateTime();
|
||||
|
||||
QList<QNetworkCookie> restoredCookies;
|
||||
@ -165,7 +165,7 @@ void CookieJar::saveCookies()
|
||||
}
|
||||
}
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + QLatin1String("cookies.dat"));
|
||||
QFile file(DataPaths::currentProfilePath() + QLatin1String("/cookies.dat"));
|
||||
file.open(QIODevice::WriteOnly);
|
||||
QDataStream stream(&file);
|
||||
int count = cookies.count();
|
||||
|
@ -35,9 +35,9 @@ CaBundleUpdater::CaBundleUpdater(NetworkManager* manager, QObject* parent)
|
||||
, m_reply(0)
|
||||
, m_latestBundleVersion(0)
|
||||
{
|
||||
m_bundleVersionFileName = DataPaths::path(DataPaths::Config) + "certificates/bundle_version";
|
||||
m_bundleFileName = DataPaths::path(DataPaths::Config) + "certificates/ca-bundle.crt";
|
||||
m_lastUpdateFileName = DataPaths::path(DataPaths::Config) + "certificates/last_update";
|
||||
m_bundleVersionFileName = DataPaths::path(DataPaths::Config) + "/certificates/bundle_version";
|
||||
m_bundleFileName = DataPaths::path(DataPaths::Config) + "/certificates/ca-bundle.crt";
|
||||
m_lastUpdateFileName = DataPaths::path(DataPaths::Config) + "/certificates/last_update";
|
||||
|
||||
int updateTime = 30 * 1000;
|
||||
|
||||
|
@ -112,7 +112,7 @@ void NetworkManager::loadSettings()
|
||||
m_acceptLanguage = AcceptLanguage::generateHeader(settings.value("Language/acceptLanguage", AcceptLanguage::defaultLanguage()).toStringList());
|
||||
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_HAIKU) || defined(Q_OS_OS2)
|
||||
QString certDir = DataPaths::currentProfilePath() + "certificates";
|
||||
QString certDir = DataPaths::currentProfilePath() + "/certificates";
|
||||
QString bundlePath = certDir + "/ca-bundle.crt";
|
||||
QString bundleVersionPath = certDir + "/bundle_version";
|
||||
|
||||
@ -594,7 +594,7 @@ void NetworkManager::removeLocalCertificate(const QSslCertificate &cert)
|
||||
|
||||
// Delete cert file from profile
|
||||
bool deleted = false;
|
||||
QDirIterator it(DataPaths::currentProfilePath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
|
||||
QDirIterator it(DataPaths::currentProfilePath() + "/certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
const QString filePath = it.next();
|
||||
const QList<QSslCertificate> &certs = QSslCertificate::fromPath(filePath);
|
||||
@ -634,7 +634,7 @@ void NetworkManager::addLocalCertificate(const QSslCertificate &cert)
|
||||
}
|
||||
|
||||
QString certFileName = fileNameForCert(cert);
|
||||
QString fileName = QzTools::ensureUniqueFilename(DataPaths::currentProfilePath() + "certificates/" + certFileName);
|
||||
QString fileName = QzTools::ensureUniqueFilename(DataPaths::currentProfilePath() + "/certificates/" + certFileName);
|
||||
|
||||
QFile file(fileName);
|
||||
if (file.open(QFile::WriteOnly)) {
|
||||
@ -726,7 +726,7 @@ void NetworkManager::loadCertificates()
|
||||
}
|
||||
// Local Certificates
|
||||
#ifdef Q_OS_WIN
|
||||
QDirIterator it_(DataPaths::currentProfilePath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
|
||||
QDirIterator it_(DataPaths::currentProfilePath() + "/certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
|
||||
while (it_.hasNext()) {
|
||||
QString filePath = it_.next();
|
||||
if (!filePath.endsWith(QLatin1String(".crt"))) {
|
||||
@ -739,7 +739,7 @@ void NetworkManager::loadCertificates()
|
||||
}
|
||||
}
|
||||
#else
|
||||
m_localCerts = QSslCertificate::fromPath(DataPaths::currentProfilePath() + "certificates/*.crt", QSsl::Pem, QRegExp::Wildcard);
|
||||
m_localCerts = QSslCertificate::fromPath(DataPaths::currentProfilePath() + "/certificates/*.crt", QSsl::Pem, QRegExp::Wildcard);
|
||||
#endif
|
||||
|
||||
QSslSocket::setDefaultCaCertificates(m_caCerts + m_localCerts);
|
||||
|
@ -99,7 +99,7 @@ void PacManager::replyFinished()
|
||||
m_reply->deleteLater();
|
||||
m_reply = 0;
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + "proxy.pac");
|
||||
QFile file(DataPaths::currentProfilePath() + "/proxy.pac");
|
||||
|
||||
if (!file.open(QFile::WriteOnly)) {
|
||||
qWarning() << "PacManager: Cannot open PAC file for writing" << file.fileName();
|
||||
@ -118,7 +118,7 @@ void PacManager::reloadScript()
|
||||
m_pacrunner = new ProxyAutoConfig(this);
|
||||
}
|
||||
|
||||
QFile file(m_url.scheme() == QLatin1String("file") ? m_url.path() : DataPaths::currentProfilePath() + "proxy.pac");
|
||||
QFile file(m_url.scheme() == QLatin1String("file") ? m_url.path() : DataPaths::currentProfilePath() + "/proxy.pac");
|
||||
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qWarning() << "PacManager: Cannot open PAC file for reading" << file.fileName();
|
||||
|
@ -397,9 +397,9 @@ QString QupZillaSchemeReply::configPage()
|
||||
|
||||
cPage.replace(QLatin1String("%PATHS-TEXT%"),
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Profile"), DataPaths::currentProfilePath()) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), DataPaths::currentProfilePath() + "settings.ini") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), DataPaths::currentProfilePath() + "session.dat") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Pinned tabs"), DataPaths::currentProfilePath() + "pinnedtabs.dat") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Settings"), DataPaths::currentProfilePath() + "/settings.ini") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Saved session"), DataPaths::currentProfilePath() + "/session.dat") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Pinned tabs"), DataPaths::currentProfilePath() + "/pinnedtabs.dat") +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Data"), DataPaths::path(DataPaths::AppData)) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), DataPaths::path(DataPaths::Themes)) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Translations"), DataPaths::path(DataPaths::Translations)));
|
||||
|
@ -68,7 +68,7 @@ void ClearPrivateData::clearLocalStorage()
|
||||
{
|
||||
const QString profile = DataPaths::currentProfilePath();
|
||||
|
||||
QzTools::removeDir(profile + "LocalStorage");
|
||||
QzTools::removeDir(profile + "/LocalStorage");
|
||||
}
|
||||
|
||||
void ClearPrivateData::clearWebDatabases()
|
||||
@ -76,7 +76,7 @@ void ClearPrivateData::clearWebDatabases()
|
||||
const QString profile = DataPaths::currentProfilePath();
|
||||
|
||||
QWebDatabase::removeAllDatabases();
|
||||
QzTools::removeDir(profile + "Databases");
|
||||
QzTools::removeDir(profile + "/Databases");
|
||||
}
|
||||
|
||||
void ClearPrivateData::clearCache()
|
||||
@ -84,7 +84,7 @@ void ClearPrivateData::clearCache()
|
||||
mApp->networkCache()->clear();
|
||||
mApp->webSettings()->clearMemoryCaches();
|
||||
|
||||
QFile::remove(DataPaths::currentProfilePath() + "ApplicationCache.db");
|
||||
QFile::remove(DataPaths::currentProfilePath() + "/ApplicationCache.db");
|
||||
}
|
||||
|
||||
void ClearPrivateData::clearIcons()
|
||||
@ -175,12 +175,12 @@ void ClearPrivateData::optimizeDb()
|
||||
{
|
||||
mApp->setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
QString profilePath = DataPaths::currentProfilePath();
|
||||
QString sizeBefore = QzTools::fileSizeToString(QFileInfo(profilePath + "browsedata.db").size());
|
||||
const QString profilePath = DataPaths::currentProfilePath();
|
||||
QString sizeBefore = QzTools::fileSizeToString(QFileInfo(profilePath + "/browsedata.db").size());
|
||||
|
||||
mApp->history()->optimizeHistory();
|
||||
|
||||
QString sizeAfter = QzTools::fileSizeToString(QFileInfo(profilePath + "browsedata.db").size());
|
||||
QString sizeAfter = QzTools::fileSizeToString(QFileInfo(profilePath + "/browsedata.db").size());
|
||||
|
||||
mApp->restoreOverrideCursor();
|
||||
|
||||
|
@ -125,7 +125,7 @@ void Plugins::loadPlugins()
|
||||
return;
|
||||
}
|
||||
|
||||
QDir settingsDir(DataPaths::currentProfilePath() + "extensions/");
|
||||
QDir settingsDir(DataPaths::currentProfilePath() + "/extensions/");
|
||||
if (!settingsDir.exists()) {
|
||||
settingsDir.mkdir(settingsDir.absolutePath());
|
||||
}
|
||||
@ -213,7 +213,7 @@ PluginInterface* Plugins::initPlugin(PluginInterface::InitState state, PluginInt
|
||||
return 0;
|
||||
}
|
||||
|
||||
interface->init(state, DataPaths::currentProfilePath() + "extensions/");
|
||||
interface->init(state, DataPaths::currentProfilePath() + "/extensions/");
|
||||
|
||||
if (!interface->testPlugin()) {
|
||||
interface->unload();
|
||||
|
@ -37,7 +37,7 @@ SpellCheckDialog::SpellCheckDialog(QWidget* parent)
|
||||
|
||||
ui->dictPath->setText(Speller::instance()->dictionaryPath());
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + "userdictionary.txt");
|
||||
QFile file(DataPaths::currentProfilePath() + "/userdictionary.txt");
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qWarning() << "SpellCheckDialog: Cannot open file" << file.fileName() << "for reading!";
|
||||
}
|
||||
@ -114,7 +114,7 @@ void SpellCheckDialog::saveSettings()
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + "userdictionary.txt");
|
||||
QFile file(DataPaths::currentProfilePath() + "/userdictionary.txt");
|
||||
if (!file.open(QFile::WriteOnly | QFile::Truncate)) {
|
||||
qWarning() << "SpellCheckDialog: Cannot open file" << file.fileName() << "for reading!";
|
||||
return;
|
||||
|
@ -65,7 +65,7 @@ void Speller::loadSettings()
|
||||
m_language.name = nameForLanguage(m_language.code);
|
||||
settings.endGroup();
|
||||
|
||||
m_userDictionary.setFileName(DataPaths::currentProfilePath() + "userdictionary.txt");
|
||||
m_userDictionary.setFileName(DataPaths::currentProfilePath() + "/userdictionary.txt");
|
||||
|
||||
if (m_enabled) {
|
||||
initialize();
|
||||
@ -393,7 +393,7 @@ QString Speller::getDictionaryPath() const
|
||||
#ifdef Q_OS_UNIX
|
||||
const QString defaultDicPath = "/usr/share/hunspell/";
|
||||
#else
|
||||
const QString defaultDicPath = DataPaths::path(DataPaths::AppData) + "hunspell/";
|
||||
const QString defaultDicPath = DataPaths::path(DataPaths::AppData) + "/hunspell/";
|
||||
#endif
|
||||
|
||||
QString dicPath = QString::fromLocal8Bit(qgetenv("DICPATH")).trimmed();
|
||||
|
@ -63,7 +63,7 @@ void SpeedDial::loadSettings()
|
||||
}
|
||||
changed(allPages);
|
||||
|
||||
m_thumbnailsDir = DataPaths::currentProfilePath() + "thumbnails/";
|
||||
m_thumbnailsDir = DataPaths::currentProfilePath() + "/thumbnails/";
|
||||
|
||||
// If needed, create thumbnails directory
|
||||
if (!QDir(m_thumbnailsDir).exists()) {
|
||||
|
@ -290,6 +290,7 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent)
|
||||
ui->allowCache->setChecked(settings.value("AllowLocalCache", true).toBool());
|
||||
ui->cacheMB->setValue(settings.value("LocalCacheSize", 50).toInt());
|
||||
ui->MBlabel->setText(settings.value("LocalCacheSize", 50).toString() + " MB");
|
||||
// FIXME: !!!
|
||||
ui->cachePath->setText(settings.value("CachePath", QString("%1networkcache/").arg(DataPaths::currentProfilePath())).toString());
|
||||
connect(ui->allowCache, SIGNAL(clicked(bool)), this, SLOT(allowCacheChanged(bool)));
|
||||
connect(ui->cacheMB, SIGNAL(valueChanged(int)), this, SLOT(cacheValueChanged(int)));
|
||||
@ -1068,9 +1069,8 @@ void Preferences::saveSettings()
|
||||
settings.setValue("ProxyExceptions", ui->proxyExceptions->text().split(QLatin1Char(','), QString::SkipEmptyParts));
|
||||
settings.endGroup();
|
||||
|
||||
//Profiles
|
||||
QSettings profileSettings(DataPaths::path(DataPaths::Config) + "profiles/profiles.ini", QSettings::IniFormat);
|
||||
profileSettings.setValue("Profiles/startProfile", ui->startProfile->currentText());
|
||||
ProfileManager profileManager;
|
||||
profileManager.setStartingProfile(ui->startProfile->currentText());
|
||||
|
||||
m_pluginsList->save();
|
||||
m_themesManager->save();
|
||||
|
@ -47,7 +47,7 @@ ThemeManager::ThemeManager(QWidget* parent, Preferences* preferences)
|
||||
QDir dir(path);
|
||||
QStringList list = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
foreach (const QString &name, list) {
|
||||
Theme themeInfo = parseTheme(dir.absoluteFilePath(name) + "/", name);
|
||||
Theme themeInfo = parseTheme(dir.absoluteFilePath(name) + QLatin1Char('/'), name);
|
||||
if (!themeInfo.isValid) {
|
||||
continue;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
RestoreManager::RestoreManager()
|
||||
{
|
||||
createFromFile(DataPaths::currentProfilePath() + QLatin1String("session.dat"));
|
||||
createFromFile(DataPaths::currentProfilePath() + QLatin1String("/session.dat"));
|
||||
}
|
||||
|
||||
RestoreData RestoreManager::restoreData() const
|
||||
|
@ -901,7 +901,7 @@ void TabWidget::savePinnedTabs()
|
||||
stream << tabs;
|
||||
stream << tabsHistory;
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + "pinnedtabs.dat");
|
||||
QFile file(DataPaths::currentProfilePath() + "/pinnedtabs.dat");
|
||||
file.open(QIODevice::WriteOnly);
|
||||
file.write(data);
|
||||
file.close();
|
||||
@ -913,7 +913,7 @@ void TabWidget::restorePinnedTabs()
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(DataPaths::currentProfilePath() + "pinnedtabs.dat");
|
||||
QFile file(DataPaths::currentProfilePath() + "/pinnedtabs.dat");
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QByteArray sd = file.readAll();
|
||||
file.close();
|
||||
|
@ -123,7 +123,7 @@ void SBI_NetworkManager::applyCurrentProxy()
|
||||
}
|
||||
|
||||
// Manually modify settings to apply proxy configuration
|
||||
QSettings settings(DataPaths::currentProfilePath() + "settings.ini", QSettings::IniFormat);
|
||||
QSettings settings(DataPaths::currentProfilePath() + "/settings.ini", QSettings::IniFormat);
|
||||
settings.beginGroup("Web-Proxy");
|
||||
m_currentProxy->saveToSettings(settings);
|
||||
settings.endGroup();
|
||||
|
Loading…
Reference in New Issue
Block a user