25 #include <KDE/KLineEdit>
26 #include <KDE/KPushButton>
27 #include <KDE/KLocalizedString>
30 #include <TelepathyQt/AccountManager>
31 #include <TelepathyQt/AccountFactory>
32 #include <TelepathyQt/PendingReady>
33 #include <TelepathyQt/PendingChannelRequest>
43 class KTp::ContactGridDialog::Private
56 Tp::AccountManagerPtr accountManager;
63 void _k_onAccountManagerReady();
64 void _k_onOkClicked();
69 void KTp::ContactGridDialog::Private::_k_onAccountManagerReady()
71 kDebug() <<
"Account manager is ready";
72 contactsModel->setAccountManager(accountManager);
75 void KTp::ContactGridDialog::Private::_k_onOkClicked()
78 if (!contactGridWidget->hasSelection()) {
83 contact = contactGridWidget->selectedContact();
84 account = contactGridWidget->selectedAccount();
86 if (account.isNull()) {
87 kWarning() <<
"Account is NULL";
88 }
else if (contact.isNull()) {
89 kWarning() <<
"Contact is NULL";
91 kDebug() <<
"Account is: " << account->displayName();
92 kDebug() <<
"Contact is: " << contact->alias();
96 void KTp::ContactGridDialog::Private::_k_onChanged()
98 q->button(KDialog::Ok)->setEnabled(contactGridWidget->hasSelection());
109 Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
110 Tp::Features() << Tp::Account::FeatureCore
111 << Tp::Account::FeatureAvatar
112 << Tp::Account::FeatureProtocolInfo
113 << Tp::Account::FeatureProfile
114 << Tp::Account::FeatureCapabilities);
116 Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
117 Tp::Features() << Tp::Connection::FeatureCore
118 << Tp::Connection::FeatureRosterGroups
119 << Tp::Connection::FeatureRoster
120 << Tp::Connection::FeatureSelfContact);
123 << Tp::Contact::FeatureAvatarData
124 << Tp::Contact::FeatureSimplePresence
125 << Tp::Contact::FeatureCapabilities);
127 Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
129 d->accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
136 connect(d->accountManager->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)), SLOT(_k_onAccountManagerReady()));
140 d->contactGridWidget->contactFilterLineEdit()->setClickMessage(i18n(
"Search in Contacts..."));
141 d->contactGridWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected);
143 setMainWidget(d->contactGridWidget);
145 connect(d->contactGridWidget,
147 SLOT(_k_onChanged()));
149 button(KDialog::Ok)->setDisabled(
true);
151 connect(
this, SIGNAL(okClicked()), SLOT(_k_onOkClicked()));
152 connect(
this, SIGNAL(rejected()), SLOT(close()));
172 return d->contactGridWidget->filter();
176 #include "contact-grid-dialog.moc"