diff --git a/linphone-app/ui/modules/Common/Dialog/DateTimeDialog.qml b/linphone-app/ui/modules/Common/Dialog/DateTimeDialog.qml index 8ef173b1e..4fff38c18 100644 --- a/linphone-app/ui/modules/Common/Dialog/DateTimeDialog.qml +++ b/linphone-app/ui/modules/Common/Dialog/DateTimeDialog.qml @@ -47,6 +47,7 @@ DialogPlus { ? dateTimeTitle : timeTitle : timeTitle + showCloseCross: true // --------------------------------------------------------------------------- RowLayout{ anchors.fill: parent diff --git a/linphone-app/ui/modules/Common/Form/Fields/TextField.qml b/linphone-app/ui/modules/Common/Form/Fields/TextField.qml index fdb2a5621..dc39e0b03 100644 --- a/linphone-app/ui/modules/Common/Form/Fields/TextField.qml +++ b/linphone-app/ui/modules/Common/Form/Fields/TextField.qml @@ -9,123 +9,121 @@ import Common.Styles 1.0 // ============================================================================= Controls.TextField { - id: textField - - // --------------------------------------------------------------------------- - - property alias icon: icon.icon - property alias iconSize: icon.iconSize - property bool isMandatory: false - property alias overwriteColor: icon.overwriteColor - property string error: '' - property var tools - property QtObject textFieldStyle : TextFieldStyle.normal - property bool showWhenEmpty: true - onTextFieldStyleChanged: if( !textFieldStyle) textFieldStyle = TextFieldStyle.normal - - signal iconClicked() - - // --------------------------------------------------------------------------- - - background: Rectangle { - border { - color: textField.error.length > 0 - ? textFieldStyle.background.border.color.error - : ( - textField.activeFocus && !textField.readOnly - ? textFieldStyle.background.border.color.selected - : textFieldStyle.background.border.color.normal - ) - width: textFieldStyle.background.border.width - } - - color: textField.readOnly - ? textFieldStyle.background.color.readOnly - : textFieldStyle.background.color.normal - - implicitHeight: textFieldStyle.background.height - implicitWidth: textFieldStyle.background.width - - radius: textFieldStyle.background.radius - - MouseArea { - anchors.right: parent.right - height: parent.height - cursorShape: Qt.ArrowCursor - implicitWidth: tools ? tools.width : 0 - - Rectangle { - id: toolsContainer - - border { - color: textField.error.length > 0 - ? textFieldStyle.background.border.color.error - : textFieldStyle.background.border.color.normal - width: textFieldStyle.background.border.width - } - - anchors.fill: parent - color: background.color - data: tools || [] - } - } - } - - color: textField.readOnly ? textFieldStyle.text.readOnly : textFieldStyle.text.normal - font.pointSize: textFieldStyle.text.pointSize - rightPadding: textFieldStyle.text.rightPadding + toolsContainer.width + (icon.visible ? icon.iconSize + 10: 0) - selectByMouse: true - - // --------------------------------------------------------------------------- - - Icon { - id: icon - - anchors { - right: parent.right - rightMargin: 10 - verticalCenter: parent.verticalCenter - } - - iconSize: parent.contentHeight - visible: showWhenEmpty && !parent.text || !showWhenEmpty && parent.text - - Text{ - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: 5 - textFormat: Text.RichText - text : '*' - color: textFieldStyle.background.mandatory.color - font.pointSize: textFieldStyle.background.mandatory.pointSize - visible: textField.isMandatory + id: textField + + // --------------------------------------------------------------------------- + + property alias icon: icon.icon + property alias iconSize: icon.iconSize + property bool isMandatory: false + property alias overwriteColor: icon.overwriteColor + property string error: '' + property var tools + property QtObject textFieldStyle : TextFieldStyle.normal + onTextFieldStyleChanged: if( !textFieldStyle) textFieldStyle = TextFieldStyle.normal + + + // --------------------------------------------------------------------------- + + background: Rectangle { + border { + color: textField.error.length > 0 + ? textFieldStyle.background.border.color.error + : ( + textField.activeFocus && !textField.readOnly + ? textFieldStyle.background.border.color.selected + : textFieldStyle.background.border.color.normal + ) + width: textFieldStyle.background.border.width + } + + color: textField.readOnly + ? textFieldStyle.background.color.readOnly + : textFieldStyle.background.color.normal + + implicitHeight: textFieldStyle.background.height + implicitWidth: textFieldStyle.background.width + + radius: textFieldStyle.background.radius + + MouseArea { + anchors.right: parent.right + height: parent.height + cursorShape: Qt.ArrowCursor + implicitWidth: tools ? tools.width : 0 + + Rectangle { + id: toolsContainer + + border { + color: textField.error.length > 0 + ? textFieldStyle.background.border.color.error + : textFieldStyle.background.border.color.normal + width: textFieldStyle.background.border.width + } + + anchors.fill: parent + color: background.color + data: tools || [] + } + } + } + + color: textField.readOnly ? textFieldStyle.text.readOnly : textFieldStyle.text.normal + font.pointSize: textFieldStyle.text.pointSize + rightPadding: textFieldStyle.text.rightPadding + toolsContainer.width + (icon.visible ? icon.iconSize + 10: 0) + selectByMouse: true + + // --------------------------------------------------------------------------- + + Icon { + id: icon + + anchors { + right: parent.right + rightMargin: 10 + verticalCenter: parent.verticalCenter + } + + iconSize: parent.contentHeight + visible: icon.icon != '' + + Text{ + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: 5 + textFormat: Text.RichText + text : '*' + color: textFieldStyle.background.mandatory.color + font.pointSize: textFieldStyle.background.mandatory.pointSize + visible: textField.isMandatory + } + MouseArea{ + anchors.fill: parent + onClicked: textField.text = '' + } + } + bottomPadding: (statusItem.visible?statusItem.implicitHeight:2) + TextEdit{ + id:statusItem + selectByMouse: true + readOnly:true + color: textFieldStyle.background.border.color.error + width:parent.width + anchors.bottom:parent.bottom + anchors.bottomMargin: 2 + anchors.right:parent.right + anchors.rightMargin:10 + toolsContainer.width + horizontalAlignment:Text.AlignRight + verticalAlignment: Text.AlignVCenter + wrapMode: TextEdit.WordWrap + font { + italic: true + pointSize: textFieldStyle.text.pointSize + } + visible:error!= '' + text:error } - MouseArea{ - anchors.fill: parent - onClicked: textField.iconClicked() - } - } - bottomPadding: (statusItem.visible?statusItem.implicitHeight:2) - TextEdit{ - id:statusItem - selectByMouse: true - readOnly:true - color: textFieldStyle.background.border.color.error - width:parent.width - anchors.bottom:parent.bottom - anchors.bottomMargin: 2 - anchors.right:parent.right - anchors.rightMargin:10 + toolsContainer.width - horizontalAlignment:Text.AlignRight - verticalAlignment: Text.AlignVCenter - wrapMode: TextEdit.WordWrap - font { - italic: true - pointSize: textFieldStyle.text.pointSize - } - visible:error!= '' - text:error - } Keys.onPressed:{ if( event.key == Qt.Key_Escape) focus = false diff --git a/linphone-app/ui/modules/Common/Form/SearchBox.qml b/linphone-app/ui/modules/Common/Form/SearchBox.qml index e8d738772..7e4efc027 100644 --- a/linphone-app/ui/modules/Common/Form/SearchBox.qml +++ b/linphone-app/ui/modules/Common/Form/SearchBox.qml @@ -76,7 +76,7 @@ Item { TextField { id: searchField - icon: 'search_custom' + icon: text == '' ? SearchBoxStyle.searchIcon : SearchBoxStyle.cancelIcon overwriteColor: SearchBoxStyle.iconColor iconSize: height readOnly: !searchBox.enabled diff --git a/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml index 16f544505..ed5609bd7 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml @@ -8,4 +8,6 @@ QtObject { property string sectionName: 'SearchBox' property color shadowColor: ColorsList.add(sectionName+'_shadow', 'l').color property color iconColor: ColorsList.add(sectionName+'_icon', 'c').color + property string searchIcon: 'search_custom' + property string cancelIcon: 'close_custom' } diff --git a/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml b/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml index 96cd9cb5b..edc018b43 100644 --- a/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml +++ b/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml @@ -333,7 +333,7 @@ Rectangle { anchors.topMargin: 5 anchors.bottomMargin: 5 width: parent.width - 14 - icon: 'search_custom' + icon: text == '' ? 'search_custom' : 'close_custom' iconSize: 30 overwriteColor: TimelineStyle.searchField.color //: 'Search in the list' : ths is a placeholder when searching something in the timeline list diff --git a/linphone-app/ui/views/App/Calls/Dialogs/CallSipAddress.qml b/linphone-app/ui/views/App/Calls/Dialogs/CallSipAddress.qml index 10765b3b9..74b5921b6 100644 --- a/linphone-app/ui/views/App/Calls/Dialogs/CallSipAddress.qml +++ b/linphone-app/ui/views/App/Calls/Dialogs/CallSipAddress.qml @@ -46,7 +46,7 @@ DialogPlus { Layout.fillWidth: true - icon: 'search_custom' + icon: text == '' ? 'search_custom' : 'close_custom' overwriteColor: CallSipAddressStyle.searchField.color onTextChanged: sipAddressesModel.setFilter(text) diff --git a/linphone-app/ui/views/App/Calls/Dialogs/CallTransfer.qml b/linphone-app/ui/views/App/Calls/Dialogs/CallTransfer.qml index 0154f1c88..e4a914ecb 100644 --- a/linphone-app/ui/views/App/Calls/Dialogs/CallTransfer.qml +++ b/linphone-app/ui/views/App/Calls/Dialogs/CallTransfer.qml @@ -68,7 +68,7 @@ DialogPlus { Layout.fillWidth: true - icon: 'search_custom' + icon: text == '' ? 'search_custom' : 'close_custom' overwriteColor: CallTransferStyle.searchField.color onTextChanged: sipAddressesModel.setFilter(text) diff --git a/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml b/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml index e8602113c..076893695 100644 --- a/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml +++ b/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml @@ -78,7 +78,7 @@ DialogPlus { Layout.fillWidth: true - icon: 'search_custom' + icon: text == '' ? 'search_custom' : 'close_custom' overwriteColor: ConferenceManagerStyle.searchField.color onTextChanged: conferenceHelperModel.setFilter(text) diff --git a/linphone-app/ui/views/App/Dialog/NewConference.qml b/linphone-app/ui/views/App/Dialog/NewConference.qml index 41f0bd360..0d10bb244 100644 --- a/linphone-app/ui/views/App/Dialog/NewConference.qml +++ b/linphone-app/ui/views/App/Dialog/NewConference.qml @@ -306,7 +306,6 @@ DialogPlus { } text: conferenceManager.conferenceInfoModel ? conferenceManager.conferenceInfoModel.dateTime.toLocaleDateString(scheduleForm.locale, Qt.ISODate) : '' icon: 'drop_down_custom' - showWhenEmpty: false MouseArea{ anchors.fill: parent onClicked: { @@ -331,7 +330,6 @@ DialogPlus { text: conferenceManager.conferenceInfoModel? conferenceManager.conferenceInfoModel.dateTime.toLocaleTimeString(scheduleForm.locale, 'hh:mm') : '' icon: 'drop_down_custom' - showWhenEmpty: false onEditingFinished: if(rightStackView.currentItemType === 2) { rightStackView.currentItemType = 0 rightStackView.pop() diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index fbd18327f..912fa9256 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -575,16 +575,12 @@ ColumnLayout { margins: 0 } width: parent.width-14 - icon: 'close_custom' + icon: text != '' ? 'close_custom' : 'search_custom' overwriteColor: ConversationStyle.filters.iconColor - showWhenEmpty: false //: 'Search in messages' : this is a placeholder when searching something in the timeline list placeholderText: qsTr('searchMessagesPlaceholder') onTextChanged: searchDelay.restart() - onIconClicked: { - searchView.text = '' - } font.pointSize: ConversationStyle.filters.pointSize Timer{