File Save As functionality implemented
[biacv.git] / biacv_mainwindow.py
index 4a98c2d..681469d 100644 (file)
@@ -62,6 +62,19 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                # set the window title
                self.setWindowTitle ("BiaCV - " + self.currentfile)
 
+       # function to save a file as a new document
+       def on_file_save_as (self):
+               savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
+                       lang.SAVE_TITLE)
+
+               # if save file name is not none
+               if savefilename <> "":
+                       mydata = self.get_document_data ()
+                       mydata.save_data (savefilename)
+                       self.ismodified = False
+                       self.currentfile = savefilename
+                       self.setWindowTitle ("BiaCV - " + self.currentfile)
+
        # function to save a file
        def on_file_save (self):
                # only save modified file
@@ -75,7 +88,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
 
                        if savefilename <> "":
                                mydata = self.get_document_data ()
-                               mydata.save_data (self.currentfile)
+                               mydata.save_data (savefilename)
                                self.ismodified = False
                                self.currentfile = savefilename
                                self.setWindowTitle ("BiaCV - " + self.currentfile)