| 295 | } |
| 296 | |
| 297 | void CommitToolView::popupContextMenu(const QPoint& pos) |
| 298 | { |
| 299 | QList<QUrl> urls; |
| 300 | const QModelIndexList selectionIdxs = m_view->selectionModel()->selectedIndexes(); |
| 301 | |
| 302 | // If there are no selected files just show an action to refresh the model |
| 303 | if (selectionIdxs.isEmpty()) { |
| 304 | QModelIndex idx = m_view->indexAt(pos); |
| 305 | IProject* project |
| 306 | = ICore::self()->projectController()->findProjectByName(idx.data(RepoStatusModel::NameRole).toString()); |
| 307 | |
| 308 | // Show the context menu & evaluate the results |
| 309 | QAction* res = m_refreshMenu->exec(m_view->viewport()->mapToGlobal(pos)); |
| 310 | if (res == m_refreshModelAct) { |
| 311 | if (project) |
| 312 | m_statusmodel->reload({ project }); |
| 313 | else |
| 314 | m_statusmodel->reloadAll(); |
| 315 | } |
| 316 | return; |
| 317 | } |
| 318 | |
| 319 | // Convert the selection into a list of urls; |
| 320 | for (const QModelIndex& idx : selectionIdxs) { |
| 321 | if (idx.column() == 0) { |
| 322 | if (idx.parent().isValid()) |
| 323 | urls += idx.data(RepoStatusModel::UrlRole).value<QUrl>(); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | // Show the context menu & evaluate the results |
| 328 | QAction* res = m_toolviewMenu->exec(m_view->viewport()->mapToGlobal(pos)); |
| 329 | if (res == m_refreshModelAct) { |
| 330 | if (!urls.isEmpty()) |
| 331 | m_statusmodel->reload(urls); |
| 332 | else |
| 333 | m_statusmodel->reloadAll(); |
| 334 | } else if (res == m_stageFilesAct) { |
| 335 | if (!urls.isEmpty()) |
| 336 | stageSelectedFiles(urls); |
| 337 | } else if (res == m_unstageFilesAct) { |
| 338 | if (!urls.isEmpty()) |
| 339 | unstageSelectedFiles(urls); |
| 340 | } else if (res == m_revertFilesAct) { |
| 341 | if (!urls.isEmpty()) |
| 342 | revertSelectedFiles(urls); |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | void CommitToolView::dblClicked ( const QModelIndex& idx ) |
| 347 | { |
nothing calls this directly
no test coverage detected