[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:05:19 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=3fd3257
The following commit has been merged in the master branch:
commit 3fd3257257786fbb571a1319bda3c1300ce95490
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Tue Mar 8 22:25:46 2011 +0100
Added dynamic accounts showing up/hiding when the account is enabled/created or disabled/removed. Also the big parts of commented-out code was removed.
---
accountbutton.cpp | 5 +
accountbutton.h | 2 +
accounts-model.cpp | 6 +-
main-widget.cpp | 707 +++++------------------------------------------------
main-widget.h | 15 +-
5 files changed, 73 insertions(+), 662 deletions(-)
diff --git a/accountbutton.cpp b/accountbutton.cpp
index 3fe0e55..ba76e0e 100644
--- a/accountbutton.cpp
+++ b/accountbutton.cpp
@@ -129,6 +129,11 @@ AccountButton::AccountButton(const Tp::AccountPtr &account, QWidget* parent): QT
updateToolTip();
}
+QString AccountButton::accountId()
+{
+ return m_account->uniqueIdentifier();
+}
+
void AccountButton::setAccountStatus(QAction *action)
{
int statusIndex = action->data().toInt();
diff --git a/accountbutton.h b/accountbutton.h
index 4c688b8..2f58b79 100644
--- a/accountbutton.h
+++ b/accountbutton.h
@@ -36,6 +36,8 @@ class AccountButton : public QToolButton
public:
AccountButton(const Tp::AccountPtr &account, QWidget *parent = 0);
+ QString accountId();
+
public Q_SLOTS:
void setAccountStatus(QAction *action);
void updateToolTip();
diff --git a/accounts-model.cpp b/accounts-model.cpp
index 2d16153..e38c8c6 100644
--- a/accounts-model.cpp
+++ b/accounts-model.cpp
@@ -70,9 +70,9 @@ AccountsModel::AccountsModel(const Tp::AccountManagerPtr &am, QObject *parent)
}
}
- connect(mPriv->mAM.data(),
- SIGNAL(newAccount(Tp::AccountPtr)),
- SLOT(onNewAccount(Tp::AccountPtr)));
+// connect(mPriv->mAM.data(),
+// SIGNAL(newAccount(Tp::AccountPtr)),
+// SLOT(onNewAccount(Tp::AccountPtr)));
QHash<int, QByteArray> roles;
roles[ItemRole] = "item";
diff --git a/main-widget.cpp b/main-widget.cpp
index 7b534e4..aeab343 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -95,6 +95,9 @@ MainWidget::MainWidget(QWidget *parent)
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onAccountManagerReady(Tp::PendingOperation*)));
+ connect(m_accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)),
+ this, SLOT(onNewAccountAdded(Tp::AccountPtr)));
+
// Initialize Telepathy
//TelepathyBridge::instance()->init();
//connect(TelepathyBridge::instance(),
@@ -156,44 +159,14 @@ void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
connect(m_actionHide_offline, SIGNAL(toggled(bool)),
m_modelFilter, SLOT(filterOfflineUsers(bool)));
+ m_accountButtonsLayout->insertStretch(-1);
QList<Tp::AccountPtr> accounts = m_accountManager->allAccounts();
foreach (Tp::AccountPtr account, accounts)
{
- if(account->isEnabled())
- {
- account->becomeReady();
-
- connect(account.data(),
- SIGNAL(connectionChanged(Tp::ConnectionPtr)),
- this, SLOT(onConnectionChanged(Tp::ConnectionPtr)));
-
- connect(account.data(),
- SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)),
- this, SLOT(onAccountConnectionStatusChanged(Tp::ConnectionStatus)));
-
- AccountButton *bt = new AccountButton(account, this);
-
- m_accountButtonsLayout->addWidget(bt);
- }
+ onNewAccountAdded(account);
}
m_contactsListView->expandAll();
-
- m_accountButtonsLayout->insertStretch(-1);
-
-// QPushButton *bInfo = new QPushButton(this);
-// bInfo->setText("Info");
-// bInfo->setObjectName("infoBt");
-//
-// QPushButton *bErr = new QPushButton(this);
-// bErr->setText("Err");
-// bErr->setObjectName("errBt");
-//
-// connect(bInfo, SIGNAL(clicked(bool)), this, SLOT(systemMessageTest()));
-// connect(bErr, SIGNAL(clicked(bool)), this, SLOT(systemMessageTest()));
-//
-// m_accountButtonsLayout->addWidget(bInfo);
-// m_accountButtonsLayout->addWidget(bErr);
}
void MainWidget::systemMessageTest()
@@ -236,6 +209,59 @@ void MainWidget::onAccountConnectionStatusChanged(Tp::ConnectionStatus status)
}
}
+void MainWidget::onNewAccountAdded(const Tp::AccountPtr& account)
+{
+ account->becomeReady();
+
+ connect(account.data(),
+ SIGNAL(connectionChanged(Tp::ConnectionPtr)),
+ this, SLOT(onConnectionChanged(Tp::ConnectionPtr)));
+
+ connect(account.data(),
+ SIGNAL(connectionStatusChanged(Tp::ConnectionStatus)),
+ this, SLOT(onAccountConnectionStatusChanged(Tp::ConnectionStatus)));
+
+ connect(account.data(), SIGNAL(stateChanged(bool)),
+ this, SLOT(onAccountStateChanged(bool)));
+
+ connect(account.data(),
+ SIGNAL(removed()),
+ this, SLOT(onAccountRemoved()));
+
+ AccountButton *bt = new AccountButton(account, this);
+ bt->setObjectName(account->uniqueIdentifier());
+ bt->hide();
+
+ m_accountButtonsLayout->insertWidget(m_accountButtonsLayout->count() - 1, bt);
+
+ if(account->isEnabled()) {
+ bt->show();
+ }
+}
+
+void MainWidget::onAccountStateChanged(bool enabled)
+{
+ Tp::AccountPtr account(static_cast<Tp::Account*>(sender()));
+
+ if(enabled) {
+ findChild<AccountButton *>(account->uniqueIdentifier())->show();
+ }
+ else {
+ findChild<AccountButton *>(account->uniqueIdentifier())->hide();
+ showMessageToUser(i18n("Account %1 was disabled!").arg(account->displayName()),
+ MainWidget::SystemMessageError);
+ }
+}
+
+void MainWidget::onAccountRemoved()
+{
+ Tp::AccountPtr account(static_cast<Tp::Account*>(sender()));
+ delete findChild<AccountButton *>(account->uniqueIdentifier());
+
+ showMessageToUser(i18n("Account %1 was removed!").arg(account->displayName()),
+ MainWidget::SystemMessageError);
+}
+
void MainWidget::onConnectionChanged(const Tp::ConnectionPtr& connection)
{
Q_UNUSED(connection);
@@ -285,16 +311,6 @@ void MainWidget::onChannelJoined(Tp::PendingOperation* op)
}
}
-
-void MainWidget::onHandlerReady(bool ready)
-{
- if (!ready) {
- kWarning() << "Telepathy handler could not become ready!";
- } else {
- kDebug() << "Telepathy handler ready";
- }
-}
-
void MainWidget::showMessageToUser(const QString& text, const MainWidget::SystemMessageType type)
{
//kDebug() << m_contactsListView->size() << m_contactsListView->viewport()->size();
@@ -388,608 +404,5 @@ void MainWidget::addOverlayButtons()
void MainWidget::onCustomContextMenuRequested(const QPoint& point)
{
-// QModelIndex proxyIdx = m_contactsListView->indexAt(point);
-// if (!proxyIdx.isValid()) {
-// kDebug() << "Invalid index provided";
-// // Flee
-// return;
-// }
-//
-// // Map the index to the real model
-// QModelIndex index = m_currentModel->mapToSource(proxyIdx);
-// if (!index.isValid()) {
-// kDebug() << "Could not map to source";
-// // Flee
-// return;
-// }
-//
-// // Ok, now let's guess
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// kDebug() << index << index.internalPointer() << abstractItem;
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-// kDebug() << contactItem;
-// QMenu *menu = new QMenu;
-//
-// // Of course we want to chat!
-// QAction *chatAction = menu->addAction(i18n("Start Chat..."));
-// chatAction->setIcon( KIcon("mail-message-new") );
-// connect(chatAction, SIGNAL(triggered(bool)),
-// this, SLOT(onStartChat(bool)));
-//
-// menu->addSeparator();
-//
-// if (contactItem) {
-// kDebug() << "A contactitem";
-// // Ok, now let's see what we can do
-// if (!contactItem->groups().isEmpty()) {
-// QMenu *parentAction = new QMenu(i18n("Remove from group"));
-// menu->addMenu(parentAction);
-// foreach (const QString &group, contactItem->groups()) {
-// QAction *action = parentAction->addAction(group);
-// connect(action, SIGNAL(triggered(bool)),
-// SLOT(onRequestRemoveFromGroup(bool)));
-// }
-// }
-//
-// // Ok, can we also add this contact to some other groups?
-// QStringList allGroups = TelepathyBridge::instance()->knownGroupsFor(contactItem->personContact());
-// kDebug() << "All groups: " << allGroups;
-//
-// QStringList nonJoinedGroups;
-// foreach (const QString &group, allGroups) {
-// if (!contactItem->groups().contains(group)) {
-// nonJoinedGroups << group;
-// }
-// }
-//
-// // Ok, now let's see what we can do
-// if (!nonJoinedGroups.isEmpty()) {
-// QMenu *parentAction = new QMenu(i18n("Add to group"));
-// menu->addMenu(parentAction);
-// foreach (const QString &group, nonJoinedGroups) {
-// QAction *action = parentAction->addAction(group);
-// connect(action, SIGNAL(triggered(bool)),
-// SLOT(onRequestAddToGroup(bool)));
-// }
-// }
-//
-// // Add/remove to metacontacts
-// // First of all: can it be added to a metacontact?
-// bool canAddToMetaContact = false;
-// MetaContactItem *metaContactItem = dynamic_cast<MetaContactItem*>(contactItem->parentItem());
-// if (metaContactItem) {
-// canAddToMetaContact = metaContactItem->type() == MetaContactItem::FakeMetaContact ? true : false;
-// } else {
-// canAddToMetaContact = true;
-// }
-//
-// if (canAddToMetaContact) {
-// // List available metacontacts
-// QList<Nepomuk::Query::Result> results;
-// {
-// using namespace Nepomuk::Query;
-//
-// Query query(ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person()));
-//
-// bool queryResult = true;
-// results = QueryServiceClient::syncQuery(query, &queryResult);
-//
-// if (!queryResult) {
-// KMessageBox::error(0, i18n("It was not possible to query Nepomuk database. Please check your "
-// "installation and make sure Nepomuk is running."));
-// }
-// }
-//
-// QMenu *parentAction = new QMenu(i18n("Add to metacontact"));
-// menu->addMenu(parentAction);
-// // Iterate over all the IMAccounts found.
-// foreach (const Nepomuk::Query::Result &result, results) {
-// Nepomuk::Person foundPerson(result.resource());
-// kDebug() << foundPerson;
-// QAction *action = parentAction->addAction(foundPerson.genericLabel());
-// connect(action, SIGNAL(triggered(bool)),
-// this, SLOT(onAddToMetaContact(bool)));
-// }
-//
-// QAction *action = parentAction->addAction(i18nc("Adds a new metacontact", "Add new..."));
-// connect(action, SIGNAL(triggered(bool)),
-// this, SLOT(onAddToMetaContact(bool)));
-// } else {
-// // We can remove it from a metacontact instead
-// QAction *action = menu->addAction(i18n("Remove from metacontact"));
-// connect(action, SIGNAL(triggered(bool)),
-// this, SLOT(onRemoveFromMetacontact(bool)));
-// }
-// }
-//
-// MetaContactItem *metaContactItem = dynamic_cast<MetaContactItem*>(abstractItem);
-// kDebug() << metaContactItem;
-// if (metaContactItem) {
-// kDebug() << "A metacontactitem";
-// // Ok, now let's see what we can do
-// if (!metaContactItem->groups().isEmpty()) {
-// QMenu *parentAction = new QMenu(i18n("Remove from group"));
-// menu->addMenu(parentAction);
-// foreach (const QString &group, metaContactItem->groups()) {
-// QAction *action = parentAction->addAction(group);
-// connect(action, SIGNAL(triggered(bool)),
-// SLOT(onRequestRemoveFromGroup(bool)));
-// }
-// }
-//
-// // Ok, can we also add this contact to some other groups?
-// QStringList allGroups = TelepathyBridge::instance()->knownGroupsFor(metaContactItem->pimoPerson());
-// kDebug() << "All groups: " << allGroups;
-//
-// QStringList nonJoinedGroups;
-// foreach (const QString &group, allGroups) {
-// if (!contactItem->groups().contains(group)) {
-// nonJoinedGroups << group;
-// }
-// }
-//
-// // Ok, now let's see what we can do
-// if (!nonJoinedGroups.isEmpty()) {
-// QMenu *parentAction = new QMenu(i18n("Add to group"));
-// menu->addMenu(parentAction);
-// foreach (const QString &group, nonJoinedGroups) {
-// QAction *action = parentAction->addAction(group);
-// connect(action, SIGNAL(triggered(bool)),
-// SLOT(onRequestAddToGroup(bool)));
-// }
-// }
-// }
-//
-// // And of course remove the contact
-// QAction *removeContact = menu->addAction(KIcon("list-remove"), i18n("Remove"));
-// QAction *blockContact = menu->addAction(KIcon("dialog-cancel"), i18n("Block"));
-//
-// connect(removeContact, SIGNAL(triggered(bool)),
-// SLOT(onContactRemovalRequest(bool)));
-// connect(blockContact, SIGNAL(triggered(bool)),
-// SLOT(onContactBlockRequest(bool)));
-//
-// menu->exec(m_contactsListView->mapToGlobal(point));
-// menu->deleteLater();
-}
-
-void MainWidget::onRequestRemoveFromGroup(bool )
-{
-// QAction *action = qobject_cast< QAction* >(sender());
-// if (!action) {
-// kDebug() << "invalid";
-// return;
-// }
-//
-// kDebug() << "Request removal from group " << action->text();
-//
-// // Pick the current model index
-// QModelIndex index = m_currentModel->mapToSource(m_contactsListView->currentIndex());
-// if (!index.isValid()) {
-// // Flee
-// kDebug() << "Invalid index";
-// return;
-// }
-//
-// // Ok, what is it?
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-//
-// if (contactItem) {
-// // Remove the contact
-// KJob *job = TelepathyBridge::instance()->removeContactFromGroup(action->text(), contactItem->personContact());
-// QEventLoop e;
-// connect(job, SIGNAL(finished(KJob*)), &e, SLOT(quit()));
-// job->start();
-// kDebug() << "Running job...";
-// e.exec();
-// kDebug() << "Job run, "<< job->error();
-// kDebug() << "rm contacts";
-// }
-//
-// MetaContactItem *metaContactItem = dynamic_cast<MetaContactItem*>(abstractItem);
-// if (metaContactItem) {
-// // Remove the metacontact
-// TelepathyBridge::instance()->removeMetaContactFromGroup(action->text(), metaContactItem->pimoPerson());
-// kDebug() << "rm contacts";
-// }
-}
-
-void MainWidget::onRequestAddToGroup(bool )
-{
-// QAction *action = qobject_cast< QAction* >(sender());
-// if (!action) {
-// kDebug() << "invalid";
-// return;
-// }
-//
-// kDebug() << "Request addition group " << action->text();
-//
-// // Pick the current model index
-// QModelIndex index = m_currentModel->mapToSource(m_contactsListView->currentIndex());
-// if (!index.isValid()) {
-// // Flee
-// kDebug() << "Invalid index";
-// return;
-// }
-//
-// // Ok, what is it?
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-//
-// if (contactItem) {
-// // Remove the contact
-// KJob *job = TelepathyBridge::instance()->addContactToGroup(action->text(), contactItem->personContact());
-// QEventLoop e;
-// connect(job, SIGNAL(finished(KJob*)), &e, SLOT(quit()));
-// job->start();
-// kDebug() << "Running job...";
-// e.exec();
-// kDebug() << "Job run, "<< job->error();
-// }
-//
-// MetaContactItem *metaContactItem = dynamic_cast<MetaContactItem*>(abstractItem);
-// if (metaContactItem) {
-// // Remove the metacontact
-// TelepathyBridge::instance()->removeMetaContactFromGroup(action->text(), metaContactItem->pimoPerson());
-// }
-}
-
-void MainWidget::onContactBlockRequest(bool )
-{
-
-}
-
-void MainWidget::onRemoveFromMetacontact(bool )
-{
-// // Pick the current model index
-// QModelIndex index = m_currentModel->mapToSource(m_contactsListView->currentIndex());
-// if (!index.isValid()) {
-// // Flee
-// kDebug() << "Invalid index";
-// return;
-// }
-//
-// // Ok, what is it?
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-//
-// Q_ASSERT(contactItem);
-//
-// KJob *job = TelepathyBridge::instance()->removeContact(contactItem->personContact(),
-// TelepathyBridge::RemoveFromMetacontactMode);
-//
-// QEventLoop e;
-// connect(job, SIGNAL(finished(KJob*)), &e, SLOT(quit()));
-// job->start();
-// qDebug() << "Running job...";
-// e.exec();
-// qDebug() << "Job run, "<< job->error();
-}
-
-void MainWidget::onContactRemovalRequest(bool )
-{
-// QAction *action = qobject_cast< QAction* >(sender());
-// if (!action) {
-// kDebug() << "invalid";
-// return;
-// }
-//
-// kDebug() << "Request addition group " << action->text();
-//
-// // Pick the current model index
-// QModelIndex index = m_currentModel->mapToSource(m_contactsListView->currentIndex());
-// if (!index.isValid()) {
-// // Flee
-// kDebug() << "Invalid index";
-// return;
-// }
-//
-// // Ok, what is it?
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-//
-// if (contactItem) {
-// // Build a dialog
-// KDialog *dial = new KDialog(this);
-// QWidget *w = new QWidget;
-// QLabel *l = new QLabel(i18n("Please select the removal means for this contact"));
-// QCheckBox *presence = 0;
-// QCheckBox *subscription = 0;
-// QCheckBox *block = 0;
-// QVBoxLayout *lay = new QVBoxLayout;
-// lay->addWidget(l);
-//
-// // What can we do?
-// TelepathyBridge::RemovalModes modes = TelepathyBridge::instance()->supportedRemovalModesFor(contactItem->personContact());
-//
-// if (modes & TelepathyBridge::RemovePublicationMode) {
-// presence = new QCheckBox(i18n("Don't show me in his buddy list anymore"));
-// // On by default
-// presence->setCheckState(Qt::Checked);
-// lay->addWidget(presence);
-// }
-// if (modes & TelepathyBridge::RemoveSubscriptionMode) {
-// subscription = new QCheckBox(i18n("Don't show him in my buddy list anymore"));
-// // On by default
-// subscription->setCheckState(Qt::Checked);
-// lay->addWidget(subscription);
-// }
-// if (modes & TelepathyBridge::BlockMode) {
-// block = new QCheckBox(i18n("Block him"));
-// // Off by default
-// block->setCheckState(Qt::Unchecked);
-// lay->addWidget(block);
-// }
-//
-// w->setLayout(lay);
-// dial->setMainWidget(w);
-//
-// if (dial->exec() == KDialog::Accepted) {
-// TelepathyBridge::RemovalModes execModes = 0;
-// if (presence) {
-// if (presence->isChecked()) {
-// if (execModes == 0) {
-// execModes = TelepathyBridge::RemovePublicationMode;
-// } else {
-// execModes |= TelepathyBridge::RemovePublicationMode;
-// }
-// }
-// }
-// if (subscription) {
-// if (subscription->isChecked()) {
-// if (execModes == 0) {
-// execModes = TelepathyBridge::RemoveSubscriptionMode;
-// } else {
-// execModes |= TelepathyBridge::RemoveSubscriptionMode;
-// }
-// }
-// }
-// if (block) {
-// if (block->isChecked()) {
-// if (execModes == 0) {
-// execModes = TelepathyBridge::BlockMode;
-// } else {
-// execModes |= TelepathyBridge::BlockMode;
-// }
-// }
-// }
-//
-// if (execModes == 0) {
-// qDebug() << "Nothing to do!";
-// return;
-// }
-//
-// // Remove the contact
-// KJob *job = TelepathyBridge::instance()->removeContact(contactItem->personContact(), execModes);
-// QEventLoop e;
-// connect(job, SIGNAL(finished(KJob*)), &e, SLOT(quit()));
-// job->start();
-// kDebug() << "Running job...";
-// e.exec();
-// kDebug() << "Job run, "<< job->error();
-// }
-// }
-}
-
-void MainWidget::onAddContactRequest(bool )
-{
-// // Let's build a dialog
-// KDialog *dial = new KDialog(this);
-// QWidget *w = new QWidget;
-// QLabel *l = new QLabel(i18n("Please enter the ID of the contact in question"));
-// KComboBox *account = new KComboBox();
-// KLineEdit *contactId = new KLineEdit();
-// QVBoxLayout *lay = new QVBoxLayout;
-// lay->addWidget(l);
-// lay->addWidget(account);
-// lay->addWidget(contactId);
-//
-// // Get all valid Telepathy accounts
-// QList<Nepomuk::Query::Result> results;
-// {
-// using namespace Nepomuk::Query;
-//
-// // me must have an IMAccount
-// ComparisonTerm imterm(Nepomuk::Vocabulary::NCO::hasIMAccount(),
-// ResourceTerm(m_mePersonContact));
-// imterm.setInverted(true);
-//
-// // Which must be an IMAccount of course
-// Query query(AndTerm(ResourceTypeTerm(Nepomuk::Vocabulary::NCO::IMAccount()),
-// imterm));
-//
-// bool queryResult = true;
-// results = QueryServiceClient::syncQuery(query, &queryResult);
-//
-// if (!queryResult) {
-// KMessageBox::error(0, i18n("It was not possible to query Nepomuk database. Please check your "
-// "installation and make sure Nepomuk is running."));
-// }
-// }
-//
-// // Iterate over all the IMAccounts/PersonContacts found.
-// foreach (const Nepomuk::Query::Result &result, results) {
-// Nepomuk::IMAccount foundIMAccount(result.resource());
-// uint statusType = foundIMAccount.statusTypes().first();
-// if( statusType != Tp::ConnectionPresenceTypeUnset &&
-// statusType != Tp::ConnectionPresenceTypeOffline &&
-// statusType != Tp::ConnectionPresenceTypeUnknown &&
-// statusType != Tp::ConnectionPresenceTypeError)
-// {
-// foreach (const QString &id, foundIMAccount.imIDs()) {
-// account->addItem(id, foundIMAccount.resourceUri());
-// }
-// }
-// }
-//
-// w->setLayout(lay);
-// dial->setMainWidget(w);
-//
-// if (dial->exec() == KDialog::Accepted) {
-// // Add the contact
-// Nepomuk::IMAccount toAddAccount(account->itemData(account->currentIndex()).toUrl());
-// KJob *job = TelepathyBridge::instance()->addContact(toAddAccount, contactId->text());
-// QEventLoop e;
-// connect(job, SIGNAL(finished(KJob*)), &e, SLOT(quit()));
-// job->start();
-// qDebug() << "Running job...";
-// e.exec();
-// qDebug() << "Job run, "<< job->error();
-// }
-}
-
-void MainWidget::onGroupContacts(bool grouped)
-{
-// if (grouped && m_currentModel != m_groupedContactsProxyModel) {
-// m_currentModel = m_groupedContactsProxyModel;
-// m_contactsListView->setModel(m_groupedContactsProxyModel);
-// }
-// else if(!grouped && m_currentModel != m_sortFilterProxyModel) {
-// m_currentModel = m_sortFilterProxyModel;
-// m_contactsListView->setModel(m_sortFilterProxyModel);
-// }
-
-}
-
-void MainWidget::onAddToMetaContact(bool )
-{
-// QAction *action = qobject_cast< QAction* >(sender());
-// if (!action) {
-// kDebug() << "invalid";
-// return;
-// }
-//
-// QString metaContactName = action->text();
-// kDebug() << "Request adding to metacontact " << metaContactName;
-//
-// // Pick the current model index
-// QModelIndex index = m_currentModel->mapToSource(m_contactsListView->currentIndex());
-// if (!index.isValid()) {
-// // Flee
-// kDebug() << "Invalid index";
-// return;
-// }
-//
-// // Ok, what is it?
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-//
-// Q_ASSERT(contactItem);
-//
-// if (metaContactName == i18nc("Adds a new metacontact", "Add new...")) {
-// // Prompt to create a new metacontact
-// // Let's build a dialog
-// KDialog *dial = new KDialog(this);
-// QWidget *w = new QWidget;
-// QLabel *l = new QLabel(i18n("Please enter a name for this new metacontact"));
-// KLineEdit *contactId = new KLineEdit();
-// QVBoxLayout *lay = new QVBoxLayout;
-// lay->addWidget(l);
-// lay->addWidget(contactId);
-//
-// w->setLayout(lay);
-// dial->setMainWidget(w);
-//
-// if (dial->exec() == KDialog::Accepted) {
-// // Add the contact
-// metaContactName = contactId->text();
-// KJob *job = TelepathyBridge::instance()->addMetaContact(contactId->text(),
-// QList< Nepomuk::PersonContact >() <<
-// contactItem->personContact());
-// QEventLoop e;
-// connect(job, SIGNAL(finished(KJob*)), &e, SLOT(quit()));
-// job->start();
-// qDebug() << "Running job...";
-// e.exec();
-// qDebug() << "Job run, "<< job->error();
-// }
-//
-// return;
-// }
-//
-// // Ok, now let's add the contact
-// QList< Nepomuk::Query::Result > results;
-// {
-// using namespace Nepomuk::Query;
-// using namespace Nepomuk::Vocabulary;
-//
-// ResourceTypeTerm rtterm(PIMO::Person());
-// ComparisonTerm cmpterm(NAO::prefLabel(), LiteralTerm(metaContactName));
-//
-// Query query(AndTerm(cmpterm, rtterm));
-//
-// bool queryResult = true;
-// results = QueryServiceClient::syncQuery(query, &queryResult);
-//
-// if (!queryResult) {
-// KMessageBox::error(0, i18n("It was not possible to query Nepomuk database. Please check your "
-// "installation and make sure Nepomuk is running."));
-// }
-// }
-//
-// // Iterate over all the IMAccounts found.
-// foreach (const Nepomuk::Query::Result &result, results) {
-// Nepomuk::Person foundPerson(result.resource());
-// foundPerson.addGroundingOccurrence(contactItem->personContact());
-// }
-}
-
-void MainWidget::onStartChat(bool)
-{
-// QAction *action = qobject_cast< QAction* >(sender());
-// if (!action) {
-// kDebug() << "invalid";
-// return;
-// }
-//
-// // Pick the current model index
-// QModelIndex index = m_currentModel->mapToSource(m_contactsListView->currentIndex());
-// if (!index.isValid()) {
-// // Flee
-// kDebug() << "Invalid index";
-// return;
-// }
-//
-// RequestTextChatJob* job;
-// // Ok, what is it?
-// AbstractTreeItem *abstractItem = static_cast<AbstractTreeItem*>(index.internalPointer());
-// ContactItem *contactItem = dynamic_cast<ContactItem*>(abstractItem);
-// MetaContactItem *metacontactItem = dynamic_cast<MetaContactItem*>(abstractItem);
-//
-// if (contactItem) {
-// kDebug() << "Request chat to contact";
-// Nepomuk::PersonContact contact = contactItem->personContact();
-// kDebug() << contact.resourceUri() << contact.genericLabel();
-// job = KTelepathy::requestTextChat(contact, PREFERRED_TEXTCHAT_HANDLER, this);
-// } else if (metacontactItem && metacontactItem->type() == MetaContactItem::RealMetaContact) {
-// kDebug() << "Request chat to REAL metacontact";
-// Nepomuk::Person metacontact = metacontactItem->pimoPerson();
-// kDebug() << metacontact.resourceUri() << metacontact.genericLabel();
-// job = KTelepathy::requestTextChat(metacontact, PREFERRED_TEXTCHAT_HANDLER, this);
-// } else if (metacontactItem && metacontactItem->type() == MetaContactItem::FakeMetaContact) {
-// kDebug() << "Request chat to FAKE metacontact";
-// QList<AbstractTreeItem*> childList = metacontactItem->childItems();
-// AbstractTreeItem *childItem = childList.first(); //It should just have one
-// Q_ASSERT(childItem);
-// contactItem = dynamic_cast<ContactItem*>(childItem);
-// if (!contactItem) {
-// KMessageBox::error(0, i18n("An error occurred????"));
-// kWarning() << "Cannot dynamic cast child item!";
-// } else {
-// Nepomuk::PersonContact contact = contactItem->personContact();
-// kDebug() << contact.resourceUri() << contact.genericLabel();
-// job = KTelepathy::requestTextChat(contact, PREFERRED_TEXTCHAT_HANDLER, this);
-// }
-// } else {
-// KMessageBox::error(0, i18n("An error occurred????"));
-// kWarning() << "This is not a contact or a metacontact!";
-// }
-// if ( !job->exec() ) {
-// // An error occurred
-// KMessageBox::error(0, i18n("Impossible to start a chat"));
-// kWarning() << "Impossible to start a chat";
-// } else {
-// kDebug() << "This should be a success.";
-// }
-}
+ Q_UNUSED(point);
+}
\ No newline at end of file
diff --git a/main-widget.h b/main-widget.h
index 1ed6b20..d248c6e 100644
--- a/main-widget.h
+++ b/main-widget.h
@@ -72,22 +72,13 @@ public Q_SLOTS:
void showMessageToUser(const QString &text, const SystemMessageType type);
void systemMessageTest();
void addOverlayButtons();
+ void onNewAccountAdded(const Tp::AccountPtr &account);
+ void onAccountStateChanged(bool enabled);
+ void onAccountRemoved();
// void startAudioChannel();
// void startVideoChannel();
void onCustomContextMenuRequested(const QPoint &point);
- //Menu actions
- void onStartChat(bool);
- void onRequestRemoveFromGroup(bool);
- void onContactRemovalRequest(bool);
- void onContactBlockRequest(bool);
- void onHandlerReady(bool);
- void onRequestAddToGroup(bool);
- void onAddToMetaContact(bool);
- void onRemoveFromMetacontact(bool);
- //Toolbar actions
- void onAddContactRequest(bool);
- void onGroupContacts(bool);
private:
AccountsModel* m_model;
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list