Skip to content
This repository was archived by the owner on Jan 25, 2025. It is now read-only.

Commit b801321

Browse files
committed
Added 'Send to Readability' context menu
1 parent 92e612d commit b801321

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Hacky/HNListViewController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ - (void)awakeFromNib
4141
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickCopyMenuButton) name:@"didClickCopyMenuButton" object:nil];
4242
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickCopyURLMenuButton) name:@"didClickCopyURLMenuButton" object:nil];
4343
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickInstapaperMenuButton) name:@"didClickInstapaperMenuButton" object:nil];
44+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickReadabilityMenuButton) name:@"didClickReadabilityMenuButton" object:nil];
4445
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickTweetMenuButton) name:@"didClickTweetMenuButton" object:nil];
4546
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickMarkAsReadMenuButton) name:@"didClickMarkAsReadMenuButton" object:nil];
4647
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didClickMarkAsUnreadMenuButton) name:@"didClickMarkAsUnreadMenuButton" object:nil];
@@ -165,6 +166,17 @@ - (void)didClickInstapaperMenuButton
165166
[[NSWorkspace sharedWorkspace] openURL:url];
166167
}
167168

169+
- (void)didClickReadabilityMenuButton
170+
{
171+
NSMutableDictionary* topic = [topics objectAtIndex:selectedIndex];
172+
NSString* baseURL = @"http://www.readability.com/save?url=";
173+
NSString* topicURL = [[topic valueForKey:@"url"] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
174+
NSString* ipURL = [NSString stringWithFormat:@"%@%@", baseURL, topicURL];
175+
176+
NSURL* url = [NSURL URLWithString:ipURL];
177+
[[NSWorkspace sharedWorkspace] openURL:url];
178+
}
179+
168180
- (void)didClickTweetMenuButton
169181
{
170182
NSMutableDictionary* topic = [topics objectAtIndex:selectedIndex];

Hacky/HNPostCell.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ - (id)initWithReusableIdentifier: (NSString*)identifier
114114
[instapaper setAction:@selector(didClickInstapaperButton:)];
115115
[instapaper setTarget:self];
116116
[contextMenu addItem:instapaper];
117+
118+
NSMenuItem *readability = [[NSMenuItem alloc] init];
119+
[readability setTitle:@"Send to Readability"];
120+
[readability setAction:@selector(didClickReadabilityButton:)];
121+
[readability setTarget:self];
122+
[contextMenu addItem:readability];
117123

118124
NSMenuItem *tweet = [[NSMenuItem alloc] init];
119125
[tweet setTitle:@"Tweet"];
@@ -219,6 +225,11 @@ - (void)didClickInstapaperButton:(id)sender
219225
[[NSNotificationCenter defaultCenter] postNotificationName:@"didClickInstapaperMenuButton" object:nil];
220226
}
221227

228+
- (void)didClickReadabilityButton:(id)sender
229+
{
230+
[[NSNotificationCenter defaultCenter] postNotificationName:@"didClickReadabilityMenuButton" object:nil];
231+
}
232+
222233
- (void)didClickTweetButton:(id)sender
223234
{
224235
[[NSNotificationCenter defaultCenter] postNotificationName:@"didClickTweetMenuButton" object:nil];

0 commit comments

Comments
 (0)