From 60c5c9f13b97c25e3b73f57fc107622d483d5160 Mon Sep 17 00:00:00 2001 From: Tobias Markmann <tm@ayena.de> Date: Wed, 16 Oct 2013 10:22:10 +0200 Subject: VCard: Removing whitespace due to empty fields in the full name. Change-Id: Ib97d7bff7fcd0364924e6266c4d20d7d71e9ad09 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. diff --git a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp index 3ddc86b..4ad12c8 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.cpp @@ -4,8 +4,9 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ -#include "QtVCardPhotoAndNameFields.h" -#include "ui_QtVCardPhotoAndNameFields.h" +#include <Swift/QtUI/QtVCardWidget/QtVCardPhotoAndNameFields.h> + +#include <Swift/QtUI/QtVCardWidget/ui_QtVCardPhotoAndNameFields.h> #include <QMenu> @@ -68,8 +69,12 @@ void QtVCardPhotoAndNameFields::setEditable(bool editable) { ui->lineEditFAMILY->setVisible(editable); ui->lineEditSUFFIX->setVisible(editable); ui->labelFULLNAME->setVisible(!editable); - ui->labelFULLNAME->setText( ui->lineEditPREFIX->text() + " " + ui->lineEditGIVEN->text() + " " + - ui->lineEditMIDDLE->text() + " " + ui->lineEditFAMILY->text() + " " + ui->lineEditSUFFIX->text()); + + QStringList fullname; + fullname << ui->lineEditPREFIX->text() << ui->lineEditGIVEN->text() << ui->lineEditMIDDLE->text(); + fullname << ui->lineEditFAMILY->text() << ui->lineEditSUFFIX->text(); + fullname = fullname.filter(".*\\S.*"); + ui->labelFULLNAME->setText(fullname.join(" ")); prepareAddFieldMenu(); } -- cgit v0.10.2-6-g49f6