void HistoryMessagesTab::clearTalkableHistory() { if (!Storage) return; Q_ASSERT(TalkableTree->selectionModel()); const QModelIndexList &selectedIndexes = TalkableTree->selectionModel()->selectedIndexes(); QList<Talkable> talkables; MessageDialog *dialog = MessageDialog::create( m_iconsManager->iconByPath(KaduIcon("dialog-question")), tr("Kadu"), tr("Do you really want to delete history?")); dialog->addButton(QMessageBox::Yes, tr("Delete history")); dialog->addButton(QMessageBox::No, tr("Cancel")); if (!dialog->ask()) return; for (auto const &selectedIndex : selectedIndexes) { Talkable talkable = selectedIndex.data(TalkableRole).value<Talkable>(); if (!talkable.isEmpty()) Storage->deleteMessages(talkable); } updateData(); displayTalkable(Talkable(), true); }
void HistoryMessagesTab::removeEntries() { QDate date = TimelineView->currentDate(); if (!Storage || !date.isValid()) return; Storage->deleteMessages(CurrentTalkable, date); displayTalkable(CurrentTalkable, true); }
void HistoryMessagesTab::updateData() { if (!Storage) { setTalkables(QVector<Talkable>()); displayTalkable(Talkable(), false); return; } setFutureTalkables(Storage->talkables()); }
void HistoryMessagesTab::currentTalkableChanged(const Talkable &talkable) { displayTalkable(talkable, false); }