Commit 072861ef authored by Laurent Montel's avatar Laurent Montel 😁

Remove unused method

parent 69116dc8
......@@ -308,23 +308,6 @@ bool Filter::checkForDuplicates(const QString &msgID,
return false;
}
bool Filter::addMessage(const QString &folderName,
const QString &msgPath,
Akonadi::MessageStatus status)
{
// Add the message.
return doAddMessage(folderName, msgPath, true, status);
}
bool Filter::addMessage_fastImport(const QString &folderName,
const QString &msgPath,
Akonadi::MessageStatus status
)
{
// Add the message.
return doAddMessage(folderName, msgPath, false, status);
}
bool Filter::doAddMessage(const QString &folderName,
const QString &msgPath,
bool duplicateCheck,
......
......@@ -79,10 +79,6 @@ protected:
bool addAkonadiMessage(const Akonadi::Collection &collection,
const KMime::Message::Ptr &message, Akonadi::MessageStatus status = Akonadi::MessageStatus());
bool addMessage(const QString &folder,
const QString &msgFile,
Akonadi::MessageStatus status = Akonadi::MessageStatus());
/**
* Checks for duplicate messages in the collection by message ID.
* returns true if a duplicate was detected.
......@@ -92,10 +88,11 @@ protected:
bool checkForDuplicates(const QString &msgID,
const Akonadi::Collection &msgCollection,
const QString &messageFolder);
bool addMessage_fastImport(const QString &folder,
const QString &msgFile,
Akonadi::MessageStatus status = Akonadi::MessageStatus());
bool doAddMessage(const QString &folderName,
const QString &msgPath,
bool duplicateCheck,
Akonadi::MessageStatus status = Akonadi::MessageStatus());
private:
/**
* Adds a single subcollection to the given base collection and returns it.
......@@ -104,10 +101,6 @@ private:
Akonadi::Collection addSubCollection(const Akonadi::Collection &baseCollection,
const QString &newCollectionPathName);
bool doAddMessage(const QString &folderName,
const QString &msgPath,
bool duplicateCheck,
Akonadi::MessageStatus status = Akonadi::MessageStatus());
class Private;
Private *const d;
};
......
......@@ -207,19 +207,12 @@ void FilterBalsa::importFiles(const QString &dirName)
filterInfo()->setTo(_path);
generatedPath = true;
}
Akonadi::MessageStatus status = statusFromFile(*mailFile);
const Akonadi::MessageStatus status = statusFromFile(*mailFile);
if (filterInfo()->removeDupMessage()) {
if (! addMessage(_path, dir.filePath(*mailFile), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
} else {
if (! addMessage_fastImport(_path, dir.filePath(*mailFile), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
if (! doAddMessage(_path, dir.filePath(*mailFile), filterInfo()->removeDupMessage(), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
}
}
}
......
......@@ -194,15 +194,7 @@ void FilterEvolution::importMBox(const QString &mboxName, const QString &rootDir
destFolder = QLatin1String("Evolution-Import/") + destFolder;
}
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (filterInfo()->removeDupMessage()) {
addMessage(destFolder, tmp.fileName());
} else {
addMessage_fastImport(destFolder, tmp.fileName());
}
doAddMessage(destFolder, tmp.fileName(), filterInfo()->removeDupMessage());
const int currentPercentage = (int)(((float) mbox.pos() / filenameInfo.size()) * 100);
filterInfo()->setCurrent(currentPercentage);
......
......@@ -255,11 +255,7 @@ void FilterEvolution_v2::importMBox(const QString &mboxName, const QString &root
}
}
if (filterInfo()->removeDupMessage()) {
addMessage(destFolder, tmp.fileName());
} else {
addMessage_fastImport(destFolder, tmp.fileName());
}
doAddMessage(destFolder, tmp.fileName(), filterInfo()->removeDupMessage());
int currentPercentage = (int)(((float) mbox.pos() / filenameInfo.size()) * 100);
filterInfo()->setCurrent(currentPercentage);
......
......@@ -204,17 +204,10 @@ void FilterEvolution_v3::importFiles(const QString &dirName)
}
Akonadi::MessageStatus status = statusFromFile(*mailFile);
if (filterInfo()->removeDupMessage()) {
if (! addMessage(_path, dir.filePath(*mailFile), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
} else {
if (! addMessage_fastImport(_path, dir.filePath(*mailFile), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
if (! doAddMessage(_path, dir.filePath(*mailFile), filterInfo()->removeDupMessage(), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
}
}
}
......
......@@ -191,17 +191,10 @@ void FilterKMail_maildir::importFiles(const QString &dirName)
generatedPath = true;
}
if (filterInfo()->removeDupMessage()) {
if (! addMessage(_path, dir.filePath(*mailFile))) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1, duplicated message", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
} else {
if (! addMessage_fastImport(_path, dir.filePath(*mailFile))) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
if (!doAddMessage(_path, dir.filePath(*mailFile), filterInfo()->removeDupMessage())) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1, duplicated message", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
}
}
}
......
......@@ -146,11 +146,7 @@ void FilterLNotes::ImportLNotes(const QString &file)
// close file, send it
tempfile->close();
if (filterInfo()->removeDupMessage()) {
addMessage(folder, tempfile->fileName());
} else {
addMessage_fastImport(folder, tempfile->fileName());
}
doAddMessage(folder, tempfile->fileName(), filterInfo()->removeDupMessage());
tempfile->setAutoRemove(true);
state = 0;
......@@ -179,11 +175,7 @@ void FilterLNotes::ImportLNotes(const QString &file)
if (state != 0) {
Q_ASSERT(tempfile);
if (filterInfo()->removeDupMessage()) {
addMessage(folder, tempfile->fileName());
} else {
addMessage_fastImport(folder, tempfile->fileName());
}
doAddMessage(folder, tempfile->fileName(), filterInfo()->removeDupMessage());
}
if (tempfile) {
tempfile->setAutoRemove(true);
......
......@@ -122,15 +122,7 @@ void FilterMailApp::importMails(const QString &maildir)
tmp.flush();
first_msg = false;
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (filterInfo()->removeDupMessage()) {
addMessage(folderName, tmp.fileName());
} else {
addMessage_fastImport(folderName, tmp.fileName());
}
doAddMessage(folderName, tmp.fileName(), filterInfo()->removeDupMessage());
int currentPercentage = (int)(((float) mbox.pos() / filenameInfo.size()) * 100);
filterInfo()->setCurrent(currentPercentage);
......
......@@ -118,16 +118,8 @@ void FilterMailmanGzip::importMails(const QStringList &filenames)
tmp.flush();
first_msg = false;
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (tmp.size() > 0) {
if (filterInfo()->removeDupMessage()) {
addMessage(folderName, tmp.fileName());
} else {
addMessage_fastImport(folderName, tmp.fileName());
}
doAddMessage(folderName, tmp.fileName(), filterInfo()->removeDupMessage());
} else {
qCWarning(MAILIMPORTER_LOG) << "Message size is 0 bytes, not importing it.";
}
......
......@@ -115,16 +115,8 @@ void FilterMBox::importMails(const QStringList &filenames)
tmp.flush();
first_msg = false;
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (tmp.size() > 0) {
if (filterInfo()->removeDupMessage()) {
addMessage(folderName, tmp.fileName());
} else {
addMessage_fastImport(folderName, tmp.fileName());
}
doAddMessage(folderName, tmp.fileName(), filterInfo()->removeDupMessage());
} else {
qCWarning(MAILIMPORTER_LOG) << "Message size is 0 bytes, not importing it.";
}
......
......@@ -211,15 +211,7 @@ void FilterOE::mbxImport(QDataStream &ds)
}
} while (!ds.atEnd());
tmp.flush();
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (filterInfo()->removeDupMessage()) {
addMessage(folderName, tmp.fileName());
} else {
addMessage_fastImport(folderName, tmp.fileName());
}
doAddMessage(folderName, tmp.fileName(), filterInfo()->removeDupMessage());
if (filterInfo()->shouldTerminate()) {
return;
......@@ -383,11 +375,7 @@ void FilterOE::dbxReadEmail(QDataStream &ds, int filePos)
tmp.flush();
if (!_break) {
if (filterInfo()->removeDupMessage()) {
addMessage(folderName, tmp.fileName());
} else {
addMessage_fastImport(folderName, tmp.fileName());
}
doAddMessage(folderName, tmp.fileName(), filterInfo()->removeDupMessage());
currentEmail++;
int currentPercentage = (int)(((float) currentEmail / totalEmails) * 100);
......
......@@ -121,11 +121,7 @@ void FilterOpera::importBox(const QDir &importDir, const QStringList &files, con
tmp.flush();
first_msg = false;
if (filterInfo()->removeDupMessage()) {
addMessage(folderName, tmp.fileName());
} else {
addMessage_fastImport(folderName, tmp.fileName());
}
doAddMessage(folderName, tmp.fileName(), filterInfo()->removeDupMessage());
int currentPercentage = (int)(((float) operaArchiv.pos() / filenameInfo.size()) * 100);
filterInfo()->setCurrent(currentPercentage);
......
......@@ -61,18 +61,8 @@ void FilterPlain::import()
filterInfo()->setFrom(dirRealPath);
filterInfo()->setTo(destName);
filterInfo()->setCurrent(0);
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (filterInfo()->removeDupMessage()) {
if (! addMessage(destName, dirRealPath)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
} else {
if (! addMessage_fastImport(destName, dirRealPath)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
if (! doAddMessage(destName, dirRealPath, filterInfo()->removeDupMessage())) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent(100);
......
......@@ -116,15 +116,7 @@ void FilterPMail::importNewMessage(const QString &file)
QString destFolder(QStringLiteral("PegasusMail-Import/New Messages"));
filterInfo()->setTo(destFolder);
/* comment by Danny Kukawka:
* addMessage() == old function, need more time and check for duplicates
* addMessage_fastImport == new function, faster and no check for duplicates
*/
if (filterInfo()->removeDupMessage()) {
addMessage(destFolder, file);
} else {
addMessage_fastImport(destFolder, file);
}
doAddMessage(destFolder, file, filterInfo()->removeDupMessage());
}
/** this function imports one mail folder file (*.PMM) */
......@@ -202,12 +194,7 @@ void FilterPMail::importMailFolder(const QString &file)
}
}
tempfile.flush();
if (filterInfo()->removeDupMessage()) {
addMessage(folder, tempfile.fileName());
} else {
addMessage_fastImport(folder, tempfile.fileName());
}
doAddMessage(folder, tempfile.fileName(), filterInfo()->removeDupMessage());
first_msg = false;
}
......@@ -270,11 +257,7 @@ void FilterPMail::importUnixMailFolder(const QString &file)
}
}
tempfile.flush();
if (filterInfo()->removeDupMessage()) {
addMessage(folder, tempfile.fileName());
} else {
addMessage_fastImport(folder, tempfile.fileName());
}
doAddMessage(folder, tempfile.fileName(), filterInfo()->removeDupMessage());
n++;
filterInfo()->setCurrent(i18n("Message %1", n));
......
......@@ -246,17 +246,10 @@ void FilterSylpheed::importFiles(const QString &dirName)
} else {
status.setRead(true); // 0 == read
}
if (filterInfo()->removeDupMessage()) {
if (! addMessage(_path, dir.filePath(*mailFile), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
} else {
if (! addMessage_fastImport(_path, dir.filePath(*mailFile), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
if (! doAddMessage(_path, dir.filePath(*mailFile), filterInfo()->removeDupMessage(), status)) {
filterInfo()->addErrorLogEntry(i18n("Could not import %1", *mailFile));
}
filterInfo()->setCurrent((int)((float) currentFile / numFiles * 100));
}
}
}
......
......@@ -246,11 +246,7 @@ void FilterTheBat::importFiles(const QString &FileName)
tmp.write(input, endPos - lastPos);
tmp.flush();
if (filterInfo()->removeDupMessage()) {
addMessage(_path, tmp.fileName());
} else {
addMessage_fastImport(_path, tmp.fileName());
}
doAddMessage(_path, tmp.fileName(), filterInfo()->removeDupMessage());
lastPos = endPos + 48;
tbb.seek(lastPos);
......
......@@ -323,11 +323,7 @@ void FilterThunderbird::importMBox(const QString &mboxName, const QString &rootD
}
}
if (filterInfo()->removeDupMessage()) {
addMessage(destFolder, tmp.fileName());
} else {
addMessage_fastImport(destFolder, tmp.fileName());
}
doAddMessage(destFolder, tmp.fileName(), filterInfo()->removeDupMessage());
int currentPercentage = (int)(((float) mbox.pos() / filenameInfo.size()) * 100);
filterInfo()->setCurrent(currentPercentage);
......
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