diff --git a/mozilla/camino/BrowserWindow.nib/classes.nib b/mozilla/camino/BrowserWindow.nib/classes.nib index 669269f11fb..ff1d11f6433 100644 --- a/mozilla/camino/BrowserWindow.nib/classes.nib +++ b/mozilla/camino/BrowserWindow.nib/classes.nib @@ -34,7 +34,6 @@ stop = id; toggleSidebar = id; viewOnlyThisImage = id; - viewSource = id; }; CLASS = BrowserWindowController; LANGUAGE = ObjC; @@ -44,6 +43,7 @@ mAddBookmarkSheetWindow = id; mAddBookmarkTitleField = id; mCachedBMDS = id; + mHistoryDataSource = id; mImageLinkMenu = id; mImageMenu = id; mInputMenu = id; @@ -75,7 +75,18 @@ {CLASS = CHBookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, {CLASS = CHExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = CHExtendedTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; }, + { + CLASS = CHHistoryDataSource; + LANGUAGE = ObjC; + SUPERCLASS = CHRDFOutlineViewDataSource; + }, {CLASS = CHLocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + { + CLASS = CHRDFOutlineViewDataSource; + LANGUAGE = ObjC; + OUTLETS = {mOutlineView = id; }; + SUPERCLASS = NSObject; + }, {CLASS = ExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = LocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -98,7 +109,8 @@ urlbar = id; }; SUPERCLASS = NSView; - } + }, + {CLASS = RDFOutlineViewItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } \ No newline at end of file diff --git a/mozilla/camino/BrowserWindow.nib/info.nib b/mozilla/camino/BrowserWindow.nib/info.nib index 2c3eba022a1..4715c3421a5 100644 --- a/mozilla/camino/BrowserWindow.nib/info.nib +++ b/mozilla/camino/BrowserWindow.nib/info.nib @@ -3,29 +3,31 @@ IBDocumentLocation - 7 130 480 309 0 0 1152 746 + 97 226 480 309 0 0 1280 1002 IBEditorPositions 124 431 537 170 180 0 0 1152 746 160 - 478 70 195 666 0 0 1152 746 + 572 326 195 666 0 0 1280 1002 28 - 478 279 195 457 0 0 1152 746 + 572 439 195 457 0 0 1280 1002 297 - 70 110 198 210 0 0 1152 746 + 70 110 187 210 0 0 1152 746 314 - 271 139 198 180 0 0 1152 746 + 271 139 168 180 0 0 1152 746 336 458 90 200 162 0 0 1152 746 + 343 + 499 330 200 252 0 0 1152 746 365 22 500 93 162 0 0 1152 746 463 7 444 200 252 0 0 1152 746 475 - 516 447 120 142 0 0 1152 746 + 609 597 120 142 0 0 1280 1002 56 - 404 484 343 68 0 0 1152 746 + 498 634 343 68 0 0 1280 1002 IBFramework Version 248.0 @@ -45,12 +47,9 @@ IBOpenObjects - 475 - 297 160 - 56 IBSystem Version - 5Q125 + 5L21 diff --git a/mozilla/camino/BrowserWindow.nib/objects.nib b/mozilla/camino/BrowserWindow.nib/objects.nib index a59a8c9f98f..9fe1c12a92b 100644 Binary files a/mozilla/camino/BrowserWindow.nib/objects.nib and b/mozilla/camino/BrowserWindow.nib/objects.nib differ diff --git a/mozilla/camino/BrowserWindowController.h b/mozilla/camino/BrowserWindowController.h index 351d7940625..5e843463a3c 100644 --- a/mozilla/camino/BrowserWindowController.h +++ b/mozilla/camino/BrowserWindowController.h @@ -58,6 +58,7 @@ class nsIDOMNode; IBOutlet id mSidebarBrowserView; IBOutlet id mSidebarBookmarksDataSource; + IBOutlet id mHistoryDataSource; IBOutlet CHBookmarksToolbar* mPersonalToolbar; diff --git a/mozilla/camino/BrowserWindowController.mm b/mozilla/camino/BrowserWindowController.mm index 33d61eb485d..d34c77ff679 100644 --- a/mozilla/camino/BrowserWindowController.mm +++ b/mozilla/camino/BrowserWindowController.mm @@ -203,6 +203,8 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item"; - (void)drawerWillOpen: (NSNotification*)aNotification { [mSidebarBookmarksDataSource ensureBookmarks]; + + [mHistoryDataSource ensureDataSourceLoaded]; // Force the window to shrink and move if necessary in order to accommodate the sidebar. NSRect screenFrame = [[[self window] screen] visibleFrame]; diff --git a/mozilla/camino/CHRDFOutlineViewDataSource.h b/mozilla/camino/CHRDFOutlineViewDataSource.h index b703ea3753f..5d08e5d8df6 100644 --- a/mozilla/camino/CHRDFOutlineViewDataSource.h +++ b/mozilla/camino/CHRDFOutlineViewDataSource.h @@ -37,7 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #import -#include +#import class nsIRDFDataSource; class nsIRDFContainer; @@ -46,17 +46,17 @@ class nsIRDFResource; class nsIRDFService; @interface CHRDFOutlineViewDataSource : NSObject { - nsIRDFDataSource* mDataSource; - nsIRDFContainer* mContainer; - nsIRDFContainerUtils* mContainerUtils; - nsIRDFResource* mRootResource; - nsIRDFService* mRDFService; + nsIRDFDataSource* mDataSource; + nsIRDFContainer* mContainer; + nsIRDFContainerUtils* mContainerUtils; + nsIRDFResource* mRootResource; + nsIRDFService* mRDFService; IBOutlet id mOutlineView; } // Initialization Methods -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource; +- (void) ensureDataSourceLoaded; - (nsIRDFDataSource*) dataSource; - (nsIRDFResource*) rootResource; diff --git a/mozilla/camino/CHRDFOutlineViewDataSource.mm b/mozilla/camino/CHRDFOutlineViewDataSource.mm index 6f37b665953..1040b84700d 100644 --- a/mozilla/camino/CHRDFOutlineViewDataSource.mm +++ b/mozilla/camino/CHRDFOutlineViewDataSource.mm @@ -44,6 +44,7 @@ #include "nsIRDFResource.h" #include "nsIRDFContainer.h" #include "nsIRDFContainerUtils.h" +#include "nsRDFCID.h" #include "nsComponentManagerUtils.h" #include "nsIServiceManagerUtils.h" @@ -51,36 +52,23 @@ #include "nsXPIDLString.h" #include "nsString.h" + + @implementation CHRDFOutlineViewDataSource -- (id) init +- (void) ensureDataSourceLoaded { - if ((self = [super init])) { - nsCOMPtr ctr(do_CreateInstance("@mozilla.org/rdf/container;1")); - NS_ADDREF(mContainer = ctr); + nsCOMPtr ctr = do_CreateInstance("@mozilla.org/rdf/container;1"); + NS_ADDREF(mContainer = ctr); - nsCOMPtr ctrUtils(do_GetService("@mozilla.org/rdf/container-utils;1")); - NS_ADDREF(mContainerUtils = ctrUtils); + nsCOMPtr ctrUtils = do_GetService("@mozilla.org/rdf/container-utils;1"); + NS_ADDREF(mContainerUtils = ctrUtils); - nsCOMPtr rdfService(do_GetService("@mozilla.org/rdf/rdf-service;1")); - NS_ADDREF(mRDFService = rdfService); + nsCOMPtr rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1"); + NS_ADDREF(mRDFService = rdfService); - mDataSource = nsnull; - mRootResource = nsnull; - } - return self; -} - -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource -{ - NS_ASSERTION(aDataSource != nsnull, "Trying to initWithDataSource without a data source!"); - if (!aDataSource) - return nil; - - NS_ADDREF(mDataSource = aDataSource); - NS_IF_ADDREF(mRootResource = aRootResource); - - return [self init]; + mDataSource = nsnull; + mRootResource = nsnull; } - (void) dealloc @@ -127,15 +115,35 @@ return NO; } -// XXX write me -- (BOOL)outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem +- (BOOL) outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem { - return NO; + NSLog(@"outlineView:%@isItemExpandable:%@", aOutlineView, aItem); + if (!mDataSource) + return NO; + + if (!aItem) + return YES; // The root is always open + + nsCOMPtr itemResource = [aItem resource]; + + PRBool isSeq = PR_FALSE; + mContainerUtils->IsSeq(mDataSource, itemResource, &isSeq); + if (isSeq) + return YES; + + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); + + nsCOMPtr childNode; + mDataSource->GetTarget(itemResource, childProperty, PR_TRUE, getter_AddRefs(childNode)); + + return childNode != nsnull; } - (id) outlineView: (NSOutlineView*) aOutlineView child: (int) aIndex ofItem: (id) aItem { + NSLog(@"outlineView:%@child:%dofItem:%@", aOutlineView, aIndex, aItem); if (!mDataSource) return nil; @@ -157,18 +165,40 @@ - (int) outlineView: (NSOutlineView*) aOutlineView numberOfChildrenOfItem: (id) aItem; { + NSLog(@"outlineView:%@numberOfChildrenOfItem:%@", aOutlineView, aItem); if (!mDataSource) return nil; nsCOMPtr resource = !aItem ? mRootResource : [aItem resource]; - nsresult rv = mContainer->Init(mDataSource, resource); - NS_ASSERTION(NS_SUCCEEDED(rv), "Not a container!"); - if (NS_FAILED(rv)) - return 0; + // XXX just assume NC:child is the only containment arc for now + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); - PRInt32 count; - mContainer->GetCount(&count); + nsCOMPtr childNodes; + mDataSource->GetTargets(resource, childProperty, PR_TRUE, getter_AddRefs(childNodes)); + + PRBool hasMore = PR_FALSE; + childNodes->HasMoreElements(&hasMore); + + PRInt32 count = 0; + + while (hasMore) { + nsCOMPtr supp; + childNodes->GetNext(getter_AddRefs(supp)); + + ++count; + + childNodes->HasMoreElements(&hasMore); + } + + if (!count) { + nsresult rv = mContainer->Init(mDataSource, resource); + if (NS_FAILED(rv)) + return 0; + + mContainer->GetCount(&count); + } return count; } @@ -176,6 +206,7 @@ - (id) outlineView: (NSOutlineView*) aOutlineView objectValueForTableColumn: (NSTableColumn*) aTableColumn byItem: (id) aItem { + NSLog(@"outlineView:%@objectValueForTableColumn:%@byItem:%@", aOutlineView, aTableColumn, aItem); if (!mDataSource || !aItem) return nil; diff --git a/mozilla/camino/Chimera.pbproj/project.pbxproj b/mozilla/camino/Chimera.pbproj/project.pbxproj index eb601662f4c..a256f3b26cb 100644 --- a/mozilla/camino/Chimera.pbproj/project.pbxproj +++ b/mozilla/camino/Chimera.pbproj/project.pbxproj @@ -24,6 +24,8 @@ F59E9F3F0237E43401A967DF, F52D5CD0027A887001A80166, F52D5CD4027A88C601A80166, + F52F87CD027D75C301A80165, + F52F87CE027D75C301A80165, ); isa = PBXGroup; name = Classes; @@ -400,6 +402,8 @@ F52D5CD1027A887001A80166, F52D5CD5027A88C601A80166, F52D5CD9027D3D5001A80166, + F52F87CF027D75C301A80165, + F52F87D0027D75C301A80165, ); isa = PBXHeadersBuildPhase; name = Headers; @@ -492,6 +496,8 @@ F52D5CD2027A887001A80166, F52D5CD6027A88C601A80166, F52D5CDA027D3D5001A80166, + F52F87D1027D75C301A80165, + F52F87D2027D75C301A80165, ); isa = PBXSourcesBuildPhase; name = Sources; @@ -896,6 +902,8 @@ F5137A1102676B9101026D05, F52D5CCF027A887001A80166, F52D5CD3027A88C601A80166, + F52F87CB027D75C301A80165, + F52F87CC027D75C301A80165, ); isa = PBXGroup; name = Headers; @@ -1482,6 +1490,50 @@ settings = { }; }; + F52F87CB027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.h; + refType = 4; + }; + F52F87CC027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.h; + refType = 4; + }; + F52F87CD027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.mm; + refType = 4; + }; + F52F87CE027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.mm; + refType = 4; + }; + F52F87CF027D75C301A80165 = { + fileRef = F52F87CB027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D0027D75C301A80165 = { + fileRef = F52F87CC027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D1027D75C301A80165 = { + fileRef = F52F87CD027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D2027D75C301A80165 = { + fileRef = F52F87CE027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; F538DFAE023B36A7010001CA = { children = ( F538DFAF023B3739010001CA, diff --git a/mozilla/camino/English.lproj/BrowserWindow.nib/classes.nib b/mozilla/camino/English.lproj/BrowserWindow.nib/classes.nib index 669269f11fb..ff1d11f6433 100644 --- a/mozilla/camino/English.lproj/BrowserWindow.nib/classes.nib +++ b/mozilla/camino/English.lproj/BrowserWindow.nib/classes.nib @@ -34,7 +34,6 @@ stop = id; toggleSidebar = id; viewOnlyThisImage = id; - viewSource = id; }; CLASS = BrowserWindowController; LANGUAGE = ObjC; @@ -44,6 +43,7 @@ mAddBookmarkSheetWindow = id; mAddBookmarkTitleField = id; mCachedBMDS = id; + mHistoryDataSource = id; mImageLinkMenu = id; mImageMenu = id; mInputMenu = id; @@ -75,7 +75,18 @@ {CLASS = CHBookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, {CLASS = CHExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = CHExtendedTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; }, + { + CLASS = CHHistoryDataSource; + LANGUAGE = ObjC; + SUPERCLASS = CHRDFOutlineViewDataSource; + }, {CLASS = CHLocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + { + CLASS = CHRDFOutlineViewDataSource; + LANGUAGE = ObjC; + OUTLETS = {mOutlineView = id; }; + SUPERCLASS = NSObject; + }, {CLASS = ExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = LocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -98,7 +109,8 @@ urlbar = id; }; SUPERCLASS = NSView; - } + }, + {CLASS = RDFOutlineViewItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } \ No newline at end of file diff --git a/mozilla/camino/English.lproj/BrowserWindow.nib/info.nib b/mozilla/camino/English.lproj/BrowserWindow.nib/info.nib index 2c3eba022a1..4715c3421a5 100644 --- a/mozilla/camino/English.lproj/BrowserWindow.nib/info.nib +++ b/mozilla/camino/English.lproj/BrowserWindow.nib/info.nib @@ -3,29 +3,31 @@ IBDocumentLocation - 7 130 480 309 0 0 1152 746 + 97 226 480 309 0 0 1280 1002 IBEditorPositions 124 431 537 170 180 0 0 1152 746 160 - 478 70 195 666 0 0 1152 746 + 572 326 195 666 0 0 1280 1002 28 - 478 279 195 457 0 0 1152 746 + 572 439 195 457 0 0 1280 1002 297 - 70 110 198 210 0 0 1152 746 + 70 110 187 210 0 0 1152 746 314 - 271 139 198 180 0 0 1152 746 + 271 139 168 180 0 0 1152 746 336 458 90 200 162 0 0 1152 746 + 343 + 499 330 200 252 0 0 1152 746 365 22 500 93 162 0 0 1152 746 463 7 444 200 252 0 0 1152 746 475 - 516 447 120 142 0 0 1152 746 + 609 597 120 142 0 0 1280 1002 56 - 404 484 343 68 0 0 1152 746 + 498 634 343 68 0 0 1280 1002 IBFramework Version 248.0 @@ -45,12 +47,9 @@ IBOpenObjects - 475 - 297 160 - 56 IBSystem Version - 5Q125 + 5L21 diff --git a/mozilla/camino/English.lproj/BrowserWindow.nib/objects.nib b/mozilla/camino/English.lproj/BrowserWindow.nib/objects.nib index a59a8c9f98f..9fe1c12a92b 100644 Binary files a/mozilla/camino/English.lproj/BrowserWindow.nib/objects.nib and b/mozilla/camino/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/mozilla/camino/projects/Chimera.pbproj/project.pbxproj b/mozilla/camino/projects/Chimera.pbproj/project.pbxproj index eb601662f4c..a256f3b26cb 100644 --- a/mozilla/camino/projects/Chimera.pbproj/project.pbxproj +++ b/mozilla/camino/projects/Chimera.pbproj/project.pbxproj @@ -24,6 +24,8 @@ F59E9F3F0237E43401A967DF, F52D5CD0027A887001A80166, F52D5CD4027A88C601A80166, + F52F87CD027D75C301A80165, + F52F87CE027D75C301A80165, ); isa = PBXGroup; name = Classes; @@ -400,6 +402,8 @@ F52D5CD1027A887001A80166, F52D5CD5027A88C601A80166, F52D5CD9027D3D5001A80166, + F52F87CF027D75C301A80165, + F52F87D0027D75C301A80165, ); isa = PBXHeadersBuildPhase; name = Headers; @@ -492,6 +496,8 @@ F52D5CD2027A887001A80166, F52D5CD6027A88C601A80166, F52D5CDA027D3D5001A80166, + F52F87D1027D75C301A80165, + F52F87D2027D75C301A80165, ); isa = PBXSourcesBuildPhase; name = Sources; @@ -896,6 +902,8 @@ F5137A1102676B9101026D05, F52D5CCF027A887001A80166, F52D5CD3027A88C601A80166, + F52F87CB027D75C301A80165, + F52F87CC027D75C301A80165, ); isa = PBXGroup; name = Headers; @@ -1482,6 +1490,50 @@ settings = { }; }; + F52F87CB027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.h; + refType = 4; + }; + F52F87CC027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.h; + refType = 4; + }; + F52F87CD027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.mm; + refType = 4; + }; + F52F87CE027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.mm; + refType = 4; + }; + F52F87CF027D75C301A80165 = { + fileRef = F52F87CB027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D0027D75C301A80165 = { + fileRef = F52F87CC027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D1027D75C301A80165 = { + fileRef = F52F87CD027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D2027D75C301A80165 = { + fileRef = F52F87CE027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; F538DFAE023B36A7010001CA = { children = ( F538DFAF023B3739010001CA, diff --git a/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib b/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib index 669269f11fb..ff1d11f6433 100644 --- a/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib +++ b/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib @@ -34,7 +34,6 @@ stop = id; toggleSidebar = id; viewOnlyThisImage = id; - viewSource = id; }; CLASS = BrowserWindowController; LANGUAGE = ObjC; @@ -44,6 +43,7 @@ mAddBookmarkSheetWindow = id; mAddBookmarkTitleField = id; mCachedBMDS = id; + mHistoryDataSource = id; mImageLinkMenu = id; mImageMenu = id; mInputMenu = id; @@ -75,7 +75,18 @@ {CLASS = CHBookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, {CLASS = CHExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = CHExtendedTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; }, + { + CLASS = CHHistoryDataSource; + LANGUAGE = ObjC; + SUPERCLASS = CHRDFOutlineViewDataSource; + }, {CLASS = CHLocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + { + CLASS = CHRDFOutlineViewDataSource; + LANGUAGE = ObjC; + OUTLETS = {mOutlineView = id; }; + SUPERCLASS = NSObject; + }, {CLASS = ExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = LocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -98,7 +109,8 @@ urlbar = id; }; SUPERCLASS = NSView; - } + }, + {CLASS = RDFOutlineViewItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } \ No newline at end of file diff --git a/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib b/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib index 2c3eba022a1..4715c3421a5 100644 --- a/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib +++ b/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib @@ -3,29 +3,31 @@ IBDocumentLocation - 7 130 480 309 0 0 1152 746 + 97 226 480 309 0 0 1280 1002 IBEditorPositions 124 431 537 170 180 0 0 1152 746 160 - 478 70 195 666 0 0 1152 746 + 572 326 195 666 0 0 1280 1002 28 - 478 279 195 457 0 0 1152 746 + 572 439 195 457 0 0 1280 1002 297 - 70 110 198 210 0 0 1152 746 + 70 110 187 210 0 0 1152 746 314 - 271 139 198 180 0 0 1152 746 + 271 139 168 180 0 0 1152 746 336 458 90 200 162 0 0 1152 746 + 343 + 499 330 200 252 0 0 1152 746 365 22 500 93 162 0 0 1152 746 463 7 444 200 252 0 0 1152 746 475 - 516 447 120 142 0 0 1152 746 + 609 597 120 142 0 0 1280 1002 56 - 404 484 343 68 0 0 1152 746 + 498 634 343 68 0 0 1280 1002 IBFramework Version 248.0 @@ -45,12 +47,9 @@ IBOpenObjects - 475 - 297 160 - 56 IBSystem Version - 5Q125 + 5L21 diff --git a/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib b/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib index a59a8c9f98f..9fe1c12a92b 100644 Binary files a/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib and b/mozilla/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/mozilla/camino/src/browser/BrowserWindowController.h b/mozilla/camino/src/browser/BrowserWindowController.h index 351d7940625..5e843463a3c 100644 --- a/mozilla/camino/src/browser/BrowserWindowController.h +++ b/mozilla/camino/src/browser/BrowserWindowController.h @@ -58,6 +58,7 @@ class nsIDOMNode; IBOutlet id mSidebarBrowserView; IBOutlet id mSidebarBookmarksDataSource; + IBOutlet id mHistoryDataSource; IBOutlet CHBookmarksToolbar* mPersonalToolbar; diff --git a/mozilla/camino/src/browser/BrowserWindowController.mm b/mozilla/camino/src/browser/BrowserWindowController.mm index 33d61eb485d..d34c77ff679 100644 --- a/mozilla/camino/src/browser/BrowserWindowController.mm +++ b/mozilla/camino/src/browser/BrowserWindowController.mm @@ -203,6 +203,8 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item"; - (void)drawerWillOpen: (NSNotification*)aNotification { [mSidebarBookmarksDataSource ensureBookmarks]; + + [mHistoryDataSource ensureDataSourceLoaded]; // Force the window to shrink and move if necessary in order to accommodate the sidebar. NSRect screenFrame = [[[self window] screen] visibleFrame]; diff --git a/mozilla/camino/src/extensions/RDFOutlineViewDataSource.h b/mozilla/camino/src/extensions/RDFOutlineViewDataSource.h index b703ea3753f..5d08e5d8df6 100644 --- a/mozilla/camino/src/extensions/RDFOutlineViewDataSource.h +++ b/mozilla/camino/src/extensions/RDFOutlineViewDataSource.h @@ -37,7 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #import -#include +#import class nsIRDFDataSource; class nsIRDFContainer; @@ -46,17 +46,17 @@ class nsIRDFResource; class nsIRDFService; @interface CHRDFOutlineViewDataSource : NSObject { - nsIRDFDataSource* mDataSource; - nsIRDFContainer* mContainer; - nsIRDFContainerUtils* mContainerUtils; - nsIRDFResource* mRootResource; - nsIRDFService* mRDFService; + nsIRDFDataSource* mDataSource; + nsIRDFContainer* mContainer; + nsIRDFContainerUtils* mContainerUtils; + nsIRDFResource* mRootResource; + nsIRDFService* mRDFService; IBOutlet id mOutlineView; } // Initialization Methods -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource; +- (void) ensureDataSourceLoaded; - (nsIRDFDataSource*) dataSource; - (nsIRDFResource*) rootResource; diff --git a/mozilla/camino/src/extensions/RDFOutlineViewDataSource.mm b/mozilla/camino/src/extensions/RDFOutlineViewDataSource.mm index 6f37b665953..1040b84700d 100644 --- a/mozilla/camino/src/extensions/RDFOutlineViewDataSource.mm +++ b/mozilla/camino/src/extensions/RDFOutlineViewDataSource.mm @@ -44,6 +44,7 @@ #include "nsIRDFResource.h" #include "nsIRDFContainer.h" #include "nsIRDFContainerUtils.h" +#include "nsRDFCID.h" #include "nsComponentManagerUtils.h" #include "nsIServiceManagerUtils.h" @@ -51,36 +52,23 @@ #include "nsXPIDLString.h" #include "nsString.h" + + @implementation CHRDFOutlineViewDataSource -- (id) init +- (void) ensureDataSourceLoaded { - if ((self = [super init])) { - nsCOMPtr ctr(do_CreateInstance("@mozilla.org/rdf/container;1")); - NS_ADDREF(mContainer = ctr); + nsCOMPtr ctr = do_CreateInstance("@mozilla.org/rdf/container;1"); + NS_ADDREF(mContainer = ctr); - nsCOMPtr ctrUtils(do_GetService("@mozilla.org/rdf/container-utils;1")); - NS_ADDREF(mContainerUtils = ctrUtils); + nsCOMPtr ctrUtils = do_GetService("@mozilla.org/rdf/container-utils;1"); + NS_ADDREF(mContainerUtils = ctrUtils); - nsCOMPtr rdfService(do_GetService("@mozilla.org/rdf/rdf-service;1")); - NS_ADDREF(mRDFService = rdfService); + nsCOMPtr rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1"); + NS_ADDREF(mRDFService = rdfService); - mDataSource = nsnull; - mRootResource = nsnull; - } - return self; -} - -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource -{ - NS_ASSERTION(aDataSource != nsnull, "Trying to initWithDataSource without a data source!"); - if (!aDataSource) - return nil; - - NS_ADDREF(mDataSource = aDataSource); - NS_IF_ADDREF(mRootResource = aRootResource); - - return [self init]; + mDataSource = nsnull; + mRootResource = nsnull; } - (void) dealloc @@ -127,15 +115,35 @@ return NO; } -// XXX write me -- (BOOL)outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem +- (BOOL) outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem { - return NO; + NSLog(@"outlineView:%@isItemExpandable:%@", aOutlineView, aItem); + if (!mDataSource) + return NO; + + if (!aItem) + return YES; // The root is always open + + nsCOMPtr itemResource = [aItem resource]; + + PRBool isSeq = PR_FALSE; + mContainerUtils->IsSeq(mDataSource, itemResource, &isSeq); + if (isSeq) + return YES; + + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); + + nsCOMPtr childNode; + mDataSource->GetTarget(itemResource, childProperty, PR_TRUE, getter_AddRefs(childNode)); + + return childNode != nsnull; } - (id) outlineView: (NSOutlineView*) aOutlineView child: (int) aIndex ofItem: (id) aItem { + NSLog(@"outlineView:%@child:%dofItem:%@", aOutlineView, aIndex, aItem); if (!mDataSource) return nil; @@ -157,18 +165,40 @@ - (int) outlineView: (NSOutlineView*) aOutlineView numberOfChildrenOfItem: (id) aItem; { + NSLog(@"outlineView:%@numberOfChildrenOfItem:%@", aOutlineView, aItem); if (!mDataSource) return nil; nsCOMPtr resource = !aItem ? mRootResource : [aItem resource]; - nsresult rv = mContainer->Init(mDataSource, resource); - NS_ASSERTION(NS_SUCCEEDED(rv), "Not a container!"); - if (NS_FAILED(rv)) - return 0; + // XXX just assume NC:child is the only containment arc for now + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); - PRInt32 count; - mContainer->GetCount(&count); + nsCOMPtr childNodes; + mDataSource->GetTargets(resource, childProperty, PR_TRUE, getter_AddRefs(childNodes)); + + PRBool hasMore = PR_FALSE; + childNodes->HasMoreElements(&hasMore); + + PRInt32 count = 0; + + while (hasMore) { + nsCOMPtr supp; + childNodes->GetNext(getter_AddRefs(supp)); + + ++count; + + childNodes->HasMoreElements(&hasMore); + } + + if (!count) { + nsresult rv = mContainer->Init(mDataSource, resource); + if (NS_FAILED(rv)) + return 0; + + mContainer->GetCount(&count); + } return count; } @@ -176,6 +206,7 @@ - (id) outlineView: (NSOutlineView*) aOutlineView objectValueForTableColumn: (NSTableColumn*) aTableColumn byItem: (id) aItem { + NSLog(@"outlineView:%@objectValueForTableColumn:%@byItem:%@", aOutlineView, aTableColumn, aItem); if (!mDataSource || !aItem) return nil; diff --git a/mozilla/chimera/BrowserWindow.nib/classes.nib b/mozilla/chimera/BrowserWindow.nib/classes.nib index 669269f11fb..ff1d11f6433 100644 --- a/mozilla/chimera/BrowserWindow.nib/classes.nib +++ b/mozilla/chimera/BrowserWindow.nib/classes.nib @@ -34,7 +34,6 @@ stop = id; toggleSidebar = id; viewOnlyThisImage = id; - viewSource = id; }; CLASS = BrowserWindowController; LANGUAGE = ObjC; @@ -44,6 +43,7 @@ mAddBookmarkSheetWindow = id; mAddBookmarkTitleField = id; mCachedBMDS = id; + mHistoryDataSource = id; mImageLinkMenu = id; mImageMenu = id; mInputMenu = id; @@ -75,7 +75,18 @@ {CLASS = CHBookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, {CLASS = CHExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = CHExtendedTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; }, + { + CLASS = CHHistoryDataSource; + LANGUAGE = ObjC; + SUPERCLASS = CHRDFOutlineViewDataSource; + }, {CLASS = CHLocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + { + CLASS = CHRDFOutlineViewDataSource; + LANGUAGE = ObjC; + OUTLETS = {mOutlineView = id; }; + SUPERCLASS = NSObject; + }, {CLASS = ExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = LocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -98,7 +109,8 @@ urlbar = id; }; SUPERCLASS = NSView; - } + }, + {CLASS = RDFOutlineViewItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } \ No newline at end of file diff --git a/mozilla/chimera/BrowserWindow.nib/info.nib b/mozilla/chimera/BrowserWindow.nib/info.nib index 2c3eba022a1..4715c3421a5 100644 --- a/mozilla/chimera/BrowserWindow.nib/info.nib +++ b/mozilla/chimera/BrowserWindow.nib/info.nib @@ -3,29 +3,31 @@ IBDocumentLocation - 7 130 480 309 0 0 1152 746 + 97 226 480 309 0 0 1280 1002 IBEditorPositions 124 431 537 170 180 0 0 1152 746 160 - 478 70 195 666 0 0 1152 746 + 572 326 195 666 0 0 1280 1002 28 - 478 279 195 457 0 0 1152 746 + 572 439 195 457 0 0 1280 1002 297 - 70 110 198 210 0 0 1152 746 + 70 110 187 210 0 0 1152 746 314 - 271 139 198 180 0 0 1152 746 + 271 139 168 180 0 0 1152 746 336 458 90 200 162 0 0 1152 746 + 343 + 499 330 200 252 0 0 1152 746 365 22 500 93 162 0 0 1152 746 463 7 444 200 252 0 0 1152 746 475 - 516 447 120 142 0 0 1152 746 + 609 597 120 142 0 0 1280 1002 56 - 404 484 343 68 0 0 1152 746 + 498 634 343 68 0 0 1280 1002 IBFramework Version 248.0 @@ -45,12 +47,9 @@ IBOpenObjects - 475 - 297 160 - 56 IBSystem Version - 5Q125 + 5L21 diff --git a/mozilla/chimera/BrowserWindow.nib/objects.nib b/mozilla/chimera/BrowserWindow.nib/objects.nib index a59a8c9f98f..9fe1c12a92b 100644 Binary files a/mozilla/chimera/BrowserWindow.nib/objects.nib and b/mozilla/chimera/BrowserWindow.nib/objects.nib differ diff --git a/mozilla/chimera/BrowserWindowController.h b/mozilla/chimera/BrowserWindowController.h index 351d7940625..5e843463a3c 100644 --- a/mozilla/chimera/BrowserWindowController.h +++ b/mozilla/chimera/BrowserWindowController.h @@ -58,6 +58,7 @@ class nsIDOMNode; IBOutlet id mSidebarBrowserView; IBOutlet id mSidebarBookmarksDataSource; + IBOutlet id mHistoryDataSource; IBOutlet CHBookmarksToolbar* mPersonalToolbar; diff --git a/mozilla/chimera/BrowserWindowController.mm b/mozilla/chimera/BrowserWindowController.mm index 33d61eb485d..d34c77ff679 100644 --- a/mozilla/chimera/BrowserWindowController.mm +++ b/mozilla/chimera/BrowserWindowController.mm @@ -203,6 +203,8 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item"; - (void)drawerWillOpen: (NSNotification*)aNotification { [mSidebarBookmarksDataSource ensureBookmarks]; + + [mHistoryDataSource ensureDataSourceLoaded]; // Force the window to shrink and move if necessary in order to accommodate the sidebar. NSRect screenFrame = [[[self window] screen] visibleFrame]; diff --git a/mozilla/chimera/CHRDFOutlineViewDataSource.h b/mozilla/chimera/CHRDFOutlineViewDataSource.h index b703ea3753f..5d08e5d8df6 100644 --- a/mozilla/chimera/CHRDFOutlineViewDataSource.h +++ b/mozilla/chimera/CHRDFOutlineViewDataSource.h @@ -37,7 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #import -#include +#import class nsIRDFDataSource; class nsIRDFContainer; @@ -46,17 +46,17 @@ class nsIRDFResource; class nsIRDFService; @interface CHRDFOutlineViewDataSource : NSObject { - nsIRDFDataSource* mDataSource; - nsIRDFContainer* mContainer; - nsIRDFContainerUtils* mContainerUtils; - nsIRDFResource* mRootResource; - nsIRDFService* mRDFService; + nsIRDFDataSource* mDataSource; + nsIRDFContainer* mContainer; + nsIRDFContainerUtils* mContainerUtils; + nsIRDFResource* mRootResource; + nsIRDFService* mRDFService; IBOutlet id mOutlineView; } // Initialization Methods -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource; +- (void) ensureDataSourceLoaded; - (nsIRDFDataSource*) dataSource; - (nsIRDFResource*) rootResource; diff --git a/mozilla/chimera/CHRDFOutlineViewDataSource.mm b/mozilla/chimera/CHRDFOutlineViewDataSource.mm index 6f37b665953..1040b84700d 100644 --- a/mozilla/chimera/CHRDFOutlineViewDataSource.mm +++ b/mozilla/chimera/CHRDFOutlineViewDataSource.mm @@ -44,6 +44,7 @@ #include "nsIRDFResource.h" #include "nsIRDFContainer.h" #include "nsIRDFContainerUtils.h" +#include "nsRDFCID.h" #include "nsComponentManagerUtils.h" #include "nsIServiceManagerUtils.h" @@ -51,36 +52,23 @@ #include "nsXPIDLString.h" #include "nsString.h" + + @implementation CHRDFOutlineViewDataSource -- (id) init +- (void) ensureDataSourceLoaded { - if ((self = [super init])) { - nsCOMPtr ctr(do_CreateInstance("@mozilla.org/rdf/container;1")); - NS_ADDREF(mContainer = ctr); + nsCOMPtr ctr = do_CreateInstance("@mozilla.org/rdf/container;1"); + NS_ADDREF(mContainer = ctr); - nsCOMPtr ctrUtils(do_GetService("@mozilla.org/rdf/container-utils;1")); - NS_ADDREF(mContainerUtils = ctrUtils); + nsCOMPtr ctrUtils = do_GetService("@mozilla.org/rdf/container-utils;1"); + NS_ADDREF(mContainerUtils = ctrUtils); - nsCOMPtr rdfService(do_GetService("@mozilla.org/rdf/rdf-service;1")); - NS_ADDREF(mRDFService = rdfService); + nsCOMPtr rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1"); + NS_ADDREF(mRDFService = rdfService); - mDataSource = nsnull; - mRootResource = nsnull; - } - return self; -} - -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource -{ - NS_ASSERTION(aDataSource != nsnull, "Trying to initWithDataSource without a data source!"); - if (!aDataSource) - return nil; - - NS_ADDREF(mDataSource = aDataSource); - NS_IF_ADDREF(mRootResource = aRootResource); - - return [self init]; + mDataSource = nsnull; + mRootResource = nsnull; } - (void) dealloc @@ -127,15 +115,35 @@ return NO; } -// XXX write me -- (BOOL)outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem +- (BOOL) outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem { - return NO; + NSLog(@"outlineView:%@isItemExpandable:%@", aOutlineView, aItem); + if (!mDataSource) + return NO; + + if (!aItem) + return YES; // The root is always open + + nsCOMPtr itemResource = [aItem resource]; + + PRBool isSeq = PR_FALSE; + mContainerUtils->IsSeq(mDataSource, itemResource, &isSeq); + if (isSeq) + return YES; + + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); + + nsCOMPtr childNode; + mDataSource->GetTarget(itemResource, childProperty, PR_TRUE, getter_AddRefs(childNode)); + + return childNode != nsnull; } - (id) outlineView: (NSOutlineView*) aOutlineView child: (int) aIndex ofItem: (id) aItem { + NSLog(@"outlineView:%@child:%dofItem:%@", aOutlineView, aIndex, aItem); if (!mDataSource) return nil; @@ -157,18 +165,40 @@ - (int) outlineView: (NSOutlineView*) aOutlineView numberOfChildrenOfItem: (id) aItem; { + NSLog(@"outlineView:%@numberOfChildrenOfItem:%@", aOutlineView, aItem); if (!mDataSource) return nil; nsCOMPtr resource = !aItem ? mRootResource : [aItem resource]; - nsresult rv = mContainer->Init(mDataSource, resource); - NS_ASSERTION(NS_SUCCEEDED(rv), "Not a container!"); - if (NS_FAILED(rv)) - return 0; + // XXX just assume NC:child is the only containment arc for now + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); - PRInt32 count; - mContainer->GetCount(&count); + nsCOMPtr childNodes; + mDataSource->GetTargets(resource, childProperty, PR_TRUE, getter_AddRefs(childNodes)); + + PRBool hasMore = PR_FALSE; + childNodes->HasMoreElements(&hasMore); + + PRInt32 count = 0; + + while (hasMore) { + nsCOMPtr supp; + childNodes->GetNext(getter_AddRefs(supp)); + + ++count; + + childNodes->HasMoreElements(&hasMore); + } + + if (!count) { + nsresult rv = mContainer->Init(mDataSource, resource); + if (NS_FAILED(rv)) + return 0; + + mContainer->GetCount(&count); + } return count; } @@ -176,6 +206,7 @@ - (id) outlineView: (NSOutlineView*) aOutlineView objectValueForTableColumn: (NSTableColumn*) aTableColumn byItem: (id) aItem { + NSLog(@"outlineView:%@objectValueForTableColumn:%@byItem:%@", aOutlineView, aTableColumn, aItem); if (!mDataSource || !aItem) return nil; diff --git a/mozilla/chimera/Chimera.pbproj/project.pbxproj b/mozilla/chimera/Chimera.pbproj/project.pbxproj index eb601662f4c..a256f3b26cb 100644 --- a/mozilla/chimera/Chimera.pbproj/project.pbxproj +++ b/mozilla/chimera/Chimera.pbproj/project.pbxproj @@ -24,6 +24,8 @@ F59E9F3F0237E43401A967DF, F52D5CD0027A887001A80166, F52D5CD4027A88C601A80166, + F52F87CD027D75C301A80165, + F52F87CE027D75C301A80165, ); isa = PBXGroup; name = Classes; @@ -400,6 +402,8 @@ F52D5CD1027A887001A80166, F52D5CD5027A88C601A80166, F52D5CD9027D3D5001A80166, + F52F87CF027D75C301A80165, + F52F87D0027D75C301A80165, ); isa = PBXHeadersBuildPhase; name = Headers; @@ -492,6 +496,8 @@ F52D5CD2027A887001A80166, F52D5CD6027A88C601A80166, F52D5CDA027D3D5001A80166, + F52F87D1027D75C301A80165, + F52F87D2027D75C301A80165, ); isa = PBXSourcesBuildPhase; name = Sources; @@ -896,6 +902,8 @@ F5137A1102676B9101026D05, F52D5CCF027A887001A80166, F52D5CD3027A88C601A80166, + F52F87CB027D75C301A80165, + F52F87CC027D75C301A80165, ); isa = PBXGroup; name = Headers; @@ -1482,6 +1490,50 @@ settings = { }; }; + F52F87CB027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.h; + refType = 4; + }; + F52F87CC027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.h; + refType = 4; + }; + F52F87CD027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.mm; + refType = 4; + }; + F52F87CE027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.mm; + refType = 4; + }; + F52F87CF027D75C301A80165 = { + fileRef = F52F87CB027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D0027D75C301A80165 = { + fileRef = F52F87CC027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D1027D75C301A80165 = { + fileRef = F52F87CD027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D2027D75C301A80165 = { + fileRef = F52F87CE027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; F538DFAE023B36A7010001CA = { children = ( F538DFAF023B3739010001CA, diff --git a/mozilla/chimera/English.lproj/BrowserWindow.nib/classes.nib b/mozilla/chimera/English.lproj/BrowserWindow.nib/classes.nib index 669269f11fb..ff1d11f6433 100644 --- a/mozilla/chimera/English.lproj/BrowserWindow.nib/classes.nib +++ b/mozilla/chimera/English.lproj/BrowserWindow.nib/classes.nib @@ -34,7 +34,6 @@ stop = id; toggleSidebar = id; viewOnlyThisImage = id; - viewSource = id; }; CLASS = BrowserWindowController; LANGUAGE = ObjC; @@ -44,6 +43,7 @@ mAddBookmarkSheetWindow = id; mAddBookmarkTitleField = id; mCachedBMDS = id; + mHistoryDataSource = id; mImageLinkMenu = id; mImageMenu = id; mInputMenu = id; @@ -75,7 +75,18 @@ {CLASS = CHBookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, {CLASS = CHExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = CHExtendedTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; }, + { + CLASS = CHHistoryDataSource; + LANGUAGE = ObjC; + SUPERCLASS = CHRDFOutlineViewDataSource; + }, {CLASS = CHLocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + { + CLASS = CHRDFOutlineViewDataSource; + LANGUAGE = ObjC; + OUTLETS = {mOutlineView = id; }; + SUPERCLASS = NSObject; + }, {CLASS = ExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = LocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -98,7 +109,8 @@ urlbar = id; }; SUPERCLASS = NSView; - } + }, + {CLASS = RDFOutlineViewItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } \ No newline at end of file diff --git a/mozilla/chimera/English.lproj/BrowserWindow.nib/info.nib b/mozilla/chimera/English.lproj/BrowserWindow.nib/info.nib index 2c3eba022a1..4715c3421a5 100644 --- a/mozilla/chimera/English.lproj/BrowserWindow.nib/info.nib +++ b/mozilla/chimera/English.lproj/BrowserWindow.nib/info.nib @@ -3,29 +3,31 @@ IBDocumentLocation - 7 130 480 309 0 0 1152 746 + 97 226 480 309 0 0 1280 1002 IBEditorPositions 124 431 537 170 180 0 0 1152 746 160 - 478 70 195 666 0 0 1152 746 + 572 326 195 666 0 0 1280 1002 28 - 478 279 195 457 0 0 1152 746 + 572 439 195 457 0 0 1280 1002 297 - 70 110 198 210 0 0 1152 746 + 70 110 187 210 0 0 1152 746 314 - 271 139 198 180 0 0 1152 746 + 271 139 168 180 0 0 1152 746 336 458 90 200 162 0 0 1152 746 + 343 + 499 330 200 252 0 0 1152 746 365 22 500 93 162 0 0 1152 746 463 7 444 200 252 0 0 1152 746 475 - 516 447 120 142 0 0 1152 746 + 609 597 120 142 0 0 1280 1002 56 - 404 484 343 68 0 0 1152 746 + 498 634 343 68 0 0 1280 1002 IBFramework Version 248.0 @@ -45,12 +47,9 @@ IBOpenObjects - 475 - 297 160 - 56 IBSystem Version - 5Q125 + 5L21 diff --git a/mozilla/chimera/English.lproj/BrowserWindow.nib/objects.nib b/mozilla/chimera/English.lproj/BrowserWindow.nib/objects.nib index a59a8c9f98f..9fe1c12a92b 100644 Binary files a/mozilla/chimera/English.lproj/BrowserWindow.nib/objects.nib and b/mozilla/chimera/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/mozilla/chimera/projects/Chimera.pbproj/project.pbxproj b/mozilla/chimera/projects/Chimera.pbproj/project.pbxproj index eb601662f4c..a256f3b26cb 100644 --- a/mozilla/chimera/projects/Chimera.pbproj/project.pbxproj +++ b/mozilla/chimera/projects/Chimera.pbproj/project.pbxproj @@ -24,6 +24,8 @@ F59E9F3F0237E43401A967DF, F52D5CD0027A887001A80166, F52D5CD4027A88C601A80166, + F52F87CD027D75C301A80165, + F52F87CE027D75C301A80165, ); isa = PBXGroup; name = Classes; @@ -400,6 +402,8 @@ F52D5CD1027A887001A80166, F52D5CD5027A88C601A80166, F52D5CD9027D3D5001A80166, + F52F87CF027D75C301A80165, + F52F87D0027D75C301A80165, ); isa = PBXHeadersBuildPhase; name = Headers; @@ -492,6 +496,8 @@ F52D5CD2027A887001A80166, F52D5CD6027A88C601A80166, F52D5CDA027D3D5001A80166, + F52F87D1027D75C301A80165, + F52F87D2027D75C301A80165, ); isa = PBXSourcesBuildPhase; name = Sources; @@ -896,6 +902,8 @@ F5137A1102676B9101026D05, F52D5CCF027A887001A80166, F52D5CD3027A88C601A80166, + F52F87CB027D75C301A80165, + F52F87CC027D75C301A80165, ); isa = PBXGroup; name = Headers; @@ -1482,6 +1490,50 @@ settings = { }; }; + F52F87CB027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.h; + refType = 4; + }; + F52F87CC027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.h; + refType = 4; + }; + F52F87CD027D75C301A80165 = { + isa = PBXFileReference; + path = CHHistoryDataSource.mm; + refType = 4; + }; + F52F87CE027D75C301A80165 = { + isa = PBXFileReference; + path = CHRDFOutlineViewDataSource.mm; + refType = 4; + }; + F52F87CF027D75C301A80165 = { + fileRef = F52F87CB027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D0027D75C301A80165 = { + fileRef = F52F87CC027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D1027D75C301A80165 = { + fileRef = F52F87CD027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; + F52F87D2027D75C301A80165 = { + fileRef = F52F87CE027D75C301A80165; + isa = PBXBuildFile; + settings = { + }; + }; F538DFAE023B36A7010001CA = { children = ( F538DFAF023B3739010001CA, diff --git a/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib b/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib index 669269f11fb..ff1d11f6433 100644 --- a/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib +++ b/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib @@ -34,7 +34,6 @@ stop = id; toggleSidebar = id; viewOnlyThisImage = id; - viewSource = id; }; CLASS = BrowserWindowController; LANGUAGE = ObjC; @@ -44,6 +43,7 @@ mAddBookmarkSheetWindow = id; mAddBookmarkTitleField = id; mCachedBMDS = id; + mHistoryDataSource = id; mImageLinkMenu = id; mImageMenu = id; mInputMenu = id; @@ -75,7 +75,18 @@ {CLASS = CHBookmarksToolbar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, {CLASS = CHExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = CHExtendedTabView; LANGUAGE = ObjC; SUPERCLASS = NSTabView; }, + { + CLASS = CHHistoryDataSource; + LANGUAGE = ObjC; + SUPERCLASS = CHRDFOutlineViewDataSource; + }, {CLASS = CHLocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + { + CLASS = CHRDFOutlineViewDataSource; + LANGUAGE = ObjC; + OUTLETS = {mOutlineView = id; }; + SUPERCLASS = NSObject; + }, {CLASS = ExtendedOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = LocationBar; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -98,7 +109,8 @@ urlbar = id; }; SUPERCLASS = NSView; - } + }, + {CLASS = RDFOutlineViewItem; LANGUAGE = ObjC; SUPERCLASS = NSObject; } ); IBVersion = 1; } \ No newline at end of file diff --git a/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib b/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib index 2c3eba022a1..4715c3421a5 100644 --- a/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib +++ b/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib @@ -3,29 +3,31 @@ IBDocumentLocation - 7 130 480 309 0 0 1152 746 + 97 226 480 309 0 0 1280 1002 IBEditorPositions 124 431 537 170 180 0 0 1152 746 160 - 478 70 195 666 0 0 1152 746 + 572 326 195 666 0 0 1280 1002 28 - 478 279 195 457 0 0 1152 746 + 572 439 195 457 0 0 1280 1002 297 - 70 110 198 210 0 0 1152 746 + 70 110 187 210 0 0 1152 746 314 - 271 139 198 180 0 0 1152 746 + 271 139 168 180 0 0 1152 746 336 458 90 200 162 0 0 1152 746 + 343 + 499 330 200 252 0 0 1152 746 365 22 500 93 162 0 0 1152 746 463 7 444 200 252 0 0 1152 746 475 - 516 447 120 142 0 0 1152 746 + 609 597 120 142 0 0 1280 1002 56 - 404 484 343 68 0 0 1152 746 + 498 634 343 68 0 0 1280 1002 IBFramework Version 248.0 @@ -45,12 +47,9 @@ IBOpenObjects - 475 - 297 160 - 56 IBSystem Version - 5Q125 + 5L21 diff --git a/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib b/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib index a59a8c9f98f..9fe1c12a92b 100644 Binary files a/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib and b/mozilla/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/mozilla/chimera/src/browser/BrowserWindowController.h b/mozilla/chimera/src/browser/BrowserWindowController.h index 351d7940625..5e843463a3c 100644 --- a/mozilla/chimera/src/browser/BrowserWindowController.h +++ b/mozilla/chimera/src/browser/BrowserWindowController.h @@ -58,6 +58,7 @@ class nsIDOMNode; IBOutlet id mSidebarBrowserView; IBOutlet id mSidebarBookmarksDataSource; + IBOutlet id mHistoryDataSource; IBOutlet CHBookmarksToolbar* mPersonalToolbar; diff --git a/mozilla/chimera/src/browser/BrowserWindowController.mm b/mozilla/chimera/src/browser/BrowserWindowController.mm index 33d61eb485d..d34c77ff679 100644 --- a/mozilla/chimera/src/browser/BrowserWindowController.mm +++ b/mozilla/chimera/src/browser/BrowserWindowController.mm @@ -203,6 +203,8 @@ static NSString *PrintToolbarItemIdentifier = @"Print Toolbar Item"; - (void)drawerWillOpen: (NSNotification*)aNotification { [mSidebarBookmarksDataSource ensureBookmarks]; + + [mHistoryDataSource ensureDataSourceLoaded]; // Force the window to shrink and move if necessary in order to accommodate the sidebar. NSRect screenFrame = [[[self window] screen] visibleFrame]; diff --git a/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.h b/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.h index b703ea3753f..5d08e5d8df6 100644 --- a/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.h +++ b/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.h @@ -37,7 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #import -#include +#import class nsIRDFDataSource; class nsIRDFContainer; @@ -46,17 +46,17 @@ class nsIRDFResource; class nsIRDFService; @interface CHRDFOutlineViewDataSource : NSObject { - nsIRDFDataSource* mDataSource; - nsIRDFContainer* mContainer; - nsIRDFContainerUtils* mContainerUtils; - nsIRDFResource* mRootResource; - nsIRDFService* mRDFService; + nsIRDFDataSource* mDataSource; + nsIRDFContainer* mContainer; + nsIRDFContainerUtils* mContainerUtils; + nsIRDFResource* mRootResource; + nsIRDFService* mRDFService; IBOutlet id mOutlineView; } // Initialization Methods -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource; +- (void) ensureDataSourceLoaded; - (nsIRDFDataSource*) dataSource; - (nsIRDFResource*) rootResource; diff --git a/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.mm b/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.mm index 6f37b665953..1040b84700d 100644 --- a/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.mm +++ b/mozilla/chimera/src/extensions/RDFOutlineViewDataSource.mm @@ -44,6 +44,7 @@ #include "nsIRDFResource.h" #include "nsIRDFContainer.h" #include "nsIRDFContainerUtils.h" +#include "nsRDFCID.h" #include "nsComponentManagerUtils.h" #include "nsIServiceManagerUtils.h" @@ -51,36 +52,23 @@ #include "nsXPIDLString.h" #include "nsString.h" + + @implementation CHRDFOutlineViewDataSource -- (id) init +- (void) ensureDataSourceLoaded { - if ((self = [super init])) { - nsCOMPtr ctr(do_CreateInstance("@mozilla.org/rdf/container;1")); - NS_ADDREF(mContainer = ctr); + nsCOMPtr ctr = do_CreateInstance("@mozilla.org/rdf/container;1"); + NS_ADDREF(mContainer = ctr); - nsCOMPtr ctrUtils(do_GetService("@mozilla.org/rdf/container-utils;1")); - NS_ADDREF(mContainerUtils = ctrUtils); + nsCOMPtr ctrUtils = do_GetService("@mozilla.org/rdf/container-utils;1"); + NS_ADDREF(mContainerUtils = ctrUtils); - nsCOMPtr rdfService(do_GetService("@mozilla.org/rdf/rdf-service;1")); - NS_ADDREF(mRDFService = rdfService); + nsCOMPtr rdfService = do_GetService("@mozilla.org/rdf/rdf-service;1"); + NS_ADDREF(mRDFService = rdfService); - mDataSource = nsnull; - mRootResource = nsnull; - } - return self; -} - -- (id) initWithDataSource: (nsIRDFDataSource*) aDataSource rootResource: (nsIRDFResource*) aRootResource -{ - NS_ASSERTION(aDataSource != nsnull, "Trying to initWithDataSource without a data source!"); - if (!aDataSource) - return nil; - - NS_ADDREF(mDataSource = aDataSource); - NS_IF_ADDREF(mRootResource = aRootResource); - - return [self init]; + mDataSource = nsnull; + mRootResource = nsnull; } - (void) dealloc @@ -127,15 +115,35 @@ return NO; } -// XXX write me -- (BOOL)outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem +- (BOOL) outlineView: (NSOutlineView*) aOutlineView isItemExpandable: (id) aItem { - return NO; + NSLog(@"outlineView:%@isItemExpandable:%@", aOutlineView, aItem); + if (!mDataSource) + return NO; + + if (!aItem) + return YES; // The root is always open + + nsCOMPtr itemResource = [aItem resource]; + + PRBool isSeq = PR_FALSE; + mContainerUtils->IsSeq(mDataSource, itemResource, &isSeq); + if (isSeq) + return YES; + + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); + + nsCOMPtr childNode; + mDataSource->GetTarget(itemResource, childProperty, PR_TRUE, getter_AddRefs(childNode)); + + return childNode != nsnull; } - (id) outlineView: (NSOutlineView*) aOutlineView child: (int) aIndex ofItem: (id) aItem { + NSLog(@"outlineView:%@child:%dofItem:%@", aOutlineView, aIndex, aItem); if (!mDataSource) return nil; @@ -157,18 +165,40 @@ - (int) outlineView: (NSOutlineView*) aOutlineView numberOfChildrenOfItem: (id) aItem; { + NSLog(@"outlineView:%@numberOfChildrenOfItem:%@", aOutlineView, aItem); if (!mDataSource) return nil; nsCOMPtr resource = !aItem ? mRootResource : [aItem resource]; - nsresult rv = mContainer->Init(mDataSource, resource); - NS_ASSERTION(NS_SUCCEEDED(rv), "Not a container!"); - if (NS_FAILED(rv)) - return 0; + // XXX just assume NC:child is the only containment arc for now + nsCOMPtr childProperty; + mRDFService->GetResource("http://home.netscape.com/NC-rdf#child", getter_AddRefs(childProperty)); - PRInt32 count; - mContainer->GetCount(&count); + nsCOMPtr childNodes; + mDataSource->GetTargets(resource, childProperty, PR_TRUE, getter_AddRefs(childNodes)); + + PRBool hasMore = PR_FALSE; + childNodes->HasMoreElements(&hasMore); + + PRInt32 count = 0; + + while (hasMore) { + nsCOMPtr supp; + childNodes->GetNext(getter_AddRefs(supp)); + + ++count; + + childNodes->HasMoreElements(&hasMore); + } + + if (!count) { + nsresult rv = mContainer->Init(mDataSource, resource); + if (NS_FAILED(rv)) + return 0; + + mContainer->GetCount(&count); + } return count; } @@ -176,6 +206,7 @@ - (id) outlineView: (NSOutlineView*) aOutlineView objectValueForTableColumn: (NSTableColumn*) aTableColumn byItem: (id) aItem { + NSLog(@"outlineView:%@objectValueForTableColumn:%@byItem:%@", aOutlineView, aTableColumn, aItem); if (!mDataSource || !aItem) return nil;