# HG changeset patch # User Chris Cannam # Date 1292760097 0 # Node ID 01580704de3ee8b269e24fca9ba4e2096791f591 # Parent bf366e0b90507ced4046b288a38a1f9038dc6756 * Implement "Change Remote Location" diff -r bf366e0b9050 -r 01580704de3e mainwindow.cpp --- 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("Change the remote location"), + this); + + d->addChoice("remote", + tr("

Remote repository
"), + 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) diff -r bf366e0b9050 -r 01580704de3e multichoicedialog.cpp --- a/multichoicedialog.cpp Fri Dec 17 10:01:02 2010 +0000 +++ b/multichoicedialog.cpp Sun Dec 19 12:01:37 2010 +0000 @@ -152,6 +152,7 @@ SelectableLabel *cb = new SelectableLabel; cb->setSelectedText(text); cb->setUnselectedText(text); + cb->setMaximumWidth(270); m_choiceLayout->addWidget(cb); m_choiceButtons[cb] = id; @@ -307,6 +308,7 @@ case UrlArg: m_urlLabel->show(); m_urlCombo->show(); + m_urlCombo->addItems(rf->getRecent()); break; case UrlToDirectoryArg: