void MediaPlayer::setChatWidgetRepository(ChatWidgetRepository *chatWidgetRepository) { m_chatWidgetRepository = chatWidgetRepository; if (m_chatWidgetRepository) { // Monitor of creating chats connect(m_chatWidgetRepository.data(), SIGNAL(chatWidgetAdded(ChatWidget *)), this, SLOT(chatWidgetAdded(ChatWidget *))); connect(m_chatWidgetRepository.data(), SIGNAL(chatWidgetRemoved(ChatWidget *)), this, SLOT(chatWidgetRemoved(ChatWidget *))); for (ChatWidget *chatWidget : m_chatWidgetRepository.data()) chatWidgetAdded(chatWidget); } }
void ChatWidgetMessageHandler::init() { connect(m_chatWidgetActivationService, SIGNAL(chatWidgetActivated(ChatWidget*)), this, SLOT(chatWidgetActivated(ChatWidget*))); connect(m_chatWidgetRepository.data(), SIGNAL(chatWidgetAdded(ChatWidget*)), this, SLOT(chatWidgetAdded(ChatWidget*))); connect(m_chatWidgetRepository.data(), SIGNAL(chatWidgetRemoved(ChatWidget*)), this, SLOT(chatWidgetRemoved(ChatWidget*))); for (auto chatWidget : m_chatWidgetRepository.data()) chatWidgetAdded(chatWidget); // some other messageReceived slot may check if message chat is open and this // slot can change this value, so let all other messageReceived be executed before this connect(m_messageManager.data(), SIGNAL(messageReceived(Message)), this, SLOT(messageReceived(Message)), Qt::QueuedConnection); connect(m_messageManager.data(), SIGNAL(messageSent(Message)), this, SLOT(messageSent(Message)), Qt::QueuedConnection); }
void WordFix::init() { ExtractBody.setPattern("<body[^>]*>.*</body>"); // Loading list QString data = m_configuration->deprecatedApi()->readEntry("word_fix", "WordFix_list"); if (data.isEmpty()) { QFile defList(m_pathsProvider->dataPath() + QStringLiteral("plugins/data/word_fix/wf_default_list.data")); if (defList.open(QIODevice::ReadOnly)) { QTextStream s(&defList); QStringList pair; while (!s.atEnd()) { pair = s.readLine().split('|'); if (pair.isEmpty()) continue; // TODO why we are not checking if there are actually at least 2 items? m_wordsList[pair.at(0)] = pair.at(1); } defList.close(); } } else { QStringList list = data.split("\t\t"); for (int i = 0; i < list.count(); i++) { if (!list.at(i).isEmpty()) { QStringList sp = list.at(i).split('\t'); m_wordsList[sp.at(0)] = sp.at(1); } } } connect(m_chatWidgetRepository, SIGNAL(chatWidgetAdded(ChatWidget *)), this, SLOT(chatWidgetAdded(ChatWidget *))); connect( m_chatWidgetRepository, SIGNAL(chatWidgetRemoved(ChatWidget *)), this, SLOT(chatWidgetRemoved(ChatWidget *))); for (auto chatWidget : m_chatWidgetRepository) chatWidgetAdded(chatWidget); }