This file is indexed.

/usr/include/KF5/KConfigCore/kcoreconfigskeleton.h is in libkf5config-dev 5.44.0-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
/*
 * This file is part of KDE.
 *
 * Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
 * Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef KCORECONFIGSKELETON_H
#define KCORECONFIGSKELETON_H

#include <kconfigcore_export.h>

#include <ksharedconfig.h>
#include <kconfiggroup.h>

#include <QtCore/QDate>
#include <QtCore/QHash>
#include <QtCore/QRect>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtCore/QUrl>
class KCoreConfigSkeletonPrivate;

class KConfigSkeletonItemPrivate;
/**
 * \class KConfigSkeletonItem kcoreconfigskeleton.h <KConfigSkeletonItem>
 *
 * @short Class for storing a preferences setting
 * @author Cornelius Schumacher
 * @see KCoreConfigSkeleton
 *
 * This class represents one preferences setting as used by @ref KCoreConfigSkeleton.
 * Subclasses of KConfigSkeletonItem implement storage functions for a certain type of
 * setting. Normally you don't have to use this class directly. Use the special
 * addItem() functions of KCoreConfigSkeleton instead. If you subclass this class you will
 * have to register instances with the function KCoreConfigSkeleton::addItem().
 */
class KCONFIGCORE_EXPORT KConfigSkeletonItem
{
public:
    typedef QList < KConfigSkeletonItem * >List;
    typedef QHash < QString, KConfigSkeletonItem * > Dict;
    typedef QHash < QString, KConfigSkeletonItem * >::Iterator DictIterator;

    /**
     * Constructor.
     *
     * @param _group Config file group.
     * @param _key Config file key.
     */
    KConfigSkeletonItem(const QString &_group, const QString &_key);

    /**
     * Destructor.
     */
    virtual ~KConfigSkeletonItem();

    /**
     * Set config file group.
     */
    void setGroup(const QString &_group);

    /**
     * Return config file group.
     */
    QString group() const;

    /**
     * Set config file key.
     */
    void setKey(const QString &_key);

    /**
     * Return config file key.
     */
    QString key() const;

    /**
     * Set internal name of entry.
     */
    void setName(const QString &_name);

    /**
     * Return internal name of entry.
     */
    QString name() const;

    /**
      Set label providing a translated one-line description of the item.
    */
    void setLabel(const QString &l);

    /**
      Return label of item. See setLabel().
    */
    QString label() const;

    /**
      Set ToolTip description of item.
      @since 4.2
    */
    void setToolTip(const QString &t);

    /**
      Return ToolTip description of item. See setToolTip().
      @since 4.2
    */
    QString toolTip() const;

    /**
      Set WhatsThis description of item.
    */
    void setWhatsThis(const QString &w);

    /**
      Return WhatsThis description of item. See setWhatsThis().
    */
    QString whatsThis() const;

    /**
     * This function is called by @ref KCoreConfigSkeleton to read the value for this setting
     * from a config file.
     */
    virtual void readConfig(KConfig *) = 0;

    /**
     * This function is called by @ref KCoreConfigSkeleton to write the value of this setting
     * to a config file.
     */
    virtual void writeConfig(KConfig *) = 0;

    /**
     * Read global default value.
     */
    virtual void readDefault(KConfig *) = 0;

    /**
     * Set item to @p p
     */
    virtual void setProperty(const QVariant &p) = 0;

    /**
     * Check whether the item is equal to p.
     *
     * Use this function to compare items that use custom types,
     * because QVariant::operator== will not work for those.
     *
     * @param p QVariant to compare to
     * @return true if the item is equal to p, false otherwise
     */
    virtual bool isEqual(const QVariant &p) const = 0;

    /**
     * Return item as property
     */
    virtual QVariant property() const = 0;

    /**
     * Return minimum value of item or invalid if not specified
     */
    virtual QVariant minValue() const;

    /**
     * Return maximum value of item or invalid if not specified
     */
    virtual QVariant maxValue() const;

    /**
     * Sets the current value to the default value.
     */
    virtual void setDefault() = 0;

