summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-13 19:26:36 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-13 19:26:48 (GMT)
commit2b7dd973b007568f31678c5e86ee9e3c04022240 (patch)
tree57829f6aaaec2e4d9ca3ad0a1aa4a4b3cac411d2
parent932b6d57eb420083856537f76f61180c8bba3f36 (diff)
Minor optimization
-rw-r--r--kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp3
-rw-r--r--kaddressbook/importexportplugins/shared/importexportengine.cpp6
2 files changed, 5 insertions, 4 deletions
diff --git a/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp b/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp
index 00816fa..5f56fdd 100644
--- a/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp
+++ b/kaddressbook/importexportplugins/gmx/gmximportexportplugininterface.cpp
@@ -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);
diff --git a/kaddressbook/importexportplugins/shared/importexportengine.cpp b/kaddressbook/importexportplugins/shared/importexportengine.cpp
index 0d78e53..6559018 100644
--- a/kaddressbook/importexportplugins/shared/importexportengine.cpp
+++ b/kaddressbook/importexportplugins/shared/importexportengine.cpp
@@ -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;