Changes to templates to include e-mail as a link
[biacv.git] / biacv_mainwindow.py
index 72c6bc3..ec74b82 100644 (file)
@@ -45,13 +45,6 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                if templatedir == "":
                        return
 
-               # get the output file path
-               outputfile = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
-                       lang.EXPORT_TITLE)
-
-               if outputfile == "":
-                       return
-
                # create a new exporter object
                exp = exporter.BiaCVExporter ()
 
@@ -61,6 +54,14 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                # set the template directory
                exp.set_template_directory (unicode (templatedir.toUtf8(), "utf-8"))
 
+               # get the output file path
+               outputfile = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
+                       exp.exporter_name, filter=exp.export_filter)
+
+               if outputfile == "":
+                       return
+
+
                # set the output file
                exp.set_output (unicode (outputfile.toUtf8(), "utf-8"))
 
@@ -78,7 +79,8 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                                return
 
                # open file dialog
-               openfilename = PyQt4.QtGui.QFileDialog.getOpenFileName (self, lang.OPEN_TITLE)
+               openfilename = PyQt4.QtGui.QFileDialog.getOpenFileName (self, lang.OPEN_TITLE,
+                               filter = lang.BIACV_FILE_FILTER)
                # if no open file name then return
                if openfilename == "":
                        return
@@ -121,7 +123,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
        # function to save a file as a new document
        def on_file_save_as (self):
                savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
-                       lang.SAVE_TITLE)
+                       lang.SAVE_TITLE, filter=lang.BIACV_FILE_FILTER)
 
                # if save file name is not none
                if savefilename <> "":
@@ -140,7 +142,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                # if no current file get file name from file save dialog
                if self.currentfile is None:
                        savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
-                               lang.SAVE_TITLE)
+                               lang.SAVE_TITLE, filter=lang.BIACV_FILE_FILTER)
 
                        if savefilename <> "":
                                mydata = self.get_document_data ()
@@ -187,7 +189,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow):
                        )
 
                # set the profile highlights
-               profile_highlights = unicode (self.profile.toPlainText ().toUtf8 ()).splitlines ()
+               profile_highlights = unicode (self.profile.toPlainText ().toUtf8 (), "utf-8").splitlines ()
                docdata.set_profile (profile_highlights)
 
                # get the list of educational qualifications from the treewidget