Commit 1a0e5801 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix i18n. Define which settings before to select file (bugs reported by david)

parent c2fda7ac
......@@ -50,7 +50,7 @@ ImportAddressbookJob::~ImportAddressbookJob()
void ImportAddressbookJob::start()
{
Q_EMIT title(i18n("Start import KAddressBook settings..."));
Q_EMIT title(i18n("Starting to import KAddressBook settings..."));
mArchiveDirectory = archive()->directory();
createProgressDialog(i18n("Import KAddressBook settings"));
searchAllFiles(mArchiveDirectory, QString(), QStringLiteral("addressbook"));
......
......@@ -39,7 +39,7 @@ ImportAkregatorJob::~ImportAkregatorJob()
void ImportAkregatorJob::start()
{
Q_EMIT title(i18n("Start import Akregator settings..."));
Q_EMIT title(i18n("Starting to import Akregator settings..."));
mArchiveDirectory = archive()->directory();
initializeListStep();
createProgressDialog(i18n("Import Akregator settings"));
......
......@@ -52,7 +52,7 @@ ImportAlarmJob::~ImportAlarmJob()
void ImportAlarmJob::start()
{
Q_EMIT title(i18n("Start import KAlarm settings..."));
Q_EMIT title(i18n("Starting to import KAlarm settings..."));
createProgressDialog(i18n("Import KAlarm settings"));
mArchiveDirectory = archive()->directory();
searchAllFiles(mArchiveDirectory, QString(), QStringLiteral("alarm"));
......
......@@ -39,7 +39,7 @@ ImportBlogiloJob::~ImportBlogiloJob()
void ImportBlogiloJob::start()
{
Q_EMIT title(i18n("Start import Blogilo settings..."));
Q_EMIT title(i18n("Starting to import Blogilo settings..."));
createProgressDialog(i18n("Import Blogilo settings"));
mArchiveDirectory = archive()->directory();
initializeListStep();
......
......@@ -54,7 +54,7 @@ ImportCalendarJob::~ImportCalendarJob()
void ImportCalendarJob::start()
{
Q_EMIT title(i18n("Start import KOrganizer settings..."));
Q_EMIT title(i18n("Starting to import KOrganizer settings..."));
mArchiveDirectory = archive()->directory();
createProgressDialog(i18n("Import KOrganizer settings"));
searchAllFiles(mArchiveDirectory, QString(), QStringLiteral("calendar"));
......
......@@ -70,7 +70,7 @@ ImportMailJob::~ImportMailJob()
void ImportMailJob::start()
{
Q_EMIT title(i18n("Start import KMail settings..."));
Q_EMIT title(i18n("Starting to import KMail settings..."));
createProgressDialog(i18n("Import KMail settings"));
mArchiveDirectory = archive()->directory();
searchAllMailsFiles(mArchiveDirectory, QString());
......@@ -872,12 +872,12 @@ void ImportMailJob::importSimpleFilesInDirectory(const QString &relativePath)
void ImportMailJob::restoreIdentity()
{
increaseProgressDialog();
setProgressDialogLabel(i18n("Restore identities..."));
setProgressDialogLabel(i18n("Restoring identities..."));
const QString path(Utils::identitiesPath() + QLatin1String("emailidentities"));
if (!mFileList.contains(path)) {
Q_EMIT error(i18n("emailidentities file could not be found in the archive."));
} else {
Q_EMIT info(i18n("Restore identities..."));
Q_EMIT info(i18n("Restoring identities..."));
const KArchiveEntry *identity = mArchiveDirectory->entry(path);
if (identity && identity->isFile()) {
......
......@@ -71,7 +71,7 @@ void ImportNotesJob::slotNextStep()
void ImportNotesJob::start()
{
Q_EMIT title(i18n("Start import KNotes settings..."));
Q_EMIT title(i18n("Starting to import KNotes settings..."));
mArchiveDirectory = archive()->directory();
// FIXME search archive ? searchAllFiles(mArchiveDirectory, QString());
createProgressDialog(i18n("Import KNotes settings"));
......
......@@ -96,7 +96,7 @@ bool PimSettingsBackupRestore::backupStart(const QString &filename)
mAction = Backup;
mStoreIterator = mStored.constBegin();
addDate();
Q_EMIT addInfo(i18n("Start to backup data in \'%1\'", mArchiveStorage->filename()));
Q_EMIT addInfo(i18n("Starting to backup data in \'%1\'", mArchiveStorage->filename()));
Q_EMIT addEndLine();
//Add version
Utils::addVersion(mArchiveStorage->archive());
......@@ -288,7 +288,7 @@ bool PimSettingsBackupRestore::restoreStart(const QString &filename)
addDate();
Q_EMIT addInfo(i18n("Start to restore data from \'%1\'", mArchiveStorage->filename()));
Q_EMIT addInfo(i18n("Starting to restore data from \'%1\'", mArchiveStorage->filename()));
Q_EMIT addEndLine();
restoreNextStep();
return true;
......
......@@ -273,26 +273,15 @@ void PimSettingExporterWindow::slotSaveLog()
void PimSettingExporterWindow::slotBackupData()
{
if (KMessageBox::warningYesNo(this, i18n("Before to backup data, close all kdepim applications. Do you want to continue?"), i18n("Backup")) == KMessageBox::No) {
if (KMessageBox::warningContinueCancel(this, i18n("Before backing up data, it is recommended to quit all kdepim applications."), i18n("Backup")) == KMessageBox::Cancel) {
return;
}
QString recentDirClass;
const QString filename = QFileDialog::getSaveFileName(this, i18n("Create backup"),
KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///pimsettingexporter")), recentDirClass).toLocalFile(),
i18n("Zip file (*.zip)"));
if (filename.isEmpty()) {
return;
}
if (!recentDirClass.isEmpty()) {
KRecentDirs::add(recentDirClass, filename);
}
mRecentFilesAction->addUrl(QUrl::fromLocalFile(filename));
backupData(filename);
backupData();
}
void PimSettingExporterWindow::backupData(const QString &filename, const QString &templateFile)
{
QString currentFileName = filename;
QPointer<SelectionTypeDialog> dialog = new SelectionTypeDialog(this);
dialog->loadTemplate(templateFile);
if (dialog->exec()) {
......@@ -300,11 +289,25 @@ void PimSettingExporterWindow::backupData(const QString &filename, const QString
initializeBackupRestoreUi();
mPimSettingsBackupRestoreUI->setStoredParameters(dialog->storedType());
delete dialog;
if (currentFileName.isEmpty()) {
QString recentDirClass;
currentFileName = QFileDialog::getSaveFileName(this, i18n("Create backup"),
KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///pimsettingexporter")), recentDirClass).toLocalFile(),
i18n("Zip file (*.zip)"));
if (currentFileName.isEmpty()) {
return;
}
if (!recentDirClass.isEmpty()) {
KRecentDirs::add(recentDirClass, currentFileName);
}
mRecentFilesAction->addUrl(QUrl::fromLocalFile(currentFileName));
}
mTrayIcon->setStatus(KStatusNotifierItem::Active);
if (!mPimSettingsBackupRestoreUI->backupStart(filename)) {
if (!mPimSettingsBackupRestoreUI->backupStart(currentFileName)) {
qCDebug(PIMSETTINGEXPORTERGUI_LOG) << " backup Start failed";
}
mLastArchiveFileName = filename;
mLastArchiveFileName = currentFileName;
} else {
delete dialog;
}
......@@ -336,18 +339,7 @@ void PimSettingExporterWindow::slotAddEndLine()
void PimSettingExporterWindow::slotRestoreData()
{
QString recentDirClass;
const QString filename = QFileDialog::getOpenFileName(this, i18n("Restore backup"),
KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///pimsettingexporter")), recentDirClass).toLocalFile(),
i18n("Zip File (*.zip)"));
if (filename.isEmpty()) {
return;
}
if (!recentDirClass.isEmpty()) {
KRecentDirs::add(recentDirClass, filename);
}
loadData(filename);
loadData();
}
void PimSettingExporterWindow::loadData(const QString &filename, const QString &templateFile)
......@@ -363,8 +355,22 @@ void PimSettingExporterWindow::loadData(const QString &filename, const QString &
initializeBackupRestoreUi();
mPimSettingsBackupRestoreUI->setStoredParameters(dialog->storedType());
delete dialog;
QString currentFileName = filename;
if (currentFileName.isEmpty()) {
QString recentDirClass;
currentFileName = QFileDialog::getOpenFileName(this, i18n("Restore backup"),
KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///pimsettingexporter")), recentDirClass).toLocalFile(),
i18n("Zip File (*.zip)"));
if (currentFileName.isEmpty()) {
return;
}
if (!recentDirClass.isEmpty()) {
KRecentDirs::add(recentDirClass, currentFileName);
}
}
mTrayIcon->setStatus(KStatusNotifierItem::Active);
if (!mPimSettingsBackupRestoreUI->restoreStart(filename)) {
if (!mPimSettingsBackupRestoreUI->restoreStart(currentFileName)) {
qCDebug(PIMSETTINGEXPORTERGUI_LOG) << " PimSettingExporterWindow restore failed";
}
} else {
......
......@@ -57,8 +57,8 @@ private Q_SLOTS:
void slotConfigure();
private:
void initializeBackupRestoreUi();
void backupData(const QString &filename, const QString &templateFile = QString());
void loadData(const QString &filename, const QString &templateFile = QString());
void backupData(const QString &filename = QString(), const QString &templateFile = QString());
void loadData(const QString &filename = QString(), const QString &templateFile = QString());
void setupActions(bool canZipFile);
void showFinishInformation();
LogWidget *mLogWidget;
......
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