Continued replacing QMessageBox.

Fri, 03 Sep 2010 10:21:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 03 Sep 2010 10:21:47 +0200
changeset 548
ac7af05dd54a
parent 547
cceececd1312
child 549
fe99d46d56c8

Continued replacing QMessageBox.

QScintilla/Editor.py file | annotate | diff | comparison | revisions
ViewManager/ViewManager.py file | annotate | diff | comparison | revisions
--- a/QScintilla/Editor.py	Fri Sep 03 10:05:50 2010 +0200
+++ b/QScintilla/Editor.py	Fri Sep 03 10:21:47 2010 +0200
@@ -2186,9 +2186,9 @@
                     QMessageBox.Save),
                 QMessageBox.Save)
             if res == QMessageBox.Save:
-                ok, newName = self.saveFile()
+                ok = self.saveFile()
                 if ok:
-                    self.vm.setEditorName(self, newName)
+                    self.vm.setEditorName(self, self.fileName)
                 return ok
             elif res == QMessageBox.Abort:
                 return False
@@ -2342,11 +2342,10 @@
         
         @param saveas flag indicating a 'save as' action (boolean)
         @param path directory to save the file in (string)
-        @return tuple of two values (boolean, string) giving a success indicator and
-            the name of the saved file
+        @return flag indicating success (boolean)
         """
         if not saveas and not self.isModified():
-            return (False, None)      # do nothing if text wasn't changed
+            return False      # do nothing if text wasn't changed
             
         newName = None
         if saveas or self.fileName is None:
@@ -2377,11 +2376,11 @@
                                     " Overwrite it?</p>").format(fn),
                         type_ = E5MessageBox.Warning)
                     if not res:
-                        return (False, None)
+                        return False
                 fn = Utilities.toNativeSeparators(fn)
                 newName = fn
             else:
-                return (False, None)
+                return False
         else:
             fn = self.fileName
         
@@ -2406,10 +2405,10 @@
             self.editorSaved.emit(self.fileName)
             self.__autoSyntaxCheck()
             self.extractTasks()
-            return (True, self.fileName)
+            return True
         else:
             self.lastModified = QFileInfo(fn).lastModified()
-            return (False, None)
+            return False
         
     def saveFileAs(self, path = None, toProject = False):
         """
@@ -3971,9 +3970,9 @@
         """
         Private slot handling the save context menu entry.
         """
-        ok, newName = self.saveFile()
+        ok = self.saveFile()
         if ok:
-            self.vm.setEditorName(self, newName)
+            self.vm.setEditorName(self, self.fileName)
         
     def __contextSaveAs(self):
         """
--- a/ViewManager/ViewManager.py	Fri Sep 03 10:05:50 2010 +0200
+++ b/ViewManager/ViewManager.py	Fri Sep 03 10:21:47 2010 +0200
@@ -3008,9 +3008,9 @@
                         QMessageBox.Save),
                     QMessageBox.Save)
             if res == QMessageBox.Save:
-                ok, newName = editor.saveFile()
+                ok = editor.saveFile()
                 if ok:
-                    self.setEditorName(editor, newName)
+                    self.setEditorName(editor, editor.getFileName())
                 return ok
             elif res == QMessageBox.Abort:
                 return False
@@ -3441,7 +3441,7 @@
         if not editor.isModified():
             return True
         else:
-            ok = editor.saveFile()[0]
+            ok = editor.saveFile()
             return ok
         
     def saveEditorEd(self, ed):
@@ -3455,9 +3455,9 @@
             if not ed.isModified():
                 return True
             else:
-                ok, newName = ed.saveFile()
+                ok = ed.saveFile()
                 if ok:
-                    self.setEditorName(ed, newName)
+                    self.setEditorName(ed, ed.getFileName())
                 return ok
         else:
             return False
@@ -3496,18 +3496,18 @@
         @param editors list of editors to be saved
         """
         for editor in editors:
-            ok, newName = editor.saveFile()
+            ok = editor.saveFile()
             if ok:
-                self.setEditorName(editor, newName)
+                self.setEditorName(editor, editor.getFileName())
         
     def saveAllEditors(self):
         """
         Public slot to save the contents of all editors.
         """
         for editor in self.editors:
-            ok, newName = editor.saveFile()
+            ok = editor.saveFile()
             if ok:
-                self.setEditorName(editor, newName)
+                self.setEditorName(editor, editor.getFileName())
         
         # restart autosave timer
         if self.autosaveInterval > 0:
@@ -4638,9 +4638,9 @@
         """
         for editor in self.editors:
             if editor.shouldAutosave():
-                ok, newName = editor.saveFile()
+                ok = editor.saveFile()
                 if ok:
-                    self.setEditorName(editor, newName)
+                    self.setEditorName(editor, editor.getFileName())
         
         # restart autosave timer
         if self.autosaveInterval > 0:

eric ide

mercurial