fix reply post counting and enable send action when there is something to post

This commit is contained in:
Morgan McMillian 2019-10-13 17:23:47 -07:00
parent 82d5a1bc0d
commit 3e9499670d
5 changed files with 24 additions and 6 deletions

View file

@ -57,7 +57,14 @@ Sheet {
TextArea {
id: postText
preferredHeight: 350.0
onTextChanging: postChanging(text)
onTextChanging: {
postChanging(text)
if (count > 0) {
sendAction.enabled = true
} else {
sendAction.enabled = false
}
}
}
}
Container {

View file

@ -377,6 +377,14 @@ Container {
onSendPost: {
postitem.ListItem.view.sendReply(text, ListItemData.id);
}
onPostChanging: {
replySheet.count = 256 - postitem.ListItem.view.postLength(text)
if (replySheet.count < 0) {
replySheet.counttext = "longpost"
} else {
replySheet.counttext = replySheet.count.toString()
}
}
}
]
function parseMentions(mentions) {

View file

@ -113,6 +113,9 @@ NavigationPane {
function getPost(pid) {
pnut.getPost(pid)
}
function postLength(text) {
return pnut.postLength(text)
}
function ccOnReply() {
if (_app.setting("cc") === "true") {
return true

View file

@ -360,7 +360,7 @@ void Pnut::sendPost(QString text, int pid=0)
QVariantMap map;
QVariantList raw;
if (postLength(text) > 254)
if (postLength(text) > 256)
{
QVariantMap longpost;
QVariantMap rawobj;

View file

@ -233,22 +233,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="182"/>
<location filename="../assets/StreamTab.qml" line="185"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="196"/>
<location filename="../assets/StreamTab.qml" line="199"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="224"/>
<location filename="../assets/StreamTab.qml" line="227"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="211"/>
<location filename="../assets/StreamTab.qml" line="214"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>