Fix issue #1, use guid if no link is set
This commit is contained in:
@@ -35,13 +35,16 @@
|
|||||||
fa.unread = YES;
|
fa.unread = YES;
|
||||||
fa.guid = entry.guid;
|
fa.guid = entry.guid;
|
||||||
fa.title = entry.title;
|
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.body = entry.body;
|
||||||
fa.author = entry.author;
|
fa.author = entry.author;
|
||||||
fa.link = entry.link;
|
fa.link = entry.link;
|
||||||
fa.published = entry.datePublished;
|
fa.published = entry.datePublished;
|
||||||
if (!fa.published)
|
if (!fa.link) fa.link = entry.guid; // may be wrong, but better than returning nothing.
|
||||||
fa.published = entry.dateModified;
|
if (!fa.published) fa.published = entry.dateModified;
|
||||||
return fa;
|
return fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,12 +67,7 @@
|
|||||||
item.title = [self shortArticleName];
|
item.title = [self shortArticleName];
|
||||||
item.enabled = (self.link.length > 0);
|
item.enabled = (self.link.length > 0);
|
||||||
item.state = (self.unread && [UserPrefs defaultYES:@"feedTickMark"] ? NSControlStateValueOn : NSControlStateValueOff);
|
item.state = (self.unread && [UserPrefs defaultYES:@"feedTickMark"] ? NSControlStateValueOn : NSControlStateValueOff);
|
||||||
//mi.toolTip = item.abstract;
|
item.toolTip = self.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.representedObject = self.objectID;
|
item.representedObject = self.objectID;
|
||||||
item.target = [self class];
|
item.target = [self class];
|
||||||
item.action = @selector(didClickOnMenuItem:);
|
item.action = @selector(didClickOnMenuItem:);
|
||||||
|
|||||||
@@ -64,7 +64,11 @@
|
|||||||
NSUInteger deleted = [StoreCoordinator deleteUnreferenced];
|
NSUInteger deleted = [StoreCoordinator deleteUnreferenced];
|
||||||
[StoreCoordinator restoreFeedIndexPaths];
|
[StoreCoordinator restoreFeedIndexPaths];
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationTotalUnreadCountReset object:nil];
|
[[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 {
|
- (IBAction)changeMenuBarIconSetting:(NSButton*)sender {
|
||||||
|
|||||||
@@ -380,7 +380,7 @@
|
|||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Tec-F3-9cE">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Tec-F3-9cE">
|
||||||
<rect key="frame" x="18" y="271" width="284" height="18"/>
|
<rect key="frame" x="18" y="271" width="284" height="18"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
<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"/>
|
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
|||||||
Reference in New Issue
Block a user