|
@@ -144,25 +144,40 @@
|
144
|
144
|
[self reloadListWithOptions];
|
145
|
145
|
}
|
146
|
146
|
|
147
|
|
--(IBAction)linkToOpen:(id)sender {
|
148
|
|
- NSString *title = [(NSMenuItem *)sender title];
|
149
|
|
- if ([title isEqualToString:NSLocalizedString(@"Link...", nil)]) {
|
150
|
|
- for (NSUInteger i = 0; i < [menuItems count]; i++) {
|
151
|
|
- NSMenuItem *item = [menuItems objectAtIndex:i];
|
152
|
|
- NSMenu *submenu = item.submenu;
|
153
|
|
- if ((submenu != nil) && (sender == [submenu itemAtIndex:0])) {
|
154
|
|
- RedditItem *rItem = [redditItems objectAtIndex:i];
|
155
|
|
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[rItem link]]];
|
156
|
|
- break;
|
|
147
|
+-(void)openAndRemoveAndReloadWithIndex:(NSInteger)index Comments:(Boolean)comments {
|
|
148
|
+ RedditItem *rItem = [redditItems objectAtIndex:index];
|
|
149
|
+ NSString *url;
|
|
150
|
+ if (comments)
|
|
151
|
+ url = [rItem comments];
|
|
152
|
+ else
|
|
153
|
+ url = [rItem link];
|
|
154
|
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]];
|
|
155
|
+
|
|
156
|
+ if (currentState.removeVisited) {
|
|
157
|
+ // TODO remove selfpost, remove submenu if link & comments visited
|
|
158
|
+ //[statusMenu removeItem:[menuItems objectAtIndex:i]];
|
|
159
|
+
|
|
160
|
+ Boolean removed = TRUE;
|
|
161
|
+ Boolean listNowEmpty = TRUE;
|
|
162
|
+
|
|
163
|
+ if (removed && listNowEmpty) {
|
|
164
|
+ [self reloadNextList:nil];
|
|
165
|
+ } else {
|
|
166
|
+ if (removed && currentState.reloadAfterVisit) {
|
|
167
|
+ // TODO load one more item!
|
157
|
168
|
}
|
158
|
169
|
}
|
159
|
|
- } else if ([title isEqualToString:NSLocalizedString(@"Comments...", nil)]) {
|
|
170
|
+ }
|
|
171
|
+}
|
|
172
|
+
|
|
173
|
+-(IBAction)linkToOpen:(id)sender {
|
|
174
|
+ NSString *title = [(NSMenuItem *)sender title];
|
|
175
|
+ if ([title isEqualToString:NSLocalizedString(@"Link...", nil)] || [title isEqualToString:NSLocalizedString(@"Comments...", nil)]) {
|
160
|
176
|
for (NSUInteger i = 0; i < [menuItems count]; i++) {
|
161
|
177
|
NSMenuItem *item = [menuItems objectAtIndex:i];
|
162
|
178
|
NSMenu *submenu = item.submenu;
|
163
|
|
- if ((submenu != nil) && (sender == [submenu itemAtIndex:1])) {
|
164
|
|
- RedditItem *rItem = [redditItems objectAtIndex:i];
|
165
|
|
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[rItem comments]]];
|
|
179
|
+ if ((submenu != nil) && (sender == [submenu itemAtIndex:([title isEqualToString:NSLocalizedString(@"Link...", nil)] ? 0 : 1)])) {
|
|
180
|
+ [self openAndRemoveAndReloadWithIndex:i Comments:[title isEqualToString:NSLocalizedString(@"Comments...", nil)]];
|
166
|
181
|
break;
|
167
|
182
|
}
|
168
|
183
|
}
|
|
@@ -170,9 +185,7 @@
|
170
|
185
|
for (NSUInteger i = 0; i < [menuItems count]; i++) {
|
171
|
186
|
NSMenuItem *item = [menuItems objectAtIndex:i];
|
172
|
187
|
if (sender == item) {
|
173
|
|
- RedditItem *rItem = [redditItems objectAtIndex:i];
|
174
|
|
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:[rItem link]]];
|
175
|
|
- [statusMenu removeItem:[menuItems objectAtIndex:i]];
|
|
188
|
+ [self openAndRemoveAndReloadWithIndex:i Comments:FALSE];
|
176
|
189
|
break;
|
177
|
190
|
}
|
178
|
191
|
}
|