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


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

The following commit has been merged in the master branch:
commit 45fee72c9e6fac73b8614e229ee8ce667df781bf
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date:   Wed Dec 28 11:03:15 2011 +0100

    Update display name in Salut
---
 plugins/salut/salut-main-options-widget.cpp | 47 ++++++++++++++++++++++++++---
 plugins/salut/salut-main-options-widget.h   |  1 +
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/plugins/salut/salut-main-options-widget.cpp b/plugins/salut/salut-main-options-widget.cpp
index ff0339a..fdd23b5 100644
--- a/plugins/salut/salut-main-options-widget.cpp
+++ b/plugins/salut/salut-main-options-widget.cpp
@@ -2,6 +2,7 @@
  * This file is part of telepathy-firstnames-kcm-plugins
  *
  * Copyright (C) 2011 Florian Reinhard <florian.reinhard at googlemail.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
@@ -31,15 +32,21 @@ SalutMainOptionsWidget::SalutMainOptionsWidget(ParameterEditModel *model, QWidge
     m_ui = new Ui::SalutMainOptionsWidget;
     m_ui->setupUi(this);
 
-    handleParameter(QLatin1String("first-name"), QVariant::String, m_ui->firstnameLineEdit, m_ui->firstnameLabel);
-    handleParameter(QLatin1String("last-name"),  QVariant::String, m_ui->lastnameLineEdit,  m_ui->lastnameLabel);
-    handleParameter(QLatin1String("nickname"),   QVariant::String, m_ui->nicknameLineEdit,  m_ui->nicknameLabel);
+    handleParameter(QLatin1String("first-name"), QVariant::String, m_ui->firstnameLineEdit, m_ui->firstnameLabel, true);
+    handleParameter(QLatin1String("last-name"),  QVariant::String, m_ui->lastnameLineEdit,  m_ui->lastnameLabel, true);
+    handleParameter(QLatin1String("nickname"),   QVariant::String, m_ui->nicknameLineEdit,  m_ui->nicknameLabel, true);
 
     // if the first- and last-name are empty on startup we add them based on
     // the current users full name
-    if (m_ui->firstnameLineEdit->text().isEmpty()) {
+    if (m_ui->firstnameLineEdit->text().isEmpty() &&
+        m_ui->lastnameLineEdit->text().isEmpty() &&
+        m_ui->nicknameLineEdit->text().isEmpty())
+    {
         KUser user = KUser();
-        m_ui->firstnameLineEdit->setText(user.property(KUser::FullName).toString());
+        QString name = user.property(KUser::FullName).toString();
+        int lastSpacePosition = name.lastIndexOf(QLatin1Char(' '));
+        m_ui->firstnameLineEdit->setText(name.left(lastSpacePosition));
+        m_ui->lastnameLineEdit->setText(name.mid(lastSpacePosition + 1));
         m_ui->nicknameLineEdit->setText(user.loginName());
     }
 
@@ -51,4 +58,34 @@ SalutMainOptionsWidget::~SalutMainOptionsWidget()
     delete m_ui;
 }
 
+void SalutMainOptionsWidget::updateDefaultDisplayName()
+{
+    QString displayName;
+    QString firstname = m_ui->firstnameLineEdit->text();
+    QString lastname = m_ui->lastnameLineEdit->text();
+    QString nickname = m_ui->nicknameLineEdit->text();
+
+    if (!firstname.isEmpty()) {
+        displayName = firstname;
+    }
+
+    if (!lastname.isEmpty()) {
+        if (!displayName.isEmpty()) {
+            displayName.append(QString::fromLatin1(" %1").arg(lastname));
+        } else {
+            displayName = lastname;
+        }
+    }
+
+    if (!nickname.isEmpty()) {
+        if (!displayName.isEmpty()) {
+            displayName.append(QString::fromLatin1(" (%1)").arg(nickname));
+        } else {
+            displayName = nickname;
+        }
+    }
+
+    setDefaultDisplayName(displayName);
+}
+
 #include "salut-main-options-widget.moc"
diff --git a/plugins/salut/salut-main-options-widget.h b/plugins/salut/salut-main-options-widget.h
index ab51e19..b61c075 100644
--- a/plugins/salut/salut-main-options-widget.h
+++ b/plugins/salut/salut-main-options-widget.h
@@ -34,6 +34,7 @@ public:
                                     QWidget *parent = 0);
     virtual ~SalutMainOptionsWidget();
 
+    virtual void updateDefaultDisplayName();
 private:
     Q_DISABLE_COPY(SalutMainOptionsWidget);
     Ui::SalutMainOptionsWidget *m_ui;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list