    /**
     * Exchanges the current value with the default value
     * Used by KCoreConfigSkeleton::useDefaults(bool);
     */
    virtual void swapDefault() = 0;

    /**
     * Return if the entry can be modified.
     */
    bool isImmutable() const;

protected:
    /**
     * sets mIsImmutable to true if mKey in config is immutable
     * @param group KConfigGroup to check if mKey is immutable in
     */
    void readImmutability(const KConfigGroup &group);

    QString mGroup; ///< The group name for this item
    QString mKey; ///< The config key for this item
    QString mName; ///< The name of this item

private:
    KConfigSkeletonItemPrivate *const d;
};

/**
 * \class KConfigSkeletonGenericItem kcoreconfigskeleton.h <KConfigSkeletonGenericItem>
 */
template < typename T > class KConfigSkeletonGenericItem: public KConfigSkeletonItem
{
public:
    /** @copydoc KConfigSkeletonItem(const QString&, const QString&)
         @param reference The initial value to hold in the item
         @param defaultValue The default value for the item
     */
    KConfigSkeletonGenericItem(const QString &_group, const QString &_key, T &reference,
                               T defaultValue)
        : KConfigSkeletonItem(_group, _key), mReference(reference),
          mDefault(defaultValue), mLoadedValue(defaultValue)
    {
    }

    /**
     * Set value of this KConfigSkeletonItem.
     */
    void setValue(const T &v)
    {
        mReference = v;
    }

    /**
     * Return value of this KConfigSkeletonItem.
     */
    T &value()
    {
        return mReference;
    }

    /**
     * Return const value of this KConfigSkeletonItem.
     */
    const T &value() const
    {
        return mReference;
    }

    /**
      Set default value for this item.
    */
    virtual void setDefaultValue(const T &v)
    {
        mDefault = v;
    }

    /**
      Set the value for this item to the default value
     */
    void setDefault() Q_DECL_OVERRIDE
    {
        mReference = mDefault;
    }

    /** @copydoc KConfigSkeletonItem::writeConfig(KConfig *) */
    void writeConfig(KConfig *config) Q_DECL_OVERRIDE
    {
        if (mReference != mLoadedValue) { // Is this needed?
            KConfigGroup cg(config, mGroup);
            if ((mDefault == mReference) && !cg.hasDefault(mKey)) {
                cg.revertToDefault(mKey);
            } else {
                cg.writeEntry(mKey, mReference);
            }
            mLoadedValue = mReference;
        }
    }

    /** @copydoc KConfigSkeletonItem::readDefault(KConfig*) */
    void readDefault(KConfig *config) Q_DECL_OVERRIDE
    {
        config->setReadDefaults(true);
        readConfig(config);
        config->setReadDefaults(false);
        mDefault = mReference;
    }

    /** @copydoc KConfigSkeletonItem::swapDefault() */
    void swapDefault() Q_DECL_OVERRIDE
    {
        T tmp = mReference;
        mReference = mDefault;
        mDefault = tmp;
    }

protected:
    T &mReference;  ///< Stores the value for this item
    T mDefault; ///< The default value for this item
    T mLoadedValue;
};

/**
 * \class KConfigSkeletonChangeNotifyingItem kcoreconfigskeleton.h <KConfigSkeletonChangeNotifyingItem>
 *
 * @author Alex Richardson
 * @see KConfigSkeletonItem
 *
 *
 * This class wraps a @ref KConfigSkeletonItem and invokes a function whenever the value changes.
 * That function must take one quint64 parameter. Whenever the property value of the wrapped KConfigSkeletonItem
 * changes this function will be invoked with the stored user data passed in the constructor.
 * It does not call a function with the new value since this class is designed solely for the kconfig_compiler generated
 * code and is therefore probably not suited for any other usecases.
 */
class KCONFIGCORE_EXPORT KConfigCompilerSignallingItem : public KConfigSkeletonItem
{
public:
    typedef void (QObject::* NotifyFunction)(quint64 arg);
    /**
    * Constructor.
    *
    * @param item the KConfigSkeletonItem to wrap
    * @param targetFunction the method to invoke whenever the value of @p item changes
    * @param object The object on which the method is invoked.
    * @param userData This data will be passed to @p targetFunction on every property change
    */
    KConfigCompilerSignallingItem(KConfigSkeletonItem *item, QObject* object,
            NotifyFunction targetFunction, quint64 userData);
    virtual ~KConfigCompilerSignallingItem();

