Commit 0f161b03 authored by Méven Car's avatar Méven Car

Hide irrevelevant default button, code clean and future proofing

Reviewers: ngraham, #plasma

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26847
parent c3f4e6b0
......@@ -248,7 +248,7 @@ void AccountInfo::hasChanged()
m_infoToSave = infoToSave;
Q_EMIT changed(!m_infoToSave.isEmpty());
emit changed(!m_infoToSave.isEmpty());
}
QString AccountInfo::cleanName(QString name) const
......@@ -400,7 +400,7 @@ void AccountInfo::openGallery()
QString path = gallery->url().toLocalFile();
m_info->face->setIcon(QIcon(path));
m_infoToSave.insert(AccountModel::Face, path);
Q_EMIT changed(true);
emit changed(true);
}
QStringList AccountInfo::imageFormats() const
......@@ -440,7 +440,7 @@ void AccountInfo::avatarCreated(KJob* job)
CreateAvatarJob *aJob = qobject_cast<CreateAvatarJob*>(job);
m_info->face->setIcon(QIcon(aJob->avatarPath()));
m_infoToSave.insert(AccountModel::Face, aJob->avatarPath());
Q_EMIT changed(true);
emit changed(true);
}
}
......@@ -459,7 +459,7 @@ void AccountInfo::clearAvatar()
{
m_info->face->setIcon(QIcon::fromTheme(QStringLiteral("user-identity")).pixmap(48, 48));
m_infoToSave.insert(AccountModel::Face, QString());
Q_EMIT changed(true);
emit changed(true);
}
void AccountInfo::changePassword()
......@@ -472,5 +472,5 @@ void AccountInfo::changePassword()
}
m_infoToSave[AccountModel::Password] = dialog->password();
Q_EMIT changed(true);
emit changed(true);
}
......@@ -41,7 +41,11 @@ UserManager::UserManager(QWidget* parent, const QVariantList& args)
, m_widget(new AccountInfo(m_model, this))
, m_ui(new Ui::KCMUserManager)
{
Q_UNUSED(args);
Q_UNUSED(args)
// No default button
setButtons( Apply | Help);
QVBoxLayout *layout = new QVBoxLayout();
m_ui->setupUi(this);
m_ui->accountInfo->setLayout(layout);
......@@ -61,7 +65,7 @@ UserManager::UserManager(QWidget* parent, const QVariantList& args)
connect(m_ui->addBtn, &QAbstractButton::clicked, this, &UserManager::addNewUser);
connect(m_ui->removeBtn, &QAbstractButton::clicked, this, &UserManager::removeUser);
connect(m_widget, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
connect(m_widget, &AccountInfo::changed, this, &KCModule::changed);
connect(m_model, &QAbstractItemModel::dataChanged, this, &UserManager::dataChanged);
}
......@@ -82,7 +86,7 @@ void UserManager::save()
void UserManager::currentChanged(const QModelIndex& selected, const QModelIndex& previous)
{
Q_UNUSED(previous);
Q_UNUSED(previous)
m_widget->setModelIndex(selected);
bool enabled = false;
......@@ -97,7 +101,7 @@ void UserManager::currentChanged(const QModelIndex& selected, const QModelIndex&
void UserManager::dataChanged(const QModelIndex& topLeft, const QModelIndex& topRight)
{
Q_UNUSED(topRight);
Q_UNUSED(topRight)
if (m_selectionModel->currentIndex() != topLeft) {
return;
}
......@@ -133,7 +137,7 @@ void UserManager::removeUser()
bool deleteFiles = result == KMessageBox::Yes ? false : true;
m_model->removeAccountKeepingFiles(index.row(), deleteFiles);
Q_EMIT changed(false);
emit changed(false);
}
#include "usermanager.moc"
Markdown is supported
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