diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp index bae7480cbb9..fd921e2e2f2 100644 --- a/src/plugins/vcsbase/cleandialog.cpp +++ b/src/plugins/vcsbase/cleandialog.cpp @@ -170,6 +170,8 @@ CleanDialog::CleanDialog(QWidget *parent) : d->ui.filesTreeView->setRootIsDecorated(false); connect(d->ui.filesTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotDoubleClicked(QModelIndex))); + connect(d->ui.selectAllCheckBox, SIGNAL(clicked(bool)), this, SLOT(selectAllItems(bool))); + connect(d->ui.filesTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateSelectAllCheckBox())); } CleanDialog::~CleanDialog() @@ -193,6 +195,9 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList for (int c = 0; c < d->m_filesModel->columnCount(); c++) d->ui.filesTreeView->resizeColumnToContents(c); + + if (ignoredFiles.isEmpty()) + d->ui.selectAllCheckBox->setChecked(true); } void CleanDialog::addFile(const QString &workingDirectory, QString fileName, bool checked) @@ -278,6 +283,31 @@ void CleanDialog::slotDoubleClicked(const QModelIndex &index) } } +void CleanDialog::selectAllItems(bool checked) +{ + if (const int rowCount = d->m_filesModel->rowCount()) { + for (int r = 0; r < rowCount; ++r) { + QStandardItem *item = d->m_filesModel->item(r, 0); + item->setCheckState(checked ? Qt::Checked : Qt::Unchecked); + } + } +} + +void CleanDialog::updateSelectAllCheckBox() +{ + bool checked = true; + if (const int rowCount = d->m_filesModel->rowCount()) { + for (int r = 0; r < rowCount; ++r) { + const QStandardItem *item = d->m_filesModel->item(r, 0); + if (item->checkState() == Qt::Unchecked) { + checked = false; + break; + } + } + d->ui.selectAllCheckBox->setChecked(checked); + } +} + void CleanDialog::changeEvent(QEvent *e) { QDialog::changeEvent(e); diff --git a/src/plugins/vcsbase/cleandialog.h b/src/plugins/vcsbase/cleandialog.h index 3b290932815..374131d0875 100644 --- a/src/plugins/vcsbase/cleandialog.h +++ b/src/plugins/vcsbase/cleandialog.h @@ -60,6 +60,8 @@ protected: private slots: void slotDoubleClicked(const QModelIndex &); + void selectAllItems(bool checked); + void updateSelectAllCheckBox(); private: QStringList checkedFiles() const; diff --git a/src/plugins/vcsbase/cleandialog.ui b/src/plugins/vcsbase/cleandialog.ui index dc679675e78..8e558dbbb67 100644 --- a/src/plugins/vcsbase/cleandialog.ui +++ b/src/plugins/vcsbase/cleandialog.ui @@ -17,6 +17,13 @@ + + + + Select All + + + @@ -44,8 +51,8 @@ accept() - 248 - 254 + 257 + 649 157 @@ -60,8 +67,8 @@ reject() - 316 - 260 + 325 + 649 286