summaryrefslogtreecommitdiff
path: root/kberylsettings/contentframe.py
diff options
context:
space:
mode:
authornatural <natural>2006-12-31 09:54:31 +0000
committernatural <natural>2006-12-31 09:54:31 +0000
commite7ae2a8a5f3bcf1669e1a7514540c451cafbc9b6 (patch)
tree7bec160d7559b4b2f1ddab7dd45f155f59f035c2 /kberylsettings/contentframe.py
parent0aa170e67595b83e49e72d78f41c27a48d3059ad (diff)
downloadkberylsettings-e7ae2a8a5f3bcf1669e1a7514540c451cafbc9b6.tar.gz
kberylsettings-e7ae2a8a5f3bcf1669e1a7514540c451cafbc9b6.tar.bz2
Added setting-editor-widgets-dirty-so-prompt before exit check.
Cleaned up the queryClose handling, too.
Diffstat (limited to 'kberylsettings/contentframe.py')
-rw-r--r--kberylsettings/contentframe.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/kberylsettings/contentframe.py b/kberylsettings/contentframe.py
index 208005f..ed6467b 100644
--- a/kberylsettings/contentframe.py
+++ b/kberylsettings/contentframe.py
@@ -82,12 +82,25 @@ class ContentFrame(WidgetStack):
self.tabPage.setGroups(plugin)
self.raiseWidget(self.tabPageId)
+ def queryClose(self):
+ """ checks for unsaved changes in a setting page
+
+ @return True if no changes, changes discarded, or changes
+ applied; False if canceled
+ """
+ try:
+ w = self.visibleWidget()
+ return w.unsavedCheck(None, None)
+ except (AttributeError, ), exc:
+ return True
+
class SettingPage:
""" SettingPage -> mixin with methods common to both the
SinglePage and the TabPage types.
"""
+ previous = (None, None)
unsavedText = ('There are unsaved changes in the active settings.\n'
'Do you want to apply the changes before changing views '
'or discard the changes?')
@@ -152,12 +165,14 @@ class SettingPage:
if self.unsaved():
res = self.unsavedDialog()
if res == KMessageBox.Cancel:
- self.emit(Signals.selectPrevious, (plugin, arg))
+ self.emit(Signals.selectPrevious, self.previous)
ret = False
elif res == KMessageBox.Yes:
self.settingApply()
else:
self.settingDiscard()
+ if ret:
+ self.previous = (plugin, arg)
return ret
def settingHelp(self):
@@ -236,7 +251,6 @@ class SinglePage(Frame, SettingPage):
"""
def __init__(self, parent):
Frame.__init__(self, parent, marginHint, spacingHint)
- self.previous = (None, None)
self.header = ContentHeader(self)
self.main = MultiSettingFrame(self)
self.footer = ContentFooter(self)
@@ -258,9 +272,8 @@ class SinglePage(Frame, SettingPage):
@param arg setting name or setting section name
@return None
"""
- if not self.unsavedCheck(*self.previous):
+ if not self.unsavedCheck(plugin, arg):
return
- self.previous = (plugin, arg)
self.header.setFromPlugin(plugin, arg)
self.main.setPlugin(plugin, arg)