Fix cases where the bookmarks info window would remember the last selection,

even after it had been deleted. Also changes focus when losing key status so
the field editor gets properly released. We seem to have lost the outlets
in the bm sidebar for the info and edit buttons, re-add and re-attach them
and ensure that they are disabled when there is no selection (bug 159655).
This commit is contained in:
pinkerton%netscape.com 2002-07-29 15:13:49 +00:00
Родитель ccb82fcf6b
Коммит 1f5bb58831
26 изменённых файлов: 202 добавлений и 50 удалений

Просмотреть файл

@ -78,32 +78,35 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
[self commitChanges:[aNotification object]];
[[mFieldEditor undoManager] removeAllActions];
}
-(void)windowDidBecomeKey:(NSNotification*) aNotification
{
[[self window] makeFirstResponder:mNameField];
}
-(void)windowDidResignKey:(NSNotification*) aNotification
{
[self commitChanges:nil];
[[self window] makeFirstResponder:[self window]];
}
// if changedField is nil, commit everything
- (void)commitChanges:(id)changedField
{
if (![mBookmarkItem contentNode])
return;
// Name
if (!changedField || changedField == mNameField)
if (changedField == mNameField)
[self commitField:mNameField toProperty:BookmarksService::gNameAtom];
// Location
if (!changedField || changedField == mLocationField)
if (changedField == mLocationField)
[self commitField:mLocationField toProperty:BookmarksService::gHrefAtom];
// Keyword
if (!changedField || changedField == mKeywordField)
if (changedField == mKeywordField)
[self commitField:mKeywordField toProperty:BookmarksService::gKeywordAtom];
// Description
if (!changedField || changedField == mDescriptionField)
if (changedField == mDescriptionField)
[self commitField:mDescriptionField toProperty:BookmarksService::gDescriptionAtom];
[[mFieldEditor undoManager] removeAllActions];
@ -213,5 +216,11 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
return mFieldEditor;
}
-(void) close
{
mBookmarkItem = nil;
[super close];
}
@end

Просмотреть файл

@ -68,6 +68,14 @@
return self;
}
-(void) awakeFromNib
{
// make sure these are disabled at the start since the outliner
// starts off with no selection.
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
}
-(void) windowClosing
{
if (mBookmarks) {
@ -312,6 +320,18 @@
return;
}
// The alert panel was the key window. As soon as we dismissed it, Cocoa will
// pick a new one for us. Ideally, it'll be the window we were using when
// we clicked the delete button. However, if by chance the BookmarkInfoController
// is visible, it will become the key window since it's a panel. If we then delete
// the bookmark and try to close the window before we've setup a new bookmark,
// we'll trigger the windowDidResignKey message, which will try to update the bookmark
// we just deleted, and things will crash. So, we'll trigger windowDidResignKey now
// and avoid the unpleasentness of a crash log.
if (![[mBrowserWindowController window] isKeyWindow])
[[mBrowserWindowController window] makeKeyWindow];
// we'll run into problems if a parent item and one if its children are both selected.
// A cheap way of having to avoid scanning the list to remove children is to have the
// outliner collapse all items that are being deleted. This will cull the selection
@ -773,14 +793,14 @@
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
{
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
int index = [mOutlineView selectedRow];
if (index == -1) {
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
[bic close];
}
else {
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
[mEditBookmarkButton setEnabled:YES];
[mDeleteBookmarkButton setEnabled:YES];
if ([[bic window] isVisible])

7
camino/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -12,7 +12,12 @@
};
CLASS = BookmarksDataSource;
LANGUAGE = ObjC;
OUTLETS = {mBrowserWindowController = id; mOutlineView = id; };
OUTLETS = {
mBrowserWindowController = id;
mDeleteBookmarkButton = id;
mEditBookmarkButton = id;
mOutlineView = id;
};
SUPERCLASS = NSObject;
},
{CLASS = BookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; },

5
camino/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -9,7 +9,7 @@
<key>124</key>
<string>305 659 170 144 0 0 1152 848 </string>
<key>160</key>
<string>478 172 195 666 0 0 1152 848 </string>
<string>605 155 195 666 0 0 1152 848 </string>
<key>28</key>
<string>523 439 195 457 0 0 1280 1002 </string>
<key>297</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>403 587 360 76 0 0 1152 848 </string>
<string>404 546 343 68 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -44,6 +44,7 @@
<key>IBOpenObjects</key>
<array>
<integer>56</integer>
<integer>160</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
camino/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

7
camino/English.lproj/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -12,7 +12,12 @@
};
CLASS = BookmarksDataSource;
LANGUAGE = ObjC;
OUTLETS = {mBrowserWindowController = id; mOutlineView = id; };
OUTLETS = {
mBrowserWindowController = id;
mDeleteBookmarkButton = id;
mEditBookmarkButton = id;
mOutlineView = id;
};
SUPERCLASS = NSObject;
},
{CLASS = BookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; },

