Fix issue #1, use guid if no link is set
This commit is contained in:
@@ -35,13 +35,16 @@
|
||||
fa.unread = YES;
|
||||
fa.guid = entry.guid;
|
||||
fa.title = entry.title;
|
||||
fa.abstract = entry.abstract;
|
||||
if (entry.abstract.length > 0) { // remove html tags and save plain text to db
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"<[^>]*>" options:kNilOptions error:nil];
|
||||
fa.abstract = [regex stringByReplacingMatchesInString:entry.abstract options:kNilOptions range:NSMakeRange(0, entry.abstract.length) withTemplate:@""];
|
||||
}
|
||||
fa.body = entry.body;
|
||||
fa.author = entry.author;
|
||||
fa.link = entry.link;
|
||||
fa.published = entry.datePublished;
|
||||
if (!fa.published)
|
||||
fa.published = entry.dateModified;
|
||||
if (!fa.link) fa.link = entry.guid; // may be wrong, but better than returning nothing.
|
||||
if (!fa.published) fa.published = entry.dateModified;
|
||||
return fa;
|
||||
}
|
||||
|
||||
@@ -64,12 +67,7 @@
|
||||
item.title = [self shortArticleName];
|
||||
item.enabled = (self.link.length > 0);
|
||||
item.state = (self.unread && [UserPrefs defaultYES:@"feedTickMark"] ? NSControlStateValueOn : NSControlStateValueOff);
|
||||
//mi.toolTip = item.abstract;
|
||||
// TODO: Do regex during save, not during display. Its here for testing purposes ...
|
||||
if (self.abstract.length > 0) {
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"<[^>]*>" options:kNilOptions error:nil];
|
||||
item.toolTip = [regex stringByReplacingMatchesInString:self.abstract options:kNilOptions range:NSMakeRange(0, self.abstract.length) withTemplate:@""];
|
||||
}
|
||||
item.toolTip = self.abstract;
|
||||
item.representedObject = self.objectID;
|
||||
item.target = [self class];
|
||||
item.action = @selector(didClickOnMenuItem:);
|
||||
|
||||
@@ -64,7 +64,11 @@
|
||||
NSUInteger deleted = [StoreCoordinator deleteUnreferenced];
|
||||
[StoreCoordinator restoreFeedIndexPaths];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationTotalUnreadCountReset object:nil];
|
||||
NSLog(@"Removed %lu unreferenced core data entries.", deleted);
|
||||
// show only if >0, but hey, this button will vanish anyway ...
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = [NSString stringWithFormat:@"Removed %lu unreferenced core data entries.", deleted];
|
||||
alert.alertStyle = NSAlertStyleInformational;
|
||||
[alert runModal];
|
||||
}
|
||||
|
||||
- (IBAction)changeMenuBarIconSetting:(NSButton*)sender {
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Tec-F3-9cE">
|
||||
<rect key="frame" x="18" y="271" width="284" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" title="Tint menu bar icon" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="19k-mc-RLe">
|
||||
<buttonCell key="cell" type="check" title="Tint menu bar icon on unread" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="19k-mc-RLe">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
|
||||
Reference in New Issue
Block a user