qml-friends-0.2.0+14.04.20140317/0000755000015201777760000000000012311702645016331 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/tests/0000755000015201777760000000000012311702645017473 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/tests/unit/0000755000015201777760000000000012311702645020452 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/tests/unit/unit.pro0000644000015201777760000000037312311702311022144 0ustar pbusernogroup00000000000000TEMPLATE = app QT += qml quick qmltest CONFIG += no_keywords TARGET = unit SOURCES += main.cpp OTHER_FILES += $$system(ls *.qml) check.commands = "sh run.sh" check.depends = $${TARGET} QMAKE_EXTRA_TARGETS += check #system(cp $$PWD/*.qml $$OUT_PWD) qml-friends-0.2.0+14.04.20140317/tests/unit/run.sh0000755000015201777760000000047712311702311021613 0ustar pbusernogroup00000000000000#!/bin/sh export FRIENDS_STREAMS_MODEL=com.canonical.Friends.TestSharedModel export QML2_IMPORT_PATH=../../modules export QT_QPA_PLATFORM=minimal xvfb-run -a dbus-test-runner -t friends-dispatcher -p --test \ --task-name FriendsService --ignore-return -t ./unit --wait-for com.canonical.Friends.Dispatcher -m 120 qml-friends-0.2.0+14.04.20140317/tests/unit/main.cpp0000644000015201777760000000007112311702311022066 0ustar pbusernogroup00000000000000#include QUICK_TEST_MAIN(unit) qml-friends-0.2.0+14.04.20140317/tests/unit/tst_test.qml0000644000015201777760000001061312311702311023025 0ustar pbusernogroup00000000000000import QtQuick 2.0 import QtTest 1.0 import Friends 0.2 // See more details @ http://qt-project.org/doc/qt-5.0/qtquick/qml-testcase.html Item { // The objects FriendsDispatcher { id: friends } SignalSpy { id: signalSpy target: friends } TestCase { name: "testFriendsDispatcher" function test_url_shorten () { var input = "http://www.python.org" var res = friends.urlShorten (input); compare (res, input.length.toString()); } function test_features () { var input = ["facebook"] var res = friends.featuresForProtocol (input[0]); compare (res, input); } function test_uploadForAccountAsync () { var acct = 1; var uri = "file:///tmp/foo.png"; var desc = "Something interesting to say"; signalSpy.clear (); signalSpy.signalName = "onUploadComplete" friends.uploadForAccountAsync (acct, uri, desc) signalSpy.wait (); compare(1, signalSpy.count, "onUploadComplete emitted"); } function test_sendforAccountAsync () { var acct = 1; var msg = "Something interesting to say"; signalSpy.clear (); signalSpy.signalName = "onSendComplete" friends.sendForAccountAsync (acct, msg) signalSpy.wait (); compare(1, signalSpy.count, "onSendComplete emitted"); } function test_sendAsync () { var msg = "Something interesting to say"; signalSpy.clear (); signalSpy.signalName = "onSendComplete" friends.sendAsync (msg) signalSpy.wait (); compare(1, signalSpy.count, "onSendComplete emitted"); } function test_sendReplyAsync () { var acct = 1; var msgId = "10"; var msg = "Something interesting to say"; signalSpy.clear (); signalSpy.signalName = "onSendComplete" friends.sendReplyAsync (acct, msgId, msg) signalSpy.wait (); compare(1, signalSpy.count, "onSendComplete emitted"); } function test_retweetAsync () { var acct = 1; var msgId = "10"; signalSpy.clear (); signalSpy.signalName = "onRetweetComplete" friends.retweetAsync (acct, msgId) signalSpy.wait (); compare(1, signalSpy.count, "onRetweetComplete emitted"); } function test_likeAsync () { var acct = 1; var msgId = "10"; signalSpy.clear (); signalSpy.signalName = "onLikeComplete" friends.likeAsync (acct, msgId) signalSpy.wait (); compare(1, signalSpy.count, "onLikeComplete emitted"); } function test_unlikeAsync () { var acct = 1; var msgId = "10"; signalSpy.clear (); signalSpy.signalName = "onUnlikeComplete" friends.unlikeAsync (acct, msgId) signalSpy.wait (); compare(1, signalSpy.count, "onUnlikeComplete emitted"); } } StreamModel { id: streamModel } TestCase { name: "testStreamModel" function init() { console.debug(">> init"); console.debug("<< init"); } function cleanup() { console.debug(">> cleanup"); console.debug("<< cleanup"); } function initTestCase() { console.debug(">> initTestCase"); console.debug("<< initTestCase"); } function cleanupTestCase() { console.debug(">> cleanupTestCase"); console.debug("<< cleanupTestCase"); } function test_streamModelStream() { streamModel.stream = "messages"; compare(0, streamModel.count, "Test StreamModel row count filtered by stream"); } function test_streamModelService() { streamModel.service = "twitter"; compare(0, streamModel.count, "Test StreamModel row count filtered by service"); } function test_streamModelAccount() { streamModel.account = 1; compare(0, streamModel.count, "Test StreamModel row count filtered by account"); } } } qml-friends-0.2.0+14.04.20140317/tests/tests.pro0000644000015201777760000000005212311702311021342 0ustar pbusernogroup00000000000000TEMPLATE = subdirs SUBDIRS += \ unit qml-friends-0.2.0+14.04.20140317/README0000644000015201777760000000215412311702311017201 0ustar pbusernogroup00000000000000QML Friends - QML module for using the Friends Service ====================================================== The Friends Service provides an API for interacting with your social networks. The friends service automatically uses accounts with serviceType="microblogging" from Ubuntu Online Accounts. Currently there are friends plugins for facebook, twitter, flickr, foursquare and identica. The service provides a Dee.SharedModel that contains the aggregated feed from all of your enabled accounts. Any application can connect to this model and provide a user interface to display the feed. You can created filtered models off that shared model to sort or limit the results to specific accounts, types, etc. Your application never actually talks directly to the web API provided by the social network, it would just interact with Friends. This Dee model is currently used in the Friends lens, People lens and Gwibber. The Friends service also provides APIs for sharing images, posting status updates, replies, favoriting posts, retweet, contact sync, etc. For an example of how to use QML Friends, see examples/poster.qml qml-friends-0.2.0+14.04.20140317/common-vars.pri0000644000015201777760000000171412311702311021277 0ustar pbusernogroup00000000000000#----------------------------------------------------------------------------- # Common variables for all projects. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Project name (used e.g. in include file and doc install path). # remember to update debian/* files if you changes this #----------------------------------------------------------------------------- PROJECT_NAME = qml-friends #----------------------------------------------------------------------------- # Project version # remember to update debian/* files if you changes this #----------------------------------------------------------------------------- PROJECT_VERSION = 0.1.0 #----------------------------------------------------------------------------- # Library version #----------------------------------------------------------------------------- API_VERSION = 0.2 # End of File qml-friends-0.2.0+14.04.20140317/docs/0000755000015201777760000000000012311702645017261 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/docs/friends-common.qdocconf0000644000015201777760000000057512311702311023714 0ustar pbusernogroup00000000000000project = Friends description = Friends Documentation sourcedirs = ../modules/Friends/plugin headerdirs = ../modules/Friends/plugin sources.fileextensions = "*.qml *.qdoc *.cpp" outputdir = html outputformats = HTML version = 0.1 syntaxhighlighting = true sourceencoding = UTF-8 outputencoding = UTF-8 HTML.templatedir = . HTML.nobreadcrumbs = "true" HTML.endheader = "\n" qml-friends-0.2.0+14.04.20140317/docs/docs.pri0000644000015201777760000000041012311702311020706 0ustar pbusernogroup00000000000000QDOC = /usr/lib/*/qt5/bin/qdoc CONFIG(ubuntu-docs) { system($$QDOC $$PWD/friends-online.qdocconf) } else { system($$QDOC $$PWD/friends-offline.qdocconf) } install_docs.files = $$PWD/html install_docs.path = /usr/share/qml-friends/doc INSTALLS += install_docs qml-friends-0.2.0+14.04.20140317/docs/html/0000755000015201777760000000000012311702645020225 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/docs/generate_html.sh0000755000015201777760000000146312311702311022430 0ustar pbusernogroup00000000000000#!/bin/sh # # Copyright 2012 Canonical Ltd. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; version 3. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # QDOCCONF_FILE=friends-online.qdocconf QDOC_BIN=/usr/lib/*/qt5/bin/qdoc sed "s|docs/||" < $QDOCCONF_FILE > $QDOCCONF_FILE.tmp $QDOC_BIN $QDOCCONF_FILE.tmp rm $QDOCCONF_FILE.tmp qml-friends-0.2.0+14.04.20140317/docs/friends-online.qdocconf0000644000015201777760000000146512311702311023707 0ustar pbusernogroup00000000000000include(friends-common.qdocconf) include(ubuntu-appdev-site-header.qdocconf) include(ubuntu-appdev-site-footer.qdocconf) HTML.stylesheets = \ docs/css/reset.css \ docs/css/qtquick.css \ docs/css/base.css \ docs/css/scratch.css HTML.headerstyles = \ "\n" \ "\n" \ "\n" \ "\n" \ "\n" \ "\n" qml-friends-0.2.0+14.04.20140317/docs/css/0000755000015201777760000000000012311702645020051 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/docs/css/scratch.css0000644000015201777760000000137412311702311022205 0ustar pbusernogroup00000000000000body { margin: 0; } div.toc ul { padding: 0; } div.toc li { margin-bottom: 3px; } h1.title { font-size: 36px; line-height: 1.1; font-weight: normal; } h0, h2 { font-size: 24px; line-height: 1.2; margin: 14px 0; font-weight: normal; display: block; } a:hover { color: #dd4814; text-decoration: underline; outline: 0; } table, pre { border-radius: 0; } .annotated td { padding: 0.8em 1em 0.3em; } .wrapper { width: 940px; margin: 0 auto; } .main-content { width: 668px; position: relative; left: 270px; } .title { margin-left: -270px; margin-top: 30px; margin-bottom: 50px; } .toc { margin-left: -270px; font-size: 100%; margin-bottom: 40px; padding: 0; z-index: 2; position: absolute; top: 100px; width: 250px; } qml-friends-0.2.0+14.04.20140317/docs/css/reset.css0000644000015201777760000000153312311702311021675 0ustar pbusernogroup00000000000000/* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html version: 3.3.0 build: 3167 */ html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}qml-friends-0.2.0+14.04.20140317/docs/css/qtquick.css0000644000015201777760000003175112311702311022241 0ustar pbusernogroup00000000000000@media screen { /* basic elements */ html { color: #000000; background: #FFFFFF; } table { border-collapse: collapse; border-spacing: 0; } fieldset, img { border: 0; max-width:100%; } address, caption, cite, code, dfn, em, strong, th, var, optgroup { font-style: inherit; font-weight: inherit; } del, ins { text-decoration: none; } ol li { list-style: decimal; } ul li { list-style: none; } caption, th { text-align: left; } h1.title { font-weight: bold; font-size: 150%; } h0 { font-weight: bold; font-size: 130%; } h1, h2, h3, h4, h5, h6 { font-size: 100%; } q:before, q:after { content: ''; } abbr, acronym { border: 0; font-variant: normal; } sup, sub { vertical-align: baseline; } tt, .qmlreadonly span, .qmldefault span { word-spacing:0.5em; } legend { color: #000000; } strong { font-weight: bold; } em { font-style: italic; } body { margin: 0 1.5em 0 1.5em; font-family: ubuntu; line-height: normal } a { color: #00732F; text-decoration: none; } hr { background-color: #E6E6E6; border: 1px solid #E6E6E6; height: 1px; width: 100%; text-align: left; margin: 1.5em 0 1.5em 0; } pre { border: 1px solid #DDDDDD; -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; border-radius: 0.7em 0.7em 0.7em 0.7em; padding: 1em 1em 1em 1em; overflow-x: auto; } table, pre { -moz-border-radius: 0.7em 0.7em 0.7em 0.7em; -webkit-border-radius: 0.7em 0.7em 0.7em 0.7em; border-radius: 0.7em 0.7em 0.7em 0.7em; background-color: #F6F6F6; border: 1px solid #E6E6E6; border-collapse: separate; margin-bottom: 2.5em; } pre { font-size: 90%; display: block; overflow:hidden; } thead { margin-top: 0.5em; font-weight: bold } th { padding: 0.5em 1.5em 0.5em 1em; background-color: #E1E1E1; border-left: 1px solid #E6E6E6; } td { padding: 0.25em 1.5em 0.25em 1em; } td.rightAlign { padding: 0.25em 0.5em 0.25em 1em; } table tr.odd { border-left: 1px solid #E6E6E6; background-color: #F6F6F6; color: black; } table tr.even { border-left: 1px solid #E6E6E6; background-color: #ffffff; color: #202020; } div.float-left { float: left; margin-right: 2em } div.float-right { float: right; margin-left: 2em } span.comment { color: #008B00; } span.string, span.char { color: #000084; } span.number { color: #a46200; } span.operator { color: #202020; } span.keyword { color: #840000; } span.name { color: black } span.type { font-weight: bold } span.type a:visited { color: #0F5300; } span.preprocessor { color: #404040 } /* end basic elements */ /* font style elements */ .heading { font-weight: bold; font-size: 125%; } .subtitle { font-size: 110% } .small-subtitle { font-size: 100% } .red { color:red; } /* end font style elements */ /* global settings*/ .header, .footer { display: block; clear: both; overflow: hidden; } /* end global settings*/ /* header elements */ .header .qtref { color: #00732F; font-weight: bold; font-size: 130%; } .header .content { margin-left: 5px; margin-top: 5px; margin-bottom: 0.5em; } .header .breadcrumb { font-size: 90%; padding: 0.5em 0 0.5em 1em; margin: 0; background-color: #fafafa; height: 1.35em; border-bottom: 1px solid #d1d1d1; } .header .breadcrumb ul { margin: 0; padding: 0; } .header .content { word-wrap: break-word; } .header .breadcrumb ul li { float: left; background: url(../images/breadcrumb.png) no-repeat 0 3px; padding-left: 1.5em; margin-left: 1.5em; } .header .breadcrumb ul li.last { font-weight: normal; } .header .breadcrumb ul li a { color: #00732F; } .header .breadcrumb ul li.first { background-image: none; padding-left: 0; margin-left: 0; } .header .content ol li { background: none; margin-bottom: 1.0em; margin-left: 1.2em; padding-left: 0 } .header .content li { background: url(../images/bullet_sq.png) no-repeat 0 5px; margin-bottom: 1em; padding-left: 1.2em; } /* end header elements */ /* content elements */ .content h1 { font-weight: bold; font-size: 130% } .content h2 { font-weight: bold; font-size: 120%; width: 100%; } .content h3 { font-weight: bold; font-size: 110%; width: 100%; } .content table p { margin: 0 } .content ul { padding-left: 2.5em; } .content li { padding-top: 0.25em; padding-bottom: 0.25em; } .content ul img { vertical-align: middle; } .content a:visited { color: #4c0033; text-decoration: none; } .content a:visited:hover { color: #4c0033; text-decoration: underline; } a:hover { color: #4c0033; text-decoration: underline; } descr p a { text-decoration: underline; } .descr p a:visited { text-decoration: underline; } .alphaChar{ width:95%; background-color:#F6F6F6; border:1px solid #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; font-size:12pt; padding-left:10px; margin-top:10px; margin-bottom:10px; } .flowList{ /*vertical-align:top;*/ /*margin:20px auto;*/ column-count:3; -webkit-column-count:3; -moz-column-count:3; /* column-width:100%; -webkit-column-width:200px; -col-column-width:200px; */ column-gap:41px; -webkit-column-gap:41px; -moz-column-gap:41px; column-rule: 1px dashed #ccc; -webkit-column-rule: 1px dashed #ccc; -moz-column-rule: 1px dashed #ccc; } .flowList dl{ } .flowList dd{ /*display:inline-block;*/ margin-left:10px; min-width:250px; line-height: 1.5; min-width:100%; min-height:15px; } .flowList dd a{ } .mainContent { padding-left:5px; } .content .flowList p{ padding:0px; } .content .alignedsummary { margin: 15px; } .qmltype { text-align: center; font-size: 120%; } .qmlreadonly { padding-left: 5px; float: right; color: #254117; } .qmldefault { padding-left: 5px; float: right; color: red; } .qmldoc { } .generic .alphaChar{ margin-top:5px; } .generic .odd .alphaChar{ background-color: #F6F6F6; } .generic .even .alphaChar{ background-color: #FFFFFF; } .memItemRight{ padding: 0.25em 1.5em 0.25em 0; } .highlightedCode { margin: 1.0em; } .annotated td { padding: 0.25em 0.5em 0.25em 0.5em; } .toc { font-size: 80% } .header .content .toc ul { padding-left: 0px; } .content .toc h3 { border-bottom: 0px; margin-top: 0px; } .content .toc h3 a:hover { color: #00732F; text-decoration: none; } .content .toc .level2 { margin-left: 1.5em; } .content .toc .level3 { margin-left: 3.0em; } .content ul li { background: url(../images/bullet_sq.png) no-repeat 0 0.7em; padding-left: 1em } .content .toc li { background: url(../images/bullet_dn.png) no-repeat 0 5px; padding-left: 1em } .relpage { -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; border: 1px solid #DDDDDD; padding: 25px 25px; clear: both; } .relpage ul { float: none; padding: 1.5em; } h3.fn, span.fn { -moz-border-radius:7px 7px 7px 7px; -webkit-border-radius:7px 7px 7px 7px; border-radius:7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; font-weight: bold; word-spacing:3px; padding:3px 5px; } .functionIndex { font-size:12pt; word-spacing:10px; margin-bottom:10px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; width:100%; } .centerAlign { text-align:center; } .rightAlign { text-align:right; } .leftAlign { text-align:left; } .topAlign{ vertical-align:top } .functionIndex a{ display:inline-block; } /* end content elements */ /* footer elements */ .footer { color: #393735; font-size: 0.75em; text-align: center; padding-top: 1.5em; padding-bottom: 1em; background-color: #E6E7E8; margin: 0; } .footer p { margin: 0.25em } .small { font-size: 0.5em; } /* end footer elements */ .item { float: left; position: relative; width: 100%; overflow: hidden; } .item .primary { margin-right: 220px; position: relative; } .item hr { margin-left: -220px; } .item .secondary { float: right; width: 200px; position: relative; } .item .cols { clear: both; display: block; } .item .cols .col { float: left; margin-left: 1.5%; } .item .cols .col.first { margin-left: 0; } .item .cols.two .col { width: 45%; } .item .box { margin: 0 0 10px 0; } .item .box h3 { margin: 0 0 10px 0; } .cols.unclear { clear:none; } } /* end of screen media */ /* start of print media */ @media print { input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult { display: none; background: none; } .content { background: none; display: block; width: 100%; margin: 0; float: none; } } /* end of print media */ /* modify the TOC layouts */ div.toc ul { padding-left: 20px; } div.toc li { padding-left: 4px; } /* Remove the border around images*/ a img { border:none; } /*Add styling to the front pages*/ .threecolumn_area { padding-top: 20px; padding-bottom: 20px; } .threecolumn_piece { display: inline-block; margin-left: 78px; margin-top: 8px; padding: 0; vertical-align: top; width: 25.5%; } div.threecolumn_piece ul { list-style-type: none; padding-left: 0px; margin-top: 2px; } div.threecolumn_piece p { margin-bottom: 7px; color: #5C626E; text-decoration: none; font-weight: bold; } div.threecolumn_piece li { padding-left: 0px; margin-bottom: 5px; } div.threecolumn_piece a { font-weight: normal; } /* Add style to guide page*/ .fourcolumn_area { padding-top: 20px; padding-bottom: 20px; } .fourcolumn_piece { display: inline-block; margin-left: 35px; margin-top: 8px; padding: 0; vertical-align: top; width: 21.3%; } div.fourcolumn_piece ul { list-style-type: none; padding-left: 0px; margin-top: 2px; } div.fourcolumn_piece p { margin-bottom: 7px; color: #40444D; text-decoration: none; font-weight: bold; } div.fourcolumn_piece li { padding-left: 0px; margin-bottom: 5px; } div.fourcolumn_piece a { font-weight: normal; } qml-friends-0.2.0+14.04.20140317/docs/css/base.css0000644000015201777760000002706712311702311021477 0ustar pbusernogroup00000000000000/** * Ubuntu Developer base stylesheet * * A base stylesheet containing site-wide styles * * @project Ubuntu Developer * @version 1.0 * @author Canonical Web Team: Steve Edwards * @copyright 2011 Canonical Ltd. */ /** * @section Global */ body { font-family: 'Ubuntu', 'Ubuntu Beta', UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif; font-size: 13px; line-height: 1.4; color: #333; } a { color: #dd4814; text-decoration: none; outline: 0; } p, dl { margin-bottom: 10px; } strong { font-weight: bold; } em { font-style: italic; } code{ padding: 10px; font-family: 'Ubuntu Mono', 'Consolas', 'Monaco', 'DejaVu Sans Mono', Courier, monospace; background-color: #fdf6f2; display: block; margin-bottom: 10px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } h1 { font-size: 36px; line-height: 1.1; margin-bottom: 20px; } article h1, h2 { font-size: 24px; line-height: 1.2; margin-bottom: 14px; } h3 { font-size: 16px; line-height: 1.3; margin-bottom: 8px; } h4 { font-weight: bold; } time { color:#999; } /** * @section Structure */ .header-login, .header-navigation div, .header-content div { margin: 0 auto; width: 940px; } .header-content h1{ background-color:#ffffff; display:inline-block; } .header-content h2{ background-color:#ffffff; display:table; } .header-login ul { margin: 4px 0; float: right; } .header-login li { margin-right: 10px; float: left; } .header-login a { color: #333; } .header-navigation { border-top: 2px solid #dd4814; border-bottom: 2px solid #dd4814; background-color: #fff; height: 54px; clear: right; overflow: hidden; } .header-navigation nav ul { border-right: 1px solid #dd4814; float: right; } .header-navigation nav li { border-left: 1px solid #dd4814; float: left; height: 54px; } .header-navigation nav a { padding: 18px 14px 0; font-size: 14px; display: block; height: 36px; } .header-navigation nav a:hover { background-color: #fcece7; } .header-navigation nav .current_page_item a, .header-navigation nav .current_page_parent a, .header-navigation nav .current_page_ancestor a { background-color: #dd4814; color: #fff; } .header-navigation input { margin: 12px 10px 0 10px; padding: 5px; border-top: 1px solid #a1a1a1; border-right: 1px solid #e0e0e0; border-bottom: 1px solid #fff; border-left: 1px solid #e0e0e0; width: 90px; font-style: italic; color: #ccc; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; -moz-box-shadow: inset 0 1px 1px #e0e0e0; -webkit-box-shadow: inset 0 1px 1px #e0e0e0; box-shadow: inset 0 1px 1px #e0e0e0; } .header-navigation h2 { margin: 18px 0 0 6px; text-transform: lowercase; font-size: 22px; color: #dd4814; float: left; } .header-navigation .logo-ubuntu { margin-top: 12px; float: left; } .header-content .header-navigation-secondary { margin-bottom: 40px; padding: 0; position: relative; z-index: 2; } .header-navigation-secondary div { padding: 0; border: 2px solid #dd4814; -moz-border-radius: 0px 0px 4px 4px; -webkit-border-radius: 0px 0px 4px 4px; border-radius: 0px 0px 4px 4px; background: #fff; border-top: 0px; width: 936px; } .header-navigation-secondary nav li { float: left; } .header-navigation-secondary nav li a { color: #333; display: block; height: 25px; padding: 8px 8px 0; } .header-navigation-secondary nav li:hover, .header-navigation-secondary nav .current_page_item a { background: url("../img/sec-nav-hover.gif"); } .header-content { padding-bottom: 30px; border-bottom: 1px solid #e0e0e0; -moz-box-shadow: 0 1px 3px #e0e0e0; -webkit-box-shadow: 0 1px 3px #e0e0e0; box-shadow: 0 1px 3px #e0e0e0; margin-bottom: 3px; position: relative; overflow: hidden; } footer { padding: 10px 10px 40px 10px; position: relative; -moz-border-radius: 0 0 4px 4px; -webkit-border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px; font-size: 12px; background: url("../img/background-footer.png") repeat scroll 0 0 #f7f6f5; } footer div { margin: 0 auto; padding: 0 10px; width: 940px; } footer a { color: #000; } footer nav ul { margin: 10px 17px 30px 0; width: 172px; display: inline-block; vertical-align: top; height: auto; zoom: 1; *display: inline; } footer nav ul.last { margin-right: 0; } footer nav li { margin-bottom: 8px; } footer nav li:first-child { font-weight: bold; } footer p { margin-bottom: 0; } #content { padding-top: 35px; } .arrow-nav { display: none; position: absolute; top: -1px; z-index: 3; } .shadow { margin: 30px 0 3px 0; border-bottom: 1px solid #e0e0e0; -moz-box-shadow: 0 2px 3px #e0e0e0; -webkit-box-shadow: 0 2px 3px #e0e0e0; box-shadow: 0 2px 3px #e0e0e0; height: 3px; } /** * @section Site-wide */ #content h2{ font-size:24px; } .box-orange { padding: 10px; border: 3px solid #dd4814; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .box-orange .link-action-small { float: right; margin: 0 0 0 20px; } .link-bug { margin-left: 10px; color: #999; } .link-action { float: left; margin-bottom: 20px; padding: 8px 12px; display: block; background-color: #dd4814; color: #fff; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; font-size: 16px; line-height: 1.3; border-top: 3px solid #e6633a; border-bottom: 3px solid #c03d14; } .link-action2 { float: left; display: block; color: #fff; font-size: 16px; line-height: 1.3; } .link-action2 span{ display:block; float:left; } .link-action2 .cta-left{ background:url(../img/button-cta-left.png) no-repeat; width:22px; height:48px; } .link-action2 .cta-center{ background:url(../img/button-cta-slice.png) repeat-x; line-height:45px; height:48px; } .link-action2 .cta-right{ background:url(../img/button-cta-right.png) no-repeat; width:22px; height:48px; } .link-action-small { float: left; display: block; color: #fff; font-size: 16px; } .link-action-small span{ display:block; float:left; height:42px; } .link-action-small .cta-left{ background:url(../img/button-cta-left-small.png) no-repeat; width:19px; } .link-action-small .cta-center{ background:url(../img/button-cta-slice-small.png) repeat-x; line-height:42px; } .link-action-small .cta-right{ background:url(../img/button-cta-right-small.png) no-repeat; width:19px; } .link-action:active { position: relative; top: 1px; } .link-action2:active { position: relative; top: 1px; } .link-action-small:active { position: relative; top: 1px; } .list-bullets li { margin-bottom: 10px; list-style: disc; list-style-position: inside; } .box { margin-bottom: 30px; padding: 15px; border: 1px solid #aea79f; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .box-padded { margin-bottom: 30px; padding: 5px; border: 2px solid #aea79f; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; background: url("../img/pattern-featured.gif") repeat scroll 0 0 #ebe9e7; overflow: hidden; } .box-padded h3 { margin: 5px 0 10px 5px; } .box-padded div { padding: 10px; border: 1px solid #aea79f; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; background-color: #fff; overflow: hidden; } .box-padded li { padding: 0 10px; float: left; width: 211px; border-right: 1px dotted #aea79f; } .box-padded li.first { padding: 0; margin-bottom: 0; } .box-padded li.last { border: 0; width: 217px; } .box-padded img { margin: 0 10px 50px 0; float: left; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } .box-clear { margin-bottom: 40px; } .box-clear .grid-4.first { margin-right: 15px; padding-right: 15px; } .box-clear .grid-4 { margin-left: 0; margin-right: 10px; padding-right: 10px; width: 298px; } .box-clear time { display: block; border-bottom: 1px dotted #aea79f; padding-bottom: 10px; margin-bottom: 10px; } .box-clear div.first { border-right: 1px dotted #aea79f; } .box-clear a { display: block; } .box-clear .rss { background: url("../img/rss.jpg") no-repeat scroll 0 center; padding-left: 20px; } .box-clear .location { display: block; margin-bottom: 1px; } .box-clear .last { margin: 0; padding-right: 0; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; width: 293px; } /* Widgets */ .ui-state-focus { outline: none; } .ui-accordion { border-bottom: 1px dotted #aea79f; } .ui-accordion a { display: block; } .ui-accordion h3 { margin-bottom: 0; border-top: 1px dotted #aea79f; position: relative; font-size: 13px; font-weight: bold; } .ui-accordion h3 a { padding: 10px 0; color: #333; } .ui-accordion h4 { margin-bottom: 5px; } .ui-accordion div fieldset { padding-bottom: 5px; } .ui-accordion div li, .ui-accordion div input { margin-bottom: 10px; } .ui-accordion .ui-icon { position: absolute; top: 15px; right: 0; display: block; width: 8px; height: 8px; background: url("../img/icon-accordion-inactive.png") 0 0 no-repeat transparent; } .ui-accordion .ui-state-active .ui-icon { background-image: url("../img/icon-accordion-active.png"); } .ui-accordion .current_page_item a { color: #333; } .container-tweet { -moz-border-radius: 4px 4px 4px 4px; -webkit-border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px; padding: 10px 10px 10px; background-color: #f7f7f7; } .container-tweet .tweet-follow { margin-top: 10px; margin-bottom: -10px; padding-left: 55px; padding-bottom: 6px; background: url("../img/tweet-follow.png") 0 5px no-repeat; display: block; } .container-tweet .tweet-follow span { font-size: 16px; font-weight: bold; line-height: 1.2; display: block; } .tweet a { display: inline; } .tweet .tweet_text { padding: 10px; background-color: #fff; -moz-border-radius: 4px 4px 4px 4px; -webkit-border-radius: 4px 4px 4px 4px; border-radius: 4px 4px 4px 4px; border: 1px solid #dd4814; font-size: 16px; display: block; clear: both; } .tweet.tweet-small .tweet_text { font-size: inherit; } .tweet .tweet_text a { color: #333; } .tweet .tweet_time, .tweet .tweet_user_and_time { padding: 15px 0 10px 0; position: relative; top: -2px; background: url("../img/tweet-arrow.png") no-repeat; display: block; } .tweet .tweet_odd .tweet_time, .tweet .tweet_odd .tweet_user_and_time { background-position: right 0; float: right; } .tweet .tweet_even .tweet_time, .tweet .tweet_even .tweet_user_and_time { background-position: left 0; float: left; } /* Search */ #content .list-search li { list-style-type:none; border:0px; margin-bottom: 15px; padding-top: 15px; } /* Blog */ .blog-article #nav-single { margin-top: 30px; margin-bottom: 30px; } .blog-article #nav-single .nav-next { float: right; } .blog-article article header .entry-meta { margin-bottom: 20px; } .blog-article article .entry-meta { color: #999; } .blog-article #respond form input[type="submit"] { float: left; cursor: pointer; margin-bottom: 20px; padding: 8px 12px; display: block; background-color: #dd4814; color: #fff; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; font-size: 16px; line-height: 1.3; border-top: 3px solid #e6633a; border-left: 3px solid #e6633a; border-right: 3px solid #e6633a; border-bottom: 3px solid #c03d14; } .blog-article #respond form input[type="submit"]:active { position: relative; top: 1px; } .alignnone{ float:left; margin:10px 20px 10px 0; } .alignleft{ float:left; margin:10px 20px 10px 0; } .alignright{ float:right; margin:10px 0 10px 20px; } .aligncenter{ float:left; margin:10px 20px 10px 0; } .entry-content h2, .entry-content h3{ margin-top:20px; } .entry-content ul li{ list-style-type: circle; margin-left:16px; } .entry-content hr{ border:none; border-top: 1px dotted #AEA79F; } qml-friends-0.2.0+14.04.20140317/docs/ubuntu-appdev-site-header.qdocconf0000644000015201777760000000340012311702311025751 0ustar pbusernogroup00000000000000HTML.postheader = \ "
\n" \ "
\n" \ " \n" \ "
\n" \ "
\n" \ "
\n" \ " \n" \ " \"Ubuntu\n" \ "

