Commit 3a63f3ba authored by Holger Kaelberer's avatar Holger Kaelberer
Browse files

balancebox: avoid starting with invalid user level set

... by cancelling saving a 'user' level set to configuration if user
levels file does not yet exist.
parent 47f9ef44
......@@ -30,6 +30,7 @@ import QtQuick.Controls 1.0
import "../../core"
import "editor/"
import "balancebox.js" as Activity
import "qrc:/gcompris/src/core/core.js" as Core
ActivityBase {
id: activity
......@@ -440,7 +441,6 @@ ActivityBase {
Button {
id: editorButton
style: GCButtonStyle {}
//width: 80
height: levelsBox.height
text: "Start Editor"
visible: levelsBox.currentIndex == 1
......@@ -468,6 +468,23 @@ ActivityBase {
}
}
dataValidationFunc: function() {
var newLevels = dialogActivityConfig.configItem
.availableLevels[dialogActivityConfig.configItem.levelsBox.currentIndex].value;
if (newLevels === "user" &&
!parser.jsonFile.exists(Activity.userFile)) {
Core.showMessageDialog(dialogActivityConfig,
qsTr("You selected the user defined level set, but you have not yet defined any user levels!<br/> " +
"Either define your user levels by starting the level editor or choose the 'builtin' level set."),
"Ok", null,
"", null,
null);
return false;
}
return true;
}
function setDefaultValues() {
for(var i = 0 ;
i < dialogActivityConfig.configItem.availableLevels.length;
......
......@@ -93,9 +93,7 @@ function showMessageDialog(parent, informativeText,
button1Text, button1Callback,
button2Text, button2Callback,
closeCallback) {
console.log("XXXXXXXXXXXXXXXXX " + parent + " trace=");
console.trace();
//console.debug("Core.showMessageDialog: parent=" + parent + " backtrace="); console.trace();
var qmlStr =
'import QtQuick 2.0\n'
+ 'GCDialog {\n'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment