mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
ProfileManager: Implement profile migration from QupZilla
This commit is contained in:
parent
3dae3edff5
commit
7c078ad70e
@ -59,8 +59,7 @@ void DataPaths::setPortableVersion()
|
|||||||
d->m_paths[Plugins].clear();
|
d->m_paths[Plugins].clear();
|
||||||
d->initAssetsIn(appDir);
|
d->initAssetsIn(appDir);
|
||||||
|
|
||||||
// Make sure the Config and Temp paths exists
|
// Make sure Temp path exists
|
||||||
QDir().mkpath(d->m_paths[Config].at(0));
|
|
||||||
QDir().mkpath(d->m_paths[Temp].at(0));
|
QDir().mkpath(d->m_paths[Temp].at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,9 +133,6 @@ void DataPaths::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_paths[Cache].append(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
m_paths[Cache].append(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
|
||||||
|
|
||||||
// Make sure Config path exists
|
|
||||||
QDir().mkpath(m_paths[Config].at(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataPaths::initCurrentProfile(const QString &profilePath)
|
void DataPaths::initCurrentProfile(const QString &profilePath)
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
ProfileManager::ProfileManager()
|
ProfileManager::ProfileManager()
|
||||||
@ -38,7 +40,11 @@ void ProfileManager::initConfigDir()
|
|||||||
{
|
{
|
||||||
QDir dir(DataPaths::path(DataPaths::Config));
|
QDir dir(DataPaths::path(DataPaths::Config));
|
||||||
|
|
||||||
if (dir.exists() && QFile(dir.filePath(QLatin1String("profiles/profiles.ini"))).exists()) {
|
if (!dir.exists()) {
|
||||||
|
migrateFromQupZilla();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QFileInfo::exists(dir.filePath(QLatin1String("profiles/profiles.ini")))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +246,29 @@ void ProfileManager::copyDataToProfile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileManager::migrateFromQupZilla()
|
||||||
|
{
|
||||||
|
if (mApp->isPortable()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
const QString qzConfig = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QL1S("/qupzilla");
|
||||||
|
#elif defined(Q_OS_MACOS)
|
||||||
|
const QString qzConfig = QDir::homePath() + QLatin1String("/Library/Application Support/QupZilla");
|
||||||
|
#else // Unix
|
||||||
|
const QString qzConfig = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QL1S("/qupzilla");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!QFileInfo::exists(qzConfig)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Falkon: Migrating config from QupZilla..." << std::endl;
|
||||||
|
|
||||||
|
QzTools::copyRecursively(qzConfig, DataPaths::path(DataPaths::Config));
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileManager::connectDatabase()
|
void ProfileManager::connectDatabase()
|
||||||
{
|
{
|
||||||
QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"));
|
QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"));
|
||||||
|
@ -51,6 +51,7 @@ private:
|
|||||||
void updateCurrentProfile();
|
void updateCurrentProfile();
|
||||||
void updateProfile(const QString ¤t, const QString &profile);
|
void updateProfile(const QString ¤t, const QString &profile);
|
||||||
void copyDataToProfile();
|
void copyDataToProfile();
|
||||||
|
void migrateFromQupZilla();
|
||||||
|
|
||||||
void connectDatabase();
|
void connectDatabase();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user