code: def saveAs( self, filename = '' ):
          
          if ( not (filename and isinstance(filename, basestring)) ):
              langTypes = XLanguage.pluginFileTypes()
              filename = QFileDialog.getSaveFileName( None,
                                                      'Save File As...',
                                                      QDir.currentPath(),
                                                      langTypes)
              
              if type(filename) == tuple:
                  filename = nativestring(filename[0])
          
          if ( not filename ):
              return False
          
          docfile = QFile(filename)
          if ( not docfile.open(QFile.WriteOnly) ):
              logger.warning('Could not open %s for writing.' % filename)
              return False
          
          success = self.write(docfile)
          docfile.close()
          
          if success:
              filename = nativestring(filename)
              self._filename = filename
              
              self.setModified(False)
              
              # set the language
              lang = XLanguage.byFileType(os.path.splitext(filename)[1])
              if ( lang != self.language() ):
                  self.setLanguage(lang)
          
          return success
docs: Saves the current document to the inputed filename.  If no filename \
          is supplied, then the user will be prompted to supply a filename.
          
          :param      filename | <str>
          
          :return     <bool> | success