| 29 | using namespace KDevelop; |
| 30 | |
| 31 | VcsChangesView::VcsChangesView(VcsProjectIntegrationPlugin* plugin, QWidget* parent) |
| 32 | : QTreeView(parent) |
| 33 | , m_model{ICore::self()->projectController()->makeChangesModel()} |
| 34 | { |
| 35 | setRootIsDecorated(false); |
| 36 | setEditTriggers(QAbstractItemView::NoEditTriggers); |
| 37 | setSelectionMode(ExtendedSelection); |
| 38 | setContextMenuPolicy(Qt::CustomContextMenu); |
| 39 | setUniformRowHeights(true); |
| 40 | setTextElideMode(Qt::ElideLeft); |
| 41 | setWindowIcon(QIcon::fromTheme(QStringLiteral("exchange-positions"), windowIcon())); |
| 42 | |
| 43 | connect(this, &VcsChangesView::customContextMenuRequested, this, &VcsChangesView::popupContextMenu); |
| 44 | |
| 45 | const auto pluginActions = plugin->actionCollection()->actions(); |
| 46 | for (QAction* action : pluginActions) { |
| 47 | addAction(action); |
| 48 | } |
| 49 | |
| 50 | QAction* action = plugin->actionCollection()->action(QStringLiteral("locate_document")); |
| 51 | connect(action, &QAction::triggered, this, &VcsChangesView::selectCurrentDocument); |
| 52 | connect(this, &VcsChangesView::doubleClicked, this, &VcsChangesView::openSelected); |
| 53 | |
| 54 | connect(m_model.get(), &QAbstractItemModel::rowsInserted, this, &VcsChangesView::expand); |
| 55 | setModel(m_model.get()); |
| 56 | } |
| 57 | |
| 58 | static void appendActions(QMenu* menu, const QList<QAction*>& actions) |
| 59 | { |
nothing calls this directly
no test coverage detected