mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Check in an interim fix for bug 154442: warn before deleting bookmarks.
This commit is contained in:
parent
0f709c1c77
commit
8739da1dee
@ -283,6 +283,35 @@
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
// first, see how many items are selected
|
||||
BOOL haveBookmarks = NO;
|
||||
|
||||
NSEnumerator* testSelRows = [mOutlineView selectedRowEnumerator];
|
||||
for (NSNumber* currIndex = [testSelRows nextObject];
|
||||
currIndex != nil;
|
||||
currIndex = [testSelRows nextObject])
|
||||
{
|
||||
index = [currIndex intValue];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
if ([mOutlineView isExpandable: item]) {
|
||||
// dumb check to see if we're deleting an empty folder. Should really
|
||||
// recurse down
|
||||
if ([self outlineView:mOutlineView numberOfChildrenOfItem: item] > 0)
|
||||
haveBookmarks = YES;
|
||||
} else
|
||||
haveBookmarks = YES;
|
||||
}
|
||||
|
||||
// ideally, we should count the number of doomed bookmarks and tell the user
|
||||
if (haveBookmarks) {
|
||||
NSString *alert = NSLocalizedString(@"DeteleBookmarksAlert",@"");
|
||||
NSString *message = NSLocalizedString(@"DeteleBookmarksMsg",@"");
|
||||
NSString *okButton = NSLocalizedString(@"DeteleBookmarksOKButton",@"");
|
||||
NSString *cancelButton = NSLocalizedString(@"DeteleBookmarksCancelButton",@"");
|
||||
if (NSRunAlertPanel(alert, message, okButton, cancelButton, nil) != NSAlertDefaultReturn)
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -283,6 +283,35 @@
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
// first, see how many items are selected
|
||||
BOOL haveBookmarks = NO;
|
||||
|
||||
NSEnumerator* testSelRows = [mOutlineView selectedRowEnumerator];
|
||||
for (NSNumber* currIndex = [testSelRows nextObject];
|
||||
currIndex != nil;
|
||||
currIndex = [testSelRows nextObject])
|
||||
{
|
||||
index = [currIndex intValue];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
if ([mOutlineView isExpandable: item]) {
|
||||
// dumb check to see if we're deleting an empty folder. Should really
|
||||
// recurse down
|
||||
if ([self outlineView:mOutlineView numberOfChildrenOfItem: item] > 0)
|
||||
haveBookmarks = YES;
|
||||
} else
|
||||
haveBookmarks = YES;
|
||||
}
|
||||
|
||||
// ideally, we should count the number of doomed bookmarks and tell the user
|
||||
if (haveBookmarks) {
|
||||
NSString *alert = NSLocalizedString(@"DeteleBookmarksAlert",@"");
|
||||
NSString *message = NSLocalizedString(@"DeteleBookmarksMsg",@"");
|
||||
NSString *okButton = NSLocalizedString(@"DeteleBookmarksOKButton",@"");
|
||||
NSString *cancelButton = NSLocalizedString(@"DeteleBookmarksCancelButton",@"");
|
||||
if (NSRunAlertPanel(alert, message, okButton, cancelButton, nil) != NSAlertDefaultReturn)
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -283,6 +283,35 @@
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
// first, see how many items are selected
|
||||
BOOL haveBookmarks = NO;
|
||||
|
||||
NSEnumerator* testSelRows = [mOutlineView selectedRowEnumerator];
|
||||
for (NSNumber* currIndex = [testSelRows nextObject];
|
||||
currIndex != nil;
|
||||
currIndex = [testSelRows nextObject])
|
||||
{
|
||||
index = [currIndex intValue];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
if ([mOutlineView isExpandable: item]) {
|
||||
// dumb check to see if we're deleting an empty folder. Should really
|
||||
// recurse down
|
||||
if ([self outlineView:mOutlineView numberOfChildrenOfItem: item] > 0)
|
||||
haveBookmarks = YES;
|
||||
} else
|
||||
haveBookmarks = YES;
|
||||
}
|
||||
|
||||
// ideally, we should count the number of doomed bookmarks and tell the user
|
||||
if (haveBookmarks) {
|
||||
NSString *alert = NSLocalizedString(@"DeteleBookmarksAlert",@"");
|
||||
NSString *message = NSLocalizedString(@"DeteleBookmarksMsg",@"");
|
||||
NSString *okButton = NSLocalizedString(@"DeteleBookmarksOKButton",@"");
|
||||
NSString *cancelButton = NSLocalizedString(@"DeteleBookmarksCancelButton",@"");
|
||||
if (NSRunAlertPanel(alert, message, okButton, cancelButton, nil) != NSAlertDefaultReturn)
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
@ -283,6 +283,35 @@
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
// first, see how many items are selected
|
||||
BOOL haveBookmarks = NO;
|
||||
|
||||
NSEnumerator* testSelRows = [mOutlineView selectedRowEnumerator];
|
||||
for (NSNumber* currIndex = [testSelRows nextObject];
|
||||
currIndex != nil;
|
||||
currIndex = [testSelRows nextObject])
|
||||
{
|
||||
index = [currIndex intValue];
|
||||
BookmarkItem* item = [mOutlineView itemAtRow: index];
|
||||
if ([mOutlineView isExpandable: item]) {
|
||||
// dumb check to see if we're deleting an empty folder. Should really
|
||||
// recurse down
|
||||
if ([self outlineView:mOutlineView numberOfChildrenOfItem: item] > 0)
|
||||
haveBookmarks = YES;
|
||||
} else
|
||||
haveBookmarks = YES;
|
||||
}
|
||||
|
||||
// ideally, we should count the number of doomed bookmarks and tell the user
|
||||
if (haveBookmarks) {
|
||||
NSString *alert = NSLocalizedString(@"DeteleBookmarksAlert",@"");
|
||||
NSString *message = NSLocalizedString(@"DeteleBookmarksMsg",@"");
|
||||
NSString *okButton = NSLocalizedString(@"DeteleBookmarksOKButton",@"");
|
||||
NSString *cancelButton = NSLocalizedString(@"DeteleBookmarksCancelButton",@"");
|
||||
if (NSRunAlertPanel(alert, message, okButton, cancelButton, nil) != NSAlertDefaultReturn)
|
||||
return;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user