|
|
|
@ -245,17 +245,19 @@ void AddFriendForm::onImportOpenClicked()
@@ -245,17 +245,19 @@ void AddFriendForm::onImportOpenClicked()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
contactsToImport = QString::fromUtf8(contactFile.readAll()).split('\n'); |
|
|
|
|
QMutableListIterator<QString> it(contactsToImport); |
|
|
|
|
qDebug() << "Import list:"; |
|
|
|
|
while (it.hasNext()) { |
|
|
|
|
const QString id = it.value().trimmed(); |
|
|
|
|
const bool valid = !id.isEmpty() && checkIsValidId(id); |
|
|
|
|
if (valid) { |
|
|
|
|
it.value() = id; |
|
|
|
|
for (auto it = contactsToImport.begin(); it != contactsToImport.end();) { |
|
|
|
|
const QString id = it->trimmed(); |
|
|
|
|
if (checkIsValidId(id)) { |
|
|
|
|
*it = id; |
|
|
|
|
qDebug() << *it; |
|
|
|
|
++it; |
|
|
|
|
} else { |
|
|
|
|
it.remove(); |
|
|
|
|
if (!id.isEmpty()) { |
|
|
|
|
qDebug() << "Invalid ID:" << *it; |
|
|
|
|
} |
|
|
|
|
it = contactsToImport.erase(it); |
|
|
|
|
} |
|
|
|
|
qDebug() << it.next(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (contactsToImport.isEmpty()) { |
|
|
|
|