Fix bad thread on Contact creation.
Fix contact selection after creation.
This commit is contained in:
parent
cde6bc0788
commit
28bb188941
6 changed files with 40 additions and 20 deletions
|
|
@ -84,13 +84,13 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &contact, bool is
|
||||||
mStarred = contact->getStarred();
|
mStarred = contact->getStarred();
|
||||||
mIsSaved = true;
|
mIsSaved = true;
|
||||||
mIsStored = isStored;
|
mIsStored = isStored;
|
||||||
|
mIsLdap = ToolModel::friendIsInFriendList(ToolModel::getLdapFriendList(), contact);
|
||||||
} else {
|
} else {
|
||||||
mIsSaved = false;
|
mIsSaved = false;
|
||||||
mStarred = false;
|
mStarred = false;
|
||||||
mIsStored = false;
|
mIsStored = false;
|
||||||
|
mIsLdap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mIsLdap = ToolModel::friendIsInFriendList(ToolModel::getLdapFriendList(), contact);
|
|
||||||
connect(this, &FriendCore::addressChanged, &FriendCore::allAddressesChanged);
|
connect(this, &FriendCore::addressChanged, &FriendCore::allAddressesChanged);
|
||||||
connect(this, &FriendCore::phoneNumberChanged, &FriendCore::allAddressesChanged);
|
connect(this, &FriendCore::phoneNumberChanged, &FriendCore::allAddressesChanged);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ int MagicSearchProxy::loadUntil(const QString &address) {
|
||||||
if (listIndex == -1) return -1;
|
if (listIndex == -1) return -1;
|
||||||
listIndex =
|
listIndex =
|
||||||
dynamic_cast<SortFilterList *>(sourceModel())->mapFromSource(magicSearchList->index(listIndex, 0)).row();
|
dynamic_cast<SortFilterList *>(sourceModel())->mapFromSource(magicSearchList->index(listIndex, 0)).row();
|
||||||
if (mMaxDisplayItems < listIndex) setMaxDisplayItems(listIndex + mDisplayItemsStep);
|
if (mMaxDisplayItems <= listIndex) setMaxDisplayItems(listIndex + mDisplayItemsStep);
|
||||||
return listIndex;
|
return listIndex;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,10 @@ ListView {
|
||||||
mainItem.highlightedContact = item.searchResultItem
|
mainItem.highlightedContact = item.searchResultItem
|
||||||
item.forceActiveFocus()
|
item.forceActiveFocus()
|
||||||
updatePosition()
|
updatePosition()
|
||||||
|
_moveToIndex = false
|
||||||
}else{// Move on the next items load.
|
}else{// Move on the next items load.
|
||||||
_moveToIndex = true
|
// If visible, try to wait loading
|
||||||
|
_moveToIndex = visible
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
mainItem.currentIndex = -1
|
mainItem.currentIndex = -1
|
||||||
|
|
@ -77,12 +79,10 @@ ListView {
|
||||||
if(headerItem) {
|
if(headerItem) {
|
||||||
headerItem.forceActiveFocus()
|
headerItem.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
_moveToIndex = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onCountChanged: if(_moveToIndex && count > mainItem.currentIndex ){
|
|
||||||
_moveToIndex = false
|
|
||||||
selectIndex(mainItem.currentIndex)
|
|
||||||
}
|
|
||||||
onContactSelected: updatePosition()
|
onContactSelected: updatePosition()
|
||||||
onExpandedChanged: if(!expanded) updatePosition()
|
onExpandedChanged: if(!expanded) updatePosition()
|
||||||
keyNavigationEnabled: false
|
keyNavigationEnabled: false
|
||||||
|
|
@ -116,6 +116,20 @@ ListView {
|
||||||
magicSearchProxy.forceUpdate()
|
magicSearchProxy.forceUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Workaround: itemAtIndex and count are decorellated and are not enough to know when the ListView has load all its children.
|
||||||
|
// So when itemAtIndex is not available, start this timer along count changed signal.
|
||||||
|
Timer{
|
||||||
|
id: delaySelection
|
||||||
|
interval: 100
|
||||||
|
running: _moveToIndex
|
||||||
|
onTriggered: {
|
||||||
|
_moveToIndex = false
|
||||||
|
if(count > mainItem.currentIndex) selectIndex(mainItem.currentIndex)
|
||||||
|
else{
|
||||||
|
_moveToIndex = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
header: FocusScope{
|
header: FocusScope{
|
||||||
id: headerItem
|
id: headerItem
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,7 @@ MainRightPanel {
|
||||||
target: contact.core
|
target: contact.core
|
||||||
function onIsSavedChanged() {
|
function onIsSavedChanged() {
|
||||||
if (contact.core.isSaved) {
|
if (contact.core.isSaved) {
|
||||||
var mainWin = UtilsCpp.getMainWindow()
|
mainItem.closeEdition(contact.core.defaultFullAddress)
|
||||||
UtilsCpp.smartShowWindow(mainWin)
|
|
||||||
mainWin.displayContactPage(contact)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,13 +26,13 @@ MainRightPanel {
|
||||||
property string oldPictureUri
|
property string oldPictureUri
|
||||||
property int addressCount: 0
|
property int addressCount: 0
|
||||||
|
|
||||||
signal closeEdition()
|
signal closeEdition(var redirectAddress)
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
mainItem.contact.core.undo()
|
mainItem.contact.core.undo()
|
||||||
mainItem.closeEdition()
|
mainItem.closeEdition('')
|
||||||
}
|
}
|
||||||
width: 278 * DefaultStyle.dp
|
width: 278 * DefaultStyle.dp
|
||||||
text: qsTr("Les changements seront annulés. Souhaitez-vous continuer ?")
|
text: qsTr("Les changements seront annulés. Souhaitez-vous continuer ?")
|
||||||
|
|
@ -81,7 +79,6 @@ MainRightPanel {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mainItem.contact.core.save()
|
mainItem.contact.core.save()
|
||||||
mainItem.closeEdition()
|
|
||||||
}
|
}
|
||||||
bannerContent: [
|
bannerContent: [
|
||||||
IconLabelButton {
|
IconLabelButton {
|
||||||
|
|
|
||||||
|
|
@ -18,20 +18,26 @@ AbstractMainPage {
|
||||||
property bool leftPanelEnabled: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactEdition"
|
property bool leftPanelEnabled: !rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactEdition"
|
||||||
property FriendGui selectedContact
|
property FriendGui selectedContact
|
||||||
property string initialFriendToDisplay
|
property string initialFriendToDisplay
|
||||||
onInitialFriendToDisplayChanged: if (initialFriendToDisplay != '' && contactList.selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = ""
|
onInitialFriendToDisplayChanged: {
|
||||||
|
if (initialFriendToDisplay != '' && contactList.selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = ""
|
||||||
|
else if(initialFriendToDisplay != '') console.warn("Abstract not selected yet: ", initialFriendToDisplay)
|
||||||
|
}
|
||||||
|
|
||||||
onVisibleChanged: if (!visible) {
|
onVisibleChanged: if (!visible) {
|
||||||
rightPanelStackView.clear()
|
rightPanelStackView.clear()
|
||||||
contactList.resetSelections()
|
contactList.resetSelections()
|
||||||
}
|
}
|
||||||
|
function updateRightPanel(){
|
||||||
onSelectedContactChanged: {
|
|
||||||
if (selectedContact) {
|
if (selectedContact) {
|
||||||
|
while(rightPanelStackView.depth > 1) rightPanelStackView.pop()
|
||||||
if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactDetail") rightPanelStackView.push(contactDetail)
|
if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactDetail") rightPanelStackView.push(contactDetail)
|
||||||
} else {
|
} else {
|
||||||
if (rightPanelStackView.currentItem && rightPanelStackView.currentItem.objectName === "contactDetail") rightPanelStackView.clear()
|
if (rightPanelStackView.currentItem && rightPanelStackView.currentItem.objectName === "contactDetail") rightPanelStackView.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onSelectedContactChanged: {
|
||||||
|
updateRightPanel()
|
||||||
|
}
|
||||||
|
|
||||||
onNoItemButtonPressed: createContact("", "")
|
onNoItemButtonPressed: createContact("", "")
|
||||||
|
|
||||||
|
|
@ -747,9 +753,11 @@ AbstractMainPage {
|
||||||
id: contactEdition
|
id: contactEdition
|
||||||
ContactEdition {
|
ContactEdition {
|
||||||
property string objectName: "contactEdition"
|
property string objectName: "contactEdition"
|
||||||
onCloseEdition: {
|
onCloseEdition: redirectAddress => {
|
||||||
if (rightPanelStackView.depth <= 1) rightPanelStackView.clear()
|
updateRightPanel()
|
||||||
else rightPanelStackView.pop(Control.StackView.Immediate)
|
if(redirectAddress){
|
||||||
|
initialFriendToDisplay = redirectAddress
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ ApplicationWindow {
|
||||||
property bool isFullscreen: visibility == Window.FullScreen
|
property bool isFullscreen: visibility == Window.FullScreen
|
||||||
onIsFullscreenChanged: DesktopToolsCpp.screenSaverStatus = !isFullscreen
|
onIsFullscreenChanged: DesktopToolsCpp.screenSaverStatus = !isFullscreen
|
||||||
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: mainWindow.contentItem.forceActiveFocus()
|
onClicked: mainWindow.contentItem.forceActiveFocus()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue