Commit 13efb8d9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use QVector + const'ref + modernize code

parent 440476fb
Pipeline #32004 passed with stage
in 20 minutes and 29 seconds
......@@ -285,9 +285,8 @@ void AddresseeLineEdit::dropEvent(QDropEvent *event)
KContacts::Addressee::List list;
KContacts::VCardDrag::fromMimeData(md, list);
const KContacts::Addressee::List::ConstIterator end(list.constEnd());
for (KContacts::Addressee::List::ConstIterator ait = list.constBegin(); ait != end; ++ait) {
insertEmails((*ait).emails());
for (const KContacts::Addressee &addr : qAsConst(list)) {
insertEmails(addr.emails());
}
}
// Case two: The user dropped a list or Urls.
......@@ -449,8 +448,8 @@ void AddresseeLineEdit::insertEmails(const QStringList &emails)
QMenu menu(this);
menu.setTitle(i18n("Select email from contact"));
menu.setObjectName(QStringLiteral("Addresschooser"));
for (QStringList::const_iterator it = emails.constBegin(), end = emails.constEnd(); it != end; ++it) {
menu.addAction(*it);
for (const QString &email : emails) {
menu.addAction(email);
}
const QAction *result = menu.exec(QCursor::pos());
if (!result) {
......@@ -538,7 +537,7 @@ void AddresseeLineEdit::addContact(const QStringList &emails, const KContacts::A
}
}
void AddresseeLineEdit::addContact(const KContacts::Addressee &addr, int weight, int source, QString append)
void AddresseeLineEdit::addContact(const KContacts::Addressee &addr, int weight, int source, const QString &append)
{
const QStringList emails = AddresseeLineEditManager::self()->cleanupEmailList(addr.emails());
if (emails.isEmpty()) {
......
......@@ -86,7 +86,7 @@ public:
* @p source index
* @p append is added to completion string, but removed, when mail is selected.
*/
void addContact(const KContacts::Addressee &contact, int weight, int source = -1, QString append = QString());
void addContact(const KContacts::Addressee &contact, int weight, int source = -1, const QString &append = QString());
/**
* Same as the above, but this time with contact groups.
......
......@@ -414,9 +414,9 @@ public:
{
}
QList< QPair<KLDAP::LdapAttrMap, QString> > selectedItems()
QVector< QPair<KLDAP::LdapAttrMap, QString> > selectedItems()
{
QList< QPair<KLDAP::LdapAttrMap, QString> > contacts;
QVector< QPair<KLDAP::LdapAttrMap, QString> > contacts;
const QModelIndexList selected = mResultView->selectionModel()->selectedRows();
const int numberOfSelectedElement(selected.count());
......@@ -838,7 +838,7 @@ void LdapSearchDialog::slotUser1()
d->mSelectedContacts.clear();
const QList< QPair<KLDAP::LdapAttrMap, QString> > &items = d->selectedItems();
const QVector< QPair<KLDAP::LdapAttrMap, QString> > &items = d->selectedItems();
if (!items.isEmpty()) {
const QDateTime now = QDateTime::currentDateTime();
......
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