- When removing all entries : delete all history and call logs (if one-one and not secure in the case of standard chat is enabled)

- Add more actions in contact edit
- fix missing colors
This commit is contained in:
Julien Wadel 2021-11-04 20:42:00 +01:00
parent 403962376d
commit b99f746c30
8 changed files with 104 additions and 23 deletions

View file

@ -332,11 +332,18 @@ bool ChatRoomModel::removeRows (int row, int count, const QModelIndex &parent) {
void ChatRoomModel::removeAllEntries () {
qInfo() << QStringLiteral("Removing all entries of: (%1, %2).")
.arg(getPeerAddress()).arg(getLocalAddress());
auto core = CoreManager::getInstance()->getCore();
bool standardChatEnabled = CoreManager::getInstance()->getSettingsModel()->getStandardChatEnabled();
beginResetModel();
for (auto &entry : mEntries)
entry->deleteEvent();
mEntries.clear();
mChatRoom->deleteHistory();
if( isOneToOne() && // Remove calls only if chat room is one-one and not secure (if available)
( !standardChatEnabled || !isSecure())
) {
auto callLogs = core->getCallHistory(mChatRoom->getPeerAddress(), mChatRoom->getLocalAddress());
for(auto callLog : callLogs)
core->removeCallLog(callLog);
}
endResetModel();
emit allEntriesRemoved(mSelf.lock());
emit focused();// Removing all entries is like having focus. Don't wait asynchronous events.

View file

@ -181,7 +181,7 @@ Item {
anchors.centerIn: parent
icon: {
if(!Images[_getIcon()])
console.log(_getIcon())
console.log("No images for: "+_getIcon())
return Images[_getIcon()].id
}
iconSize: wrappedButton.iconSize || (

View file

@ -34,9 +34,11 @@ QtObject {
property string name : 'add'
property string icon : 'add_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'l_n_b_bg').color
property color backgroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_d', icon, 'l_d_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'l_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'l_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'l_n_b_fg').color
property color foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 'l_d_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'l_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'l_p_b_fg').color

View file

@ -28,9 +28,11 @@ QtObject {
property string name : 'add'
property string icon : 'add_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_n_b_bg').color
property color backgroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_d', icon, 'me_d_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_n_b_fg').color
property color foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 'me_d_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_fg').color
@ -40,9 +42,11 @@ QtObject {
property string name : 'delete'
property string icon : 'delete_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_n_b_bg').color
property color backgroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_d', icon, 'me_d_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_n_b_fg').color
property color foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 'me_d_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_fg').color
}

View file

