Mercurial > hg > easyhg
diff mainwindow.cpp @ 183:01580704de3e
* Implement "Change Remote Location"
author | Chris Cannam |
---|---|
date | Sun, 19 Dec 2010 12:01:37 +0000 |
parents | bf366e0b9050 |
children | 1220f26d6f35 |
line wrap: on
line diff
--- a/mainwindow.cpp Fri Dec 17 10:01:02 2010 +0000 +++ b/mainwindow.cpp Sun Dec 19 12:01:37 2010 +0000 @@ -915,7 +915,32 @@ void MainWindow::changeRemoteRepo() { - //!!! so we want a "multi-choice" thingy but with remote only? and then we rewrite the local hgrc?? + // This will involve rewriting the local .hgrc + + QFileInfo hgrc(workFolderPath + "/.hg/hgrc"); + if (!hgrc.exists() || !hgrc.isWritable()) { + //!!! visible error! + return; + } + + MultiChoiceDialog *d = new MultiChoiceDialog + (tr("Change Remote Location"), + tr("<qt><big>Change the remote location</big></qt>"), + this); + + d->addChoice("remote", + tr("<qt><center><img src=\":images/browser-64.png\"><br>Remote repository</center></qt>"), + tr("Provide a new URL to use for push and pull actions from the current local repository."), + MultiChoiceDialog::UrlArg); + + if (d->exec() == QDialog::Accepted) { + QSettings s(hgrc.canonicalFilePath(), QSettings::IniFormat); + s.beginGroup("paths"); + s.setValue("default", d->getArgument()); + hgQueryPaths(); + } + + delete d; } void MainWindow::open(QString local)