Bug 465258, attach feed discovery to MailNews.
authorJustin Wood <Callek@gmail.com>
Tue, 18 Nov 2008 20:12:35 -0500
changeset 1145 f78ce96ba4d68a0ee1462231a7a73b878227bf7b
parent 1144 832c859036ef205fe75e22c0c513828f721d1e89
child 1146 75dcf3c6be22eec85c049c8a7c9cb951f88c0b63
push idunknown
push userunknown
push dateunknown
bugs465258
Bug 465258, attach feed discovery to MailNews. r+sr=NeilAway
suite/browser/linkToolbarOverlay.xul
suite/browser/navigator.xul
suite/browser/navigatorOverlay.xul
suite/browser/pageinfo/feeds.js
suite/common/utilityOverlay.js
--- a/suite/browser/linkToolbarOverlay.xul
+++ b/suite/browser/linkToolbarOverlay.xul
@@ -194,13 +194,14 @@
 
         </menupopup>
       </toolbarbutton>
 
       <toolbarbutton id="link-feed" class="bookmark-item"
           type="menu"
           container="true"
           label="&feedButton.label;" disabled="true">
-        <menupopup id="link-feed-popup"/>
+        <!-- XXXCallek oncommand temporary until feed Preview works -->
+        <menupopup id="link-feed-popup" oncommand="event.stopPropagation(); return subscribeToFeed('feed:' + event.target.getAttribute('href');"/>
       </toolbarbutton>
     </toolbar>
   </toolbox>
 </overlay>
--- a/suite/browser/navigator.xul
+++ b/suite/browser/navigator.xul
@@ -131,19 +131,20 @@
 
   <popupset id="mainPopupSet"/> <!-- Firefox extension compatibility -->
 
   <popup id="toolbar-context-menu"/>
 
   <!-- context menu -->
   <popupset id="contentAreaContextSet"/>
 
+  <!-- XXXCallek this should be loadURI rather than subscribe* here -->
   <popup id="feedsPopup" popupanchor="bottomright" popupalign="topright"
          onpopupshowing="window.XULBrowserWindow.populateFeeds(this);"
-         oncommand="loadURI(event.target.statusText, gBrowser.currentURI);"/>
+         oncommand="subscribeToFeed('feed:' + event.target.statusText /*, gBrowser.currentURI*/);"/>
   <panel type="autocomplete" id="PopupAutoComplete" level="top"/>
 
   <toolbox id="navigator-toolbox" class="toolbox-top" deferattached="true"
            mode="full" defaultmode="full">
     <!-- Menu -->
     <menubar id="main-menubar" persist="collapsed" grippytooltiptext="&menuBar.tooltip;"/>
 
     <toolbar class="toolbar-primary chromeclass-toolbar" id="nav-bar" persist="collapsed" 
--- a/suite/browser/navigatorOverlay.xul
+++ b/suite/browser/navigatorOverlay.xul
@@ -489,17 +489,17 @@
         <menuitem key="addBookmarkKb"   command="Browser:AddBookmark"/>
         <menuitem key="addBookmarkAsKb" command="Browser:AddBookmarkAs"/>
         <menuitem                       command="Browser:AddGroupmarkAs"/>
         <menuitem key="manBookmarkKb"   command="Browser:ManageBookmark"/>
         <menuseparator/>
         <menu id="feedsMenu" class="menu-iconic" disabled="true"
               label="&feedsMenu.label;" accesskey="&feedsMenu.accesskey;">
           <menupopup onpopupshowing="window.XULBrowserWindow.populateFeeds(this);"
-                     oncommand="loadURI(event.target.statusText, gBrowser.currentURI);"/>
+                     oncommand="subscribeToFeed('feed:' + event.target.statusText /*, gBrowser.currentURI*/);"/>
         </menu>
         <menuseparator/>
       </menupopup>
     </menu>
       
   <menu id="tasksMenu">
     <menupopup id="taskPopup">
       <menuitem id="menu_searchWeb" label="&searchInternetCmd.label;" key="searchInternetKb" accesskey="&searchInternetCmd.accesskey;" command="Browser:SearchInternet"/>
--- a/suite/browser/pageinfo/feeds.js
+++ b/suite/browser/pageinfo/feeds.js
@@ -71,17 +71,17 @@ function initFeedTab()
   }
   var feedListbox = document.getElementById("feedListbox");
   document.getElementById("feedTab").hidden = feedListbox.getRowCount() == 0;
 }
 
 function onSubscribeFeed()
 {
   var listbox = document.getElementById("feedListbox");
-  openTopWin(listbox.selectedItem.getAttribute("feedURL"));
+  subscribeToFeed('feed:' + listbox.selectedItem.getAttribute("feedURL"));
 }
 
 function addRow(name, type, url)
 {
   var item = document.createElement("richlistitem");
   item.setAttribute("feed", "true");
   item.setAttribute("name", name);
   item.setAttribute("type", type);
--- a/suite/common/utilityOverlay.js
+++ b/suite/common/utilityOverlay.js
@@ -1084,8 +1084,17 @@ function openUILinkArrayIn(urlArray, whe
       browser.selectedTab = tab;
   }
   for (var i = 1; i < urlArray.length; i++)
     browser.addTab(urlArray[i], null, null, false, flags);
 
   w.content.focus();
   return w;
 }
+
+//XXXCallek only used until we implement Feed Preview
+// uri is a string!
+function subscribeToFeed(uri)
+{
+  Components.classes["@mozilla.org/newsblog-feed-downloader;1"]
+            .getService(Components.interfaces.nsINewsBlogFeedDownloader)
+            .subscribeToFeed(uri, null, null);
+}