Fixes: Added dbl-click handling for remote branches

Task:
RevBy:
AutoTest:
Details: Moved code to create a local branch from model to dialog which is slightly better since all the modifying app code is there.
This commit is contained in:
Friedemann Kleint
2009-01-09 16:27:42 +01:00
parent 5632709e0a
commit 94d646a206
4 changed files with 102 additions and 29 deletions

View File

@@ -218,33 +218,18 @@ bool LocalBranchModel::setData(const QModelIndex &index, const QVariant &value,
if (role != Qt::EditRole || index.row() < branchCount())
return false;
const QString branchName = value.toString();
const bool ok = checkNewBranchName(branchName);
if (debug)
qDebug() << Q_FUNC_INFO << branchName << ok;
if (!ok)
return false;
// Create
QString output;
QString errorMessage;
if (!runGitBranchCommand(workingDirectory(), QStringList(branchName), &output, &errorMessage))
return false;
m_newBranch = branchName;
// Start a delayed complete refresh and return true for now.
QTimer::singleShot(0, this, SLOT(slotNewBranchDelayedRefresh()));
// Delay the signal as we don't ourselves to be reset while
// in setData().
if (checkNewBranchName(branchName)) {
m_newBranch = branchName;
QTimer::singleShot(0, this, SLOT(slotNewBranchDelayedRefresh()));
}
return true;
}
void LocalBranchModel::slotNewBranchDelayedRefresh()
{
if (debug)
qDebug() << Q_FUNC_INFO;
QString errorMessage;
if (!refresh(workingDirectory(), &errorMessage)) {
qWarning("%s", qPrintable(errorMessage));
return;
}
emit newBranchCreated(m_newBranch);
emit newBranchEntered(m_newBranch);
}
}