[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:31 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=67c83bb
The following commit has been merged in the master branch:
commit 67c83bbd7f772139ba98a632f2ae658142246328
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date: Fri Mar 11 01:26:17 2011 +0100
Set the preferred handler to be the KDE Chat Handler for now. Also some whitespace fixes
---
main-widget.cpp | 114 ++++++++++++++++++++++++++++----------------------------
main-widget.h | 8 ++--
2 files changed, 60 insertions(+), 62 deletions(-)
diff --git a/main-widget.cpp b/main-widget.cpp
index bb8af28..bb86281 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -57,59 +57,59 @@ MainWidget::MainWidget(QWidget *parent)
setupUi(this);
m_filterBar->hide();
setWindowIcon(KIcon("telepathy"));
-
+
m_actionAdd_contact->setIcon(KIcon("list-add-user"));
m_actionAdd_contact->setText(QString());
m_actionAdd_contact->setToolTip(i18n("Add new contacts.."));
-
+
m_actionGroup_contacts->setIcon(KIcon("user-group-properties"));
m_actionGroup_contacts->setText(QString());
//TODO: Toggle the tooltip with the button? eg. once its Show, after click its Hide .. ?
m_actionGroup_contacts->setToolTip(i18n("Show/Hide groups"));
-
+
m_actionHide_offline->setIcon(KIcon("meeting-attending-tentative"));
m_actionHide_offline->setText(QString());
m_actionHide_offline->setToolTip(i18n("Show/Hide offline users"));
-
+
m_actionSearch_contact->setIcon(KIcon("edit-find-user"));
m_actionSearch_contact->setText(QString());
m_actionSearch_contact->setToolTip(i18n("Find contact"));
-
+
// Start setting up the Telepathy AccountManager.
Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
Tp::Features() << Tp::Account::FeatureCore
<< Tp::Account::FeatureAvatar
<< Tp::Account::FeatureProtocolInfo
<< Tp::Account::FeatureProfile);
-
+
Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
Tp::Features() << Tp::Connection::FeatureCore
<< Tp::Connection::FeatureRosterGroups
<< Tp::Connection::FeatureRoster
<< Tp::Connection::FeatureSelfContact);
-
+
Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(Tp::Features() << Tp::Contact::FeatureAlias
<< Tp::Contact::FeatureAvatarData
<< Tp::Contact::FeatureSimplePresence
<< Tp::Contact::FeatureCapabilities);
-
+
Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
-
+
m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
accountFactory,
connectionFactory,
channelFactory,
contactFactory);
-
+
connect(m_accountManager->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onAccountManagerReady(Tp::PendingOperation*)));
-
+
connect(m_accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)),
this, SLOT(onNewAccountAdded(Tp::AccountPtr)));
-
+
m_delegate = new ContactDelegate(this);
-
+
m_contactsListView->header()->hide();
m_contactsListView->setRootIsDecorated(false);
m_contactsListView->setSortingEnabled(true);
@@ -118,24 +118,24 @@ MainWidget::MainWidget(QWidget *parent)
m_contactsListView->setIndentation(0);
m_contactsListView->setMouseTracking(true);
m_contactsListView->setExpandsOnDoubleClick(false); //the expanding/collapsing is handled manually
-
+
addOverlayButtons();
-
+
connect(m_contactsListView, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(onCustomContextMenuRequested(QPoint)));
-
+
connect(m_contactsListView, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(onContactListDoubleClick(QModelIndex)));
-
+
connect(m_delegate, SIGNAL(repaintItem(QModelIndex)),
m_contactsListView->viewport(), SLOT(repaint())); //update(QModelIndex)
-
+
connect(m_actionAdd_contact, SIGNAL(triggered(bool)),
this, SLOT(onAddContactRequest(bool)));
-
+
connect(m_actionGroup_contacts, SIGNAL(triggered(bool)),
this, SLOT(onGroupContacts(bool)));
-
+
connect(m_actionSearch_contact, SIGNAL(triggered(bool)),
this, SLOT(toggleSearchWidget(bool)));
}
@@ -147,11 +147,10 @@ MainWidget::~MainWidget()
void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
{
if (op->isError()) {
-
kDebug() << op->errorName();
kDebug() << op->errorMessage();
}
-
+
m_model = new AccountsModel(m_accountManager, this);
m_modelFilter = new AccountFilterModel(this);
m_modelFilter->setSourceModel(m_model);
@@ -168,18 +167,18 @@ void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
connect(m_filterBar, SIGNAL(filterChanged(QString)),
m_modelFilter, SLOT(setFilterString(QString)));
-
+
connect(m_filterBar, SIGNAL(closeRequest()),
m_modelFilter, SLOT(clearFilterString()));
-
+
connect(m_filterBar, SIGNAL(closeRequest()),
m_filterBar, SLOT(hide()));
-
+
connect(m_filterBar, SIGNAL(closeRequest()),
m_actionSearch_contact, SLOT(toggle()));
-
+
m_accountButtonsLayout->insertStretch(-1);
-
+
QList<Tp::AccountPtr> accounts = m_accountManager->allAccounts();
foreach (Tp::AccountPtr account, accounts) {
onNewAccountAdded(account);
@@ -193,13 +192,13 @@ void MainWidget::onAccountReady(Tp::PendingOperation* op)
qWarning() << "Account cannot become ready";
return;
}
-
+
Tp::PendingReady *pendingReady = qobject_cast<Tp::PendingReady*>(op);
Q_ASSERT(pendingReady);
}
void MainWidget::onAccountConnectionStatusChanged(Tp::ConnectionStatus status)
-{
+{
kDebug() << "Connection status is" << status;
switch (status) {
case Tp::ConnectionStatusConnected:
@@ -215,30 +214,30 @@ 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();
}
@@ -247,7 +246,7 @@ void MainWidget::onNewAccountAdded(const Tp::AccountPtr& account)
void MainWidget::onAccountStateChanged(bool enabled)
{
Tp::AccountPtr account(static_cast<Tp::Account*>(sender()));
-
+
if(enabled) {
findChild<AccountButton *>(account->uniqueIdentifier())->show();
}
@@ -262,7 +261,7 @@ 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);
}
@@ -270,8 +269,6 @@ void MainWidget::onAccountRemoved()
void MainWidget::onConnectionChanged(const Tp::ConnectionPtr& connection)
{
Q_UNUSED(connection);
-// m_contactsListView->expandAll();
- //Tp::AccountPtr account(qobject_cast<Tp::Account*>(sender()));
kDebug();
}
@@ -280,7 +277,7 @@ void MainWidget::onContactListDoubleClick(const QModelIndex& index)
if(!index.isValid()) {
return;
}
-
+
if(index.data(AccountsModel::AliasRole).toString().isEmpty()) {
if(m_contactsListView->isExpanded(index))
m_contactsListView->collapse(index);
@@ -297,14 +294,16 @@ void MainWidget::startTextChannel(const QModelIndex &index)
if (! index.isValid()) {
return;
}
-
+
QModelIndex realIndex = m_modelFilter->mapToSource(index);
Tp::ContactPtr contact = m_model->contactForIndex(realIndex);
kDebug() << "Requesting chat for contact" << contact->alias();
-
+
Tp::AccountPtr account = m_model->accountForContactIndex(realIndex);
-
- Tp::PendingChannelRequest* channelRequest = account->ensureTextChat(contact);
+
+ Tp::PendingChannelRequest* channelRequest = account->ensureTextChat(contact,
+ QDateTime::currentDateTime(),
+ PREFERRED_TEXTCHAT_HANDLER);
connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onChannelJoined(Tp::PendingOperation*)));
}
@@ -325,50 +324,49 @@ void MainWidget::showMessageToUser(const QString& text, const MainWidget::System
msgFrame->setFrameShadow(QFrame::Plain);
msgFrame->setAutoFillBackground(true);
msgFrame->setLineWidth(1);
-
+
if(type == MainWidget::SystemMessageError) {
msgFrame->setStyleSheet("background-color: #FFCBCB; color: #FF2222;");
}
else if(type == MainWidget::SystemMessageInfo) {
msgFrame->setStyleSheet("color: #2222FF;");
}
-
+
QHBoxLayout *layout = new QHBoxLayout(msgFrame);
QVBoxLayout *closeBtLayout = new QVBoxLayout(msgFrame);
-
+
QLabel *message = new QLabel(text, msgFrame);
message->setAlignment(Qt::AlignVCenter);
-
+
QToolButton *closeButton = new QToolButton(msgFrame);
closeButton->setText("x");
closeButton->setAutoRaise(true);
closeButton->setMaximumSize(QSize(16,16));
-
+
connect(closeButton, SIGNAL(clicked(bool)), msgFrame, SLOT(close()));
-
+
closeBtLayout->addWidget(closeButton);
closeBtLayout->addStretch(-1);
-
+
layout->addWidget(message);
layout->addLayout(closeBtLayout);
-
+
msgFrame->show();
-
+
QPropertyAnimation *a = new QPropertyAnimation(msgFrame, "pos");
a->setParent(msgFrame);
a->setDuration(4000);
a->setEasingCurve(QEasingCurve::OutExpo);
a->setStartValue(QPointF(m_contactsListView->viewport()->pos().x(),
m_contactsListView->viewport()->pos().y()+m_contactsListView->viewport()->height()));
-
+
a->setEndValue(QPointF(m_contactsListView->viewport()->pos().x(),
m_contactsListView->viewport()->pos().y()+m_contactsListView->viewport()->height()-50));
a->start();
-
+
if(type == MainWidget::SystemMessageInfo) {
QTimer::singleShot(4500, msgFrame, SLOT(close()));
}
-
}
void MainWidget::addOverlayButtons()
diff --git a/main-widget.h b/main-widget.h
index 472a264..5c6ae90 100644
--- a/main-widget.h
+++ b/main-widget.h
@@ -43,7 +43,7 @@ class MainWidget : public QWidget, Ui::MainWidget
public:
MainWidget(QWidget *parent = 0);
~MainWidget();
-
+
enum SystemMessageType {
/*
* this will show a system message to the user
@@ -52,7 +52,7 @@ public:
* like "Connecting..." etc.
*/
SystemMessageInfo,
-
+
/*
* message with this class will stay visible until user
* closes it and will have light-red background
@@ -76,9 +76,9 @@ public Q_SLOTS:
void toggleSearchWidget(bool show);
// void startAudioChannel();
// void startVideoChannel();
-
+
void onCustomContextMenuRequested(const QPoint &point);
-
+
private:
AccountsModel *m_model;
AccountFilterModel *m_modelFilter;
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list