better manage the info tab panels to fix black bg on 10.1 and forgetting
which tab is selected when going between folders/items. Also cleans up the code a lot (bugs 242650, 243246)
This commit is contained in:
Родитель
fc47ce92bf
Коммит
135ffda14a
|
@ -13,12 +13,14 @@
|
|||
mBookmarkKeywordField = NSTextField;
|
||||
mBookmarkLocationField = NSTextField;
|
||||
mBookmarkNameField = NSTextField;
|
||||
mBookmarkView = NSBox;
|
||||
mClearNumberVisitsButton = NSButton;
|
||||
mDockMenuCheckbox = NSButton;
|
||||
mDummyView = NSBox;
|
||||
mFolderDescField = NSTextField;
|
||||
mFolderKeywordField = NSTextField;
|
||||
mFolderKeywordLabel = NSTextField;
|
||||
mFolderNameField = NSTextField;
|
||||
mFolderView = NSBox;
|
||||
mLastVisitField = NSTextField;
|
||||
mNumberVisitsField = NSTextField;
|
||||
mStatusField = NSTextField;
|
||||
|
|
|
@ -5,40 +5,40 @@
|
|||
<key>IBDocumentLocation</key>
|
||||
<string>9 7 466 409 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>283.0</string>
|
||||
<string>364.0</string>
|
||||
<key>IBGroupedObjects</key>
|
||||
<dict>
|
||||
<key>13</key>
|
||||
<key>29</key>
|
||||
<array>
|
||||
<string>224</string>
|
||||
<string>225</string>
|
||||
<string>436</string>
|
||||
<string>445</string>
|
||||
</array>
|
||||
<key>14</key>
|
||||
<key>30</key>
|
||||
<array>
|
||||
<string>291</string>
|
||||
<string>292</string>
|
||||
<string>437</string>
|
||||
<string>435</string>
|
||||
<string>453</string>
|
||||
</array>
|
||||
<key>16</key>
|
||||
<key>31</key>
|
||||
<array>
|
||||
<string>296</string>
|
||||
<string>301</string>
|
||||
<string>302</string>
|
||||
<string>441</string>
|
||||
<string>448</string>
|
||||
<string>447</string>
|
||||
</array>
|
||||
<key>17</key>
|
||||
<key>32</key>
|
||||
<array>
|
||||
<string>295</string>
|
||||
<string>298</string>
|
||||
<string>299</string>
|
||||
<string>459</string>
|
||||
<string>439</string>
|
||||
<string>452</string>
|
||||
</array>
|
||||
<key>18</key>
|
||||
<key>33</key>
|
||||
<array>
|
||||
<string>280</string>
|
||||
<string>281</string>
|
||||
<string>282</string>
|
||||
<string>438</string>
|
||||
<string>450</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>IBLastGroupID</key>
|
||||
<string>19</string>
|
||||
<string>34</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array>
|
||||
<integer>130</integer>
|
||||
|
@ -46,8 +46,9 @@
|
|||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>130</integer>
|
||||
<integer>304</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>6L60</string>
|
||||
<string>7H63</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
Двоичные данные
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/objects.nib
сгенерированный
Двоичные данные
camino/resources/localized/English.lproj/BookmarkInfoPanel.nib/objects.nib
сгенерированный
Двоичный файл не отображается.
|
@ -46,6 +46,10 @@
|
|||
|
||||
@interface BookmarkInfoController : NSWindowController<BookmarksClient>
|
||||
{
|
||||
IBOutlet NSBox* mDummyView;
|
||||
IBOutlet NSBox* mBookmarkView;
|
||||
IBOutlet NSBox* mFolderView;
|
||||
|
||||
IBOutlet NSTabView* mTabView;
|
||||
IBOutlet NSTextField* mBookmarkNameField;
|
||||
IBOutlet NSTextField* mBookmarkLocationField;
|
||||
|
@ -53,7 +57,6 @@
|
|||
IBOutlet NSTextField* mBookmarkDescField;
|
||||
IBOutlet NSTextField* mFolderNameField;
|
||||
IBOutlet NSTextField* mFolderKeywordField;
|
||||
IBOutlet NSTextField* mFolderKeywordLabel;
|
||||
IBOutlet NSTextField* mFolderDescField;
|
||||
IBOutlet NSTextField* mLastVisitField;
|
||||
IBOutlet NSTextField* mStatusField;
|
||||
|
|
|
@ -72,21 +72,11 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
- (void)windowDidLoad
|
||||
{
|
||||
// keep a ref so that we can remove and add to the its superview with impunity
|
||||
[mFolderKeywordField retain];
|
||||
[mFolderKeywordLabel retain];
|
||||
[mTabgroupCheckbox retain];
|
||||
// find the TabViewItems & retain them, too. Like to do this
|
||||
// in IB, but just doesn't want to connect. So do it here.
|
||||
int tabIndex = [mTabView indexOfTabViewItemWithIdentifier:@"bminfo"];
|
||||
mBookmarkInfoTabView = [[mTabView tabViewItemAtIndex:tabIndex] retain];
|
||||
tabIndex = [mTabView indexOfTabViewItemWithIdentifier:@"bmupdate"];
|
||||
mBookmarkUpdateTabView = [[mTabView tabViewItemAtIndex:tabIndex] retain];
|
||||
tabIndex = [mTabView indexOfTabViewItemWithIdentifier:@"folinfo"];
|
||||
mFolderInfoTabView = [[mTabView tabViewItemAtIndex:tabIndex] retain];
|
||||
// it would be nice to do this in IB, but I can't make it connect.
|
||||
[mBookmarkInfoTabView setInitialFirstResponder:mBookmarkNameField];
|
||||
[mFolderInfoTabView setInitialFirstResponder:mFolderNameField];
|
||||
[mBookmarkUpdateTabView setInitialFirstResponder:mClearNumberVisitsButton];
|
||||
[[mBookmarkView retain] removeFromSuperview];
|
||||
[[mFolderView retain] removeFromSuperview];
|
||||
// find the TabViewItems
|
||||
mBookmarkInfoTabView = [mTabView tabViewItemAtIndex:[mTabView indexOfTabViewItemWithIdentifier:@"bminfo"]];
|
||||
mBookmarkUpdateTabView = [mTabView tabViewItemAtIndex:[mTabView indexOfTabViewItemWithIdentifier:@"bmupdate"]];
|
||||
// Generic notifications for Bookmark Client - only care if there's a deletion
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver:self selector:@selector(bookmarkRemoved:) name:BookmarkFolderDeletionNotification object:nil];
|
||||
|
@ -102,12 +92,8 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
[mBookmarkItem release];
|
||||
mBookmarkItem = nil;
|
||||
[mFieldEditor release];
|
||||
[mFolderKeywordField release];
|
||||
[mFolderKeywordLabel release];
|
||||
[mTabgroupCheckbox release];
|
||||
[mBookmarkInfoTabView release];
|
||||
[mBookmarkUpdateTabView release];
|
||||
[mFolderInfoTabView release];
|
||||
[mBookmarkView release];
|
||||
[mFolderView release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -119,13 +105,16 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
|
||||
-(void)windowDidBecomeKey:(NSNotification*) aNotification
|
||||
{
|
||||
NSTabViewItem *tabViewItem = [mTabView selectedTabViewItem];
|
||||
if (tabViewItem == mBookmarkInfoTabView)
|
||||
[[self window] makeFirstResponder:mBookmarkNameField];
|
||||
else if (tabViewItem == mFolderInfoTabView)
|
||||
if ([mDummyView contentView] == mBookmarkView) {
|
||||
NSTabViewItem *tabViewItem = [mTabView selectedTabViewItem];
|
||||
if (tabViewItem == mBookmarkInfoTabView)
|
||||
[[self window] makeFirstResponder:mBookmarkNameField];
|
||||
else if (tabViewItem == mBookmarkUpdateTabView)
|
||||
[[self window] makeFirstResponder:mClearNumberVisitsButton];
|
||||
}
|
||||
else {
|
||||
[[self window] makeFirstResponder:mFolderNameField];
|
||||
else if (tabViewItem == mBookmarkUpdateTabView)
|
||||
[[self window] makeFirstResponder:mClearNumberVisitsButton];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)windowDidResignKey:(NSNotification*) aNotification
|
||||
|
@ -143,7 +132,9 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
|
||||
- (void)commitChanges:(id)changedField
|
||||
{
|
||||
NSTabViewItem *tabViewItem = [mTabView selectedTabViewItem];
|
||||
NSTabViewItem *tabViewItem = nil;
|
||||
if ([mDummyView contentView] == mBookmarkView)
|
||||
tabViewItem = [mTabView selectedTabViewItem];
|
||||
BOOL isBookmark;
|
||||
if ((isBookmark = [mBookmarkItem isKindOfClass:[Bookmark class]])) {
|
||||
if ([(Bookmark *)mBookmarkItem isSeparator] || ![[mBookmarkItem parent] isKindOfClass:[BookmarkItem class]])
|
||||
|
@ -156,7 +147,7 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
[mBookmarkItem setKeyword:[mBookmarkKeywordField stringValue]];
|
||||
[(Bookmark *)mBookmarkItem setUrl:[mBookmarkLocationField stringValue]];
|
||||
}
|
||||
else if (tabViewItem == mFolderInfoTabView && !isBookmark) {
|
||||
else if ([mDummyView contentView] == mFolderView && !isBookmark) {
|
||||
[mBookmarkItem setTitle:[mFolderNameField stringValue]];
|
||||
[mBookmarkItem setDescription:[mFolderDescField stringValue]];
|
||||
if ([(BookmarkFolder *)mBookmarkItem isGroup])
|
||||
|
@ -220,20 +211,9 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
//
|
||||
// setup for bookmarks
|
||||
//
|
||||
int numTabs = [mTabView numberOfTabViewItems];
|
||||
NSBox *newView;
|
||||
if ([aBookmark isKindOfClass:[Bookmark class]]) {
|
||||
if (numTabs == 1) {
|
||||
[mTabView removeTabViewItem:mFolderInfoTabView];
|
||||
[mTabView setTabViewType:NSTopTabsBezelBorder];
|
||||
[mTabView insertTabViewItem:mBookmarkInfoTabView atIndex:0];
|
||||
[mTabView insertTabViewItem:mBookmarkUpdateTabView atIndex:1];
|
||||
[mTabView selectLastTabViewItem:self];//have to do this to avoid "2 selected tabs" ugliness
|
||||
[mTabView selectFirstTabViewItem:self];
|
||||
}
|
||||
else if (numTabs == 3) {
|
||||
[mTabView removeTabViewItem:mFolderInfoTabView];
|
||||
[mTabView selectFirstTabViewItem:self];
|
||||
}
|
||||
newView = mBookmarkView;
|
||||
[mBookmarkNameField setStringValue: [aBookmark title]];
|
||||
[mBookmarkDescField setStringValue: [aBookmark description]];
|
||||
[mBookmarkKeywordField setStringValue: [aBookmark keyword]];
|
||||
|
@ -263,7 +243,7 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
statusString = [NSString string];
|
||||
}
|
||||
[mStatusField setStringValue:statusString];
|
||||
// if it's parent is a smart folder or it's a menu separator,
|
||||
// if its parent is a smart folder or it's a menu separator,
|
||||
// we turn off all the fields. if it isn't, then we turn them all on
|
||||
id parent = [aBookmark parent];
|
||||
if (([parent isKindOfClass:[BookmarkItem class]]) &&
|
||||
|
@ -286,36 +266,15 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
// Folders
|
||||
//
|
||||
else if ([aBookmark isKindOfClass:[BookmarkFolder class]]) {
|
||||
if (numTabs == 2) {
|
||||
[mTabView removeTabViewItem:mBookmarkInfoTabView];
|
||||
[mTabView removeTabViewItem:mBookmarkUpdateTabView];
|
||||
[mTabView insertTabViewItem:mFolderInfoTabView atIndex:0];
|
||||
[mTabView setTabViewType:NSNoTabsNoBorder];
|
||||
}
|
||||
else if (numTabs == 3) {
|
||||
[mTabView removeTabViewItem:mBookmarkInfoTabView];
|
||||
[mTabView removeTabViewItem:mBookmarkUpdateTabView];
|
||||
[mTabView setTabViewType:NSNoTabsNoBorder];
|
||||
}
|
||||
NSView *superview = [mFolderKeywordField superview];
|
||||
newView = mFolderView;
|
||||
if ([(BookmarkFolder *)aBookmark isGroup]) {
|
||||
if (!superview) {
|
||||
superview = [mFolderNameField superview];
|
||||
[superview addSubview:mFolderKeywordField];
|
||||
[superview addSubview:mFolderKeywordLabel];
|
||||
[mFolderNameField setNextKeyView:mFolderKeywordField];
|
||||
}
|
||||
[mTabgroupCheckbox setState:NSOnState];
|
||||
}
|
||||
else {
|
||||
if (superview) {
|
||||
[mFolderKeywordField removeFromSuperview];
|
||||
[mFolderKeywordLabel removeFromSuperview];
|
||||
[mFolderNameField setNextKeyView:mFolderDescField];
|
||||
}
|
||||
[mTabgroupCheckbox setState:NSOffState];
|
||||
}
|
||||
[mFolderNameField setStringValue: [aBookmark title]];
|
||||
[mFolderKeywordField setStringValue: [aBookmark keyword]];
|
||||
[mFolderDescField setStringValue: [aBookmark description]];
|
||||
//
|
||||
// we can't just unselect dock menu - we have to pick a new one
|
||||
|
@ -328,6 +287,9 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
|
|||
[mDockMenuCheckbox setEnabled:YES];
|
||||
}
|
||||
}
|
||||
// Swap view if necessary
|
||||
if ([mDummyView contentView] != newView)
|
||||
[mDummyView setContentView:newView];
|
||||
// Header
|
||||
NSMutableString *truncatedTitle = [NSMutableString stringWithString:[aBookmark title]];
|
||||
[truncatedTitle truncateTo:kMaxLengthOfWindowTitle at:kTruncateAtEnd];
|
||||
|
|
Загрузка…
Ссылка в новой задаче