Skip to content
Snippets Groups Projects
Select Git revision
  • 4a2bf0d61e605dd5128ac35049c124381aaa28b8
  • master default protected
  • stable/20251106.0
  • nightly/20251106.0
  • nightly/20251103.0
  • nightly/20251101.0
  • beta/202510311701
  • stable/20251003.0
  • nightly/20251003.0
  • beta/202509301457
  • stable/20250917.0
  • nightly/20250917.0
  • beta/202509161514
  • beta/202509122057
  • stable/20250912.0
  • nightly/20250912.0
  • nightly/20250911.0
  • beta/202509111213
  • stable/20250902.0
  • nightly/20250902.0
  • beta/202508201613
  • stable/20250815.1
22 results

ConversationSmartListContextMenu.qml

Blame
  • agsantos's avatar
    Aline Gondim Santos authored and Sébastien Blin committed
    Call controls and features are restrained if video is disabled in account advanced settings.
    
    + Do not show "accept in video" if there is no video device available
    
    GitLab: #525
    Change-Id: Iacc8801c8a302a1b00642a6c31603973ff5f24b6
    4a2bf0d6
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ConversationSmartListContextMenu.qml 5.04 KiB
    /*
     * Copyright (C) 2020 by Savoir-faire Linux
     * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 3 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     */
    
    import QtQuick 2.15
    
    import net.jami.Models 1.1
    import net.jami.Adapters 1.1
    import net.jami.Constants 1.1
    
    import "../../commoncomponents"
    import "../../commoncomponents/contextmenu"
    
    ContextMenuAutoLoader {
        id: root
    
        property string responsibleAccountId: ""
        property string responsibleConvUid: ""
        property bool isSwarm: false
        property int contactType: Profile.Type.INVALID
        property bool hasCall: {
            if (responsibleAccountId && responsibleConvUid)
                return UtilsAdapter.getCallId(responsibleAccountId,
                                              responsibleConvUid) !== ""
            return false
        }
        property bool readOnly
    
        property list<GeneralMenuItem> menuItems: [
            GeneralMenuItem {
                id: startVideoCallItem
    
                canTrigger: CurrentAccount.videoEnabled_Video && !hasCall && !readOnly
                itemName: JamiStrings.startVideoCall
                iconSource: JamiResources.videocam_24dp_svg
                onClicked: {
                    LRCInstance.selectConversation(responsibleConvUid,
                                                   responsibleAccountId)
                    if (CurrentAccount.videoEnabled_Video)
                        CallAdapter.placeCall()
                }
            },
            GeneralMenuItem {
                id: startAudioCall
    
                canTrigger: !hasCall && !readOnly
                itemName: JamiStrings.startAudioCall
                iconSource: JamiResources.place_audiocall_24dp_svg
                onClicked: {
                    LRCInstance.selectConversation(responsibleConvUid,
                                                   responsibleAccountId)
                    CallAdapter.placeAudioOnlyCall()
                }
            },
            GeneralMenuItem {
                id: clearConversation
    
                canTrigger: !isSwarm && !hasCall
                itemName: JamiStrings.clearConversation
                iconSource: JamiResources.ic_clear_24dp_svg
                onClicked: MessagesAdapter.clearConversationHistory(
                               responsibleAccountId,
                               responsibleConvUid)
            },
            GeneralMenuItem {
                id: removeContact
    
                canTrigger: !hasCall && (contactType === Profile.Type.JAMI
                                         || contactType === Profile.Type.SIP)
                itemName: JamiStrings.removeContact
                iconSource: JamiResources.ic_hangup_participant_24dp_svg
                onClicked: MessagesAdapter.removeContact(responsibleConvUid)
            },
            GeneralMenuItem {
                id: hangup
    
                canTrigger: hasCall
                itemName: JamiStrings.hangup
                iconSource: JamiResources.ic_call_end_white_24dp_svg
                addMenuSeparatorAfter: contactType !== Profile.Type.SIP
                                       && (contactType === Profile.Type.PENDING
                                           || !hasCall)
                onClicked: CallAdapter.hangUpACall(responsibleAccountId,
                                                   responsibleConvUid)
            },
            GeneralMenuItem {
                id: acceptContactRequest
    
                canTrigger: contactType === Profile.Type.PENDING
                itemName: JamiStrings.acceptContactRequest
                iconSource: JamiResources.add_people_24dp_svg
                onClicked: MessagesAdapter.acceptInvitation(responsibleConvUid)
            },
            GeneralMenuItem {
                id: declineContactRequest
    
                canTrigger: contactType === Profile.Type.PENDING
                itemName: JamiStrings.declineContactRequest
                iconSource: JamiResources.round_close_24dp_svg
                onClicked: MessagesAdapter.refuseInvitation(responsibleConvUid)
            },
            GeneralMenuItem {
                id: blockContact
    
                canTrigger: !hasCall && contactType !== Profile.Type.SIP
                itemName: JamiStrings.blockContact
                iconSource: JamiResources.block_black_24dp_svg
                addMenuSeparatorAfter: contactType !== Profile.Type.SIP
                onClicked: MessagesAdapter.blockConversation(responsibleConvUid)
            },
            GeneralMenuItem {
                id: contactDetails
    
                canTrigger: contactType !== Profile.Type.SIP
                itemName: JamiStrings.contactDetails
                iconSource: JamiResources.person_24dp_svg
                onClicked: userProfile.open()
            }
        ]
    
        Component.onCompleted: menuItemsToLoad = menuItems
    }