    void readConfig(KConfig *) Q_DECL_OVERRIDE;
    void writeConfig(KConfig *) Q_DECL_OVERRIDE;
    void readDefault(KConfig *) Q_DECL_OVERRIDE;
    void setProperty(const QVariant &p) Q_DECL_OVERRIDE;
    bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;
    QVariant property() const Q_DECL_OVERRIDE;
    void setDefault() Q_DECL_OVERRIDE;
    void swapDefault() Q_DECL_OVERRIDE;
private:
    inline void invokeNotifyFunction()
    {
        // call the pointer to member function using the strange ->* operator
        (mObject->*mTargetFunction)(mUserData);
    }
private:
    QScopedPointer<KConfigSkeletonItem> mItem;
    NotifyFunction mTargetFunction;
    QObject* mObject;
    quint64 mUserData;
};


/**
 * \class KCoreConfigSkeleton kcoreconfigskeleton.h <KCoreConfigSkeleton>
 *
 * @short Class for handling preferences settings for an application.
 * @author Cornelius Schumacher
 * @see KConfigSkeletonItem
 *
 * This class provides an interface to preferences settings. Preferences items
 * can be registered by the addItem() function corresponding to the data type of
 * the setting. KCoreConfigSkeleton then handles reading and writing of config files and
 * setting of default values.
 *
 * Normally you will subclass KCoreConfigSkeleton, add data members for the preferences
 * settings and register the members in the constructor of the subclass.
 *
 * Example:
 * \code
 * class MyPrefs : public KCoreConfigSkeleton
 * {
 *   public:
 *     MyPrefs()
 *     {
 *       setCurrentGroup("MyGroup");
 *       addItemBool("MySetting1", mMyBool, false);
 *       addItemPoint("MySetting2", mMyPoint, QPoint(100, 200));
 *
 *       setCurrentGroup("MyOtherGroup");
 *       addItemDouble("MySetting3", mMyDouble, 3.14);
 *     }
 *
 *     bool mMyBool;
 *     QPoint mMyPoint;
 *     double mMyDouble;
 * }
 * \endcode
 *
 * It might be convenient in many cases to make this subclass of KCoreConfigSkeleton a
 * singleton for global access from all over the application without passing
 * references to the KCoreConfigSkeleton object around.
 *
 * You can write the data to the configuration file by calling @ref save()
 * and read the data from the configuration file by calling @ref readConfig().
 * If you want to watch for config changes, use @ref configChanged() signal.
 *
 * If you have items, which are not covered by the existing addItem() functions
 * you can add customized code for reading, writing and default setting by
 * implementing the functions @ref usrUseDefaults(), @ref usrRead() and
 * @ref usrSave().
 *
 * Internally preferences settings are stored in instances of subclasses of
 * @ref KConfigSkeletonItem. You can also add KConfigSkeletonItem subclasses
 * for your own types and call the generic @ref addItem() to register them.
 *
 * In many cases you don't have to write the specific KCoreConfigSkeleton
 * subclasses yourself, but you can use \ref kconfig_compiler to automatically
 * generate the C++ code from an XML description of the configuration options.
 *
 * Use KConfigSkeleton if you need GUI types as well.
 */
class KCONFIGCORE_EXPORT KCoreConfigSkeleton : public QObject
{
    Q_OBJECT
public:
    /**
     * Class for handling a string preferences item.
     */
    class KCONFIGCORE_EXPORT ItemString: public KConfigSkeletonGenericItem < QString >
    {
    public:
        enum Type { Normal, Password, Path };

        /** @enum Type
            The type of string that is held in this item

            @var ItemString::Type ItemString::Normal
            A normal string

            @var ItemString::Type ItemString::Password
            A password string

            @var ItemString::Type ItemString::Path
            A path to a file or directory
         */

        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem
            @param type The type of string held by the item
         */
        ItemString(const QString &_group, const QString &_key,
                   QString &reference,
                   const QString &defaultValue = QLatin1String(""),  // NOT QString() !!
                   Type type = Normal);

