[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:00:51 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=00c5daa
The following commit has been merged in the master branch:
commit 00c5daaaebaa229cdaa3130210290b4ef757eea8
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Sun Dec 25 21:36:19 2011 +0000
Add a dialog in the KCM to configure account identity
Option to set account nickname and avatar
---
src/CMakeLists.txt | 7 ++
src/account-identity-dialog.cpp | 89 +++++++++++++++++
src/account-identity-dialog.h | 39 ++++++++
src/account-identity-dialog.ui | 110 +++++++++++++++++++++
src/account-item.cpp | 5 +
src/account-item.h | 1 +
src/accounts-list-model.cpp | 4 +
src/accounts-list-model.h | 1 +
src/avatar-button.cpp | 108 +++++++++++++++++++++
src/{edit-account-dialog.h => avatar-button.h} | 43 ++++----
src/fetch-avatar-job.cpp | 113 ++++++++++++++++++++++
src/{edit-account-dialog.h => fetch-avatar-job.h} | 38 ++++----
src/kcm-telepathy-accounts.cpp | 34 ++++++-
src/kcm-telepathy-accounts.h | 1 +
src/main-widget.ui | 47 ++-------
15 files changed, 561 insertions(+), 79 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0927028..8fb139a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,6 +7,8 @@ add_subdirectory (KCMTelepathyAccounts)
project (ktp-accounts-kcm)
set (kcm_ktp_accounts_SRCS
+ avatar-button.cpp
+ fetch-avatar-job.cpp
salut-enabler.cpp
salut-message-widget.cpp
kcm-telepathy-accounts.cpp
@@ -14,12 +16,15 @@ set (kcm_ktp_accounts_SRCS
account-item.cpp
add-account-assistant.cpp
edit-account-dialog.cpp
+ account-identity-dialog.cpp
salut-details-dialog.cpp
accounts-list-delegate.cpp
)
+
kde4_add_ui_files (kcm_ktp_accounts_SRCS
main-widget.ui
+ account-identity-dialog.ui
)
kde4_add_plugin (kcm_ktp_accounts
@@ -32,6 +37,8 @@ target_link_libraries (kcm_ktp_accounts
${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
${KTP_LIBRARIES}
+ ${KDE4_KIO_LIBS}
+
)
# Install:
diff --git a/src/account-identity-dialog.cpp b/src/account-identity-dialog.cpp
new file mode 100644
index 0000000..b3a2157
--- /dev/null
+++ b/src/account-identity-dialog.cpp
@@ -0,0 +1,89 @@
+#include "account-identity-dialog.h"
+#include "ui_account-identity-dialog.h"
+
+#include <TelepathyQt/Account>
+#include <TelepathyQt/AvatarData>
+
+#include <KDebug>
+
+//FIXME possibly need to monitor account connection status and disable if appropriate?
+
+AccountIdentityDialog::AccountIdentityDialog(const Tp::AccountPtr &account, QWidget *parent) :
+ KDialog(parent),
+ m_account(account),
+ ui(new Ui::AccountIdentityDialog)
+{
+ QWidget *widget = new QWidget(this);
+ ui->setupUi(widget);
+
+ Q_ASSERT(! m_account.isNull());
+
+ setMainWidget(widget);
+
+ setWindowTitle(i18n("Edit Account Identity"));
+ setButtons(KDialog::Cancel | KDialog::Apply);
+
+ connect(m_account.data(), SIGNAL(nicknameChanged(QString)), SLOT(onNicknameChanged(QString)));
+ connect(m_account.data(), SIGNAL(avatarChanged(Tp::Avatar)), SLOT(onAvatarChanged(Tp::Avatar)));
+ onNicknameChanged(account->nickname());
+ onAvatarChanged(account->avatar());
+
+ ui->accountId->setText(m_account->displayName());
+ connect(ui->accountNickname, SIGNAL(textChanged(QString)), SLOT(onEdited()));
+ connect(ui->accountAvatar, SIGNAL(avatarChanged()), SLOT(onEdited()));
+
+ onEdited();
+
+ connect(this, SIGNAL(applyClicked()), SLOT(apply()));
+}
+
+AccountIdentityDialog::~AccountIdentityDialog()
+{
+ delete ui;
+}
+
+bool AccountIdentityDialog::hasChanged() const
+{
+ if (m_account.isNull()) {
+ return false;
+ }
+ if (ui->accountNickname->text() != m_account->nickname()) {
+ return true;
+ }
+ if (ui->accountAvatar->avatar().avatarData != m_account->avatar().avatarData) {
+ return true;
+ }
+ return false;
+}
+
+void AccountIdentityDialog::onNicknameChanged(const QString &nickname)
+{
+ ui->accountNickname->setText(nickname);
+ onEdited();
+}
+
+void AccountIdentityDialog::onAvatarChanged(const Tp::Avatar &avatar)
+{
+ ui->accountAvatar->setAvatar(avatar);
+ onEdited();
+}
+
+void AccountIdentityDialog::apply()
+{
+ kDebug();
+ if (m_account.isNull()) {
+ return;
+ }
+
+ m_account->setAvatar(ui->accountAvatar->avatar());
+ m_account->setNickname(ui->accountNickname->text());
+
+ //not much point watching these, they just return that everything was OK even when it isn't.
+}
+
+void AccountIdentityDialog::onEdited()
+{
+ enableButtonApply(hasChanged());
+}
+
+#include "account-identity-dialog.moc"
diff --git a/src/account-identity-dialog.h b/src/account-identity-dialog.h
new file mode 100644
index 0000000..a5bcb4e
--- /dev/null
+++ b/src/account-identity-dialog.h
@@ -0,0 +1,39 @@
+#ifndef ACCOUNT_IDENTITY_DIALOG_H
+#define ACCOUNT_IDENTITY_DIALOG_H
+
+#include <KDialog>
+
+#include <TelepathyQt/Types>
+
+namespace Ui {
+ class AccountIdentityDialog;
+}
+
+/** Widget that configures user's identity (nickname/avatar etc) for an account*/
+
+class AccountIdentityDialog : public KDialog
+{
+ Q_OBJECT
+
+public:
+ explicit AccountIdentityDialog(const Tp::AccountPtr &account, QWidget *parent = 0);
+ ~AccountIdentityDialog();
+
+ /** Returns if the user has changed settings*/
+ bool hasChanged() const;
+
+public slots:
+ /** Updates the account to user selection*/
+ void apply();
+
+private slots:
+ void onNicknameChanged(const QString &nickname);
+ void onAvatarChanged(const Tp::Avatar &avatar);
+ void onEdited();
+
+private:
+ Tp::AccountPtr m_account;
+ Ui::AccountIdentityDialog *ui;
+};
+
+#endif // ACCOUNT_IDENTITY_DIALOG_H
diff --git a/src/account-identity-dialog.ui b/src/account-identity-dialog.ui
new file mode 100644
index 0000000..ef736ec
--- /dev/null
+++ b/src/account-identity-dialog.ui
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AccountIdentityDialog</class>
+ <widget class="QWidget" name="AccountIdentityDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>357</width>
+ <height>121</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Nickname:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KLineEdit" name="accountNickname"/>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Account:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="accountId">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="AvatarButton" name="accountAvatar">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>100</horstretch>
+ <verstretch>100</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KLineEdit</class>
+ <extends>QLineEdit</extends>
+ <header>klineedit.h</header>
+ </customwidget>
+ <customwidget>
+ <class>AvatarButton</class>
+ <extends>QToolButton</extends>
+ <header>avatar-button.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/account-item.cpp b/src/account-item.cpp
index bb26b9e..92ebe67 100644
--- a/src/account-item.cpp
+++ b/src/account-item.cpp
@@ -192,4 +192,9 @@ void AccountItem::onTitleForCustomPages(QString mandatoryPage, QList<QString> op
emit setTitleForCustomPages(mandatoryPage, optionalPage);
}
+Tp::ConnectionStatus AccountItem::connectionStatus() const
+{
+ return m_account->connectionStatus();
+}
+
#include "account-item.moc"
diff --git a/src/account-item.h b/src/account-item.h
index f59853a..aba7e0e 100644
--- a/src/account-item.h
+++ b/src/account-item.h
@@ -44,6 +44,7 @@ public:
Tp::AccountPtr account() const;
void remove();
const KIcon& icon() const;
+ Tp::ConnectionStatus connectionStatus() const;
const QString connectionStateString() const;
const KIcon connectionStateIcon() const;
const QString connectionStatusReason() const;
diff --git a/src/accounts-list-model.cpp b/src/accounts-list-model.cpp
index 58db79e..c9691df 100644
--- a/src/accounts-list-model.cpp
+++ b/src/accounts-list-model.cpp
@@ -88,6 +88,10 @@ QVariant AccountsListModel::data(const QModelIndex &index, int role) const
}
break;
+ case AccountsListModel::ConnectionStateRole:
+ data = QVariant(m_accounts.at(index.row())->connectionStatus());
+ break;
+
case AccountsListModel::ConnectionStateDisplayRole:
data = QVariant(m_accounts.at(index.row())->connectionStateString());
break;
diff --git a/src/accounts-list-model.h b/src/accounts-list-model.h
index 061c192..15238b6 100644
--- a/src/accounts-list-model.h
+++ b/src/accounts-list-model.h
@@ -34,6 +34,7 @@ class AccountsListModel : public QAbstractListModel
public:
enum Roles {
+ ConnectionStateRole = Qt::UserRole,
ConnectionStateDisplayRole = Qt::UserRole+1,
ConnectionStateIconRole,
ConnectionErrorMessageDisplayRole,
diff --git a/src/avatar-button.cpp b/src/avatar-button.cpp
new file mode 100644
index 0000000..365b027
--- /dev/null
+++ b/src/avatar-button.cpp
@@ -0,0 +1,108 @@
+/*
+ * Button representing user's Avatar
+ *
+ * Copyright (C) 2011 Martin Klapetek <martin.klapetek at gmail.com>
+ *
+ * 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 "avatar-button.h"
+
+#include <QWidgetAction>
+
+#include <KDebug>
+#include <KFileDialog>
+#include <KMenu>
+#include <KLocalizedString>
+#include <KMessageBox>
+
+#include "fetch-avatar-job.h"
+
+AvatarButton::AvatarButton(QWidget *parent)
+ : QToolButton(parent)
+{
+ KMenu *menu = new KMenu(this);
+
+ setPopupMode(QToolButton::InstantPopup);
+
+ setIconSize(QSize(64,64));
+
+ menu->addAction(KIcon("document-open-folder"), i18n("Load from file..."), this, SLOT(onLoadAvatarFromFile()));
+ menu->addAction(KIcon("edit-clear"),i18n("Clear Avatar"), this, SLOT(onClearAvatar()));
+
+
+ setMenu(menu);
+}
+
+AvatarButton::~AvatarButton()
+{
+
+}
+
+void AvatarButton::setAvatar(const Tp::Avatar &avatar) {
+ m_avatar = avatar;
+
+ if (! avatar.avatarData.isNull()) {
+ KIcon avatarIcon;
+ QPixmap avatarPixmap = QPixmap::fromImage(QImage::fromData(avatar.avatarData));
+ //scale oversized avatars to fit, but don't stretch smaller avatars
+ avatarIcon.addPixmap(avatarPixmap.scaled(iconSize().boundedTo(avatarPixmap.size()), Qt::KeepAspectRatio));
+ setIcon(avatarIcon);
+ } else {
+ setIcon(KIcon("im-user"));
+ }
+}
+
+Tp::Avatar AvatarButton::avatar() const {
+ return m_avatar;
+}
+
+
+void AvatarButton::onLoadAvatarFromFile()
+{
+ KUrl fileUrl = KFileDialog::getImageOpenUrl(KUrl(), this,
+ i18n("Please choose your avatar"));
+
+ if (!fileUrl.isEmpty()) {
+ FetchAvatarJob *job = new FetchAvatarJob(fileUrl, this);
+
+ connect(job, SIGNAL(result(KJob*)),
+ this, SLOT(onAvatarFetched(KJob*)));
+
+ job->start();
+ } else {
+ return;
+ }
+}
+
+void AvatarButton::onClearAvatar()
+{
+ setAvatar(Tp::Avatar());
+ Q_EMIT avatarChanged();
+}
+
+void AvatarButton::onAvatarFetched(KJob *job)
+{
+ if (job->error()) {
+ KMessageBox::error(this, job->errorString());
+ return;
+ } else {
+ FetchAvatarJob *fetchJob = qobject_cast< FetchAvatarJob* >(job);
+
+ Q_ASSERT(fetchJob);
+ setAvatar(fetchJob->avatar());
+ Q_EMIT avatarChanged();
+ }
+}
diff --git a/src/edit-account-dialog.h b/src/avatar-button.h
similarity index 56%
copy from src/edit-account-dialog.h
copy to src/avatar-button.h
index 6fdf98d..19b953e 100644
--- a/src/edit-account-dialog.h
+++ b/src/avatar-button.h
@@ -1,7 +1,7 @@
/*
- * This file is part of telepathy-accounts-kcm
+ * Button representing user's Avatar
*
- * Copyright (C) 2009 Collabora Ltd. <info at collabora.com>
+ * Copyright (C) 2011 Martin Klapetek <martin.klapetek at gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,34 +18,39 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef KCM_TELEPATHY_ACCOUNTS_EDIT_ACCOUNT_DIALOG_H
-#define KCM_TELEPATHY_ACCOUNTS_EDIT_ACCOUNT_DIALOG_H
+#ifndef AVATAR_BUTTON_H
+#define AVATAR_BUTTON_H
-#include "account-item.h"
+#include <QtGui/QToolButton>
-#include <KDialog>
+#include <TelepathyQt/Types>
-class EditAccountDialog : public KDialog
+class AccountsModel;
+class KJob;
+class KMenu;
+
+class AvatarButton : public QToolButton
{
Q_OBJECT
public:
- explicit EditAccountDialog(AccountItem *item, QWidget *parent = 0);
- virtual ~EditAccountDialog();
+ AvatarButton(QWidget* parent = 0);
+ ~AvatarButton();
+
+ void setAvatar(const Tp::Avatar &avatar);
+ Tp::Avatar avatar() const;
+
+Q_SIGNALS:
+ void avatarChanged();
private Q_SLOTS:
- void onParametersUpdated(Tp::PendingOperation *op);
- void onDisplayNameUpdated(Tp::PendingOperation *op);
+ void onLoadAvatarFromFile();
+ void onClearAvatar();
+ void onAvatarFetched(KJob*);
private:
- Q_DISABLE_COPY(EditAccountDialog);
+ Tp::Avatar m_avatar;
- void accept();
-
- class Private;
- Private * const d;
};
-
-#endif // header guard
-
+#endif //AVATAR_BUTTON_H
diff --git a/src/fetch-avatar-job.cpp b/src/fetch-avatar-job.cpp
new file mode 100644
index 0000000..06a35ea
--- /dev/null
+++ b/src/fetch-avatar-job.cpp
@@ -0,0 +1,113 @@
+/*
+ * This file is part of telepathy-contactslist-prototype
+ *
+ * Copyright (C) 2011 Collabora Ltd. <info at collabora.co.uk>
+ * @Author Dario Freddi <dario.freddi at collabora.co.uk>
+ *
+ * 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 "fetch-avatar-job.h"
+
+#include <KUrl>
+#include <KLocalizedString>
+
+#include <KIO/Job>
+
+class FetchAvatarJob::Private
+{
+public:
+ Private(FetchAvatarJob *q) : q(q) {}
+ ~Private() {}
+
+ void _k_onMimeTypeDetected(KIO::Job *job, const QString &mimetype);
+ void _k_onDataFromJob(KIO::Job *job, const QByteArray &data);
+ void _k_onJobFinished(KJob *job);
+
+ Tp::Avatar avatar;
+ KUrl url;
+
+ FetchAvatarJob *q;
+};
+
+FetchAvatarJob::FetchAvatarJob(const KUrl& url, QObject* parent)
+ : KJob(parent)
+ , d(new Private(this))
+{
+ d->url = url;
+}
+
+FetchAvatarJob::~FetchAvatarJob()
+{
+ delete d;
+}
+
+Tp::Avatar FetchAvatarJob::avatar() const
+{
+ return d->avatar;
+}
+
+void FetchAvatarJob::start()
+{
+ if (d->url.isEmpty() || !d->url.isValid()) {
+ setError(1);
+ emitResult();
+ return;
+ }
+
+ KIO::TransferJob *job = KIO::get(d->url);
+
+ connect(job, SIGNAL(mimetype(KIO::Job*,QString)),
+ this, SLOT(_k_onMimeTypeDetected(KIO::Job*,QString)));
+ connect(job, SIGNAL(data(KIO::Job*,QByteArray)),
+ this, SLOT(_k_onDataFromJob(KIO::Job*,QByteArray)));
+ connect(job, SIGNAL(result(KJob*)),
+ this, SLOT(_k_onJobFinished(KJob*)));
+}
+
+void FetchAvatarJob::Private::_k_onMimeTypeDetected(KIO::Job *job, const QString &mimetype)
+{
+ if (!mimetype.contains("image/")) {
+ q->setErrorText(i18n("The file you have selected does not seem to be an image.
"
+ "Please select an image file."));
+ q->setError(1);
+ q->emitResult();
+
+ disconnect(job, SIGNAL(result(KJob*)),
+ q, SLOT(_k_onJobFinished(KJob*)));
+ disconnect(job, SIGNAL(data(KIO::Job*,QByteArray)),
+ q, SLOT(_k_onDataFromJob(KIO::Job*,QByteArray)));
+
+ job->kill();
+
+ return;
+ }
+
+ avatar.MIMEType = mimetype;
+}
+
+void FetchAvatarJob::Private::_k_onDataFromJob(KIO::Job *job, const QByteArray &data)
+{
+ Q_UNUSED(job)
+ avatar.avatarData.append(data);
+}
+
+void FetchAvatarJob::Private::_k_onJobFinished(KJob *job)
+{
+ q->setError(job->error());
+ q->emitResult();
+}
+
+#include "fetch-avatar-job.moc"
diff --git a/src/edit-account-dialog.h b/src/fetch-avatar-job.h
similarity index 55%
copy from src/edit-account-dialog.h
copy to src/fetch-avatar-job.h
index 6fdf98d..f9841e2 100644
--- a/src/edit-account-dialog.h
+++ b/src/fetch-avatar-job.h
@@ -1,7 +1,8 @@
/*
- * This file is part of telepathy-accounts-kcm
+ * This file is part of telepathy-contactslist-prototype
*
- * Copyright (C) 2009 Collabora Ltd. <info at collabora.com>
+ * Copyright (C) 2011 Collabora Ltd. <info at collabora.co.uk>
+ * @Author Dario Freddi <dario.freddi at collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,34 +19,33 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef KCM_TELEPATHY_ACCOUNTS_EDIT_ACCOUNT_DIALOG_H
-#define KCM_TELEPATHY_ACCOUNTS_EDIT_ACCOUNT_DIALOG_H
+#ifndef FETCH_AVATAR_JOB_H
+#define FETCH_AVATAR_JOB_H
-#include "account-item.h"
+#include <KJob>
-#include <KDialog>
+#include <TelepathyQt/Types>
-class EditAccountDialog : public KDialog
+class KUrl;
+class FetchAvatarJob : public KJob
{
Q_OBJECT
public:
- explicit EditAccountDialog(AccountItem *item, QWidget *parent = 0);
- virtual ~EditAccountDialog();
+ explicit FetchAvatarJob(const KUrl &url, QObject *parent = 0);
+ virtual ~FetchAvatarJob();
-private Q_SLOTS:
- void onParametersUpdated(Tp::PendingOperation *op);
- void onDisplayNameUpdated(Tp::PendingOperation *op);
+ void start();
-private:
- Q_DISABLE_COPY(EditAccountDialog);
-
- void accept();
+ Tp::Avatar avatar() const;
+private:
class Private;
Private * const d;
-};
-
-#endif // header guard
+ Q_PRIVATE_SLOT(d, void _k_onMimeTypeDetected(KIO::Job*,QString))
+ Q_PRIVATE_SLOT(d, void _k_onDataFromJob(KIO::Job*,QByteArray))
+ Q_PRIVATE_SLOT(d, void _k_onJobFinished(KJob*))
+};
+#endif // FETCH_AVATAR_JOB_H
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index 3f0853d..de7f864 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -27,6 +27,7 @@
#include "add-account-assistant.h"
#include "edit-account-dialog.h"
#include "accounts-list-delegate.h"
+#include "account-identity-dialog.h"
#include <KTp/wallet-interface.h>
@@ -121,6 +122,7 @@ KCMTelepathyAccounts::KCMTelepathyAccounts(QWidget *parent, const QVariantList&
m_ui->addAccountButton->setIcon(KIcon("list-add"));
m_ui->editAccountButton->setIcon(KIcon("configure"));
m_ui->removeAccountButton->setIcon(KIcon("edit-delete"));
+ m_ui->editAccountIdentityButton->setIcon(KIcon("user-identity"));
m_salutBusyWheel = new KPixmapSequenceOverlayPainter(this);
m_salutBusyWheel->setSequence(KPixmapSequence("process-working", 22));
@@ -149,6 +151,9 @@ KCMTelepathyAccounts::KCMTelepathyAccounts(QWidget *parent, const QVariantList&
connect(m_ui->editAccountButton,
SIGNAL(clicked()),
SLOT(onEditAccountClicked()));
+ connect(m_ui->editAccountIdentityButton,
+ SIGNAL(clicked()),
+ SLOT(onEditIdentityClicked()));
connect(m_ui->accountsListView,
SIGNAL(doubleClicked(QModelIndex)),
SLOT(onEditAccountClicked()));
@@ -253,10 +258,13 @@ void KCMTelepathyAccounts::onSelectedItemChanged(const QModelIndex ¤t, con
{
Q_UNUSED(previous);
- if (!current.isValid()) {
- m_ui->removeAccountButton->setEnabled(false);
- m_ui->editAccountButton->setEnabled(false);
- return;
+ m_ui->removeAccountButton->setEnabled(current.isValid());
+ m_ui->editAccountButton->setEnabled(current.isValid());
+
+ if (current.isValid() && current.data(AccountsListModel::ConnectionStateRole).toInt() == Tp::ConnectionStatusConnected) {
+ m_ui->editAccountIdentityButton->setEnabled(true);
+ } else {
+ m_ui->editAccountIdentityButton->setEnabled(false);
}
m_currentModel = qobject_cast<const QSortFilterProxyModel*>(current.model());
@@ -310,6 +318,24 @@ void KCMTelepathyAccounts::onEditAccountClicked()
dialog.exec();
}
+void KCMTelepathyAccounts::onEditIdentityClicked()
+{
+ QModelIndex index = m_currentListView->currentIndex();
+ if (!index.isValid()) {
+ return;
+ }
+
+ AccountItem *item = m_accountsListModel->itemForIndex(m_currentModel->mapToSource(index));
+
+ if (!item) {
+ return;
+ }
+
+ AccountIdentityDialog dialog(item->account(),this);
+ dialog.exec();
+}
+
+
void KCMTelepathyAccounts::onRemoveAccountClicked()
{
kDebug();
diff --git a/src/kcm-telepathy-accounts.h b/src/kcm-telepathy-accounts.h
index 8e4b519..29629eb 100644
--- a/src/kcm-telepathy-accounts.h
+++ b/src/kcm-telepathy-accounts.h
@@ -65,6 +65,7 @@ private Q_SLOTS:
void onSelectedItemChanged(const QModelIndex ¤t, const QModelIndex &previous);
void onAddAccountClicked();
void onEditAccountClicked();
+ void onEditIdentityClicked();
void onRemoveAccountClicked();
void onModelDataChanged();
void onSalutEnableButtonToggled(bool checked);
diff --git a/src/main-widget.ui b/src/main-widget.ui
index 8ee8aa0..62af7b6 100644
--- a/src/main-widget.ui
+++ b/src/main-widget.ui
@@ -102,43 +102,6 @@
</layout>
</widget>
</item>
-<!-- <item>
- <widget class="QFrame" name="frame">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>80</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>-->
</layout>
</widget>
</item>
@@ -196,6 +159,16 @@
</widget>
</item>
<item>
+ <widget class="KPushButton" name="editAccountIdentityButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Edit Identity</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="KPushButton" name="removeAccountButton">
<property name="enabled">
<bool>false</bool>
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list