| 108 | } |
| 109 | |
| 110 | void BranchManager::createBranch() |
| 111 | { |
| 112 | const QModelIndex currentBranchIdx = m_ui->branchView->currentIndex(); |
| 113 | if (!currentBranchIdx.isValid()) { |
| 114 | KMessageBox::error(this, i18n("You must select a base branch from the list before creating a new branch.")); |
| 115 | return; |
| 116 | } |
| 117 | QString baseBranch = currentBranchIdx.data().toString(); |
| 118 | bool branchNameEntered = false; |
| 119 | QString newBranch = QInputDialog::getText(this, i18nc("@title:window", "New Branch"), i18nc("@label:textbox", "Name of the new branch:"), |
| 120 | QLineEdit::Normal, QString(), &branchNameEntered); |
| 121 | if (!branchNameEntered) |
| 122 | return; |
| 123 | |
| 124 | if (!m_model->findItems(newBranch).isEmpty()) |
| 125 | { |
| 126 | KMessageBox::error(this, i18n("Branch \"%1\" already exists.\n" |
| 127 | "Please, choose another name.", |
| 128 | newBranch)); |
| 129 | } |
| 130 | else |
| 131 | m_model->createBranch(baseBranch, newBranch); |
| 132 | } |
| 133 | |
| 134 | void BranchManager::deleteBranch() |
| 135 | { |