@ -4,7 +4,7 @@ import Common 1.0
import Linphone.Styles 1.0
// =============================================================================
// SipAddressesMenu
Item {
id: sipAddressesMenu
@ -18,16 +18,19 @@ Item {
// ---------------------------------------------------------------------------
function open (isSecure) {
function open (callback) {
var length = sipAddresses.length
if (!length) {
return
}
if (length === 1) {
return sipAddressesMenu.sipAddressClicked(sipAddresses[0], isSecure)
if(callback)
return callback(sipAddresses[0])
else
return sipAddressesMenu.sipAddressClicked(sipAddresses[0])
}
menu.isSecure = isSecure
menu.callback = callback
menu.open()
}
@ -41,7 +44,7 @@ Item {
// ---------------------------------------------------------------------------
signal sipAddressClicked (string sipAddress, bool isSecure)
signal sipAddressClicked (string sipAddress)
// ---------------------------------------------------------------------------
@ -51,7 +54,7 @@ Item {
DropDownDynamicMenu {
id: menu
property bool isSecure : false
property var callback
parent: sipAddressesMenu.parent
@ -105,7 +108,10 @@ Item {
onClicked: {
menu.close()
sipAddressesMenu.sipAddressClicked($sipAddress, menu.isSecure)
if( menu.callback)
menu.callback($sipAddress)
else
sipAddressesMenu.sipAddressClicked($sipAddress)
}
}
}

View file

@ -153,12 +153,31 @@ ColumnLayout {
anchors.verticalCenter: parent.verticalCenter
iconSize: ContactEditStyle.bar.actions.history.iconSize
ActionButton {
isCustom: true
backgroundRadius: 90
colorSet: ContactEditStyle.videoCall
visible: SettingsModel.videoSupported && SettingsModel.outgoingCallsEnabled && SettingsModel.showStartVideoCallButton
onClicked: sipAddressesMenu.open(sipAddressesMenu.startVideoCall)
}
ActionButton {
isCustom: true
backgroundRadius: 90
colorSet: ContactEditStyle.call
visible: SettingsModel.outgoingCallsEnabled
onClicked: sipAddressesMenu.open(sipAddressesMenu.startCall)
}
ActionButton {
isCustom: true
backgroundRadius: 90
colorSet: SettingsModel.getShowStartChatButton() ? ContactEditStyle.chat : ContactEditStyle.history
visible: SettingsModel.standardChatEnabled
onClicked: sipAddressesMenu.open(false)
onClicked: sipAddressesMenu.open(sipAddressesMenu.createChatRoom)
tooltipText: qsTr('tooltipShowConversation')
tooltipIsClickable: false
}
@ -176,7 +195,7 @@ ColumnLayout {
anchors.top:parent.top
anchors.topMargin: -3
}
onClicked: {sipAddressesMenu.open(true)}
onClicked: {sipAddressesMenu.open(sipAddressesMenu.createSecureChatRoom)}
tooltipMaxWidth: actionBar.width
tooltipVisible: AccountSettingsModel.conferenceURI == ''
@ -219,16 +238,30 @@ ColumnLayout {
relativeY: infoBar.height
sipAddresses: _contact ? _contact.vcard.sipAddresses : [ contactEdit.sipAddress ]
onSipAddressClicked: {
var entry = CallsListModel.createChatRoom( "", isSecure, [sipAddress], false )
if(entry){
window.setView('Conversation', {
chatRoomModel:entry.chatRoomModel
}, function(){
TimelineListModel.select(entry.chatRoomModel)
})
}
function vewConversation(chatRoomModel){
window.setView('Conversation', {
chatRoomModel:chatRoomModel
}, function(){
TimelineListModel.select(chatRoomModel)
})
}
function createChatRoom(sipAddress){
var entry = CallsListModel.createChatRoom( "", false, [sipAddress], false )
if(entry)
vewConversation(entry.chatRoomModel)
}
function createSecureChatRoom(sipAddress){
var entry = CallsListModel.createChatRoom( "", true, [sipAddress], false )
if(entry)
vewConversation(entry.chatRoomModel)
}
function startCall(sipAddress){
CallsListModel.launchAudioCall([sipAddress])
}
function startVideoCall(sipAddress){
CallsListModel.launchVideoCall([sipAddress])
}
}

View file

@ -98,6 +98,29 @@ QtObject {
property int height: 1
}
}
property QtObject call: QtObject {
property int iconSize: 40
property string name : 'call'
property string icon : 'call_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 's_n_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 's_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 's_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 's_n_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 's_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 's_p_b_fg').color
}
property QtObject videoCall: QtObject {
property int iconSize: 40
property string name : 'videoCall'
property string icon : 'video_call_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 's_n_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 's_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 's_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 's_n_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 's_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 's_p_b_fg').color
}
property QtObject chat: QtObject {
property int iconSize: 40
property string name : 'chat'

View file

@ -28,9 +28,11 @@ QtObject {
property string name : 'add'
property string icon : 'add_custom'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 'me_n_b_bg').color
property color backgroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_d', icon, 'me_d_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 'me_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 'me_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 'me_n_b_fg').color
property color foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 'me_d_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 'me_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 'me_p_b_fg').color
}
@ -39,9 +41,11 @@ QtObject {
property string icon : 'cancel_custom'
property string name : 'cancel'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 's_n_b_bg').color
property color backgroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_d', icon, 's_d_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 's_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 's_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 's_n_b_fg').color
property color foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 's_d_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 's_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 's_p_b_fg').color
}
@ -50,9 +54,11 @@ QtObject {
property string icon : 'options_custom'
property string name : 'options'
property color backgroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_n', icon, 's_n_b_bg').color
property color backgroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_d', icon, 's_d_b_bg').color
property color backgroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_h', icon, 's_h_b_bg').color
property color backgroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_bg_p', icon, 's_p_b_bg').color
property color foregroundNormalColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_n', icon, 's_n_b_fg').color
property color foregroundDisabledColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_d', icon, 's_d_b_fg').color
property color foregroundHoveredColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_h', icon, 's_h_b_fg').color
property color foregroundPressedColor : ColorsList.addImageColor(sectionName+'_'+name+'_fg_p', icon, 's_p_b_fg').color
}