Browse Source

Distinguish between one / double click.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
8335d1c4d3
  1. 24
      Clocker/Panel/UI/TimezoneCellView.swift

24
Clocker/Panel/UI/TimezoneCellView.swift

@ -198,16 +198,20 @@ class TimezoneCellView: NSTableCellView {
Logger.log(object: nil, for: "Open Extra Options") Logger.log(object: nil, for: "Open Extra Options")
} }
override func mouseDown(with _: NSEvent) { override func mouseDown(with event: NSEvent) {
// Text is copied in the following format: Chicago - 1625185925 if (event.clickCount == 1) {
let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)" // Text is copied in the following format: Chicago - 1625185925
let pasteboard = NSPasteboard.general let clipboardCopy = "\(customName.stringValue) - \(time.stringValue)"
pasteboard.declareTypes([.string], owner: nil) let pasteboard = NSPasteboard.general
pasteboard.setString(clipboardCopy, forType: .string) pasteboard.declareTypes([.string], owner: nil)
pasteboard.setString(clipboardCopy, forType: .string)
window?.contentView?.makeToast("Copied to Clipboard".localized())
window?.contentView?.makeToast("Copied to Clipboard".localized())
window?.endEditing(for: nil)
window?.endEditing(for: nil)
} else if (event.clickCount == 2) {
//TODO: Favourite this timezone
}
} }
override func rightMouseDown(with event: NSEvent) { override func rightMouseDown(with event: NSEvent) {

Loading…
Cancel
Save