5
camino/English.lproj/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -9,7 +9,7 @@
<key>124</key>
<string>305 659 170 144 0 0 1152 848 </string>
<key>160</key>
<string>478 172 195 666 0 0 1152 848 </string>
<string>605 155 195 666 0 0 1152 848 </string>
<key>28</key>
<string>523 439 195 457 0 0 1280 1002 </string>
<key>297</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>403 587 360 76 0 0 1152 848 </string>
<string>404 546 343 68 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -44,6 +44,7 @@
<key>IBOpenObjects</key>
<array>
<integer>56</integer>
<integer>160</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
camino/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -12,7 +12,12 @@
};
CLASS = BookmarksDataSource;
LANGUAGE = ObjC;
OUTLETS = {mBrowserWindowController = id; mOutlineView = id; };
OUTLETS = {
mBrowserWindowController = id;
mDeleteBookmarkButton = id;
mEditBookmarkButton = id;
mOutlineView = id;
};
SUPERCLASS = NSObject;
},
{CLASS = BookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; },

Просмотреть файл

@ -9,7 +9,7 @@
<key>124</key>
<string>305 659 170 144 0 0 1152 848 </string>
<key>160</key>
<string>478 172 195 666 0 0 1152 848 </string>
<string>605 155 195 666 0 0 1152 848 </string>
<key>28</key>
<string>523 439 195 457 0 0 1280 1002 </string>
<key>297</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>403 587 360 76 0 0 1152 848 </string>
<string>404 546 343 68 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -44,6 +44,7 @@
<key>IBOpenObjects</key>
<array>
<integer>56</integer>
<integer>160</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -78,32 +78,35 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
[self commitChanges:[aNotification object]];
[[mFieldEditor undoManager] removeAllActions];
}
-(void)windowDidBecomeKey:(NSNotification*) aNotification
{
[[self window] makeFirstResponder:mNameField];
}
-(void)windowDidResignKey:(NSNotification*) aNotification
{
[self commitChanges:nil];
[[self window] makeFirstResponder:[self window]];
}
// if changedField is nil, commit everything
- (void)commitChanges:(id)changedField
{
if (![mBookmarkItem contentNode])
return;
// Name
if (!changedField || changedField == mNameField)
if (changedField == mNameField)
[self commitField:mNameField toProperty:BookmarksService::gNameAtom];
// Location
if (!changedField || changedField == mLocationField)
if (changedField == mLocationField)
[self commitField:mLocationField toProperty:BookmarksService::gHrefAtom];
// Keyword
if (!changedField || changedField == mKeywordField)
if (changedField == mKeywordField)
[self commitField:mKeywordField toProperty:BookmarksService::gKeywordAtom];
// Description
if (!changedField || changedField == mDescriptionField)
if (changedField == mDescriptionField)
[self commitField:mDescriptionField toProperty:BookmarksService::gDescriptionAtom];
[[mFieldEditor undoManager] removeAllActions];
@ -213,5 +216,11 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
return mFieldEditor;
}
-(void) close
{
mBookmarkItem = nil;
[super close];
}
@end

Просмотреть файл

