Commit 2755864b authored by Laurent Montel's avatar Laurent Montel
Browse files

Allow to check/uncheck all items + expand/collapse

parent 19ff00b0
Pipeline #228330 passed with stage
in 13 minutes and 4 seconds
......@@ -110,6 +110,23 @@ QVector<Akonadi::Item::List> ResultDuplicateTreeWidget::selectedContactsToMerge(
return listItems;
}
void ResultDuplicateTreeWidget::checkAllItems()
{
for (int i = 0; i < topLevelItemCount(); ++i) {
QTreeWidgetItem *item = topLevelItem(i);
item->setCheckState(0, Qt::Checked);
// const int childCount = item->childCount();
}
}
void ResultDuplicateTreeWidget::uncheckAllItems()
{
for (int i = 0; i < topLevelItemCount(); ++i) {
QTreeWidgetItem *item = topLevelItem(i);
item->setCheckState(0, Qt::Unchecked);
}
}
ResultDuplicateTreeWidgetItem::ResultDuplicateTreeWidgetItem(QTreeWidget *parent)
: QTreeWidgetItem(parent)
{
......
......@@ -42,6 +42,8 @@ public:
Q_REQUIRED_RESULT QVector<Akonadi::Item::List> selectedContactsToMerge() const;
void checkAllItems();
void uncheckAllItems();
Q_SIGNALS:
void showContactPreview(const Akonadi::Item &item);
......
......@@ -94,10 +94,33 @@ SearchDuplicateResultWidget::~SearchDuplicateResultWidget() = default;
void SearchDuplicateResultWidget::slotCustomContextMenuRequested(const QPoint &)
{
#if 0
QMenu menu(this);
menu.addAction(i18n("Expand All"), this, &SearchDuplicateResultWidget::slotExpandAll);
menu.addAction(i18n("Collapse All"), this, &SearchDuplicateResultWidget::slotCollapseAll);
menu.addSeparator();
menu.addAction(i18n("Select All"), this, &SearchDuplicateResultWidget::slotSelectAll);
menu.addAction(i18n("Deselect All"), this, &SearchDuplicateResultWidget::slotDeselectAll);
menu.exec(QCursor::pos());
#endif
}
void SearchDuplicateResultWidget::slotExpandAll()
{
mResultTreeWidget->expandAll();
}
void SearchDuplicateResultWidget::slotCollapseAll()
{
mResultTreeWidget->collapseAll();
}
void SearchDuplicateResultWidget::slotSelectAll()
{
mResultTreeWidget->checkAllItems();
}
void SearchDuplicateResultWidget::slotDeselectAll()
{
mResultTreeWidget->uncheckAllItems();
}
void SearchDuplicateResultWidget::setContacts(const QVector<Akonadi::Item::List> &lstItem)
......
......@@ -52,6 +52,10 @@ private:
void slotCustomizeMergingContacts();
void mergeContact();
void slotCustomContextMenuRequested(const QPoint &);
void slotExpandAll();
void slotCollapseAll();
void slotSelectAll();
void slotDeselectAll();
QVector<MergeConflictResult> mResultConflictList;
QVector<Akonadi::Item::List> mListContactToMerge;
ResultDuplicateTreeWidget *const mResultTreeWidget;
......
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