Skip to content

Commit

Permalink
clear
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Apr 25, 2024
1 parent 4d8d6fd commit 7d07a6c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Binary file modified assets/zh-Hans.lproj/Localizable.strings
Binary file not shown.
24 changes: 21 additions & 3 deletions src/config/dictmanager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct DictManagerView: View {
}
}
VStack {
Button("Import dictionaries") {
Button {
openPanel.allowsMultipleSelection = true
openPanel.canChooseDirectories = false
openPanel.allowedContentTypes = ["dict", "scel", "txt"].map {
Expand All @@ -134,22 +134,40 @@ struct DictManagerView: View {
reloadDicts()
dictManagerSelectedDirectory = openPanel.directoryURL?.localPath()
}
} label: {
Text("Import dictionaries")
}

urlButton(
NSLocalizedString("Sogou Cell Dictionary", comment: ""), "https://pinyin.sogou.com/dict/")

Button("Remove dictionaries") {
Button {
for dict in selectedDicts {
removeFile(dictDir.appendingPathComponent(dict + ".dict"))
}
selectedDicts.removeAll()
reloadDicts()
} label: {
Text("Remove dictionaries")
}.disabled(selectedDicts.isEmpty)

Button("Open dictionary directory") {
Button {
Fcitx.setConfig("fcitx://config/addon/pinyin/clearuserdict", "{}")
} label: {
Text("Clear user data")
}

Button {
Fcitx.setConfig("fcitx://config/addon/pinyin/clearalldict", "{}")
} label: {
Text("Clear all data")
}

Button {
mkdirP(dictPath)
NSWorkspace.shared.open(dictDir)
} label: {
Text("Open dictionary directory")
}
}
}.padding()
Expand Down

0 comments on commit 7d07a6c

Please sign in to comment.