def reconnectCsvVectorLayers(self, csvVectorLayers):
     layers = QgsMapLayerRegistry.instance().mapLayers()
     for qgsLayer in layers.itervalues():
         csvFilePath = qgsLayer.customProperty('editablegeocsv_path', '') 
         if csvFilePath:                
             try:        
                 dataSourceHandler = GeoCsvDataSourceHandler(csvFilePath)
                 vectorLayerDescriptor = dataSourceHandler.createCsvVectorDescriptorFromCsvt()
                 if not dataSourceHandler.hasPrj():
                     dataSourceHandler.updatePrjFile(qgsLayer.crs().toWkt())
                 csvVectorLayer = GeoCsvVectorLayerFactory.createCsvVectorLayer(dataSourceHandler, vectorLayerDescriptor, qgsLayer)
                 vectorLayerController = VectorLayerController(csvVectorLayer, dataSourceHandler)
                 csvVectorLayer.initController(vectorLayerController)                    
                 csvVectorLayers.append(csvVectorLayer)
                 NotificationHandler.pushSuccess(QApplication.translate('GeoCsvReconnectController', 'GeoCSV Layer reconnected'), QApplication.translate('GeoCsvReconnectController', 'Layer "{}" is successfully reconnected').format(qgsLayer.name()))                                                    
             except:                  
                 GeoCsvNewController.getInstance().createCsvVectorLayer(csvVectorLayers, qgsLayer, QApplication.translate('GeoCsvReconnectController', 'Couldn\'t automatically restore csv layer "{}"').format(qgsLayer.name()))
 def createCsvVectorLayer(self, csvVectorLayers, qgsVectorLayer=None, customTitle=None):
     if self.newDialog.isVisible():
         self.newDialog.reject()                                
     # enable help hyperlink
     self.newDialog.helpLabel.setOpenExternalLinks(True)                            
     self.dataSourceHandler = None
     self.vectorDescriptor = None 
     self.csvtFileIsDirty = False                       
     if customTitle:
         self.newDialog.setWindowTitle(customTitle)
     if qgsVectorLayer:
         csvPath = qgsVectorLayer.customProperty('editablegeocsv_path')
         if csvPath:
             self.newDialog.filePath.setText(csvPath)
     self._updateAcceptButton()
     self._analyseCsv()
     self.newDialog.show()        
     #wait for user input
     result = self.newDialog.exec_()
     #if user pressed ok
     if result == 1:
         if self.dataSourceHandler and self.vectorDescriptor:                                
             csvVectorLayer = GeoCsvVectorLayerFactory.createCsvVectorLayer(self.dataSourceHandler, self.vectorDescriptor, qgsVectorLayer)
             vectorLayerController = VectorLayerController(csvVectorLayer, self.dataSourceHandler)
             csvVectorLayer.initController(vectorLayerController)                                                                        
             QgsMapLayerRegistry.instance().addMapLayer(csvVectorLayer.qgsVectorLayer)
             NotificationHandler.pushSuccess(QApplication.translate('GeoCsvNewController', 'GeoCSV Layer created'), QApplication.translate('GeoCsvNewController', 'The layer "{}" was created successfully.').format(csvVectorLayer.qgsVectorLayer.name()))                
             csvVectorLayers.append(csvVectorLayer)
             if self.csvtFileIsDirty:
                 try:
                     self.dataSourceHandler.updateCsvtFile(self.vectorDescriptor.getAttributeTypes())
                     NotificationHandler.pushInfo(QApplication.translate('GeoCsvNewController', 'CSVT File created/updated.'), QApplication.translate('GeoCsvNewController', 'The CSVT file was successfully created/updated on disk.'))
                 except FileIOException:                                                
                     NotificationHandler.pushWarning(QApplication.translate('GeoCsvNewController', 'CSVT File Error'), QApplication.translate('GeoCsvNewController', 'The csvt file couldn\'t be updated on disk.'))         
             if not self.dataSourceHandler.hasPrj():
                 self.dataSourceHandler.updatePrjFile(csvVectorLayer.qgsVectorLayer.crs().toWkt())
                 NotificationHandler.pushInfo(QApplication.translate('GeoCsvNewController', 'PRJ File created.'), QApplication.translate('GeoCsvNewController', 'The PRJ file was successfully created on disk.'))