- Wrapped "fossil close"

- Fixed invalid window title when closing a workspace


FossilOrigin-Name: c449a826c83c98c4e33e7adb31841684b4ed6084
This commit is contained in:
kostas
2015-04-26 17:40:58 +00:00
parent c43c638b91
commit 1c728c9146
5 changed files with 31 additions and 11 deletions

View File

@ -85,6 +85,17 @@ bool Bridge::newRepository(const QString& repositoryPath)
return true;
}
//------------------------------------------------------------------------------
bool Bridge::closeRepository()
{
if(!runFossil(QStringList() << "close"))
return false;
stopUI();
setCurrentWorkspace("");
return true;
}
//------------------------------------------------------------------------------
static QString ParseFossilQuery(QString line)
{

View File

@ -84,6 +84,7 @@ public:
bool openRepository(const QString &repositoryPath, const QString& workspacePath);
bool newRepository(const QString &repositoryPath);
bool closeRepository();
bool uiRunning() const;
bool startUI(const QString &httpPort);

View File

@ -498,14 +498,20 @@ void MainWindow::on_actionCloseRepository_triggered()
return;
// Close Repo
#ifndef BRIDGE_ENABLED
if(!runFossil(QStringList() << "close"))
#else
if(!bridge.closeRepository())
#endif
{
QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes available?"), QMessageBox::Ok );
return;
}
#ifdef BRIDGE_ENABLED
stopUI();
setCurrentWorkspace("");
#endif
refresh();
}
@ -647,6 +653,8 @@ void MainWindow::enableActions(bool on)
//------------------------------------------------------------------------------
bool MainWindow::refresh()
{
QString title = "Fuel";
// Load repository info
RepoStatus st = getRepoStatus();
@ -656,6 +664,7 @@ bool MainWindow::refresh()
enableActions(false);
repoFileModel.removeRows(0, repoFileModel.rowCount());
repoDirModel.clear();
setWindowTitle(title);
return false;
}
else if(st==REPO_OLD_SCHEMA)
@ -664,6 +673,7 @@ bool MainWindow::refresh()
enableActions(false);
repoFileModel.removeRows(0, repoFileModel.rowCount());
repoDirModel.clear();
setWindowTitle(title);
return true;
}
@ -672,8 +682,6 @@ bool MainWindow::refresh()
setStatus("");
enableActions(true);
QString title = "Fuel";
if(!getProjectName().isEmpty())
title += " - " + getProjectName();