- Cloning now uses the keychain to store credentials, and sets the default remote

- Clone target fossil file now adds the fossil extension if missing
- Fixed clipboard URL parsing for clone url
- Added more actions to disable when a valid workspace is not available


FossilOrigin-Name: e7d9b59c32aa0d0ad5c97b24d7562e448dad16f3
This commit is contained in:
kostas
2015-06-02 14:48:51 +00:00
parent e71c3750cb
commit d87c651d45
4 changed files with 38 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ bool CloneDialog::run(QWidget *parent, QUrl &url, QString &repository, QUrl &url
dlg.ui->linePassword->setText(nurl.password());
nurl.setUserName("");
nurl.setPassword("");
dlg.ui->lineURL->setText(nurl.toString());
dlg.ui->lineURL->setText(UrlToStringNoCredentials(nurl));
}
}
@@ -91,6 +91,11 @@ void CloneDialog::GetRepositoryPath(QString &pathResult)
filter,
&filter,
QFileDialog::DontConfirmOverwrite);
// Ensure that it ends in the required extension (On GTK, Qt doesn't seem to add it automatically)
QFileInfo fi(pathResult);
if(fi.suffix().toLower() != ("." FOSSIL_EXT))
pathResult += "." FOSSIL_EXT;
}
//-----------------------------------------------------------------------------

View File

@@ -521,7 +521,25 @@ void MainWindow::on_actionCloneRepository_triggered()
return;
}
openWorkspace(repository);
if(!openWorkspace(repository))
return;
// Store credentials
if(!url.isLocalFile())
{
KeychainDelete(this, url);
if(!KeychainSet(this, url))
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok );
}
// Create Remote
url.setPassword("");
QString name = UrlToStringNoCredentials(url);
getWorkspace().addRemote(url, name);
getWorkspace().setRemoteDefault(url);
updateWorkspaceView();
}
//------------------------------------------------------------------------------
@@ -559,6 +577,7 @@ void MainWindow::onOpenRecent()
void MainWindow::enableActions(bool on)
{
QAction *actions[] = {
ui->actionCloseRepository,
ui->actionCommit,
ui->actionDiff,
ui->actionAdd,
@@ -585,6 +604,7 @@ void MainWindow::enableActions(bool on)
ui->actionDeleteTag,
ui->actionCreateBranch,
ui->actionMergeBranch,
ui->actionFossilSettings
};
for(size_t i=0; i<COUNTOF(actions); ++i)
@@ -623,8 +643,9 @@ bool MainWindow::refresh()
setStatus("");
enableActions(true);
if(!fossil().getProjectName().isEmpty())
title += " - " + fossil().getProjectName();
const QString &project_name = fossil().getProjectName();
if(!project_name.isEmpty())
title += " - " + project_name;
setWindowTitle(title);
return true;