Git commit 179ff16a81c0d60fb94134737e6c7ee54491991b by Aleix Pol. Committed on 07/09/2013 at 23:05. Pushed by apol into branch 'master'. Cosmetic changes M +11 -11 src/widgets/mergedialog.cpp M +5 -7 src/widgets/mergedialog.h http://commits.kde.org/libkpeople/179ff16a81c0d60fb94134737e6c7ee54491991b diff --git a/src/widgets/mergedialog.cpp b/src/widgets/mergedialog.cpp index 133761a..57a95ff 100644 --- a/src/widgets/mergedialog.cpp +++ b/src/widgets/mergedialog.cpp @@ -61,7 +61,7 @@ MergeDialog::MergeDialog(QWidget *parent) = setWindowTitle(i18n("Duplicates Manager")); setLayout(new QVBoxLayout()); - setMinimumSize(450,350); + setMinimumSize(450, 350); = d->model =3D new QStandardItemModel(this); d->view =3D new QListView(this); @@ -116,7 +116,7 @@ void MergeDialog::mergeMatchingContactsFromIndex(const = QStandardItem *parent) int rows =3D parent->rowCount(); = for (int i =3D 0; ichild(i,0); + QStandardItem *child =3D parent->child(i, 0); mergingList << child->data(MergeDialog::UriRole).toUrl(); } mergingList << parent->data(MergeDialog::UriRole).toUrl(); @@ -126,7 +126,7 @@ void MergeDialog::mergeMatchingContactsFromIndex(const = QStandardItem *parent) void MergeDialog::onMergeButtonClicked() { QList parents =3D checkedItems(); - Q_FOREACH (QStandardItem *parent , parents) { + Q_FOREACH (QStandardItem *parent, parents) { mergeMatchingContactsFromIndex(parent); } emit accept(); @@ -142,8 +142,8 @@ void MergeDialog::searchForDuplicatesFinished(KJob*) d->view->setItemDelegate(d->delegate); = // To extend the selected item - connect(d->view->selectionModel(), SIGNAL(selectionChanged(QItemSelect= ion,QItemSelection)), - d->delegate, SLOT(onSelectedContactsChanged(QItemSelection,QIt= emSelection))); + connect(d->view->selectionModel(), SIGNAL(selectionChanged(QItemSelect= ion, QItemSelection)), + d->delegate, SLOT(onSelectedContactsChanged(QItemSelection, QI= temSelection))); // To contract an already selected item connect(d->view, SIGNAL(doubleClicked(QModelIndex)), d->delegate, SLOT(onClickContactParent(QModelIndex))); @@ -166,7 +166,7 @@ void MergeDialog::feedDuplicateModelFromMatches(const Q= List &matches) compareTable[match.indexA]=3D currentValue; } } - // now build the model : 1st dimension =3D parent , 2nd dimension =3D = children + // now build the model : 1st dimension =3D parent, 2nd dimension =3D c= hildren QStandardItem *rootItem =3D d->model->invisibleRootItem(); QMap >::const_iterator i; = @@ -175,7 +175,7 @@ void MergeDialog::feedDuplicateModelFromMatches(const Q= List &matches) QStandardItem *parent =3D itemMergeContactFromMatch(i.key(), i->fi= rst()); rootItem->appendRow(parent); = - Q_FOREACH (const Match &matchChild, compareTable.value(QModelIndex= () , *i)) { + Q_FOREACH (const Match &matchChild, compareTable.value(QModelIndex= (), *i)) { QStandardItem *oneChild =3D itemMergeContactFromMatch(QModelIn= dex(), matchChild); parent->appendRow(oneChild); } @@ -189,7 +189,7 @@ QStandardItem* MergeDialog::itemMergeContactFromMatch(c= onst QModelIndex &idx, co item->setCheckable(true); item->setCheckState(Qt::Checked); = - QUrl uri ; + QUrl uri; if (!idx.isValid()) { // child = uri =3D match.indexB.data(PersonsModel::UriRole).toUrl(); @@ -205,7 +205,7 @@ QStandardItem* MergeDialog::itemMergeContactFromMatch(c= onst QModelIndex &idx, co item->setData(qVariantFromValue(uri), UriRole); = item->setText(match.indexA.data(Qt::DisplayRole).toString()); - item->setData(match.indexA.data(Qt::DecorationRole) , Qt::Decorati= onRole); + item->setData(match.indexA.data(Qt::DecorationRole), Qt::Decoratio= nRole); } return item; } @@ -216,8 +216,8 @@ QList MergeDialog::checkedItems() QStandardItem *root =3D d->model->invisibleRootItem(); int rows =3D root->rowCount(); QList results; - for (int i =3D 0 ; i < rows ; i++) { - QStandardItem *currentParent =3D root->child(i,0); + for (int i =3D 0; i < rows; i++) { + QStandardItem *currentParent =3D root->child(i, 0); if (currentParent->checkState() =3D=3D Qt::Checked) { results.append(currentParent); } diff --git a/src/widgets/mergedialog.h b/src/widgets/mergedialog.h index 2a17920..5ed8ab8 100644 --- a/src/widgets/mergedialog.h +++ b/src/widgets/mergedialog.h @@ -49,19 +49,17 @@ public: ~MergeDialog(); void setPersonsModel(PersonsModel *model); = -private: - QList checkedItems(); - void mergeMatchingContactsFromIndex(const QStandardItem *parent); - QStandardItem* itemMergeContactFromMatch(const QModelIndex &idx, const= Match &match); - - void feedDuplicateModelFromMatches(const QList &matches) ; - private Q_SLOTS: void searchForDuplicates(); void searchForDuplicatesFinished(KJob *); void onMergeButtonClicked(); = private: + QList checkedItems(); + void mergeMatchingContactsFromIndex(const QStandardItem *parent); + QStandardItem* itemMergeContactFromMatch(const QModelIndex &idx, const= Match &match); + void feedDuplicateModelFromMatches(const QList &matches); + MergeDialogPrivate * const d_ptr; Q_DECLARE_PRIVATE(MergeDialog) };