|
@@ -7,9 +7,6 @@
|
|
|
|
|
|
import Cocoa
|
|
|
|
|
|
-private let KMLeftSideViewNoteSortTypeKey = "KMLeftSideViewNoteSortTypeKey"
|
|
|
-private let KMLeftSideViewAscendSortBoolKey = "KMLeftSideViewAscendSortBoolKey"
|
|
|
-
|
|
|
@objc protocol KMLeftSideViewControllerDelegate {
|
|
|
@objc optional func controlStateChange(_ obj: KMLeftSideViewController,show:Bool)
|
|
|
@objc optional func enterEditMode(_ obj: KMLeftSideViewController, _ pages: [Int])
|
|
@@ -199,8 +196,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
private let MIN_SIDE_PANE_WIDTH: CGFloat = 270
|
|
|
private let LABEL_COLUMNID = "label"
|
|
|
var foldType: KMFoldAllAnnotationType = .none
|
|
|
- static let noteSortTypeKey = KMLeftSideViewNoteSortTypeKey
|
|
|
- static let ascendSorKey = KMLeftSideViewAscendSortBoolKey
|
|
|
|
|
|
var tocType: KMFoldType = .none
|
|
|
|
|
@@ -417,9 +412,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
self.view.wantsLayer = true
|
|
|
self.view.layer?.backgroundColor = KMAppearance.Layout.l0Color().cgColor
|
|
|
|
|
|
- let sud = UserDefaults.standard
|
|
|
- self.isAscendSort = sud.bool(forKey: KMLeftSideViewAscendSortBoolKey)
|
|
|
-
|
|
|
self.mwcFlags.wholeWordSearch = UserDefaults.standard.integer(forKey: SKWholeWordSearchKey)
|
|
|
self.mwcFlags.caseInsensitiveSearch = UserDefaults.standard.integer(forKey: SKCaseInsensitiveSearchKey)
|
|
|
|
|
@@ -744,30 +736,6 @@ class KMLeftSideViewController: KMSideViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @IBAction @objc func sortTypeAction(_ sender: NSMenuItem) {
|
|
|
- let item = sender
|
|
|
- let tag = item.tag
|
|
|
-
|
|
|
- if (item.state == .on) {
|
|
|
- item.state = .off
|
|
|
- } else {
|
|
|
- item.state = .on
|
|
|
- }
|
|
|
- if (tag == 0) {
|
|
|
- self.noteSortType = .page
|
|
|
- self.sortTypeLabel.stringValue = KMLocalizedString("Page", nil)
|
|
|
- self.sortTypeBox.toolTip = KMLocalizedString("Page", nil)
|
|
|
- } else if (tag == 1) {
|
|
|
- self.noteSortType = .time
|
|
|
- self.sortTypeLabel.stringValue = KMLocalizedString("Time", nil)
|
|
|
- self.sortTypeBox.toolTip = KMLocalizedString("Time", nil)
|
|
|
- }
|
|
|
- UserDefaults.standard.set(self.noteSortType.rawValue, forKey: KMLeftSideViewNoteSortTypeKey)
|
|
|
- UserDefaults.standard.synchronize()
|
|
|
-
|
|
|
- self.annotationSort(sortArray: [])
|
|
|
- }
|
|
|
-
|
|
|
@IBAction func leftSideViewDoneButtonAction(_ sender: AnyObject?) {
|
|
|
let button = sender as? NSButton
|
|
|
let tag = button?.tag ?? 0
|
|
@@ -1026,12 +994,6 @@ extension KMLeftSideViewController {
|
|
|
// self.updateViewButtonState()
|
|
|
// 将事件传递出去
|
|
|
self.delegate?.controlStateChange?(self,show:show)
|
|
|
- if (index != NSNotFound) {
|
|
|
-
|
|
|
- // 记录当前选中
|
|
|
- UserDefaults.standard.set(index, forKey: "KMBOTASelectedIndexKey")
|
|
|
- UserDefaults.standard.synchronize()
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private func getMethodMode(_ type: BotaType) -> KMLeftMethodMode {
|
|
@@ -1071,51 +1033,10 @@ extension KMLeftSideViewController {
|
|
|
|
|
|
//MARK: Cache
|
|
|
extension KMLeftSideViewController {
|
|
|
- func clearAnnotationFilterData() {
|
|
|
- if let _key = self.listView?.document?.documentURL?.path {
|
|
|
- let userDefaults = UserDefaults.standard
|
|
|
- let typeData = try?NSKeyedArchiver.archivedData(withRootObject: [Any](), requiringSecureCoding: false)
|
|
|
- userDefaults.set(typeData, forKey: "KMNoteOutlineFilterSelectArray_Type" + _key)
|
|
|
- let colorData = try?NSKeyedArchiver.archivedData(withRootObject: [Any](), requiringSecureCoding: false)
|
|
|
- userDefaults.set(colorData, forKey: "KMNoteOutlineFilterSelectArray_Color" + _key)
|
|
|
- let authorData = try?NSKeyedArchiver.archivedData(withRootObject: [Any](), requiringSecureCoding: false)
|
|
|
- userDefaults.set(authorData, forKey: "KMNoteOutlineFilterSelectArray_Author" + _key)
|
|
|
- userDefaults.synchronize()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
func clearNotification() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// MARK: - Analytics (埋点)
|
|
|
-
|
|
|
-extension KMLeftSideViewController {
|
|
|
- func trackEvent(type: BotaType) -> Void {
|
|
|
- if (type == .Thumbnail) {
|
|
|
- KMAnalytics.trackEvent(eventName: "Btn_LeftSideBar_Thumbnail", parameters: [
|
|
|
- KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.leftSideBar,
|
|
|
- KMAnalytics.Parameter.labelKey : KMAnalytics.Label.leftSideBar_Btn], platform: .AppCenter, appTarget: .all)
|
|
|
- } else if (type == .Outline) {
|
|
|
- KMAnalytics.trackEvent(eventName: "Btn_LeftSideBar_Outline", parameters: [
|
|
|
- KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.leftSideBar,
|
|
|
- KMAnalytics.Parameter.labelKey : KMAnalytics.Label.leftSideBar_Btn], platform: .AppCenter, appTarget: .all)
|
|
|
- } else if (type == .BookMark) {
|
|
|
- KMAnalytics.trackEvent(eventName: "Btn_LeftSideBar_BookMark", parameters: [
|
|
|
- KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.leftSideBar,
|
|
|
- KMAnalytics.Parameter.labelKey : KMAnalytics.Label.leftSideBar_Btn], platform: .AppCenter, appTarget: .all)
|
|
|
- } else if (type == .Annotation) {
|
|
|
- KMAnalytics.trackEvent(eventName: "Btn_LeftSideBar_Annotation", parameters: [
|
|
|
- KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.leftSideBar,
|
|
|
- KMAnalytics.Parameter.labelKey : KMAnalytics.Label.leftSideBar_Btn], platform: .AppCenter, appTarget: .all)
|
|
|
- } else if (type == .Search) {
|
|
|
- KMAnalytics.trackEvent(eventName: "Btn_LeftSideBar_Search", parameters: [
|
|
|
- KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.leftSideBar,
|
|
|
- KMAnalytics.Parameter.labelKey : KMAnalytics.Label.leftSideBar_Btn], platform: .AppCenter, appTarget: .all)
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// MARK: - Private Methods
|
|
|
|
|
|
extension KMLeftSideViewController {
|