[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
sullivan
sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:13:43 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 792c4a1c21526a773ee186c29238af1b19830a7a
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon May 20 19:15:11 2002 +0000
- fixed 2923492 -- No way to put separators in Bookmarks menu
- fixed 2927561 -- Added child of bookmarks folder should be first, not last
- fixed 2927575 -- New bookmark should have blank URL
- fixed 2927589 -- "Modify" and "Remove" should be "Edit" and "Delete"
- fixed 2923220 -- Bookmarks window should reopen at launch if it was open at quit
- fixed bug where bookmark window would sometimes start with a horiz scrollbar
- fixed bug where deleting nested bookmark would leave last row selected
* PreferenceKeys.h: define ShowBookmarksPreferenceKey
* AppController.m:
(-[AppController applicationDidFinishLaunching:]):
Open bookmarks window if preference says to.
(-[AppController _insertBookmark:intoMenu:atIndex:]):
Handle separators.
* BookmarksController.m:
(-[BookmarksController windowDidLoad]): Set self as delegate so we will receive
windowWillClose:; setAutoresizesOutlineColumn:NO so column widths won't change
at launch.
(-[BookmarksController removeSelectedBookmarks:]):
Reselect previously selected item if it's still valid
(-[BookmarksController _newItemWithTitle:image:URLString:type:]):
Change isLeaf parameter to bookmark type. Handle separators (don't edit title
of newly-created separator). If expanded folder is selected, make new item first.
(-[BookmarksController _newSeparator:]): Implemented.
(-[BookmarksController outlineView:objectValueForTableColumn:byItem:]):
Return "--" as string to represent separator, for now.
(-[BookmarksController _newFolder:]),
(-[BookmarksController _newBookmark:]):
(-[BookmarksController outlineView:isItemExpandable:]):
(-[BookmarksController outlineView:validateDrop:proposedItem:proposedChildIndex:]):
(-[BookmarksController outlineView:shouldEditTableColumn:item:]):
Replaced uses of isLeaf with bookmarkType.
(-[BookmarksController toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:]):
Handle separator item.
(-[BookmarksController toolbarAllowedItemIdentifiers:]): Include "New Separator" item.
(-[BookmarksController showWindow:]): Set "bookmarks showing" preference to YES.
(-[BookmarksController windowWillClose:]): Set "bookmarks showing" preference to NO.
* BrowserDocument.m:
(-[BrowserDocument addBookmark:]):
Replaced use of isLeaf with bookmarkType.
* GlobalHistory.m:
(-[GlobalHistory addSelectedItemsToBookmarks:]):
Replaced use of isLeaf with bookmarkType.
* Resources/Images/new_separator.tiff: Added.
* WebBrowser.pbproj/project.pbxproj: Updated for new file.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/Bookmarks.subproj/IFBookmark.h b/WebKit/Bookmarks.subproj/IFBookmark.h
index aebb158..4f8a701 100644
--- a/WebKit/Bookmarks.subproj/IFBookmark.h
+++ b/WebKit/Bookmarks.subproj/IFBookmark.h
@@ -10,6 +10,12 @@
@class IFBookmarkGroup;
+typedef enum {
+ IFBookmarkTypeLeaf,
+ IFBookmarkTypeList,
+ IFBookmarkTypeSeparator,
+} IFBookmarkType;
+
@interface IFBookmark : NSObject <NSCopying> {
IFBookmark *_parent;
IFBookmarkGroup *_group;
@@ -21,27 +27,27 @@
- (NSImage *)image;
- (void)setImage:(NSImage *)image;
-// Distinguishes a single bookmark from a list
-- (BOOL)isLeaf;
+// The type of bookmark
+- (IFBookmarkType)bookmarkType;
// String intended to represent URL for leaf bookmarks. May not be a valid URL string.
-// This is nil if isLeaf returns NO.
+// This is nil if bookmarkType is not IFBookmarkTypeLeaf.
- (NSString *)URLString;
// Sets the string intended to represent URL for leaf bookmarks. URLString need not be
-// a valid URL string. Does nothing if isLeaf returns NO.
+// a valid URL string. Does nothing if bookmarkType is not IFBookmarkTypeLeaf.
- (void)setURLString:(NSString *)URLString;
-// Array of child IFBookmarks. Returns nil if isLeaf returns YES.
+// Array of child IFBookmarks. Returns nil if bookmarkType is not IFBookmarkTypeList.
- (NSArray *)children;
-// Number of children. Returns 0 if isLeaf returns YES.
+// Number of children. Returns 0 if bookmarkType is not IFBookmarkTypeList.
- (unsigned)numberOfChildren;
-// Insert a bookmark into the list. Does nothing if isLeaf returns YES.
+// Insert a bookmark into the list. Does nothing if bookmarkType is not IFBookmarkTypeList.
- (void)insertChild:(IFBookmark *)bookmark atIndex:(unsigned)index;
-// Remove a bookmark from the list. Does nothing if isLeaf returns YES.
+// Remove a bookmark from the list. Does nothing if bookmarkType is not IFBookmarkTypeList.
- (void)removeChild:(IFBookmark *)bookmark;
@end
diff --git a/WebKit/Bookmarks.subproj/IFBookmark.m b/WebKit/Bookmarks.subproj/IFBookmark.m
index 52bf2d9..2460d9b 100644
--- a/WebKit/Bookmarks.subproj/IFBookmark.m
+++ b/WebKit/Bookmarks.subproj/IFBookmark.m
@@ -30,30 +30,38 @@
- (NSString *)title
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
return nil;
}
- (void)setTitle:(NSString *)title
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
}
- (NSImage *)image
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
return nil;
}
- (void)setImage:(NSImage *)image
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
}
-- (BOOL)isLeaf
+- (IFBookmarkType)bookmarkType
{
NSRequestConcreteImplementation(self, _cmd, [self class]);
- return YES;
+ return IFBookmarkTypeLeaf;
}
- (NSString *)URLString
@@ -63,14 +71,14 @@
- (void)setURLString:(NSString *)URLString
{
- if ([self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeLeaf) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
}
- (NSArray *)children
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
return nil;
@@ -78,7 +86,7 @@
- (unsigned)numberOfChildren
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
return 0;
@@ -86,7 +94,7 @@
- (unsigned)_numberOfDescendants
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
return 0;
@@ -94,14 +102,14 @@
- (void)insertChild:(IFBookmark *)bookmark atIndex:(unsigned)index
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
}
- (void)removeChild:(IFBookmark *)bookmark
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
}
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkGroup.h b/WebKit/Bookmarks.subproj/IFBookmarkGroup.h
index f9c6b3b..a294afc 100644
--- a/WebKit/Bookmarks.subproj/IFBookmarkGroup.h
+++ b/WebKit/Bookmarks.subproj/IFBookmarkGroup.h
@@ -42,12 +42,12 @@
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag;
+ type:(IFBookmarkType)bookmarkType;
- (IFBookmark *)addNewBookmarkToBookmark:(IFBookmark *)parent
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag;
+ type:(IFBookmarkType)bookmarkType;
// storing contents on disk
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkGroup.m b/WebKit/Bookmarks.subproj/IFBookmarkGroup.m
index 1a7ea2f..5bd7bc5 100644
--- a/WebKit/Bookmarks.subproj/IFBookmarkGroup.m
+++ b/WebKit/Bookmarks.subproj/IFBookmarkGroup.m
@@ -11,6 +11,7 @@
#import <WebKit/IFBookmark_Private.h>
#import <WebKit/IFBookmarkList.h>
#import <WebKit/IFBookmarkLeaf.h>
+#import <WebKit/IFBookmarkSeparator.h>
#import <WebKit/WebKitDebug.h>
@interface IFBookmarkGroup (IFForwardDeclarations)
@@ -77,7 +78,8 @@
{
BOOL hadChildren, hasChildrenNow;
- WEBKIT_ASSERT_VALID_ARG (newTopBookmark, newTopBookmark == nil || ![newTopBookmark isLeaf]);
+ WEBKIT_ASSERT_VALID_ARG (newTopBookmark, newTopBookmark == nil ||
+ [newTopBookmark bookmarkType] == IFBookmarkTypeList);
hadChildren = [_topBookmark numberOfChildren] > 0;
hasChildrenNow = newTopBookmark != nil && [newTopBookmark numberOfChildren] > 0;
@@ -108,7 +110,7 @@
- (void)_bookmarkChildrenDidChange:(IFBookmark *)bookmark
{
- WEBKIT_ASSERT_VALID_ARG (bookmark, ![bookmark isLeaf]);
+ WEBKIT_ASSERT_VALID_ARG (bookmark, [bookmark bookmarkType] == IFBookmarkTypeList);
[self _sendChangeNotificationForBookmark:bookmark childrenChanged:YES];
}
@@ -130,14 +132,14 @@
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag
+ type:(IFBookmarkType)bookmarkType
{
return [self insertNewBookmarkAtIndex:[parent numberOfChildren]
ofBookmark:parent
withTitle:newTitle
image:newImage
URLString:newURLString
- isLeaf:flag];
+ type:bookmarkType];
}
- (IFBookmark *)insertNewBookmarkAtIndex:(unsigned)index
@@ -145,20 +147,23 @@
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag
+ type:(IFBookmarkType)bookmarkType
{
IFBookmark *bookmark;
WEBKIT_ASSERT_VALID_ARG (parent, [parent _group] == self);
- WEBKIT_ASSERT_VALID_ARG (parent, ![parent isLeaf]);
- WEBKIT_ASSERT_VALID_ARG (newURLString, flag ? (newURLString != nil) : (newURLString == nil));
-
- if (flag) {
+ WEBKIT_ASSERT_VALID_ARG (parent, [parent bookmarkType] == IFBookmarkTypeList);
+ WEBKIT_ASSERT_VALID_ARG (newURLString, bookmarkType == IFBookmarkTypeLeaf || (newURLString == nil));
+
+ if (bookmarkType == IFBookmarkTypeLeaf) {
bookmark = [[[IFBookmarkLeaf alloc] initWithURLString:newURLString
title:newTitle
image:newImage
group:self] autorelease];
+ } else if (bookmarkType == IFBookmarkTypeSeparator) {
+ bookmark = [[[IFBookmarkSeparator alloc] initWithGroup:self] autorelease];
} else {
+ WEBKIT_ASSERT (bookmarkType == IFBookmarkTypeList);
bookmark = [[[IFBookmarkList alloc] initWithTitle:newTitle
image:newImage
group:self] autorelease];
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m b/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m
index 50792f3..1ae3274 100644
--- a/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m
+++ b/WebKit/Bookmarks.subproj/IFBookmarkLeaf.m
@@ -56,10 +56,13 @@
{
NSMutableDictionary *dict;
- dict = [NSMutableDictionary dictionaryWithCapacity: 2];
+ dict = [NSMutableDictionary dictionaryWithCapacity: 3];
+ [dict setObject:IFBookmarkTypeLeafValue forKey:IFBookmarkTypeKey];
[dict setObject:[_entry dictionaryRepresentation] forKey:URIDictionaryKey];
- [dict setObject:_URLString forKey:URLStringKey];
+ if (_URLString != nil) {
+ [dict setObject:_URLString forKey:URLStringKey];
+ }
return dict;
}
@@ -107,9 +110,9 @@
[[self _group] _bookmarkDidChange:self];
}
-- (BOOL)isLeaf
+- (IFBookmarkType)bookmarkType
{
- return YES;
+ return IFBookmarkTypeLeaf;
}
- (NSString *)URLString
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkList.m b/WebKit/Bookmarks.subproj/IFBookmarkList.m
index 9e7c6d5..f55d2b1 100644
--- a/WebKit/Bookmarks.subproj/IFBookmarkList.m
+++ b/WebKit/Bookmarks.subproj/IFBookmarkList.m
@@ -8,12 +8,12 @@
#import <WebKit/IFBookmarkList.h>
#import <WebKit/IFBookmarkLeaf.h>
+#import <WebKit/IFBookmarkSeparator.h>
#import <WebKit/IFBookmark_Private.h>
#import <WebKit/IFBookmarkGroup_Private.h>
#import <WebKit/WebKitDebug.h>
#define TitleKey @"Title"
-#define ListIdentifierKey @"ListIdentifier"
#define ChildrenKey @"Children"
@implementation IFBookmarkList
@@ -39,6 +39,7 @@
NSArray *storedChildren;
NSDictionary *childAsDictionary;
IFBookmark *child;
+ NSString *typeString;
unsigned index, count;
WEBKIT_ASSERT_VALID_ARG (dict, dict != nil);
@@ -56,18 +57,23 @@
count = [storedChildren count];
for (index = 0; index < count; ++index) {
childAsDictionary = [storedChildren objectAtIndex:index];
+ child = nil;
- // determine whether child is a leaf or a list by looking for the
- // token that this list class inserts.
- if ([childAsDictionary objectForKey:ListIdentifierKey] != nil) {
+ typeString = [childAsDictionary objectForKey:IFBookmarkTypeKey];
+ if ([typeString isEqualToString:IFBookmarkTypeListValue]) {
child = [[IFBookmarkList alloc] _initFromDictionaryRepresentation:childAsDictionary
withGroup:group];
- } else {
+ } else if ([typeString isEqualToString:IFBookmarkTypeLeafValue]) {
child = [[IFBookmarkLeaf alloc] _initFromDictionaryRepresentation:childAsDictionary
withGroup:group];
+ } else if ([typeString isEqualToString:IFBookmarkTypeSeparatorValue]) {
+ child = [[IFBookmarkSeparator alloc] _initFromDictionaryRepresentation:childAsDictionary
+ withGroup:group];
}
- [self insertChild:child atIndex:index];
+ if (child != nil) {
+ [self insertChild:child atIndex:index];
+ }
}
}
@@ -87,8 +93,7 @@
[dict setObject:_title forKey:TitleKey];
}
- // mark this as a list-type bookmark; used in _initFromDictionaryRepresentation
- [dict setObject:@"YES" forKey:ListIdentifierKey];
+ [dict setObject:IFBookmarkTypeListValue forKey:IFBookmarkTypeKey];
childCount = [self numberOfChildren];
if (childCount > 0) {
@@ -188,9 +193,9 @@
[[self _group] _bookmarkDidChange:self];
}
-- (BOOL)isLeaf
+- (IFBookmarkType)bookmarkType
{
- return NO;
+ return IFBookmarkTypeList;
}
- (NSArray *)children
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkSeparator.h b/WebKit/Bookmarks.subproj/IFBookmarkSeparator.h
new file mode 100644
index 0000000..7786744
--- /dev/null
+++ b/WebKit/Bookmarks.subproj/IFBookmarkSeparator.h
@@ -0,0 +1,17 @@
+//
+// IFBookmarkSeparator.h
+// WebKit
+//
+// Created by John Sullivan on Mon May 20 2002.
+// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <WebKit/IFBookmark.h>
+
+
+ at interface IFBookmarkSeparator : IFBookmark {
+}
+
+- (id)initWithGroup:(IFBookmarkGroup *)group;
+
+ at end
diff --git a/WebKit/Bookmarks.subproj/IFBookmarkSeparator.m b/WebKit/Bookmarks.subproj/IFBookmarkSeparator.m
new file mode 100644
index 0000000..fbe17f2
--- /dev/null
+++ b/WebKit/Bookmarks.subproj/IFBookmarkSeparator.m
@@ -0,0 +1,52 @@
+//
+// IFBookmarkSeparator.m
+// WebKit
+//
+// Created by John Sullivan on Mon May 20 2002.
+// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "IFBookmarkSeparator.h"
+
+#import "IFBookmark_Private.h"
+#import <WebKit/WebKitDebug.h>
+
+
+ at implementation IFBookmarkSeparator
+
+- (id)initWithGroup:(IFBookmarkGroup *)group
+{
+ WEBKIT_ASSERT_VALID_ARG (group, group != nil);
+
+ [super init];
+ [self _setGroup:group];
+
+ return self;
+}
+
+- (id)_initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group
+{
+ if (![[dict objectForKey:IFBookmarkTypeKey] isEqualToString:IFBookmarkTypeSeparatorValue]) {
+ WEBKITDEBUG("Can't initialize Bookmark separator from non-separator type");
+ return nil;
+ }
+
+ return [self initWithGroup:group];
+}
+
+- (NSDictionary *)_dictionaryRepresentation
+{
+ return [NSDictionary dictionaryWithObject:IFBookmarkTypeSeparatorValue forKey:IFBookmarkTypeKey];
+}
+
+- (IFBookmarkType)bookmarkType
+{
+ return IFBookmarkTypeSeparator;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return [[IFBookmarkSeparator alloc] initWithGroup:[self _group]];
+}
+
+ at end
diff --git a/WebKit/Bookmarks.subproj/IFBookmark_Private.h b/WebKit/Bookmarks.subproj/IFBookmark_Private.h
index 609b169..e4f97aa 100644
--- a/WebKit/Bookmarks.subproj/IFBookmark_Private.h
+++ b/WebKit/Bookmarks.subproj/IFBookmark_Private.h
@@ -9,6 +9,11 @@
#import <WebKit/IFBookmark.h>
+#define IFBookmarkTypeKey @"IFBookmarkType"
+#define IFBookmarkTypeLeafValue @"IFBookmarkTypeLeaf"
+#define IFBookmarkTypeListValue @"IFBookmarkTypeList"
+#define IFBookmarkTypeSeparatorValue @"IFBookmarkTypeSeparator"
+
@interface IFBookmark(IFPrivate)
- (id)_initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group;
diff --git a/WebKit/Bookmarks.subproj/WebBookmark.h b/WebKit/Bookmarks.subproj/WebBookmark.h
index aebb158..4f8a701 100644
--- a/WebKit/Bookmarks.subproj/WebBookmark.h
+++ b/WebKit/Bookmarks.subproj/WebBookmark.h
@@ -10,6 +10,12 @@
@class IFBookmarkGroup;
+typedef enum {
+ IFBookmarkTypeLeaf,
+ IFBookmarkTypeList,
+ IFBookmarkTypeSeparator,
+} IFBookmarkType;
+
@interface IFBookmark : NSObject <NSCopying> {
IFBookmark *_parent;
IFBookmarkGroup *_group;
@@ -21,27 +27,27 @@
- (NSImage *)image;
- (void)setImage:(NSImage *)image;
-// Distinguishes a single bookmark from a list
-- (BOOL)isLeaf;
+// The type of bookmark
+- (IFBookmarkType)bookmarkType;
// String intended to represent URL for leaf bookmarks. May not be a valid URL string.
-// This is nil if isLeaf returns NO.
+// This is nil if bookmarkType is not IFBookmarkTypeLeaf.
- (NSString *)URLString;
// Sets the string intended to represent URL for leaf bookmarks. URLString need not be
-// a valid URL string. Does nothing if isLeaf returns NO.
+// a valid URL string. Does nothing if bookmarkType is not IFBookmarkTypeLeaf.
- (void)setURLString:(NSString *)URLString;
-// Array of child IFBookmarks. Returns nil if isLeaf returns YES.
+// Array of child IFBookmarks. Returns nil if bookmarkType is not IFBookmarkTypeList.
- (NSArray *)children;
-// Number of children. Returns 0 if isLeaf returns YES.
+// Number of children. Returns 0 if bookmarkType is not IFBookmarkTypeList.
- (unsigned)numberOfChildren;
-// Insert a bookmark into the list. Does nothing if isLeaf returns YES.
+// Insert a bookmark into the list. Does nothing if bookmarkType is not IFBookmarkTypeList.
- (void)insertChild:(IFBookmark *)bookmark atIndex:(unsigned)index;
-// Remove a bookmark from the list. Does nothing if isLeaf returns YES.
+// Remove a bookmark from the list. Does nothing if bookmarkType is not IFBookmarkTypeList.
- (void)removeChild:(IFBookmark *)bookmark;
@end
diff --git a/WebKit/Bookmarks.subproj/WebBookmark.m b/WebKit/Bookmarks.subproj/WebBookmark.m
index 52bf2d9..2460d9b 100644
--- a/WebKit/Bookmarks.subproj/WebBookmark.m
+++ b/WebKit/Bookmarks.subproj/WebBookmark.m
@@ -30,30 +30,38 @@
- (NSString *)title
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
return nil;
}
- (void)setTitle:(NSString *)title
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
}
- (NSImage *)image
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
return nil;
}
- (void)setImage:(NSImage *)image
{
- NSRequestConcreteImplementation(self, _cmd, [self class]);
+ if ([self bookmarkType] != IFBookmarkTypeSeparator) {
+ NSRequestConcreteImplementation(self, _cmd, [self class]);
+ }
}
-- (BOOL)isLeaf
+- (IFBookmarkType)bookmarkType
{
NSRequestConcreteImplementation(self, _cmd, [self class]);
- return YES;
+ return IFBookmarkTypeLeaf;
}
- (NSString *)URLString
@@ -63,14 +71,14 @@
- (void)setURLString:(NSString *)URLString
{
- if ([self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeLeaf) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
}
- (NSArray *)children
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
return nil;
@@ -78,7 +86,7 @@
- (unsigned)numberOfChildren
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
return 0;
@@ -86,7 +94,7 @@
- (unsigned)_numberOfDescendants
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
return 0;
@@ -94,14 +102,14 @@
- (void)insertChild:(IFBookmark *)bookmark atIndex:(unsigned)index
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
}
- (void)removeChild:(IFBookmark *)bookmark
{
- if (![self isLeaf]) {
+ if ([self bookmarkType] == IFBookmarkTypeList) {
NSRequestConcreteImplementation(self, _cmd, [self class]);
}
}
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkGroup.h b/WebKit/Bookmarks.subproj/WebBookmarkGroup.h
index f9c6b3b..a294afc 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkGroup.h
+++ b/WebKit/Bookmarks.subproj/WebBookmarkGroup.h
@@ -42,12 +42,12 @@
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag;
+ type:(IFBookmarkType)bookmarkType;
- (IFBookmark *)addNewBookmarkToBookmark:(IFBookmark *)parent
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag;
+ type:(IFBookmarkType)bookmarkType;
// storing contents on disk
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkGroup.m b/WebKit/Bookmarks.subproj/WebBookmarkGroup.m
index 1a7ea2f..5bd7bc5 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkGroup.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkGroup.m
@@ -11,6 +11,7 @@
#import <WebKit/IFBookmark_Private.h>
#import <WebKit/IFBookmarkList.h>
#import <WebKit/IFBookmarkLeaf.h>
+#import <WebKit/IFBookmarkSeparator.h>
#import <WebKit/WebKitDebug.h>
@interface IFBookmarkGroup (IFForwardDeclarations)
@@ -77,7 +78,8 @@
{
BOOL hadChildren, hasChildrenNow;
- WEBKIT_ASSERT_VALID_ARG (newTopBookmark, newTopBookmark == nil || ![newTopBookmark isLeaf]);
+ WEBKIT_ASSERT_VALID_ARG (newTopBookmark, newTopBookmark == nil ||
+ [newTopBookmark bookmarkType] == IFBookmarkTypeList);
hadChildren = [_topBookmark numberOfChildren] > 0;
hasChildrenNow = newTopBookmark != nil && [newTopBookmark numberOfChildren] > 0;
@@ -108,7 +110,7 @@
- (void)_bookmarkChildrenDidChange:(IFBookmark *)bookmark
{
- WEBKIT_ASSERT_VALID_ARG (bookmark, ![bookmark isLeaf]);
+ WEBKIT_ASSERT_VALID_ARG (bookmark, [bookmark bookmarkType] == IFBookmarkTypeList);
[self _sendChangeNotificationForBookmark:bookmark childrenChanged:YES];
}
@@ -130,14 +132,14 @@
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag
+ type:(IFBookmarkType)bookmarkType
{
return [self insertNewBookmarkAtIndex:[parent numberOfChildren]
ofBookmark:parent
withTitle:newTitle
image:newImage
URLString:newURLString
- isLeaf:flag];
+ type:bookmarkType];
}
- (IFBookmark *)insertNewBookmarkAtIndex:(unsigned)index
@@ -145,20 +147,23 @@
withTitle:(NSString *)newTitle
image:(NSImage *)newImage
URLString:(NSString *)newURLString
- isLeaf:(BOOL)flag
+ type:(IFBookmarkType)bookmarkType
{
IFBookmark *bookmark;
WEBKIT_ASSERT_VALID_ARG (parent, [parent _group] == self);
- WEBKIT_ASSERT_VALID_ARG (parent, ![parent isLeaf]);
- WEBKIT_ASSERT_VALID_ARG (newURLString, flag ? (newURLString != nil) : (newURLString == nil));
-
- if (flag) {
+ WEBKIT_ASSERT_VALID_ARG (parent, [parent bookmarkType] == IFBookmarkTypeList);
+ WEBKIT_ASSERT_VALID_ARG (newURLString, bookmarkType == IFBookmarkTypeLeaf || (newURLString == nil));
+
+ if (bookmarkType == IFBookmarkTypeLeaf) {
bookmark = [[[IFBookmarkLeaf alloc] initWithURLString:newURLString
title:newTitle
image:newImage
group:self] autorelease];
+ } else if (bookmarkType == IFBookmarkTypeSeparator) {
+ bookmark = [[[IFBookmarkSeparator alloc] initWithGroup:self] autorelease];
} else {
+ WEBKIT_ASSERT (bookmarkType == IFBookmarkTypeList);
bookmark = [[[IFBookmarkList alloc] initWithTitle:newTitle
image:newImage
group:self] autorelease];
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m b/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
index 50792f3..1ae3274 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkLeaf.m
@@ -56,10 +56,13 @@
{
NSMutableDictionary *dict;
- dict = [NSMutableDictionary dictionaryWithCapacity: 2];
+ dict = [NSMutableDictionary dictionaryWithCapacity: 3];
+ [dict setObject:IFBookmarkTypeLeafValue forKey:IFBookmarkTypeKey];
[dict setObject:[_entry dictionaryRepresentation] forKey:URIDictionaryKey];
- [dict setObject:_URLString forKey:URLStringKey];
+ if (_URLString != nil) {
+ [dict setObject:_URLString forKey:URLStringKey];
+ }
return dict;
}
@@ -107,9 +110,9 @@
[[self _group] _bookmarkDidChange:self];
}
-- (BOOL)isLeaf
+- (IFBookmarkType)bookmarkType
{
- return YES;
+ return IFBookmarkTypeLeaf;
}
- (NSString *)URLString
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkList.m b/WebKit/Bookmarks.subproj/WebBookmarkList.m
index 9e7c6d5..f55d2b1 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkList.m
+++ b/WebKit/Bookmarks.subproj/WebBookmarkList.m
@@ -8,12 +8,12 @@
#import <WebKit/IFBookmarkList.h>
#import <WebKit/IFBookmarkLeaf.h>
+#import <WebKit/IFBookmarkSeparator.h>
#import <WebKit/IFBookmark_Private.h>
#import <WebKit/IFBookmarkGroup_Private.h>
#import <WebKit/WebKitDebug.h>
#define TitleKey @"Title"
-#define ListIdentifierKey @"ListIdentifier"
#define ChildrenKey @"Children"
@implementation IFBookmarkList
@@ -39,6 +39,7 @@
NSArray *storedChildren;
NSDictionary *childAsDictionary;
IFBookmark *child;
+ NSString *typeString;
unsigned index, count;
WEBKIT_ASSERT_VALID_ARG (dict, dict != nil);
@@ -56,18 +57,23 @@
count = [storedChildren count];
for (index = 0; index < count; ++index) {
childAsDictionary = [storedChildren objectAtIndex:index];
+ child = nil;
- // determine whether child is a leaf or a list by looking for the
- // token that this list class inserts.
- if ([childAsDictionary objectForKey:ListIdentifierKey] != nil) {
+ typeString = [childAsDictionary objectForKey:IFBookmarkTypeKey];
+ if ([typeString isEqualToString:IFBookmarkTypeListValue]) {
child = [[IFBookmarkList alloc] _initFromDictionaryRepresentation:childAsDictionary
withGroup:group];
- } else {
+ } else if ([typeString isEqualToString:IFBookmarkTypeLeafValue]) {
child = [[IFBookmarkLeaf alloc] _initFromDictionaryRepresentation:childAsDictionary
withGroup:group];
+ } else if ([typeString isEqualToString:IFBookmarkTypeSeparatorValue]) {
+ child = [[IFBookmarkSeparator alloc] _initFromDictionaryRepresentation:childAsDictionary
+ withGroup:group];
}
- [self insertChild:child atIndex:index];
+ if (child != nil) {
+ [self insertChild:child atIndex:index];
+ }
}
}
@@ -87,8 +93,7 @@
[dict setObject:_title forKey:TitleKey];
}
- // mark this as a list-type bookmark; used in _initFromDictionaryRepresentation
- [dict setObject:@"YES" forKey:ListIdentifierKey];
+ [dict setObject:IFBookmarkTypeListValue forKey:IFBookmarkTypeKey];
childCount = [self numberOfChildren];
if (childCount > 0) {
@@ -188,9 +193,9 @@
[[self _group] _bookmarkDidChange:self];
}
-- (BOOL)isLeaf
+- (IFBookmarkType)bookmarkType
{
- return NO;
+ return IFBookmarkTypeList;
}
- (NSArray *)children
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkPrivate.h b/WebKit/Bookmarks.subproj/WebBookmarkPrivate.h
index 609b169..e4f97aa 100644
--- a/WebKit/Bookmarks.subproj/WebBookmarkPrivate.h
+++ b/WebKit/Bookmarks.subproj/WebBookmarkPrivate.h
@@ -9,6 +9,11 @@
#import <WebKit/IFBookmark.h>
+#define IFBookmarkTypeKey @"IFBookmarkType"
+#define IFBookmarkTypeLeafValue @"IFBookmarkTypeLeaf"
+#define IFBookmarkTypeListValue @"IFBookmarkTypeList"
+#define IFBookmarkTypeSeparatorValue @"IFBookmarkTypeSeparator"
+
@interface IFBookmark(IFPrivate)
- (id)_initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group;
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkSeparator.h b/WebKit/Bookmarks.subproj/WebBookmarkSeparator.h
new file mode 100644
index 0000000..7786744
--- /dev/null
+++ b/WebKit/Bookmarks.subproj/WebBookmarkSeparator.h
@@ -0,0 +1,17 @@
+//
+// IFBookmarkSeparator.h
+// WebKit
+//
+// Created by John Sullivan on Mon May 20 2002.
+// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <WebKit/IFBookmark.h>
+
+
+ at interface IFBookmarkSeparator : IFBookmark {
+}
+
+- (id)initWithGroup:(IFBookmarkGroup *)group;
+
+ at end
diff --git a/WebKit/Bookmarks.subproj/WebBookmarkSeparator.m b/WebKit/Bookmarks.subproj/WebBookmarkSeparator.m
new file mode 100644
index 0000000..fbe17f2
--- /dev/null
+++ b/WebKit/Bookmarks.subproj/WebBookmarkSeparator.m
@@ -0,0 +1,52 @@
+//
+// IFBookmarkSeparator.m
+// WebKit
+//
+// Created by John Sullivan on Mon May 20 2002.
+// Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "IFBookmarkSeparator.h"
+
+#import "IFBookmark_Private.h"
+#import <WebKit/WebKitDebug.h>
+
+
+ at implementation IFBookmarkSeparator
+
+- (id)initWithGroup:(IFBookmarkGroup *)group
+{
+ WEBKIT_ASSERT_VALID_ARG (group, group != nil);
+
+ [super init];
+ [self _setGroup:group];
+
+ return self;
+}
+
+- (id)_initFromDictionaryRepresentation:(NSDictionary *)dict withGroup:(IFBookmarkGroup *)group
+{
+ if (![[dict objectForKey:IFBookmarkTypeKey] isEqualToString:IFBookmarkTypeSeparatorValue]) {
+ WEBKITDEBUG("Can't initialize Bookmark separator from non-separator type");
+ return nil;
+ }
+
+ return [self initWithGroup:group];
+}
+
+- (NSDictionary *)_dictionaryRepresentation
+{
+ return [NSDictionary dictionaryWithObject:IFBookmarkTypeSeparatorValue forKey:IFBookmarkTypeKey];
+}
+
+- (IFBookmarkType)bookmarkType
+{
+ return IFBookmarkTypeSeparator;
+}
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return [[IFBookmarkSeparator alloc] initWithGroup:[self _group]];
+}
+
+ at end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 2201bb0..e5ddbe2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,59 @@
+2002-05-20 John Sullivan <sullivan at apple.com>
+
+ Support for bookmark separators
+
+ * Bookmarks.subproj/IFBookmark.h: Update comments and replace
+ isLeaf with bookmarkType.
+
+ * Bookmarks.subproj/IFBookmark.m:
+ (-[IFBookmark bookmarkType]): New method, replaces isLeaf.
+ (-[IFBookmark title]):
+ (-[IFBookmark setTitle:]):
+ (-[IFBookmark image]):
+ (-[IFBookmark setImage:]):
+ (-[IFBookmark setURLString:]):
+ (-[IFBookmark children]):
+ (-[IFBookmark numberOfChildren]):
+ (-[IFBookmark _numberOfDescendants]):
+ (-[IFBookmark insertChild:atIndex:]):
+ (-[IFBookmark removeChild:]):
+ Update callers of isLeaf, and don't require concrete implementations
+ of some methods for some types.
+
+ * Bookmarks.subproj/IFBookmarkLeaf.m:
+ (-[IFBookmarkLeaf bookmarkType]): return IFBookmarkTypeLeaf
+ (-[IFBookmarkLeaf _dictionaryRepresentation]): set value for bookmark type.
+
+ * Bookmarks.subproj/IFBookmarkList.m:
+ (-[IFBookmarkList _initFromDictionaryRepresentation:withGroup:]):
+ Handle separator case.
+ (-[IFBookmarkList _dictionaryRepresentation]): set value for bookmark type
+ (-[IFBookmarkList bookmarkType]): return IFBookmarkTypeList
+
+ * Bookmarks.subproj/IFBookmarkSeparator.h: Added.
+ * Bookmarks.subproj/IFBookmarkSeparator.m: Added.
+ (-[IFBookmarkSeparator initWithGroup:]): Simple init method.
+ (-[IFBookmarkSeparator _initFromDictionaryRepresentation:withGroup:]): Just calls
+ initWithGroup.
+ (-[IFBookmarkSeparator _dictionaryRepresentation]): set value for bookmark type
+ (-[IFBookmarkSeparator bookmarkType]): return IFBookmarkTypeSeparator
+ (-[IFBookmarkSeparator copyWithZone:]): calls initWithGroup
+
+ * Bookmarks.subproj/IFBookmark_Private.h: Added key/value #defines for dictionary
+ representation.
+
+ * Bookmarks.subproj/IFBookmarkGroup.h:
+ * Bookmarks.subproj/IFBookmarkGroup.m:
+ (-[IFBookmarkGroup _setTopBookmark:]):
+ (-[IFBookmarkGroup _bookmarkChildrenDidChange:]):
+ (-[IFBookmarkGroup addNewBookmarkToBookmark:withTitle:image:URLString:type:]):
+ Update callers of isLeaf to use bookmarkType instead.
+
+ (-[IFBookmarkGroup insertNewBookmarkAtIndex:ofBookmark:withTitle:image:URLString:type:]):
+ if type is IFBookmarkTypeSeparator, instantiate an IFBookmarkSeparator
+
+ * WebKit.pbproj/project.pbxproj: Updated for new files.
+
2002-05-17 Chris Blumenberg <cblu at apple.com>
- Made IFPluginStream the URL handle client instead of IFPluginView.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 2201bb0..e5ddbe2 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,59 @@
+2002-05-20 John Sullivan <sullivan at apple.com>
+
+ Support for bookmark separators
+
+ * Bookmarks.subproj/IFBookmark.h: Update comments and replace
+ isLeaf with bookmarkType.
+
+ * Bookmarks.subproj/IFBookmark.m:
+ (-[IFBookmark bookmarkType]): New method, replaces isLeaf.
+ (-[IFBookmark title]):
+ (-[IFBookmark setTitle:]):
+ (-[IFBookmark image]):
+ (-[IFBookmark setImage:]):
+ (-[IFBookmark setURLString:]):
+ (-[IFBookmark children]):
+ (-[IFBookmark numberOfChildren]):
+ (-[IFBookmark _numberOfDescendants]):
+ (-[IFBookmark insertChild:atIndex:]):
+ (-[IFBookmark removeChild:]):
+ Update callers of isLeaf, and don't require concrete implementations
+ of some methods for some types.
+
+ * Bookmarks.subproj/IFBookmarkLeaf.m:
+ (-[IFBookmarkLeaf bookmarkType]): return IFBookmarkTypeLeaf
+ (-[IFBookmarkLeaf _dictionaryRepresentation]): set value for bookmark type.
+
+ * Bookmarks.subproj/IFBookmarkList.m:
+ (-[IFBookmarkList _initFromDictionaryRepresentation:withGroup:]):
+ Handle separator case.
+ (-[IFBookmarkList _dictionaryRepresentation]): set value for bookmark type
+ (-[IFBookmarkList bookmarkType]): return IFBookmarkTypeList
+
+ * Bookmarks.subproj/IFBookmarkSeparator.h: Added.
+ * Bookmarks.subproj/IFBookmarkSeparator.m: Added.
+ (-[IFBookmarkSeparator initWithGroup:]): Simple init method.
+ (-[IFBookmarkSeparator _initFromDictionaryRepresentation:withGroup:]): Just calls
+ initWithGroup.
+ (-[IFBookmarkSeparator _dictionaryRepresentation]): set value for bookmark type
+ (-[IFBookmarkSeparator bookmarkType]): return IFBookmarkTypeSeparator
+ (-[IFBookmarkSeparator copyWithZone:]): calls initWithGroup
+
+ * Bookmarks.subproj/IFBookmark_Private.h: Added key/value #defines for dictionary
+ representation.
+
+ * Bookmarks.subproj/IFBookmarkGroup.h:
+ * Bookmarks.subproj/IFBookmarkGroup.m:
+ (-[IFBookmarkGroup _setTopBookmark:]):
+ (-[IFBookmarkGroup _bookmarkChildrenDidChange:]):
+ (-[IFBookmarkGroup addNewBookmarkToBookmark:withTitle:image:URLString:type:]):
+ Update callers of isLeaf to use bookmarkType instead.
+
+ (-[IFBookmarkGroup insertNewBookmarkAtIndex:ofBookmark:withTitle:image:URLString:type:]):
+ if type is IFBookmarkTypeSeparator, instantiate an IFBookmarkSeparator
+
+ * WebKit.pbproj/project.pbxproj: Updated for new files.
+
2002-05-17 Chris Blumenberg <cblu at apple.com>
- Made IFPluginStream the URL handle client instead of IFPluginView.
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 0727306..5973e8d 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -233,6 +233,7 @@
F5F717280288493C018635CA,
F5F71748028855C5018635CA,
F5F7174E02885C5B018635CA,
+ F5C81E4302994EA401C1A525,
);
isa = PBXHeadersBuildPhase;
};
@@ -292,6 +293,7 @@
F5F717270288493C018635CA,
F5F717290288493C018635CA,
F5F7174F02885C5B018635CA,
+ F5C81E4402994EA401C1A525,
);
isa = PBXSourcesBuildPhase;
};
@@ -1048,6 +1050,8 @@
F506521E027F557E01C1A526,
F506521F027F557E01C1A526,
F5065220027F557E01C1A526,
+ F5C81E4102994EA401C1A525,
+ F5C81E4202994EA401C1A525,
);
isa = PBXGroup;
name = Bookmarks;
@@ -1598,6 +1602,30 @@
settings = {
};
};
+ F5C81E4102994EA401C1A525 = {
+ isa = PBXFileReference;
+ name = IFBookmarkSeparator.h;
+ path = Bookmarks.subproj/IFBookmarkSeparator.h;
+ refType = 2;
+ };
+ F5C81E4202994EA401C1A525 = {
+ isa = PBXFileReference;
+ name = IFBookmarkSeparator.m;
+ path = Bookmarks.subproj/IFBookmarkSeparator.m;
+ refType = 2;
+ };
+ F5C81E4302994EA401C1A525 = {
+ fileRef = F5C81E4102994EA401C1A525;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F5C81E4402994EA401C1A525 = {
+ fileRef = F5C81E4202994EA401C1A525;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
F5D538E802441F2601A80181 = {
isa = PBXFileReference;
name = IFMainURLHandleClient.h;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list