[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:01:24 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=5696aa8

The following commit has been merged in the master branch:
commit 5696aa8152b1925f6e7d93bf9aea0f89f7c68773
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Tue Jan 10 18:17:37 2012 +0100

    Change "Edit Identity" dialog's "Apply" button to "Ok" button. Usability++
    
    The Tp::PendingOperation always returns no-error-state, therefore there's no use waiting for them and the dialog can be simply closed instead of clicking Apply + Cancel/Close window button.
    
    Reviewed-by: David Edmundson
---
 src/account-identity-dialog.cpp | 41 ++++++++---------------------------------
 src/account-identity-dialog.h   |  8 ++++----
 2 files changed, 12 insertions(+), 37 deletions(-)

diff --git a/src/account-identity-dialog.cpp b/src/account-identity-dialog.cpp
index af8f941..bb5191d 100644
--- a/src/account-identity-dialog.cpp
+++ b/src/account-identity-dialog.cpp
@@ -3,6 +3,7 @@
 
 #include <TelepathyQt/Account>
 #include <TelepathyQt/AvatarData>
+#include <TelepathyQt/PendingOperation>
 
 //FIXME possibly need to monitor account connection status and disable if appropriate?
 
@@ -19,7 +20,7 @@ AccountIdentityDialog::AccountIdentityDialog(const Tp::AccountPtr &account, QWid
     setMainWidget(widget);
 
     setWindowTitle(i18n("Edit Account Identity"));
-    setButtons(KDialog::Cancel | KDialog::Apply);
+    setButtons(KDialog::Ok | KDialog::Cancel);
 
     connect(m_account.data(), SIGNAL(nicknameChanged(QString)), SLOT(onNicknameChanged(QString)));
     connect(m_account.data(), SIGNAL(avatarChanged(Tp::Avatar)), SLOT(onAvatarChanged(Tp::Avatar)));
@@ -27,12 +28,8 @@ AccountIdentityDialog::AccountIdentityDialog(const Tp::AccountPtr &account, QWid
     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()));
+    connect(this, SIGNAL(okClicked()), SLOT(apply()));
 }
 
 AccountIdentityDialog::~AccountIdentityDialog()
@@ -40,47 +37,25 @@ 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()
 {
-    if (m_account.isNull()) {
-        return;
+    if (!m_account.isNull()) {
+        //not much point watching these, they just return that everything was OK even when it isn't.
+        m_account->setAvatar(ui->accountAvatar->avatar());
+        m_account->setNickname(ui->accountNickname->text());
     }
 
-    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());
+    close();
 }
 
 #include "account-identity-dialog.moc"
diff --git a/src/account-identity-dialog.h b/src/account-identity-dialog.h
index 72b04f4..12d9b68 100644
--- a/src/account-identity-dialog.h
+++ b/src/account-identity-dialog.h
@@ -5,6 +5,10 @@
 
 #include <TelepathyQt/Types>
 
+namespace Tp {
+class PendingOperation;
+}
+
 namespace Ui {
     class AccountIdentityDialog;
 }
@@ -19,9 +23,6 @@ public:
     explicit AccountIdentityDialog(const Tp::AccountPtr &account, QWidget *parent = 0);
     ~AccountIdentityDialog();
 
-    /** Returns if the user has changed settings*/
-    bool hasChanged() const;
-
 public Q_SLOTS:
     /** Updates the account to user selection*/
     void apply();
@@ -29,7 +30,6 @@ public Q_SLOTS:
 private Q_SLOTS:
     void onNicknameChanged(const QString &nickname);
     void onAvatarChanged(const Tp::Avatar &avatar);
-    void onEdited();
 
 private:
     Tp::AccountPtr m_account;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list