Refactored openRepository
FossilOrigin-Name: 02a7b672e1d634b703ee5f30258153c3f4610886
This commit is contained in:
@@ -55,21 +55,6 @@ enum
|
||||
REPODIRMODEL_ROLE_PATH = Qt::UserRole+1
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static QString QuotePath(const QString &path)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static QStringList QuotePaths(const QStringList &paths)
|
||||
{
|
||||
QStringList res;
|
||||
for(int i=0; i<paths.size(); ++i)
|
||||
res.append(QuotePath(paths[i]));
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
static QStringMap MakeKeyValues(QStringList lines)
|
||||
@@ -347,14 +332,15 @@ bool MainWindow::openWorkspace(const QString &path)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
// Ok open the fossil
|
||||
setCurrentWorkspace(wkspace);
|
||||
if(!QDir::setCurrent(wkspace))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory"), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
|
||||
setCurrentWorkspace(wkspace);
|
||||
setRepositoryFile(fi.absoluteFilePath());
|
||||
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(getRepositoryFile())))
|
||||
@@ -362,6 +348,13 @@ bool MainWindow::openWorkspace(const QString &path)
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if(!bridge.openRepository(fi.absoluteFilePath(), wkspace))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user