Skip to content

Commit

Permalink
added Services menu support to Info.plist and AppController.m; rename…
Browse files Browse the repository at this point in the history
…d misspelled method; added localization strings for New Password functionality
  • Loading branch information
Zachary Schneirov committed Sep 29, 2009
1 parent 4a6dcd8 commit 1bfe385
Show file tree
Hide file tree
Showing 9 changed files with 870 additions and 220 deletions.
2 changes: 1 addition & 1 deletion AppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void outletObjectAwoke(id sender);
- (void)setNotationController:(NotationController*)newNotation;

- (void)setupViewsAfterAppAwakened;
- (void)runDelayedIUActionsAfterLaunch;
- (void)runDelayedUIActionsAfterLaunch;
- (void)updateNoteMenus;

- (BOOL)addNotesFromPasteboard:(NSPasteboard*)pasteboard;
Expand Down
11 changes: 9 additions & 2 deletions AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ void outletObjectAwoke(id sender) {
}
}

- (void)runDelayedIUActionsAfterLaunch {
- (void)runDelayedUIActionsAfterLaunch {
[[prefsController bookmarksController] setDelegate:self];
[[prefsController bookmarksController] updateBookmarksUI];
[self updateNoteMenus];
[prefsController registerAppActivationKeystrokeWithTarget:self selector:@selector(bringFocusToControlField:)];
[notationController checkIfNotationIsTrashed];
[NSApp setServicesProvider:self];

//connect sparkle programmatically to avoid loading its framework at nib awake;
if (RunningTigerAppKitOrHigher && !NSClassFromString(@"SUUpdater")) {
Expand Down Expand Up @@ -199,7 +200,7 @@ - (void)applicationDidFinishLaunching:(NSNotification*)aNote {
//need to know whether "delete note" should have an ellipsis
[prefsController registerForSettingChange:@selector(setConfirmNoteDeletion:sender:) withTarget:self];

[self performSelector:@selector(runDelayedIUActionsAfterLaunch) withObject:nil afterDelay:0.1];
[self performSelector:@selector(runDelayedUIActionsAfterLaunch) withObject:nil afterDelay:0.1];

NSLog(@"decoded 7 bit count: %d", decodedCount());

Expand Down Expand Up @@ -291,6 +292,12 @@ - (void)updateNoteMenus {
}
}

- (void)createFromSelection:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error {
if (!notationController || ![self addNotesFromPasteboard:pboard]) {
*error = NSLocalizedString(@"Error: Couldn't create a note from the selection.", @"error message to set during a Service call when adding a note failed");
}
}

- (BOOL)addNotesFromPasteboard:(NSPasteboard*)pasteboard {

NSArray *types = [pasteboard types];
Expand Down
Binary file modified English.lproj/Localizable.strings
Binary file not shown.
29 changes: 29 additions & 0 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,35 @@
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSServices</key>
<array>
<dict>
<key>NSKeyEquivalent</key>
<dict>
<key>default</key>
<string>V</string>
</dict>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>Notational Velocity: New Note With Selection</string>
</dict>
<key>NSMessage</key>
<string>createFromSelection</string>
<key>NSPortName</key>
<string>Notational Velocity</string>
<key>NSSendTypes</key>
<array>
<string>NSRTFDPboardType</string>
<string>NSRTFPboardType</string>
<string>NSStringPboardType</string>
<string>NSURLPboardType</string>
<string>NSFilenamesPboardType</string>
<string>Apple Web Archive pasteboard type</string>
<string>com.apple.webarchive</string>
</array>
</dict>
</array>
<key>SUCheckAtStartup</key>
<false/>
<key>SUFeedURL</key>
Expand Down
4 changes: 2 additions & 2 deletions LinkingEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ - (void)awakeFromNib {
[editMenu addItem:[NSMenuItem separatorItem]];

theMenuItem = [[NSMenuItem alloc]
initWithTitle:[NSString stringWithFormat:@"%@%C", NSLocalizedString(@"New Password", ""), 0x2026 /*ellipses*/]
initWithTitle:[NSString stringWithFormat:@"%@%C", NSLocalizedString(@"New Password...", "new password command in the edit menu"), 0x2026 /*ellipses*/]
action:@selector(showGeneratedPasswords:) keyEquivalent:@"\\"];
[theMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask];
[theMenuItem setTarget:nil]; // First Responder being the current Link Editor
[editMenu addItem:theMenuItem];
[theMenuItem release];

theMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Insert New Password", "")
theMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Insert New Password", "insert new password command in the edit menu")
action:@selector(insertGeneratedPassword:) keyEquivalent:@"\\"];
[theMenuItem setAlternate:YES];
[theMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask|NSAlternateKeyMask];
Expand Down
2 changes: 1 addition & 1 deletion Notation.freqorder
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ _BlockSizeForNotation
-[WALController setDelegate]
_getOptimalBlockSize
-[AppController windowWillReturnUndoManager]
-[AppController runDelayedIUActionsAfterLaunch]
-[AppController runDelayedUIActionsAfterLaunch]
-[PTHotKeyCenter unregisterHotKeyForName]
-[WALController initWithParentFSRepencryptionKey]
-[AppController textDidEndEditing]
Expand Down
2 changes: 1 addition & 1 deletion Notation.launchorder
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ _dateCreatedStringOfNote
-[NotationController updateDateStringsIfNecessary]
-[RBSplitView viewDidMoveToSuperview]
-[RBSplitView(RB___ViewAdditions) RB___adjustOutermostIfNeeded]
-[AppController runDelayedIUActionsAfterLaunch]
-[AppController runDelayedUIActionsAfterLaunch]
-[BookmarksController setDelegate]
-[BookmarksController updateBookmarksUI]
-[GlobalPrefs setBookmarksFromSender]
Expand Down
Loading

0 comments on commit 1bfe385

Please sign in to comment.