Mercurial > hg > easyhg
comparison mainwindow.cpp @ 192:702ca6dafcbe
* Make OK buttons on push/pull dialogs say Push and Pull
author | Chris Cannam |
---|---|
date | Mon, 20 Dec 2010 21:33:42 +0000 |
parents | b2fae1f16002 |
children | ef5feb0d648f |
comparison
equal
deleted
inserted
replaced
191:b2fae1f16002 | 192:702ca6dafcbe |
---|---|
760 params << "--template" << Changeset::getLogTemplate(); | 760 params << "--template" << Changeset::getLogTemplate(); |
761 | 761 |
762 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params)); | 762 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params)); |
763 } | 763 } |
764 | 764 |
765 static QMessageBox::StandardButton confirm(QWidget *parent, | |
766 QString title, | |
767 QString text, | |
768 QString okButtonText) | |
769 { | |
770 QMessageBox box(QMessageBox::Question, | |
771 title, | |
772 text, | |
773 QMessageBox::Cancel, | |
774 parent); | |
775 | |
776 QPushButton *ok = box.addButton(QMessageBox::Ok); | |
777 ok->setText(okButtonText); | |
778 if (box.exec() == -1) return QMessageBox::Cancel; | |
779 return box.standardButton(box.clickedButton()); | |
780 } | |
781 | |
765 void MainWindow::hgPull() | 782 void MainWindow::hgPull() |
766 { | 783 { |
767 if (QMessageBox::question | 784 if (confirm |
768 (this, tr("Confirm pull"), | 785 (this, tr("Confirm pull"), |
769 format3(tr("Confirm pull from remote repository"), | 786 format3(tr("Confirm pull from remote repository"), |
770 tr("You are about to pull from the following remote repository:"), | 787 tr("You are about to pull changes from the following remote repository:"), |
771 remoteRepoPath), | 788 remoteRepoPath), |
772 QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { | 789 tr("Pull")) == QMessageBox::Ok) { |
773 | 790 |
774 QStringList params; | 791 QStringList params; |
775 params << "pull" << remoteRepoPath; | 792 params << "pull" << remoteRepoPath; |
776 runner->requestAction(HgAction(ACT_PULL, workFolderPath, params)); | 793 runner->requestAction(HgAction(ACT_PULL, workFolderPath, params)); |
777 } | 794 } |
778 } | 795 } |
779 | 796 |
780 void MainWindow::hgPush() | 797 void MainWindow::hgPush() |
781 { | 798 { |
782 if (QMessageBox::question | 799 if (confirm |
783 (this, tr("Confirm push"), | 800 (this, tr("Confirm push"), |
784 format3(tr("Confirm push to remote repository"), | 801 format3(tr("Confirm push to remote repository"), |
785 tr("You are about to push to the following remote repository:"), | 802 tr("You are about to push your changes to the following remote repository:"), |
786 remoteRepoPath), | 803 remoteRepoPath), |
787 QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) { | 804 tr("Push")) == QMessageBox::Ok) { |
788 | 805 |
789 QStringList params; | 806 QStringList params; |
790 params << "push" << "--new-branch" << remoteRepoPath; | 807 params << "push" << "--new-branch" << remoteRepoPath; |
791 runner->requestAction(HgAction(ACT_PUSH, workFolderPath, params)); | 808 runner->requestAction(HgAction(ACT_PUSH, workFolderPath, params)); |
792 } | 809 } |