        /** @copydoc KConfigSkeletonItem::writeConfig(KConfig*) */
        void writeConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() const */
        QVariant property() const Q_DECL_OVERRIDE;

    private:
        Type mType;
    };

    /**
     * Class for handling a password preferences item.
     */
    class KCONFIGCORE_EXPORT ItemPassword: public ItemString
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemPassword(const QString &_group, const QString &_key,
                     QString &reference,
                     const QString &defaultValue = QLatin1String(""));  // NOT QString() !!
    };

    /**
     * Class for handling a path preferences item.
     */
    class KCONFIGCORE_EXPORT ItemPath: public ItemString
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemPath(const QString &_group, const QString &_key,
                 QString &reference,
                 const QString &defaultValue = QString());
    };

    /**
     * Class for handling a url preferences item.
     */
    class KCONFIGCORE_EXPORT ItemUrl: public KConfigSkeletonGenericItem < QUrl >
    {
    public:

        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem
         */
        ItemUrl(const QString &_group, const QString &_key,
                QUrl &reference,
                const QUrl &defaultValue = QUrl());

        /** @copydoc KConfigSkeletonItem::writeConfig(KConfig*) */
        void writeConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() const */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a QVariant preferences item.
     */
    class KCONFIGCORE_EXPORT ItemProperty: public KConfigSkeletonGenericItem < QVariant >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemProperty(const QString &_group, const QString &_key,
                     QVariant &reference, const QVariant &defaultValue = QVariant());

        void readConfig(KConfig *config) Q_DECL_OVERRIDE;
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() const */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a bool preferences item.
     */
    class KCONFIGCORE_EXPORT ItemBool: public KConfigSkeletonGenericItem < bool >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemBool(const QString &_group, const QString &_key, bool &reference,
                 bool defaultValue = true);

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() const */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a 32-bit integer preferences item.
     */
    class KCONFIGCORE_EXPORT ItemInt: public KConfigSkeletonGenericItem < qint32 >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemInt(const QString &_group, const QString &_key, qint32 &reference,
                qint32 defaultValue = 0);

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;

        /** Get the minimum value that is allowed to be stored in this item */
        QVariant minValue() const Q_DECL_OVERRIDE;

        /** Get the maximum value this is allowed to be stored in this item */
        QVariant maxValue() const Q_DECL_OVERRIDE;

        /** Set the minimum value for the item
            @sa minValue()
         */
        void setMinValue(qint32);

        /** Set the maximum value for the item
            @sa maxValue
         */
        void setMaxValue(qint32);

    private:
        bool mHasMin : 1;
        bool mHasMax : 1;
        qint32 mMin;
        qint32 mMax;
    };

    /**
     * Class for handling a 64-bit integer preferences item.
     */
    class KCONFIGCORE_EXPORT ItemLongLong: public KConfigSkeletonGenericItem < qint64 >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemLongLong(const QString &_group, const QString &_key, qint64 &reference,
                     qint64 defaultValue = 0);

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::minValue() */
        QVariant minValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::maxValue() */
        QVariant maxValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::setMinValue(qint32) */
        void setMinValue(qint64);

        /** @copydoc ItemInt::setMaxValue(qint32) */
        void setMaxValue(qint64);

    private:
        bool mHasMin : 1;
        bool mHasMax : 1;
        qint64 mMin;
        qint64 mMax;
    };
#ifndef KDE_NO_DEPRECATED
    typedef KCONFIGCORE_DEPRECATED ItemLongLong ItemInt64;
