diff --git a/camino/BookmarksService.h b/camino/BookmarksService.h index 09d89880293d..310209869226 100644 --- a/camino/BookmarksService.h +++ b/camino/BookmarksService.h @@ -81,6 +81,9 @@ class nsIAtom; -(IBAction)cancelRenameBookmarkSheet:(id)sender; -(IBAction)doRenameBookmarkSheet:(id)sender; +-(IBAction)openBookmarkInNewTab:(id)aSender; +-(IBAction)openBookmarkInNewWindow:(id)aSender; + // Datasource methods. - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item; - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; diff --git a/camino/BookmarksService.mm b/camino/BookmarksService.mm index a090cf363c4b..e408fb77ec0e 100644 --- a/camino/BookmarksService.mm +++ b/camino/BookmarksService.mm @@ -45,6 +45,7 @@ #include "nsIDOMHTMLDocument.h" #include "nsIDOMElement.h" #include "nsIDOMCharacterData.h" +#include "nsIPrefBranch.h" #include "nsString.h" #include "nsCRT.h" #include "nsIFile.h" @@ -635,6 +636,49 @@ mBookmarks->BookmarkChanged([item contentNode]); } +-(IBAction)openBookmarkInNewTab:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + if (!pref) + return; // Something bad happened if we can't get prefs. + + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + PRBool loadInBackground; + pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground); + + [mBrowserWindowController openNewTabWithURL: urlToLoad loadInBackground: loadInBackground]; + } +} + +-(IBAction)openBookmarkInNewWindow:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + [mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO]; + } +} + @end @implementation BookmarkItem diff --git a/camino/BrowserWindow.nib/classes.nib b/camino/BrowserWindow.nib/classes.nib index c611539d80c3..cdf80357af63 100644 --- a/camino/BrowserWindow.nib/classes.nib +++ b/camino/BrowserWindow.nib/classes.nib @@ -9,6 +9,8 @@ cancelRenameBookmarkSheet = id; deleteBookmarks = id; doRenameBookmarkSheet = id; + openBookmarkInNewTab = id; + openBookmarkInNewWindow = id; }; CLASS = BookmarksDataSource; LANGUAGE = ObjC; diff --git a/camino/BrowserWindow.nib/info.nib b/camino/BrowserWindow.nib/info.nib index fb1b9bfcb218..4e35b8760bee 100644 --- a/camino/BrowserWindow.nib/info.nib +++ b/camino/BrowserWindow.nib/info.nib @@ -7,9 +7,9 @@ IBEditorPositions 124 - 305 656 170 180 0 0 1152 848 + 345 807 170 180 0 0 1280 1002 160 - 478 172 195 666 0 0 1152 848 + 564 326 195 666 0 0 1280 1002 28 478 351 195 457 0 0 1152 848 297 @@ -17,7 +17,7 @@ 314 218 602 139 66 0 0 1152 848 336 - 630 666 200 132 0 0 1152 848 + 715 809 200 132 0 0 1280 1002 365 22 587 93 162 0 0 1152 848 463 @@ -43,7 +43,9 @@ IBOpenObjects + 336 160 + 124 IBSystem Version 5Q125 diff --git a/camino/BrowserWindow.nib/objects.nib b/camino/BrowserWindow.nib/objects.nib index 1ec084e4c9cb..788fd4ae2f5d 100644 Binary files a/camino/BrowserWindow.nib/objects.nib and b/camino/BrowserWindow.nib/objects.nib differ diff --git a/camino/English.lproj/BrowserWindow.nib/classes.nib b/camino/English.lproj/BrowserWindow.nib/classes.nib index c611539d80c3..cdf80357af63 100644 --- a/camino/English.lproj/BrowserWindow.nib/classes.nib +++ b/camino/English.lproj/BrowserWindow.nib/classes.nib @@ -9,6 +9,8 @@ cancelRenameBookmarkSheet = id; deleteBookmarks = id; doRenameBookmarkSheet = id; + openBookmarkInNewTab = id; + openBookmarkInNewWindow = id; }; CLASS = BookmarksDataSource; LANGUAGE = ObjC; diff --git a/camino/English.lproj/BrowserWindow.nib/info.nib b/camino/English.lproj/BrowserWindow.nib/info.nib index fb1b9bfcb218..4e35b8760bee 100644 --- a/camino/English.lproj/BrowserWindow.nib/info.nib +++ b/camino/English.lproj/BrowserWindow.nib/info.nib @@ -7,9 +7,9 @@ IBEditorPositions 124 - 305 656 170 180 0 0 1152 848 + 345 807 170 180 0 0 1280 1002 160 - 478 172 195 666 0 0 1152 848 + 564 326 195 666 0 0 1280 1002 28 478 351 195 457 0 0 1152 848 297 @@ -17,7 +17,7 @@ 314 218 602 139 66 0 0 1152 848 336 - 630 666 200 132 0 0 1152 848 + 715 809 200 132 0 0 1280 1002 365 22 587 93 162 0 0 1152 848 463 @@ -43,7 +43,9 @@ IBOpenObjects + 336 160 + 124 IBSystem Version 5Q125 diff --git a/camino/English.lproj/BrowserWindow.nib/objects.nib b/camino/English.lproj/BrowserWindow.nib/objects.nib index 1ec084e4c9cb..788fd4ae2f5d 100644 Binary files a/camino/English.lproj/BrowserWindow.nib/objects.nib and b/camino/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib b/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib index c611539d80c3..cdf80357af63 100644 --- a/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib +++ b/camino/resources/localized/English.lproj/BrowserWindow.nib/classes.nib @@ -9,6 +9,8 @@ cancelRenameBookmarkSheet = id; deleteBookmarks = id; doRenameBookmarkSheet = id; + openBookmarkInNewTab = id; + openBookmarkInNewWindow = id; }; CLASS = BookmarksDataSource; LANGUAGE = ObjC; diff --git a/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib b/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib index fb1b9bfcb218..4e35b8760bee 100644 --- a/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib +++ b/camino/resources/localized/English.lproj/BrowserWindow.nib/info.nib @@ -7,9 +7,9 @@ IBEditorPositions 124 - 305 656 170 180 0 0 1152 848 + 345 807 170 180 0 0 1280 1002 160 - 478 172 195 666 0 0 1152 848 + 564 326 195 666 0 0 1280 1002 28 478 351 195 457 0 0 1152 848 297 @@ -17,7 +17,7 @@ 314 218 602 139 66 0 0 1152 848 336 - 630 666 200 132 0 0 1152 848 + 715 809 200 132 0 0 1280 1002 365 22 587 93 162 0 0 1152 848 463 @@ -43,7 +43,9 @@ IBOpenObjects + 336 160 + 124 IBSystem Version 5Q125 diff --git a/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib b/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib index 1ec084e4c9cb..788fd4ae2f5d 100644 Binary files a/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib and b/camino/resources/localized/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/camino/src/bookmarks/BookmarksService.h b/camino/src/bookmarks/BookmarksService.h index 09d89880293d..310209869226 100644 --- a/camino/src/bookmarks/BookmarksService.h +++ b/camino/src/bookmarks/BookmarksService.h @@ -81,6 +81,9 @@ class nsIAtom; -(IBAction)cancelRenameBookmarkSheet:(id)sender; -(IBAction)doRenameBookmarkSheet:(id)sender; +-(IBAction)openBookmarkInNewTab:(id)aSender; +-(IBAction)openBookmarkInNewWindow:(id)aSender; + // Datasource methods. - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item; - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; diff --git a/camino/src/bookmarks/BookmarksService.mm b/camino/src/bookmarks/BookmarksService.mm index a090cf363c4b..e408fb77ec0e 100644 --- a/camino/src/bookmarks/BookmarksService.mm +++ b/camino/src/bookmarks/BookmarksService.mm @@ -45,6 +45,7 @@ #include "nsIDOMHTMLDocument.h" #include "nsIDOMElement.h" #include "nsIDOMCharacterData.h" +#include "nsIPrefBranch.h" #include "nsString.h" #include "nsCRT.h" #include "nsIFile.h" @@ -635,6 +636,49 @@ mBookmarks->BookmarkChanged([item contentNode]); } +-(IBAction)openBookmarkInNewTab:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + if (!pref) + return; // Something bad happened if we can't get prefs. + + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + PRBool loadInBackground; + pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground); + + [mBrowserWindowController openNewTabWithURL: urlToLoad loadInBackground: loadInBackground]; + } +} + +-(IBAction)openBookmarkInNewWindow:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + [mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO]; + } +} + @end @implementation BookmarkItem diff --git a/chimera/BookmarksService.h b/chimera/BookmarksService.h index 09d89880293d..310209869226 100644 --- a/chimera/BookmarksService.h +++ b/chimera/BookmarksService.h @@ -81,6 +81,9 @@ class nsIAtom; -(IBAction)cancelRenameBookmarkSheet:(id)sender; -(IBAction)doRenameBookmarkSheet:(id)sender; +-(IBAction)openBookmarkInNewTab:(id)aSender; +-(IBAction)openBookmarkInNewWindow:(id)aSender; + // Datasource methods. - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item; - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; diff --git a/chimera/BookmarksService.mm b/chimera/BookmarksService.mm index a090cf363c4b..e408fb77ec0e 100644 --- a/chimera/BookmarksService.mm +++ b/chimera/BookmarksService.mm @@ -45,6 +45,7 @@ #include "nsIDOMHTMLDocument.h" #include "nsIDOMElement.h" #include "nsIDOMCharacterData.h" +#include "nsIPrefBranch.h" #include "nsString.h" #include "nsCRT.h" #include "nsIFile.h" @@ -635,6 +636,49 @@ mBookmarks->BookmarkChanged([item contentNode]); } +-(IBAction)openBookmarkInNewTab:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + if (!pref) + return; // Something bad happened if we can't get prefs. + + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + PRBool loadInBackground; + pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground); + + [mBrowserWindowController openNewTabWithURL: urlToLoad loadInBackground: loadInBackground]; + } +} + +-(IBAction)openBookmarkInNewWindow:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + [mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO]; + } +} + @end @implementation BookmarkItem diff --git a/chimera/BrowserWindow.nib/classes.nib b/chimera/BrowserWindow.nib/classes.nib index c611539d80c3..cdf80357af63 100644 --- a/chimera/BrowserWindow.nib/classes.nib +++ b/chimera/BrowserWindow.nib/classes.nib @@ -9,6 +9,8 @@ cancelRenameBookmarkSheet = id; deleteBookmarks = id; doRenameBookmarkSheet = id; + openBookmarkInNewTab = id; + openBookmarkInNewWindow = id; }; CLASS = BookmarksDataSource; LANGUAGE = ObjC; diff --git a/chimera/BrowserWindow.nib/info.nib b/chimera/BrowserWindow.nib/info.nib index fb1b9bfcb218..4e35b8760bee 100644 --- a/chimera/BrowserWindow.nib/info.nib +++ b/chimera/BrowserWindow.nib/info.nib @@ -7,9 +7,9 @@ IBEditorPositions 124 - 305 656 170 180 0 0 1152 848 + 345 807 170 180 0 0 1280 1002 160 - 478 172 195 666 0 0 1152 848 + 564 326 195 666 0 0 1280 1002 28 478 351 195 457 0 0 1152 848 297 @@ -17,7 +17,7 @@ 314 218 602 139 66 0 0 1152 848 336 - 630 666 200 132 0 0 1152 848 + 715 809 200 132 0 0 1280 1002 365 22 587 93 162 0 0 1152 848 463 @@ -43,7 +43,9 @@ IBOpenObjects + 336 160 + 124 IBSystem Version 5Q125 diff --git a/chimera/BrowserWindow.nib/objects.nib b/chimera/BrowserWindow.nib/objects.nib index 1ec084e4c9cb..788fd4ae2f5d 100644 Binary files a/chimera/BrowserWindow.nib/objects.nib and b/chimera/BrowserWindow.nib/objects.nib differ diff --git a/chimera/English.lproj/BrowserWindow.nib/classes.nib b/chimera/English.lproj/BrowserWindow.nib/classes.nib index c611539d80c3..cdf80357af63 100644 --- a/chimera/English.lproj/BrowserWindow.nib/classes.nib +++ b/chimera/English.lproj/BrowserWindow.nib/classes.nib @@ -9,6 +9,8 @@ cancelRenameBookmarkSheet = id; deleteBookmarks = id; doRenameBookmarkSheet = id; + openBookmarkInNewTab = id; + openBookmarkInNewWindow = id; }; CLASS = BookmarksDataSource; LANGUAGE = ObjC; diff --git a/chimera/English.lproj/BrowserWindow.nib/info.nib b/chimera/English.lproj/BrowserWindow.nib/info.nib index fb1b9bfcb218..4e35b8760bee 100644 --- a/chimera/English.lproj/BrowserWindow.nib/info.nib +++ b/chimera/English.lproj/BrowserWindow.nib/info.nib @@ -7,9 +7,9 @@ IBEditorPositions 124 - 305 656 170 180 0 0 1152 848 + 345 807 170 180 0 0 1280 1002 160 - 478 172 195 666 0 0 1152 848 + 564 326 195 666 0 0 1280 1002 28 478 351 195 457 0 0 1152 848 297 @@ -17,7 +17,7 @@ 314 218 602 139 66 0 0 1152 848 336 - 630 666 200 132 0 0 1152 848 + 715 809 200 132 0 0 1280 1002 365 22 587 93 162 0 0 1152 848 463 @@ -43,7 +43,9 @@ IBOpenObjects + 336 160 + 124 IBSystem Version 5Q125 diff --git a/chimera/English.lproj/BrowserWindow.nib/objects.nib b/chimera/English.lproj/BrowserWindow.nib/objects.nib index 1ec084e4c9cb..788fd4ae2f5d 100644 Binary files a/chimera/English.lproj/BrowserWindow.nib/objects.nib and b/chimera/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib b/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib index c611539d80c3..cdf80357af63 100644 --- a/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib +++ b/chimera/resources/localized/English.lproj/BrowserWindow.nib/classes.nib @@ -9,6 +9,8 @@ cancelRenameBookmarkSheet = id; deleteBookmarks = id; doRenameBookmarkSheet = id; + openBookmarkInNewTab = id; + openBookmarkInNewWindow = id; }; CLASS = BookmarksDataSource; LANGUAGE = ObjC; diff --git a/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib b/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib index fb1b9bfcb218..4e35b8760bee 100644 --- a/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib +++ b/chimera/resources/localized/English.lproj/BrowserWindow.nib/info.nib @@ -7,9 +7,9 @@ IBEditorPositions 124 - 305 656 170 180 0 0 1152 848 + 345 807 170 180 0 0 1280 1002 160 - 478 172 195 666 0 0 1152 848 + 564 326 195 666 0 0 1280 1002 28 478 351 195 457 0 0 1152 848 297 @@ -17,7 +17,7 @@ 314 218 602 139 66 0 0 1152 848 336 - 630 666 200 132 0 0 1152 848 + 715 809 200 132 0 0 1280 1002 365 22 587 93 162 0 0 1152 848 463 @@ -43,7 +43,9 @@ IBOpenObjects + 336 160 + 124 IBSystem Version 5Q125 diff --git a/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib b/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib index 1ec084e4c9cb..788fd4ae2f5d 100644 Binary files a/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib and b/chimera/resources/localized/English.lproj/BrowserWindow.nib/objects.nib differ diff --git a/chimera/src/bookmarks/BookmarksService.h b/chimera/src/bookmarks/BookmarksService.h index 09d89880293d..310209869226 100644 --- a/chimera/src/bookmarks/BookmarksService.h +++ b/chimera/src/bookmarks/BookmarksService.h @@ -81,6 +81,9 @@ class nsIAtom; -(IBAction)cancelRenameBookmarkSheet:(id)sender; -(IBAction)doRenameBookmarkSheet:(id)sender; +-(IBAction)openBookmarkInNewTab:(id)aSender; +-(IBAction)openBookmarkInNewWindow:(id)aSender; + // Datasource methods. - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item; - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item; diff --git a/chimera/src/bookmarks/BookmarksService.mm b/chimera/src/bookmarks/BookmarksService.mm index a090cf363c4b..e408fb77ec0e 100644 --- a/chimera/src/bookmarks/BookmarksService.mm +++ b/chimera/src/bookmarks/BookmarksService.mm @@ -45,6 +45,7 @@ #include "nsIDOMHTMLDocument.h" #include "nsIDOMElement.h" #include "nsIDOMCharacterData.h" +#include "nsIPrefBranch.h" #include "nsString.h" #include "nsCRT.h" #include "nsIFile.h" @@ -635,6 +636,49 @@ mBookmarks->BookmarkChanged([item contentNode]); } +-(IBAction)openBookmarkInNewTab:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + nsCOMPtr pref(do_GetService("@mozilla.org/preferences-service;1")); + if (!pref) + return; // Something bad happened if we can't get prefs. + + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + PRBool loadInBackground; + pref->GetBoolPref("browser.tabs.loadInBackground", &loadInBackground); + + [mBrowserWindowController openNewTabWithURL: urlToLoad loadInBackground: loadInBackground]; + } +} + +-(IBAction)openBookmarkInNewWindow:(id)aSender +{ + int index = [mOutlineView selectedRow]; + if (index == -1) + return; + if ([mOutlineView numberOfSelectedRows] == 1) { + BookmarkItem* item = [mOutlineView itemAtRow: index]; + nsAutoString hrefAttr; + [item contentNode]->GetAttr(kNameSpaceID_None, BookmarksService::gHrefAtom, hrefAttr); + + // stuff it into the string + NSString* hrefStr = [NSString stringWithCharacters:hrefAttr.get() length:hrefAttr.Length()]; + NSURL* urlToLoad = [NSURL URLWithString: hrefStr]; + + [mBrowserWindowController openNewWindowWithURL: urlToLoad loadInBackground: NO]; + } +} + @end @implementation BookmarkItem