comparison mainwindow.cpp @ 126:f41bbd0c7c27

* Add confirm dialogs for pull and push
author Chris Cannam
date Mon, 29 Nov 2010 17:11:29 +0000
parents 63c2f3f61c79
children 758471b71721
comparison
equal deleted inserted replaced
125:63c2f3f61c79 126:f41bbd0c7c27
585 params << "--template" << Changeset::getLogTemplate(); 585 params << "--template" << Changeset::getLogTemplate();
586 586
587 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params)); 587 runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params));
588 } 588 }
589 589
590
591 void MainWindow::hgPull() 590 void MainWindow::hgPull()
592 { 591 {
593 QStringList params; 592 if (QMessageBox::question
594 593 (this, tr("Confirm pull"),
595 params << "pull" << remoteRepoPath; 594 format3(tr("Confirm pull from remote repository"),
596 595 tr("You are about to pull from the following remote repository:"),
597 runner->requestAction(HgAction(ACT_PULL, workFolderPath, params)); 596 remoteRepoPath),
598 } 597 QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
599 598
599 QStringList params;
600 params << "pull" << remoteRepoPath;
601 runner->requestAction(HgAction(ACT_PULL, workFolderPath, params));
602 }
603 }
600 604
601 void MainWindow::hgPush() 605 void MainWindow::hgPush()
602 { 606 {
603 QStringList params; 607 if (QMessageBox::question
604 608 (this, tr("Confirm push"),
605 params << "push" << remoteRepoPath; 609 format3(tr("Confirm push to remote repository"),
606 610 tr("You are about to push to the following remote repository:"),
607 runner->requestAction(HgAction(ACT_PUSH, workFolderPath, params)); 611 remoteRepoPath),
612 QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
613
614 QStringList params;
615 params << "push" << remoteRepoPath;
616 runner->requestAction(HgAction(ACT_PUSH, workFolderPath, params));
617 }
608 } 618 }
609 619
610 QString MainWindow::listAllUpIpV4Addresses() 620 QString MainWindow::listAllUpIpV4Addresses()
611 { 621 {
612 QString ret; 622 QString ret;
1041 QString MainWindow::format3(QString head, QString intro, QString code) 1051 QString MainWindow::format3(QString head, QString intro, QString code)
1042 { 1052 {
1043 if (intro == "") { 1053 if (intro == "") {
1044 return QString("<qt><h3>%1</h3><code>%2</code>") 1054 return QString("<qt><h3>%1</h3><code>%2</code>")
1045 .arg(head).arg(xmlEncode(code).replace("\n", "<br>")); 1055 .arg(head).arg(xmlEncode(code).replace("\n", "<br>"));
1056 } else if (code == "") {
1057 return QString("<qt><h3>%1</h3><p>%2</p>")
1058 .arg(head).arg(intro);
1046 } else { 1059 } else {
1047 return QString("<qt><h3>%1</h3><p>%2</p><code>%3</code>") 1060 return QString("<qt><h3>%1</h3><p>%2</p><code>%3</code>")
1048 .arg(head).arg(intro).arg(xmlEncode(code).replace("\n", "<br>")); 1061 .arg(head).arg(intro).arg(xmlEncode(code).replace("\n", "<br>"));
1049 } 1062 }
1050 } 1063 }