#endif

    /**
     * Class for handling enums.
     */
    class KCONFIGCORE_EXPORT ItemEnum: public ItemInt
    {
    public:
        struct Choice {
            QString name;
            QString label;
            QString toolTip;
            QString whatsThis;
        };

        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem
            @param choices The list of enums that can be stored in this item
          */
        ItemEnum(const QString &_group, const QString &_key, qint32 &reference,
                 const QList<Choice> &choices, qint32 defaultValue = 0);

        QList<Choice> choices() const;

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::writeConfig(KConfig*) */
        void writeConfig(KConfig *config) Q_DECL_OVERRIDE;

        // Source compatibility with 4.x
        typedef Choice Choice2;
        QList<Choice> choices2() const;

    private:
        QList<Choice> mChoices;
    };

    /**
     * Class for handling an unsigned 32-bit integer preferences item.
     */
    class KCONFIGCORE_EXPORT ItemUInt: public KConfigSkeletonGenericItem < quint32 >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemUInt(const QString &_group, const QString &_key,
                 quint32 &reference, quint32 defaultValue = 0);

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::minValue() */
        QVariant minValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::maxValue() */
        QVariant maxValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::setMinValue(qint32) */
        void setMinValue(quint32);

        /** @copydoc ItemInt::setMaxValue(qint32) */
        void setMaxValue(quint32);

    private:
        bool mHasMin : 1;
        bool mHasMax : 1;
        quint32 mMin;
        quint32 mMax;
    };

    /**
     * Class for handling unsigned 64-bit integer preferences item.
     */
    class KCONFIGCORE_EXPORT ItemULongLong: public KConfigSkeletonGenericItem < quint64 >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemULongLong(const QString &_group, const QString &_key, quint64 &reference,
                      quint64 defaultValue = 0);

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::minValue() */
        QVariant minValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::maxValue() */
        QVariant maxValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::setMinValue(qint32) */
        void setMinValue(quint64);

        /** @copydoc ItemInt::setMaxValue(qint32) */
        void setMaxValue(quint64);

    private:
        bool mHasMin : 1;
        bool mHasMax : 1;
        quint64 mMin;
        quint64 mMax;
    };
#ifndef KDE_NO_DEPRECATED
    typedef KCONFIGCORE_DEPRECATED ItemULongLong ItemUInt64;
#endif

    /**
     * Class for handling a floating point preference item.
     */
    class KCONFIGCORE_EXPORT ItemDouble: public KConfigSkeletonGenericItem < double >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemDouble(const QString &_group, const QString &_key,
                   double &reference, double defaultValue = 0);

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::minValue() */
        QVariant minValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::maxValue() */
        QVariant maxValue() const Q_DECL_OVERRIDE;

        /** @copydoc ItemInt::setMinValue() */
        void setMinValue(double);

        /** @copydoc ItemInt::setMaxValue() */
        void setMaxValue(double);

    private:
        bool mHasMin : 1;
        bool mHasMax : 1;
        double mMin;
        double mMax;
    };

    /**
     * Class for handling a QRect preferences item.
     */
    class KCONFIGCORE_EXPORT ItemRect: public KConfigSkeletonGenericItem < QRect >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemRect(const QString &_group, const QString &_key, QRect &reference,
                 const QRect &defaultValue = QRect());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a QPoint preferences item.
     */
    class KCONFIGCORE_EXPORT ItemPoint: public KConfigSkeletonGenericItem < QPoint >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemPoint(const QString &_group, const QString &_key, QPoint &reference,
                  const QPoint &defaultValue = QPoint());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a QSize preferences item.
     */
    class KCONFIGCORE_EXPORT ItemSize: public KConfigSkeletonGenericItem < QSize >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemSize(const QString &_group, const QString &_key, QSize &reference,
                 const QSize &defaultValue = QSize());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a QDateTime preferences item.
     */
    class KCONFIGCORE_EXPORT ItemDateTime: public KConfigSkeletonGenericItem < QDateTime >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemDateTime(const QString &_group, const QString &_key,
                     QDateTime &reference,
                     const QDateTime &defaultValue = QDateTime());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a string list preferences item.
     */
    class KCONFIGCORE_EXPORT ItemStringList: public KConfigSkeletonGenericItem < QStringList >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemStringList(const QString &_group, const QString &_key,
                       QStringList &reference,
                       const QStringList &defaultValue = QStringList());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a path list preferences item.
     */
    class KCONFIGCORE_EXPORT ItemPathList: public ItemStringList
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemPathList(const QString &_group, const QString &_key,
                     QStringList &reference,
                     const QStringList &defaultValue = QStringList());

        /** @copydoc KConfigSkeletonItem::readConfig */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;
        /** @copydoc KConfigSkeletonItem::writeConfig */
        void writeConfig(KConfig *config) Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling a url list preferences item.
     */
    class KCONFIGCORE_EXPORT ItemUrlList: public KConfigSkeletonGenericItem < QList<QUrl> >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemUrlList(const QString &_group, const QString &_key,
                    QList<QUrl> &reference,
                    const QList<QUrl> &defaultValue = QList<QUrl>());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::writeConfig(KConfig*) */
        void writeConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

    /**
     * Class for handling an integer list preferences item.
     */
    class KCONFIGCORE_EXPORT ItemIntList: public KConfigSkeletonGenericItem < QList < int > >
    {
    public:
        /** @copydoc KConfigSkeletonGenericItem::KConfigSkeletonGenericItem */
        ItemIntList(const QString &_group, const QString &_key,
                    QList < int > &reference,
                    const QList < int > &defaultValue = QList < int >());

        /** @copydoc KConfigSkeletonItem::readConfig(KConfig*) */
        void readConfig(KConfig *config) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::setProperty(const QVariant&) */
        void setProperty(const QVariant &p) Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::isEqual(const QVariant &) const */
        bool isEqual(const QVariant &p) const Q_DECL_OVERRIDE;

        /** @copydoc KConfigSkeletonItem::property() */
        QVariant property() const Q_DECL_OVERRIDE;
    };

