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

Create a rootCollectionName()

parent 2af08367
......@@ -140,6 +140,11 @@ bool FilterInfo::shouldTerminate() const
return Private::s_terminateASAP;
}
QString FilterInfo::rootCollectionName() const
{
return d->m_rootCollection.name();
}
Akonadi::Collection FilterInfo::rootCollection() const
{
return d->m_rootCollection;
......@@ -160,11 +165,11 @@ bool FilterInfo::removeDupMessage() const
return d->m_removeDupMsg;
}
QWidget *FilterInfo::parent()
QWidget *FilterInfo::parent() const
{
if (d->m_filterInfoGui) {
return d->m_filterInfoGui->parent();
}
return 0;
return nullptr;
}
......@@ -48,10 +48,12 @@ public:
static void terminateASAP();
bool shouldTerminate() const;
QString rootCollectionName() const;
Akonadi::Collection rootCollection() const;
void setRootCollection(const Akonadi::Collection &collection);
QWidget *parent();
QWidget *parent() const;
void setRemoveDupMessage(bool removeDupMessage);
bool removeDupMessage() const;
......
......@@ -115,7 +115,7 @@ bool FilterKMailArchive::importFolder(const KArchiveDirectory *folder, const QSt
{
qCDebug(MAILIMPORTER_LOG) << "Importing folder" << folder->name();
filterInfo()->addInfoLogEntry(i18n("Importing folder '%1'...", folderPath));
filterInfo()->setTo(filterInfo()->rootCollection().name() + folderPath);
filterInfo()->setTo(filterInfo()->rootCollectionName() + folderPath);
const KArchiveDirectory *const messageDir =
dynamic_cast<const KArchiveDirectory *>(folder->entry(QStringLiteral("cur")));
if (messageDir) {
......@@ -204,8 +204,6 @@ int FilterKMailArchive::countFiles(const KArchiveDirectory *directory) const
void FilterKMailArchive::import()
{
Q_ASSERT(filterInfo()->rootCollection().isValid());
const QString archiveFile = QFileDialog::getOpenFileName(filterInfo()->parent(), i18n("Select KMail Archive File to Import"), QString(), i18n("KMail Archive Files (*.tar *.tar.gz *.tar.bz2 *.zip)"));
if (archiveFile.isEmpty()) {
filterInfo()->alert(i18n("Please select an archive file that should be imported."));
......@@ -244,7 +242,7 @@ void FilterKMailArchive::importMails(const QString &archiveFile)
filterInfo()->setOverall(100);
filterInfo()->setCurrent(100);
filterInfo()->addInfoLogEntry(i18n("Importing the archive file '%1' into the folder '%2' succeeded.",
archiveFile, filterInfo()->rootCollection().name()));
archiveFile, filterInfo()->rootCollectionName()));
filterInfo()->addInfoLogEntry(i18np("1 message was imported.", "%1 messages were imported.",
d->mFilesDone));
} else {
......
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