Mercurial > hg > easyhg
diff mainwindow.cpp @ 103:0bd32aedc6f6
* Start to use the confirm-comment dialog for commits; much work still needed
author | Chris Cannam |
---|---|
date | Wed, 24 Nov 2010 22:44:40 +0000 |
parents | a5a2d74a83a7 |
children | af314dd436d5 |
line wrap: on
line diff
--- a/mainwindow.cpp Wed Nov 24 22:24:55 2010 +0000 +++ b/mainwindow.cpp Wed Nov 24 22:44:40 2010 +0000 @@ -37,6 +37,7 @@ #include "colourset.h" #include "debug.h" #include "logparser.h" +#include "confirmcommentdialog.h" MainWindow::MainWindow() @@ -316,17 +317,6 @@ } } - -bool MainWindow::getCommentOrTag(QString& commentOrTag, - QString question, - QString dlgTitle) -{ - bool ok = false; - QString text = QInputDialog::getText(this, dlgTitle, question, QLineEdit::Normal, commentOrTag, &ok); - commentOrTag = text; - return ok; -} - void MainWindow::hgCommit() { //!!! Now that hg actions can be fired asynchronously (e.g. from @@ -337,14 +327,20 @@ { QStringList params; QString comment; - - if (getCommentOrTag(comment, tr("Comment:"), tr("Save (commit)"))) - { + + QStringList files = hgTabs->getSelectedCommittableFiles(); + if (files.empty()) files = hgTabs->getAllCommittableFiles(); + + if (ConfirmCommentDialog::confirmAndComment(this, + tr("Commit files"), + tr("About to commit the following files:"), + tr("About to commit %1 files."), + files, + comment)) { + //!!! do something more sensible when the comment is empty // (i.e. tell the user about it?) - QStringList files = hgTabs->getSelectedCommittableFiles(); - if ((justMerged == false) && //!!! review usage of justMerged !files.empty()) { // User wants to commit selected file(s) (and this is not merge commit, which would fail if we selected files) @@ -384,9 +380,11 @@ QStringList params; QString tag; - if (getCommentOrTag(tag, tr("Tag:"), tr("Tag"))) - { - if (!tag.isEmpty()) + if (ConfirmCommentDialog::confirmAndComment(this, + tr("Tag"), + tr("Enter tag:"), + tag)) { + if (!tag.isEmpty()) //!!! do something better if it is empty { params << "tag" << "--user" << getUserInfo() << filterTag(tag);