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

Method handleStyleChange

apps/lib/diff/diffwidget.cpp:356–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354}
355
356void DiffWidget::handleStyleChange(int newStyle)
357{
358 if (newStyle == m_style) {
359 return;
360 }
361 m_style = (DiffStyle)newStyle;
362 const QByteArray diff = m_rawDiff;
363 const DiffParams params = m_params;
364 clearData();
365 m_params = params;
366
367 if (m_style == SideBySide) {
368 m_left->setVisible(true);
369 m_left->setOpenLineNumAEnabled(m_params.flags.testFlag(DiffParams::Flag::ShowEditLeftSide));
370 m_left->setOpenLineNumBEnabled(false);
371 m_right->setVisible(true);
372 m_right->setOpenLineNumAEnabled(m_params.flags.testFlag(DiffParams::Flag::ShowEditRightSide));
373 m_right->setOpenLineNumBEnabled(false);
374 openDiff(diff);
375 } else if (m_style == Unified) {
376 m_left->setVisible(true);
377 m_left->setOpenLineNumAEnabled(m_params.flags.testFlag(DiffParams::Flag::ShowEditLeftSide));
378 m_left->setOpenLineNumBEnabled(m_params.flags.testFlag(DiffParams::Flag::ShowEditRightSide));
379 m_right->setVisible(false);
380 openDiff(diff);
381 } else if (m_style == Raw) {
382 m_left->setVisible(true);
383 m_left->setOpenLineNumAEnabled(false);
384 m_left->setOpenLineNumBEnabled(false);
385 m_right->setVisible(false);
386 openDiff(diff);
387 } else {
388 qWarning("Unexpected diff style value: %d", newStyle);
389 Q_UNREACHABLE();
390 }
391
392 if (sender() && (sender() == m_left || sender() == m_right)) {
393 KSharedConfig::Ptr config = KSharedConfig::openConfig();
394 KConfigGroup cgGeneral = KConfigGroup(config, QStringLiteral("General"));
395 cgGeneral.writeEntry("Diff Show Style", (int)m_style);
396 }
397}
398
399void DiffWidget::handleStageUnstage(DiffEditor *e, int startLine, int endLine, int actionType, DiffParams::Flag f)
400{

Callers

nothing calls this directly

Calls 4

setVisibleMethod · 0.80
KConfigGroupClass · 0.50

Tested by

no test coverage detected