summaryrefslogtreecommitdiff
path: root/ios
diff options
context:
space:
mode:
authorjan Iversen <jani@libreoffice.org>2017-10-30 08:28:21 +0100
committerjan Iversen <jani@libreoffice.org>2017-10-30 08:30:18 +0100
commitdd9c17ae211a8171a7dc84acd9c9dc17cc5b8c48 (patch)
treeb9304e7282a94a0b0c18b2ca99e78a6c0424da41 /ios
parent08a43cc97ccf88faa9d3a04afc3aacd2c885a2d1 (diff)
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
Diffstat (limited to 'ios')
-rwxr-xr-xios/LibreOfficeLight/LibreOfficeLight/DocumentController.swift12
1 files changed, 12 insertions, 0 deletions
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 )
+ }
}