Commit a2a83631 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Prepare to autotest merge config

parent 0eda5854
Pipeline #25418 passed with stage
in 32 minutes and 46 seconds
......@@ -180,3 +180,9 @@ void ImportMailJobInterfaceTestImpl::importSmtpMailTransport(const SmtpMailTrans
}
mHashTransport.insert(transportId, transportValue);
}
QString ImportMailJobInterfaceTestImpl::configLocation() const
{
//TODO implement
return {};
}
......@@ -45,10 +45,12 @@ protected:
void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) override;
void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
void importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId) override;
Q_REQUIRED_RESULT QString configLocation() const override;
private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
uint mIdentityUoid = 1;
uint mMailTransportId = 1;
};
#endif // IMPORTMAILJOBINTERFACETESTIMPL_H
......@@ -616,7 +616,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *kmailsnippetentry = mArchiveDirectory->entry(Utils::configsPath() + kmailsnippetrcStr);
if (kmailsnippetentry && kmailsnippetentry->isFile()) {
const KArchiveFile *kmailsnippet = static_cast<const KArchiveFile *>(kmailsnippetentry);
const QString kmailsnippetrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kmailsnippetrcStr;
const QString kmailsnippetrc = configLocation() + kmailsnippetrcStr;
if (QFileInfo::exists(kmailsnippetrc)) {
//TODO 4.13 allow to merge config.
if (overwriteConfigMessageBox(kmailsnippetrcStr)) {
......@@ -631,7 +631,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *kabldapentry = mArchiveDirectory->entry(Utils::configsPath() + labldaprcStr);
if (kabldapentry && kabldapentry->isFile()) {
const KArchiveFile *kabldap = static_cast<const KArchiveFile *>(kabldapentry);
const QString kabldaprc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + labldaprcStr;
const QString kabldaprc = configLocation() + labldaprcStr;
if (QFileInfo::exists(kabldaprc)) {
const int result = mergeConfigMessageBox(labldaprcStr);
if (result == KMessageBox::Yes) {
......@@ -647,7 +647,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *archiveconfigurationentry = mArchiveDirectory->entry(Utils::configsPath() + archiveconfigurationrcStr);
if (archiveconfigurationentry && archiveconfigurationentry->isFile()) {
const KArchiveFile *archiveconfiguration = static_cast<const KArchiveFile *>(archiveconfigurationentry);
const QString archiveconfigurationrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + archiveconfigurationrcStr;
const QString archiveconfigurationrc = configLocation() + archiveconfigurationrcStr;
if (QFileInfo::exists(archiveconfigurationrc)) {
const int result = mergeConfigMessageBox(archiveconfigurationrcStr);
if (result == KMessageBox::Yes) {
......@@ -664,7 +664,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *archivemailentry = mArchiveDirectory->entry(Utils::configsPath() + folderMailArchiveStr);
if (archivemailentry && archivemailentry->isFile()) {
const KArchiveFile *archiveconfiguration = static_cast<const KArchiveFile *>(archivemailentry);
const QString archiveconfigurationrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + folderMailArchiveStr;
const QString archiveconfigurationrc = configLocation() + folderMailArchiveStr;
if (QFileInfo::exists(archiveconfigurationrc)) {
const int result = mergeConfigMessageBox(folderMailArchiveStr);
if (result == KMessageBox::Yes) {
......@@ -681,7 +681,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *templatesconfigurationentry = mArchiveDirectory->entry(Utils::configsPath() + templatesconfigurationrcStr);
if (templatesconfigurationentry && templatesconfigurationentry->isFile()) {
const KArchiveFile *templatesconfiguration = static_cast<const KArchiveFile *>(templatesconfigurationentry);
const QString templatesconfigurationrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + templatesconfigurationrcStr;
const QString templatesconfigurationrc = configLocation() + templatesconfigurationrcStr;
if (QFileInfo::exists(templatesconfigurationrc)) {
//TODO 4.13 allow to merge config.
if (overwriteConfigMessageBox(templatesconfigurationrcStr)) {
......@@ -696,7 +696,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *kmail2rcentry = mArchiveDirectory->entry(Utils::configsPath() + kmailStr);
if (kmail2rcentry && kmail2rcentry->isFile()) {
const KArchiveFile *kmailrc = static_cast<const KArchiveFile *>(kmail2rcentry);
const QString kmail2rc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kmailStr;
const QString kmail2rc = configLocation() + kmailStr;
if (QFileInfo::exists(kmail2rc)) {
if (overwriteConfigMessageBox(kmailStr)) {
importKmailConfig(kmailrc, kmail2rc, kmailStr, Utils::configsPath());
......@@ -710,7 +710,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *sievetemplatentry = mArchiveDirectory->entry(Utils::configsPath() + sievetemplatercStr);
if (sievetemplatentry && sievetemplatentry->isFile()) {
const KArchiveFile *sievetemplateconfiguration = static_cast<const KArchiveFile *>(sievetemplatentry);
const QString sievetemplaterc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + sievetemplatercStr;
const QString sievetemplaterc = configLocation() + sievetemplatercStr;
if (QFileInfo::exists(sievetemplaterc)) {
const int result = mergeConfigMessageBox(sievetemplatercStr);
if (result == KMessageBox::Yes) {
......@@ -727,7 +727,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *customtemplatentry = mArchiveDirectory->entry(Utils::configsPath() + customTemplateStr);
if (customtemplatentry && customtemplatentry->isFile()) {
const KArchiveFile *customtemplateconfiguration = static_cast<const KArchiveFile *>(customtemplatentry);
const QString customtemplaterc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + customTemplateStr;
const QString customtemplaterc = configLocation() + customTemplateStr;
if (QFileInfo::exists(customtemplaterc)) {
//TODO 4.13 allow to merge config.
if (overwriteConfigMessageBox(customTemplateStr)) {
......@@ -742,7 +742,7 @@ void ImportMailJobInterface::restoreConfig()
const KArchiveEntry *adblockentry = mArchiveDirectory->entry(Utils::configsPath() + adblockStr);
if (adblockentry && adblockentry->isFile()) {
const KArchiveFile *adblockconfiguration = static_cast<const KArchiveFile *>(adblockentry);
const QString adblockrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + adblockStr;
const QString adblockrc = configLocation() + adblockStr;
if (QFileInfo::exists(adblockrc)) {
//TODO 4.13 allow to merge config.
if (overwriteConfigMessageBox(adblockStr)) {
......
......@@ -57,6 +57,7 @@ protected:
virtual void registerSpecialCollection(Akonadi::SpecialMailCollections::Type type, qint64 colId) = 0;
virtual void synchronizeResource(const QStringList &lst) = 0;
virtual void importFilters(const QString &filename) = 0;
virtual Q_REQUIRED_RESULT QString configLocation() const = 0;
virtual Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) = 0;
virtual void addNewIdentity(const QString &name, KConfigGroup &group, int defaultIdentities, int oldUid) = 0;
virtual void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) = 0;
......
......@@ -40,6 +40,12 @@ ImportMailJobInterfaceImpl::~ImportMailJobInterfaceImpl()
{
}
QString ImportMailJobInterfaceImpl::configLocation() const
{
return QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/');
}
QString ImportMailJobInterfaceImpl::adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData)
{
ResourceConverterImpl converter;
......
......@@ -53,6 +53,7 @@ protected:
void importCustomMailTransport(const QString &identifierValue, const KConfigGroup &group, int defaultTransport, int transportId) override;
void importSmtpMailTransport(const SmtpMailTransport &smtpMailTransport, int defaultTransport, int transportId) override;
void addMailTransport(MailTransport::Transport *mt, int defaultTransport, int transportId);
Q_REQUIRED_RESULT QString configLocation() const override;
private:
Q_REQUIRED_RESULT QString uniqueIdentityName(const QString &name);
KIdentityManagement::IdentityManager *mIdentityManager = nullptr;
......
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