public:
    /**
     * Constructor.
     *
     * @param configname name of config file. If no name is given, the default
     *                   config file as returned by KSharedConfig::openConfig() is used
     * @param parent the parent object (see QObject documentation)
     */
    explicit KCoreConfigSkeleton(const QString &configname = QString(), QObject *parent = nullptr);

    /**
     * Constructor.
     *
     * @param config configuration object to use
     * @param parent the parent object (see QObject documentation)
     */
    explicit KCoreConfigSkeleton(KSharedConfig::Ptr config, QObject *parent = nullptr);

    /**
     * Destructor
     */
    virtual ~KCoreConfigSkeleton();

    /**
     * Set all registered items to their default values.
     * This method calls usrSetDefaults() after setting the defaults for the
     * registered items. You can override usrSetDefaults() in derived classes
     * if you have special requirements.
     * If you need more fine-grained control of setting the default values of
     * the registered items you can override setDefaults() in a derived class.
     */
    virtual void setDefaults();

    /**
     * Read preferences from config file. All registered items are set to the
     * values read from disk.
     * This method calls usrRead() after reading the settings of the
     * registered items from the KConfig. You can override usrRead()
     * in derived classes if you have special requirements.
     */
    void load();

#ifndef KCONFIGCORE_NO_DEPRECATED
    /**
     * @deprecated since 5.0, call load() instead (to reload from disk) or just read()
     * if the underlying KConfig object is already up-to-date.
     */
    KCONFIGCORE_DEPRECATED void readConfig()
    {
        load();
    }
