Changeset View
Changeset View
Standalone View
Standalone View
src/utils/kateautoindent.cpp
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | |||||
353 | { | 353 | { | ||
354 | if (m_script) { | 354 | if (m_script) { | ||
355 | if (!isStyleProvided(m_script, doc->highlight())) { | 355 | if (!isStyleProvided(m_script, doc->highlight())) { | ||
356 | qCDebug(LOG_KTE) << "mode" << m_mode << | 356 | qCDebug(LOG_KTE) << "mode" << m_mode << | ||
357 | "requires a different highlight style: highlighting '" | 357 | "requires a different highlight style: highlighting '" | ||
358 | << doc->highlight()->name() << "', style '" << doc->highlight()->style() << "'" | 358 | << doc->highlight()->name() << "', style '" << doc->highlight()->style() << "'" | ||
359 | ", but script require '" << m_script->indentHeader().requiredStyle() << "'" | 359 | ", but script require '" << m_script->indentHeader().requiredStyle() << "'" | ||
360 | ; | 360 | ; | ||
361 | doc->config()->setIndentationMode(MODE_NORMAL()); | 361 | doc->config()->set("Indentation Mode", MODE_NORMAL()); | ||
362 | } | 362 | } | ||
363 | } | 363 | } | ||
364 | } | 364 | } | ||
365 | 365 | | |||
366 | void KateAutoIndent::updateConfig() | 366 | void KateAutoIndent::updateConfig() | ||
367 | { | 367 | { | ||
368 | KateDocumentConfig *config = doc->config(); | 368 | KateDocumentConfig *config = doc->config(); | ||
369 | 369 | | |||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 474 | for (int z = 0; z < modes.size(); ++z) { | |||
475 | QAction *action = menu()->addAction(QLatin1Char('&') + KateAutoIndent::modeDescription(z).replace(QLatin1Char('&'), QLatin1String("&&"))); | 475 | QAction *action = menu()->addAction(QLatin1Char('&') + KateAutoIndent::modeDescription(z).replace(QLatin1Char('&'), QLatin1String("&&"))); | ||
476 | actionGroup->addAction(action); | 476 | actionGroup->addAction(action); | ||
477 | action->setCheckable(true); | 477 | action->setCheckable(true); | ||
478 | action->setData(z); | 478 | action->setData(z); | ||
479 | 479 | | |||
480 | QString requiredStyle = KateAutoIndent::modeRequiredStyle(z); | 480 | QString requiredStyle = KateAutoIndent::modeRequiredStyle(z); | ||
481 | action->setEnabled(requiredStyle.isEmpty() || requiredStyle == doc->highlight()->style()); | 481 | action->setEnabled(requiredStyle.isEmpty() || requiredStyle == doc->highlight()->style()); | ||
482 | 482 | | |||
483 | if (doc->config()->indentationMode() == KateAutoIndent::modeName(z)) { | 483 | if (doc->config()->stringVal("Indentation Mode") == KateAutoIndent::modeName(z)) { | ||
484 | action->setChecked(true); | 484 | action->setChecked(true); | ||
485 | } | 485 | } | ||
486 | } | 486 | } | ||
487 | 487 | | |||
488 | disconnect(menu(), SIGNAL(triggered(QAction*)), this, SLOT(setMode(QAction*))); | 488 | disconnect(menu(), SIGNAL(triggered(QAction*)), this, SLOT(setMode(QAction*))); | ||
489 | connect(menu(), SIGNAL(triggered(QAction*)), this, SLOT(setMode(QAction*))); | 489 | connect(menu(), SIGNAL(triggered(QAction*)), this, SLOT(setMode(QAction*))); | ||
490 | } | 490 | } | ||
491 | 491 | | |||
492 | void KateViewIndentationAction::setMode(QAction *action) | 492 | void KateViewIndentationAction::setMode(QAction *action) | ||
493 | { | 493 | { | ||
494 | // set new mode | 494 | // set new mode | ||
495 | doc->config()->setIndentationMode(KateAutoIndent::modeName(action->data().toInt())); | 495 | doc->config()->set("Indentation Mode", KateAutoIndent::modeName(action->data().toInt())); | ||
496 | doc->rememberUserDidSetIndentationMode(); | 496 | doc->rememberUserDidSetIndentationMode(); | ||
497 | } | 497 | } | ||
498 | //END KateViewIndentationAction | 498 | //END KateViewIndentationAction | ||
499 | 499 | | |||
Context not available. |