ClientMgr // Allow multiple selection.

This commit is contained in:
ShikiSuen 2022-10-15 14:54:33 +08:00
parent 4b08607608
commit 0926e345a4
6 changed files with 29 additions and 22 deletions

View File

@ -103,31 +103,38 @@ extension CtlClientListMgr {
"Choose the target application bundle.", comment: ""
)
dlgOpenPath.showsResizeIndicator = true
dlgOpenPath.allowsMultipleSelection = true
dlgOpenPath.allowedFileTypes = ["app"]
dlgOpenPath.allowsOtherFileTypes = false
dlgOpenPath.showsHiddenFiles = true
dlgOpenPath.canChooseFiles = true
dlgOpenPath.canChooseDirectories = false
dlgOpenPath.beginSheetModal(for: window) { result in
switch result {
case .OK:
guard let url = dlgOpenPath.url else { return }
var title = NSLocalizedString("The selected item is not a valid macOS application bundle.", comment: "")
let text = NSLocalizedString("Please try again.", comment: "")
guard let bundle = Bundle(url: url) else {
self.callAlert(window, title: title, text: text)
return
}
guard let identifier = bundle.bundleIdentifier else {
self.callAlert(window, title: title, text: text)
return
}
if PrefMgr.shared.clientsIMKTextInputIncapable.contains(identifier) {
title = NSLocalizedString(
"The selected item's identifier is already in the list.", comment: ""
for url in dlgOpenPath.urls {
var title = NSLocalizedString(
"The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier.",
comment: ""
)
self.callAlert(window, title: title)
return
let text = url.path + "\n\n" + NSLocalizedString("Please try again.", comment: "")
guard let bundle = Bundle(url: url) else {
self.callAlert(window, title: title, text: text)
return
}
guard let identifier = bundle.bundleIdentifier else {
self.callAlert(window, title: title, text: text)
return
}
if PrefMgr.shared.clientsIMKTextInputIncapable.contains(identifier) {
title = NSLocalizedString(
"The selected item's identifier is already in the list.", comment: ""
)
self.callAlert(window, title: title, text: identifier + "\n\n" + url.path)
return
}
self.applyNewValue(identifier)
}
self.applyNewValue(identifier)
default: return
}
}

View File

@ -10,7 +10,7 @@
"Add Client" = "Add Client";
"Remove Selected" = "Remove Selected";
"Choose the target application bundle." = "Choose the target application bundle.";
"The selected item is not a valid macOS application bundle." = "The selected item is not a valid macOS application bundle.";
"The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier." = "The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier.";
"Please try again." = "Please try again.";
"The selected item's identifier is already in the list." = "The selected item's identifier is already in the list.";
"Update Check Completed" = "Update Check Completed";

View File

@ -10,7 +10,7 @@
"Add Client" = "Add Client";
"Remove Selected" = "Remove Selected";
"Choose the target application bundle." = "Choose the target application bundle.";
"The selected item is not a valid macOS application bundle." = "The selected item is not a valid macOS application bundle.";
"The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier." = "The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier.";
"Please try again." = "Please try again.";
"The selected item's identifier is already in the list." = "The selected item's identifier is already in the list.";
"Update Check Completed" = "Update Check Completed";

View File

@ -10,7 +10,7 @@
"Add Client" = "入れる";
"Remove Selected" = "外す";
"Choose the target application bundle." = "登録したいアプリのバンドルのお選びを。";
"The selected item is not a valid macOS application bundle." = "今選んだんのは正しい macOS アプリバンドルではないと考えられる。";
"The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier." = "今選んだんのは正しい macOS アプリバンドルではないと考えられる。少なくとも、唯一識別子は検出できぬ。";
"Please try again." = "お選び直しください。";
"The selected item's identifier is already in the list." = "今選んだバンドルの唯一識別子Bundle Identifierは既に登録済みである。";
"Update Check Completed" = "新バージョンチェック完了";

View File

@ -10,7 +10,7 @@
"Add Client" = "登记新客体";
"Remove Selected" = "移除所选条目";
"Choose the target application bundle." = "请选择要登记的应用程式的封包。";
"The selected item is not a valid macOS application bundle." = "当前所选之物并非 macOS 应用程式封包。";
"The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier." = "当前所选之物并非 macOS 应用程式封包至少无法发现其唯一标帜Bundle Identifier。";
"Please try again." = "请重试。";
"The selected item's identifier is already in the list." = "当前所选之封包的唯一标帜Bundle Identifier已被登记。";
"Update Check Completed" = "更新检查完毕";

View File

@ -10,7 +10,7 @@
"Add Client" = "登記新客體";
"Remove Selected" = "移除所選條目";
"Choose the target application bundle." = "請選擇要登記的應用程式的封包。";
"The selected item is not a valid macOS application bundle." = "當前所選之物並非 macOS 應用程式封包。";
"The selected item is not a valid macOS application bundle, nor not having a valid app bundle identifier." = "當前所選之物並非 macOS 應用程式封包至少無法發現其唯一標幟Bundle Identifier。";
"Please try again." = "請重試。";
"The selected item's identifier is already in the list." = "當前所選之封包的唯一標幟Bundle Identifier已被登記。";
"Update Check Completed" = "更新檢查完畢";