fix(search): fix profile popup opened on search title clicked
Fixes #4795 Makes sure to only open the profile popup if the click is a pubkey. Also opens the popup on ctrl+f
This commit is contained in:
parent
8c95e65ebf
commit
58935b82d7
|
@ -7,15 +7,11 @@ QtObject:
|
||||||
View* = ref object of QObject
|
View* = ref object of QObject
|
||||||
delegate: io_interface.AccessInterface
|
delegate: io_interface.AccessInterface
|
||||||
searchResultModel: result_model.Model
|
searchResultModel: result_model.Model
|
||||||
searchResultModelVariant: QVariant
|
|
||||||
locationMenuModel: location_menu_model.Model
|
locationMenuModel: location_menu_model.Model
|
||||||
locationMenuModelVariant: QVariant
|
|
||||||
|
|
||||||
proc delete*(self: View) =
|
proc delete*(self: View) =
|
||||||
self.searchResultModel.delete
|
self.searchResultModel.delete
|
||||||
self.searchResultModelVariant.delete
|
|
||||||
self.locationMenuModel.delete
|
self.locationMenuModel.delete
|
||||||
self.locationMenuModelVariant.delete
|
|
||||||
self.QObject.delete
|
self.QObject.delete
|
||||||
|
|
||||||
proc newView*(delegate: io_interface.AccessInterface): View =
|
proc newView*(delegate: io_interface.AccessInterface): View =
|
||||||
|
@ -23,9 +19,7 @@ QtObject:
|
||||||
result.QObject.setup
|
result.QObject.setup
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
result.searchResultModel = result_model.newModel()
|
result.searchResultModel = result_model.newModel()
|
||||||
result.searchResultModelVariant = newQVariant(result.searchResultModel)
|
|
||||||
result.locationMenuModel = location_menu_model.newModel()
|
result.locationMenuModel = location_menu_model.newModel()
|
||||||
result.locationMenuModelVariant = newQVariant(result.locationMenuModel)
|
|
||||||
|
|
||||||
proc load*(self: View) =
|
proc load*(self: View) =
|
||||||
self.delegate.viewDidLoad()
|
self.delegate.viewDidLoad()
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ccfe8cc0ff7f32993f0aef996fe45fa6960b1e3e
|
Subproject commit 8495fae8a50c3a7da7796c3348208bfc6aa0c47e
|
|
@ -197,7 +197,7 @@ Item {
|
||||||
store: rootStore
|
store: rootStore
|
||||||
}
|
}
|
||||||
|
|
||||||
AppSearch{
|
AppSearch {
|
||||||
id: appSearch
|
id: appSearch
|
||||||
store: appMain.rootStore.appSearchStore
|
store: appMain.rootStore.appSearchStore
|
||||||
}
|
}
|
||||||
|
@ -695,6 +695,7 @@ Item {
|
||||||
Action {
|
Action {
|
||||||
shortcut: "Ctrl+K"
|
shortcut: "Ctrl+K"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
// FIXME the focus is no longer on the AppMain when the popup is opened, so this does not work to close
|
||||||
if (channelPicker.opened) {
|
if (channelPicker.opened) {
|
||||||
channelPicker.close()
|
channelPicker.close()
|
||||||
} else {
|
} else {
|
||||||
|
@ -702,6 +703,17 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Action {
|
||||||
|
shortcut: "Ctrl+F"
|
||||||
|
onTriggered: {
|
||||||
|
// FIXME the focus is no longer on the AppMain when the popup is opened, so this does not work to close
|
||||||
|
if (appSearch.opened) {
|
||||||
|
appSearch.closeSearchPopup()
|
||||||
|
} else {
|
||||||
|
appSearch.openSearchPopup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StatusSearchListPopup {
|
StatusSearchListPopup {
|
||||||
id: channelPicker
|
id: channelPicker
|
||||||
|
|
|
@ -11,19 +11,22 @@ Item {
|
||||||
readonly property var searchMessages: Backpressure.debounce(searchPopup, 400, function (value) {
|
readonly property var searchMessages: Backpressure.debounce(searchPopup, 400, function (value) {
|
||||||
appSearch.store.searchMessages(value)
|
appSearch.store.searchMessages(value)
|
||||||
})
|
})
|
||||||
|
property alias opened: searchPopup.opened
|
||||||
|
|
||||||
function openSearchPopup(){
|
function openSearchPopup(){
|
||||||
searchPopup.open()
|
searchPopup.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeSearchPopup(){
|
||||||
|
searchPopup.close()
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: appSearch.store.locationMenuModel
|
target: appSearch.store.locationMenuModel
|
||||||
onModelAboutToBeReset: {
|
onModelAboutToBeReset: {
|
||||||
for (var i = 2; i <= searchPopupMenu.count; i++) {
|
while (searchPopupMenu.takeItem(searchPopupMenu.numDefaultItems)) {
|
||||||
//clear menu
|
// Delete the item right after the default items
|
||||||
if (!!searchPopupMenu.takeItem(i)) {
|
// If takeItem returns null, it means there was nothing to remove
|
||||||
searchPopupMenu.removeItem(searchPopupMenu.takeItem(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,9 +127,9 @@ Item {
|
||||||
searchPopup.close()
|
searchPopup.close()
|
||||||
appSearch.store.resultItemClicked(itemId)
|
appSearch.store.resultItemClicked(itemId)
|
||||||
}
|
}
|
||||||
|
acceptsTitleClick: function (titleId) {
|
||||||
onResultItemTitleClicked: {
|
return Utils.isChatKey(titleId)
|
||||||
return Global.openProfilePopup(titleId)
|
|
||||||
}
|
}
|
||||||
|
onResultItemTitleClicked: Global.openProfilePopup(titleId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue