mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-29 17:40:42 +00:00
Fixing bug 332542, bookmarking a tab group uses frontmost page title, confusing users. Patch by Chris Lawson <bugzilla@chrislawson.net>, r=smorgan, sr=pink.
This commit is contained in:
parent
b1973cffa2
commit
c3d0a07209
@ -1,7 +1,12 @@
|
||||
{
|
||||
IBClasses = (
|
||||
{
|
||||
ACTIONS = {cancelAddBookmark = id; confirmAddBookmark = id; parentFolderChanged = id; };
|
||||
ACTIONS = {
|
||||
cancelAddBookmark = id;
|
||||
confirmAddBookmark = id;
|
||||
parentFolderChanged = id;
|
||||
toggleTabGroup = id;
|
||||
};
|
||||
CLASS = AddBookmarkDialogController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
|
@ -5,8 +5,12 @@
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>120 74 425 249 0 0 1600 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>437.0</string>
|
||||
<string>443.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>16</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8C46</string>
|
||||
<string>8I127</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Binary file not shown.
@ -55,6 +55,7 @@ extern NSString* const kAddBookmarkItemPrimaryTabKey; // NSNumber with book, t
|
||||
BookmarkFolder* mInitialParentFolder;
|
||||
int mInitialParentFolderIndex;
|
||||
NSArray* mBookmarkItems; // array of NSDictionary
|
||||
NSString* mDefaultTitle;
|
||||
BOOL mCreatingFolder;
|
||||
}
|
||||
|
||||
@ -63,6 +64,7 @@ extern NSString* const kAddBookmarkItemPrimaryTabKey; // NSNumber with book, t
|
||||
- (IBAction)confirmAddBookmark:(id)sender;
|
||||
- (IBAction)cancelAddBookmark:(id)sender;
|
||||
- (IBAction)parentFolderChanged:(id)sender;
|
||||
- (IBAction)toggleTabGroup:(id)sender;
|
||||
|
||||
- (void)setDefaultParentFolder:(BookmarkFolder*)inFolder andIndex:(int)inIndex;
|
||||
- (void)setBookmarkViewController:(BookmarkViewController*)inBMViewController;
|
||||
|
@ -113,6 +113,24 @@ NSString* const kAddBookmarkItemPrimaryTabKey = @"primary";
|
||||
mInitialParentFolderIndex = -1;
|
||||
}
|
||||
|
||||
- (IBAction)toggleTabGroup:(id)sender
|
||||
{
|
||||
NSString* defaultGroupTitle = [NSString stringWithFormat:NSLocalizedString(@"defaultTabGroupTitle", @"[%d tabs] %@"), [mBookmarkItems count], mDefaultTitle];
|
||||
|
||||
// if title is unedited and we're bookmarking a tab group, prepend a prefix to indicate this
|
||||
if ([[mTitleField stringValue] isEqualToString:mDefaultTitle] ||
|
||||
[[mTitleField stringValue] isEqualToString:defaultGroupTitle])
|
||||
{
|
||||
[mTitleField setStringValue:([mTabGroupCheckbox state] == NSOnState) ? defaultGroupTitle : mDefaultTitle];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setDefaultTitle:(NSString*)aString
|
||||
{
|
||||
[mDefaultTitle autorelease];
|
||||
mDefaultTitle = [aString retain];
|
||||
}
|
||||
|
||||
// -1 index means put at end
|
||||
- (void)setDefaultParentFolder:(BookmarkFolder*)inFolder andIndex:(int)inIndex
|
||||
{
|
||||
@ -137,13 +155,12 @@ NSString* const kAddBookmarkItemPrimaryTabKey = @"primary";
|
||||
mCreatingFolder = inIsFolder;
|
||||
|
||||
// set title field
|
||||
NSString* titleString = @"";
|
||||
if (mCreatingFolder)
|
||||
titleString = NSLocalizedString(@"NewBookmarkFolder", @"");
|
||||
[self setDefaultTitle:NSLocalizedString(@"NewBookmarkFolder", @"")];
|
||||
else
|
||||
titleString = [AddBookmarkDialogController bookmarkTitleForItem:[AddBookmarkDialogController primaryBookmarkItem:inItems]];
|
||||
[self setDefaultTitle:[AddBookmarkDialogController bookmarkTitleForItem:[AddBookmarkDialogController primaryBookmarkItem:inItems]]];
|
||||
|
||||
[mTitleField setStringValue:titleString];
|
||||
[mTitleField setStringValue:mDefaultTitle];
|
||||
|
||||
// setup tab checkbox
|
||||
if (!mCreatingFolder)
|
||||
@ -269,16 +286,17 @@ NSString* const kAddBookmarkItemPrimaryTabKey = @"primary";
|
||||
{
|
||||
[mTitleField setStringValue:@""];
|
||||
[mTabGroupCheckbox setState:NSOffState];
|
||||
|
||||
|
||||
[mInitialParentFolder release];
|
||||
mInitialParentFolder = nil;
|
||||
mInitialParentFolderIndex = -1;
|
||||
|
||||
mCreatingFolder = NO;
|
||||
[self setDefaultTitle:@""];
|
||||
|
||||
[mBookmarkItems release];
|
||||
mBookmarkItems = nil;
|
||||
|
||||
|
||||
mBookmarkViewController = nil;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user