Commit Graph

30 Commits

Author SHA1 Message Date
Allan Odgaard
b0228b9aff Remove redundant target setting from file browser context menu
We set target for all items in the menu during post-processing.
2020-06-09 16:48:37 +07:00
Allan Odgaard
ad1cc8abd8 Deliver all NSUserDefaultsDidChangeNotification in main queue
This is easier than ensuring that we do not update user defaults from a background thread.
2020-05-14 09:52:38 +07:00
Allan Odgaard
17aada3471 Let FileItemTableCellView give access to its close button via a property
This is simpler than having to proxy the action (and target) for the button.

Previously the button was created on demand, but now that we always create it (and hide it when not required), we might as well have users set action and target directly on the button instance.
2020-04-28 09:52:10 +07:00
Allan Odgaard
4e0cb76985 fixup! Convert to reference URL for file browser’s “Select Current Document” 2020-04-18 15:22:13 +07:00
Allan Odgaard
3668245163 Convert to reference URL for file browser’s “Select Current Document”
This fixes problems with symbolic links, for example file browser may show contents of /private/tmp when we ask to select /tmp/foo.txt. Comparing file path URLs will fail even though /tmp is a symbolic link for /private/tmp.

Note that this fix only works for when the current document is already part of the items in the file browser, as we still store pending URLs to select as file path URLs.
2020-04-14 12:58:10 +07:00
Allan Odgaard
c682655d4a Use readObjectsForClasses: with NSURL instead of NSFilenamesPboardType 2020-04-14 12:58:10 +07:00
Allan Odgaard
969c541202 Fix copying files from file browser and pasting in Terminal.app
Terminal.app is peculiar about what it expects to be on the clipboard. If we only write URLs like this:

	[pboard clearContents];
	[pboard writeObjects:urls];

Then it will not paste anything. There *must* be string fallbacks for it to support paste. But if we also write an array of strings like this:

	[pboard clearContents];
	[pboard writeObjects:urls];
	[pboard writeObjects:[urls valueForKeyPath:@"path.lastPathComponent"]];

Then it will paste both the URLs and the strings, but where the URLs will be space-separated, the strings will not. If instead we write a single string fallback only for the first item, like this:

	[pboard clearContents];
	[pboard writeObjects:urls];
	[pboard setString:@"whatever" forType:NSPasteboardTypeString];

Then it will paste the URLs and ignore the string fallback for the first URL.
2020-04-14 12:58:10 +07:00
Allan Odgaard
4a1e9113f3 Make file browser state API wrap the system UI restoration methods
This avoids duplicating code, although for compatibility with old saved state, we still can restore state from a dictionary.
2020-04-14 12:58:10 +07:00
Allan Odgaard
61ec959b37 Change data type of file browser state from dictionary to opaque object
This gives us more flexibility in how we wish to represent the state, although the state should be a property list object.
2020-04-14 12:58:10 +07:00
Allan Odgaard
4013020b14 Use dot syntax for NSNumber’s boolValue property 2020-04-14 12:58:10 +07:00
Allan Odgaard
0545f02620 Add support for NSRestorableState to FileBrowserViewController 2020-03-13 16:39:15 +07:00
Allan Odgaard
2410ba345f Refactoring: Move logic from FileBrowserView → FileBrowserViewController
This is to make it easier to support Cocoa’s native resume feature, as for this, we should keep all state in the controller, but also, the controller should be able to know if view state changes, for example expanded/selected items in the outline view, which require our controller to be the delegate.
2020-03-11 21:22:25 +07:00
Allan Odgaard
fa9e690309 Formatting: Align closing braces 2020-03-11 14:08:53 +07:00
Allan Odgaard
3ca83220bb Add URL property to FileBrowserViewController
This should be used instead of path, as we may display non-file URLs.
2020-03-11 13:35:04 +07:00
Allan Odgaard
4b4e5fca8b Remove code required for compatibility with 10.10 and earlier 2019-10-07 21:28:16 +02:00
Allan Odgaard
5e96d41a3d Look for numeric prefix when duplicating a file and increase it if found
For example if we have a directory with files named 001-foo.txt, 002-bar.txt, and 003-fud.txt, duplicating one of these will result in the duplicate starting with 004.

Also improve support for finding dates in file names being duplicated. Previously we only looked for YYYY-MM-DD but now we also support YYYY_MM_DD and YYYYMMDD. If a date is found in the file name being duplicated, it is replaced with the current date in the duplicate.
2019-08-08 21:37:42 +02:00
Allan Odgaard
454b1b4644 Use availableTypeFromArray: instead of checking types array directly 2019-08-02 21:06:21 +02:00
Allan Odgaard
8f685ff25c Use std::clamp instead of oak::cap (C++17) 2019-08-01 10:23:55 +02:00
Allan Odgaard
11d67f3a22 Avoid NSString’s deprecated percent encoding methods 2019-06-30 10:32:45 +02:00
Allan Odgaard
1ef78b3af7 Rename symbols to what’s expected by the 10.14 SDK 2019-06-29 20:14:15 +02:00
Ronald Wampler
ca80254b80 Refactor finder tags to use catalog colors
Also, reworked the OFBFinderTagsChooser to have a similar look as on 10.14.
2018-12-05 21:16:54 +07:00
Allan Odgaard
42cdb1c430 Add URL escaping for the path component of SCM URLs 2018-11-22 16:24:17 +07:00
Allan Odgaard
60a3690bef Use NSPasteboard’s writeObjects: when copying items from file browser 2018-11-21 16:24:51 +07:00
Allan Odgaard
892fc536f8 Move outlineView:writeItems:toPasteboard: to view controller 2018-11-21 16:24:51 +07:00
Allan Odgaard
b1ae800fdc Show an alert if version control information is unavailable 2018-11-12 19:58:48 +07:00
Allan Odgaard
c21387adfb Selecting file outside project (⌃⌘R) would fail 2018-10-30 18:52:30 +07:00
Allan Odgaard
0d75927528 Update OakFileBrowserDelegate protocol to new file browser controller 2018-10-28 13:36:33 +07:00
Allan Odgaard
10bf1acf78 Use display name instead of localized name for file browser location
The display name includes the “disambiguation suffix” which we set to “disabled” or “no status” for the SCM status file item.
2018-10-28 13:21:19 +07:00
Allan Odgaard
c822943b93 Move OakFileBrowser delegate protocol and constants to new file browser 2018-10-28 13:15:39 +07:00
Allan Odgaard
a304ebe25f Add file browser view controller 2018-10-28 00:28:02 +07:00