Commit 5efa465c authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

accounts: eliminate the notion of a default profile name

- Removes the use of the system current username as the default
  profile name in the account creation wizard, and also removes
  the insertion of "Jami account" as a profile name if the user
  clears the profile name text field.

- For accounts lacking profile name and registered name:
  - fixes the best name display in the account selection combobox
  - fixes the fallback avatar choice

Change-Id: If38d575274542bd59b11dac8a17d983edcbd266c
parent a2aa7e42
...@@ -143,7 +143,6 @@ AccountItemDelegate::paint(QPainter* painter, ...@@ -143,7 +143,6 @@ AccountItemDelegate::paint(QPainter* painter,
} }
// Display the secondary ID under the name // Display the secondary ID under the name
QString idStr = index.data(static_cast<int>(AccountListModel::Role::Username)).value<QString>(); QString idStr = index.data(static_cast<int>(AccountListModel::Role::Username)).value<QString>();
if (idStr != name.toString()) { if (idStr != name.toString()) {
fontSecondary.setItalic(false); fontSecondary.setItalic(false);
......
...@@ -60,7 +60,7 @@ QVariant AccountListModel::data(const QModelIndex &index, int role) const ...@@ -60,7 +60,7 @@ QVariant AccountListModel::data(const QModelIndex &index, int role) const
switch (role) { switch (role) {
case Role::Alias: case Role::Alias:
case Qt::DisplayRole: case Qt::DisplayRole:
return QVariant(QString::fromStdString(accountInfo.profileInfo.alias)); return QVariant(QString::fromStdString(Utils::bestNameForAccount(accountInfo)));
case Role::Username: case Role::Username:
return QVariant(QString::fromStdString(Utils::secondBestNameForAccount(accountInfo))); return QVariant(QString::fromStdString(Utils::secondBestNameForAccount(accountInfo)));
case Role::Type: case Role::Type:
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
#include "utils.h" #include "utils.h"
#include "ringthemeutils.h" #include "ringthemeutils.h"
const QString DEFAULT_RING_ACCT_ALIAS = QObject::tr("Jami account", "Default alias for new Jami account");
NewWizardWidget::NewWizardWidget(QWidget* parent) : NewWizardWidget::NewWizardWidget(QWidget* parent) :
NavWidget(parent), NavWidget(parent),
ui(new Ui::NewWizardWidget), ui(new Ui::NewWizardWidget),
...@@ -188,7 +186,7 @@ void NewWizardWidget::changePage(QWidget* toPage) ...@@ -188,7 +186,7 @@ void NewWizardWidget::changePage(QWidget* toPage)
ui->confirmPasswordEdit->clear(); ui->confirmPasswordEdit->clear();
ui->signUpCheckbox->setChecked(true); ui->signUpCheckbox->setChecked(true);
ui->usernameEdit->setEnabled(true); ui->usernameEdit->setEnabled(true);
ui->fullNameEdit->setText(Utils::GetCurrentUserName()); ui->fullNameEdit->setText(QString());
setNavBarVisibility(true); setNavBarVisibility(true);
updateCustomUI(); updateCustomUI();
registeredNameFoundConnection_ = connect( registeredNameFoundConnection_ = connect(
......
...@@ -353,9 +353,10 @@ PixbufManipulator::accountPhoto(const lrc::api::account::Info& accountInfo) ...@@ -353,9 +353,10 @@ PixbufManipulator::accountPhoto(const lrc::api::account::Info& accountInfo)
else { else {
auto bestId = Utils::bestIdForAccount(accountInfo); auto bestId = Utils::bestIdForAccount(accountInfo);
auto bestName = Utils::bestNameForAccount(accountInfo); auto bestName = Utils::bestNameForAccount(accountInfo);
QString letterStr = bestId == bestName ? QString() : QString::fromStdString(bestName);
photo = fallbackAvatar( IMAGE_SIZE, photo = fallbackAvatar( IMAGE_SIZE,
QString::fromStdString("ring:" + bestId), QString::fromStdString("ring:" + bestId),
QString::fromStdString(bestName)); letterStr);
} }
return QVariant::fromValue(scaleAndFrame(photo, IMAGE_SIZE)); return QVariant::fromValue(scaleAndFrame(photo, IMAGE_SIZE));
} }
...@@ -166,18 +166,6 @@ Utils::GetISODate() { ...@@ -166,18 +166,6 @@ Utils::GetISODate() {
#endif #endif
} }
QString
Utils::GetCurrentUserName() {
#ifdef Q_OS_WIN
wchar_t username[UNLEN+1];
DWORD username_len = UNLEN+1;
GetUserName(username, &username_len);
return QString::fromWCharArray(username, username_len-1);
#else
return QString();
#endif
}
void void
Utils::InvokeMailto(const QString& subject, Utils::InvokeMailto(const QString& subject,
const QString& body, const QString& body,
......
...@@ -56,7 +56,6 @@ namespace Utils ...@@ -56,7 +56,6 @@ namespace Utils
QString GetRingtonePath(); QString GetRingtonePath();
QString GenGUID(); QString GenGUID();
QString GetISODate(); QString GetISODate();
QString GetCurrentUserName();
void InvokeMailto(const QString& subject, const QString& body, const QString& attachement = QString()); void InvokeMailto(const QString& subject, const QString& body, const QString& attachement = QString());
QImage getCirclePhoto(const QImage original, int sizePhoto); QImage getCirclePhoto(const QImage original, int sizePhoto);
void setStackWidget(QStackedWidget *stack, QWidget *widget); void setStackWidget(QStackedWidget *stack, QWidget *widget);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment