| 200 | } |
| 201 | |
| 202 | void StSecurityFileTransfer::LoadPage(int page) { |
| 203 | if (!list_widget_) { |
| 204 | return; |
| 205 | } |
| 206 | |
| 207 | context_->PostDBTask([=, this]() { |
| 208 | if (!ft_record_op_) { |
| 209 | ft_record_op_ = context_->GetDatabase()->GetFileTransferRecordOp(); |
| 210 | } |
| 211 | records_.clear(); |
| 212 | auto total_count = ft_record_op_->GetTotalCounts(); |
| 213 | |
| 214 | records_.push_back(std::make_shared<FileTransferRecord>(FileTransferRecord { |
| 215 | .id_ = 0, |
| 216 | .begin_ = 1, |
| 217 | .end_ = 1, |
| 218 | .visitor_device_ = "", |
| 219 | .target_device_ = "", |
| 220 | })); |
| 221 | |
| 222 | auto records = ft_record_op_->QueryFileTransferRecords(page, kPageSize); |
| 223 | for (const auto& r : records) { |
| 224 | records_.push_back(r); |
| 225 | } |
| 226 | |
| 227 | context_->PostUITask([=, this]() { |
| 228 | |
| 229 | page_widget_->setMaxPage(total_count/kPageSize+1); |
| 230 | |
| 231 | auto index = 0; |
| 232 | int count = list_widget_->count(); |
| 233 | for (int i = 0; i < count; i++) { |
| 234 | auto item = list_widget_->takeItem(0); |
| 235 | delete item; |
| 236 | } |
| 237 | |
| 238 | for (const auto& item_info : records_) { |
| 239 | AddItem(item_info); |
| 240 | } |
| 241 | }); |
| 242 | }); |
| 243 | } |
| 244 | |
| 245 | void StSecurityFileTransfer::RegisterActions(int index) { |
| 246 | auto record = records_.at(index); |
nothing calls this directly
no test coverage detected