Fix mobile ExploreComponent
Make sure that the search filter is removed when another button is pressed. Make sure that the popup closes when one of the other menus is open. Make the separator is at the top on NavigationTabBar
This commit is contained in:
@@ -10,9 +10,8 @@ import org.kde.kirigamiaddons.delegates as Delegates
|
|||||||
|
|
||||||
import org.kde.neochat
|
import org.kde.neochat
|
||||||
|
|
||||||
ColumnLayout {
|
Kirigami.NavigationTabBar {
|
||||||
id: root
|
id: root
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The connection for the current user.
|
* @brief The connection for the current user.
|
||||||
@@ -24,12 +23,8 @@ ColumnLayout {
|
|||||||
*/
|
*/
|
||||||
signal textChanged(string newText)
|
signal textChanged(string newText)
|
||||||
|
|
||||||
Kirigami.Separator {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
Kirigami.NavigationTabBar {
|
|
||||||
id: exploreTabBar
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
actions: [
|
actions: [
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
id: infoAction
|
id: infoAction
|
||||||
@@ -38,20 +33,21 @@ ColumnLayout {
|
|||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (explorePopup.visible && explorePopupLoader.sourceComponent == search) {
|
if (explorePopup.visible && explorePopupLoader.sourceComponent == search) {
|
||||||
explorePopup.close();
|
explorePopup.close();
|
||||||
exploreTabBar.currentIndex = -1;
|
root.currentIndex = -1;
|
||||||
} else if (explorePopup.visible && explorePopupLoader.sourceComponent != search) {
|
} else if (explorePopup.visible && explorePopupLoader.sourceComponent != search) {
|
||||||
explorePopup.close();
|
explorePopup.close();
|
||||||
explorePopup.open();
|
explorePopup.open();
|
||||||
} else {
|
} else {
|
||||||
explorePopup.open();
|
explorePopup.open();
|
||||||
}
|
}
|
||||||
explorePopupLoader.sourceComponent = search;
|
explorePopupLoader.switchComponent(search);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Explore rooms")
|
text: i18n("Explore rooms")
|
||||||
icon.name: "compass"
|
icon.name: "compass"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
explorePopup.close();
|
||||||
let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), {
|
let dialog = pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ExploreRoomsPage'), {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
@@ -60,19 +56,20 @@ ColumnLayout {
|
|||||||
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => {
|
||||||
RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join");
|
RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join");
|
||||||
});
|
});
|
||||||
exploreTabBar.currentIndex = -1;
|
root.currentIndex = -1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Find your friends")
|
text: i18n("Find your friends")
|
||||||
icon.name: "list-add-user"
|
icon.name: "list-add-user"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
explorePopup.close();
|
||||||
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), {
|
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'UserSearchPage'), {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
title: i18nc("@title", "Find your friends")
|
title: i18nc("@title", "Find your friends")
|
||||||
});
|
});
|
||||||
exploreTabBar.currentIndex = -1;
|
root.currentIndex = -1;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
@@ -81,18 +78,17 @@ ColumnLayout {
|
|||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (explorePopup.visible && explorePopupLoader.sourceComponent == create) {
|
if (explorePopup.visible && explorePopupLoader.sourceComponent == create) {
|
||||||
explorePopup.close();
|
explorePopup.close();
|
||||||
exploreTabBar.currentIndex = -1;
|
root.currentIndex = -1;
|
||||||
} else if (explorePopup.visible && explorePopupLoader.sourceComponent != create) {
|
} else if (explorePopup.visible && explorePopupLoader.sourceComponent != create) {
|
||||||
explorePopup.close();
|
explorePopup.close();
|
||||||
explorePopup.open();
|
explorePopup.open();
|
||||||
} else {
|
} else {
|
||||||
explorePopup.open();
|
explorePopup.open();
|
||||||
}
|
}
|
||||||
explorePopupLoader.sourceComponent = create;
|
explorePopupLoader.switchComponent(create);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
|
||||||
|
|
||||||
QQC2.Popup {
|
QQC2.Popup {
|
||||||
id: explorePopup
|
id: explorePopup
|
||||||
@@ -110,6 +106,13 @@ ColumnLayout {
|
|||||||
contentItem: Loader {
|
contentItem: Loader {
|
||||||
id: explorePopupLoader
|
id: explorePopupLoader
|
||||||
sourceComponent: search
|
sourceComponent: search
|
||||||
|
|
||||||
|
function switchComponent(newComponent) {
|
||||||
|
if (sourceComponent == search) {
|
||||||
|
root.textChanged("");
|
||||||
|
}
|
||||||
|
sourceComponent = newComponent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: ColumnLayout {
|
background: ColumnLayout {
|
||||||
|
|||||||
Reference in New Issue
Block a user