#endif

    /**
     * Read preferences from the KConfig object.
     * This method assumes that the KConfig object was previously loaded,
     * i.e. it uses the in-memory values from KConfig without reloading from disk.
     *
     * This method calls usrRead() after reading the settings of the
     * registered items from the KConfig. You can override usrRead()
     * in derived classes if you have special requirements.
     * @since 5.0
     */
    void read();

    /**
     * Set the config file group for subsequent addItem() calls. It is valid
     * until setCurrentGroup() is called with a new argument. Call this before
     * you add any items. The default value is "No Group".
     */
    void setCurrentGroup(const QString &group);

    /**
     * Returns the current group used for addItem() calls.
     */
    QString currentGroup() const;

    /**
     * Register a custom @ref KConfigSkeletonItem with a given name.
     *
     * If the name parameter is null, take the name from KConfigSkeletonItem::key().
     * Note that all names must be unique but that multiple entries can have
     * the same key if they reside in different groups.
     *
     * KCoreConfigSkeleton takes ownership of the KConfigSkeletonItem.
     */
    void addItem(KConfigSkeletonItem *, const QString &name = QString());

    /**
     * Register an item of type QString.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemString *addItemString(const QString &name, QString &reference,
                              const QString &defaultValue = QLatin1String(""),  // NOT QString() !!
                              const QString &key = QString());

    /**
     * Register a password item of type QString. The string value is written
     * encrypted to the config file. Note that the current encryption scheme
     * is very weak.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemPassword *addItemPassword(const QString &name, QString &reference,
                                  const QString &defaultValue = QLatin1String(""),
                                  const QString &key = QString());

    /**
     * Register a path item of type QString. The string value is interpreted
     * as a path. This means, dollar expension is activated for this value, so
     * that e.g. $HOME gets expanded.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemPath *addItemPath(const QString &name, QString &reference,
                          const QString &defaultValue = QLatin1String(""),
                          const QString &key = QString());

    /**
     * Register a property item of type QVariant. Note that only the following
     * QVariant types are allowed: String, StringList, Font, Point, Rect, Size,
     * Color, Int, UInt, Bool, Double, DateTime and Date.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemProperty *addItemProperty(const QString &name, QVariant &reference,
                                  const QVariant &defaultValue = QVariant(),
                                  const QString &key = QString());
    /**
     * Register an item of type bool.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemBool *addItemBool(const QString &name, bool &reference,
                          bool defaultValue = false,
                          const QString &key = QString());

    /**
     * Register an item of type qint32.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemInt *addItemInt(const QString &name, qint32 &reference, qint32 defaultValue = 0,
                        const QString &key = QString());

    /**
     * Register an item of type quint32.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemUInt *addItemUInt(const QString &name, quint32 &reference,
                          quint32 defaultValue = 0,
                          const QString &key = QString());

    /**
     * Register an item of type qint64.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemLongLong *addItemLongLong(const QString &name, qint64 &reference,
                                  qint64 defaultValue = 0,
                                  const QString &key = QString());

    /**
     * @deprecated
     * Use addItemLongLong().
     */
#ifndef KDE_NO_DEPRECATED
    KCONFIGCORE_DEPRECATED ItemLongLong *addItemInt64(const QString &name, qint64 &reference,
            qint64 defaultValue = 0,
            const QString &key = QString());
#endif

    /**
     * Register an item of type quint64
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemULongLong *addItemULongLong(const QString &name, quint64 &reference,
                                    quint64 defaultValue = 0,
                                    const QString &key = QString());

    /**
     * @deprecated
     * Use addItemULongLong().
     */
#ifndef KDE_NO_DEPRECATED
    KCONFIGCORE_DEPRECATED ItemULongLong *addItemUInt64(const QString &name, quint64 &reference,
            quint64 defaultValue = 0,
            const QString &key = QString());
