diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index c71a820..c54dcec 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -248,6 +248,8 @@ C4F780CE25D80B75000DBC97 /* LocalNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = C474B00524C0E98C00066A22 /* LocalNotification.swift */; }; C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */; }; C4FBFC532616485F00CDB8E1 /* PhpVersionDetectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FBFC512616485F00CDB8E1 /* PhpVersionDetectionTest.swift */; }; + C4FE011128084FC200D1DE6D /* SelectionVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FE011028084FC200D1DE6D /* SelectionVC.swift */; }; + C4FE011228084FC200D1DE6D /* SelectionVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FE011028084FC200D1DE6D /* SelectionVC.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -406,6 +408,7 @@ C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtension.swift; sourceTree = ""; }; C4F8C0A522D4FA41002EFE61 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; C4FBFC512616485F00CDB8E1 /* PhpVersionDetectionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhpVersionDetectionTest.swift; sourceTree = ""; }; + C4FE011028084FC200D1DE6D /* SelectionVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionVC.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -673,6 +676,7 @@ C464ADAE275A7A69003FCD53 /* DomainListVC.swift */, C41E87192763D42300161EE0 /* DomainListVC+ContextMenu.swift */, C41CA5EC2774F8EE00A2C80E /* DomainListVC+Actions.swift */, + C4FE011028084FC200D1DE6D /* SelectionVC.swift */, C4930849279F331F009C240B /* AddSiteVC.swift */, ); path = DomainList; @@ -1150,6 +1154,7 @@ C4927F0B27B2DFC200C55AFD /* Errors.swift in Sources */, C4B5853E2770FE3900DA4FBE /* Paths.swift in Sources */, C41C1B4B22B019FF00E7CF16 /* ActivePhpInstallation.swift in Sources */, + C4FE011128084FC200D1DE6D /* SelectionVC.swift in Sources */, C44CCD4027AFE2FC00CE40E5 /* AlertableError.swift in Sources */, C4188989275FE8CB001EF227 /* Filesystem.swift in Sources */, C4B97B7B275CF20A003F3378 /* App+GlobalHotkey.swift in Sources */, @@ -1196,6 +1201,7 @@ 54FCFD2B276C8AA4004CE748 /* CheckboxPreferenceView.swift in Sources */, C415D3B82770F294005EF286 /* Actions.swift in Sources */, 54B48B60275F66AE006D90C5 /* Application.swift in Sources */, + C4FE011228084FC200D1DE6D /* SelectionVC.swift in Sources */, C4F780C825D80B75000DBC97 /* DateExtension.swift in Sources */, C493084B279F331F009C240B /* AddSiteVC.swift in Sources */, C4D9ADC0277610E1007277F4 /* PhpSwitcher.swift in Sources */, diff --git a/phpmon/Domain/App/Base.lproj/Main.storyboard b/phpmon/Domain/App/Base.lproj/Main.storyboard index 6c6be75..e0f1b46 100644 --- a/phpmon/Domain/App/Base.lproj/Main.storyboard +++ b/phpmon/Domain/App/Base.lproj/Main.storyboard @@ -487,7 +487,7 @@ - + @@ -533,7 +533,7 @@ Gw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + If you would like to link a folder, choose "Create a Link". 
If you would like to proxy an IP address, you can "Create a Proxy". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phpmon/Domain/DomainList/DomainListWC.swift b/phpmon/Domain/DomainList/DomainListWC.swift index cdcdb3a..b708c96 100644 --- a/phpmon/Domain/DomainList/DomainListWC.swift +++ b/phpmon/Domain/DomainList/DomainListWC.swift @@ -55,11 +55,23 @@ class DomainListWC: PMWindowController, NSSearchFieldDelegate, NSToolbarDelegate } @IBAction func pressedAddLink(_ sender: Any?) { - selectFolder() + showSelectionWindow() } // MARK: - Add a new site + func showSelectionWindow() { + let storyboard = NSStoryboard(name: "Main", bundle : nil) + + let windowController = storyboard.instantiateController( + withIdentifier: "showSelectionWindow" + ) as! NSWindowController + + // let viewController = windowController.window!.contentViewController! + + self.window?.beginSheet(windowController.window!) + } + func selectFolder() { let dialog = NSOpenPanel() dialog.message = "domain_list.add.modal_description".localized diff --git a/phpmon/Domain/DomainList/SelectionVC.swift b/phpmon/Domain/DomainList/SelectionVC.swift new file mode 100644 index 0000000..d57b268 --- /dev/null +++ b/phpmon/Domain/DomainList/SelectionVC.swift @@ -0,0 +1,44 @@ +// +// SelectionVC.swift +// PHP Monitor +// +// Created by Nico Verbruggen on 14/04/2022. +// Copyright © 2022 Nico Verbruggen. All rights reserved. +// + +import Foundation +import Cocoa + +class SelectionVC: NSViewController { + + @IBOutlet weak var buttonCreateLink: NSButton! + @IBOutlet weak var buttonCreateProxy: NSButton! + @IBOutlet weak var buttonCancel: NSButton! + + override func viewDidLoad() { + super.viewDidLoad() + loadStaticLocalisedStrings() + } + + override func viewDidAppear() { + view.window?.makeFirstResponder(buttonCreateLink) + } + + private func dismissView(outcome: NSApplication.ModalResponse) { + guard let window = self.view.window, let parent = window.sheetParent else { return } + parent.endSheet(window, returnCode: outcome) + } + + // MARK: - Localisation + + func loadStaticLocalisedStrings() { + // TODO + } + + // MARK: - Outlet Interactions + + @IBAction func pressedCancel(_ sender: Any) { + self.dismissView(outcome: .cancel) + } + +}