<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[2263] 2013/b0unc3/trunk: </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://gsoc.trac.wordpress.org/changeset/2263">2263</a></dd>
<dt>Author</dt> <dd>b0unc3</dd>
<dt>Date</dt> <dd>2013-09-06 17:57:30 +0000 (Fri, 06 Sep 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre></pre>
<h3>Added Paths</h3>
<ul>
<li><a href="#2013b0unc3trunkMakefile">2013/b0unc3/trunk/Makefile</a></li>
<li>2013/b0unc3/trunk/assets/</li>
<li><a href="#2013b0unc3trunkassetsassetsindex">2013/b0unc3/trunk/assets/.assets.index</a></li>
<li><a href="#2013b0unc3trunkassetsBlogsSelectionDialogqml">2013/b0unc3/trunk/assets/BlogsSelectionDialog.qml</a></li>
<li><a href="#2013b0unc3trunkassetsCustomDialogCategoriesqml">2013/b0unc3/trunk/assets/CustomDialogCategories.qml</a></li>
<li><a href="#2013b0unc3trunkassetsLoginqml">2013/b0unc3/trunk/assets/Login.qml</a></li>
<li><a href="#2013b0unc3trunkassetsblogslistqml">2013/b0unc3/trunk/assets/blogslist.qml</a></li>
<li><a href="#2013b0unc3trunkassetscommentslistqml">2013/b0unc3/trunk/assets/commentslist.qml</a></li>
<li>2013/b0unc3/trunk/assets/images/</li>
<li><a href="#2013b0unc3trunkassetsimagesaddpng">2013/b0unc3/trunk/assets/images/add.png</a></li>
<li><a href="#2013b0unc3trunkassetsimagesaddimagepng">2013/b0unc3/trunk/assets/images/addimage.png</a></li>
<li><a href="#2013b0unc3trunkassetsimageseditpng">2013/b0unc3/trunk/assets/images/edit.png</a></li>
<li><a href="#2013b0unc3trunkassetsimagespostspng">2013/b0unc3/trunk/assets/images/posts.png</a></li>
<li><a href="#2013b0unc3trunkassetsimagesrefreshpng">2013/b0unc3/trunk/assets/images/refresh.png</a></li>
<li><a href="#2013b0unc3trunkassetsimagessavepng">2013/b0unc3/trunk/assets/images/save.png</a></li>
<li><a href="#2013b0unc3trunkassetsimageswplogopng">2013/b0unc3/trunk/assets/images/wplogo.png</a></li>
<li><a href="#2013b0unc3trunkassetsmainqml">2013/b0unc3/trunk/assets/main.qml</a></li>
<li><a href="#2013b0unc3trunkassetsmakePostqml">2013/b0unc3/trunk/assets/makePost.qml</a></li>
<li><a href="#2013b0unc3trunkassetspageslistqml">2013/b0unc3/trunk/assets/pageslist.qml</a></li>
<li><a href="#2013b0unc3trunkassetsshowPostqml">2013/b0unc3/trunk/assets/showPost.qml</a></li>
<li><a href="#2013b0unc3trunkbardescriptorxml">2013/b0unc3/trunk/bar-descriptor.xml</a></li>
<li><a href="#2013b0unc3trunkconfigpri">2013/b0unc3/trunk/config.pri</a></li>
<li><a href="#2013b0unc3trunkiconpng">2013/b0unc3/trunk/icon.png</a></li>
<li><a href="#2013b0unc3trunkprecompiledh">2013/b0unc3/trunk/precompiled.h</a></li>
<li>2013/b0unc3/trunk/src/</li>
<li><a href="#2013b0unc3trunksrcWPUtilscpp">2013/b0unc3/trunk/src/WPUtils.cpp</a></li>
<li><a href="#2013b0unc3trunksrcWPUtilsh">2013/b0unc3/trunk/src/WPUtils.h</a></li>
<li><a href="#2013b0unc3trunksrcapplicationuicpp">2013/b0unc3/trunk/src/applicationui.cpp</a></li>
<li><a href="#2013b0unc3trunksrcapplicationuihpp">2013/b0unc3/trunk/src/applicationui.hpp</a></li>
<li><a href="#2013b0unc3trunksrcmaincpp">2013/b0unc3/trunk/src/main.cpp</a></li>
<li><a href="#2013b0unc3trunktestxml">2013/b0unc3/trunk/test.xml</a></li>
<li>2013/b0unc3/trunk/translations/</li>
<li><a href="#2013b0unc3trunktranslationsMakefile">2013/b0unc3/trunk/translations/Makefile</a></li>
<li><a href="#2013b0unc3trunktranslationswp_bb10pro">2013/b0unc3/trunk/translations/wp_bb10.pro</a></li>
<li><a href="#2013b0unc3trunktranslationswp_bb10ts">2013/b0unc3/trunk/translations/wp_bb10.ts</a></li>
<li><a href="#2013b0unc3trunkwp_bb10bar">2013/b0unc3/trunk/wp_bb10.bar</a></li>
<li><a href="#2013b0unc3trunkwp_bb10pro">2013/b0unc3/trunk/wp_bb10.pro</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="2013b0unc3trunkMakefile"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/Makefile (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/Makefile (rev 0)
+++ 2013/b0unc3/trunk/Makefile 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+QMAKE_TARGET = wp_bb10
+PROJECT_DIR := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
+I18N_DIR := $(PROJECT_DIR)/translations
+
+include mk/cs-base.mk
+
</ins></span></pre></div>
<a id="2013b0unc3trunkassetsassetsindex"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/.assets.index (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/.assets.index (rev 0)
+++ 2013/b0unc3/trunk/assets/.assets.index 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+1
+19
+pageslist.qml
+blogslist.qml
+BlogsSelectionDialog.qml
+.pageslist.qml.swp
+CustomDialogCategories.qml
+commentslist.qml
+showPost.qml
+makePost.qml
+images/wplogo.png
+images/add.png
+images/refresh.png
+images/save.png
+images/edit.png
+images/addimage.png
+images/posts.png
+main.qml
+Login.qml
+wplogo.png
+posts.png
</ins></span></pre></div>
<a id="2013b0unc3trunkassetsBlogsSelectionDialogqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/BlogsSelectionDialog.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/BlogsSelectionDialog.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/BlogsSelectionDialog.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+import bb.cascades 1.0
+
+Dialog {
+ id: bsd
+
+ function getRegisteredBlogs()
+ {
+ var val = wpu.getBI();
+ for (var event in val) {
+ var dataCopy = val[event]
+
+ for (var key in dataCopy) {
+ //console.log("dataCopy[key] = " + dataCopy[key]);
+ }
+ console.log("event = " + event);
+
+ //if (event == "name") {
+ // console.log("add name " + cats[event]);
+ var option = optionControlDefinition.createObject();
+ option.value = event;
+ option.text = val[event];
+ bdd.add(option);
+ //}
+ }
+ }
+ /*
+ function onDataReady(val)
+ {
+ console.log("bsd val = " + val)
+ for (var event in val) {
+ var dataCopy = val[event]
+
+ for (var key in dataCopy) {
+ //console.log("dataCopy[key] = " + dataCopy[key]);
+ }
+ console.log("event = " + event);
+
+ //if (event == "name") {
+ // console.log("add name " + cats[event]);
+ // var option = optionControlDefinition.createObject();
+ console.log("adding = " + val[event]);
+ //dropDown.add(option)
+ //}
+ }
+ }*/
+
+ attachedObjects: [
+ ComponentDefinition {
+ id: optionControlDefinition
+ Option {
+ }
+ }
+ ]
+
+ Container {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ background: Color.create(0.0, 0.0, 0.0, 0.5)
+
+ layout: StackLayout {
+ }
+
+ DropDown {
+ id: bdd
+ }
+
+ Divider {
+
+ }
+ Button {
+ horizontalAlignment: HorizontalAlignment.Center
+ text: qsTr("Done")
+ onClicked: {
+ bsdo.close();
+ }
+ }
+ }
+
+ onOpened: {
+ console.log("fetching info, cause it's opened now");
+ console.log("BI = " + wpu.getBI());
+ getRegisteredBlogs();
+ //wpu.getBlogsInfo();
+ //wpu.dataReady.connect(bsd.onDataReady);
+ }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013b0unc3trunkassetsCustomDialogCategoriesqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/CustomDialogCategories.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/CustomDialogCategories.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/CustomDialogCategories.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,68 @@
</span><ins>+import bb.cascades 1.0
+
+Dialog {
+ id: cdcp
+
+ property variant cats;
+
+ function onDataReady(val)
+ {
+ cats = wpu.getRes();
+ /* not work? */
+ for (var event in cats) {
+ var dataCopy = cats[event]
+
+ for (var key in dataCopy) {
+ //console.log("dataCopy[key] = " + dataCopy[key]);
+ }
+ // console.log("event = " + event);
+ if ( event == "name" ) {
+ // console.log("add name " + cats[event]);
+ var option = optionControlDefinition.createObject();
+ option.text = cats[event]
+ dropDown.add(option)
+ }
+ }
+
+ cdcind.stop();
+ }
+
+ attachedObjects: [
+ ComponentDefinition {
+ id: optionControlDefinition
+ Option {
+ }
+ }
+ ]
+
+ Container {
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ background: Color.create(0.0, 0.0, 0.0, 0.5)
+
+ layout: StackLayout {}
+
+ DropDown {
+ Option {
+ text: cats.name //<--?
+ }
+ }
+
+ Divider {
+
+ }
+ Button {
+ horizontalAlignment: HorizontalAlignment.Center
+ text: qsTr("Done");
+ onClicked: {
+ customdialogcat.close();
+ }
+ }
+ }
+
+ onCreationCompleted: {
+ wpu.getCategories();
+ wpu.dataReady.connect(cdcp.onDataReady);
+ }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013b0unc3trunkassetsLoginqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/Login.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/Login.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/Login.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,146 @@
</span><ins>+import bb.cascades 1.0
+import bb.system 1.0
+
+Page {
+ id: lp
+
+ actionBarVisibility: ChromeVisibility.Hidden
+
+ attachedObjects: [
+ ComponentDefinition {
+ id: pageDefinition
+ source: "blogslist.qml"
+ },
+ SystemToast {
+ id: myQmlToast
+ body: "Unable to register account\nPlease try again."
+ button.label: "Ok"
+ button.enabled: true
+ }
+
+ ]
+
+ function onDataReady(val) {
+ var a = wpu.getRes();
+
+ if (a["ERROR"]) {
+ myQmlToast.show();
+ usr.text = '';
+ pwd.text = '';
+ blgd.text = '';
+ myIndicator.stop();
+ // wpu.resetRes();
+ } else {
+ wpu.setUsername(usr.text);
+ wpu.setPassword(pwd.text);
+
+ var newPage = pageDefinition.createObject();
+ newPage.bl_xml = val;
+
+ myIndicator.stop();
+ navigationPane.push(newPage);
+ }
+
+ }
+
+ Container {
+ layout: DockLayout { }
+
+
+ ActivityIndicator {
+ id: myIndicator
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ preferredHeight: 500
+ preferredWidth: 500
+ }
+
+ Container {
+ layout: StackLayout {
+ }
+
+ Container {
+ verticalAlignment: VerticalAlignment.Top
+ horizontalAlignment: HorizontalAlignment.Center
+ layout: DockLayout {
+ }
+
+ //header - logo
+ ImageView {
+
+ imageSource: "asset:///wplogo.png"
+ }
+ }
+ Container {
+ verticalAlignment: VerticalAlignment.Center
+ horizontalAlignment: HorizontalAlignment.Center
+ layout: StackLayout {
+ }
+
+ topPadding: 50
+ leftPadding: 50
+ rightPadding: 50
+ bottomPadding: 50
+
+ Label {
+ text: "Username"
+ }
+
+ TextField {
+ id: usr
+ clearButtonVisible: true
+ hintText: "username"
+ }
+
+ Label {
+ topMargin: 50
+ text: "Password"
+ }
+
+ TextField {
+ id: pwd
+ inputMode: TextFieldInputMode.Password
+
+ hintText: "YouRpAsSwOrD"
+ }
+
+ Label {
+ topMargin: 50
+ text: "Blog Address"
+ }
+
+ TextField {
+ id: blgd
+
+ hintText: "leave empty if unsure"
+
+ }
+ }
+ Container {
+ verticalAlignment: VerticalAlignment.Bottom
+ horizontalAlignment: HorizontalAlignment.Center
+ layout: StackLayout {
+ }
+
+ topPadding: 50
+ //bottomPadding: 25//50
+ Button {
+ text: "Sign In"
+
+ onClicked: {
+ if (usr.text && pwd.text) {
+ myIndicator.start();
+ wpu.getBlogs(usr.text, pwd.text, blgd.text);
+ wpu.dataReady.connect(lp.onDataReady);
+ } else {; /*** TODO ***/
+ }
+ }
+
+ }
+ }
+ }
+ }
+}
+
+
</ins></span></pre></div>
<a id="2013b0unc3trunkassetsblogslistqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/blogslist.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/blogslist.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/blogslist.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,134 @@
</span><ins>+import bb.cascades 1.0
+import bb.data 1.0
+import bb.system 1.0
+
+Page {
+ id: blp
+
+ // actionBarVisibility: ChromeVisibility.Hidden
+
+
+ property string blogid: ""
+ property string blogurl: ""
+
+ property string mystr;
+ property alias bl_xml: blp.mystr
+
+ actions: [
+ MultiSelectActionItem {
+ id: msa
+ multiSelectHandler: listView.multiSelectHandler
+ title: "select blog(s)"
+ //listV.multiSelectHandler
+ onTriggered: {
+ console.log("MSA got ttriggered now.");
+
+ }
+ }
+ ]
+
+ attachedObjects: [
+ SystemToast {
+ id: myQmlToast
+ body: "Unable to register account\nPlease try again."
+ button.label: "Ok"
+ button.enabled: true
+ }
+
+ ]
+
+ function moveOn()
+ {
+ navigationPane.pop();
+ }
+
+ onMystrChanged: {
+ listView.setDataModel(wpu.setModel(mystr));
+ }
+
+ content: Container {
+ layout: DockLayout {}
+
+ ListView {
+ id: listView
+ multiSelectAction: MultiSelectActionItem { onTriggered: {
+ console.log("---------------------msa in listview triggered");
+ }}
+
+ multiSelectHandler {
+ // active: true
+ status: qsTr("None selected");
+ actions: [
+ ActionItem {
+ title: "add selected"
+ imageSource: "asset:///images/add.png"
+
+ onTriggered: {
+ if (enabled) {
+ var selectionList = listView.selectionList();
+ console.log("selectionlist = " + selectionList);
+ for (var i = 0; i < selectionList.length; i ++) {
+ console.log("looking at = " + selectionList[i]);
+ var selectedItem = listView.dataModel.data(selectionList[i]);
+ console.log("item = " + selectedItem.blogid);
+ wpu.setBlogsInfo(selectedItem.blogid, selectedItem.xmlrpc);
+ moveOn();
+ }
+
+ }
+ }
+ }
+ ]
+ }
+
+ onSelectionChanged: {
+ if (selectionList().length > 1) {
+ multiSelectHandler.status = selectionList().length + " items selected";
+ } else if (selectionList().length == 1) {
+ multiSelectHandler.status = "1 item selected";
+ } else {
+ multiSelectHandler.status = "None selected";
+ }
+ }
+
+ listItemComponents: [
+ ListItemComponent {
+ type: "item"
+ StandardListItem {
+ id: bitem
+ imageSpaceReserved: false
+ textFormat: TextFormat.Html
+ title: ListItemData.blogName
+ description: ListItemData.url
+
+ } // end of second ListItemComponent
+ } // end standardlistitem
+ ] // end of listItemComponents list
+
+
+ onTriggered: {
+ var selectedItem = listView.dataModel.data(indexPath);
+ blogid = selectedItem.blogid;
+ blogurl = selectedItem.xmlrpc;
+ }
+ } // end of ListView
+ /*
+ Button {
+ bottomMargin: 50
+ verticalAlignment: VerticalAlignment.Bottom
+ horizontalAlignment: HorizontalAlignment.Center
+ text: "Done"
+ onClicked: {
+ if ( blogid && blogurl )
+ {
+ wpu.setBlogsInfo(blogid, blogurl);
+ );
+ }
+ }
+ }*/
+ } // end of Container
+ onCreationCompleted: {
+ msa.triggered();
+ }
+
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013b0unc3trunkassetscommentslistqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/commentslist.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/commentslist.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/commentslist.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+import bb.cascades 1.0
+
+Page {
+ id: cp
+
+ property string mystr
+ property alias bl_xml: cp.mystr
+
+ function onDataReady(val) {
+ console.log("val = " + val);
+ var a = wpu.getRes();
+
+ if (a["ERROR"]) {
+ //myQmlToast.show(); <- TBD
+ console.log("ERRORE");
+ // wpu.resetRes();
+ } else {
+ bl_xml = val;
+ clind.stop();
+ }
+
+ }
+
+ onMystrChanged: {
+ clListView.setDataModel(wpu.setModel(mystr));
+ }
+
+ titleBar: TitleBar {
+ title: "Comments"
+ }
+
+ actions: [
+ ActionItem {
+ title: "New"
+ imageSource: "asset:///images/add.png"
+ ActionBar.placement: ActionBarPlacement.InOverflow
+
+ },
+ ActionItem {
+ title: "Refresh"
+ imageSource: "asset:///images/refresh.png"
+
+ ActionBar.placement: ActionBarPlacement.InOverflow
+ }
+ ]
+
+ content: Container {
+ layout: DockLayout {
+ }
+
+ ActivityIndicator {
+ id: clind
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ preferredHeight: 500
+ preferredWidth: 500
+
+ running: true
+ }
+
+ Container {
+ layout: StackLayout {
+ }
+
+ ListView {
+ id: clListView
+
+ listItemComponents: [
+ ListItemComponent {
+ type: "item"
+ id: listItemContainer
+
+ StandardListItem {
+
+ function getStatus(s)
+ {
+ if ( s == "approve" )
+ return "<html><p style='color: green;'>" + s + "</p></html>";
+ else if ( s == "hold" )
+ return "<html><p style='color: orange;'>" + s + "</p></html>";
+ else return s;
+
+ }
+
+ textFormat: TextFormat.Html
+ title: ListItemData.content
+ description: ListItemData.author
+ status: getStatus(ListItemData.status) // + "\n" + ListItemData.date_created_gmt
+ imageSpaceReserved: false
+
+ contextActions: [
+ ActionSet {
+ title: "Test"
+ ActionItem {
+ title: "Edit"
+ onTriggered: {
+
+ //console.log("edit post id = " + ListItemData.post_id);
+ }
+ }
+ DeleteActionItem {
+ title: "Delete"
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ onTriggered: {
+ var selectedItem = clListView.dataModel.data(indexPath);
+ }
+ } // end of clListView
+ }
+ }
+
+ onCreationCompleted: {
+ wpu.getComments();
+ wpu.dataReady.connect(cp.onDataReady);
+ }
+}
</ins></span></pre></div>
<a id="2013b0unc3trunkassetsimagesaddpng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/add.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/add.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/add.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/add.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/add.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsimagesaddimagepng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/addimage.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/addimage.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/addimage.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/addimage.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/addimage.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsimageseditpng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/edit.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/edit.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/edit.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/edit.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/edit.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsimagespostspng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/posts.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/posts.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/posts.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/posts.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/posts.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsimagesrefreshpng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/refresh.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/refresh.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/refresh.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/refresh.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/refresh.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsimagessavepng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/save.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/save.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/save.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/save.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/save.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsimageswplogopng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/assets/images/wplogo.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/assets/images/wplogo.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/assets/images/wplogo.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/assets/images/wplogo.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/assets/images/wplogo.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkassetsmainqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/main.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/main.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/main.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,315 @@
</span><ins>+import bb.cascades 1.0
+import bb.system 1.0
+
+TabbedPane {
+ id: tabbedPane
+ showTabsOnActionBar: false
+ peekEnabled: false
+
+ Menu.definition: MenuDefinition {
+ actions: [
+ ActionItem {
+ title: qsTr("Change blog");
+ enabled: wpu.blogsInfo();
+
+ onTriggered: {
+ console.log("wpu blogsinfo = " + wpu.blogsInfo());
+ console.log("opeening bsdo");
+ bsdo.open();
+ }
+ }
+ ]
+
+ }
+ attachedObjects: [
+ BlogsSelectionDialog {
+ id: bsdo
+ },
+ ComponentDefinition {
+ id: loginPage
+ source: "Login.qml"
+ },
+ ComponentDefinition {
+ id: blogsList
+ source: "blogslist.qml"
+ },
+ ComponentDefinition {
+ id: commentsList
+ source: "commentslist.qml"
+ },
+ ComponentDefinition {
+ id: pagesList
+ source: "pageslist.qml"
+ }
+ ]
+ Tab {
+ id: loginregisterTab
+ NavigationPane {
+ id: navigationPane
+ peekEnabled: false
+ backButtonsVisible: false
+
+ onCreationCompleted: {
+ var page = loginPage.createObject();
+ navigationPane.push(page);
+ }
+
+ onPopTransitionEnded: {
+ page.destroy();
+ plp.loadData();
+
+ tabbedPane.activeTab = postTab;
+
+ tabbedPane.remove(loginregisterTab);
+ tabbedPane.showTabsOnActionBar = false;
+ tabbedPane.peekEnabled = true;
+
+ }
+ }
+ }
+ Tab {
+ id: postTab
+ title: qsTr("Posts")
+
+ NavigationPane {
+ id: navpostpane
+
+ Page {
+ id: plp
+
+ property string t: "ciao"
+
+ property string mystr
+ property alias bl_xml: plp.mystr
+
+ function loadData() {
+ if ( plListView.dataModel )
+ plListView.dataModel.clear();
+
+ plind.start();
+ console.log("*()*(*)(*)(*)*(*)*()*(*)*(*)*))))))))-->here we are");
+ wpu.getPosts();
+ wpu.dataReady.connect(plp.onDataReady);
+ }
+
+ function onDataReady(val) {
+ var a = wpu.getRes();
+
+ if (a["ERROR"]) {
+ //myQmlToast.show();
+ console.log("ERRORE");
+ // wpu.resetRes();
+ } else if ( a["delpost"] ){
+ console.log("del post = " + a["delpost"]);
+ if ( a["delpost"] == 1 )
+ {
+ console.log("delete ok");
+ delprog.cancel();
+ deldialog.cancel();
+ } else console.log("delete fail");
+
+ } else {
+ bl_xml = val;
+ plind.stop();
+ }
+
+ }
+
+
+
+ onMystrChanged: {
+ plListView.setDataModel(wpu.setModel(mystr));
+ }
+
+ titleBar: TitleBar {
+ title: "Posts"
+ }
+
+
+ attachedObjects: [
+ ComponentDefinition {
+ id: showPost
+ source: "showPost.qml"
+ },
+ ComponentDefinition {
+ id: makePost
+ source: "makePost.qml"
+ },
+ SystemProgressToast {
+ id: delprog
+ progress: -1
+ body: qsTr("Deleting post, please wait")
+ },
+ SystemDialog {
+ property string ptitle
+ property string pid
+ id: delDialog
+ title: qsTr("DELETE POST")
+ body: qsTr("Are you to delete post = " + ptitle + " id = " + pid)
+ confirmButton.label: qsTr("Okay")
+ confirmButton.enabled: true
+ cancelButton.label: qsTr("Cancel")
+ cancelButton.enabled: true
+ onFinished: {
+ // console.log("test t = " + plp.t);
+ var x = result;
+ console.log(delDialog.error);
+ if (x == SystemUiResult.ConfirmButtonSelection) {
+ delprog.exec();
+ wpu.deletePost(pid);
+ console.log("confirm");
+ } else if (x == SystemUiResult.CancelButtonSelection) {
+ console.log("cancel");
+ }
+ }
+ }
+ ]
+
+ actions: [
+ ActionItem {
+ title: "New"
+ imageSource: "asset:///images/add.png"
+ ActionBar.placement: ActionBarPlacement.InOverflow
+
+ onTriggered: {
+ var newPage = makePost.createObject();
+ navpostpane.push(newPage);
+ }
+ },
+ ActionItem {
+ title: "Refresh"
+ imageSource: "asset:///images/refresh.png"
+
+ ActionBar.placement: ActionBarPlacement.InOverflow
+
+ onTriggered: {
+ plp.loadData();
+ }
+ }
+ ]
+
+ content: Container {
+ layout: DockLayout {
+ }
+
+ ActivityIndicator {
+ id: plind
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ preferredHeight: 500
+ preferredWidth: 500
+
+ running: true
+ }
+
+ Container {
+ layout: StackLayout { }
+
+ ListView {
+ id: plListView
+
+ listItemComponents: [
+ ListItemComponent {
+ type: "item"
+ id: listItemContainer
+
+ StandardListItem {
+ id: sli;
+ property variant internalWpu;
+ textFormat: TextFormat.Html
+ title: ListItemData.post_title
+ description: ListItemData.post_date
+ status: ListItemData.post_status
+ imageSpaceReserved: false
+
+ contextActions: [
+ ActionSet {
+ title: "Test"
+ ActionItem {
+ title: "Edit"
+ imageSource: "asset:///images/edit.png"
+ onTriggered: {
+
+ //console.log("edit post id = " + ListItemData.post_id);
+ }
+ }
+ DeleteActionItem {
+ title: "Delete"
+ onTriggered: {
+ sli.ListItem.view.goToDel(ListItemData.post_id, ListItemData.post_title)
+ //console.log("got : " + navpostpane.t);
+ /*
+ delDialog.pid = ListItemData.post_id;
+ delDialog.ptitle = ListItemData.post_title;
+ delDialog.show();
+ */
+ //plp.goToDel();
+ }
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ function goToDel(id, title) {
+ console.log("%%%%% HERE I AM");
+ console.log("value t = " + plp.t);
+ delDialog.pid = id;
+ delDialog.ptitle = title;
+ delDialog.show();
+ }
+ onTriggered: {
+ var selectedItem = plListView.dataModel.data(indexPath);
+ var newPage = showPost.createObject();
+ // console.log("wrk post_id = " + selectedItem.post_id);
+ newPage.apostid = selectedItem.post_id;
+ navpostpane.push(newPage);
+ }
+ } // end of plListView
+
+ }
+
+ }
+
+ }
+
+ onCreationCompleted: {
+ sli.internalWpu = wpu;
+ console.log("wpu setted");
+ }
+
+ onPopTransitionEnded: {
+ page.destroy();
+ plp.loadData();
+ }
+ }
+
+
+ onTriggered: {
+ plp.loadData();
+ }
+ }
+
+ Tab {
+ id: commentsTab
+ title: qsTr("Comments")
+
+ onTriggered: {
+ var newPage = commentsList.createObject();
+ commentsTab.setContent(newPage);
+ tabbedPane.activeTab = commentsTab;
+ }
+ }
+ Tab {
+ id: pagesTab
+ title: qsTr("Pages")
+
+ onTriggered: {
+ var newPage = pagesList.createObject();
+ pagesTab.setContent(newPage);
+ tabbedPane.activeTab = pagesTab;
+ }
+ }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013b0unc3trunkassetsmakePostqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/makePost.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/makePost.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/makePost.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,179 @@
</span><ins>+import bb.cascades 1.0
+import bb.system 1.0
+import bb.cascades.pickers 1.0
+
+Page {
+ id: mpp
+
+ actionBarVisibility: ChromeVisibility.Visible
+
+ attachedObjects: [
+ CustomDialogCategories {
+ id: customdialogcat
+ /* not sure */
+ onOpened: {
+ customDialogPage.actionBarVisibility = ChromeVisibility.Hidden
+ }
+ onClosed: {
+ customDialogPage.actionBarVisibility = ChromeVisibility.Default
+ }
+ },
+ SystemProgressToast {
+ id: spt
+ progress: -1
+ body: qsTr("Creating the new post, please wait");
+ },
+ FilePicker {
+ id: filePicker
+ type: FileType.Picture
+ title: qsTr("Select Picture")
+ mode: FilePickerMode.Picker
+ //directories: [ "shared/camera/" ]
+ onFileSelected: {
+ console.log("FileSelected signal received : " + selectedFiles);
+ console.log(" [ 0 ] = " + selectedFiles[0]);
+
+
+ wpu.uploadFile(selectedFiles[0]);
+ wpu.dataReady.connect(mpp.onDataReady);
+ //make sure to prepend "file://" when using as a source for an ImageView or MediaPlayer
+ // myImageView.imageSource = "file://" + selectedFiles[0];
+
+ }
+ }
+ ]
+
+ actions: [
+ ActionItem {
+ title: "Save"
+ imageSource: "asset:///images/save.png"
+ ActionBar.placement: ActionBarPlacement.OnBar
+
+ onTriggered: {
+ spt.show();
+ wpu.makePost(posttitle.text, postcontent.text.trim(), posttype.selectedValue, posttags.text, poststatus.selectedValue);
+ wpu.dataReady.connect(mpp.onDataReady);
+ }
+ },
+ ActionItem {
+ title: qsTr("Add Image");
+ imageSource: "asset:///images/addimage.png"
+ ActionBar.placement: ActionBarPlacement.OnBar
+
+ onTriggered: {
+ filePicker.open();
+ }
+ }
+
+ ]
+
+ function onDataReady(val)
+ {
+ var a = wpu.getRes();
+
+// console.log("forse = " + a['newpostid']);
+ if ( a['newpostid'] )
+ {
+ navpostpane.pop();
+ spt.cancel();
+ // mpp.deleteLater();
+ } else if ( a['file'] )
+ {
+ console.log("filename upload = " + a['file']);
+ console.log("url = " + a['url']);
+// postcontent.editor.cursorPosition
+ //<img src="http://img62.imageshack.us/img62/538/jlz4.png" width="480" height="800" class="aligncenter" />
+ //<img src="http://bouncelab.files.wordpress.com/2013/09/wpid-img_00000055.jpg" alt="desc" />
+ postcontent.editor.insertPlainText("<img src=\"" + a['url'] + "\" alt=\"desc\" />"); // width=\"480\" height=\"800\" class=\"aligncenter\" />");
+ } else console.log("wrg : smtg wrong"); /* TODO */
+ }
+
+
+ titleBar: TitleBar {
+ title: qsTr("New Post");
+ }
+
+ content: Container {
+ layout: StackLayout { }
+
+ TextField {
+ horizontalAlignment: HorizontalAlignment.Fill
+ id: posttitle
+
+ hintText: qsTr("Post Title");
+ }
+
+ TextArea {
+ id: postcontent
+ editable: true
+ hintText: qsTr("Post Content");
+
+ minHeight: 150
+ preferredHeight: 400
+ }
+
+ TextField {
+ horizontalAlignment: HorizontalAlignment.Fill
+ id: posttags
+ hintText: qsTr("Post tags (Separate tags with commas)");
+ }
+
+ Divider {
+
+ }
+
+ Button {
+ text: qsTr("Categories")
+
+ onClicked: {
+ customdialogcat.open();
+ }
+ }
+
+ DropDown {
+ id: poststatus
+ title: qsTr("Status");
+ Option {
+ text: qsTr("Public");
+ value: "public"
+ selected: true
+ }
+ Option {
+ text: qsTr("Private");
+ value: "private"
+ }
+ }
+
+ DropDown {
+ id: posttype
+ title: qsTr("Format");
+
+ Option {
+ text: qsTr("Standard");
+ value: "post"
+ selected: true
+ }
+ Option {
+ text: qsTr("Aside");
+ value: "aside"
+ }
+ Option {
+ text: qsTr("Image");
+ value: "image"
+ }
+ Option {
+ text: qsTr("Video");
+ value: "video"
+ }
+ Option {
+ text: qsTr("Quote");
+ value: "quote"
+ }
+ Option {
+ text: qsTr("Link");
+ value: "link"
+ }
+ }
+
+ }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="2013b0unc3trunkassetspageslistqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/pageslist.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/pageslist.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/pageslist.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,110 @@
</span><ins>+import bb.cascades 1.0
+
+Page {
+ id: plp
+
+ property string mystr
+ property alias bl_xml: plp.mystr
+
+ function onDataReady(val) {
+ var a = wpu.getRes();
+
+ if (a["ERROR"]) {
+ // myQmlToast.show();
+ console.log("ERRORE");
+ // wpu.resetRes();
+ } else {
+ bl_xml = val;
+ pslind.stop();
+ }
+
+ }
+
+ onMystrChanged: {
+ pListView.setDataModel(wpu.setModel(mystr));
+ }
+
+ titleBar: TitleBar {
+ title: "Pages"
+ }
+
+ actions: [
+ ActionItem {
+ title: "New"
+ imageSource: "asset:///images/add.png"
+ ActionBar.placement: ActionBarPlacement.InOverflow
+
+ },
+ ActionItem {
+ title: "Refresh"
+ imageSource: "asset:///images/refresh.png"
+
+ ActionBar.placement: ActionBarPlacement.InOverflow
+ }
+ ]
+
+ content: Container {
+ layout: DockLayout {
+ }
+
+ ActivityIndicator {
+ id: pslind
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ preferredHeight: 500
+ preferredWidth: 500
+
+ running: true
+ }
+
+ Container {
+ layout: StackLayout {
+ }
+
+ ListView {
+ id: pListView
+
+ listItemComponents: [
+ ListItemComponent {
+ type: "item"
+ id: listItemContainer
+
+ StandardListItem {
+ textFormat: TextFormat.Html
+ title: ListItemData.title
+ description: ListItemData.wp_author
+ status: ListItemData.page_status
+ imageSpaceReserved: false
+
+ contextActions: [
+ ActionSet {
+ title: "Test"
+ ActionItem {
+ title: "Edit"
+ onTriggered: {
+
+ //console.log("edit post id = " + ListItemData.post_id);
+ }
+ }
+ DeleteActionItem {
+ title: "Delete"
+
+ }
+ }
+ ]
+ }
+ }
+ ]
+ onTriggered: {
+ var selectedItem = pListView.dataModel.data(indexPath);
+ }
+ } // end of pListView
+ }
+ }
+
+ onCreationCompleted: {
+ wpu.getPages();
+ wpu.dataReady.connect(plp.onDataReady);
+ }
+}
</ins></span></pre></div>
<a id="2013b0unc3trunkassetsshowPostqml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/assets/showPost.qml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/assets/showPost.qml (rev 0)
+++ 2013/b0unc3/trunk/assets/showPost.qml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+import bb.cascades 1.0
+
+Page {
+
+ id: sp
+
+ property string postid
+ property alias apostid: sp.postid
+ property variant myObj
+
+ onPostidChanged: {
+ //console.log("postid changed" + sp.postid);
+ wpu.getPost(sp.postid);
+ wpu.dataReady.connect(sp.onDataReady);
+ }
+
+ function onDataReady(val) {
+ //aspe`
+ myObj = wpu.getRes();
+ console.log("myObj contains " + myObj);
+ for (var event in myObj) {
+ var dataCopy = myObj[event]
+ }
+ // console.log("going to set title = " + myObj["post_title"]);
+ spind.stop();
+ }
+
+ actionBarVisibility: ChromeVisibility.Visible
+
+
+
+ titleBar: TitleBar {
+ title: "Post : " + myObj.post_title
+ }
+ content: Container {
+ layout: DockLayout { }
+
+ ActivityIndicator {
+ id: spind
+ horizontalAlignment: HorizontalAlignment.Center
+ verticalAlignment: VerticalAlignment.Center
+
+ preferredHeight: 500
+ preferredWidth: 500
+
+ running: true
+ }
+
+ Container {
+ layout: StackLayout { }
+
+ ScrollView {
+ id: scrollView
+ scrollViewProperties {
+ scrollMode: ScrollMode.Both
+ pinchToZoomEnabled: true
+ maxContentScale: 5
+ minContentScale: 1
+ }
+
+ layoutProperties: StackLayoutProperties {
+ spaceQuota: 1.0
+ }
+
+ Container {
+ background: Color.LightGray
+
+ /* alternative?!?!? */
+ WebView {
+ id: webView
+ html: "<html><p style=\"font-family: 'Verdena'; font-size: 55px;\">" + myObj.post_content + "</p></html>"
+
+
+ onMinContentScaleChanged: {
+ scrollView.scrollViewProperties.minContentScale = minContentScale;
+ }
+
+ onMaxContentScaleChanged: {
+ scrollView.scrollViewProperties.maxContentScale = maxContentScale;
+ }
+ } // end WebView
+ } // end container
+ } // end ScrollView
+
+ }
+ }
+}
</ins></span></pre></div>
<a id="2013b0unc3trunkbardescriptorxml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/bar-descriptor.xml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/bar-descriptor.xml (rev 0)
+++ 2013/b0unc3/trunk/bar-descriptor.xml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,111 @@
</span><ins>+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!--
+
+ Copyright (c) 2011, 2012, 2013 Research In Motion Limited.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
+
+<!-- BlackBerry Tablet OS application descriptor file.
+
+ Specifies parameters for identifying, installing, and launching native applications on BlackBerry Tablet OS.
+
+-->
+
+ <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
+ Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+ <id>com.example.wp_bb10</id>
+
+ <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <name>wp_bb10</name>
+
+ <!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
+ Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+ An updated version of application must have a versionNumber value higher than the previous version. Required. -->
+ <versionNumber>1.0.0</versionNumber>
+
+ <!-- Fourth digit segment of the package version. First three segments are taken from the
+ <versionNumber> element. Must be an integer from 0 to 2^16-1 -->
+ <buildId>1</buildId>
+
+ <!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+ <!-- <versionLabel></versionLabel> -->
+
+ <!-- Description, displayed in the BlackBerry Tablet OS application installer.
+ May have multiple values for each language. See samples or xsd schema file. Optional. -->
+ <description>The wp_bb10 application</description>
+
+ <!-- Copyright information. Optional. -->
+ <!-- <copyright></copyright> -->
+
+ <!-- Name of author which is used for signing. Must match the developer name of your development certificate. -->
+ <author>Example Inc.</author>
+
+ <!-- Unique author ID assigned by signing authority. Required if using debug tokens. -->
+ <!-- <authorId>ABC1234YjsnUk235h</authorId> -->
+
+ <initialWindow>
+ <autoOrients>true</autoOrients>
+ <systemChrome>none</systemChrome>
+ <transparent>false</transparent>
+ </initialWindow>
+
+ <!-- The category where the application appears. Either core.games or core.media. -->
+ <category>core.games</category>
+ <configuration name="Device-Debug">
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm/o.le-v7-g/wp_bb10" entry="true" type="Qnx/Elf">wp_bb10</asset>
+ </configuration>
+ <configuration name="Device-Release">
+ <entryPointType>Qnx/Cascades</entryPointType>
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm/o.le-v7/wp_bb10.so" entry="true" type="Qnx/Elf">wp_bb10.so</asset>
+ </configuration>
+ <configuration name="Device-Profile">
+ <platformArchitecture>armle-v7</platformArchitecture>
+ <asset path="arm-p/o.le-v7-g/wp_bb10" entry="true" type="Qnx/Elf">wp_bb10</asset>
+ </configuration>
+ <configuration name="Simulator-Debug">
+ <platformArchitecture>x86</platformArchitecture>
+ <asset path="x86/o-g/wp_bb10" entry="true" type="Qnx/Elf">wp_bb10</asset>
+ </configuration>
+
+ <!-- The icon for the application -->
+ <icon>
+ <image>icon.png</image>
+ </icon>
+
+ <asset path="icon.png">icon.png</asset>
+ <asset path="assets">assets</asset>
+
+ <!-- Locale support -->
+ <asset path="translations" dest="qm">
+ <include name="*.qm"/>
+ </asset>
+
+
+ <asset path="assets/images/wplogo.png">assets/wplogo.png</asset>
+ <!-- <asset path="assets/images/rotate.png">assets/refresh.png</asset> -->
+ <asset path="assets/images/posts.png">assets/posts.png</asset>
+
+ <!-- Request permission to execute native code. Required for native applications. -->
+ <permission system="true">run_native</permission>
+ <permission>access_shared</permission>
+ <permission>access_internet</permission>
+ <permission>use_camera</permission>
+ <env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
+
+</qnx>
</ins></span></pre></div>
<a id="2013b0unc3trunkconfigpri"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/config.pri (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/config.pri (rev 0)
+++ 2013/b0unc3/trunk/config.pri 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+# Auto-generated by IDE. Any changes made by user will be lost!
+BASEDIR = $$quote($$_PRO_FILE_PWD_)
+
+device {
+ CONFIG(debug, debug|release) {
+ SOURCES += $$quote($$BASEDIR/src/WPUtils.cpp) \
+ $$quote($$BASEDIR/src/applicationui.cpp) \
+ $$quote($$BASEDIR/src/main.cpp)
+
+ HEADERS += $$quote($$BASEDIR/src/WPUtils.h) \
+ $$quote($$BASEDIR/src/applicationui.hpp)
+ }
+
+ CONFIG(release, debug|release) {
+ SOURCES += $$quote($$BASEDIR/src/WPUtils.cpp) \
+ $$quote($$BASEDIR/src/applicationui.cpp) \
+ $$quote($$BASEDIR/src/main.cpp)
+
+ HEADERS += $$quote($$BASEDIR/src/WPUtils.h) \
+ $$quote($$BASEDIR/src/applicationui.hpp)
+ }
+}
+
+simulator {
+ CONFIG(debug, debug|release) {
+ SOURCES += $$quote($$BASEDIR/src/WPUtils.cpp) \
+ $$quote($$BASEDIR/src/applicationui.cpp) \
+ $$quote($$BASEDIR/src/main.cpp)
+
+ HEADERS += $$quote($$BASEDIR/src/WPUtils.h) \
+ $$quote($$BASEDIR/src/applicationui.hpp)
+ }
+}
+
+INCLUDEPATH += $$quote($$BASEDIR/src)
+
+CONFIG += precompile_header
+
+PRECOMPILED_HEADER = $$quote($$BASEDIR/precompiled.h)
+
+lupdate_inclusion {
+ SOURCES += $$quote($$BASEDIR/../src/*.c) \
+ $$quote($$BASEDIR/../src/*.c++) \
+ $$quote($$BASEDIR/../src/*.cc) \
+ $$quote($$BASEDIR/../src/*.cpp) \
+ $$quote($$BASEDIR/../src/*.cxx) \
+ $$quote($$BASEDIR/../assets/*.qml) \
+ $$quote($$BASEDIR/../assets/*.js) \
+ $$quote($$BASEDIR/../assets/*.qs)
+
+ HEADERS += $$quote($$BASEDIR/../src/*.h) \
+ $$quote($$BASEDIR/../src/*.h++) \
+ $$quote($$BASEDIR/../src/*.hh) \
+ $$quote($$BASEDIR/../src/*.hpp) \
+ $$quote($$BASEDIR/../src/*.hxx)
+}
+
+TRANSLATIONS = $$quote($${TARGET}.ts)
</ins></span></pre></div>
<a id="2013b0unc3trunkiconpng"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/icon.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/icon.png
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/icon.png 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/icon.png 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/icon.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkprecompiledh"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/precompiled.h (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/precompiled.h (rev 0)
+++ 2013/b0unc3/trunk/precompiled.h 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+// This file is used to store precompiled headers.
+// It is intentionally left blank. It is up to you to decide which headers should be included here.
</ins></span></pre></div>
<a id="2013b0unc3trunksrcWPUtilscpp"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/src/WPUtils.cpp (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/src/WPUtils.cpp (rev 0)
+++ 2013/b0unc3/trunk/src/WPUtils.cpp 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,1063 @@
</span><ins>+/*
+ * WPUtils.cpp
+ *
+ * Created on: 04/ago/2013
+ * Author: b0unc3
+ */
+
+#include "WPUtils.h"
+
+WPUtils::~WPUtils() {
+ // TODO Auto-generated destructor stub
+}
+
+void WPUtils::uploadFile(QString furl)
+{
+ //QUrl("file://" + workingDir +"/shared/camera/camera0001.jpg"
+ //file:shared/camera/IMG_00000064.png
+ QString workingDir = QDir::currentPath();
+
+ qDebug() << "wrkg dir = " << workingDir;
+
+ qDebug() << "furl = " << furl;
+
+ //(QUrl::fromLocalFile(fileName))
+ //QString theUrl = QUrl::fromLocalFile(workingDir + "/shared/camera/IMG_00000064.png").toString();
+ //qDebug() << "THE URL = " << theUrl;
+ //QFile* file = new QFile(theUrl); //+furl).toString()));
+ //QFile* file = new QFile("/accounts/1000/appdata/com.example.wp_bb10.testDev_ple_wp_bb10568b6114/shared/camera/IMG_00000064.png");
+
+ /*
+ * wrkg dir = "/accounts/1000/appdata/com.example.wp_bb10.testDev_ple_wp_bb10568b6114"
+ furl = "/accounts/1000/shared/camera/IMG_00000064.png"
+ */
+ QString fn = furl;
+ QStringList l = fn.split('/');
+ QString nome = l[l.count()-1];
+
+ QString f = workingDir + "/shared/camera/" + nome;
+
+ QFile* file = new QFile(f);
+
+ if ( file->exists() )
+ qDebug() << "file founded.";
+ else qDebug() << "file not found.";
+
+ if ( file->isReadable() )
+ qDebug() << "posso leggere";
+ else qDebug() << "non so leggere";
+
+ file->open(QIODevice::ReadOnly);
+ //QByteArray image = file->readAll().toBase64();
+ //QString bits = image.toBase64();
+
+ //qDebug() << "bits = " << image;
+
+ qDebug() << "set name = " << nome;
+
+ QXmlStreamWriter sw(&_xml);
+
+ sw.setAutoFormatting(true);
+ sw.writeStartDocument();
+
+ sw.writeStartElement("methodCall");
+ sw.writeTextElement("methodName", "wp.uploadFile");
+ sw.writeStartElement("params");
+ sw.writeStartElement("param");
+ sw.writeCharacters("blog_id");
+ sw.writeTextElement("value", _blogid);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("username");
+ sw.writeTextElement("value", _username);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("password");
+ sw.writeTextElement("value", _password);
+ sw.writeEndElement();
+ sw.writeStartElement("struct");
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "name");
+ sw.writeTextElement("value", nome);
+ sw.writeEndElement();
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "type");
+ QImageReader reader(f);
+
+ //QByteArray imageFormat = QImageReader::imageFormat(furl);
+ qDebug() << "MIME/TYPE = " << reader.format();//.toString();
+ sw.writeTextElement("value", "image/"+reader.format());
+ sw.writeEndElement();
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "bits");
+ sw.writeStartElement("value");
+ sw.writeStartElement("base64");
+ sw.writeCharacters(file->readAll().toBase64());
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "overwrite");
+ sw.writeTextElement("value", "true");
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndDocument();
+
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+
+}
+
+void WPUtils::deletePost(QString post_id)
+{
+ QXmlStreamWriter sw(&_xml);
+
+ sw.setAutoFormatting(true);
+ sw.writeStartDocument();
+
+ sw.writeStartElement("methodCall");
+ sw.writeTextElement("methodName", "wp.deletePost");
+ sw.writeStartElement("params");
+ sw.writeStartElement("param");
+ sw.writeCharacters("blog_id");
+ sw.writeTextElement("value", _blogid);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("username");
+ sw.writeTextElement("value", _username);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("password");
+ sw.writeTextElement("value", _password);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("post_id");
+ sw.writeTextElement("value", post_id);
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndDocument();
+
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+}
+
+void WPUtils::makePost(QString title, QVariant cnt, QVariant type, QString tags, QVariant status)
+{
+ qDebug() << "new post, tile = " << title << " content, = " << cnt << " type = " << type.toString() << " tags = " << tags << " status = " << status.toString();
+ QString pd = cnt.toString();
+ pd.replace("&","&");
+ pd.replace("<","<");
+ pd.replace(">",">");
+ pd.replace("\"",""");
+
+ qDebug() << "pd = " << pd;
+
+ QXmlStreamWriter sw(&_xml);
+ sw.setAutoFormatting(true);
+ sw.writeStartDocument();
+
+ sw.writeStartElement("methodCall");
+ sw.writeTextElement("methodName", "wp.newPost");
+ sw.writeStartElement("params");
+ sw.writeStartElement("param");
+ sw.writeCharacters("blog_id");
+ sw.writeTextElement("value", _blogid);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("username");
+ sw.writeTextElement("value", _username);
+ sw.writeEndElement();
+ sw.writeStartElement("param");
+ sw.writeCharacters("password");
+ sw.writeTextElement("value", _password);
+ sw.writeEndElement();
+ sw.writeStartElement("struct");
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "post_type");
+ sw.writeTextElement("value", type.toString());
+ sw.writeEndElement();
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "post_status");
+ sw.writeTextElement("value", status.toString());
+ sw.writeEndElement();
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "post_title");
+ sw.writeTextElement("value", title);
+ sw.writeEndElement();
+
+ sw.writeStartElement("member");
+ sw.writeTextElement("name", "post_content");
+ sw.writeStartElement("value");
+ sw.writeCharacters(pd.toUtf8());
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndElement();
+ sw.writeEndDocument();
+
+ //QString _endpoint = _endpoint;
+
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+}
+
+void WPUtils::getBlogs(QString u, QString p, QString blog_address)
+{
+
+ /* alternative ? */
+ QDomDocument doc;
+ QDomProcessingInstruction init = doc.createProcessingInstruction("xml version=\"1.0\"", "encoding=\"UTF-8\"");
+ QDomElement mc = doc.createElement("methodCall");
+ QDomElement mn = doc.createElement("methodName");
+ QDomText mnt = doc.createTextNode("wp.getUsersBlogs");
+ QDomElement ps = doc.createElement("params");
+ QDomElement p1 = doc.createElement("param");
+ QDomText p1t = doc.createTextNode("username");
+ QDomElement v1 = doc.createElement("value");
+ QDomText v1t = doc.createTextNode(u);
+ QDomElement p2 = doc.createElement("param");
+ QDomText p2t = doc.createTextNode("password");
+ QDomElement v2 = doc.createElement("value");
+ QDomText v2t = doc.createTextNode(p);
+
+ doc.appendChild(init);
+ doc.appendChild(mc);
+ mc.appendChild(mn);
+ mn.appendChild(mnt);
+ mc.appendChild(ps);
+ ps.appendChild(p1);
+ p1.appendChild(p1t);
+ p1.appendChild(v1);
+ v1.appendChild(v1t);
+ ps.appendChild(p2);
+ p2.appendChild(p2t);
+ p2.appendChild(v2);
+ v2.appendChild(v2t);
+
+ QString xml = doc.toString();
+ qDebug() << "builded xml : " << xml;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+ _xml = xml.toUtf8();
+
+ QString tmp_url = searchEndPoint(blog_address);
+ if ( tmp_url.isEmpty() )
+ {
+ qDebug() << "unable to found endpoint";
+ res.insert("ERROR","ERROR");
+ } else {
+
+ url.setUrl(tmp_url);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+ }
+
+}
+
+int WPUtils::getPosition()
+{
+ return _position;
+}
+
+QMap<QString, QVariant> WPUtils::getBI()
+{
+ qDebug() << "getBI() == " << _blogs;
+
+ return _blogs;
+}
+
+void WPUtils::getBlogsInfo()
+{
+ qDebug() << "originals getBlogsInfo() = " << _blogs;
+
+ //res = _blogs;
+ qDebug() << "res contains = " << res;
+ /*
+ QByteArray ba;
+ int c = 0;
+ QHashIterator<QString, QString> i(_blogs);
+ while (i.hasNext())
+ {
+ ba.insert(c, i.value());
+ } // here the stream gets destroyed so it has to flush whatever it caches
+
+
+ qDebug() << ba.length() << ba.toHex();
+ qDebug() << "getBlogsInfo() = " << ba;
+ emit dataReady(ba);*/
+
+
+}
+
+bool WPUtils::blogsInfo()
+{
+ qDebug() << "blogsInfo () = " << _blogs.isEmpty();
+ return _blogs.isEmpty();
+}
+
+void WPUtils::setBlogsInfo(QString bid, QString burl)
+{
+
+ //_blogs.insertMulti("bname", bname);
+ _blogs.insertMulti(bid, burl);
+ //_blogs.insertMulti("burl", burl);
+
+ qDebug() << "first = " << _blogs.values(bid);//[_position];
+
+ _blogid = bid; //_blogs.values("blogid")[_position];
+ _endpoint = burl;//_blogs.values("burl")[_position];
+}
+
+void WPUtils::getCategories()
+{
+ QDomDocument doc;
+ QDomProcessingInstruction init = doc.createProcessingInstruction("xml version=\"1.0\"", "encoding=\"UTF-8\"");
+ QDomElement mc = doc.createElement("methodCall");
+ QDomElement mn = doc.createElement("methodName");
+ QDomText mnt = doc.createTextNode("wp.getTerms");
+ QDomElement ps = doc.createElement("params");
+ QDomElement p1 = doc.createElement("param");
+ QDomText p1t = doc.createTextNode("blogid");
+ QDomElement v1 = doc.createElement("value");
+ QDomText v1t = doc.createTextNode(_blogid);
+ QDomElement p2 = doc.createElement("param");
+ QDomText p2t = doc.createTextNode("username");
+ QDomElement v2 = doc.createElement("value");
+ QDomText v2t = doc.createTextNode(_username);
+ QDomElement p3 = doc.createElement("param");
+ QDomText p3t = doc.createTextNode("password");
+ QDomElement v3 = doc.createElement("value");
+ QDomText v3t = doc.createTextNode(_password);
+ QDomElement p4 = doc.createElement("param");
+ QDomText p4t = doc.createTextNode("taxonomy");
+ QDomElement v4 = doc.createElement("value");
+ QDomText v4t = doc.createTextNode("category");
+
+ doc.appendChild(init);
+ doc.appendChild(mc);
+ mc.appendChild(mn);
+ mn.appendChild(mnt);
+ mc.appendChild(ps);
+
+ ps.appendChild(p1);
+ p1.appendChild(p1t);
+ p1.appendChild(v1);
+ v1.appendChild(v1t);
+
+ ps.appendChild(p2);
+ p2.appendChild(p2t);
+ p2.appendChild(v2);
+ v2.appendChild(v2t);
+
+ ps.appendChild(p3);
+ p3.appendChild(p3t);
+ p3.appendChild(v3);
+ v3.appendChild(v3t);
+
+ ps.appendChild(p4);
+ p4.appendChild(p4t);
+ p4.appendChild(v4);
+ v4.appendChild(v4t);
+
+
+
+ _xml = doc.toString().toUtf8();
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+}
+
+void WPUtils::getPost(QString pid)
+{
+
+ qDebug() << "fetching post id = " << pid;
+ /* alternative ? */
+ QDomDocument doc;
+ QDomProcessingInstruction init = doc.createProcessingInstruction("xml version=\"1.0\"", "encoding=\"UTF-8\"");
+ QDomElement mc = doc.createElement("methodCall");
+ QDomElement mn = doc.createElement("methodName");
+ QDomText mnt = doc.createTextNode("wp.getPost");
+ QDomElement ps = doc.createElement("params");
+ QDomElement p1 = doc.createElement("param");
+ QDomText p1t = doc.createTextNode("blogid");
+ QDomElement v1 = doc.createElement("value");
+ QDomText v1t = doc.createTextNode(_blogid);
+ QDomElement p2 = doc.createElement("param");
+ QDomText p2t = doc.createTextNode("username");
+ QDomElement v2 = doc.createElement("value");
+ QDomText v2t = doc.createTextNode(_username);
+ QDomElement p3 = doc.createElement("param");
+ QDomText p3t = doc.createTextNode("password");
+ QDomElement v3 = doc.createElement("value");
+ QDomText v3t = doc.createTextNode(_password);
+ QDomElement p4 = doc.createElement("param");
+ QDomText p4t = doc.createTextNode("post_id");
+ QDomElement v4 = doc.createElement("value");
+ QDomText v4t = doc.createTextNode(pid);
+
+ doc.appendChild(init);
+ doc.appendChild(mc);
+ mc.appendChild(mn);
+ mn.appendChild(mnt);
+ mc.appendChild(ps);
+
+ ps.appendChild(p1);
+ p1.appendChild(p1t);
+ p1.appendChild(v1);
+ v1.appendChild(v1t);
+
+ ps.appendChild(p2);
+ p2.appendChild(p2t);
+ p2.appendChild(v2);
+ v2.appendChild(v2t);
+
+ ps.appendChild(p3);
+ p3.appendChild(p3t);
+ p3.appendChild(v3);
+ v3.appendChild(v3t);
+
+ ps.appendChild(p4);
+ p4.appendChild(p4t);
+ p4.appendChild(v4);
+ v4.appendChild(v4t);
+
+
+
+ _xml = doc.toString().toUtf8();
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+}
+
+
+
+void WPUtils::getPages()
+{
+ //_blogid = bid;
+
+ //_endpoint = burl;//.append("xmlrpc.php");
+ QDomDocument doc;
+ QDomProcessingInstruction init = doc.createProcessingInstruction("xml version=\"1.0\"", "encoding=\"UTF-8\"");
+ QDomElement mc = doc.createElement("methodCall");
+ QDomElement mn = doc.createElement("methodName");
+ QDomText mnt = doc.createTextNode("wp.getPages");
+ QDomElement ps = doc.createElement("params");
+ QDomElement p1 = doc.createElement("param");
+ QDomText p1t = doc.createTextNode("blogid");
+ QDomElement v1 = doc.createElement("value");
+ QDomText v1t = doc.createTextNode(_blogid);
+ QDomElement p2 = doc.createElement("param");
+ QDomText p2t = doc.createTextNode("username");
+ QDomElement v2 = doc.createElement("value");
+ QDomText v2t = doc.createTextNode(_username);
+ QDomElement p3 = doc.createElement("param");
+ QDomText p3t = doc.createTextNode("password");
+ QDomElement v3 = doc.createElement("value");
+ QDomText v3t = doc.createTextNode(_password);
+
+ doc.appendChild(init);
+ doc.appendChild(mc);
+ mc.appendChild(mn);
+ mn.appendChild(mnt);
+ mc.appendChild(ps);
+
+ ps.appendChild(p1);
+ p1.appendChild(p1t);
+ p1.appendChild(v1);
+ v1.appendChild(v1t);
+
+ ps.appendChild(p2);
+ p2.appendChild(p2t);
+ p2.appendChild(v2);
+ v2.appendChild(v2t);
+
+ ps.appendChild(p3);
+ p3.appendChild(p3t);
+ p3.appendChild(v3);
+ v3.appendChild(v3t);
+
+
+ _xml = doc.toString().toUtf8();
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+
+}
+
+void WPUtils::getComments()
+{
+ //_blogid = bid;
+
+ //_endpoint = burl;//.append("xmlrpc.php");
+ QDomDocument doc;
+ QDomProcessingInstruction init = doc.createProcessingInstruction("xml version=\"1.0\"", "encoding=\"UTF-8\"");
+ QDomElement mc = doc.createElement("methodCall");
+ QDomElement mn = doc.createElement("methodName");
+ QDomText mnt = doc.createTextNode("wp.getComments");
+ QDomElement ps = doc.createElement("params");
+ QDomElement p1 = doc.createElement("param");
+ QDomText p1t = doc.createTextNode("blogid");
+ QDomElement v1 = doc.createElement("value");
+ QDomText v1t = doc.createTextNode(_blogid);
+ QDomElement p2 = doc.createElement("param");
+ QDomText p2t = doc.createTextNode("username");
+ QDomElement v2 = doc.createElement("value");
+ QDomText v2t = doc.createTextNode(_username);
+ QDomElement p3 = doc.createElement("param");
+ QDomText p3t = doc.createTextNode("password");
+ QDomElement v3 = doc.createElement("value");
+ QDomText v3t = doc.createTextNode(_password);
+
+ doc.appendChild(init);
+ doc.appendChild(mc);
+ mc.appendChild(mn);
+ mn.appendChild(mnt);
+ mc.appendChild(ps);
+
+ ps.appendChild(p1);
+ p1.appendChild(p1t);
+ p1.appendChild(v1);
+ v1.appendChild(v1t);
+
+ ps.appendChild(p2);
+ p2.appendChild(p2t);
+ p2.appendChild(v2);
+ v2.appendChild(v2t);
+
+ ps.appendChild(p3);
+ p3.appendChild(p3t);
+ p3.appendChild(v3);
+ v3.appendChild(v3t);
+
+
+ _xml = doc.toString().toUtf8();
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+
+}
+
+void WPUtils::getPosts()
+{
+ //_blogid = bid;
+
+ //_endpoint = burl;//.append("xmlrpc.php");
+ QDomDocument doc;
+ QDomProcessingInstruction init = doc.createProcessingInstruction("xml version=\"1.0\"", "encoding=\"UTF-8\"");
+ QDomElement mc = doc.createElement("methodCall");
+ QDomElement mn = doc.createElement("methodName");
+ QDomText mnt = doc.createTextNode("wp.getPosts");
+ QDomElement ps = doc.createElement("params");
+ QDomElement p1 = doc.createElement("param");
+ QDomText p1t = doc.createTextNode("blogid");
+ QDomElement v1 = doc.createElement("value");
+ QDomText v1t = doc.createTextNode(_blogid);
+ QDomElement p2 = doc.createElement("param");
+ QDomText p2t = doc.createTextNode("username");
+ QDomElement v2 = doc.createElement("value");
+ QDomText v2t = doc.createTextNode(_username);
+ QDomElement p3 = doc.createElement("param");
+ QDomText p3t = doc.createTextNode("password");
+ QDomElement v3 = doc.createElement("value");
+ QDomText v3t = doc.createTextNode(_password);
+
+ doc.appendChild(init);
+ doc.appendChild(mc);
+ mc.appendChild(mn);
+ mn.appendChild(mnt);
+ mc.appendChild(ps);
+
+ ps.appendChild(p1);
+ p1.appendChild(p1t);
+ p1.appendChild(v1);
+ v1.appendChild(v1t);
+
+ ps.appendChild(p2);
+ p2.appendChild(p2t);
+ p2.appendChild(v2);
+ v2.appendChild(v2t);
+
+ ps.appendChild(p3);
+ p3.appendChild(p3t);
+ p3.appendChild(v3);
+ v3.appendChild(v3t);
+
+
+ _xml = doc.toString().toUtf8();
+ qDebug() << "post xml : " << _xml << " on " << _endpoint;
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager();
+
+ QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
+
+ QUrl url;
+
+
+ url.setUrl(_endpoint);
+ QNetworkRequest request(url);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd)); /* not sure */
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+
+ manager->post(request,_xml);
+
+
+}
+
+void WPUtils::replyFinished(QNetworkReply *rep)
+{
+ QVariantMap _res_bck;
+ model = new GroupDataModel();
+ model->setGrouping(ItemGrouping::None);
+
+ if ( model && !model->isEmpty() )
+ model->clear();
+
+ if ( !res.isEmpty() )
+ res.clear();
+
+
+ QByteArray ret = rep->readAll();
+ if ( !ret.isEmpty() )
+ qDebug() << "reading " << ret; //rep->readAll();
+ else qDebug() << "ret empty -> error handling /*TODO*/";
+
+ QString _current_name = "";
+
+ QXmlStreamReader xml(ret);
+
+ int _struct_counter = 0;
+
+ while(!xml.atEnd() && !xml.hasError()) {
+ QXmlStreamReader::TokenType token = xml.readNext();
+ if ( token == QXmlStreamReader::StartElement )
+ {
+ if ( xml.name().toString() == "struct" )
+ {
+ _struct_counter++;
+ //qDebug() << "+++++++++++++ increased struct counter to " << QString::number(_temp_struct_counter);
+ } else if ( xml.name().toString() == "name" )
+ {
+ token = xml.readNext();
+ //qDebug() << "save name = " << xml.text().toString();
+ _current_name = xml.text().toString();
+ } else if ( xml.name().toString() == "value" && !_current_name.isEmpty() )
+ {
+ token = xml.readNext();
+ if ( xml.name().toString() == "string" || xml.name().toString() == "boolean" || xml.name().toString() == "dateTime.iso8601" )
+ {
+ token = xml.readNext();
+ if ( _current_name == "post_date" || _current_name == "date_created_gmt" )
+ {
+ /* is this insane?! */
+ QString theDate = xml.text().toString(); //"20130503T14:48:55";
+ QString y = theDate.mid(0,4);
+ QString m = theDate.mid(4,2);
+ QString d = theDate.mid(6,2);
+ QString build = y + "-" + m + "-" + d + "" + theDate.mid(8,theDate.size());
+ /** TBC **/
+
+ const QDateTime t2(QDateTime::fromString(build, Qt::ISODate));
+ QString s = t2.toString();
+ QStringList ret = s.split(" ");
+ QString pt = ret[2] + "/" + ret[1] + "/" + ret[4] + " " + ret[3];
+
+ res[_current_name] = pt;
+ }/* else if ( _current_name == "post_id" )
+ {
+
+ }*/ else res[_current_name] = xml.text().toString();
+
+ _current_name = "";
+ } else _current_name = "";
+ } else if ( xml.name().toString() == "string" )
+ {
+ /* newpost workaround */
+ token = xml.readNext();
+ res["newpostid"] = xml.text().toString();
+ model->insert(res);
+ _res_bck.unite(res);
+ res.clear();
+ } else if ( xml.name().toString() == "boolean")
+ {
+ /* deletepost workaround */
+ token = xml.readNext();
+ res["delpost"] = xml.text().toString();
+ model->insert(res);
+ _res_bck.unite(res);
+ res.clear();
+ }
+
+
+ } else if ( token == QXmlStreamReader::EndElement )
+ {
+ if ( xml.name().toString() == "struct" )
+ {
+ _struct_counter--;
+ //qDebug() << "------------- decreased struct counter to " << QString::number(_temp_struct_counter);
+
+ if ( _struct_counter == 0 )
+ {
+ //qDebug() << "**END** inserting " << res;
+ if ( !res.isEmpty() )
+ {
+ model->insert(res);
+ _res_bck.unite(res);
+ res.clear();
+ } else qDebug() << "*+*+*+*+*+*+*+* ouch! res is empty!! =====DO SMTG======";
+
+ }
+ }
+ }
+ }
+
+ res = _res_bck;
+
+ //qDebug() << "map = " << res << "tot = " << res.count();
+
+ emit dataReady(ret);
+}
+
+/* no need to pass a qbytearray, model filled in the replyFinished */
+bb::cascades::GroupDataModel * WPUtils::setModel(QByteArray a)
+{
+ /*
+ qDebug() << "workgin on " << a;
+ qDebug() << "adding " << res;
+ */
+ return model;
+
+}
+
+QString WPUtils::sanitize(QString burl)
+{
+ /*
+ * check for the presence of http / https
+ * check for the trailing /
+ */
+ if ( !burl.isEmpty() ) {
+ if ( !burl.toLower().startsWith("http://") && !burl.toLower().startsWith("https://") )
+ {
+ burl = "http://" + burl;
+ }
+ if ( !burl.endsWith("/") )
+ burl.append("/");
+
+
+ return burl;
+ }
+
+ return burl;
+
+}
+
+QString WPUtils::searchEndPoint(QString url) // WP_FindEndPoint(QString url)
+{
+ _url = sanitize(url);
+ /*
+ * not here , but somewhere esle TBD
+ QUrl t(_url);
+ if ( !t.isValid() )
+ {
+ return "";
+ }*/
+
+ if ( _url.isEmpty() )
+ {
+ _url = "https://wordpress.com/xmlrpc.php";
+ if ( validate(_url) )
+ return _endpoint;
+ else return "";
+
+
+ } else {
+ if ( _url.indexOf("xmlrpc.php") != - 1 )
+ {
+ if ( validate(_url) )
+ return _endpoint;
+ }
+ else if ( _url.indexOf("/wp-admin/") != -1 )
+ {
+ /*
+ input contains /wp-admin/
+ remove it, and adding xmlrpc.php (WRN : check if there is also xmlrpc.php FIXME )
+ then validate
+ */
+ _url.replace("/wp-admin/","/").append("xmlrpc.php");
+ if ( validate(_url) )
+ return _endpoint;
+ }
+ else if ( validate(_url.append("xmlrpc.php")) )
+ {
+ return _endpoint;
+ } else {
+ /*
+ unable to locate xmlrpc.php
+ try to search on the HTML. href of pingback link
+ */
+ qDebug() << "fetch on = " << _url;
+
+
+ QNetworkAccessManager *a = new QNetworkAccessManager();
+ QUrl url(_url);//.append("/"));
+ QNetworkRequest request(_url);
+
+ QNetworkReply *reply = a->get(request);
+ //QEvent_loop _loop;
+ QObject::connect(a, SIGNAL(finished(QNetworkReply*)), this, SLOT(checkForPingback(QNetworkReply*)) );
+
+ _loop.exec();
+
+ return _endpoint;
+ /*if ( _endpoint.isEmpty() )
+ return
+ */
+
+
+ }
+ }
+
+ if ( _endpoint.isEmpty() )
+ {
+ _url = "https://wordpress.com/xmlrpc.php";
+ if ( validate(_url) )
+ return _endpoint;
+ else return "";
+
+
+ }
+
+ return "";
+
+
+
+}
+
+bool WPUtils::validate(QString e)
+{
+ qDebug() << "going on validate = " << e;
+ QUrl u(e);
+ QNetworkAccessManager *a = new QNetworkAccessManager();
+
+ QNetworkRequest request(u);
+ int cmd = 0;
+ request.setAttribute(QNetworkRequest::Attribute(QNetworkRequest::User + 1), QVariant((int) cmd));
+ request.setRawHeader("User-Agent", "wp-bb10/0.0.1");
+ request.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
+
+ QNetworkReply *reply;
+
+ reply = a->post(request, _xml);
+
+
+ QObject::connect(a, SIGNAL(finished(QNetworkReply*)), this, SLOT(repFinished(QNetworkReply*)) );
+ _loop.exec();
+
+ qDebug() << "********* FINISHED";
+ qDebug() << "_endpoint = " << _endpoint;
+
+ if ( _endpoint.isEmpty() )
+ return false;
+ else return true;
+}
+
+void WPUtils::repFinished(QNetworkReply *r)
+{
+ QByteArray t = r->readAll();
+ qDebug() << "we got reply = " << t;
+ QXmlStreamReader xr(t);//r->readAll());
+
+ _endpoint = "";
+ while(!xr.atEnd() && !xr.hasError())
+ {
+
+ QXmlStreamReader::TokenType token = xr.readNext();
+ if(token == QXmlStreamReader::StartElement)
+ {
+ if ( xr.name() == "methodResponse") //all the correct call, contain a <methodResponse> ; right? */
+ {
+ qDebug() << "xml correct";
+ _endpoint = _url;
+ }
+
+
+ }
+ }
+ xr.clear();
+ _loop.quit();
+}
+void WPUtils::checkForPingback(QNetworkReply *r)
+{
+ qDebug() << "check fo pingback";
+ QRegExp trx("link rel=\"pingback\" href=\"([^\"]*)\"");//(.*)<\/a>)
+ QString str = r->readAll();//"Offsets: 12 14 99 231 7";
+ qDebug() << "on " << str;
+
+ int pos = trx.indexIn(str);
+ if ( pos != -1 )
+ {
+ qDebug() << " index in = " << QString::number(pos);
+ QStringList list = trx.capturedTexts();
+ qDebug() << list;
+ qDebug() << "our item " << list[1];
+ if ( validate(list[1]) )
+ qDebug() << "got it " << _endpoint;// return _endpoint;
+ else{
+ /*
+ check on pingback href failed
+ check on EditURI href
+ */
+ QRegExp erx("link rel=\"EditURI\" type=\"application/rsd\+[^*]*\" title=\"RSD\" href=\"([^\"]*)\"");//(.*)<\/a>)
+ int pos = erx.indexIn(str);
+ if ( pos != -1 )
+ {
+ qDebug() << " index in = " << QString::number(pos);
+ QStringList list = erx.capturedTexts();
+ qDebug() << list;
+ qDebug() << "our item " << list[1];
+ if (list[1].indexOf('xmlrpc') != -1 ) //double check we got the right url
+ {
+ /*
+ download the xml and parse it
+ check for apiLink url
+ */
+ /****TODO****/
+ }
+ if ( validate(list[1]) )
+ qDebug() << "got on 2 = " << _endpoint;
+ else {
+ qDebug() << "nothing found";
+ }
+ }
+ }
+ }
+}
</ins></span></pre></div>
<a id="2013b0unc3trunksrcWPUtilsh"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/src/WPUtils.h (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/src/WPUtils.h (rev 0)
+++ 2013/b0unc3/trunk/src/WPUtils.h 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+/*
+ * WPUtils.h
+ *
+ * Created on: 04/ago/2013
+ * Author: b0unc3
+ */
+
+#ifndef WPUTILS_H_
+#define WPUTILS_H_
+
+#include <QObject>
+#include <QMetaType>
+#include <QMap>
+
+#include <qnetworkaccessmanager.h>
+#include <qnetworkreply.h>
+#include <qnetworkrequest.h>
+
+#include <QUrl>
+/* TO BE ROMEVED, USE QXml* */
+#include <QDomDocument>
+#include <QDomElement>
+#include <QDomText>
+
+#include <QtXml/QXmlStreamReader>
+#include <QXmlStreamWriter>
+
+#include <QByteArray>
+#include <QVariant>
+
+#include <QStringList>
+
+#include <QRegExp>
+
+#include <QXmlStreamReader>
+
+#include <Qt/qimagereader.h>
+
+#include <QDebug>
+
+#include <QMetaType>
+#include <QtScript>
+
+#include <bb/data/XmlDataAccess> //?
+#include <bb/cascades/ListView> //?
+#include <bb/cascades/DataModel> //?
+#include <bb/cascades/GroupDataModel>
+#include <bb/cascades/QListDataModel> //?
+
+using namespace bb::data;
+using namespace bb::cascades; //?
+
+
+class WPUtils: public QObject {
+ Q_OBJECT
+
+public:
+ QVariantMap res;
+ bb::cascades::GroupDataModel *model;
+
+
+ WPUtils(QObject *parent = 0) { _position = 0; }
+ virtual ~WPUtils();
+
+ Q_INVOKABLE void getBlogs(QString, QString, QString);
+ Q_INVOKABLE void getPosts();
+ Q_INVOKABLE void setBlogsInfo(QString,QString);
+ Q_INVOKABLE void getComments();
+ Q_INVOKABLE void getPages();
+ Q_INVOKABLE void getPost(QString);
+ Q_INVOKABLE void getCategories();
+ Q_INVOKABLE void makePost(QString, QVariant, QVariant, QString, QVariant);
+ Q_INVOKABLE void deletePost(QString);
+ Q_INVOKABLE void uploadFile(QString);
+
+ Q_INVOKABLE bb::cascades::GroupDataModel *setModel(QByteArray); /* should be getModel, since the model is setted in another func */
+ QString searchEndPoint(QString);
+
+ /* maybe temporary */
+ Q_INVOKABLE QMap<QString, QVariant> getRes() { return res; }
+ Q_INVOKABLE void resetRes() { res.clear(); }
+ Q_INVOKABLE void setUsername(QString u) { _username = u; }
+ Q_INVOKABLE void setPassword(QString p) { _password = p; }
+
+ Q_INVOKABLE void setPosition(int p) { _position = p; }
+ Q_INVOKABLE bool blogsInfo();
+ Q_INVOKABLE void getBlogsInfo();
+ Q_INVOKABLE QMap<QString, QVariant> getBI();
+
+private:
+ int _position;
+ QMap<QString, QVariant> _blogs;
+ //QHash<QString, QString> _blogs;
+ QString _endpoint;
+ QString _url;
+ QEventLoop _loop;
+ QByteArray _xml;
+ QString _username;
+ QString _password;
+ QString _blogid;
+
+ int getPosition();
+ QString sanitize(QString);
+ bool validate(QString);
+
+ signals:
+ void dataReady(QByteArray); //QVariant);//QString);
+ void blogsReady(QHash<QString, QString>);
+
+private slots:
+ void replyFinished(QNetworkReply*);
+ void repFinished(QNetworkReply*);
+ void checkForPingback(QNetworkReply*);
+
+};
+
+#endif /* WPUTILS_H_ */
</ins></span></pre></div>
<a id="2013b0unc3trunksrcapplicationuicpp"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/src/applicationui.cpp (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/src/applicationui.cpp (rev 0)
+++ 2013/b0unc3/trunk/src/applicationui.cpp 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+// Default empty project template
+#include "applicationui.hpp"
+
+#include "WPUtils.h"
+
+#include <bb/cascades/Application>
+#include <bb/cascades/QmlDocument>
+#include <bb/cascades/AbstractPane>
+
+
+
+using namespace bb::cascades;
+
+ApplicationUI::ApplicationUI(bb::cascades::Application *app)
+: QObject(app)
+{
+ // create scene document from main.qml asset
+ // set parent to created document to ensure it exists for the whole application lifetime
+ QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
+
+ WPUtils *wpu = new WPUtils();
+ qml->setContextProperty("wpu", wpu);
+
+ // create root object for the UI
+ AbstractPane *root = qml->createRootObject<AbstractPane>();
+ // set created root object as a scene
+ app->setScene(root);
+}
+
</ins></span></pre></div>
<a id="2013b0unc3trunksrcapplicationuihpp"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/src/applicationui.hpp (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/src/applicationui.hpp (rev 0)
+++ 2013/b0unc3/trunk/src/applicationui.hpp 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+// Default empty project template
+#ifndef ApplicationUI_HPP_
+#define ApplicationUI_HPP_
+
+#include <QObject>
+
+namespace bb { namespace cascades { class Application; }}
+
+/*!
+ * @brief Application pane object
+ *
+ *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
+ */
+class ApplicationUI : public QObject
+{
+ Q_OBJECT
+public:
+ ApplicationUI(bb::cascades::Application *app);
+ virtual ~ApplicationUI() {}
+};
+
+
+#endif /* ApplicationUI_HPP_ */
</ins></span></pre></div>
<a id="2013b0unc3trunksrcmaincpp"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/src/main.cpp (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/src/main.cpp (rev 0)
+++ 2013/b0unc3/trunk/src/main.cpp 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+// Default empty project template
+#include <bb/cascades/Application>
+
+#include <QLocale>
+#include <QTranslator>
+#include "applicationui.hpp"
+
+// include JS Debugger / CS Profiler enabler
+// this feature is enabled by default in the debug build only
+#include <Qt/qdeclarativedebug.h>
+
+using namespace bb::cascades;
+
+Q_DECL_EXPORT int main(int argc, char **argv)
+{
+ // this is where the server is started etc
+ Application app(argc, argv);
+
+ // localization support
+ QTranslator translator;
+ QString locale_string = QLocale().name();
+ QString filename = QString( "wp_bb10_%1" ).arg( locale_string );
+ if (translator.load(filename, "app/native/qm")) {
+ app.installTranslator( &translator );
+ }
+
+ new ApplicationUI(&app);
+
+ // we complete the transaction started in the app constructor and start the client event loop here
+ return Application::exec();
+ // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
+}
</ins></span></pre></div>
<a id="2013b0unc3trunktestxml"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/test.xml (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/test.xml (rev 0)
+++ 2013/b0unc3/trunk/test.xml 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8"?>
+<methodResponse>
+ <params>
+ <param>
+ <value>
+ <array><data>
+ <value><struct>
+ <member><name>isAdmin</name><value><boolean>1</boolean></value></member>
+ <member><name>url</name><value><string>https://bouncelab.wordpress.com/</string></value></member>
+ <member><name>blogid</name><value><string>51280592</string></value></member>
+ <member><name>blogName</name><value><string>b0unc3&#039;s Blog</string></value></member>
+ <member><name>xmlrpc</name><value><string>https://bouncelab.wordpress.com/xmlrpc.php</string></value></member>
+</struct></value>
+</data></array>
+ </value>
+ </param>
+ </params>
+</methodResponse>
</ins></span></pre></div>
<a id="2013b0unc3trunktranslationsMakefile"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/translations/Makefile (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/translations/Makefile (rev 0)
+++ 2013/b0unc3/trunk/translations/Makefile 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+QMAKE_TARGET = wp_bb10
+LUPDATE = $(QNX_HOST)/usr/bin/lupdate
+LRELEASE = $(QNX_HOST)/usr/bin/lrelease
+
+update: $(QMAKE_TARGET).pro FORCE
+ $(LUPDATE) $(QMAKE_TARGET).pro
+
+release: $(QMAKE_TARGET).pro $(QMAKE_TARGET).ts
+ $(LRELEASE) $(QMAKE_TARGET).pro
+
+FORCE:
+
</ins></span></pre></div>
<a id="2013b0unc3trunktranslationswp_bb10pro"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/translations/wp_bb10.pro (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/translations/wp_bb10.pro (rev 0)
+++ 2013/b0unc3/trunk/translations/wp_bb10.pro 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+include (../wp_bb10.pro)
</ins></span></pre></div>
<a id="2013b0unc3trunktranslationswp_bb10ts"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/translations/wp_bb10.ts (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/translations/wp_bb10.ts (rev 0)
+++ 2013/b0unc3/trunk/translations/wp_bb10.ts 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,135 @@
</span><ins>+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0">
+<context>
+ <name>BlogsSelectionDialog</name>
+ <message>
+ <source>Done</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>CustomDialogCategories</name>
+ <message>
+ <source>Done</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>blogslist</name>
+ <message>
+ <source>None selected</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>main</name>
+ <message>
+ <source>Posts</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Comments</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Pages</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Deleting post, please wait</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>DELETE POST</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Okay</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Cancel</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Change blog</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>makePost</name>
+ <message>
+ <source>Post Title</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Post Content</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Categories</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Status</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Public</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Private</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Format</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Standard</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Aside</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Image</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Video</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Quote</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Link</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>New Post</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Creating the new post, please wait</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Post tags (Separate tags with commas)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Add Image</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>Select Picture</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
</ins></span></pre></div>
<a id="2013b0unc3trunkwp_bb10bar"></a>
<div class="binary"><h4>Added: 2013/b0unc3/trunk/wp_bb10.bar</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: 2013/b0unc3/trunk/wp_bb10.bar
</span><span class="cx">===================================================================
</span><del>--- 2013/b0unc3/trunk/wp_bb10.bar 2013-09-06 17:53:50 UTC (rev 2262)
</del><ins>+++ 2013/b0unc3/trunk/wp_bb10.bar 2013-09-06 17:57:30 UTC (rev 2263)
</ins><span class="cx">Property changes on: 2013/b0unc3/trunk/wp_bb10.bar
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+application/octet-stream
</ins><span class="cx">\ No newline at end of property
</span><a id="2013b0unc3trunkwp_bb10pro"></a>
<div class="addfile"><h4>Added: 2013/b0unc3/trunk/wp_bb10.pro (0 => 2263)</h4>
<pre class="diff"><span>
<span class="info">--- 2013/b0unc3/trunk/wp_bb10.pro (rev 0)
+++ 2013/b0unc3/trunk/wp_bb10.pro 2013-09-06 17:57:30 UTC (rev 2263)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+APP_NAME = wp_bb10
+
+CONFIG += qt warn_on cascades10
+
+QT += xml network script
+
+LIBS += -lbbdata -lbbcascadespickers
+
+include(config.pri)
+
+device {
+ CONFIG(debug, debug|release) {
+ # Device-Debug custom configuration
+ }
+
+ CONFIG(release, debug|release) {
+ # Device-Release custom configuration
+ }
+}
+
+simulator {
+ CONFIG(debug, debug|release) {
+ # Simulator-Debug custom configuration
+ }
+}
</ins></span></pre>
</div>
</div>
</body>
</html>