Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
void HistoryMessagesTab::removeEntries()
{
    QDate date = TimelineView->currentDate();
    if (!Storage || !date.isValid())
        return;

    Storage->deleteMessages(CurrentTalkable, date);
    displayTalkable(CurrentTalkable, true);
}
Exemplo n.º 3
0
void HistoryMessagesTab::updateData()
{
    if (!Storage)
    {
        setTalkables(QVector<Talkable>());
        displayTalkable(Talkable(), false);
        return;
    }

    setFutureTalkables(Storage->talkables());
}
Exemplo n.º 4
0
void HistoryMessagesTab::currentTalkableChanged(const Talkable &talkable)
{
	displayTalkable(talkable, false);
}