Commit 2b7dd973 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Minor optimization

parent 932b6d57
......@@ -241,7 +241,8 @@ void GMXImportExportPluginInterface::doExport(QFile *fp, const KContacts::Addres
const QStringList categories = addressee->categories();
long int category = 0;
if (!categories.isEmpty()) {
for (int i = 0; i < categories.count(); ++i) {
const int categoriesCount(categories.count());
for (int i = 0; i < categoriesCount; ++i) {
const QString cat = categories[i];
if (categoryMap.contains(cat)) {
category |= 1 << categoryMap.indexOf(cat, 0);
......
......@@ -90,20 +90,20 @@ void ImportExportEngine::importContacts()
const Akonadi::Collection collection = dlg->selectedCollection();
delete dlg;
mNumberElementToImport = mContactsList.count();
if (!mImportProgressDialog) {
mImportProgressDialog = new QProgressDialog(mParentWidget);
mImportProgressDialog->setWindowTitle(i18n("Import Contacts"));
mImportProgressDialog->setLabelText(
i18np("Importing one contact to %2", "Importing %1 contacts to %2",
mContactsList.count(), collection.name()));
mNumberElementToImport, collection.name()));
mImportProgressDialog->setCancelButton(Q_NULLPTR);
mImportProgressDialog->setAutoClose(true);
mImportProgressDialog->setRange(1, mContactsList.count());
mImportProgressDialog->setRange(1, mNumberElementToImport);
}
mImportProgressDialog->show();
mImportDone = 0;
mNumberElementToImport = mContactsList.count();
for (int i = 0; i < mContactsList.addressList().count(); ++i) {
Akonadi::Item item;
......
Supports Markdown
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