[Libreoffice-commits] core.git: ios/LibreOfficeLight

jan Iversen jani at libreoffice.org
Mon Oct 30 07:30:49 UTC 2017


 ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift |   12 ++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit dd9c17ae211a8171a7dc84acd9c9dc17cc5b8c48
Author: jan Iversen <jani at libreoffice.org>
Date:   Mon Oct 30 08:28:21 2017 +0100

    iOS, make list of allowed file extensions
    
    Info.plist import/export file extensions handled by
    LibreOfficeKit, looped through and created var "KnownDocumentTypes"
    
    Change-Id: I479126a8070490e259c81d32f7dbfe437670fb28

diff --git a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift
index ddfd77d2c301..a03ec08f38ef 100755
--- a/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift
+++ b/ios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift
@@ -19,11 +19,23 @@ class DocumentController: UIViewController, MenuDelegate, UIDocumentBrowserViewC
     // this is normal functions every controller must implement
 
 
+    // holds known document types
+    var KnownDocumentTypes : [String] = []
+
 
     // called once controller is loaded
     override func viewDidLoad()
     {
         super.viewDidLoad()
+
+        // loading known document types, so we can use them for the open call
+        let path = Bundle.main.path(forResource: "Info", ofType: "plist")
+        let plist = NSDictionary(contentsOfFile: path!)
+        for dict in (plist!.object(forKey: "UTExportedTypeDeclarations") as! [NSDictionary]) +
+                    (plist!.object(forKey: "UTImportedTypeDeclarations") as! [NSDictionary]) {
+            let x = ((dict["UTTypeTagSpecification"]  as! NSDictionary)["public.filename-extension"] as! NSArray)
+            KnownDocumentTypes.append( x[0] as! String )
+        }
     }
 
 


More information about the Libreoffice-commits mailing list