Added User search support
This commit is contained in:
parent
539e681331
commit
10f27b9d50
10 changed files with 144 additions and 97 deletions
|
@ -62,6 +62,7 @@ OTHER_FILES += qml/harbour-tooter.qml \
|
||||||
qml/pages/components/VisualContainer.qml \
|
qml/pages/components/VisualContainer.qml \
|
||||||
qml/pages/components/MiniStatus.qml \
|
qml/pages/components/MiniStatus.qml \
|
||||||
qml/pages/components/MiniHeader.qml \
|
qml/pages/components/MiniHeader.qml \
|
||||||
|
qml/pages/components/ItemUser.qml \
|
||||||
harbour-tooter.desktop
|
harbour-tooter.desktop
|
||||||
|
|
||||||
SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256
|
SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.0.1, 2017-10-25T00:36:59. -->
|
<!-- Written by QtCreator 4.0.1, 2017-10-27T16:44:08. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
<value type="QByteArray">{41ec03ca-9430-48f3-b421-990d428b2838}</value>
|
<value type="QByteArray">{25497605-1bff-4134-a878-76c1475dd8e3}</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
|
@ -61,12 +61,12 @@
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-i486 (in Sailfish OS Build Engine)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-i486 (in Sailfish OS Build Engine)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-i486 (in Sailfish OS Build Engine)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-i486 (in Sailfish OS Build Engine)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2b6dd414-d640-472a-9475-472ab2c5e22e}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c5294635-b154-4f12-9c01-f8fe0f997f49}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-SailfishOS_i486_in_Sailfish_OS_Build_Engine-Debug</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-SailfishOS_i486_in_Sailfish_OS_Build_Engine-Debug</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-SailfishOS_i486_in_Sailfish_OS_Build_Engine-Release</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-SailfishOS_i486_in_Sailfish_OS_Build_Engine-Release</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -210,7 +210,7 @@
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-SailfishOS_i486_in_Sailfish_OS_Build_Engine-Profile</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-SailfishOS_i486_in_Sailfish_OS_Build_Engine-Profile</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -396,7 +396,7 @@
|
||||||
<value type="int">13</value>
|
<value type="int">13</value>
|
||||||
<value type="int">14</value>
|
<value type="int">14</value>
|
||||||
</valuelist>
|
</valuelist>
|
||||||
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">/Users/dysko/GIT/harbour-tooter</value>
|
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">C:/Users/dysko/SF/harbour-tooter</value>
|
||||||
<value type="bool" key="MerRunConfiguration.QmlLiveEnabled">false</value>
|
<value type="bool" key="MerRunConfiguration.QmlLiveEnabled">false</value>
|
||||||
<value type="int" key="MerRunConfiguration.QmlLiveIpcPort">10234</value>
|
<value type="int" key="MerRunConfiguration.QmlLiveIpcPort">10234</value>
|
||||||
<value type="int" key="MerRunConfiguration.QmlLiveOptions">3</value>
|
<value type="int" key="MerRunConfiguration.QmlLiveOptions">3</value>
|
||||||
|
@ -414,7 +414,7 @@
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
|
<value type="bool" key="RunConfiguration.UseMultiProcess">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
|
@ -426,12 +426,12 @@
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-armv7hl (in Sailfish OS Build Engine)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SailfishOS-armv7hl (in Sailfish OS Build Engine)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-armv7hl (in Sailfish OS Build Engine)</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">SailfishOS-armv7hl (in Sailfish OS Build Engine)</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e475a8ea-d9f2-4d35-b4f0-1f1076cd8d23}</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c33e8913-ac83-4c44-be39-b4748ccc7738}</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">2</value>
|
||||||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-SailfishOS_armv7hl_in_Sailfish_OS_Build_Engine-Debug</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-SailfishOS_armv7hl_in_Sailfish_OS_Build_Engine-Debug</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -503,7 +503,7 @@
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-SailfishOS_armv7hl_in_Sailfish_OS_Build_Engine-Release</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-SailfishOS_armv7hl_in_Sailfish_OS_Build_Engine-Release</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -575,7 +575,7 @@
|
||||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/dysko/GIT/build-harbour-tooter-SailfishOS_armv7hl_in_Sailfish_OS_Build_Engine-Profile</value>
|
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/dysko/SF/build-harbour-tooter-SailfishOS_armv7hl_in_Sailfish_OS_Build_Engine-Profile</value>
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||||
|
@ -761,7 +761,7 @@
|
||||||
<value type="int">13</value>
|
<value type="int">13</value>
|
||||||
<value type="int">14</value>
|
<value type="int">14</value>
|
||||||
</valuelist>
|
</valuelist>
|
||||||
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">/Users/dysko/GIT/harbour-tooter</value>
|
<value type="QString" key="MerRunConfiguration.QmlLiveBenchWorkspace">C:/Users/dysko/SF/harbour-tooter</value>
|
||||||
<value type="bool" key="MerRunConfiguration.QmlLiveEnabled">false</value>
|
<value type="bool" key="MerRunConfiguration.QmlLiveEnabled">false</value>
|
||||||
<value type="int" key="MerRunConfiguration.QmlLiveIpcPort">10234</value>
|
<value type="int" key="MerRunConfiguration.QmlLiveIpcPort">10234</value>
|
||||||
<value type="int" key="MerRunConfiguration.QmlLiveOptions">3</value>
|
<value type="int" key="MerRunConfiguration.QmlLiveOptions">3</value>
|
||||||
|
|
|
@ -99,20 +99,20 @@ CoverBackground {
|
||||||
color: Theme.primaryColor
|
color: Theme.primaryColor
|
||||||
}
|
}
|
||||||
|
|
||||||
/*CoverActionList {
|
CoverActionList {
|
||||||
id: coverAction
|
id: coverAction
|
||||||
|
|
||||||
CoverAction {
|
CoverAction {
|
||||||
iconSource: "image://theme/icon-cover-next"
|
iconSource: "image://theme/icon-cover-next"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
label.text = Logic.modelTLhome.count
|
Logic.conf.notificationLastID = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CoverAction {
|
CoverAction {
|
||||||
iconSource: "image://theme/icon-cover-pause"
|
iconSource: "image://theme/icon-cover-pause"
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
function checkNotifications(){
|
function checkNotifications(){
|
||||||
console.log("checkNotifications")
|
console.log("checkNotifications")
|
||||||
var notificationsNum = 0
|
var notificationsNum = 0
|
||||||
|
|
|
@ -10,22 +10,36 @@ Page {
|
||||||
property alias title: header.title
|
property alias title: header.title
|
||||||
property alias description: header.description
|
property alias description: header.description
|
||||||
property alias avatar: header.image
|
property alias avatar: header.image
|
||||||
|
property string suggestedUser: ""
|
||||||
|
property ListModel suggestedModel;
|
||||||
property int toot_id
|
property int toot_id
|
||||||
property ListModel mdl;
|
property ListModel mdl;
|
||||||
allowedOrientations: Orientation.All
|
allowedOrientations: Orientation.All
|
||||||
|
onSuggestedUserChanged: {
|
||||||
|
console.log(suggestedUser)
|
||||||
|
suggestedModel = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
|
||||||
|
predictionList.visible = false;
|
||||||
|
if (suggestedUser.length > 0) {
|
||||||
|
var msg = {
|
||||||
|
'action' : 'accounts/search',
|
||||||
|
'method' : 'GET',
|
||||||
|
'model' : suggestedModel,
|
||||||
|
'mode' : "append",
|
||||||
|
'params' : [ {name: "q", data: suggestedUser} ],
|
||||||
|
|
||||||
|
'conf' : Logic.conf
|
||||||
|
};
|
||||||
|
worker.sendMessage(msg);
|
||||||
|
predictionList.visible = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
id: mediaModel
|
id: mediaModel
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
btnAddImage.enabled = mediaModel.count < 4
|
btnAddImage.enabled = mediaModel.count < 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ListModel {
|
|
||||||
id: suggestedModel
|
|
||||||
onCountChanged: {
|
|
||||||
console.log("aaaa " + count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WorkerScript {
|
WorkerScript {
|
||||||
id: worker
|
id: worker
|
||||||
|
@ -77,44 +91,26 @@ Page {
|
||||||
anchors.bottom: panel.top
|
anchors.bottom: panel.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: panel.right
|
anchors.right: panel.right
|
||||||
height: Theme.itemSizeMedium * 6
|
height: suggestedModel.count > 6 ? Theme.itemSizeMedium * 6 : Theme.itemSizeMedium * suggestedModel.count
|
||||||
color: Theme.highlightDimmerColor
|
color: Theme.highlightDimmerColor
|
||||||
|
|
||||||
ListView {
|
SilicaListView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: suggestedModel
|
model: suggestedModel
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
delegate: BackgroundItem {
|
delegate: ItemUser {
|
||||||
height: Theme.itemSizeMedium
|
onClicked: {
|
||||||
width: parent.width
|
var start = toot.cursorPosition;
|
||||||
|
while(toot.text[start] !== "@" && start > 0){
|
||||||
Image {
|
start--;
|
||||||
id: avatar
|
|
||||||
width: Theme.itemSizeSmall
|
|
||||||
height: width
|
|
||||||
source: model.account_avatar
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: Theme.horizontalPageMargin
|
|
||||||
}
|
|
||||||
Column {
|
|
||||||
anchors.left: avatar.right
|
|
||||||
anchors.leftMargin: Theme.paddingLarge
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
height: account_acct.height + display_name.height
|
|
||||||
Label {
|
|
||||||
id: display_name
|
|
||||||
text: model.account_display_name+" "
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
id: account_acct
|
|
||||||
text: "@"+model.account_acct
|
|
||||||
color: Theme.secondaryColor
|
|
||||||
anchors.leftMargin: Theme.paddingMedium
|
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
|
||||||
}
|
}
|
||||||
|
textOperations.text = toot.text
|
||||||
|
textOperations.cursorPosition = toot.cursorPosition
|
||||||
|
textOperations.moveCursorSelection(start-1,TextInput.SelectWords)
|
||||||
|
toot.text = textOperations.text.substring(0, textOperations.selectionStart) + ' @'+model.account_acct + ' ' + textOperations.text.substring(textOperations.selectionEnd).trim()
|
||||||
|
textOperations.text = ""
|
||||||
|
toot.cursorPosition = toot.text.indexOf('@'+model.account_acct)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
|
@ -153,6 +149,11 @@ Page {
|
||||||
//tweet()
|
//tweet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TextInput {
|
||||||
|
id: textOperations
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
|
||||||
TextArea {
|
TextArea {
|
||||||
id: toot
|
id: toot
|
||||||
anchors {
|
anchors {
|
||||||
|
@ -164,7 +165,7 @@ Page {
|
||||||
}
|
}
|
||||||
autoScrollEnabled: true
|
autoScrollEnabled: true
|
||||||
labelVisible: false
|
labelVisible: false
|
||||||
// focus: true
|
//focus: true
|
||||||
text: description !== "" && (description.charAt(0) == '@' || description.charAt(0) == '#') ? description+' ' : ''
|
text: description !== "" && (description.charAt(0) == '@' || description.charAt(0) == '#') ? description+' ' : ''
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
horizontalAlignment: Text.AlignLeft
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
@ -172,41 +173,14 @@ Page {
|
||||||
//tweet()
|
//tweet()
|
||||||
}
|
}
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
var pattern = /\B@[a-z0-9_-]+/gi;
|
textOperations.text = toot.text
|
||||||
var mentions = text.match(pattern);
|
textOperations.cursorPosition = toot.cursorPosition
|
||||||
if (mentions && mentions.length){
|
textOperations.selectWord()
|
||||||
var index = text.indexOf(cursorPosition);
|
textOperations.select(textOperations.selectionStart ? textOperations.selectionStart-1 : 0, textOperations.selectionEnd)
|
||||||
var preText = text.substring(0, cursorPosition);
|
console.log(textOperations.text.substr(textOperations.selectionStart, textOperations.selectionEnd))
|
||||||
var current;
|
suggestedUser = ""
|
||||||
if (preText.indexOf(" ") > 0) {
|
if (textOperations.selectedText.charAt(0) === "@") {
|
||||||
var words = preText.split(" ");
|
suggestedUser = textOperations.selectedText.trim().substring(1);
|
||||||
current = words[words.length - 1]; //return last word
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
current = preText;
|
|
||||||
}
|
|
||||||
if (current[0] === "@") {
|
|
||||||
predictionList.visible = true;
|
|
||||||
var matches = mentions.filter(function(value){
|
|
||||||
if(value) {
|
|
||||||
return (value.substring(0, current.length) === current);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
console.log(matches)
|
|
||||||
var msg = {
|
|
||||||
'action' : 'accounts/search',
|
|
||||||
'method' : 'GET',
|
|
||||||
'model' : suggestedModel,
|
|
||||||
'mode' : "append",
|
|
||||||
'params' : [ {name: "q", data: matches[0].substring(1)} ],
|
|
||||||
|
|
||||||
'conf' : Logic.conf
|
|
||||||
};
|
|
||||||
|
|
||||||
worker.sendMessage(msg);
|
|
||||||
} else {
|
|
||||||
predictionList.visible = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -577,7 +551,9 @@ Page {
|
||||||
text: glyph
|
text: glyph
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
toot.text = toot.text + model.glyph
|
var cursorPosition = toot.cursorPosition
|
||||||
|
toot.text = toot.text.substring(0, cursorPosition) + model.glyph + toot.text.substring(cursorPosition)
|
||||||
|
toot.cursorPosition = cursorPosition+model.glyph.length
|
||||||
emoticonsDialog.canAccept = true;
|
emoticonsDialog.canAccept = true;
|
||||||
emoticonsDialog.accept()
|
emoticonsDialog.accept()
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,12 @@ Page {
|
||||||
tlSearch.type = "timelines/tag/"+search.substring(1)
|
tlSearch.type = "timelines/tag/"+search.substring(1)
|
||||||
loadData("append")
|
loadData("append")
|
||||||
}
|
}
|
||||||
|
if (search[0] === "@") {
|
||||||
|
tlSearch.type = "accounts/search"
|
||||||
|
tlSearch.params = []
|
||||||
|
tlSearch.params.push({name: 'q', data: search.substring(1)});
|
||||||
|
loadData("append")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onTypeChanged: {
|
onTypeChanged: {
|
||||||
console.log("type changed")
|
console.log("type changed")
|
||||||
|
@ -122,6 +128,11 @@ Page {
|
||||||
enabled: tlSearch.mdl === 0
|
enabled: tlSearch.mdl === 0
|
||||||
text: "Only #hastag search works"
|
text: "Only #hastag search works"
|
||||||
}
|
}
|
||||||
|
delegate: Loader {
|
||||||
|
width: parent.width
|
||||||
|
source: tlSearch.search[0] === "@" ? "components/ItemUser.qml" : "components/VisualContainer.qml"
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
48
qml/pages/components/ItemUser.qml
Normal file
48
qml/pages/components/ItemUser.qml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
import Sailfish.Silica 1.0
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
BackgroundItem {
|
||||||
|
id: delegate
|
||||||
|
//property string text: "0"
|
||||||
|
height: Theme.itemSizeMedium
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: avatar
|
||||||
|
width: Theme.itemSizeExtraSmall
|
||||||
|
height: width
|
||||||
|
source: model.account_avatar
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.horizontalPageMargin
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: pageStack.push(Qt.resolvedUrl("./../Profile.qml"), {
|
||||||
|
"displayname": model.account_username,
|
||||||
|
"username": model.account_acct,
|
||||||
|
"user_id": model.account_id,
|
||||||
|
"profileImage": model.account_avatar
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Column {
|
||||||
|
anchors.left: avatar.right
|
||||||
|
anchors.leftMargin: Theme.paddingLarge
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: account_acct.height + display_name.height
|
||||||
|
Label {
|
||||||
|
id: display_name
|
||||||
|
text: model.account_display_name+" "
|
||||||
|
color: !pressed ? Theme.primaryColor : Theme.highlightColor
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
id: account_acct
|
||||||
|
text: "@"+model.account_acct
|
||||||
|
color: !pressed ? Theme.secondaryColor : Theme.secondaryHighlightColor
|
||||||
|
anchors.leftMargin: Theme.paddingMedium
|
||||||
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -166,6 +166,10 @@ SilicaListView {
|
||||||
}
|
}
|
||||||
function loadData(mode){
|
function loadData(mode){
|
||||||
var p = [];
|
var p = [];
|
||||||
|
if (params.length)
|
||||||
|
for(var i = 0; i<params.length; i++)
|
||||||
|
p.push(params[i])
|
||||||
|
|
||||||
if (mode === "append" && model.count){
|
if (mode === "append" && model.count){
|
||||||
p.push({name: 'max_id', data: model.get(model.count-1).id});
|
p.push({name: 'max_id', data: model.get(model.count-1).id});
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,3 +44,10 @@
|
||||||
- Cover page fix for SailfishX
|
- Cover page fix for SailfishX
|
||||||
- Added Copy URL option
|
- Added Copy URL option
|
||||||
- Privacy option in the conversation is now inherited by toot in the thread
|
- Privacy option in the conversation is now inherited by toot in the thread
|
||||||
|
|
||||||
|
* Fri October 27 2017 Dusko Angirevic <dysko@me.com> 0.2.3-0
|
||||||
|
- Added User autocomplete options
|
||||||
|
- Added video player options
|
||||||
|
- Smileys are inserted on the cursor position
|
||||||
|
- Pintch to zoom photos
|
||||||
|
- Support for downloading media to the device
|
||||||
|
|
|
@ -13,7 +13,7 @@ Name: harbour-tooter
|
||||||
%{!?qtc_make:%define qtc_make make}
|
%{!?qtc_make:%define qtc_make make}
|
||||||
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
||||||
Summary: Tooter
|
Summary: Tooter
|
||||||
Version: 0.2.2
|
Version: 0.2.3
|
||||||
Release: 0
|
Release: 0
|
||||||
Group: Qt/Qt
|
Group: Qt/Qt
|
||||||
License: LICENSE
|
License: LICENSE
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Name: harbour-tooter
|
Name: harbour-tooter
|
||||||
Summary: Tooter
|
Summary: Tooter
|
||||||
Version: 0.2.2
|
Version: 0.2.3
|
||||||
Release: 0
|
Release: 0
|
||||||
# The contents of the Group field should be one of the groups listed here:
|
# The contents of the Group field should be one of the groups listed here:
|
||||||
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
|
# http://gitorious.org/meego-developer-tools/spectacle/blobs/master/data/GROUPS
|
||||||
|
|
Loading…
Reference in a new issue