summaryrefslogtreecommitdiff
path: root/src/plugins/vcsbase/cleandialog.cpp
diff options
context:
space:
mode:
authorPetar Perisin <petar.perisin@gmail.com>2013-03-26 17:27:17 +0100
committerPetar Perisin <petar.perisin@gmail.com>2013-04-02 11:37:02 +0200
commiteebee3311d4b8bba4972613128efa3af816b9f85 (patch)
tree538fa7caa496127f5ee76695634b147871b97ab8 /src/plugins/vcsbase/cleandialog.cpp
parent0bac4d861d87bc9f69562e054d75fe00ce908983 (diff)
downloadqt-creator-eebee3311d4b8bba4972613128efa3af816b9f85.tar.gz
VCS Clean Dialog: Added "Select All" checkbox
Change-Id: I5bff60b1aa1985926efb6b850be958f48d67a029 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Diffstat (limited to 'src/plugins/vcsbase/cleandialog.cpp')
-rw-r--r--src/plugins/vcsbase/cleandialog.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp
index bae7480cbb..fd921e2e2f 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);