@ -68,6 +68,14 @@
return self;
}
-(void) awakeFromNib
{
// make sure these are disabled at the start since the outliner
// starts off with no selection.
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
}
-(void) windowClosing
{
if (mBookmarks) {
@ -312,6 +320,18 @@
return;
}
// The alert panel was the key window. As soon as we dismissed it, Cocoa will
// pick a new one for us. Ideally, it'll be the window we were using when
// we clicked the delete button. However, if by chance the BookmarkInfoController
// is visible, it will become the key window since it's a panel. If we then delete
// the bookmark and try to close the window before we've setup a new bookmark,
// we'll trigger the windowDidResignKey message, which will try to update the bookmark
// we just deleted, and things will crash. So, we'll trigger windowDidResignKey now
// and avoid the unpleasentness of a crash log.
if (![[mBrowserWindowController window] isKeyWindow])
[[mBrowserWindowController window] makeKeyWindow];
// we'll run into problems if a parent item and one if its children are both selected.
// A cheap way of having to avoid scanning the list to remove children is to have the
// outliner collapse all items that are being deleted. This will cull the selection
@ -773,14 +793,14 @@
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
{
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
int index = [mOutlineView selectedRow];
if (index == -1) {
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
[bic close];
}
else {
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
[mEditBookmarkButton setEnabled:YES];
[mDeleteBookmarkButton setEnabled:YES];
if ([[bic window] isVisible])

Просмотреть файл

@ -78,32 +78,35 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
[self commitChanges:[aNotification object]];
[[mFieldEditor undoManager] removeAllActions];
}
-(void)windowDidBecomeKey:(NSNotification*) aNotification
{
[[self window] makeFirstResponder:mNameField];
}
-(void)windowDidResignKey:(NSNotification*) aNotification
{
[self commitChanges:nil];
[[self window] makeFirstResponder:[self window]];
}
// if changedField is nil, commit everything
- (void)commitChanges:(id)changedField
{
if (![mBookmarkItem contentNode])
return;
// Name
if (!changedField || changedField == mNameField)
if (changedField == mNameField)
[self commitField:mNameField toProperty:BookmarksService::gNameAtom];
// Location
if (!changedField || changedField == mLocationField)
if (changedField == mLocationField)
[self commitField:mLocationField toProperty:BookmarksService::gHrefAtom];
// Keyword
if (!changedField || changedField == mKeywordField)
if (changedField == mKeywordField)
[self commitField:mKeywordField toProperty:BookmarksService::gKeywordAtom];
// Description
if (!changedField || changedField == mDescriptionField)
if (changedField == mDescriptionField)
[self commitField:mDescriptionField toProperty:BookmarksService::gDescriptionAtom];
[[mFieldEditor undoManager] removeAllActions];
@ -213,5 +216,11 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
return mFieldEditor;
}
-(void) close
{
mBookmarkItem = nil;
[super close];
}
@end

Просмотреть файл

@ -68,6 +68,14 @@
return self;
}
-(void) awakeFromNib
{
// make sure these are disabled at the start since the outliner
// starts off with no selection.
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
}
-(void) windowClosing
{
if (mBookmarks) {
@ -312,6 +320,18 @@
return;
}
// The alert panel was the key window. As soon as we dismissed it, Cocoa will
// pick a new one for us. Ideally, it'll be the window we were using when
// we clicked the delete button. However, if by chance the BookmarkInfoController
// is visible, it will become the key window since it's a panel. If we then delete
// the bookmark and try to close the window before we've setup a new bookmark,
// we'll trigger the windowDidResignKey message, which will try to update the bookmark
// we just deleted, and things will crash. So, we'll trigger windowDidResignKey now
// and avoid the unpleasentness of a crash log.
if (![[mBrowserWindowController window] isKeyWindow])
[[mBrowserWindowController window] makeKeyWindow];
// we'll run into problems if a parent item and one if its children are both selected.
// A cheap way of having to avoid scanning the list to remove children is to have the
// outliner collapse all items that are being deleted. This will cull the selection
@ -773,14 +793,14 @@
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
{
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
int index = [mOutlineView selectedRow];
if (index == -1) {
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
[bic close];
}
else {
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
[mEditBookmarkButton setEnabled:YES];
[mDeleteBookmarkButton setEnabled:YES];
if ([[bic window] isVisible])

7
chimera/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -12,7 +12,12 @@
};
CLASS = BookmarksDataSource;
LANGUAGE = ObjC;
OUTLETS = {mBrowserWindowController = id; mOutlineView = id; };
OUTLETS = {
mBrowserWindowController = id;
mDeleteBookmarkButton = id;
mEditBookmarkButton = id;
mOutlineView = id;
};
SUPERCLASS = NSObject;
},
{CLASS = BookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; },

5
chimera/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -9,7 +9,7 @@
<key>124</key>
<string>305 659 170 144 0 0 1152 848 </string>
<key>160</key>
<string>478 172 195 666 0 0 1152 848 </string>
<string>605 155 195 666 0 0 1152 848 </string>
<key>28</key>
<string>523 439 195 457 0 0 1280 1002 </string>
<key>297</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>403 587 360 76 0 0 1152 848 </string>
<string>404 546 343 68 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -44,6 +44,7 @@
<key>IBOpenObjects</key>
<array>
<integer>56</integer>
<integer>160</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
chimera/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

7
chimera/English.lproj/BrowserWindow.nib/classes.nib сгенерированный
Просмотреть файл

@ -12,7 +12,12 @@
};
CLASS = BookmarksDataSource;
LANGUAGE = ObjC;
OUTLETS = {mBrowserWindowController = id; mOutlineView = id; };
OUTLETS = {
mBrowserWindowController = id;
mDeleteBookmarkButton = id;
mEditBookmarkButton = id;
mOutlineView = id;
};
SUPERCLASS = NSObject;
},
{CLASS = BookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; },

5
chimera/English.lproj/BrowserWindow.nib/info.nib сгенерированный
Просмотреть файл