App Developer

\n" \ "
\n" \ "
\n" \ " \n" \ "
\n" \ "
\n" \ "
\n" qml-friends-0.2.0+14.04.20140317/docs/friends-offline.qdocconf0000644000015201777760000000203412311702311024036 0ustar pbusernogroup00000000000000include(friends-common.qdocconf) HTML.stylesheets = \ docs/css/reset.css \ docs/css/qtquick.css \ docs/css/base.css \ docs/css/scratch.css HTML.headerstyles = \ "\n" \ "\n" \ "\n" \ "\n" HTML.postheader = \ "
\n" \ "
\n" HTML.footer = \ "
\n" \ "
\n" \ "
\n" \ "
\n" \ " \n" \ "

© 2013 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd. Report a bug on this site

\n" \ "
\n" \ "
\n" qml-friends-0.2.0+14.04.20140317/docs/ubuntu-appdev-site-footer.qdocconf0000644000015201777760000000753012311702311026027 0ustar pbusernogroup00000000000000HTML.footer = \ "
\n" \ "
\n" \ "\n" \ "\n" \ "\n" qml-friends-0.2.0+14.04.20140317/modules/0000755000015201777760000000000012311702645020001 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/modules/Friends/0000755000015201777760000000000012311702645021373 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/0000755000015201777760000000000012311702645022671 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/friendsutils.h0000644000015201777760000000204212311702311025541 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #ifndef FRIENDSUTILS_H #define FRIENDSUTILS_H #include #include class FriendsUtilsQml : public QObject { Q_OBJECT public: explicit FriendsUtilsQml(QObject *parent = 0); ~FriendsUtilsQml(); public Q_SLOTS: QString getAvatarPath(const QString& url); QString createTimeString(const QString& time); private: FriendsUtils* m_utils; }; #endif // FRIENDSUTILS_H qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/friendsutils.cpp0000644000015201777760000000460312311702311026101 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * */ #include "friendsutils.h" #include #include /*! * \qmltype FriendsUtils * \inqmlmodule Friends 0.1 * \ingroup Friends * * \brief Common Utilities for Friends * * FriendsUtils provides some common functions needed for Friends. * * The API providews the following methods: * \list * \li \c createTimeString which returns a timestring from a * timestamp ("a few seconds ago", "2 hours ago", etc) * \li \c getAvatarPath returns a valid path to the cached avatar * \endlist * * Example of use: * * \qml * Item { * FriendsUtils { * id: friendsUtils * } * * Text { * text: friendsUtils.createTimeString("2013-03-07T19:30:02Z") * } * Image { * source: friendsUtils.getAvatarPath ("https://graph.facebook.com/kenvandine/picture") * } * } * \endqml * */ FriendsUtilsQml::FriendsUtilsQml(QObject *parent) : QObject(parent), m_utils(0) { m_utils = friends_utils_new(); } FriendsUtilsQml::~FriendsUtilsQml() { g_object_unref(m_utils); } /* * \qmlmethod variant FriendsUtils::getAvatarPath(string url) * * Returns the path to the cached avatar. */ QString FriendsUtilsQml::getAvatarPath(const QString& url) { QByteArray byte_array = url.toUtf8(); gchar* avatar_path = friends_utils_get_avatar_path(m_utils, byte_array.data()); return QString::fromUtf8(avatar_path); } /* * \qmlmethod variant FriendsUtils::createTimeString(string timestamp) * * Returns a friendly string for the time delta. */ QString FriendsUtilsQml::createTimeString(const QString& time) { QByteArray byte_array = time.toUtf8(); gchar* time_string = friends_utils_create_time_string(m_utils, byte_array.data()); return QString::fromUtf8(time_string); } qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/friends.qdoc0000644000015201777760000000130712311702311025162 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ /*! \qmlmodule Friends 0.1 \title Friends Components */ qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/friendsdispatcher.h0000644000015201777760000000634012311702311026534 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef FRIENDSSERVICE_H #define FRIENDSSERVICE_H #include #include #include class FriendsDispatcherQml : public QObject { Q_OBJECT public: explicit FriendsDispatcherQml(QObject *parent = 0); ~FriendsDispatcherQml(); public Q_SLOTS: QString urlShorten(const QString& url) const; QStringList featuresForProtocol(const QString& protocol) const; void uploadForAccount(const int& account_id, const QString& uri, const QString& description) const; void uploadForAccountAsync(const int& account_id, const QString& uri, const QString& description) const; void sendForAccount(const int& account_id, const QString& message) const; void sendForAccountAsync(const int& account_id, const QString& message) const; void send(const QString& message) const; void sendAsync(const QString& message) const; void sendReply(const int& account_id, const QString& message_id, const QString& message) const; void sendReplyAsync(const int& account_id, const QString& message_id, const QString& message) const; void retweet(const int& account_id, const QString& message_id) const; void retweetAsync(const int& account_id, const QString& message_id) const; void like(const int& account_id, const QString& message_id) const; void likeAsync(const int& account_id, const QString& message_id) const; void unlike(const int& account_id, const QString& message_id) const; void unlikeAsync(const int& account_id, const QString& message_id) const; void refresh() const; Q_SIGNALS: void uploadComplete(QString resultUrl, bool success, QString errorMessage); void sendComplete(QString result, bool success, QString errorMessage); void retweetComplete(QString result, bool success, QString errorMessage); void likeComplete(QString result, bool success, QString errorMessage); void unlikeComplete(QString result, bool success, QString errorMessage); private: static void uploadCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data); static void sendCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data); static void sendReplyCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data); static void retweetCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data); static void likeCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data); static void unlikeCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data); FriendsDispatcher* m_dispatcher; }; #endif // FRIENDSSERVICE_H qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/plugin.h0000644000015201777760000000166212311702311024333 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #ifndef FRIENDS_PLUGIN_H #define FRIENDS_PLUGIN_H #include class FriendsPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri); }; #endif // FRIENDS_PLUGIN_H qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/streammodel.cpp0000644000015201777760000002025312311702311025701 0ustar pbusernogroup00000000000000#include #include "streammodel.h" #include #include class StreamModelPrivate: public DeeListModel { Q_DECLARE_PUBLIC(StreamModel) public: StreamModelPrivate(StreamModel *model); ~StreamModelPrivate(); static void onModelReady(GObject* parent, GParamSpec *pspec, StreamModelPrivate *q); void updateResults(StreamModelPrivate *d); void createRoles(); QHash m_roleNames; private: mutable StreamModel *q_ptr; QString streamId = NULL; QString serviceId = NULL; uint accountId = 0; DeeModel* m_resultsModel; DeeModel* m_sharedModel; DeeModel* m_sortedModel; }; StreamModelPrivate::StreamModelPrivate(StreamModel *model): DeeListModel(model), q_ptr(model) { QString modelName = "com.canonical.Friends.Streams"; /* read environment variables */ QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); if (environment.contains(QLatin1String("FRIENDS_STREAMS_MODEL"))) { modelName = environment.value(QLatin1String("FRIENDS_STREAMS_MODEL")); } qDebug() << "MODEL: " << modelName; m_sharedModel = dee_shared_model_new (modelName.toUtf8()); m_resultsModel = m_sharedModel; m_sortedModel = dee_sequence_model_new (); g_signal_connect(m_sharedModel, "notify::synchronized", G_CALLBACK(onModelReady), this); } void StreamModelPrivate::createRoles() { if (m_resultsModel == NULL) { return; } QHash roles; roles[0] = QString("service").toLocal8Bit(); roles[1] = QString("accountId").toLocal8Bit(); roles[2] = QString("messageId").toLocal8Bit(); roles[3] = QString("stream").toLocal8Bit(); roles[4] = QString("sender").toLocal8Bit(); roles[5] = QString("senderId").toLocal8Bit(); roles[6] = QString("senderNick").toLocal8Bit(); roles[7] = QString("fromMe").toLocal8Bit(); roles[8] = QString("timestamp").toLocal8Bit(); roles[9] = QString("message").toLocal8Bit(); roles[10] = QString("avatar").toLocal8Bit(); roles[11] = QString("url").toLocal8Bit(); roles[12] = QString("likes").toLocal8Bit(); roles[13] = QString("liked").toLocal8Bit(); roles[14] = QString("linkPicture").toLocal8Bit(); roles[15] = QString("linkName").toLocal8Bit(); roles[16] = QString("linkUrl").toLocal8Bit(); roles[17] = QString("linkDescription").toLocal8Bit(); roles[18] = QString("linkCaption").toLocal8Bit(); roles[19] = QString("linkIcon").toLocal8Bit(); roles[20] = QString("location").toLocal8Bit(); roles[21] = QString("latitude").toLocal8Bit(); roles[22] = QString("longitude").toLocal8Bit(); m_roleNames = roles; Q_EMIT q_ptr->roleNamesChanged(roles); } void StreamModelPrivate::onModelReady(GObject* parent __attribute__ ((unused)), GParamSpec *pspec, StreamModelPrivate *d) { DeeModel *model = (DeeModel*)parent; if (!dee_shared_model_is_synchronized ((DeeSharedModel*)model)) return; d->createRoles(); DeeFilter _sort_filter; dee_filter_new_collator_desc (8, &_sort_filter); d->m_sortedModel = dee_filter_model_new (model, &_sort_filter); qDebug() << Q_FUNC_INFO << " " << dee_model_get_n_rows (d->m_sortedModel); d->updateResults(d); } void StreamModelPrivate::updateResults(StreamModelPrivate *d) { if (d->streamId != NULL) { DeeFilter _key_filter; dee_filter_new_for_key_column (3, d->streamId.toUtf8().data(), &_key_filter); d->m_resultsModel = dee_filter_model_new (d->m_sortedModel, &_key_filter); } else { GRegex *regex; regex = g_regex_new ("^((?!reply_to).)*$", G_REGEX_FIRSTLINE, G_REGEX_MATCH_PARTIAL, NULL); DeeFilter _regex_filter; dee_filter_new_regex (3, regex, &_regex_filter); g_regex_unref (regex); d->m_resultsModel = dee_filter_model_new (d->m_sortedModel, &_regex_filter); } qDebug () << "STREAM: " << d->streamId << " ROWS: " << dee_model_get_n_rows (d->m_resultsModel); if (d->serviceId != NULL) { DeeFilter _service_filter; dee_filter_new_for_key_column (0, d->serviceId.toUtf8().data(), &_service_filter); d->m_resultsModel = dee_filter_model_new (d->m_resultsModel, &_service_filter); } qDebug () << "SERVICE: " << d->serviceId << " ROWS: " << dee_model_get_n_rows (d->m_resultsModel); if (d->accountId != 0) { DeeFilter _account_filter; dee_filter_new_for_any_column (1, g_variant_new_uint64(d->accountId), &_account_filter); d->m_resultsModel = dee_filter_model_new (d->m_resultsModel, &_account_filter); qDebug () << "ACCOUNT: " << d->accountId << " ROWS: " << dee_model_get_n_rows (d->m_resultsModel); } q_ptr->setModel(m_resultsModel); Q_EMIT q_ptr->streamChanged(); } StreamModelPrivate::~StreamModelPrivate() { } /*! * \qmltype StreamModel * \inqmlmodule Friends 0.1 * \ingroup Friends * * \brief A model of the user's Friends feeds. * * The SteamsModel is a model based on the model provided by the Friends * service, conveniently sorted with pre-defined filters. By default, * the model contains everything except comments. You can filter * based on stream, account or service. * * Examples of use: * * 1. Model of the complete Friends feed: * \qml * * Item { * StreamModel { * id: StreamModel * } * * ListView { * model: StreamModel * delegate: Text { text: "message: " + message } * } * } * * \endqml * * 2. Model of the Friends feed, limited to facebook: * \qml * * Item { * StreamModel { * id: StreamModel * service: "facebook" * } * * ListView { * model: StreamModel * delegate: Text { text: "message: " + message } * } * } * \endqml * * 3. Model of the Friends feed, limited to a single account: * \qml * * Item { * StreamModel { * id: StreamModel * account: 1 // The account ID provided but Ubuntu.OnlineAccounts * } * * ListView { * model: StreamModel * delegate: Text { text: "message: " + message } * } * } * \endqml * * 4. Model of the Friends feed, limited to a thread of comments: * \qml * * Item { * StreamModel { * id: StreamModel * stream: "reply_to/"+messageId * } * * ListView { * model: StreamModel * delegate: Text { text: "message: " + message } * } * } * \endqml * * 5. Model of the Friends feed, limited to a specific stream, like private messages: * \qml * * Item { * StreamModel { * id: StreamModel * stream: "private" * } * * ListView { * model: StreamModel * delegate: Text { text: "message: " + message } * } * } * \endqml * */ StreamModel::StreamModel(DeeListModel *parent) : DeeListModel(parent), d_ptr(new StreamModelPrivate(this)) { } StreamModel::~StreamModel() { } void StreamModel::classBegin() { } void StreamModel::componentComplete() { } void StreamModel::setStream(const QString& streamId) { Q_D(StreamModel); if (streamId == d->streamId) return; d->streamId = streamId; d->updateResults(d); } /*! * \qmlproperty string StreamModel::stream * If set, the model will include only this stream */ QString StreamModel::stream() const { Q_D(const StreamModel); return d->streamId; } void StreamModel::setService(const QString& serviceId) { Q_D(StreamModel); if (serviceId == d->serviceId) return; d->serviceId = serviceId; d->updateResults(d); } /*! * \qmlproperty string StreamModel::service * If set, the model will include only this service */ QString StreamModel::service() const { Q_D(const StreamModel); return d->serviceId; } void StreamModel::setAccount(uint account) { Q_D(StreamModel); if (account == d->accountId) return; d->accountId = account; d->updateResults(d); qDebug() << "Account: " << account; } /*! * \qmlproperty uint StreamModel::account * If set, the model will include only this account */ uint StreamModel::account() const { Q_D(const StreamModel); return d->accountId; } QHash StreamModel::roleNames() const { Q_D(const StreamModel); return d->m_roleNames; } qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/streammodel.h0000644000015201777760000000223112311702311025342 0ustar pbusernogroup00000000000000#ifndef StreamModel_H #define StreamModel_H #include #include #include #include #include "deelistmodel.h" #include class StreamModelPrivate; class StreamModel : public DeeListModel, public QQmlParserStatus { Q_OBJECT Q_INTERFACES(QQmlParserStatus) Q_PROPERTY(QString stream READ stream WRITE setStream NOTIFY streamChanged) Q_PROPERTY(QString service READ service WRITE setService NOTIFY serviceChanged) Q_PROPERTY(uint account READ account WRITE setAccount NOTIFY accountChanged) public: explicit StreamModel(DeeListModel *parent = 0); ~StreamModel(); void setStream(const QString& streamId); QString stream() const; void setService(const QString& serviceId); QString service() const; void setAccount(uint account); uint account() const; void classBegin(); void componentComplete(); QHash roleNames() const; Q_SIGNALS: void streamChanged(); void serviceChanged(); void accountChanged(); private: StreamModelPrivate* const d_ptr; Q_DECLARE_PRIVATE(StreamModel) }; #endif // StreamModel_H qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/plugin.pro0000644000015201777760000000132012311702311024673 0ustar pbusernogroup00000000000000include(../../../qtversioncheck.pri) include(../../../common-vars.pri) TEMPLATE = lib TARGET = ../Friends QT += qml CONFIG += qt plugin no_keywords link_pkgconfig PKGCONFIG += friends-0.1 gobject-2.0 libdee-qt5 #comment in the following line to disable traces #DEFINES += QT_NO_DEBUG_OUTPUT QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF TARGET = $$qtLibraryTarget($$TARGET) uri = Friends HEADERS += plugin.h \ friendsutils.h \ friendsdispatcher.h \ streammodel.h SOURCES += plugin.cpp \ friendsutils.cpp \ friendsdispatcher.cpp \ streammodel.cpp # deployment rules for the plugin installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /).$$API_VERSION target.path = $$installPath INSTALLS += target qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/friendsdispatcher.cpp0000644000015201777760000003745412311702311027101 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "friendsdispatcher.h" #include /*! * \qmltype FriendsDispatcher * \inqmlmodule Friends 0.1 * \ingroup Friends * * \brief Interface to the Friends dispatcher * * FriendsDispatcher provides an interface for applications to use the Friends * dispatcher * * Example of use: * * \qml * Item { * FriendsDispatcher { * id: friends * onSendComplete: { * if (success) { * activitySpinner.visible = false; * entry.text = ""; * console.log ("Send completed successfully"); * } else { * activitySpinner.visible = false; * console.log ("Send failed: " + errorMessage); * } * } * * } * * TextArea { * id: entry * height: units.gu(4) * placeholderText: i18n.tr("Compose") * autoSize: true * ActivityIndicator { * id: activitySpinner * objectName: "activitySpinner" * anchors.centerIn: entry * visible: false * running: visible * } * } * Button { * id: sendButton * width: units.gu(9) * height: units.gu(4) * text: i18n.tr("Send") * onClicked: { * console.log ("Post: " + entry.text); * activitySpinner.visible = true * var account = 1; //The account ID from Ubuntu.OnlineAccounts * friends.sendForAccountAsync(account, entry.text); * } * } * * } * \endqml * */ FriendsDispatcherQml::FriendsDispatcherQml(QObject *parent) : QObject(parent), m_dispatcher(0) { GError* error = NULL; m_dispatcher = friends_dispatcher_new(&error); if (error != NULL) g_error_free (error); } FriendsDispatcherQml::~FriendsDispatcherQml() { g_object_unref(m_dispatcher); } QString FriendsDispatcherQml::urlShorten(const QString& url) const { QByteArray byte_array = url.toUtf8(); GError* error = NULL; gchar* shortUrl = friends_dispatcher_shorten(m_dispatcher, byte_array.data(), &error); if (error != NULL) g_error_free (error); return shortUrl; } QStringList FriendsDispatcherQml::featuresForProtocol(const QString& protocol) const { QStringList features; int length; QByteArray byte_array = protocol.toUtf8(); GError* error = NULL; gchar** c_features = friends_dispatcher_features(m_dispatcher, byte_array.data(), &length, &error); for (int i = 0; i < length; i++) { features.append(QString::fromUtf8(c_features[i])); } if (error != NULL) g_error_free (error); return features; } void FriendsDispatcherQml::uploadForAccount(const int& account_id, const QString& uri, const QString& description) const { QByteArray path = uri.toUtf8(); QByteArray desc = description.toUtf8(); GError* error = NULL; friends_dispatcher_upload(m_dispatcher, account_id, path.data(), desc.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::sendForAccount(const int& account_id, const QString& message) const { QByteArray msg = message.toUtf8(); uint acct = (uint)account_id; GError* error = NULL; friends_dispatcher_send_message(m_dispatcher, &acct, msg.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::send(const QString& message) const { QByteArray msg = message.toUtf8(); GError* error = NULL; friends_dispatcher_send_message(m_dispatcher, NULL, msg.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::sendReply(const int& account_id, const QString& message_id, const QString& message) const { QByteArray msg = message.toUtf8(); QByteArray msg_id = message_id.toUtf8(); GError* error = NULL; friends_dispatcher_send_reply(m_dispatcher, account_id, msg_id.data(), msg.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::retweetCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data) { Q_UNUSED(source_object); FriendsDispatcherQml* dispatcher = (FriendsDispatcherQml*) user_data; if (dispatcher) { gchar* result; GError* error = NULL; bool success = TRUE; friends_dispatcher_retweet_finish(dispatcher->m_dispatcher, res, &result, &error); QString errorMessage; if (result == NULL || error != NULL) { success = FALSE; errorMessage = QString::fromUtf8(error->message); } Q_EMIT dispatcher->retweetComplete(QString::fromUtf8(result), success, errorMessage); if (error != NULL) g_error_free (error); } } /*! * \qmlmethod object FriendsDispatcher::retweetAsync(int accountId, string messageId) * * Retweets a post for the specified \a messageId. Use retweetComplete * callback to check for success. * \list * \li \c accountId is the accountId, as provided by Ubuntu.OnlineAccounts * \li \c messageId for the post to retweet * \endlist * * \sa retweetComplete */ void FriendsDispatcherQml::retweetAsync(const int& account_id, const QString& message_id) const { QByteArray msg_id = message_id.toUtf8(); friends_dispatcher_retweet_async(m_dispatcher, account_id, msg_id.data(), &retweetCompleteCallback, (gpointer) this); } void FriendsDispatcherQml::retweet(const int& account_id, const QString& message_id) const { QByteArray msg_id = message_id.toUtf8(); GError* error = NULL; friends_dispatcher_retweet(m_dispatcher, account_id, msg_id.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::likeCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data) { Q_UNUSED(source_object); FriendsDispatcherQml* dispatcher = (FriendsDispatcherQml*) user_data; if (dispatcher) { gchar* result; GError* error = NULL; bool success = TRUE; friends_dispatcher_like_finish(dispatcher->m_dispatcher, res, &result, &error); QString errorMessage; if (result == NULL || error != NULL) { success = FALSE; errorMessage = QString::fromUtf8(error->message); } Q_EMIT dispatcher->likeComplete(QString::fromUtf8(result), success, errorMessage); if (error != NULL) g_error_free (error); } } /*! * \qmlmethod object FriendsDispatcher::likeAsync(int accountId, string messageId) * * Likes a post for the specified \a messageId. Use likeComplete * callback to check for success. * \list * \li \c accountId is the accountId, as provided by Ubuntu.OnlineAccounts * \li \c messageId for the post to like * \endlist * * \sa likeComplete */ void FriendsDispatcherQml::likeAsync(const int& account_id, const QString& message_id) const { QByteArray msg_id = message_id.toUtf8(); friends_dispatcher_like_async(m_dispatcher, account_id, msg_id.data(), &likeCompleteCallback, (gpointer) this); } void FriendsDispatcherQml::like(const int& account_id, const QString& message_id) const { QByteArray msg_id = message_id.toUtf8(); GError* error = NULL; friends_dispatcher_like(m_dispatcher, account_id, msg_id.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::unlikeCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data) { Q_UNUSED(source_object); FriendsDispatcherQml* dispatcher = (FriendsDispatcherQml*) user_data; if (dispatcher) { gchar* result; GError* error = NULL; bool success = TRUE; friends_dispatcher_unlike_finish(dispatcher->m_dispatcher, res, &result, &error); QString errorMessage; if (result == NULL || error != NULL) { success = FALSE; errorMessage = QString::fromUtf8(error->message); } Q_EMIT dispatcher->unlikeComplete(QString::fromUtf8(result), success, errorMessage); if (error != NULL) g_error_free (error); } } /*! * \qmlmethod object FriendsDispatcher::unlikeAsync(int accountId, string messageId) * * Un-likes a post for the specified \a messageId. Use unlikeComplete * callback to check for success. * \list * \li \c accountId is the accountId, as provided by Ubuntu.OnlineAccounts * \li \c messageId for the post to un-like * \endlist * * \sa unlikeComplete */ void FriendsDispatcherQml::unlikeAsync(const int& account_id, const QString& message_id) const { QByteArray msg_id = message_id.toUtf8(); friends_dispatcher_unlike_async(m_dispatcher, account_id, msg_id.data(), &unlikeCompleteCallback, (gpointer) this); } void FriendsDispatcherQml::unlike(const int& account_id, const QString& message_id) const { QByteArray msg_id = message_id.toUtf8(); GError* error = NULL; friends_dispatcher_unlike(m_dispatcher, account_id, msg_id.data(), &error); if (error != NULL) g_error_free (error); } void FriendsDispatcherQml::uploadCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data) { Q_UNUSED(source_object); FriendsDispatcherQml* dispatcher = (FriendsDispatcherQml*) user_data; if (dispatcher) { gchar* result_url; GError* error = NULL; bool success = TRUE; friends_dispatcher_upload_finish(dispatcher->m_dispatcher, res, &result_url, &error); QString errorMessage; if (result_url == NULL || error != NULL) { success = FALSE; errorMessage = QString::fromUtf8(error->message); } Q_EMIT dispatcher->uploadComplete(QString::fromUtf8(result_url), success, errorMessage); if (error != NULL) g_error_free (error); } } /*! * \qmlmethod object FriendsDispatcher::uploadForAccountAsync(int accountId, string uri, string description) * * Uploads file from \a uri to the specified account, use uploadComplete * callback to check for success. * \list * \li \c accountId is the accountId, as provided by Ubuntu.OnlineAccounts * \li \c uri is a URI to an image to upload, for example file:///tmp/example.jpg * \li \c description is a description to be included in the post * \endlist * * \sa uploadComplete */ void FriendsDispatcherQml::uploadForAccountAsync(const int& account_id, const QString& uri, const QString& description) const { QByteArray path = uri.toUtf8(); QByteArray desc = description.toUtf8(); friends_dispatcher_upload_async(m_dispatcher, account_id, path.data(), desc.data(), &uploadCompleteCallback, (gpointer) this); } void FriendsDispatcherQml::sendCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data) { Q_UNUSED(source_object); FriendsDispatcherQml* dispatcher = (FriendsDispatcherQml*) user_data; if (dispatcher) { gchar* result; GError* error = NULL; bool success = TRUE; friends_dispatcher_send_message_finish(dispatcher->m_dispatcher, res, &result, &error); QString errorMessage; if (result == NULL || error != NULL) { success = FALSE; errorMessage = QString::fromUtf8(error->message); } Q_EMIT dispatcher->sendComplete(QString::fromUtf8(result), success, errorMessage); if (error != NULL) g_error_free (error); } } /*! * \qmlmethod object FriendsDispatcher::sendAsync(string message) * * Posts a status update to all enabled account, use sendComplete * callback to check for success. * * \sa sendComplete */ void FriendsDispatcherQml::sendAsync(const QString& message) const { QByteArray msg = message.toUtf8(); friends_dispatcher_send_message_async(m_dispatcher, NULL, msg.data(), &sendCompleteCallback, (gpointer) this); } /*! * \qmlmethod object FriendsDispatcher::sendForAccountAsync(int accountId, string message) * * Posts a status update to the specified account, use sendComplete * callback to check for success. * * \sa sendComplete */ void FriendsDispatcherQml::sendForAccountAsync(const int& account_id, const QString& message) const { QByteArray msg = message.toUtf8(); uint acct = (uint)account_id; friends_dispatcher_send_message_async(m_dispatcher, &acct, msg.data(), &sendCompleteCallback, (gpointer) this); } void FriendsDispatcherQml::sendReplyCompleteCallback(GObject *source_object, GAsyncResult *res, gpointer user_data) { Q_UNUSED(source_object); FriendsDispatcherQml* dispatcher = (FriendsDispatcherQml*) user_data; if (dispatcher) { gchar* result; GError* error = NULL; bool success = TRUE; friends_dispatcher_send_reply_finish(dispatcher->m_dispatcher, res, &result, &error); QString errorMessage; if (result == NULL || error != NULL) { success = FALSE; errorMessage = QString::fromUtf8(error->message); } Q_EMIT dispatcher->sendComplete(QString::fromUtf8(result), success, errorMessage); if (error != NULL) g_error_free (error); } } /*! * \qmlmethod object FriendsDispatcher::sendReplyAsync(int accountId, string messageId, string message) * * Posts a reply status update to all enabled account, use sendComplete * callback to check for success. * * \sa sendComplete */ void FriendsDispatcherQml::sendReplyAsync(const int& account_id, const QString& message_id, const QString& message) const { QByteArray msg = message.toUtf8(); QByteArray msg_id = message_id.toUtf8(); friends_dispatcher_send_reply_async(m_dispatcher, account_id, msg_id.data(), msg.data(), &sendReplyCompleteCallback, (gpointer) this); } void FriendsDispatcherQml::refresh() const { GError* error = NULL; friends_dispatcher_refresh(m_dispatcher, &error); if (error != NULL) g_error_free (error); } /*! * \qmlsignal FriendsDispatcher::sendComplete(bool success, string errorMessage) * * Emitted when any of the async send methods completes. Check \a success * for success or failure and \a errorMessage contains the error string * returned from the dispatcher. */ /*! * \qmlsignal FriendsDispatcher::uploadComplete(bool success, string errorMessage) * * Emitted when uploadForAccountAsync completes. Check \a success * for success or failure and \a errorMessage contains the error string * returned from the dispatcher. */ /*! * \qmlsignal FriendsDispatcher::likeComplete(bool success, string errorMessage) * * Emitted when likeAsync completes. Check \a success * for success or failure and \a errorMessage contains the error string * returned from the dispatcher. */ /*! * \qmlsignal FriendsDispatcher::unlikeComplete(bool success, string errorMessage) * * Emitted when unlikeAsync completes. Check \a success * for success or failure and \a errorMessage contains the error string * returned from the dispatcher. */ /*! * \qmlsignal FriendsDispatcher::retweetComplete(bool success, string errorMessage) * * Emitted when retweetAsync completes. Check \a success * for success or failure and \a errorMessage contains the error string * returned from the dispatcher. */ qml-friends-0.2.0+14.04.20140317/modules/Friends/plugin/plugin.cpp0000644000015201777760000000220512311702311024660 0ustar pbusernogroup00000000000000/* * Copyright 2012 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include "friendsutils.h" #include "friendsdispatcher.h" #include "streammodel.h" #include "plugin.h" #include #include void FriendsPlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("Friends")); qDebug() << Q_FUNC_INFO << uri; g_type_init (); qmlRegisterType(uri, 0, 2, "FriendsUtils"); qmlRegisterType(uri, 0, 2, "FriendsDispatcher"); qmlRegisterType(uri, 0, 2, "StreamModel"); } qml-friends-0.2.0+14.04.20140317/modules/Friends/qmldir0000644000015201777760000000003612311702311022573 0ustar pbusernogroup00000000000000module Friends plugin Friends qml-friends-0.2.0+14.04.20140317/modules/Friends/Friends.pro0000644000015201777760000000047212311702311023500 0ustar pbusernogroup00000000000000include(../../qtversioncheck.pri) include(../../common-vars.pri) TEMPLATE = subdirs SUBDIRS += plugin uri = Friends installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /).$$API_VERSION # qmldir QMLDIR_FILE = qmldir qmldir_file.path = $$installPath qmldir_file.files = $$QMLDIR_FILE INSTALLS += qmldir_file qml-friends-0.2.0+14.04.20140317/modules/qt-friends.pro0000644000015201777760000000010712311702311022563 0ustar pbusernogroup00000000000000include(../qtversioncheck.pri) TEMPLATE = subdirs SUBDIRS += Friends qml-friends-0.2.0+14.04.20140317/examples/0000755000015201777760000000000012311702645020147 5ustar pbusernogroup00000000000000qml-friends-0.2.0+14.04.20140317/examples/poster-account.qml0000644000015201777760000000677412311702311023634 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.OnlineAccounts 0.1 import Friends 0.2 /*! \brief MainView with a TextArea and send button which post with qml-friends */ MainView { // objectName for functional testing purposes (autopilot-qt5) objectName: "mainView" applicationName: "poster" width: units.gu(50) height: units.gu(20) AccountServiceModel { id: accounts // Set serviceType to get all accounts for a type, like microblogging //serviceType: "microblogging" // Set provider to get all accounts for a single provider, like twitter provider: "twitter" } FriendsDispatcher { id: friends // use this to check if the send was successfull onSendComplete: { if (success) { activitySpinner.visible = false; entry.text = ""; console.log ("Send completed successfully"); } else { activitySpinner.visible = false; console.log ("Send failed: " + errorMessage); } } } Column { anchors.centerIn: parent width: units.gu(40) spacing: units.gu(2) TextArea { id: entry objectName: "entry" anchors { left: parent.left leftMargin: units.gu(1) right: sendButton.left rightMargin: units.gu(1) bottomMargin: units.gu(1.5) } focus: true font.pixelSize: FontUtils.sizeToPixels("medium") font.family: "Ubuntu" // send message if return was pressed Keys.onReturnPressed: sendButton.clicked(null) Keys.onEscapePressed: text = "" height: units.gu(4) placeholderText: i18n.tr("Compose") autoSize: true maximumLineCount: 0 ActivityIndicator { id: activitySpinner objectName: "activitySpinner" anchors.centerIn: entry visible: false running: visible } } Button { id: sendButton objectName: "sendButton" anchors { right: parent.right rightMargin: units.gu(1) left: entry.right bottom: entry.bottom } width: units.gu(9) height: units.gu(4) color: "#dd4814" text: i18n.tr("Send") onClicked: { console.log ("Post: " + entry.text); activitySpinner.visible = true for (var i = 0; i < accounts.count; i++) { var account = accounts.get(i, "accountId"); friends.sendForAccountAsync(account, entry.text); } } } } } qml-friends-0.2.0+14.04.20140317/examples/streamview.qml0000644000015201777760000000746012311702311023045 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick 2.0 import Ubuntu.Components 0.1 import Ubuntu.Components.ListItems 0.1 import Friends 0.2 MainView { width: units.gu(50) height: units.gu(100) FriendsUtils { id: friendsUtils } ListView { id: listView anchors { fill: parent } snapMode: ListView.SnapToItem cacheBuffer: parent.height model: StreamModel { //stream: "messages" //service: "facebook" /* account Id from libaccounts */ //account: 1 } delegate: Item { id: tile height: status_update_content.height width: parent.width anchors { margins: units.gu(1) } UbuntuShape { id: avatarImage radius: "medium" height: units.dp(48) width: units.dp(48) anchors { left: parent.left top: parent.top leftMargin: units.gu(1) topMargin: units.gu(1) } image: Image { anchors.fill: parent source: Qt.resolvedUrl(model.avatar) asynchronous: true fillMode: Image.PreserveAspectFit } } Item { id: status_update_content anchors { left: avatarImage.right right: parent.right top: parent.top topMargin: units.gu(1) leftMargin: units.gu(1) bottomMargin: units.gu(1) rightMargin: units.gu(1) } height: childrenRect.height + units.gu(2) Column { spacing: units.gu(1) anchors { left: parent.left; right: parent.right bottomMargin: units.gu(2) } Label { id: sender text: model.sender fontSize: "medium" font.bold: true font.family: "Ubuntu" width: parent.width } Label { id: message text: model.message wrapMode: Text.WrapAtWordBoundaryOrAnywhere width: parent.width - units.gu(3) font.family: "Ubuntu" } } Row { anchors.right: parent.right anchors.rightMargin: units.gu(1) anchors.top: parent.top spacing: units.gu(1) Label { id: time text: friendsUtils.createTimeString(model.timestamp) fontSize: "small" font.family: "Ubuntu" } } } ThinDivider {} } } } qml-friends-0.2.0+14.04.20140317/examples/README0000644000015201777760000000363212311702311021021 0ustar pbusernogroup00000000000000Code examples for qml-friends All the dependencies can be installed from ppa:super-friends/ppa Installing the qtdeclarative5-friends-plugin package should bring in the necessary dependencies /* Sending http://bazaar.launchpad.net/~super-friends/qml-friends/raring/view/head:/examples/poster.qml */ import Friends 0.1 FriendsDispatcher { id: friends // use this to check if the send was successfull onSendComplete: { if (success) { console.log ("Send completed successfully"); } else { console.log ("Send failed: " + errorMessage); } } } Button { id: sendButton text: i18n.tr("Send") onClicked: { /* async method to send, connect to onSendComplete for success/failure */ friends.sendAsync(entry.text); } } Getting a model of the data from Friends http://bazaar.launchpad.net/~super-friends/qml-friends/raring/view/head:/examples/streamview.qml /* To get a model of all posts, suitable for use in a ListView, Repeater, etc */ StreamModel { id: streamModel } /* The roleNames provided from StreamModel: service accountId messageId stream sender senderId senderNick fromMe timestamp message avatar url likes liked linkPicture linkName linkUrl linkDescription linkCaption linkIcon location latitude longitude */ /* To get a model of all images */ StreamModel { stream: "images" } /* To get a model of content from twitter */ StreamModel { service: "twitter" } /* To get a model of content from accountId 2 */ StreamModel { account: 2 } /* To get a model of threads on a post */ StreamModel { stream: "reply_to/"+messageId } /* convenience function for converting timestamps into time delta strings, like "2 hours ago" */ FriendsUtils { id: friendsUtils } friendsUtils.createTimeString(timestamp) qml-friends-0.2.0+14.04.20140317/examples/poster.qml0000644000015201777760000000603412311702311022167 0ustar pbusernogroup00000000000000/* * Copyright (C) 2013 Canonical, Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ import QtQuick 2.0 import Ubuntu.Components 0.1 import Friends 0.2 /*! \brief MainView with a TextArea and send button which post with qml-friends */ MainView { // objectName for functional testing purposes (autopilot-qt5) objectName: "mainView" applicationName: "poster" width: units.gu(50) height: units.gu(20) FriendsDispatcher { id: friends // use this to check if the send was successfull onSendComplete: { if (success) { activitySpinner.visible = false; entry.text = ""; console.log ("Send completed successfully"); } else { activitySpinner.visible = false; console.log ("Send failed: " + errorMessage); } } } Column { anchors.centerIn: parent width: units.gu(40) spacing: units.gu(2) TextArea { id: entry objectName: "entry" anchors { left: parent.left leftMargin: units.gu(1) right: sendButton.left rightMargin: units.gu(1) bottomMargin: units.gu(1.5) } focus: true font.pixelSize: FontUtils.sizeToPixels("medium") font.family: "Ubuntu" // send message if return was pressed Keys.onReturnPressed: sendButton.clicked(null) Keys.onEscapePressed: text = "" height: units.gu(4) placeholderText: i18n.tr("Compose") autoSize: true maximumLineCount: 0 ActivityIndicator { id: activitySpinner objectName: "activitySpinner" anchors.centerIn: entry visible: false running: visible } } Button { id: sendButton objectName: "sendButton" anchors { right: parent.right rightMargin: units.gu(1) left: entry.right bottom: entry.bottom } width: units.gu(9) height: units.gu(4) color: "#dd4814" text: i18n.tr("Send") onClicked: { console.log ("Post: " + entry.text); activitySpinner.visible = true friends.sendAsync(entry.text); } } } } qml-friends-0.2.0+14.04.20140317/COPYING0000644000015201777760000001674312311702311017365 0ustar pbusernogroup00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. qml-friends-0.2.0+14.04.20140317/qtversioncheck.pri0000644000015201777760000000007712311702311022067 0ustar pbusernogroup00000000000000contains(QT_VERSION, ^4.*) { error("Use at least Qt 5.x"); } qml-friends-0.2.0+14.04.20140317/friends.pro0000644000015201777760000000073212311702311020475 0ustar pbusernogroup00000000000000include(qtversioncheck.pri) include(common-vars.pri) include(docs/docs.pri) TEMPLATE = subdirs SUBDIRS += modules/qt-friends.pro DISTNAME = $${PROJECT_NAME}-$${PROJECT_VERSION} EXCLUDES = \ --exclude-vcs \ --exclude-from .bzrignore \ --exclude=debian \ --exclude=$${DISTNAME}.tar.bz2 dist.commands = "tar -cvjf $${DISTNAME}.tar.bz2 $$EXCLUDES --transform='s,^,$$DISTNAME/,' *" dist.depends = distclean QMAKE_EXTRA_TARGETS += dist SUBDIRS += \ tests