psa: Added sharing menu item for articles
authorYves <yves@marcoz.org>
Tue, 29 Nov 2011 23:16:53 +0000 (15:16 -0800)
committerYves <yves@marcoz.org>
Tue, 29 Nov 2011 23:16:53 +0000 (15:16 -0800)
psa_harmattan/feedingit/pysrc/feedingit.py
psa_harmattan/feedingit/qml/ArticleViewer.qml
psa_harmattan/feedingit/qml/common/images/.directory
psa_harmattan/feedingit/qml/main.qml

index 374627f..2dc6e8d 100644 (file)
@@ -195,6 +195,19 @@ class Controller(QtCore.QObject):
             config.setAutoUpdateEnabled(value)
         config.saveConfig()
 
+    @QtCore.Slot(str, str)
+    def share(self, key, articleid):
+        feed = listing.getFeed(key)
+        title = feed.getTitle(articleid)
+        link = feed.getExternalLink(articleid)
+        description = 'Shared%20via%FeedingIt%20on%20Meego'
+        import urllib
+        bus = dbus.SessionBus()
+        shareService = bus.get_object('com.nokia.ShareUi', '/')
+        share = shareService.get_dbus_method('share', 'com.nokia.maemo.meegotouch.ShareUiInterface')
+        #share([u'data:text/x-url;description=Support%20for%20Nokia%20Developers;title=Forum%20Nokia,http%3A%2F%2Fforum.nokia.com',])
+        share( ['data:text/x-url;title=%s;description=%s,%s' %(urllib.quote(title), description, urllib.quote(link)),] )
+
 def main():
     if not isdir(CONFIGDIR):
         try:
index f2b89aa..2e3ae95 100644 (file)
@@ -43,14 +43,9 @@ Item {
         }
     }
 
-    function viewArticle(articleid) {
-        var index = 0;
-        for (var i=0; i<articleList.count; ++i) {
-            if (articles.get(0).articleid==articleid) {
-                index = i;
-            }
-        }
-        articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true;
+    function getCurrentArticleId() {
+        var object = articleView.model.get(articleView.currentIndex)
+        return object.articleid
     }
 
     ListView {
index 6892179..8aec41a 100644 (file)
@@ -257,6 +257,15 @@ PageStackWindow {
                 }
 
                 ToolIcon {
+                    platformIconId: "toolbar-share"
+                    visible: flipper.articleShown
+                    //anchors.right: (parent === undefined) ? undefined : parent.right
+                    onClicked: {
+                        controller.share(window.feedid, flipper.getCurrentArticleId());
+                    }
+                }
+
+                ToolIcon {
                     platformIconId: "toolbar-next"
                     visible: flipper.articleShown
                     //anchors.right: (parent === undefined) ? undefined : parent.right