- More fossil "mv" wrapping

- stopUI now navigates to "about:blank"

FossilOrigin-Name: 77ff1ae8697fa89d87f3ca03fc50cf40ce537f24
This commit is contained in:
kostas
2015-04-27 15:49:05 +00:00
parent c4e96bea35
commit efe0b61464
5 changed files with 21 additions and 13 deletions

View File

@ -258,7 +258,7 @@ bool Bridge::revertFiles(const QStringList& fileList)
}
//------------------------------------------------------------------------------
bool Bridge::renameFile(const QString &beforePath, const QString &afterPath)
bool Bridge::renameFile(const QString &beforePath, const QString &afterPath, bool renameLocal)
{
// Ensure we can rename the file
if(!QFileInfo(beforePath).exists() || QFileInfo(afterPath).exists())
@ -271,7 +271,10 @@ bool Bridge::renameFile(const QString &beforePath, const QString &afterPath)
QString wkdir = getCurrentWorkspace() + QDir::separator();
// Also rename the file
return QFile::rename(wkdir+beforePath, wkdir+afterPath);
if(renameLocal && !QFile::rename(wkdir+beforePath, wkdir+afterPath))
return false;
return true;
}
//------------------------------------------------------------------------------

View File

@ -103,7 +103,7 @@ public:
bool addFiles(const QStringList& fileList);
bool removeFiles(const QStringList& fileList, bool deleteLocal);
bool revertFiles(const QStringList& fileList);
bool renameFile(const QString& beforePath, const QString& afterPath);
bool renameFile(const QString& beforePath, const QString& afterPath, bool renameLocal);
bool undoRepository(QStringList& result, bool explainOnly);
bool updateRepository(QStringList& result, bool explainOnly);
private:

View File

@ -1828,6 +1828,7 @@ bool MainWindow::startUI()
void MainWindow::stopUI()
{
bridge.stopUI();
ui->webView->load(QUrl("about:blank"));
ui->actionFossilUI->setChecked(false);
}
@ -2159,7 +2160,7 @@ void MainWindow::on_actionRename_triggered()
// Also rename the file
QFile::rename(wkdir+fi_before.filePath(), wkdir+fi_after.filePath());
#else
bridge.renameFile(fi_before.filePath(), fi_after.filePath());
bridge.renameFile(fi_before.filePath(), fi_after.filePath(), true);
#endif
refresh();
@ -2547,7 +2548,11 @@ void MainWindow::on_actionRenameFolder_triggered()
RepoFile *r = files_to_move[i];
const QString &new_file_path = new_paths[i] + PATH_SEP + r->getFilename();
#ifndef BRIDGE_ENABLED
if(!runFossil(QStringList() << "mv" << QuotePath(r->getFilePath()) << QuotePath(new_file_path)))
#else
if(!bridge.renameFile(r->getFilePath(), new_file_path, false))
#endif
{
log(tr("Move aborted due to errors")+"\n");
goto _exit;