MCPcopy Create free account
hub / github.com/KDE/kate / openDiff

Method openDiff

apps/lib/diff/diffwidget.cpp:68–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void DiffWidgetManager::openDiff(const QByteArray &diff, DiffParams p, class KTextEditor::MainWindow *mw)
69{
70 DiffWidget *existing = existingDiffWidgetForParams(mw, p);
71 if (!existing) {
72 existing = new DiffWidget(p);
73 mw->connect(existing, &DiffWidget::openFileRequested, mw, [mw](QString path, int line, int columnNumber) {
74 auto view = mw->openUrl(QUrl(path));
75 view->setCursorPosition(KTextEditor::Cursor(line - 1, columnNumber));
76 });
77 if (!p.tabTitle.isEmpty()) {
78 existing->setWindowTitle(p.tabTitle);
79 } else {
80 if (p.destFile.isEmpty())
81 existing->setWindowTitle(i18n("Diff %1", Utils::fileNameFromPath(p.srcFile)));
82 else
83 existing->setWindowTitle(i18n("Diff %1..%2", Utils::fileNameFromPath(p.srcFile), Utils::fileNameFromPath(p.destFile)));
84 }
85 existing->setWindowIcon(QIcon::fromTheme(QStringLiteral("text-x-patch")));
86 existing->openDiff(diff);
87 mw->addWidget(existing);
88 } else {
89 existing->clearData();
90 existing->m_params = p;
91 existing->openDiff(diff);
92 mw->activateWidget(existing);
93 }
94}
95
96void DiffWidgetManager::diffDocs(KTextEditor::Document *l, KTextEditor::Document *r, class KTextEditor::MainWindow *mw)
97{

Callers 1

Calls 15

commitInfoFromDiffFunction · 0.85
connectMethod · 0.80
setCursorPositionMethod · 0.80
hideMethod · 0.80
documentMethod · 0.80
QUrlClass · 0.70
CursorClass · 0.50
fileNameFromPathFunction · 0.50
openUrlMethod · 0.45
isEmptyMethod · 0.45

Tested by 1