Changeset View
Changeset View
Standalone View
Standalone View
src/core/kcoreconfigskeleton.h
Show All 28 Lines | |||||
29 | #include <kconfiggroup.h> | 29 | #include <kconfiggroup.h> | ||
30 | 30 | | |||
31 | #include <QDate> | 31 | #include <QDate> | ||
32 | #include <QHash> | 32 | #include <QHash> | ||
33 | #include <QRect> | 33 | #include <QRect> | ||
34 | #include <QStringList> | 34 | #include <QStringList> | ||
35 | #include <QVariant> | 35 | #include <QVariant> | ||
36 | #include <QUrl> | 36 | #include <QUrl> | ||
37 | | ||||
37 | class KCoreConfigSkeletonPrivate; | 38 | class KCoreConfigSkeletonPrivate; | ||
38 | 39 | | |||
39 | class KConfigSkeletonItemPrivate; | 40 | class KConfigSkeletonItemPrivate; | ||
40 | /** | 41 | /** | ||
41 | * \class KConfigSkeletonItem kcoreconfigskeleton.h <KConfigSkeletonItem> | 42 | * \class KConfigSkeletonItem kcoreconfigskeleton.h <KConfigSkeletonItem> | ||
42 | * | 43 | * | ||
43 | * @short Class for storing a preferences setting | 44 | * @short Class for storing a preferences setting | ||
44 | * @author Cornelius Schumacher | 45 | * @author Cornelius Schumacher | ||
Show All 32 Lines | 57 | public: | |||
77 | void setGroup(const QString &_group); | 78 | void setGroup(const QString &_group); | ||
78 | 79 | | |||
79 | /** | 80 | /** | ||
80 | * Return config file group. | 81 | * Return config file group. | ||
81 | */ | 82 | */ | ||
82 | QString group() const; | 83 | QString group() const; | ||
83 | 84 | | |||
84 | /** | 85 | /** | ||
86 | * Set config file group bu giving the KConfigGroup. | ||||
ervin: s/bu/but/ | |||||
87 | * Allow the item to be in nested groups. | ||||
88 | */ | ||||
89 | void setGroup(const KConfigGroup &cg); | ||||
dfaure: Missing @since 5.68 | |||||
90 | | ||||
91 | /** | ||||
92 | * Return a KConfigGroup, the one provided by setGroup(KConfigGroup) if it's valid, | ||||
93 | * or make one from @param config and item's group | ||||
94 | * @sa setGroup(const QString &_group) | ||||
95 | * @sa setGroup(KConfigGroup cg) | ||||
96 | */ | ||||
dfaure: Missing @since 5.68 | |||||
97 | KConfigGroup configGroup(KConfig* config) const; | ||||
ervin: Space before * not after. | |||||
98 | | ||||
99 | /** | ||||
85 | * Set config file key. | 100 | * Set config file key. | ||
86 | */ | 101 | */ | ||
87 | void setKey(const QString &_key); | 102 | void setKey(const QString &_key); | ||
88 | 103 | | |||
89 | /** | 104 | /** | ||
90 | * Return config file key. | 105 | * Return config file key. | ||
91 | */ | 106 | */ | ||
92 | QString key() const; | 107 | QString key() const; | ||
▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Line(s) | 320 | public: | |||
355 | { | 370 | { | ||
356 | mReference = mDefault; | 371 | mReference = mDefault; | ||
357 | } | 372 | } | ||
358 | 373 | | |||
359 | /** @copydoc KConfigSkeletonItem::writeConfig(KConfig *) */ | 374 | /** @copydoc KConfigSkeletonItem::writeConfig(KConfig *) */ | ||
360 | void writeConfig(KConfig *config) override | 375 | void writeConfig(KConfig *config) override | ||
361 | { | 376 | { | ||
362 | if (mReference != mLoadedValue) { // Is this needed? | 377 | if (mReference != mLoadedValue) { // Is this needed? | ||
363 | KConfigGroup cg(config, mGroup); | 378 | KConfigGroup cg = configGroup(config); | ||
364 | if ((mDefault == mReference) && !cg.hasDefault(mKey)) { | 379 | if ((mDefault == mReference) && !cg.hasDefault(mKey)) { | ||
365 | cg.revertToDefault(mKey, writeFlags()); | 380 | cg.revertToDefault(mKey, writeFlags()); | ||
366 | } else { | 381 | } else { | ||
367 | cg.writeEntry(mKey, mReference, writeFlags()); | 382 | cg.writeEntry(mKey, mReference, writeFlags()); | ||
368 | } | 383 | } | ||
369 | mLoadedValue = mReference; | 384 | mLoadedValue = mReference; | ||
370 | } | 385 | } | ||
371 | } | 386 | } | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 426 | public: | |||
425 | void readConfig(KConfig *) override; | 440 | void readConfig(KConfig *) override; | ||
426 | void writeConfig(KConfig *) override; | 441 | void writeConfig(KConfig *) override; | ||
427 | void readDefault(KConfig *) override; | 442 | void readDefault(KConfig *) override; | ||
428 | void setProperty(const QVariant &p) override; | 443 | void setProperty(const QVariant &p) override; | ||
429 | bool isEqual(const QVariant &p) const override; | 444 | bool isEqual(const QVariant &p) const override; | ||
430 | QVariant property() const override; | 445 | QVariant property() const override; | ||
431 | void setDefault() override; | 446 | void setDefault() override; | ||
432 | void swapDefault() override; | 447 | void swapDefault() override; | ||
433 | // shadow the method in KConfigSkeletonItem, which should be fine for autogenerated code | 448 | // shadow the method in KConfigSkeletonItem, which should be fine for autogenerated code | ||
So this KF6 TODO is to make those methods virtual? It's a bit unclear to me... I'm asking because: if the solution is something else then maybe it can be done already for those new methods. dfaure: So this KF6 TODO is to make those methods virtual? It's a bit unclear to me...
I'm asking… | |||||
That's my understanding to have them virtuals in KF6 indeed, that was introduced by David Edmundson a little while ago. This is necessary because of the way KConfigSkeletonItem is done and because KConfigCompilerSignallingItem is basically a decorator. ervin: That's my understanding to have them virtuals in KF6 indeed, that was introduced by David… | |||||
Added David's comment from D25791 to make things clearer on what to do. crossi: Added David's comment from D25791 to make things clearer on what to do. | |||||
434 | // KF6 TODO - fix this | 449 | // KF6 TODO - fix this | ||
435 | void setWriteFlags(KConfigBase::WriteConfigFlags flags); | 450 | void setWriteFlags(KConfigBase::WriteConfigFlags flags); | ||
436 | KConfigBase::WriteConfigFlags writeFlags() const; | 451 | KConfigBase::WriteConfigFlags writeFlags() const; | ||
452 | void setGroup(const KConfigGroup &cg); | ||||
dfaure: the end of the sentence is missing. ("should be fine") | |||||
453 | KConfigGroup configGroup(KConfig* config) const; | ||||
ervin: Space before * not after | |||||
454 | // END TODO | ||||
455 | | ||||
437 | private: | 456 | private: | ||
438 | inline void invokeNotifyFunction() | 457 | inline void invokeNotifyFunction() | ||
439 | { | 458 | { | ||
440 | // call the pointer to member function using the strange ->* operator | 459 | // call the pointer to member function using the strange ->* operator | ||
441 | (mObject->*mTargetFunction)(mUserData); | 460 | (mObject->*mTargetFunction)(mUserData); | ||
442 | } | 461 | } | ||
443 | private: | 462 | private: | ||
444 | QScopedPointer<KConfigSkeletonItem> mItem; | 463 | QScopedPointer<KConfigSkeletonItem> mItem; | ||
▲ Show 20 Lines • Show All 1164 Lines • Show Last 20 Lines |
s/bu/but/