#endif

    /**
     * Register an item of type double.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemDouble *addItemDouble(const QString &name, double &reference,
                              double defaultValue = 0.0,
                              const QString &key = QString());

    /**
     * Register an item of type QRect.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemRect *addItemRect(const QString &name, QRect &reference,
                          const QRect &defaultValue = QRect(),
                          const QString &key = QString());

    /**
     * Register an item of type QPoint.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemPoint *addItemPoint(const QString &name, QPoint &reference,
                            const QPoint &defaultValue = QPoint(),
                            const QString &key = QString());

    /**
     * Register an item of type QSize.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemSize *addItemSize(const QString &name, QSize &reference,
                          const QSize &defaultValue = QSize(),
                          const QString &key = QString());

    /**
     * Register an item of type QDateTime.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemDateTime *addItemDateTime(const QString &name, QDateTime &reference,
                                  const QDateTime &defaultValue = QDateTime(),
                                  const QString &key = QString());

    /**
     * Register an item of type QStringList.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemStringList *addItemStringList(const QString &name, QStringList &reference,
                                      const QStringList &defaultValue = QStringList(),
                                      const QString &key = QString());

    /**
     * Register an item of type QList<int>.
     *
     * @param name Name used to identify this setting. Names must be unique.
     * @param reference Pointer to the variable, which is set by readConfig()
     * calls and read by save() calls.
     * @param defaultValue Default value, which is used when the config file
     * does not yet contain the key of this item.
     * @param key Key used in config file. If key is null, name is used as key.
     * @return The created item
     */
    ItemIntList *addItemIntList(const QString &name, QList < int > &reference,
                                const QList < int > &defaultValue =
                                    QList < int >(),
                                const QString &key = QString());

    /**
     * Return the @ref KConfig object used for reading and writing the settings.
     */
    KConfig *config();

    /**
     * Return the @ref KConfig object used for reading and writing the settings.
     */
    const KConfig *config() const;

    /**
     * Return the @ref KConfig object used for reading and writing the settings.
     * @since 5.0
     */
    KSharedConfig::Ptr sharedConfig() const;

    /**
     * Set the @ref KSharedConfig object used for reading and writing the settings.
     */
    void setSharedConfig(KSharedConfig::Ptr pConfig);

    /**
     * Return list of items managed by this KCoreConfigSkeleton object.
     */
    KConfigSkeletonItem::List items() const;

    /**
     * Removes and deletes an item by name
     * @param name the name of the item to remove
     */
    void removeItem(const QString &name);

    /**
     * Removes and deletes all items
     */
    void clearItems();

    /**
     * Return whether a certain item is immutable
     * @since 4.4
     */
    bool isImmutable(const QString &name) const;

    /**
     * Lookup item by name
     * @since 4.4
     */
    KConfigSkeletonItem *findItem(const QString &name) const;

    /**
     * Specify whether this object should reflect the actual values or the
     * default values.
     * This method is implemented by usrUseDefaults(), which can be overridden
     * in derived classes if you have special requirements and can call
     * usrUseDefaults() directly.
     * If you don't have control whether useDefaults() or usrUseDefaults() is
     * called override useDefaults() directly.
     * @param b true to make this object reflect the default values,
     *          false to make it reflect the actual values.
     * @return The state prior to this call
     */
    virtual bool useDefaults(bool b);

public Q_SLOTS:
    /**
     * Write preferences to config file. The values of all registered items are
     * written to disk.
     * This method calls usrSave() after writing the settings from the
     * registered items to the KConfig. You can override usrSave()
     * in derived classes if you have special requirements.
     */
    bool save();

#ifndef KCONFIGCORE_NO_DEPRECATED
    /**
     * @deprecated since 5.0, call save() instead.
     */
    KCONFIGCORE_DEPRECATED void writeConfig()
    {
        save();
    }
#endif

Q_SIGNALS:
    /**
     * This signal is emitted when the configuration change.
     */
    void configChanged();

protected:
    /**
     * Implemented by subclasses that use special defaults.
     * It replaces the default values with the actual values and
     * vice versa.  Called from @ref useDefaults()
     * @param b true to make this object reflect the default values,
     *          false to make it reflect the actual values.
     * @return The state prior to this call
     */
    virtual bool usrUseDefaults(bool b);

    /**
     * Perform the actual setting of default values.
     * Override in derived classes to set special default values.
     * Called from @ref setDefaults()
     */
    virtual void usrSetDefaults();

    /**
     * Perform the actual reading of the configuration file.
     * Override in derived classes to read special config values.
     * Called from @ref read()
     */
    virtual void usrRead();

    /**
     * Perform the actual writing of the configuration file.
     * Override in derived classes to write special config values.
     * Called from @ref writeConfig()
     */
    virtual bool usrSave();

   /**
     * @deprecated since 5.0, override usrRead instead.  This method is still called from usrRead
     * for compatibility.
     */
    KCONFIGCORE_DEPRECATED virtual void usrReadConfig();

   /**
     * @deprecated since 5.0, override usrSave instead.  This method is still called from usrSave
     * for compatibility.
     */
    KCONFIGCORE_DEPRECATED virtual bool usrWriteConfig();

private:
    KCoreConfigSkeletonPrivate *const d;
    friend class KConfigSkeleton;

};

#endif