+ "cancel": self.keyCancel,
+ "save": self.keySave,
+ }, -2)
+
+ ConfigListScreen.__init__(self, list, session = session, on_change = self.changedEntry)
+
+ self.changedEntry()
+
+ # for summary:
+ def changedEntry(self):
+ for x in self.onChangedEntry:
+ x()
+
+ def getCurrentEntry(self):
+ return self["config"].getCurrent()[0]
+
+ def getCurrentValue(self):
+ return str(self["config"].getCurrent()[1].getText())
+
+ def createSummary(self):
+ return SetupSummary
+
+ def addItems(self, list, childNode):
+ for x in childNode:
+ if x.nodeType != xml.dom.minidom.Element.nodeType:
+ continue
+ elif x.tagName == 'item':
+ item_text = _(x.getAttribute("text").encode("UTF-8") or "??")
+ b = eval(XMLTools.mergeText(x.childNodes));
+ if b == "":
+ continue
+ #add to configlist
+ item = b
+ # the first b is the item itself, ignored by the configList.
+ # the second one is converted to string.
+ list.append( (item_text, item) )
+
+ def keySave(self):
+ print "save requested"
+ for x in self["config"].list:
+ x[1].save()
+ self.close()
+
+ def cancelConfirm(self, result):
+ if not result:
+ return
+
+ print "cancel requested"
+
+ for x in self["config"].list:
+ x[1].cancel()
+ self.close()
+
+ def keyCancel(self):
+ is_changed = False
+ for x in self["config"].list:
+ is_changed |= x[1].isChanged()
+
+ if is_changed:
+ self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
+ else:
+ self.close()
+
+def getSetupTitle(id):
+ xmldata = setupdom.childNodes[0].childNodes
+ for x in elementsWithTag(xmldata, "setup"):
+ if x.getAttribute("key") == id:
+ return x.getAttribute("title").encode("UTF-8")