Fix room forget and buttons bugs

This commit is contained in:
miruka 2019-04-26 16:52:26 -04:00
parent 5988eccdbb
commit c7dd602687
6 changed files with 33 additions and 17 deletions

View File

@ -93,8 +93,6 @@ class Backend(QObject):
room_id, self.past_tokens[room_id], limit
)
break
else:
raise ValueError(f"Room not found in any client: {room_id}")
@pyqtSlot()

View File

@ -23,6 +23,11 @@ class ListModelMap(QObject):
return self.dict[key]
@pyqtSlot(str, result=bool)
def has(self, key) -> bool:
return key in self.dict
def __getitem__(self, key) -> ListModel:
return self.dict[key]

View File

@ -194,6 +194,10 @@ class SignalManager(QObject):
.fromMSecsSinceEpoch(edict["server_timestamp"])
new_event = RoomEvent(type=etype, dateTime=date_time, dict=edict)
if etype == "RoomCreateEvent":
print(room_id, "ff")
self.backend.fully_loaded_rooms.add(room_id)
if self._events_in_transfer:
local_echoes_met: int = 0
update_at: Optional[int] = None

View File

@ -60,6 +60,7 @@ Button {
}
MouseArea {
z: 101
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true

View File

@ -81,27 +81,34 @@ Rectangle {
iconName: modelData.iconName
display: bannerButtons.displayMode
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
onClicked: {
if (alreadyClicked) { return }
iconName = "hourglass"
alreadyClicked = true
// modelData might become undefined after Backend call
// modelData might be undefined after Backend call
var signalId = modelData.signalId
var iconName_ = modelData.iconName
var isForget =
modelData.clientFunction === "forgetRoom"
var future =
Backend.clientManager.clients[chatPage.userId].
call(modelData.clientFunction,
modelData.clientArgs)
if (! isForget) {
future.onGotResult.connect(function() {
iconName = iconName_
iconName = modelData.iconName
})
}
if (signalId) { buttonClicked(signalId) }
}
}
Layout.maximumWidth: bannerButtons.compact ? height : -1
Layout.fillHeight: true

View File

@ -111,6 +111,7 @@ Image {
Base.HButton {
text: qsTr("Login")
Layout.fillWidth: true
}
Base.HButton {
text: qsTr("Forgot?")