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


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

The following commit has been merged in the master branch:
commit 8576381d284e21244ed193bad9976d90f1aa27fa
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Fri Dec 30 15:45:27 2011 +0100

    Simplify and fix displayName creation in SalutEnabler
---
 src/salut-enabler.cpp | 45 +++++++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 24 deletions(-)

diff --git a/src/salut-enabler.cpp b/src/salut-enabler.cpp
index d9a296c..b16e57f 100644
--- a/src/salut-enabler.cpp
+++ b/src/salut-enabler.cpp
@@ -1,6 +1,7 @@
 /*
     Class that auto configures link-local xmpp account
     Copyright (C) 2011  Martin Klapetek <martin.klapetek at gmail.com>
+    Copyright (C) 2012  Daniele E. Domenichelli <daniele.domenichelli 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
@@ -189,35 +190,31 @@ void SalutEnabler::onUserAccepted()
 
     QString lastname = d->values[lastNamePar].toString();
     QString firstname = d->values[firstNamePar].toString();
-    QString nick = d->values[nickNamePar].toString();
+    QString nickname = d->values[nickNamePar].toString();
 
-    //either one of the names is filled and nick is filled
-    if (((lastname.isEmpty() && !firstname.isEmpty()) || (!lastname.isEmpty() && firstname.isEmpty()))
-            && !nick.isEmpty()) {
-
-        displayName = QString::fromLatin1("%1 (%2)").arg(d->values[firstNamePar].toString().isEmpty() ?
-                d->values[lastNamePar].toString() : d->values[firstNamePar].toString(),
-                                                            d->values[nickNamePar].toString());
-
-    //either one of the names is filled and nick is empty
-    } else if (((lastname.isEmpty() && !firstname.isEmpty()) || (!lastname.isEmpty() && firstname.isEmpty()))
-            && nick.isEmpty()) {
-
-        displayName = d->values[firstNamePar].toString().isEmpty() ?
-                d->values[lastNamePar].toString() : d->values[firstNamePar].toString();
+    if (!firstname.isEmpty()) {
+        displayName = firstname;
+    }
 
-    //both first & last names are empty but nick is not
-    } else if (lastname.isEmpty() && firstname.isEmpty() && !nick.isEmpty()) {
+    if (!lastname.isEmpty()) {
+        if (!displayName.isEmpty()) {
+            displayName.append(QString::fromLatin1(" %1").arg(lastname));
+        } else {
+            displayName = lastname;
+        }
+    }
 
-        displayName = d->values[nickNamePar].toString();
+    if (!nickname.isEmpty()) {
+        if (!displayName.isEmpty()) {
+            displayName.append(QString::fromLatin1(" (%1)").arg(nickname));
+        } else {
+            displayName = nickname;
+        }
+    }
 
-    } else if (lastname.isEmpty() && firstname.isEmpty() && nick.isEmpty()) {
+    if (displayName.isEmpty()) {
         //FIXME: let the user know that he reached a very strange situation
-
-    } else {
-        displayName = QString::fromLatin1("%1 %2 (%3)").arg(d->values[firstNamePar].toString(),
-                                                               d->values[lastNamePar].toString(),
-                                                               d->values[nickNamePar].toString());
+        kWarning() << "All fields are empty";
     }
 
     Tp::PendingAccount *pa = d->accountManager->createAccount(d->profile->cmName(),

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list