Changeset View
Changeset View
Standalone View
Standalone View
src/core/kconfig.cpp
Show All 18 Lines | 1 | /* | |||
---|---|---|---|---|---|
19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
20 | Boston, MA 02110-1301, USA. | 20 | Boston, MA 02110-1301, USA. | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "kconfig.h" | 23 | #include "kconfig.h" | ||
24 | #include "kconfig_p.h" | 24 | #include "kconfig_p.h" | ||
25 | 25 | | |||
26 | #include "config-kconfig.h" | 26 | #include "config-kconfig.h" | ||
27 | #include "kconfig_core_log_settings.h" | ||||
27 | 28 | | |||
28 | #include <cstdlib> | 29 | #include <cstdlib> | ||
29 | #include <fcntl.h> | 30 | #include <fcntl.h> | ||
30 | 31 | | |||
31 | #include "kconfigbackend_p.h" | 32 | #include "kconfigbackend_p.h" | ||
32 | #include "kconfiggroup.h" | 33 | #include "kconfiggroup.h" | ||
33 | 34 | | |||
34 | #include <qcoreapplication.h> | 35 | #include <qcoreapplication.h> | ||
▲ Show 20 Lines • Show All 368 Lines • ▼ Show 20 Line(s) | 393 | { | |||
403 | if (d->bDirty && d->mBackend) { | 404 | if (d->bDirty && d->mBackend) { | ||
404 | const QByteArray utf8Locale(locale().toUtf8()); | 405 | const QByteArray utf8Locale(locale().toUtf8()); | ||
405 | 406 | | |||
406 | // Create the containing dir, maybe it wasn't there | 407 | // Create the containing dir, maybe it wasn't there | ||
407 | d->mBackend->createEnclosing(); | 408 | d->mBackend->createEnclosing(); | ||
408 | 409 | | |||
409 | // lock the local file | 410 | // lock the local file | ||
410 | if (d->configState == ReadWrite && !d->lockLocal()) { | 411 | if (d->configState == ReadWrite && !d->lockLocal()) { | ||
411 | qWarning() << "couldn't lock local file"; | 412 | qCWarning(KCONFIG_CORE_LOG) << "couldn't lock local file"; | ||
412 | return false; | 413 | return false; | ||
413 | } | 414 | } | ||
414 | 415 | | |||
415 | // Rewrite global/local config only if there is a dirty entry in it. | 416 | // Rewrite global/local config only if there is a dirty entry in it. | ||
416 | bool writeGlobals = false; | 417 | bool writeGlobals = false; | ||
417 | bool writeLocals = false; | 418 | bool writeLocals = false; | ||
418 | 419 | | |||
419 | for (auto it = d->entryMap.constBegin(); it != d->entryMap.constEnd(); ++it) { | 420 | for (auto it = d->entryMap.constBegin(); it != d->entryMap.constEnd(); ++it) { | ||
Show All 13 Lines | |||||
433 | } | 434 | } | ||
434 | } | 435 | } | ||
435 | 436 | | |||
436 | d->bDirty = false; // will revert to true if a config write fails | 437 | d->bDirty = false; // will revert to true if a config write fails | ||
437 | 438 | | |||
438 | if (d->wantGlobals() && writeGlobals) { | 439 | if (d->wantGlobals() && writeGlobals) { | ||
439 | QExplicitlySharedDataPointer<KConfigBackend> tmp = KConfigBackend::create(*sGlobalFileName); | 440 | QExplicitlySharedDataPointer<KConfigBackend> tmp = KConfigBackend::create(*sGlobalFileName); | ||
440 | if (d->configState == ReadWrite && !tmp->lock()) { | 441 | if (d->configState == ReadWrite && !tmp->lock()) { | ||
441 | qWarning() << "couldn't lock global file"; | 442 | qCWarning(KCONFIG_CORE_LOG) << "couldn't lock global file"; | ||
442 | 443 | | |||
443 | //unlock the local config if we're returning early | 444 | //unlock the local config if we're returning early | ||
444 | if (d->mBackend->isLocked()) { | 445 | if (d->mBackend->isLocked()) { | ||
445 | d->mBackend->unlock(); | 446 | d->mBackend->unlock(); | ||
446 | } | 447 | } | ||
447 | 448 | | |||
448 | d->bDirty = true; | 449 | d->bDirty = true; | ||
449 | return false; | 450 | return false; | ||
▲ Show 20 Lines • Show All 571 Lines • Show Last 20 Lines |