aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenri Chain <henri.chain@enioka.com>2020-02-28 09:53:54 +0100
committerHenri Chain <henri.chain@enioka.com>2020-02-28 09:57:48 +0100
commitf98feb16981350480bdb292cf157f70005d5be12 (patch)
treeadf32c3c6553791d2f2155c3dc39ca700dd274d5
parented960455a112f455695d85b1b5407db22a3369e7 (diff)
downloadkconfig-f98feb16981350480bdb292cf157f70005d5be12.tar.gz
kconfig-f98feb16981350480bdb292cf157f70005d5be12.tar.bz2
fix min/max entries with dpointer
Summary: D27497 was causing cases with dpointer + min/max to fail Specifically, this okular build: https://build.kde.org/job/Applications/job/okular/job/kf5-qt5 SUSEQt5.12/175/console Test Plan: Added min/max to dpointer autotest Reviewers: meven, ervin Subscribers: kde-frameworks-devel, aacid Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27717
-rw-r--r--autotests/kconfig_compiler/CMakeLists.txt2
-rw-r--r--autotests/kconfig_compiler/test_dpointer.cpp.ref14
-rw-r--r--autotests/kconfig_compiler/test_dpointer.kcfg2
-rw-r--r--src/kconfig_compiler/kconfig_compiler.cpp2
4 files changed, 18 insertions, 2 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt
index f1a9dd8c..2b31a4da 100644
--- a/autotests/kconfig_compiler/CMakeLists.txt
+++ b/autotests/kconfig_compiler/CMakeLists.txt
@@ -231,7 +231,7 @@ ecm_add_test(${test_properties_minmax_SRCS}
########### next target ###############
set(test_param_minmax_SRCS test_param_minmax_main.cpp)
-gen_kcfg_test_source(test_param_minmax test_param_minmax_SRCS GENERATE_MOC)
+gen_kcfg_test_source(test_param_minmax test_param_minmax_SRCS)
ecm_add_test(${test_param_minmax_SRCS}
TEST_NAME test_param_minmax
diff --git a/autotests/kconfig_compiler/test_dpointer.cpp.ref b/autotests/kconfig_compiler/test_dpointer.cpp.ref
index 5693fb62..14af30b7 100644
--- a/autotests/kconfig_compiler/test_dpointer.cpp.ref
+++ b/autotests/kconfig_compiler/test_dpointer.cpp.ref
@@ -78,6 +78,8 @@ TestDPointer::TestDPointer( )
d->autoSaveItem->setWhatsThis( QCoreApplication::translate("TestDPointer", "WhatsThis text for AutoSave option") );
addItem( d->autoSaveItem, QStringLiteral( "AutoSave" ) );
d->autoSaveIntervalItem = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Auto Save Interval" ), d->autoSaveInterval, 10 );
+ d->autoSaveIntervalItem->setMinValue(0);
+ d->autoSaveIntervalItem->setMaxValue(123);
d->autoSaveIntervalItem->setLabel( QCoreApplication::translate("TestDPointer", "Auto Save Interval") );
addItem( d->autoSaveIntervalItem, QStringLiteral( "AutoSaveInterval" ) );
d->confirmItem = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Confirm Deletes" ), d->confirm, true );
@@ -179,6 +181,18 @@ KConfigSkeleton::ItemBool *TestDPointer::autoSaveItem()
void TestDPointer::setAutoSaveInterval( int v )
{
+ if (v < 0)
+ {
+ qDebug() << "setAutoSaveInterval: value " << v << " is less than the minimum value of 0";
+ v = 0;
+ }
+
+ if (v > 123)
+ {
+ qDebug() << "setAutoSaveInterval: value " << v << " is greater than the maximum value of 123";
+ v = 123;
+ }
+
if (!self()->TestDPointer::isAutoSaveIntervalImmutable())
self()->d->autoSaveInterval = v;
}
diff --git a/autotests/kconfig_compiler/test_dpointer.kcfg b/autotests/kconfig_compiler/test_dpointer.kcfg
index 3b19e270..7dc7400e 100644
--- a/autotests/kconfig_compiler/test_dpointer.kcfg
+++ b/autotests/kconfig_compiler/test_dpointer.kcfg
@@ -13,6 +13,8 @@
</entry>
<entry type="Int" key="Auto Save Interval">
<default>10</default>
+ <min>0</min>
+ <max>123</max>
</entry>
<entry type="Bool" key="Confirm Deletes" name="Confirm">
<label>Confirm deletes</label>
diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp
index 4e76f375..f4349420 100644
--- a/src/kconfig_compiler/kconfig_compiler.cpp
+++ b/src/kconfig_compiler/kconfig_compiler.cpp
@@ -440,7 +440,7 @@ QString itemVar(const CfgEntry *e, const KConfigParameters &cfg)
QString innerItemVar(const CfgEntry *e, const KConfigParameters &cfg)
{
if (e->signalList.isEmpty()) {
- return itemVar(e, cfg);
+ return itemPath(e, cfg);
} else {
QString result = "innerItem" + e->name;
result[9] = result[9].toUpper();