Changeset View
Changeset View
Standalone View
Standalone View
src/core/kcoreconfigskeleton.cpp
Show First 20 Lines • Show All 571 Lines • ▼ Show 20 Line(s) | |||||
572 | void KCoreConfigSkeleton::ItemLongLong::setMaxValue(qint64 v) | 572 | void KCoreConfigSkeleton::ItemLongLong::setMaxValue(qint64 v) | ||
573 | { | 573 | { | ||
574 | mHasMax = true; | 574 | mHasMax = true; | ||
575 | mMax = v; | 575 | mMax = v; | ||
576 | } | 576 | } | ||
577 | 577 | | |||
578 | KCoreConfigSkeleton::ItemEnum::ItemEnum(const QString &_group, const QString &_key, | 578 | KCoreConfigSkeleton::ItemEnum::ItemEnum(const QString &_group, const QString &_key, | ||
579 | qint32 &reference, | 579 | qint32 &reference, | ||
580 | const QList<Choice> &choices, | 580 | const QList<Choice> &choices, | ||
ervin: Will need an update | |||||
You mean I should prepare this and put it in KF6 waiting for merge queue ? meven: You mean I should prepare this and put it in KF6 waiting for merge queue ? | |||||
No I meant the comment needs to be adjusted due to the changes (fields changing place and such) sorry if I was unclear. ervin: No I meant the comment needs to be adjusted due to the changes (fields changing place and such)… | |||||
meven: I updated the comment since your first comment, I think it is ok now. | |||||
581 | qint32 defaultValue) | 581 | qint32 defaultValue) | ||
You mean KConfigSkeletonItemPrivate aren't you? (instead of KCoreConfigSkeletonPrivate) ervin: You mean KConfigSkeletonItemPrivate aren't you? (instead of KCoreConfigSkeletonPrivate) | |||||
582 | : ItemInt(_group, _key, reference, defaultValue), mChoices(choices) | 582 | : ItemInt(_group, _key, reference, defaultValue), mChoices(choices) | ||
583 | { | 583 | { | ||
584 | } | 584 | } | ||
585 | 585 | | |||
586 | void KCoreConfigSkeleton::ItemEnum::readConfig(KConfig *config) | 586 | void KCoreConfigSkeleton::ItemEnum::readConfig(KConfig *config) | ||
ervin: This comment should go away | |||||
587 | { | 587 | { | ||
588 | KConfigGroup cg(config, mGroup); | 588 | KConfigGroup cg(config, mGroup); | ||
589 | if (!cg.hasKey(mKey)) { | 589 | if (!cg.hasKey(mKey)) { | ||
590 | mReference = mDefault; | 590 | mReference = mDefault; | ||
591 | } else { | 591 | } else { | ||
592 | int i = 0; | 592 | int i = 0; | ||
593 | mReference = -1; | 593 | mReference = -1; | ||
594 | QString tmp = cg.readEntry(mKey, QString()).toLower(); | 594 | QString tmp = cg.readEntry(mKey, QString()).toLower(); | ||
595 | for (QList<Choice>::ConstIterator it = mChoices.constBegin(); | 595 | for (QList<Choice>::ConstIterator it = mChoices.constBegin(); | ||
596 | it != mChoices.constEnd(); ++it, ++i) { | 596 | it != mChoices.constEnd(); ++it, ++i) { | ||
597 | if ((*it).name.toLower() == tmp) { | 597 | if ((*it).value().toLower() == tmp) { | ||
598 | mReference = i; | 598 | mReference = i; | ||
599 | break; | 599 | break; | ||
600 | } | 600 | } | ||
601 | } | 601 | } | ||
602 | if (mReference == -1) { | 602 | if (mReference == -1) { | ||
603 | mReference = cg.readEntry(mKey, mDefault); | 603 | mReference = cg.readEntry(mKey, mDefault); | ||
604 | } | 604 | } | ||
605 | } | 605 | } | ||
606 | mLoadedValue = mReference; | 606 | mLoadedValue = mReference; | ||
607 | 607 | | |||
608 | readImmutability(cg); | 608 | readImmutability(cg); | ||
609 | } | 609 | } | ||
610 | 610 | | |||
611 | void KCoreConfigSkeleton::ItemEnum::writeConfig(KConfig *config) | 611 | void KCoreConfigSkeleton::ItemEnum::writeConfig(KConfig *config) | ||
612 | { | 612 | { | ||
613 | if (mReference != mLoadedValue) { // WABA: Is this test needed? | 613 | if (mReference != mLoadedValue) { // WABA: Is this test needed? | ||
614 | KConfigGroup cg(config, mGroup); | 614 | KConfigGroup cg(config, mGroup); | ||
615 | if ((mDefault == mReference) && !cg.hasDefault(mKey)) { | 615 | if ((mDefault == mReference) && !cg.hasDefault(mKey)) { | ||
616 | cg.revertToDefault(mKey, writeFlags()); | 616 | cg.revertToDefault(mKey, writeFlags()); | ||
617 | } else if ((mReference >= 0) && (mReference < mChoices.count())) { | 617 | } else if ((mReference >= 0) && (mReference < mChoices.count())) { | ||
618 | cg.writeEntry(mKey, mChoices[mReference].name, writeFlags()); | 618 | cg.writeEntry(mKey, mChoices[mReference].value(), writeFlags()); | ||
619 | } else { | 619 | } else { | ||
620 | cg.writeEntry(mKey, mReference, writeFlags()); | 620 | cg.writeEntry(mKey, mReference, writeFlags()); | ||
621 | } | 621 | } | ||
622 | mLoadedValue = mReference; | 622 | mLoadedValue = mReference; | ||
623 | } | 623 | } | ||
624 | } | 624 | } | ||
625 | 625 | | |||
626 | QList<KCoreConfigSkeleton::ItemEnum::Choice> KCoreConfigSkeleton::ItemEnum::choices() const | 626 | QList<KCoreConfigSkeleton::ItemEnum::Choice> KCoreConfigSkeleton::ItemEnum::choices() const | ||
▲ Show 20 Lines • Show All 991 Lines • Show Last 20 Lines |
Will need an update