Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/dcc-fcitx5configtool/operation/fcitx5configproxy.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 - 2027 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -219,6 +219,13 @@ QVariantList Fcitx5ConfigProxy::globalConfigOptions(const QString &type, bool al
}
++iterator;
}
if (option.type() == "Integer") {
bool ok = false;
int maxVal = properties.contains("IntMax") ? properties["IntMax"].toInt(&ok) : 9999;
item["intMax"] = ok ? maxVal : 9999;
int minVal = properties.contains("IntMin") ? properties["IntMin"].toInt(&ok) : 0;
item["intMin"] = ok ? minVal : 0;
}
}
list.append(item);
}
Expand Down
7 changes: 5 additions & 2 deletions src/dcc-fcitx5configtool/qml/DetailConfigItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ DccObject {
Component {
id: integerComponent
D.SpinBox {
width: 55
implicitWidth: 55
editable: true
width: 75
implicitWidth: 75
from: modelData.intMin !== undefined ? modelData.intMin : 0
to: modelData.intMax !== undefined ? modelData.intMax : 9999
Comment on lines +118 to +119
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Hard-coded default range 0–9999 may not match actual valid range for all integer options.

If IntMin/IntMax are missing, defaulting to [0, 9999] can prevent valid negative or large values and silently clamp user input. Consider either not constraining the SpinBox when no range is defined, or using a more permissive default that aligns with the config semantics.

Suggested change
from: modelData.intMin !== undefined ? modelData.intMin : 0
to: modelData.intMax !== undefined ? modelData.intMax : 9999
from: modelData.intMin !== undefined ? modelData.intMin : -2147483648
to: modelData.intMax !== undefined ? modelData.intMax : 2147483647

value: parseInt(modelData.value)
onValueChanged: {
dccData.fcitx5ConfigProxy.setValue(
Expand Down
Loading