Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Data Exporter
Commits
17d2e9bc
Commit
17d2e9bc
authored
Oct 15, 2022
by
Laurent Montel
Browse files
Adapt to new api (scripted)
parent
982ce46f
Pipeline
#248503
failed with stage
in 1 minute and 43 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/autotests/importexportprogressindicatortest.cpp
View file @
17d2e9bc
...
...
@@ -6,6 +6,7 @@
#include
"importexportprogressindicatortest.h"
#include
<KMessageBox>
#include
<kwidgetsaddons_version.h>
ImportExportProgressIndicatorTest
::
ImportExportProgressIndicatorTest
(
QObject
*
parent
)
:
ImportExportProgressIndicatorBase
(
parent
)
...
...
@@ -15,7 +16,11 @@ ImportExportProgressIndicatorTest::ImportExportProgressIndicatorTest(QObject *pa
int
ImportExportProgressIndicatorTest
::
mergeConfigMessageBox
(
const
QString
&
configName
)
const
{
Q_UNUSED
(
configName
)
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
ButtonCode
::
PrimaryAction
;
#else
return
KMessageBox
::
Yes
;
#endif
}
bool
ImportExportProgressIndicatorTest
::
overwriteConfigMessageBox
(
const
QString
&
configName
)
const
...
...
core/importexportprogressindicatorbase.cpp
View file @
17d2e9bc
...
...
@@ -7,6 +7,7 @@
#include
"importexportprogressindicatorbase.h"
#include
<KMessageBox>
#include
<QDebug>
#include
<kwidgetsaddons_version.h>
ImportExportProgressIndicatorBase
::
ImportExportProgressIndicatorBase
(
QObject
*
parent
)
:
QObject
(
parent
)
...
...
@@ -44,7 +45,11 @@ void ImportExportProgressIndicatorBase::setNumberOfStep(int numberOfStep)
int
ImportExportProgressIndicatorBase
::
mergeConfigMessageBox
(
const
QString
&
configName
)
const
{
Q_UNUSED
(
configName
)
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
ButtonCode
::
PrimaryAction
;
#else
return
KMessageBox
::
Yes
;
#endif
}
bool
ImportExportProgressIndicatorBase
::
overwriteConfigMessageBox
(
const
QString
&
configName
)
const
...
...
core/mail/importmailjobinterface.cpp
View file @
17d2e9bc
...
...
@@ -27,6 +27,7 @@
#include
<QRegularExpression>
#include
<QStandardPaths>
#include
<QTimer>
#include
<kwidgetsaddons_version.h>
using
namespace
Akonadi
;
...
...
@@ -641,9 +642,17 @@ void ImportMailJobInterface::restoreConfig()
const
QString
kabldaprc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
labldaprcStr
;
if
(
QFileInfo
::
exists
(
kabldaprc
))
{
const
int
result
=
mergeConfigMessageBox
(
labldaprcStr
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
copyToFile
(
kabldap
,
kabldaprc
,
labldaprcStr
,
Utils
::
configsPath
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
result
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
result
==
KMessageBox
::
No
)
{
#endif
mergeLdapConfig
(
kabldap
,
labldaprcStr
,
Utils
::
configsPath
());
}
}
else
{
...
...
@@ -660,9 +669,17 @@ void ImportMailJobInterface::restoreConfig()
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
archiveconfigurationrcStr
;
if
(
QFileInfo
::
exists
(
archiveconfigurationrc
))
{
const
int
result
=
mergeConfigMessageBox
(
archiveconfigurationrcStr
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
importArchiveConfig
(
archiveconfiguration
,
archiveconfigurationrc
,
archiveconfigurationrcStr
,
Utils
::
configsPath
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
result
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
result
==
KMessageBox
::
No
)
{
#endif
mergeArchiveMailAgentConfig
(
archiveconfiguration
,
archiveconfigurationrcStr
,
Utils
::
configsPath
());
}
}
else
{
...
...
@@ -679,9 +696,17 @@ void ImportMailJobInterface::restoreConfig()
const
QString
archiveconfigurationrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
folderMailArchiveStr
;
if
(
QFileInfo
::
exists
(
archiveconfigurationrc
))
{
const
int
result
=
mergeConfigMessageBox
(
folderMailArchiveStr
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
importMailArchiveConfig
(
archiveconfiguration
,
archiveconfigurationrc
,
folderMailArchiveStr
,
Utils
::
configsPath
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
result
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
result
==
KMessageBox
::
No
)
{
#endif
mergeMailArchiveConfig
(
archiveconfiguration
,
folderMailArchiveStr
,
Utils
::
configsPath
());
}
}
else
{
...
...
@@ -698,9 +723,17 @@ void ImportMailJobInterface::restoreConfig()
const
QString
unifiedMailBoxrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
unifiedMailBoxStr
;
if
(
QFileInfo
::
exists
(
unifiedMailBoxrc
))
{
const
int
result
=
mergeConfigMessageBox
(
unifiedMailBoxStr
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
importUnifiedMailBoxConfig
(
archiveconfiguration
,
unifiedMailBoxrc
,
unifiedMailBoxStr
,
Utils
::
configsPath
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
result
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
result
==
KMessageBox
::
No
)
{
#endif
mergeUnifiedMailBoxConfig
(
archiveconfiguration
,
unifiedMailBoxStr
,
Utils
::
configsPath
());
}
}
else
{
...
...
@@ -748,9 +781,17 @@ void ImportMailJobInterface::restoreConfig()
const
QString
sievetemplaterc
=
configLocation
()
+
sievetemplatercStr
;
if
(
QFileInfo
::
exists
(
sievetemplaterc
))
{
const
int
result
=
mergeConfigMessageBox
(
sievetemplatercStr
);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
result
==
KMessageBox
::
ButtonCode
::
PrimaryAction
)
{
#else
if
(
result
==
KMessageBox
::
Yes
)
{
#endif
copyToFile
(
sievetemplateconfiguration
,
sievetemplaterc
,
sievetemplatercStr
,
Utils
::
configsPath
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
}
else
if
(
result
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
}
else
if
(
result
==
KMessageBox
::
No
)
{
#endif
mergeSieveTemplate
(
sievetemplateconfiguration
,
sievetemplatercStr
,
Utils
::
configsPath
());
}
}
else
{
...
...
gui/dialog/showarchivestructuredialog.cpp
View file @
17d2e9bc
...
...
@@ -25,6 +25,7 @@
#include
<KTreeWidgetSearchLine>
#include
<QFileDialog>
#include
<QTemporaryDir>
#include
<kwidgetsaddons_version.h>
ShowArchiveStructureDialog
::
ShowArchiveStructureDialog
(
const
QString
&
filename
,
QWidget
*
parent
)
:
QDialog
(
parent
)
...
...
@@ -129,12 +130,21 @@ void ShowArchiveStructureDialog::slotExtractFile()
QFileDialog
::
ShowDirsOnly
|
QFileDialog
::
DontResolveSymlinks
);
if
(
!
dir
.
isEmpty
())
{
if
(
QFile
(
dir
+
QLatin1Char
(
'/'
)
+
currentFile
->
name
()).
exists
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
KMessageBox
::
questionTwoActions
(
this
,
#else
if
(
KMessageBox
::
questionYesNo
(
this
,
i18n
(
"Do you want to overwrite %1?"
,
currentFile
->
name
()),
i18n
(
"File Already Exist"
),
KStandardGuiItem
::
overwrite
(),
KStandardGuiItem
::
cancel
())
#endif
i18n
(
"Do you want to overwrite %1?"
,
currentFile
->
name
()),
i18n
(
"File Already Exist"
),
KStandardGuiItem
::
overwrite
(),
KStandardGuiItem
::
cancel
())
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
==
KMessageBox
::
No
)
{
#endif
return
;
}
}
...
...
gui/importexportprogressindicatorgui.cpp
View file @
17d2e9bc
...
...
@@ -10,6 +10,7 @@
#include
<KMessageBox>
#include
<KStandardGuiItem>
#include
<QProgressDialog>
#include
<kwidgetsaddons_version.h>
ImportExportProgressIndicatorGui
::
ImportExportProgressIndicatorGui
(
QWidget
*
parentWidget
,
QObject
*
parent
)
:
ImportExportProgressIndicatorBase
(
parent
)
...
...
@@ -60,13 +61,21 @@ bool ImportExportProgressIndicatorGui::wasCanceled() const
int
ImportExportProgressIndicatorGui
::
mergeConfigMessageBox
(
const
QString
&
configName
)
const
{
if
(
PimDataExportGlobalConfig
::
self
()
->
alwaysMergeConfigFile
())
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
ButtonCode
::
PrimaryAction
;
#else
return
KMessageBox
::
Yes
;
#endif
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
KMessageBox
::
warningTwoActionsCancel
(
mParentWidget
,
#else
return
KMessageBox
::
warningYesNoCancel
(
mParentWidget
,
i18n
(
"
\"
%1
\"
already exists. Do you want to overwrite it or merge it?"
,
configName
),
i18n
(
"Restore"
),
KStandardGuiItem
::
overwrite
(),
KGuiItem
(
i18n
(
"Merge"
)));
#endif
i18n
(
"
\"
%1
\"
already exists. Do you want to overwrite it or merge it?"
,
configName
),
i18n
(
"Restore"
),
KStandardGuiItem
::
overwrite
(),
KGuiItem
(
i18n
(
"Merge"
)));
}
bool
ImportExportProgressIndicatorGui
::
overwriteConfigMessageBox
(
const
QString
&
configName
)
const
...
...
@@ -74,12 +83,20 @@ bool ImportExportProgressIndicatorGui::overwriteConfigMessageBox(const QString &
if
(
PimDataExportGlobalConfig
::
self
()
->
alwaysOverrideFile
())
{
return
true
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
warningTwoActions
(
mParentWidget
,
#else
const
int
answer
=
KMessageBox
::
warningYesNo
(
mParentWidget
,
i18n
(
"
\"
%1
\"
already exists. Do you want to overwrite it?"
,
configName
),
i18n
(
"Restore"
),
KStandardGuiItem
::
overwrite
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"
\"
%1
\"
already exists. Do you want to overwrite it?"
,
configName
),
i18n
(
"Restore"
),
KStandardGuiItem
::
overwrite
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
);
#else
return
(
answer
==
KMessageBox
::
Yes
);
#endif
}
bool
ImportExportProgressIndicatorGui
::
overwriteDirectoryMessageBox
(
const
QString
&
directory
)
const
...
...
@@ -87,12 +104,20 @@ bool ImportExportProgressIndicatorGui::overwriteDirectoryMessageBox(const QStrin
if
(
PimDataExportGlobalConfig
::
self
()
->
alwaysOverrideDirectory
())
{
return
true
;
}
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
warningTwoActions
(
mParentWidget
,
#else
const
int
answer
=
KMessageBox
::
warningYesNo
(
mParentWidget
,
i18n
(
"Directory
\"
%1
\"
already exists. Do you want to overwrite it?"
,
directory
),
i18n
(
"Restore"
),
KStandardGuiItem
::
overwrite
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"Directory
\"
%1
\"
already exists. Do you want to overwrite it?"
,
directory
),
i18n
(
"Restore"
),
KStandardGuiItem
::
overwrite
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
return
(
answer
==
KMessageBox
::
ButtonCode
::
PrimaryAction
);
#else
return
(
answer
==
KMessageBox
::
Yes
);
#endif
}
void
ImportExportProgressIndicatorGui
::
showErrorMessage
(
const
QString
&
message
,
const
QString
&
title
)
...
...
gui/pimdatabackuprestoreui.cpp
View file @
17d2e9bc
...
...
@@ -9,6 +9,7 @@
#include
"importexportprogressindicatorgui.h"
#include
<KLocalizedString>
#include
<KMessageBox>
#include
<kwidgetsaddons_version.h>
PimDataBackupRestoreUI
::
PimDataBackupRestoreUI
(
QWidget
*
parentWidget
,
QObject
*
parent
)
:
PimDataBackupRestore
(
parent
)
...
...
@@ -20,13 +21,22 @@ PimDataBackupRestoreUI::~PimDataBackupRestoreUI() = default;
bool
PimDataBackupRestoreUI
::
continueToRestore
()
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
questionTwoActions
(
mParentWidget
,
#else
const
int
answer
=
KMessageBox
::
questionYesNo
(
mParentWidget
,
i18n
(
"The archive was created by a newer version of this program. It might contain additional data which "
"will be skipped during import. Do you want to import it?"
),
i18n
(
"Not correct version"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Import"
),
QStringLiteral
(
"document-import"
)),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"The archive was created by a newer version of this program. It might contain additional data which "
"will be skipped during import. Do you want to import it?"
),
i18n
(
"Not correct version"
),
KGuiItem
(
i18nc
(
"@action:button"
,
"Import"
),
QStringLiteral
(
"document-import"
)),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
No
)
{
#endif
return
false
;
}
return
true
;
...
...
gui/pimdataexporterwindow.cpp
View file @
17d2e9bc
...
...
@@ -47,6 +47,7 @@
#include
"userfeedback/userfeedbackmanager.h"
#include
<KUserFeedback/NotificationPopup>
#include
<KUserFeedback/Provider>
#include
<kwidgetsaddons_version.h>
#endif
PimDataExporterWindow
::
PimDataExporterWindow
(
QWidget
*
parent
)
...
...
@@ -354,12 +355,20 @@ void PimDataExporterWindow::slotRestoreData()
void
PimDataExporterWindow
::
loadData
(
const
QString
&
filename
,
const
QString
&
templateFile
)
{
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const
int
answer
=
KMessageBox
::
warningTwoActions
(
this
,
#else
const
int
answer
=
KMessageBox
::
warningYesNo
(
this
,
i18n
(
"Before restoring data you must close all kdepim applications. Do you want to continue?"
),
i18n
(
"Backup"
),
KStandardGuiItem
::
cont
(),
KStandardGuiItem
::
cancel
());
#endif
i18n
(
"Before restoring data you must close all kdepim applications. Do you want to continue?"
),
i18n
(
"Backup"
),
KStandardGuiItem
::
cont
(),
KStandardGuiItem
::
cancel
());
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if
(
answer
==
KMessageBox
::
ButtonCode
::
SecondaryAction
)
{
#else
if
(
answer
==
KMessageBox
::
No
)
{
#endif
return
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment