# HG changeset patch
# User Chris Cannam
# Date 1292884662 0
# Node ID ef5feb0d648fe0f1fedb236a01d43ac7d0539658
# Parent 702ca6dafcbe8150a0c7e386c00ac98274bef6d8
* Give all of the substantial confirmation dialogs meaningful labels for their OK buttons
diff -r 702ca6dafcbe -r ef5feb0d648f confirmcommentdialog.cpp
--- a/confirmcommentdialog.cpp Mon Dec 20 21:33:42 2010 +0000
+++ b/confirmcommentdialog.cpp Mon Dec 20 22:37:42 2010 +0000
@@ -28,7 +28,8 @@
ConfirmCommentDialog::ConfirmCommentDialog(QWidget *parent,
QString title,
QString introText,
- QString initialComment) :
+ QString initialComment,
+ QString okButtonText) :
QDialog(parent)
{
setWindowTitle(title);
@@ -50,6 +51,7 @@
layout->addWidget(bbox, 2, 0);
m_ok = bbox->button(QDialogButtonBox::Ok);
m_ok->setEnabled(initialComment != "");
+ m_ok->setText(okButtonText);
connect(bbox, SIGNAL(accepted()), this, SLOT(accept()));
connect(bbox, SIGNAL(rejected()), this, SLOT(reject()));
@@ -77,11 +79,46 @@
return text;
}
+bool ConfirmCommentDialog::confirm(QWidget *parent,
+ QString title,
+ QString text,
+ QString okButtonText)
+{
+ QMessageBox box(QMessageBox::Question,
+ title,
+ text,
+ QMessageBox::Cancel,
+ parent);
+
+ QPushButton *ok = box.addButton(QMessageBox::Ok);
+ ok->setText(okButtonText);
+ if (box.exec() == -1) return QMessageBox::Cancel;
+ return box.standardButton(box.clickedButton());
+}
+
+bool ConfirmCommentDialog::confirmDangerous(QWidget *parent,
+ QString title,
+ QString text,
+ QString okButtonText)
+{
+ QMessageBox box(QMessageBox::Warning,
+ title,
+ text,
+ QMessageBox::Cancel,
+ parent);
+
+ QPushButton *ok = box.addButton(QMessageBox::Ok);
+ ok->setText(okButtonText);
+ if (box.exec() == -1) return QMessageBox::Cancel;
+ return box.standardButton(box.clickedButton());
+}
+
bool ConfirmCommentDialog::confirmFilesAction(QWidget *parent,
QString title,
QString introText,
QString introTextWithCount,
- QStringList files)
+ QStringList files,
+ QString okButtonText)
{
QString text;
if (files.size() <= 10) {
@@ -89,19 +126,15 @@
} else {
text = " Please enter your comment:
%2").arg(cf)
.arg(tr("You are about to commit %n file(s).", "", reportFiles.size())),
reportFiles,
- comment)) {
+ comment,
+ tr("Commit"))) {
if (!justMerged && !files.empty()) {
// User wants to commit selected file(s) (and this is not
@@ -374,7 +375,8 @@
(this,
tr("Tag"),
tr("Enter tag:"),
- tag)) {
+ tag,
+ tr("Add Tag"))) {
if (!tag.isEmpty()) {//!!! do something better if it is empty
params << "tag" << "--user" << getUserInfo();
@@ -594,7 +596,8 @@
.arg(tr("You are about to revert the following files to their previous committed state.
This will throw away any changes that you have made to these files but have not committed:")),
tr("
%2").arg(rf)
.arg(tr("You are about to revert %n file(s).
This will throw away any changes that you have made to these files but have not committed.", "", files.size())),
- files)) {
+ files,
+ tr("Revert"))) {
lastRevertedFiles = files;
@@ -762,26 +765,9 @@
runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params));
}
-static QMessageBox::StandardButton confirm(QWidget *parent,
- QString title,
- QString text,
- QString okButtonText)
-{
- QMessageBox box(QMessageBox::Question,
- title,
- text,
- QMessageBox::Cancel,
- parent);
-
- QPushButton *ok = box.addButton(QMessageBox::Ok);
- ok->setText(okButtonText);
- if (box.exec() == -1) return QMessageBox::Cancel;
- return box.standardButton(box.clickedButton());
-}
-
void MainWindow::hgPull()
{
- if (confirm
+ if (ConfirmCommentDialog::confirm
(this, tr("Confirm pull"),
format3(tr("Confirm pull from remote repository"),
tr("You are about to pull changes from the following remote repository:"),
@@ -796,7 +782,7 @@
void MainWindow::hgPush()
{
- if (confirm
+ if (ConfirmCommentDialog::confirm
(this, tr("Confirm push"),
format3(tr("Confirm push to remote repository"),
tr("You are about to push your changes to the following remote repository:"),