@ -9,7 +9,7 @@
<key>124</key>
<string>305 659 170 144 0 0 1152 848 </string>
<key>160</key>
<string>478 172 195 666 0 0 1152 848 </string>
<string>605 155 195 666 0 0 1152 848 </string>
<key>28</key>
<string>523 439 195 457 0 0 1280 1002 </string>
<key>297</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>403 587 360 76 0 0 1152 848 </string>
<string>404 546 343 68 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -44,6 +44,7 @@
<key>IBOpenObjects</key>
<array>
<integer>56</integer>
<integer>160</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
chimera/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -12,7 +12,12 @@
};
CLASS = BookmarksDataSource;
LANGUAGE = ObjC;
OUTLETS = {mBrowserWindowController = id; mOutlineView = id; };
OUTLETS = {
mBrowserWindowController = id;
mDeleteBookmarkButton = id;
mEditBookmarkButton = id;
mOutlineView = id;
};
SUPERCLASS = NSObject;
},
{CLASS = BookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; },

Просмотреть файл

@ -9,7 +9,7 @@
<key>124</key>
<string>305 659 170 144 0 0 1152 848 </string>
<key>160</key>
<string>478 172 195 666 0 0 1152 848 </string>
<string>605 155 195 666 0 0 1152 848 </string>
<key>28</key>
<string>523 439 195 457 0 0 1280 1002 </string>
<key>297</key>
@ -23,7 +23,7 @@
<key>463</key>
<string>22 619 200 180 0 0 1152 848 </string>
<key>56</key>
<string>403 587 360 76 0 0 1152 848 </string>
<string>404 546 343 68 0 0 1152 848 </string>
</dict>
<key>IBFramework Version</key>
<string>248.0</string>
@ -44,6 +44,7 @@
<key>IBOpenObjects</key>
<array>
<integer>56</integer>
<integer>160</integer>
</array>
<key>IBSystem Version</key>
<string>5S60</string>

Двоичные данные
chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib сгенерированный

Двоичный файл не отображается.

Просмотреть файл

@ -78,32 +78,35 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
[self commitChanges:[aNotification object]];
[[mFieldEditor undoManager] removeAllActions];
}
-(void)windowDidBecomeKey:(NSNotification*) aNotification
{
[[self window] makeFirstResponder:mNameField];
}
-(void)windowDidResignKey:(NSNotification*) aNotification
{
[self commitChanges:nil];
[[self window] makeFirstResponder:[self window]];
}
// if changedField is nil, commit everything
- (void)commitChanges:(id)changedField
{
if (![mBookmarkItem contentNode])
return;
// Name
if (!changedField || changedField == mNameField)
if (changedField == mNameField)
[self commitField:mNameField toProperty:BookmarksService::gNameAtom];
// Location
if (!changedField || changedField == mLocationField)
if (changedField == mLocationField)
[self commitField:mLocationField toProperty:BookmarksService::gHrefAtom];
// Keyword
if (!changedField || changedField == mKeywordField)
if (changedField == mKeywordField)
[self commitField:mKeywordField toProperty:BookmarksService::gKeywordAtom];
// Description
if (!changedField || changedField == mDescriptionField)
if (changedField == mDescriptionField)
[self commitField:mDescriptionField toProperty:BookmarksService::gDescriptionAtom];
[[mFieldEditor undoManager] removeAllActions];
@ -213,5 +216,11 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
return mFieldEditor;
}
-(void) close
{
mBookmarkItem = nil;
[super close];
}
@end

Просмотреть файл

@ -68,6 +68,14 @@
return self;
}
-(void) awakeFromNib
{
// make sure these are disabled at the start since the outliner
// starts off with no selection.
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
}
-(void) windowClosing
{
if (mBookmarks) {
@ -312,6 +320,18 @@
return;
}
// The alert panel was the key window. As soon as we dismissed it, Cocoa will
// pick a new one for us. Ideally, it'll be the window we were using when
// we clicked the delete button. However, if by chance the BookmarkInfoController
// is visible, it will become the key window since it's a panel. If we then delete
// the bookmark and try to close the window before we've setup a new bookmark,
// we'll trigger the windowDidResignKey message, which will try to update the bookmark
// we just deleted, and things will crash. So, we'll trigger windowDidResignKey now
// and avoid the unpleasentness of a crash log.
if (![[mBrowserWindowController window] isKeyWindow])
[[mBrowserWindowController window] makeKeyWindow];
// we'll run into problems if a parent item and one if its children are both selected.
// A cheap way of having to avoid scanning the list to remove children is to have the
// outliner collapse all items that are being deleted. This will cull the selection
@ -773,14 +793,14 @@
-(void)outlineViewSelectionDidChange: (NSNotification*) aNotification
{
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
int index = [mOutlineView selectedRow];
if (index == -1) {
[mEditBookmarkButton setEnabled:NO];
[mDeleteBookmarkButton setEnabled:NO];
[bic close];
}
else {
BookmarkInfoController *bic = [BookmarkInfoController sharedBookmarkInfoController];
[mEditBookmarkButton setEnabled:YES];
[mDeleteBookmarkButton setEnabled:YES];
if ([[bic window] isVisible])