|
@@ -65,14 +65,23 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
|
|
self.bookTableView.reloadData()
|
|
self.bookTableView.reloadData()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ func addBookMarkAndEdit(newBookMark:CPDFBookmark) {
|
|
|
|
+ self.reloadData()
|
|
|
|
+ if self.dataSource.contains(newBookMark) {
|
|
|
|
+ if let index = self.dataSource.firstIndex(of: newBookMark) {
|
|
|
|
+ self.selectRow(index: index)
|
|
|
|
+ self.renameBookWithRow(row: index)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
func selectRow(index:NSInteger) {
|
|
func selectRow(index:NSInteger) {
|
|
self.bookTableView.deselectAll(nil)
|
|
self.bookTableView.deselectAll(nil)
|
|
|
|
|
|
- if index > 0 {
|
|
|
|
- var indexSet = IndexSet()
|
|
|
|
- indexSet.insert(index)
|
|
|
|
- self.bookTableView.selectRowIndexes(indexSet, byExtendingSelection: false)
|
|
|
|
- }
|
|
|
|
|
|
+ var indexSet = IndexSet()
|
|
|
|
+ indexSet.insert(index)
|
|
|
|
+ self.bookTableView.selectRowIndexes(indexSet, byExtendingSelection: false)
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
func initNotification() {
|
|
func initNotification() {
|