MCPcopy Create free account
hub / github.com/KDE/kdevelop / showEditDialog

Method showEditDialog

plugins/patchreview/patchreviewtoolview.cpp:201–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void PatchReviewToolView::showEditDialog() {
202 m_editPatch.setupUi( this );
203
204 bool allowSelection = m_plugin->patch() && m_plugin->patch()->canSelectFiles();
205 m_fileModel = new PatchFilesModel( this, allowSelection );
206 m_fileSortProxyModel = new VcsFileChangesSortProxyModel(this);
207 m_fileSortProxyModel->setSourceModel(m_fileModel);
208 m_fileSortProxyModel->sort(1);
209 m_fileSortProxyModel->setDynamicSortFilter(true);
210 m_editPatch.filesList->setModel( m_fileSortProxyModel );
211 m_editPatch.filesList->header()->hide();
212 m_editPatch.filesList->setRootIsDecorated( false );
213 m_editPatch.filesList->setContextMenuPolicy(Qt::CustomContextMenu);
214 connect(m_editPatch.filesList, &QTreeView::customContextMenuRequested, this, &PatchReviewToolView::customContextMenuRequested);
215 connect(m_fileModel, &PatchFilesModel::itemChanged, this, &PatchReviewToolView::fileItemChanged);
216 m_editPatch.finishReview->setDefaultAction(m_plugin->finishReviewAction());
217
218#ifdef WITH_PURPOSE
219 m_exportMenu = new Purpose::Menu(this);
220 connect(m_exportMenu, &Purpose::Menu::finished, this, [](const QJsonObject &output, int error, const QString &errorMessage) {
221 Sublime::Message* message;
222 if (error==0) {
223 const QString messageText = i18n("<qt>You can find the new request at:<br /><a href='%1'>%1</a> </qt>", output[QLatin1String("url")].toString());
224 message = new Sublime::Message(messageText, Sublime::Message::Information);
225 } else {
226 const QString messageText = i18n("Couldn't export the patch.\n%1", errorMessage);
227 message = new Sublime::Message(messageText, Sublime::Message::Error);
228 }
229 ICore::self()->uiController()->postMessage(message);
230 });
231 // set the model input parameters to avoid terminal warnings
232 m_exportMenu->model()->setInputData(QJsonObject {
233 { QStringLiteral("urls"), QJsonArray { QString() } },
234 { QStringLiteral("mimeType"), { QStringLiteral("text/x-patch") } }
235 });
236 m_exportMenu->model()->setPluginType(QStringLiteral("Export"));
237 m_editPatch.exportReview->setMenu( m_exportMenu );
238#else
239 m_editPatch.exportReview->setEnabled(false);
240#endif
241
242 connect( m_editPatch.previousHunk, &QToolButton::clicked, this, &PatchReviewToolView::prevHunk );
243 connect( m_editPatch.nextHunk, &QToolButton::clicked, this, &PatchReviewToolView::nextHunk );
244 connect( m_editPatch.previousFile, &QToolButton::clicked, this, &PatchReviewToolView::prevFile );
245 connect( m_editPatch.nextFile, &QToolButton::clicked, this, &PatchReviewToolView::nextFile );
246 connect( m_editPatch.filesList, &QTreeView::activated , this, &PatchReviewToolView::fileDoubleClicked );
247
248 connect( m_editPatch.cancelReview, &QToolButton::clicked, m_plugin, &PatchReviewPlugin::cancelReview );
249 //connect( m_editPatch.cancelButton, SIGNAL(pressed()), this, SLOT(slotEditCancel()) );
250
251 //connect( this, SIGNAL(finished(int)), this, SLOT(slotEditDialogFinished(int)) );
252
253 connect( m_editPatch.updateButton, &QToolButton::clicked, m_plugin, &PatchReviewPlugin::forceUpdate );
254
255 connect( m_editPatch.testsButton, &QToolButton::clicked, this, &PatchReviewToolView::runTests );
256
257 m_selectAllAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-select-all")), i18nc("@action", "Select All"), this );
258 connect( m_selectAllAction, &QAction::triggered, this, &PatchReviewToolView::selectAll );

Callers

nothing calls this directly

Calls 14

setupUiMethod · 0.80
patchMethod · 0.80
setSourceModelMethod · 0.80
headerMethod · 0.80
finishReviewActionMethod · 0.80
uiControllerMethod · 0.80
QStringClass · 0.50
canSelectFilesMethod · 0.45
sortMethod · 0.45
setModelMethod · 0.45
toStringMethod · 0.45
postMessageMethod · 0.45

Tested by

no test coverage detected