diff --git a/KTp/Models/contacts-list-model.cpp b/KTp/Models/contacts-list-model.cpp index 31c591a..f217cb0 100644 --- a/KTp/Models/contacts-list-model.cpp +++ b/KTp/Models/contacts-list-model.cpp @@ -1,249 +1,249 @@ /* * Copyright (C) 2012 David Edmundson * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "contacts-list-model.h" #include #include #include #include #include #include #include "debug.h" #include #include "contact.h" #include "presence.h" #include "types.h" class KTp::ContactsListModel::Private { public: Private(): initialized(false) { } QList contacts; KTp::GlobalContactManager *contactManager; bool initialized; }; KTp::ContactsListModel::ContactsListModel(QObject *parent) : QAbstractListModel(parent), d(new KTp::ContactsListModel::Private()) { d->contactManager = nullptr; } KTp::ContactsListModel::~ContactsListModel() { delete d; } void KTp::ContactsListModel::setAccountManager(const Tp::AccountManagerPtr &accountManager) { d->contactManager = new KTp::GlobalContactManager(accountManager, this); connect(d->contactManager, SIGNAL(allKnownContactsChanged(Tp::Contacts,Tp::Contacts)), SLOT(onContactsChanged(Tp::Contacts,Tp::Contacts))); // If there are no enabled account or no account is online, emit the signal // directly, because onContactsChanged won't be called const QList accounts = accountManager->enabledAccounts()->accounts(); if (accounts.isEmpty()) { d->initialized = true; Q_EMIT modelInitialized(true); } else { Q_FOREACH (const Tp::AccountPtr &account, accounts) { if (account->isOnline()) { return; } } d->initialized = true; Q_EMIT modelInitialized(true); } } int KTp::ContactsListModel::rowCount(const QModelIndex &parent) const { if (!parent.isValid()) { return d->contacts.size(); } else { return 0; } } QVariant KTp::ContactsListModel::data(const QModelIndex &index, int role) const { int row = index.row(); if (row >=0 && row < d->contacts.size()) { const KTp::ContactPtr contact = KTp::ContactPtr::qObjectCast(d->contacts[row]); Q_ASSERT_X(!contact.isNull(), "KTp::ContactListModel::data()", "Failed to cast Tp::ContactPtr to KTp::ContactPtr. Are you using KTp::ContactFactory?"); switch (role) { case KTp::RowTypeRole: return KTp::ContactRowType; case Qt::DisplayRole: return contact->alias(); case KTp::IdRole: return contact->id(); case KTp::ContactRole: return QVariant::fromValue(contact); case KTp::AccountRole: return QVariant::fromValue(d->contactManager->accountForContact(contact)); case KTp::ContactClientTypesRole: return contact->clientTypes(); case KTp::ContactAvatarPathRole: return contact->avatarData().fileName; case KTp::ContactAvatarPixmapRole: return contact->avatarPixmap(); case KTp::ContactGroupsRole: return contact->groups(); case KTp::ContactPresenceNameRole: return contact->presence().displayString(); case KTp::ContactPresenceMessageRole: return contact->presence().statusMessage(); case KTp::ContactPresenceTypeRole: return contact->presence().type(); case KTp::ContactPresenceIconRole: return contact->presence().iconName(); case KTp::ContactSubscriptionStateRole: return contact->subscriptionState(); case KTp::ContactPublishStateRole: return contact->publishState(); case KTp::ContactIsBlockedRole: return contact->isBlocked(); case KTp::ContactCanTextChatRole: return contact->textChatCapability(); case KTp::ContactCanFileTransferRole: return contact->fileTransferCapability(); case KTp::ContactCanAudioCallRole: return contact->audioCallCapability(); case KTp::ContactCanVideoCallRole: return contact->videoCallCapability(); case KTp::ContactTubesRole: return QStringList() << contact->streamTubeServicesCapability() << contact->dbusTubeServicesCapability(); default: break; } } return QVariant(); } void KTp::ContactsListModel::onContactsChanged(const Tp::Contacts &added, const Tp::Contacts &removed) { //add contacts. Q_FOREACH(const Tp::ContactPtr &contact_uncasted, added) { KTp::ContactPtr contact = KTp::ContactPtr::qObjectCast(contact_uncasted); connect(contact.data(), SIGNAL(aliasChanged(QString)), SLOT(onChanged())); connect(contact.data(), SIGNAL(avatarTokenChanged(QString)), SLOT(onChanged())); connect(contact.data(), SIGNAL(avatarDataChanged(Tp::AvatarData)), SLOT(onChanged())); connect(contact.data(), SIGNAL(presenceChanged(Tp::Presence)), SLOT(onChanged())); connect(contact->manager()->connection()->selfContact().data(), SIGNAL(capabilitiesChanged(Tp::ContactCapabilities)), SLOT(onChanged())); connect(contact.data(), SIGNAL(capabilitiesChanged(Tp::ContactCapabilities)), SLOT(onChanged())); connect(contact.data(), SIGNAL(locationUpdated(Tp::LocationInfo)), SLOT(onChanged())); connect(contact.data(), SIGNAL(infoFieldsChanged(Tp::Contact::InfoFields)), SLOT(onChanged())); connect(contact.data(), SIGNAL(subscriptionStateChanged(Tp::Contact::PresenceState)), SLOT(onChanged())); connect(contact.data(), SIGNAL(publishStateChanged(Tp::Contact::PresenceState,QString)), SLOT(onChanged())); connect(contact.data(), SIGNAL(blockStatusChanged(bool)), SLOT(onChanged())); connect(contact.data(), SIGNAL(clientTypesChanged(QStringList)), SLOT(onChanged())); connect(contact.data(), SIGNAL(addedToGroup(QString)), SLOT(onChanged())); connect(contact.data(), SIGNAL(removedFromGroup(QString)), SLOT(onChanged())); connect(contact.data(), SIGNAL(invalidated()), SLOT(onConnectionDropped())); } if (added.size() > 0) { beginInsertRows(QModelIndex(), d->contacts.size(), d->contacts.size() + added.size() -1); - d->contacts.append(added.toList()); + d->contacts.append(added.values()); endInsertRows(); } //remove contacts Q_FOREACH(const Tp::ContactPtr &contact, removed) { int row = d->contacts.indexOf(contact); if (row >= 0) { //if contact found in list beginRemoveRows(QModelIndex(), row, row); d->contacts.removeOne(contact); endRemoveRows(); } } if (!d->initialized) { Q_EMIT modelInitialized(true); d->initialized = true; } } void KTp::ContactsListModel::onChanged() { KTp::ContactPtr contact(qobject_cast(sender())); int row = d->contacts.indexOf(contact); if (row > 0) { QModelIndex index = createIndex(row, 0); dataChanged(index, index); } } void KTp::ContactsListModel::onConnectionDropped() { KTp::ContactPtr contact(qobject_cast(sender())); onContactsChanged(Tp::Contacts(), Tp::Contacts() << contact); } diff --git a/KTp/Models/groups-tree-proxy-model.cpp b/KTp/Models/groups-tree-proxy-model.cpp index d393c1c..c8b89ba 100644 --- a/KTp/Models/groups-tree-proxy-model.cpp +++ b/KTp/Models/groups-tree-proxy-model.cpp @@ -1,69 +1,73 @@ /* * Copyright (C) 2012 David Edmundson * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "groups-tree-proxy-model.h" #include "types.h" #include class KTp::GroupsTreeProxyModel::Private { public: //nothing here yet, added anyway in case we need private members without breaking the ABI }; KTp::GroupsTreeProxyModel::GroupsTreeProxyModel(QAbstractItemModel *sourceModel) : AbstractGroupingProxyModel(sourceModel), d(new KTp::GroupsTreeProxyModel::Private()) { } KTp::GroupsTreeProxyModel::~GroupsTreeProxyModel() { delete d; } QSet KTp::GroupsTreeProxyModel::groupsForIndex(const QModelIndex &sourceIndex) const { QStringList groups = sourceIndex.data(KTp::ContactGroupsRole).value(); if (groups.isEmpty()) { groups.append(QLatin1String("_unsorted")); } +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) return groups.toSet(); +#else + return QSet(groups.begin(), groups.end()); +#endif } QVariant KTp::GroupsTreeProxyModel::dataForGroup(const QString &group, int role) const { switch (role) { case KTp::RowTypeRole: return KTp::GroupRowType; case Qt::DisplayRole: if (group == QLatin1String("_unsorted")) { return i18n("Unsorted"); } else { return group; } case KTp::IdRole: return group; } return QVariant(); } diff --git a/KTp/Models/kpeopletranslationproxy.cpp b/KTp/Models/kpeopletranslationproxy.cpp index cdd52da..1452fc9 100644 --- a/KTp/Models/kpeopletranslationproxy.cpp +++ b/KTp/Models/kpeopletranslationproxy.cpp @@ -1,229 +1,227 @@ /* Copyright (C) 2013 Martin Klapetek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "kpeopletranslationproxy.h" #include "KTp/types.h" #include "KTp/global-contact-manager.h" #include #include #include #include using namespace KPeople; KPeopleTranslationProxy::KPeopleTranslationProxy(QObject *parent) : QSortFilterProxyModel(parent) { setDynamicSortFilter(true); } KPeopleTranslationProxy::~KPeopleTranslationProxy() { } QVariant KPeopleTranslationProxy::data(const QModelIndex &proxyIndex, int role) const { if (!proxyIndex.isValid()) { return QVariant(); } // IMPersonsDataSource *imPlugin = qobject_cast(PersonPluginManager::presencePlugin()); // // if (!imPlugin) { // qCWarning(KTP_MODELS) << "No imPlugin"; // return QVariant(); // } // const QModelIndex sourceIndex = mapToSource(proxyIndex); AbstractContact::Ptr contact = sourceIndex.data(KPeople::PersonsModel::PersonVCardRole).value(); switch (role) { case KTp::ContactPresenceTypeRole: return s_presenceStrings.key(contact->customProperty(S_KPEOPLE_PROPERTY_PRESENCE).toString()); case KTp::ContactPresenceIconRole: return KPeople::iconNameForPresenceString(contact->customProperty(S_KPEOPLE_PROPERTY_PRESENCE).toString()); // case KTp::ContactPresenceNameRole: // return sourceIndex.data(PersonsModel::PresenceDisplayRole); case Qt::DisplayRole: return sourceIndex.data(KPeople::PersonsModel::FormattedNameRole); case KTp::RowTypeRole: if (proxyIndex.parent().isValid() || sourceModel()->rowCount(sourceIndex) <= 1) { return KTp::ContactRowType; } else { return KTp::PersonRowType; } // //if the person has max 1 child, it's a fake person, so treat it as contact row // if (sourceIndex.parent().isValid() || sourceModel()->rowCount(sourceIndex) <= 1) { // return KTp::ContactRowType; // } else { // return KTp::PersonRowType; // } // case KTp::ContactAvatarPathRole: // return sourceIndex.data(PersonsModel::PhotosRole); case KTp::ContactAvatarPixmapRole: return sourceIndex.data(KPeople::PersonsModel::PhotoRole); case KTp::ContactUriRole: return contact->customProperty(S_KPEOPLE_PROPERTY_CONTACT_URI); case KTp::IdRole: return contact->customProperty(S_KPEOPLE_PROPERTY_CONTACT_ID); case KTp::ContactIsBlockedRole: return contact->customProperty(S_KPEOPLE_PROPERTY_IS_BLOCKED); // case KTp::HeaderTotalUsersRole: // return sourceModel()->rowCount(sourceIndex); case KTp::ContactGroupsRole: return sourceIndex.data(PersonsModel::GroupsRole); case KTp::PersonIdRole: return sourceIndex.data(PersonsModel::PersonUriRole); case KTp::ContactVCardRole: return sourceIndex.data(KPeople::PersonsModel::PersonVCardRole); } AbstractContact::List contacts = sourceIndex.data(PersonsModel::ContactsVCardRole).value(); int mostOnlineIndex = 0; for (int i = 0; i < contacts.size(); i++) { if (KPeople::presenceSortPriority(contact->customProperty(S_KPEOPLE_PROPERTY_PRESENCE).toString()) < KPeople::presenceSortPriority(contacts.at(mostOnlineIndex)->customProperty(S_KPEOPLE_PROPERTY_PRESENCE).toString())) { mostOnlineIndex = i; } } AbstractContact::Ptr informationContact = contacts.isEmpty() ? contact : contacts.at(mostOnlineIndex); QVariant rValue = dataForKTpContact(informationContact->customProperty(S_KPEOPLE_PROPERTY_ACCOUNT_PATH).toString(), informationContact->customProperty(S_KPEOPLE_PROPERTY_CONTACT_ID).toString(), role); if (rValue.isNull()) { return sourceIndex.data(role); } else { return rValue; } } QVariant KPeopleTranslationProxy::dataForKTpContact(const QString &accountPath, const QString &contactId, int role) const { if (accountPath.isEmpty()) { return QVariant(); } if (role == KTp::AccountRole) { return QVariant::fromValue(KTp::contactManager()->accountForAccountPath(accountPath)); } KTp::ContactPtr ktpContact = KTp::contactManager()->contactForContactId(accountPath, contactId); if (!ktpContact.isNull()) { switch (role) { case KTp::ContactRole: return QVariant::fromValue(ktpContact); break; case KTp::ContactPresenceMessageRole: return ktpContact->presence().statusMessage(); break; case KTp::ContactIsBlockedRole: return ktpContact->isBlocked(); break; case KTp::ContactCanTextChatRole: return true; break; case KTp::ContactCanAudioCallRole: return ktpContact->audioCallCapability(); break; case KTp::ContactCanVideoCallRole: return ktpContact->videoCallCapability(); break; case KTp::ContactCanFileTransferRole: return ktpContact->fileTransferCapability(); break; case KTp::ContactClientTypesRole: return ktpContact->clientTypes(); break; } } return QVariant(); } bool KPeopleTranslationProxy::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const { QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent); //if no valid presence (not even "offline") .. reject the contact return !sourceIndex.data(KPeople::PersonsModel::PersonVCardRole).value()->customProperty(S_KPEOPLE_PROPERTY_PRESENCE).isNull(); } -QVariant KPeopleTranslationProxy::translatePresence(const QVariant &presenceName) const +QVariant KPeopleTranslationProxy::translatePresence(const QVariant &/*presenceName*/) const { - - return Tp::ConnectionPresenceTypeOffline; } QPixmap KPeopleTranslationProxy::contactPixmap(const QModelIndex &index) const { QPixmap avatar; int presenceType = index.data(KTp::ContactPresenceTypeRole).toInt(); //we need some ID to generate proper cache key for this contact //so we'll use the contact's uri const QString id = index.data(KTp::IdRole).toString(); //key for the pixmap cache, so we can look up the avatar const QString keyCache = id + (presenceType == Tp::ConnectionPresenceTypeOffline ? QLatin1String("-offline") : QLatin1String("-online")); //check pixmap cache for the avatar, if not present, load the avatar if (!QPixmapCache::find(keyCache, avatar)){ const QVariantList files = index.data(KTp::ContactAvatarPathRole).toList(); QString file; if (!files.isEmpty()) { file = files.first().toUrl().toLocalFile(); } //QPixmap::load() checks for empty path avatar.load(file); //if the above didn't succeed, we need to load the generic icon if (avatar.isNull()) { avatar = KIconLoader::global()->loadIcon(QLatin1String("im-user"), KIconLoader::NoGroup, 96); } //if the contact is offline, gray it out if (presenceType == Tp::ConnectionPresenceTypeOffline) { QImage image = avatar.toImage(); const QImage alpha = image.alphaChannel(); for (int i = 0; i < image.width(); ++i) { for (int j = 0; j < image.height(); ++j) { int colour = qGray(image.pixel(i, j)); image.setPixel(i, j, qRgb(colour, colour, colour)); } } image.setAlphaChannel(alpha); avatar = avatar.fromImage(image); } //insert the contact into pixmap cache for faster lookup QPixmapCache::insert(keyCache, avatar); } return avatar; } diff --git a/KTp/message-filter-config-manager.cpp b/KTp/message-filter-config-manager.cpp index 4202779..33e8523 100644 --- a/KTp/message-filter-config-manager.cpp +++ b/KTp/message-filter-config-manager.cpp @@ -1,131 +1,131 @@ /* * Copyright (C) 2012 Lasath Fernando * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "message-filter-config-manager.h" #include "message-processor-private.h" #include #include #include "ktp-debug.h" #include typedef QSet PluginSet; using namespace KTp; class MessageFilterConfigManager::Private { public: Private(MessageFilterConfigManager *parent): q(parent) { } PluginSet all; PluginSet enabled; KService::List offers() const; void generateCache(); private: MessageFilterConfigManager *q; }; KService::List MessageFilterConfigManager::Private::offers() const { return KServiceTypeTrader::self()->query(QLatin1String("KTpTextUi/MessageFilter"), QLatin1String("[X-KTp-PluginInfo-Version] == " KTP_MESSAGE_FILTER_FRAMEWORK_VERSION)); } void MessageFilterConfigManager::Private::generateCache() { KPluginInfo::List pluginInfos = KPluginInfo::fromServices(offers(), q->configGroup()); for (KPluginInfo::List::Iterator i = pluginInfos.begin(); i != pluginInfos.end(); i++) { KPluginInfo &plugin = *i; all.insert(plugin); plugin.load(); if (plugin.isPluginEnabled()) { enabled.insert(plugin); } } } MessageFilterConfigManager *MessageFilterConfigManager::self() { static MessageFilterConfigManager *mfcm_instance; static QMutex mutex; mutex.lock(); if (!mfcm_instance) { mfcm_instance = new MessageFilterConfigManager; } mutex.unlock(); return mfcm_instance; } MessageFilterConfigManager::MessageFilterConfigManager() : d(new Private(this)) { d->generateCache(); } MessageFilterConfigManager::~MessageFilterConfigManager() { delete d; } KPluginInfo::List MessageFilterConfigManager::allPlugins() const { - return d->all.toList(); + return d->all.values(); } KPluginInfo::List MessageFilterConfigManager::enabledPlugins() const { - return d->enabled.toList(); + return d->enabled.values(); } KConfigGroup MessageFilterConfigManager::configGroup() const { return sharedConfig()->group("Plugins"); } KSharedConfig::Ptr MessageFilterConfigManager::sharedConfig() const { return KSharedConfig::openConfig(QLatin1String("ktelepathyrc")); } void MessageFilterConfigManager::reloadConfig() { PluginSet::ConstIterator iter = d->all.constBegin(); for ( ; iter != d->all.constEnd(); ++iter) { KPluginInfo pluginInfo = *iter; const bool wasEnabled = d->enabled.contains(pluginInfo); if (!wasEnabled && pluginInfo.isPluginEnabled()) { d->enabled.insert(pluginInfo); MessageProcessor::instance()->d->loadFilter(pluginInfo); } else if (wasEnabled && !pluginInfo.isPluginEnabled()) { d->enabled.remove(pluginInfo); MessageProcessor::instance()->d->unloadFilter(pluginInfo); } } } diff --git a/tools/debugger/main-window.cpp b/tools/debugger/main-window.cpp index b9f79c1..b69071d 100644 --- a/tools/debugger/main-window.cpp +++ b/tools/debugger/main-window.cpp @@ -1,108 +1,108 @@ /* Copyright (C) 2011 Collabora Ltd. @author George Kiagiadakis This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #include "main-window.h" #include "debug-message-view.h" #include "telepathy-process.h" #include #include #include #include #include #include #include #include MainWindow::MainWindow(QWidget *parent) : KXmlGuiWindow(parent) { setCentralWidget(new QWidget(this)); m_ui.setupUi(centralWidget()); setupGUI(); TelepathyProcess *process = new TelepathyProcess(this); process->setOwnerId(QStringLiteral("org.freedesktop.Telepathy.MissionControl5")); m_ui.mcLogsView->setTelepathyProcess(process); m_AccountManager = Tp::AccountManager::create(); Tp::PendingReady *pendingReady = m_AccountManager->becomeReady(); connect(pendingReady, SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onAccountManagerBecameReady(Tp::PendingOperation*))); QAction *saveLogAction = new QAction(QIcon::fromTheme(QLatin1String("document-save-as")), i18n("Save Log"), this); saveLogAction->setToolTip(i18nc("Toolbar icon tooltip", "Save log of the current tab")); toolBar()->addAction(saveLogAction); connect(m_ui.mcLogsView, SIGNAL(statusMessage(QString)), statusBar(), SLOT(showMessage(QString))); connect(saveLogAction, SIGNAL(triggered(bool)), this, SLOT(saveLogFile())); } MainWindow::~MainWindow() { } void MainWindow::saveLogFile() { m_ui.tabWidget->currentWidget()->findChild()->saveLogFile(); } void MainWindow::onAccountManagerBecameReady(Tp::PendingOperation* op) { if (op->isError()) { qCritical() << "Failed to initialize Tp::AccountManager" << "Error was:" << op->errorName() << "-" << op->errorMessage(); } else { QSet connectionManagers; Tp::AccountSetPtr accountSetPtr = m_AccountManager->onlineAccounts(); QList accountList = accountSetPtr->accounts(); Q_FOREACH(Tp::AccountPtr account, accountList) { connectionManagers.insert(account->cmName()); } initConnectionManagerTabs(connectionManagers); } } void MainWindow::initConnectionManagerTabs(const QSet& connectionManagerSet) { - QStringList connectionManagerStringList = connectionManagerSet.toList(); + QStringList connectionManagerStringList = connectionManagerSet.values(); std::sort(connectionManagerStringList.begin(), connectionManagerStringList.end()); Q_FOREACH(QString connectionManager, connectionManagerStringList) { QWidget *cmTab = new QWidget(); QHBoxLayout *horizontalLayout = new QHBoxLayout(cmTab); DebugMessageView *cmDebugMessageView = new DebugMessageView(cmTab); TelepathyProcess *process = new TelepathyProcess(cmDebugMessageView); process->setOwnerId(QString(QStringLiteral("org.freedesktop.Telepathy.ConnectionManager.%1")).arg(connectionManager)); cmDebugMessageView->setTelepathyProcess(process); horizontalLayout->addWidget(cmDebugMessageView); // Convert the connectionManager to title case. eg. haze to Haze QString tabText = connectionManager; tabText[0] = tabText[0].toTitleCase(); m_ui.tabWidget->addTab(cmTab, tabText); connect(cmDebugMessageView, SIGNAL(statusMessage(QString)), statusBar(), SLOT(showMessage(QString))); } }