[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:17 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=bdf5f18
The following commit has been merged in the master branch:
commit bdf5f1839819458af7624e1857bc7a21e8c2c3d3
Author: Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
Date: Fri Dec 30 17:24:38 2011 +0100
Simplify and fix displayName creation in SalutMessageWidget
---
src/salut-message-widget.cpp | 42 ++++++++++++++++++++++--------------------
src/salut-message-widget.h | 2 +-
2 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/salut-message-widget.cpp b/src/salut-message-widget.cpp
index 6fa34fe..3014f91 100644
--- a/src/salut-message-widget.cpp
+++ b/src/salut-message-widget.cpp
@@ -1,6 +1,7 @@
/*
Extended KMessageWidget for link-local xmpp account autocreation
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
@@ -25,6 +26,7 @@
#include <KLocalizedString>
#include <KIcon>
#include <KAction>
+#include <KDebug>
#include <QtGui/QLayout>
#include <QtGui/QWidgetAction>
@@ -71,32 +73,32 @@ SalutMessageWidget::~SalutMessageWidget()
}
///these params always comes from KUser with first & last name split manually by the last space
-void SalutMessageWidget::setParams(const QString& firstname, const QString& lastname, const QString& nick)
+void SalutMessageWidget::setParams(const QString& firstname, const QString& lastname, const QString& nickname)
{
QString displayName;
- //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(lastname.isEmpty() ? firstname : lastname, nick);
-
- //either one of the names is filled and nick is empty
- } else if (((lastname.isEmpty() && !firstname.isEmpty()) || (!lastname.isEmpty() && firstname.isEmpty()))
- && nick.isEmpty()) {
-
- displayName = QString::fromLatin1("%1").arg(lastname.isEmpty() ? firstname : lastname);
-
- //both first & last names are empty but nick is not
- } else if (lastname.isEmpty() && firstname.isEmpty() && !nick.isEmpty()) {
+ if (!firstname.isEmpty()) {
+ displayName = firstname;
+ }
- displayName = QString::fromLatin1("%1").arg(nick);
+ if (!lastname.isEmpty()) {
+ if (!displayName.isEmpty()) {
+ displayName.append(QString::fromLatin1(" %1").arg(lastname));
+ } else {
+ displayName = lastname;
+ }
+ }
- } else if (lastname.isEmpty() && firstname.isEmpty() && nick.isEmpty()) {
+ if (!nickname.isEmpty()) {
+ if (!displayName.isEmpty()) {
+ displayName.append(QString::fromLatin1(" (%1)").arg(nickname));
+ } else {
+ displayName = nickname;
+ }
+ }
+ if (displayName.isEmpty()) {
//FIXME: let the user know that he reached a very strange situation
-
- } else {
- displayName = QString::fromLatin1("%1 %2 (%3)").arg(firstname, lastname, nick);
+ kWarning() << "All fields are empty";
}
setText(i18n("You will appear as \"%1\" on your local network.",
diff --git a/src/salut-message-widget.h b/src/salut-message-widget.h
index 4ebd849..7796bfa 100644
--- a/src/salut-message-widget.h
+++ b/src/salut-message-widget.h
@@ -30,7 +30,7 @@ public:
SalutMessageWidget(QWidget *parent = 0);
virtual ~SalutMessageWidget();
- void setParams(const QString &firstname, const QString &lastname, const QString &nick);
+ void setParams(const QString &firstname, const QString &lastname, const QString &nickname);
Q_SIGNALS:
void timeout();
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list