зеркало из https://github.com/mozilla/pjs.git
412695 Don't write empty/zero values in bookmarks.plist for last-visited date, visit count, and status. Handles folders too: don't write empty/zero values for the folder type and UUID. r=smorgan
This commit is contained in:
Родитель
30fcdab40d
Коммит
648087d977
|
@ -64,7 +64,6 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
|||
|
||||
// methods used for saving to files; are guaranteed never to return nil
|
||||
- (id)savedURL;
|
||||
- (id)savedLastVisit;
|
||||
- (id)savedStatus;
|
||||
- (id)savedNumberOfVisits;
|
||||
- (id)savedFaviconURL;
|
||||
|
@ -294,12 +293,7 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
|||
|
||||
- (id)savedURL
|
||||
{
|
||||
return mURL;
|
||||
}
|
||||
|
||||
- (id)savedLastVisit
|
||||
{
|
||||
return mLastVisit;
|
||||
return mURL ? mURL : @"";
|
||||
}
|
||||
|
||||
- (id)savedStatus
|
||||
|
@ -366,11 +360,18 @@ NSString* const URLLoadSuccessKey = @"url_bool";
|
|||
NSMutableDictionary* itemDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[self savedTitle], BMTitleKey,
|
||||
[self savedURL], BMURLKey,
|
||||
[self savedLastVisit], BMLastVisitKey,
|
||||
[self savedNumberOfVisits], BMNumberVisitsKey,
|
||||
[self savedStatus], BMStatusKey,
|
||||
nil];
|
||||
|
||||
if (mLastVisit)
|
||||
[itemDict setObject:mLastVisit forKey:BMLastVisitKey];
|
||||
|
||||
if (mNumberOfVisits)
|
||||
[itemDict setObject:[self savedNumberOfVisits] forKey:BMNumberVisitsKey];
|
||||
|
||||
// The bookmark is guaranteed not to be a separator at this point, so
|
||||
// [self savedStatus] will be 0, and there is no reason to write anything
|
||||
// for BMStatusKey.
|
||||
|
||||
if ([[self itemDescription] length])
|
||||
[itemDict setObject:[self itemDescription] forKey:BMDescKey];
|
||||
|
||||
|
|
|
@ -1197,10 +1197,14 @@ static int BookmarkItemSort(id firstItem, id secondItem, void* context)
|
|||
NSMutableDictionary* folderDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
children, BMChildrenKey,
|
||||
[self savedTitle], BMTitleKey,
|
||||
[self savedUUID], BMUUIDKey,
|
||||
[self savedSpecialFlag], BMFolderTypeKey,
|
||||
nil];
|
||||
|
||||
if (mSpecialFlag)
|
||||
[folderDict setObject:[self savedSpecialFlag] forKey:BMFolderTypeKey];
|
||||
|
||||
if ([mUUID length])
|
||||
[folderDict setObject:mUUID forKey:BMUUIDKey];
|
||||
|
||||
if ([[self itemDescription] length])
|
||||
[folderDict setObject:[self itemDescription] forKey:BMFolderDescKey];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче