comparison mainwindow.cpp @ 183:01580704de3e

* Implement "Change Remote Location"
author Chris Cannam
date Sun, 19 Dec 2010 12:01:37 +0000
parents bf366e0b9050
children 1220f26d6f35
comparison
equal deleted inserted replaced
182:bf366e0b9050 183:01580704de3e
913 } 913 }
914 } 914 }
915 915
916 void MainWindow::changeRemoteRepo() 916 void MainWindow::changeRemoteRepo()
917 { 917 {
918 //!!! so we want a "multi-choice" thingy but with remote only? and then we rewrite the local hgrc?? 918 // This will involve rewriting the local .hgrc
919
920 QFileInfo hgrc(workFolderPath + "/.hg/hgrc");
921 if (!hgrc.exists() || !hgrc.isWritable()) {
922 //!!! visible error!
923 return;
924 }
925
926 MultiChoiceDialog *d = new MultiChoiceDialog
927 (tr("Change Remote Location"),
928 tr("<qt><big>Change the remote location</big></qt>"),
929 this);
930
931 d->addChoice("remote",
932 tr("<qt><center><img src=\":images/browser-64.png\"><br>Remote repository</center></qt>"),
933 tr("Provide a new URL to use for push and pull actions from the current local repository."),
934 MultiChoiceDialog::UrlArg);
935
936 if (d->exec() == QDialog::Accepted) {
937 QSettings s(hgrc.canonicalFilePath(), QSettings::IniFormat);
938 s.beginGroup("paths");
939 s.setValue("default", d->getArgument());
940 hgQueryPaths();
941 }
942
943 delete d;
919 } 944 }
920 945
921 void MainWindow::open(QString local) 946 void MainWindow::open(QString local)
922 { 947 {
923 if (openLocal(local)) { 948 if (openLocal(local)) {