Skip to content

Commit a3a965b

Browse files
More work on Finder tagging
Click the preferences warning, click thru the warning and ALL FINDER TAGS and ALL OM TAGS get merged and from then on, no way to go back, nvALT will use Finder tagging. For debugging purposes, check in AppController.h, set k_FinderTaggingReset to 1 to have your preference for useFinderTagging removed on launch. Quit, and set k_FinderTaggingReset back to 0, before doing anything.
1 parent e86e2a2 commit a3a965b

File tree

24 files changed

+248
-114
lines changed

24 files changed

+248
-114
lines changed

AppController.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,6 @@ void outletObjectAwoke(id sender);
148148
- (IBAction)importNotes:(id)sender;
149149
- (IBAction)switchViewLayout:(id)sender;
150150

151-
- (IBAction)mirrorAllOMToFinder:(id)sender;
152-
153151
- (IBAction)fieldAction:(id)sender;
154152
- (NoteObject*)createNoteIfNecessary;
155153
- (void)searchForString:(NSString*)string;

AppController.m

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
//#define kDefaultMarkupPreviewMode @"markupPreviewMode"
7171
#define kDualFieldHeight 35.0
7272

73+
#define k_FinderTaggingReset 1
7374

7475
NSWindow *normalWindow;
7576
NSInteger ModFlagger;
@@ -94,6 +95,11 @@ + (void)initialize
9495
- (id)init {
9596
self = [super init];
9697
if (self) {
98+
99+
#if k_FinderTaggingReset
100+
[[NSUserDefaults standardUserDefaults]removeObjectForKey:@"UseFinderTags"];
101+
#endif
102+
97103
hasLaunched=NO;
98104

99105
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"ShowDockIcon"]){
@@ -123,7 +129,7 @@ - (id)init {
123129
NSFileManager *fileManager = [NSFileManager defaultManager];
124130

125131

126-
NSString *folder = [[NSFileManager defaultManager] applicationSupportDirectory];
132+
NSString *folder = [fileManager applicationSupportDirectory];
127133

128134
if ([fileManager fileExistsAtPath: folder] == NO)
129135
{
@@ -537,6 +543,7 @@ - (void)applicationDidFinishLaunching:(NSNotification*)aNote {
537543
@selector(removeTableColumn:sender:), //ditto
538544
@selector(setTableColumnsShowPreview:sender:), //when to tell notationcontroller to generate or disable note-body previews
539545
@selector(setConfirmNoteDeletion:sender:), //whether "delete note" should have an ellipsis
546+
@selector(setUseFinderTags:), //whether nvalt should use findertags
540547
@selector(setAutoCompleteSearches:sender:),@selector(setUseETScrollbarsOnLion:sender:), nil]; //when to tell notationcontroller to build its title-prefix connections
541548

542549
[self performSelector:@selector(runDelayedUIActionsAfterLaunch) withObject:nil afterDelay:0.0];
@@ -1113,7 +1120,9 @@ - (void)settingChangedForSelectorString:(NSString*)selectorString {
11131120
if ([prefsController autoCompleteSearches])
11141121
[notationController updateTitlePrefixConnections];
11151122

1116-
}
1123+
}else if ([selectorString isEqualToString:SEL_STR(setUseFinderTags:)]) {
1124+
[notationController mirrorAllOMToFinderTags];
1125+
}
11171126

11181127
}
11191128

@@ -1877,10 +1886,6 @@ - (NoteObject*)createNoteIfNecessary {
18771886
return currentNote;
18781887
}
18791888

1880-
- (IBAction)mirrorAllOMToFinder:(id)sender
1881-
{
1882-
[notationController mirrorAllOMToFinderTags];
1883-
}
18841889

18851890
- (void)restoreListStateUsingPreferences {
18861891
//to be invoked after loading a notationcontroller

English.lproj/NotationPrefsView.nib/designable.nib

Lines changed: 33 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

GlobalPrefs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ BOOL ColorsEqualWith8BitChannels(NSColor *c1, NSColor *c2);
147147
- (void)setSoftTabs:(BOOL)value sender:(id)sender;
148148
- (BOOL)softTabs;
149149

150-
- (void)setUseFinderTags:(BOOL)value sender:(id)sender;
150+
- (void)setUseFinderTags:(id)sender;
151+
//- (void)setUseFinderTags:(BOOL)value sender:(id)sender;
151152
- (BOOL)useFinderTags;
152153

153154
- (NSInteger)numberOfSpacesInTab;

GlobalPrefs.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void sendCallbacksForGlobalPrefs(GlobalPrefs* self, SEL selector, id orig
115115

116116
- (id)init {
117117
if (self=[super init]) {
118-
118+
119119
runCallbacksIMP = [self methodForSelector:@selector(notifyCallbacksForSelector:excludingSender:)];
120120
selectorObservers = [[NSMutableDictionary alloc] init];
121121

@@ -124,7 +124,7 @@ - (id)init {
124124
tableColumns = nil;
125125

126126
[defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
127-
[NSNumber numberWithBool:IsMavericksOrLater], UseFinderTagsKey,
127+
[NSNumber numberWithBool:NO], UseFinderTagsKey,
128128
[NSNumber numberWithBool:YES], AutoSuggestLinksKey,
129129
[NSNumber numberWithBool:YES], AutoFormatsDoneTagKey,
130130
[NSNumber numberWithBool:YES], AutoIndentsNewLinesKey,
@@ -539,16 +539,20 @@ - (NSDictionary*)searchTermHighlightAttributes {
539539

540540
}
541541

542-
- (void)setUseFinderTags:(BOOL)value sender:(id)sender {
542+
- (void)setUseFinderTags:(id)sender {
543543
if (!IsMavericksOrLater) {
544544
[defaults setBool:NO forKey:UseFinderTagsKey];
545545
return;
546546
}
547-
[defaults setBool:value forKey:UseFinderTagsKey];
547+
[defaults setBool:YES forKey:UseFinderTagsKey];
548+
SEND_CALLBACKS();
548549
}
549550

550551
- (BOOL)useFinderTags
551552
{
553+
if (!IsMavericksOrLater) {
554+
return NO;
555+
}
552556
return [defaults boolForKey:UseFinderTagsKey];
553557
}
554558

NSFileManager_NV.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
- (BOOL)createFolderAtPath:(NSString *)path withAttributes:(NSDictionary *)attributes;
3737
- (NSDictionary *)attributesAtPath:(NSString *)path followLink:(BOOL)follow;
3838
- (NSArray *)folderContentsAtPath:(NSString *)path;
39-
- (BOOL)mirrorOMToFinderTags:(const char*)path;
39+
- (NSArray *)mergedTagsForFileAtPath:(const char*)path;
4040
- (BOOL)deleteFileAtPath:(NSString *)path;
4141

4242
@end

0 commit comments

Comments
 (0)