SingleWindow::~SingleWindow() { KaduWindow *kadu = m_kaduWindowService->kaduWindow(); bool visible = isVisible(); m_configuration->deprecatedApi()->writeEntry("SingleWindow", "KaduWindowWidth", kadu->width()); disconnect(m_chatWidgetManager, 0, this, 0); disconnect(m_tabs, 0, this, 0); disconnect(kadu, 0, this, 0); if (!m_sessionService->isClosing()) { for (int i = m_tabs->count()-1; i >= 0; --i) { ChatWidget *chatWidget = static_cast<ChatWidget *>(m_tabs->widget(i)); const Chat &chat = chatWidget->chat(); m_tabs->removeTab(i); delete chatWidget; m_chatWidgetManager->openChat(chat, OpenChatActivation::DoNotActivate); } } kadu->setParent(0); if (!m_sessionService->isClosing()) kadu->setVisible(visible); }
TalkableProxyModel * ChatEditBox::talkableProxyModel() { ChatWidget *cw = chatWidget(); if (cw && cw->chat().contacts().count() > 1) return cw->talkableProxyModel(); return 0; }
void ShowHistoryAction::showDaysMessages(QAction *action, int days) { Action *act = qobject_cast<Action *>(action); Chat actionChat = act ? act->context()->chat() : Chat::null; ChatWidget *chatWidget = action->data().value<ChatWidget *>(); if (!chatWidget) { m_historyWindowService->show(actionChat); return; } WebkitMessagesView *chatMessagesView = chatWidget->chatMessagesView(); if (!chatMessagesView) { m_historyWindowService->show(actionChat); return; } chatMessagesView->setForcePruneDisabled(0 != days); if (-1 == days) { m_historyWindowService->show(chatWidget->chat()); return; } const Chat &buddyChat = m_buddyChatManager->buddyChat(chatWidget->chat()); const Chat &messagesChat = buddyChat ? buddyChat : chatWidget->chat(); HistoryStorage *historyStorage = m_history->currentStorage(); if (!historyStorage) return; HistoryQuery query; query.setTalkable(messagesChat); if (0 == days) query.setLimit(configuration()->deprecatedApi()->readUnsignedNumEntry("History", "ChatHistoryCitation", 10)); else query.setFromDate(QDate::currentDate().addDays(-days)); new HistoryMessagesPrepender(historyStorage->messages(query), chatMessagesView); }
void TabsManager::onTabChange(int index) { if (index < 0) return; ChatWidget *chatWidget = static_cast<ChatWidget *>(TabDialog->widget(index)); Title->setActiveChatWidget(chatWidget); const Chat &chat = chatWidget->chat(); if (chat.unreadMessagesCount() > 0) emit chatWidgetActivated(chatWidget); //TabDialog->setWindowTitle(chatWidget->title()->title()); //TabDialog->setWindowIcon(chatWidget->title()->icon()); chatWidget->edit()->setFocus(); }