feat: add fetch more menu item in the chat drop down menu
fix import fix extra spaces
This commit is contained in:
parent
388b57cb76
commit
2baa55b5c4
|
@ -104,6 +104,13 @@ Rectangle {
|
||||||
|
|
||||||
PopupMenu {
|
PopupMenu {
|
||||||
id: chatContextMenu
|
id: chatContextMenu
|
||||||
|
subMenuIcons: [
|
||||||
|
{
|
||||||
|
source: Qt.resolvedUrl("../../../img/fetch.svg"),
|
||||||
|
width: 16,
|
||||||
|
height: 16
|
||||||
|
}
|
||||||
|
]
|
||||||
Action {
|
Action {
|
||||||
icon.source: "../../../img/close.svg"
|
icon.source: "../../../img/close.svg"
|
||||||
icon.width: chatTopBarContent.iconSize
|
icon.width: chatTopBarContent.iconSize
|
||||||
|
@ -112,6 +119,7 @@ Rectangle {
|
||||||
text: qsTrId("clear-history")
|
text: qsTrId("clear-history")
|
||||||
onTriggered: chatsModel.clearChatHistory(chatsModel.activeChannel.id)
|
onTriggered: chatsModel.clearChatHistory(chatsModel.activeChannel.id)
|
||||||
}
|
}
|
||||||
|
FetchMoreMessages {}
|
||||||
Action {
|
Action {
|
||||||
icon.source: "../../../img/delete.svg"
|
icon.source: "../../../img/delete.svg"
|
||||||
icon.width: chatTopBarContent.iconSize
|
icon.width: chatTopBarContent.iconSize
|
||||||
|
|
|
@ -194,57 +194,7 @@ ScrollView {
|
||||||
chatsModel.markAllChannelMessagesReadByIndex(channelContextMenu.channelIndex)
|
chatsModel.markAllChannelMessagesReadByIndex(channelContextMenu.channelIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PopupMenu {
|
FetchMoreMessages {}
|
||||||
hasArrow: false
|
|
||||||
//% "Fetch Messages"
|
|
||||||
title: qsTrId("fetch-messages")
|
|
||||||
|
|
||||||
// TODO call fetch for the wanted duration
|
|
||||||
//% "Last 24 hours"
|
|
||||||
Action {
|
|
||||||
text: qsTrId("last-24-hours");
|
|
||||||
icon.width: 0;
|
|
||||||
onTriggered: {
|
|
||||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours)
|
|
||||||
timer.setTimeout(function(){
|
|
||||||
chatsModel.hideLoadingIndicator()
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//% "Last 2 days"
|
|
||||||
Action {
|
|
||||||
text: qsTrId("last-2-days");
|
|
||||||
icon.width: 0;
|
|
||||||
onTriggered: {
|
|
||||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast2Days)
|
|
||||||
timer.setTimeout(function(){
|
|
||||||
chatsModel.hideLoadingIndicator()
|
|
||||||
}, 4000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//% "Last 3 days"
|
|
||||||
Action {
|
|
||||||
text: qsTrId("last-3-days");
|
|
||||||
icon.width: 0;
|
|
||||||
onTriggered: {
|
|
||||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast3Days)
|
|
||||||
timer.setTimeout(function(){
|
|
||||||
chatsModel.hideLoadingIndicator()
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//% "Last 7 days"
|
|
||||||
Action {
|
|
||||||
text: qsTrId("last-7-days");
|
|
||||||
icon.width: 0;
|
|
||||||
onTriggered: {
|
|
||||||
chatsModel.requestMoreMessages(Constants.fetchRangeLast7Days)
|
|
||||||
timer.setTimeout(function(){
|
|
||||||
chatsModel.hideLoadingIndicator()
|
|
||||||
}, 7000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Action {
|
Action {
|
||||||
//% "Clear History"
|
//% "Clear History"
|
||||||
text: qsTrId("clear-history")
|
text: qsTrId("clear-history")
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
import QtQuick 2.13
|
||||||
|
import QtQuick.Controls 2.13
|
||||||
|
import QtQuick.Layouts 1.13
|
||||||
|
import "../../../../shared"
|
||||||
|
import "../../../../shared/status"
|
||||||
|
import "../../../../imports"
|
||||||
|
|
||||||
|
PopupMenu {
|
||||||
|
//% "Fetch Messages"
|
||||||
|
title: qsTrId("fetch-messages")
|
||||||
|
|
||||||
|
// TODO call fetch for the wanted duration
|
||||||
|
//% "Last 24 hours"
|
||||||
|
Action {
|
||||||
|
text: qsTrId("last-24-hours");
|
||||||
|
icon.width: 0;
|
||||||
|
onTriggered: {
|
||||||
|
chatsModel.requestMoreMessages(Constants.fetchRangeLast24Hours)
|
||||||
|
timer.setTimeout(function(){
|
||||||
|
chatsModel.hideLoadingIndicator()
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//% "Last 2 days"
|
||||||
|
Action {
|
||||||
|
text: qsTrId("last-2-days");
|
||||||
|
icon.width: 0;
|
||||||
|
onTriggered: {
|
||||||
|
chatsModel.requestMoreMessages(Constants.fetchRangeLast2Days)
|
||||||
|
timer.setTimeout(function(){
|
||||||
|
chatsModel.hideLoadingIndicator()
|
||||||
|
}, 4000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//% "Last 3 days"
|
||||||
|
Action {
|
||||||
|
text: qsTrId("last-3-days");
|
||||||
|
icon.width: 0;
|
||||||
|
onTriggered: {
|
||||||
|
chatsModel.requestMoreMessages(Constants.fetchRangeLast3Days)
|
||||||
|
timer.setTimeout(function(){
|
||||||
|
chatsModel.hideLoadingIndicator()
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//% "Last 7 days"
|
||||||
|
Action {
|
||||||
|
text: qsTrId("last-7-days");
|
||||||
|
icon.width: 0;
|
||||||
|
onTriggered: {
|
||||||
|
chatsModel.requestMoreMessages(Constants.fetchRangeLast7Days)
|
||||||
|
timer.setTimeout(function(){
|
||||||
|
chatsModel.hideLoadingIndicator()
|
||||||
|
}, 7000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue