Changeset View
Changeset View
Standalone View
Standalone View
src/utils/kateglobal.cpp
Show First 20 Lines • Show All 544 Lines • ▼ Show 20 Line(s) | 543 | { | |||
---|---|---|---|---|---|
545 | if (KTextEditor::EditorPrivate::unitTestMode()) { | 545 | if (KTextEditor::EditorPrivate::unitTestMode()) { | ||
546 | return KSharedConfig::openConfig(QStringLiteral("katepartrc-unittest"), KConfig::SimpleConfig, QStandardPaths::TempLocation); | 546 | return KSharedConfig::openConfig(QStringLiteral("katepartrc-unittest"), KConfig::SimpleConfig, QStandardPaths::TempLocation); | ||
547 | } | 547 | } | ||
548 | 548 | | |||
549 | // else: use application configuration, but try to transfer global settings on first use | 549 | // else: use application configuration, but try to transfer global settings on first use | ||
550 | auto applicationConfig = KSharedConfig::openConfig(); | 550 | auto applicationConfig = KSharedConfig::openConfig(); | ||
551 | if (!KConfigGroup(applicationConfig, QStringLiteral("KTextEditor Editor")).exists()) { | 551 | if (!KConfigGroup(applicationConfig, QStringLiteral("KTextEditor Editor")).exists()) { | ||
552 | auto globalConfig = KSharedConfig::openConfig(QStringLiteral("katepartrc")); | 552 | auto globalConfig = KSharedConfig::openConfig(QStringLiteral("katepartrc")); | ||
553 | for (auto group : {QStringLiteral("Editor"), QStringLiteral("Document"), QStringLiteral("View"), QStringLiteral("Renderer")}) { | 553 | for (const auto &group : {QStringLiteral("Editor"), QStringLiteral("Document"), QStringLiteral("View"), QStringLiteral("Renderer")}) { | ||
554 | KConfigGroup origin(globalConfig, group); | 554 | KConfigGroup origin(globalConfig, group); | ||
555 | KConfigGroup destination(applicationConfig, QStringLiteral("KTextEditor ") + group); | 555 | KConfigGroup destination(applicationConfig, QStringLiteral("KTextEditor ") + group); | ||
556 | origin.copyTo(&destination); | 556 | origin.copyTo(&destination); | ||
557 | } | 557 | } | ||
558 | } | 558 | } | ||
559 | return applicationConfig; | 559 | return applicationConfig; | ||
560 | } | 560 | } |