Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit b1898d81 authored by Wolfgang Bauer's avatar Wolfgang Bauer

Migrate KDE4 config

Migrate config files from the KDE4 version to the new location.
Also copy the data files (current downloads and transfer history).
parent 1d78410a
......@@ -9,6 +9,8 @@
version 2 of the License, or (at your option) any later version.
*/
#include <Kdelibs4ConfigMigrator>
#include <Kdelibs4Migration>
#include <kwindowsystem.h>
#include <klocale.h>
#include <kaboutdata.h>
......@@ -151,6 +153,39 @@ int main(int argc, char *argv[])
KDBusService dbusService(KDBusService::Unique);
Kdelibs4ConfigMigrator migrate(QStringLiteral("kget"));
migrate.setConfigFiles(QStringList() << QStringLiteral("kgetrc")
<< QStringLiteral("kget_bittorrentfactory.rc")
<< QStringLiteral("kget_checksumsearchfactory.rc")
<< QStringLiteral("kget_metalinkfactory.rc")
<< QStringLiteral("kget_mirrorsearchfactory.rc")
<< QStringLiteral("kget_mmsfactory.rc")
<< QStringLiteral("kget_multisegkiofactory.rc")
<< QStringLiteral("kget.notifyrc"));
if (migrate.migrate()) {
Kdelibs4Migration dataMigrator;
const QString sourceBasePath = dataMigrator.saveLocation("data", QStringLiteral("kget"));
const QString targetBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/kget/");
QString targetFilePath;
QDir sourceDir(sourceBasePath);
QDir targetDir(targetBasePath);
if (sourceDir.exists()) {
if (!targetDir.exists()) {
QDir().mkpath(targetBasePath);
}
QStringList fileNames = sourceDir.entryList(
QDir::Files | QDir::NoDotAndDotDot | QDir::NoSymLinks);
foreach (const QString &fileName, fileNames) {
targetFilePath = targetBasePath + fileName;
if (!QFile::exists(targetFilePath)) {
QFile::copy(sourceBasePath + fileName, targetFilePath);
}
}
}
}
KGetApp kApp(&parser);
QObject::connect(&dbusService, &KDBusService::activateRequested, &kApp, &KGetApp::slotActivateRequested);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment