diff options
author | jan Iversen <jani@libreoffice.org> | 2017-03-19 11:55:52 +0100 |
---|---|---|
committer | jan iversen <jani@libreoffice.org> | 2017-03-24 15:41:19 +0000 |
commit | f7eab4dbb8046103df08176e11e0844371e0d20a (patch) | |
tree | 9c1ec41a1831df116decced798a6b8b4d4700c90 /ios | |
parent | f9bf486e25bcec4831393b6dd78ea358ff981b38 (diff) |
iOS LibreOfficeLight, document actions
added action menu in Document viewer
Change-Id: Ia7c796f7806e363769a5932ce774f33bb4ae8bd2
Reviewed-on: https://gerrit.libreoffice.org/35666
Reviewed-by: jan iversen <jani@libreoffice.org>
Tested-by: jan iversen <jani@libreoffice.org>
Diffstat (limited to 'ios')
3 files changed, 531 insertions, 390 deletions
diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/DocumentController.swift b/ios/experimental/LibreOfficeLight/LibreOfficeLight/DocumentController.swift index 9c6cd1b9fb82..1b61f6bb2f2b 100755 --- a/ios/experimental/LibreOfficeLight/LibreOfficeLight/DocumentController.swift +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/DocumentController.swift @@ -9,8 +9,87 @@ import UIKit -class DocumentController: UIViewController +class DocumentController: UIViewController, DocumentActionsControlDelegate { + @IBAction func returned(segue: UIStoryboardSegue) + { + print("I returned") + } + + + + // Last stop before displaying popover + override func prepare(for segue: UIStoryboardSegue, sender: Any?) + { + if segue.identifier == "showActions" { + let vc = segue.destination as! DocumentActions + vc.delegate = self + + // JIX, TO BE CHANGED + vc.isDocActive = true + } + } + + + + func actionNew(_ name : String) + { + // JIX Close active documents if any + // Start new (with default name + + // Only interact with DocumentBrowser + + } + + + + func actionOpen() + { + // JIX Close active documents if any + // Present FileManager + performSegue(withIdentifier: "showFileManager", sender: self) + + // start DocumentBrowser with new document + } + + + + func actionDelete() + { + // JIX Close active documents if any + // Delete document + } + + + + func actionSave() + { + // call save in DocumentBrowser + + } + + + + func actionSaveAs(_ name : String) + { + // call saveas in DocumentBrowser + + } + + + + func actionPDF() + { + // call savePDF in documentBrowser + } + + + + func actionPrint() + { + // call print in DocumentBrowser + } + override func viewDidLoad() @@ -20,49 +99,105 @@ class DocumentController: UIViewController } - @IBAction func returned(segue: UIStoryboardSegue) { - print("I returned") - } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } +} + +// Protocol for action popover callback +protocol DocumentActionsControlDelegate +{ + func actionNew(_ name : String) + func actionOpen() + func actionDelete() + func actionSave() + func actionSaveAs(_ name : String) + func actionPDF() + func actionPrint() } class DocumentActions: UITableViewController { + // Pointer to callback class + var delegate : DocumentActionsControlDelegate? + var isDocActive : Bool = false + + // Calling class might enable/disable each button + @IBOutlet weak var buttonNew: UIButton! + @IBOutlet weak var buttonOpen: UIButton! + @IBOutlet weak var buttonDelete: UIButton! + @IBOutlet weak var buttonSave: UIButton! + @IBOutlet weak var buttonSaveAs: UIButton! + @IBOutlet weak var buttonPDF: UIButton! + @IBOutlet weak var buttonPrint: UIButton! + + + // Actions + @IBAction func doOpen(_ sender: UIButton) + { + delegate?.actionOpen() + dismiss(animated: false) + } + + - @IBAction func doOpen(_ sender: UIButton) { + @IBAction func doDelete(_ sender: UIButton) + { + delegate?.actionDelete() + dismiss(animated: false) } - @IBAction func doNew(_ sender: UIButton) { + + + @IBAction func doSave(_ sender: UIButton) + { + delegate?.actionSave() + dismiss(animated: false) } - @IBAction func doSave(_ sender: UIButton) { + + + @IBAction func doPDF(_ sender: UIButton) + { + delegate?.actionPDF() + dismiss(animated: false) } - @IBAction func doPDF(_ sender: UIButton) { + + + @IBAction func doPrint(_ sender: UIButton) + { + delegate?.actionPrint() + dismiss(animated: false) } + + + override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. + buttonDelete.isEnabled = isDocActive + buttonSave.isEnabled = isDocActive + buttonSaveAs.isEnabled = isDocActive + buttonPDF.isEnabled = isDocActive + buttonPrint.isEnabled = isDocActive } - override func didReceiveMemoryWarning() + // Last stop before displaying popover + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - super.didReceiveMemoryWarning() - // Dispose of any resources that can be recreated. + let vc = segue.destination as! setNameAction + vc.delegateDoc = self.delegate + vc.protocolActionToPerform = (segue.identifier == "showNew") ? 2 : 3 } - - } diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/FileManagerController.swift b/ios/experimental/LibreOfficeLight/LibreOfficeLight/FileManagerController.swift index 9f6352071c10..03003fd699b2 100755 --- a/ios/experimental/LibreOfficeLight/LibreOfficeLight/FileManagerController.swift +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/FileManagerController.swift @@ -1,477 +1,479 @@ // -//ThisfileispartoftheLibreOfficeproject. +// This file is part of the LibreOffice project. // -//ThisSourceCodeFormissubjecttothetermsoftheMozillaPublic -//License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis -//file,Youcanobtainoneathttp://mozilla.org/MPL/2.0/. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v.2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. // -importUIKit +import UIKit -privateclassFileStorage +private class FileStorage { -//housekeepingvariables -privateletfilemgr:FileManager=FileManager.default -privatevarstorageIsLocal:Bool=true - -//Startpathforthe2storagelocations -privateletbaseLocalDocPath:URL -privateletbaseCloudDocPath:URL? -privatevarcurrentDocPath:URL?{ -get{ -returnstorageIsLocal?baseLocalDocPath:baseCloudDocPath -} -} + // house keeping variables + private let filemgr : FileManager = FileManager.default + private var storageIsLocal : Bool = true -//makeaccesstocurrentdirindependentofstorageselection -privatevarlocalDir:URL -privatevarcloudDir:URL? -privatevarcurrentDir:URL{ -get{ -returnstorageIsLocal?localDir:cloudDir! -} -set(newDir){ -ifstorageIsLocal{ -localDir=newDir -}else{ -cloudDir=newDir -} -} -} + // Start path for the 2 storage locations + private let baseLocalDocPath : URL + private let baseCloudDocPath : URL? + private var currentDocPath : URL? { + get { + return storageIsLocal ? baseLocalDocPath : baseCloudDocPath + } + } + // make access to current dir independent of storage selection + private var localDir : URL + private var cloudDir : URL? + private var currentDir : URL { + get { + return storageIsLocal ? localDir : cloudDir! + } + set(newDir) { + if storageIsLocal { + localDir = newDir + } else { + cloudDir = newDir + } + } + } -//contentofcurrentdirectory -varcurrentFileList:[String]=[] -varcurrentDirList:[String]=[] + // content of current directory + var currentFileList : [String] = [] + var currentDirList : [String] = [] -//Supportfunctions -funciCloudEnabled()->Bool -{ -returnfilemgr.ubiquityIdentityToken!=nil -} + // Support functions + func iCloudEnabled() -> Bool + { + return filemgr.ubiquityIdentityToken != nil + } -funcisSubDirectory()->Bool -{ -returncurrentDir!=currentDocPath -} + func isSubDirectory() -> Bool + { + return currentDir != currentDocPath + } -funcselectStorage(_doSwitch:Bool)->Bool -{ -ifdoSwitch{ -storageIsLocal=!storageIsLocal -buildFileList() -} -returnstorageIsLocal -} + func selectStorage(_ doSwitch : Bool) -> Bool + { + if doSwitch { + storageIsLocal = !storageIsLocal + buildFileList() + } + return storageIsLocal + } -funcenterDirectory(_name:String) -{ -//simpleadddirectory -currentDir=currentDir.appendingPathComponent(name) -filemgr.changeCurrentDirectoryPath(name) -buildFileList() -} + func enterDirectory(_ name: String) + { + // simple add directory + currentDir = currentDir.appendingPathComponent(name) + filemgr.changeCurrentDirectoryPath(name) + buildFileList() + } -funcleaveDirectory() -{ -//stepupforactivestorage,andonlyifnotinroot -ifisSubDirectory(){ -currentDir=currentDir.deletingLastPathComponent() -buildFileList() -} -} + func leaveDirectory() + { + // step up for active storage, and only if not in root + if isSubDirectory() { + currentDir = currentDir.deletingLastPathComponent() + buildFileList() + } + } -funccreateDirectory(_name:String) -{ -letnewDir=currentDir.appendingPathComponent(name) -try!filemgr.createDirectory(at:newDir,withIntermediateDirectories:true,attributes:nil) -currentDir=currentDir.appendingPathComponent(name) -buildFileList() -} + func createDirectory(_ name: String) + { + let newDir = currentDir.appendingPathComponent(name) + try! filemgr.createDirectory(at: newDir, withIntermediateDirectories: true, attributes: nil) + currentDir = currentDir.appendingPathComponent(name) + buildFileList() + } -funcdeleteFileDirectory(_name:String) -{ -letdelDir=currentDir.appendingPathComponent(name) -try!filemgr.removeItem(at:delDir) -buildFileList() -} + func deleteFileDirectory(_ name: String) + { + let delDir = currentDir.appendingPathComponent(name) + try! filemgr.removeItem(at: delDir) + buildFileList() + } -funcgetFileURL(_name:String)->URL -{ -returncurrentDir.appendingPathComponent(name) -} + func getFileURL(_ name: String) -> URL + { + return currentDir.appendingPathComponent(name) + } -funccopyFile(_name:String) -{ -try!filemgr.copyItem(at:currentDir.appendingPathComponent(name), -to:(storageIsLocal?cloudDir!:localDir).appendingPathComponent(name)) -} + func copyFile(_ name: String) + { + try! filemgr.copyItem(at: currentDir.appendingPathComponent(name), + to: (storageIsLocal ? cloudDir! : localDir).appendingPathComponent(name)) + } -funcmoveFile(_name:String) -{ -try!filemgr.moveItem(at:currentDir.appendingPathComponent(name), -to:(storageIsLocal?localDir:cloudDir!).appendingPathComponent(name)) -buildFileList() -} + func moveFile(_ name: String) + { + try! filemgr.moveItem(at: currentDir.appendingPathComponent(name), + to: (storageIsLocal ? localDir : cloudDir!).appendingPathComponent(name)) + buildFileList() + } -funcrenameFile(_oldName:String,_newName:String) -{ -try!filemgr.moveItem(at:currentDir.appendingPathComponent(oldName), -to:currentDir.appendingPathComponent(newName)) -buildFileList() -} + func renameFile(_ oldName: String, _ newName: String) + { + try! filemgr.moveItem(at: currentDir.appendingPathComponent(oldName), + to: currentDir.appendingPathComponent(newName)) + buildFileList() + } -privatefuncbuildFileList() -{ -currentDirList=[] -currentFileList=[] -letrawFileList=try!filemgr.contentsOfDirectory(at:currentDir, -includingPropertiesForKeys:[URLResourceKey.isDirectoryKey]) -forrawFileinrawFileList{ -varisDir:ObjCBool=false -filemgr.fileExists(atPath:rawFile.path,isDirectory:&isDir) -ifisDir.boolValue{ -currentDirList.append(rawFile.lastPathComponent) -}else{ -currentFileList.append(rawFile.lastPathComponent) -} -} -} + private func buildFileList() + { + currentDirList = [] + currentFileList = [] + let rawFileList = try! filemgr.contentsOfDirectory(at: currentDir, + includingPropertiesForKeys: [URLResourceKey.isDirectoryKey]) + for rawFile in rawFileList { + var isDir: ObjCBool = false + filemgr.fileExists(atPath: rawFile.path, isDirectory: &isDir) + if isDir.boolValue { + currentDirList.append(rawFile.lastPathComponent) + } else { + currentFileList.append(rawFile.lastPathComponent) + } + } + } -init() -{ -baseLocalDocPath=filemgr.urls(for:.documentDirectory,in:.userDomainMask)[0] -localDir=baseLocalDocPath -letcloudUrl=filemgr.url(forUbiquityContainerIdentifier:nil) -baseCloudDocPath=(cloudUrl==nil)?nil:cloudUrl?.appendingPathComponent("Documents") -cloudDir=baseCloudDocPath -buildFileList() -} + init() + { + baseLocalDocPath = filemgr.urls(for: .documentDirectory, in: .userDomainMask)[0] + localDir = baseLocalDocPath + + let cloudUrl = filemgr.url(forUbiquityContainerIdentifier: nil) + baseCloudDocPath = (cloudUrl == nil) ? nil : cloudUrl?.appendingPathComponent("Documents") + cloudDir = baseCloudDocPath + buildFileList() + } } -classFileManagerController:UITableViewController,actionsControlDelegate +class FileManagerController : UITableViewController, FileActionsControlDelegate { -//Housekeepingvariables -privatevarfileData=FileStorage() -privatevarselectedRow:IndexPath? + // Housekeeping variables + private var fileData = FileStorage() + private var selectedRow : IndexPath? -//selectStorageisonlyenabledwheniCloudisactive -@IBOutletweakvarbuttonSelectStorage:UIBarButtonItem! -overridefuncviewDidLoad() -{ -super.viewDidLoad() -buttonSelectStorage.isEnabled=fileData.iCloudEnabled() -} + // selectStorage is only enabled when iCloud is active + @IBOutlet weak var buttonSelectStorage: UIBarButtonItem! + override func viewDidLoad() + { + super.viewDidLoad() + buttonSelectStorage.isEnabled = fileData.iCloudEnabled() + } -//Tooglebetweenlocalandcloudstorage -@IBActionfuncdoSelectStorage(_sender:UIBarButtonItem) -{ -sender.image=fileData.selectStorage(true)?#imageLiteral(resourceName:"iCloudDrive"):#imageLiteral(resourceName:"iPhone") -reloadData() -self.presentedViewController?.dismiss(animated:true,completion:nil) -} + // Toogle between local and cloud storage + @IBAction func doSelectStorage(_ sender: UIBarButtonItem) + { + sender.image = fileData.selectStorage(true) ? #imageLiteral(resourceName: "iCloudDrive") : #imageLiteral(resourceName: "iPhone") + reloadData() + self.presentedViewController?.dismiss(animated: true, completion: nil) + } -//Laststopbeforedisplayingpopover -overridefuncprepare(forsegue:UIStoryboardSegue,sender:Any?) -{ -ifsegue.identifier=="showActions"{ -letvc=segue.destinationas!FileManagerActions -vc.delegate=self -vc.inFileSelect=(selectedRow!=nil) -vc.inSubDirectory=fileData.isSubDirectory() -vc.useCloud=fileData.iCloudEnabled() -} -} + // Last stop before displaying popover + override func prepare(for segue: UIStoryboardSegue, sender: Any?) + { + if segue.identifier == "showActions" { + let vc = segue.destination as! FileManagerActions + vc.delegate = self + vc.inFileSelect = (selectedRow != nil) + vc.inSubDirectory = fileData.isSubDirectory() + vc.useCloud = fileData.iCloudEnabled() + } + } -funcactionOpen() -{ -ifselectedRow!=nil{ -letcurrentCell=tableView.cellForRow(at:selectedRow!)as!FileManagerCell -ifcurrentCell.isDirectory{ -fileData.enterDirectory(currentCell.fileName) -reloadData() -}else{ -//JIXdelegatetoDocument -} -} -} + func actionOpen() + { + if selectedRow != nil { + let currentCell = tableView.cellForRow(at: selectedRow!) as! FileManagerCell + if currentCell.isDirectory { + fileData.enterDirectory(currentCell.fileName) + reloadData() + } else { + // JIX delegate to Document + } + } + } -funcactionDelete() -{ -ifselectedRow!=nil{ -letcurrentCell=self.tableView.cellForRow(at:selectedRow!)as!FileManagerCell -fileData.deleteFileDirectory(currentCell.fileName) -reloadData() -} -} + func actionDelete() + { + if selectedRow != nil { + let currentCell = self.tableView.cellForRow(at: selectedRow!) as! FileManagerCell + fileData.deleteFileDirectory(currentCell.fileName) + reloadData() + } + } -funcactionRename(_name:String) -{ -ifselectedRow!=nil{ -letcurrentCell=tableView.cellForRow(at:selectedRow!)as!FileManagerCell -fileData.renameFile(currentCell.fileName,name) -reloadData() -} -} + func actionRename(_ name : String) + { + if selectedRow != nil { + let currentCell = tableView.cellForRow(at: selectedRow!) as! FileManagerCell + fileData.renameFile(currentCell.fileName, name) + reloadData() + } + } -funcactionUploadDownload() -{ -ifselectedRow!=nil{ -letcurrentCell=self.tableView.cellForRow(at:selectedRow!)as!FileManagerCell -fileData.copyFile(currentCell.fileName) -reloadData() -} -} + func actionUploadDownload() + { + if selectedRow != nil { + let currentCell = self.tableView.cellForRow(at: selectedRow!) as! FileManagerCell + fileData.copyFile(currentCell.fileName) + reloadData() + } + } -funcactionLevelUp() -{ -fileData.leaveDirectory() -reloadData() -} + func actionLevelUp() + { + fileData.leaveDirectory() + reloadData() + } -funcactionCreateDirectory(_name:String) -{ -fileData.createDirectory(name) -reloadData() -} + func actionCreateDirectory(_ name : String) + { + fileData.createDirectory(name) + reloadData() + } -//Tablehandlingfunctions -overridefuncnumberOfSections(intableView:UITableView)->Int -{ -return1 -} + // Table handling functions + override func numberOfSections(in tableView: UITableView) -> Int + { + return 1 + } -overridefunctableView(_tableView:UITableView,numberOfRowsInSectionsection:Int)->Int -{ -returnfileData.currentDirList.count+fileData.currentFileList.count -} + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int + { + return fileData.currentDirList.count + fileData.currentFileList.count + } -overridefunctableView(_tableView:UITableView,cellForRowAtindexPath:IndexPath)->UITableViewCell -{ -letcell=self.tableView.dequeueReusableCell(withIdentifier:"fileEntry",for:indexPath)as!FileManagerCell -letrow=indexPath.row - -ifrow<fileData.currentDirList.count{ -cell.fileName=fileData.currentDirList[row] -cell.fileLabel.text=cell.fileName+"/" -cell.isDirectory=true -}else{ -letinx=row-fileData.currentDirList.count -cell.fileName=fileData.currentFileList[inx] -cell.fileLabel.text=cell.fileName -cell.isDirectory=false -} -returncell -} + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell + { + let cell = self.tableView.dequeueReusableCell(withIdentifier: "fileEntry", for: indexPath) as! FileManagerCell + let row = indexPath.row + if row < fileData.currentDirList.count { + cell.fileName = fileData.currentDirList[row] + cell.fileLabel.text = cell.fileName + "/" + cell.isDirectory = true + } else { + let inx = row - fileData.currentDirList.count + cell.fileName = fileData.currentFileList[inx] + cell.fileLabel.text = cell.fileName + cell.isDirectory = false + } + return cell + } -//Selectarow(file)andshowactions -overridefunctableView(_tableView:UITableView,didSelectRowAtindexPath:IndexPath) -{ -selectedRow=indexPath -performSegue(withIdentifier:"showActions",sender:self) -} + // Select a row (file) and show actions + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) + { + selectedRow = indexPath + performSegue(withIdentifier: "showActions", sender: self) + } -//Supportfunction -funcreloadData() -{ -selectedRow=nil -tableView.reloadData() -} + + // Support function + func reloadData() + { + selectedRow = nil + tableView.reloadData() + } } -//Spaceholderforextrainformationneededtodotherightthingforeachaction -classFileManagerCell:UITableViewCell{ +// Space holder for extra information needed to do the right thing for each action +class FileManagerCell: UITableViewCell { -@IBOutletweakvarfileLabel:UILabel! -varisDirectory:Bool=false -varfileName:String="" + @IBOutlet weak var fileLabel: UILabel! + var isDirectory : Bool = false + var fileName : String = "" } -//Protocolforactionpopovercallback -protocolactionsControlDelegate +// Protocol for action popover callback +protocol FileActionsControlDelegate { -funcactionOpen() -funcactionDelete() -funcactionRename(_name:String) -funcactionUploadDownload() -funcactionLevelUp() -funcactionCreateDirectory(_name:String) + func actionOpen() + func actionDelete() + func actionRename(_ name : String) + func actionUploadDownload() + func actionLevelUp() + func actionCreateDirectory(_ name : String) } -//Actionpopoverdialog -classFileManagerActions:UITableViewController +// Action popover dialog +class FileManagerActions : UITableViewController { -//Pointertocallbackclass -vardelegate:actionsControlDelegate? -varinSubDirectory:Bool=false -varinFileSelect:Bool=false -varuseCloud:Bool=false - -//Callingclassmightenable/disableeachbutton -@IBOutletweakvarbuttonUploadDownload:UIButton! -@IBOutletweakvarbuttonDelete:UIButton! -@IBOutletweakvarbuttonOpen:UIButton! -@IBOutletweakvarbuttonRename:UIButton! -@IBOutletweakvarbuttonLevelUp:UIButton! - - -//Actions -@IBActionfuncdoOpen(_sender:UIButton) -{ -delegate?.actionOpen() -dismiss(animated:false) -} + // Pointer to callback class + var delegate : FileActionsControlDelegate? + var inSubDirectory : Bool = false + var inFileSelect : Bool = false + var useCloud : Bool = false + // Calling class might enable/disable each button + @IBOutlet weak var buttonUploadDownload: UIButton! + @IBOutlet weak var buttonDelete: UIButton! + @IBOutlet weak var buttonOpen: UIButton! + @IBOutlet weak var buttonRename: UIButton! + @IBOutlet weak var buttonLevelUp: UIButton! -@IBActionfuncdoDelete(_sender:UIButton) -{ -delegate?.actionDelete() -dismiss(animated:false) -} + // Actions + @IBAction func doOpen(_ sender: UIButton) + { + delegate?.actionOpen() + dismiss(animated: false) + } -@IBActionfuncdoUploadDownload(_sender:UIButton) -{ -delegate?.actionUploadDownload() -dismiss(animated:false) -} + @IBAction func doDelete(_ sender: UIButton) + { + delegate?.actionDelete() + dismiss(animated: false) + } -@IBActionfuncdoLevelUp(_sender:UIButton) -{ -delegate?.actionLevelUp() -dismiss(animated:false) -} + @IBAction func doUploadDownload(_ sender: UIButton) + { + delegate?.actionUploadDownload() + dismiss(animated: false) + } -overridefuncviewDidLoad() -{ -super.viewDidLoad() -buttonLevelUp.isEnabled=inSubDirectory -buttonDelete.isEnabled=inFileSelect -buttonOpen.isEnabled=inFileSelect -buttonRename.isEnabled=inFileSelect -buttonUploadDownload.isEnabled=(inFileSelect&&useCloud) -} + @IBAction func doLevelUp(_ sender: UIButton) + { + delegate?.actionLevelUp() + dismiss(animated: false) + } -//Laststopbeforedisplayingpopover -overridefuncprepare(forsegue:UIStoryboardSegue,sender:Any?) -{ -letvc=segue.destinationas!setNameAction -vc.delegate=self.delegate -vc.protocolActionToPerform=(segue.identifier=="showRename")?0:1 -} + override func viewDidLoad() + { + super.viewDidLoad() + buttonLevelUp.isEnabled = inSubDirectory + buttonDelete.isEnabled = inFileSelect + buttonOpen.isEnabled = inFileSelect + buttonRename.isEnabled = inFileSelect + buttonUploadDownload.isEnabled = (inFileSelect && useCloud) + } + + + + // Last stop before displaying popover + override func prepare(for segue: UIStoryboardSegue, sender: Any?) + { + let vc = segue.destination as! setNameAction + vc.delegateFile = self.delegate + vc.protocolActionToPerform = (segue.identifier == "showRename") ? 0 : 1 + } } -//Actionpopoverdialog -classsetNameAction:UIViewController +// Action popover dialog +class setNameAction : UIViewController { -//Pointertocallbackclass -vardelegate:actionsControlDelegate? -varprotocolActionToPerform:Int=-1 + // Pointer to callback class + var delegateFile : FileActionsControlDelegate? + var delegateDoc : DocumentActionsControlDelegate? + var protocolActionToPerform : Int = -1 -//Callingclassmightenable/disableeachbutton -@IBOutletweakvareditText:UITextField! + // Calling class might enable/disable each button + @IBOutlet weak var editText: UITextField! -@IBActionfuncdoOK(_sender:UIButton) -{ -print("checking\(protocolActionToPerform)") -switchprotocolActionToPerform -{ -case0: -print("runrenameDir") -delegate?.actionRename(editText.text!) -case1: -print("runcreateDir") -delegate?.actionCreateDirectory(editText.text!) -default: -break -} -dismiss(animated:false) -} + @IBAction func doOK(_ sender: UIButton) + { + switch protocolActionToPerform + { + case 0: // renameDir + delegateFile?.actionRename(editText.text!) + case 1: // createDir + delegateFile?.actionCreateDirectory(editText.text!) + case 2: // New + delegateDoc?.actionNew(editText.text!) + case 3: // SaveAs + delegateDoc?.actionSaveAs(editText.text!) + default: + break + } + dismiss(animated: false) + } -overridefuncviewDidLoad() -{ -super.viewDidLoad() -} + override func viewDidLoad() + { + super.viewDidLoad() + } } diff --git a/ios/experimental/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard b/ios/experimental/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard index 0530cf99a2ce..eb059f98a062 100755 --- a/ios/experimental/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard +++ b/ios/experimental/LibreOfficeLight/LibreOfficeLight/en.lproj/Main.storyboard @@ -26,27 +26,19 @@ </view> <toolbarItems/> <navigationItem key="navigationItem" title="Document" id="5c6-32-T4J"> - <barButtonItem key="leftBarButtonItem" image="menu" id="fdq-Uw-536"> + <barButtonItem key="leftBarButtonItem" image="menu" id="fdq-Uw-536"/> + <barButtonItem key="rightBarButtonItem" systemItem="action" id="BNq-ol-ZVK"> <connections> - <action selector="doMenu:" destination="vXZ-lx-hvc" id="sJP-Fp-Kn2"/> + <segue destination="IER-X5-Ax8" kind="popoverPresentation" identifier="showActions" popoverAnchorBarButtonItem="BNq-ol-ZVK" id="xmZ-1A-ZrW"> + <popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/> + </segue> </connections> </barButtonItem> - <rightBarButtonItems> - <barButtonItem systemItem="action" id="BNq-ol-ZVK"> - <connections> - <segue destination="IER-X5-Ax8" kind="popoverPresentation" identifier="doShowActions" popoverAnchorBarButtonItem="BNq-ol-ZVK" id="xmZ-1A-ZrW"> - <popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/> - </segue> - </connections> - </barButtonItem> - <barButtonItem title="Item" id="0Cf-rp-1Gn"> - <connections> - <segue destination="cip-1Z-62J" kind="show" id="0sd-5x-euH"/> - </connections> - </barButtonItem> - </rightBarButtonItems> </navigationItem> <simulatedToolbarMetrics key="simulatedBottomBarMetrics"/> + <connections> + <segue destination="cip-1Z-62J" kind="show" identifier="showFileManager" id="0PG-d7-Fy1"/> + </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/> </objects> @@ -65,7 +57,7 @@ <rect key="frame" x="0.0" y="28" width="768" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="kKu-xM-S1e" id="80i-6K-kty"> - <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/> + <rect key="frame" x="0.0" y="0.0" width="768" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="fileEntry" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vlx-gc-YQQ"> @@ -142,7 +134,7 @@ <rect key="frame" x="0.0" y="0.0" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VuG-w2-cW6" id="8SA-cA-5eZ"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZSm-By-dJs"> @@ -160,7 +152,7 @@ <rect key="frame" x="0.0" y="30" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="L5l-rq-TxW" id="dmK-Lh-hje"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IQ3-hK-KmM"> @@ -178,7 +170,7 @@ <rect key="frame" x="0.0" y="60" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="gCu-Su-BAB" id="P2T-Nb-OqI"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BSN-dd-e84"> @@ -196,7 +188,7 @@ <rect key="frame" x="0.0" y="90" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="b9s-rz-SjN" id="NVs-9k-H8m"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Rk-LW-Ub9"> @@ -216,7 +208,7 @@ <rect key="frame" x="0.0" y="120" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="bzW-XI-AgR" id="z9x-qQ-lou"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fNi-5u-PqA"> @@ -234,7 +226,7 @@ <rect key="frame" x="0.0" y="150" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1ne-Jo-yKA" id="qmx-Us-SWx"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pir-sf-icw"> @@ -570,7 +562,7 @@ <!--Document Actions--> <scene sceneID="U7J-9A-X5o"> <objects> - <tableViewController autoresizesArchivedViewToFullSize="NO" title="Document Actions" modalTransitionStyle="crossDissolve" modalPresentationStyle="overCurrentContext" clearsSelectionOnViewWillAppear="NO" id="IER-X5-Ax8" customClass="DocumentActions" customModule="LibreOfficeLight" customModuleProvider="target" sceneMemberID="viewController"> + <tableViewController autoresizesArchivedViewToFullSize="NO" title="Document Actions" automaticallyAdjustsScrollViewInsets="NO" modalTransitionStyle="crossDissolve" modalPresentationStyle="overCurrentContext" clearsSelectionOnViewWillAppear="NO" id="IER-X5-Ax8" customClass="DocumentActions" customModule="LibreOfficeLight" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="30" sectionHeaderHeight="28" sectionFooterHeight="28" id="RqF-IL-YJc"> <rect key="frame" x="0.0" y="0.0" width="134" height="210"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/> @@ -582,7 +574,7 @@ <rect key="frame" x="0.0" y="0.0" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KLS-lN-QYa" id="dA0-Ji-bxj"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mCx-kB-iUI"> @@ -590,7 +582,9 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="New"/> <connections> - <action selector="doNew:" destination="IER-X5-Ax8" eventType="touchUpInside" id="nAN-4l-w68"/> + <segue destination="99b-cf-b84" kind="popoverPresentation" identifier="showNew" popoverAnchorView="mCx-kB-iUI" id="NIs-pA-xdK"> + <popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/> + </segue> </connections> </button> </subviews> @@ -600,7 +594,7 @@ <rect key="frame" x="0.0" y="30" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VNE-JL-Lw0" id="EB2-HA-y79"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="myk-zs-md7"> @@ -608,7 +602,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="Open..."/> <connections> - <action selector="doOpen:" destination="IER-X5-Ax8" eventType="touchUpInside" id="2AU-aR-NF4"/> + <action selector="doOpen:" destination="IER-X5-Ax8" eventType="touchUpInside" id="Nk2-o7-3r9"/> </connections> </button> </subviews> @@ -618,7 +612,7 @@ <rect key="frame" x="0.0" y="60" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mPa-wa-TDO" id="jhW-pd-Qkl"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Iva-rO-9V3"> @@ -626,7 +620,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="Delete..."/> <connections> - <action selector="doDelete:" destination="IER-X5-Ax8" eventType="touchUpInside" id="mFt-G6-sGA"/> + <action selector="doDelete:" destination="IER-X5-Ax8" eventType="touchUpInside" id="WhW-7L-FOo"/> </connections> </button> </subviews> @@ -636,7 +630,7 @@ <rect key="frame" x="0.0" y="90" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XW7-H5-0ob" id="lJN-OL-mO8"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b90-ja-Wm0"> @@ -644,8 +638,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="Save"/> <connections> - <action selector="doOpen:" destination="IER-X5-Ax8" eventType="touchUpInside" id="3N4-Kv-vVS"/> - <action selector="doSave:" destination="IER-X5-Ax8" eventType="touchUpInside" id="rsu-KH-DDF"/> + <action selector="doSave:" destination="IER-X5-Ax8" eventType="touchUpInside" id="7Uc-hy-ogX"/> </connections> </button> </subviews> @@ -655,7 +648,7 @@ <rect key="frame" x="0.0" y="120" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fqs-uC-KiW" id="nT7-Ly-JW5"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ioJ-xc-RrS"> @@ -663,7 +656,9 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="Save as..."/> <connections> - <action selector="doOpen:" destination="IER-X5-Ax8" eventType="touchUpInside" id="IhZ-cb-cgC"/> + <segue destination="99b-cf-b84" kind="popoverPresentation" identifier="showSaveAs" popoverAnchorView="ioJ-xc-RrS" id="etF-bX-EXf"> + <popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/> + </segue> </connections> </button> </subviews> @@ -673,7 +668,7 @@ <rect key="frame" x="0.0" y="150" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="GmK-gj-GYu" id="3OK-Zz-mqN"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="apE-3B-lUt"> @@ -681,8 +676,7 @@ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="PDF"/> <connections> - <action selector="doOpen:" destination="IER-X5-Ax8" eventType="touchUpInside" id="utd-hj-l3F"/> - <action selector="doPDF:" destination="IER-X5-Ax8" eventType="touchUpInside" id="fm0-3u-e0T"/> + <action selector="doPDF:" destination="IER-X5-Ax8" eventType="touchUpInside" id="ATe-5t-jab"/> </connections> </button> </subviews> @@ -692,15 +686,15 @@ <rect key="frame" x="0.0" y="180" width="134" height="30"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="1ly-sz-g0x" id="wVi-tX-eKD"> - <rect key="frame" x="0.0" y="0.0" width="134" height="29.5"/> + <rect key="frame" x="0.0" y="0.0" width="134" height="29"/> <autoresizingMask key="autoresizingMask"/> <subviews> - <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="516-b0-K4N"> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="516-b0-K4N" userLabel="Button Print"> <rect key="frame" x="8" y="-1" width="118" height="30"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <state key="normal" title="Print..."/> <connections> - <action selector="doOpen:" destination="IER-X5-Ax8" eventType="touchUpInside" id="tqe-2K-EJc"/> + <action selector="doPrint:" destination="IER-X5-Ax8" eventType="touchUpInside" id="07n-Ba-Tp9"/> </connections> </button> </subviews> @@ -714,12 +708,22 @@ <outlet property="delegate" destination="IER-X5-Ax8" id="sji-7W-aF0"/> </connections> </tableView> + <extendedEdge key="edgesForExtendedLayout"/> <value key="contentSizeForViewInPopover" type="size" width="200" height="230"/> <nil key="simulatedStatusBarMetrics"/> <nil key="simulatedTopBarMetrics"/> <nil key="simulatedBottomBarMetrics"/> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <size key="freeformSize" width="134" height="210"/> + <connections> + <outlet property="buttonDelete" destination="Iva-rO-9V3" id="i8x-8H-YoE"/> + <outlet property="buttonNew" destination="mCx-kB-iUI" id="70b-Qo-y3M"/> + <outlet property="buttonOpen" destination="myk-zs-md7" id="XLW-EG-UgD"/> + <outlet property="buttonPDF" destination="apE-3B-lUt" id="j3U-Dx-UxJ"/> + <outlet property="buttonPrint" destination="516-b0-K4N" id="WL3-KB-jS1"/> + <outlet property="buttonSave" destination="b90-ja-Wm0" id="GPH-29-EFu"/> + <outlet property="buttonSaveAs" destination="ioJ-xc-RrS" id="Ndn-1D-CcB"/> + </connections> </tableViewController> <placeholder placeholderIdentifier="IBFirstResponder" id="D6j-Ov-CSK" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> @@ -738,7 +742,7 @@ <image name="saveas" width="20" height="20"/> </resources> <inferredMetricsTieBreakers> - <segue reference="0sd-5x-euH"/> - <segue reference="nga-Gl-Vki"/> + <segue reference="0PG-d7-Fy1"/> + <segue reference="etF-bX-EXf"/> </inferredMetricsTieBreakers> </document> |