Changeset View
Changeset View
Standalone View
Standalone View
src/usermanager.cpp
Show All 25 Lines | |||||
26 | 26 | | |||
27 | #include <pwquality.h> | 27 | #include <pwquality.h> | ||
28 | 28 | | |||
29 | #include <QVBoxLayout> | 29 | #include <QVBoxLayout> | ||
30 | 30 | | |||
31 | #include <kpluginfactory.h> | 31 | #include <kpluginfactory.h> | ||
32 | #include <KLocalizedString> | 32 | #include <KLocalizedString> | ||
33 | #include <KMessageBox> | 33 | #include <KMessageBox> | ||
34 | #include <KIconLoader> | | |||
35 | 34 | | |||
36 | K_PLUGIN_FACTORY(UserManagerFactory, registerPlugin<UserManager>();) | 35 | K_PLUGIN_FACTORY(UserManagerFactory, registerPlugin<UserManager>();) | ||
37 | 36 | | |||
38 | UserManager::UserManager(QWidget* parent, const QVariantList& args) | 37 | UserManager::UserManager(QWidget* parent, const QVariantList& args) | ||
39 | : KCModule(parent, args) | 38 | : KCModule(parent, args) | ||
40 | , m_saveNeeded(false) | 39 | , m_saveNeeded(false) | ||
41 | , m_model(new AccountModel(this)) | 40 | , m_model(new AccountModel(this)) | ||
42 | , m_widget(new AccountInfo(m_model, this)) | 41 | , m_widget(new AccountInfo(m_model, this)) | ||
43 | , m_ui(new Ui::KCMUserManager) | 42 | , m_ui(new Ui::KCMUserManager) | ||
44 | { | 43 | { | ||
45 | Q_UNUSED(args); | 44 | Q_UNUSED(args); | ||
46 | QVBoxLayout *layout = new QVBoxLayout(); | 45 | QVBoxLayout *layout = new QVBoxLayout(); | ||
47 | m_ui->setupUi(this); | 46 | m_ui->setupUi(this); | ||
48 | m_ui->accountInfo->setLayout(layout); | 47 | m_ui->accountInfo->setLayout(layout); | ||
49 | layout->addWidget(m_widget); | 48 | layout->addWidget(m_widget); | ||
50 | 49 | | |||
51 | m_selectionModel = new QItemSelectionModel(m_model); | 50 | m_selectionModel = new QItemSelectionModel(m_model); | ||
52 | connect(m_selectionModel, &QItemSelectionModel::currentChanged, this, &UserManager::currentChanged); | 51 | connect(m_selectionModel, &QItemSelectionModel::currentChanged, this, &UserManager::currentChanged); | ||
53 | m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent); | 52 | m_selectionModel->setCurrentIndex(m_model->index(0), QItemSelectionModel::SelectCurrent); | ||
54 | 53 | | |||
55 | m_ui->userList->setModel(m_model); | 54 | m_ui->userList->setModel(m_model); | ||
56 | m_ui->userList->setSelectionModel(m_selectionModel); | 55 | m_ui->userList->setSelectionModel(m_selectionModel); | ||
57 | m_ui->userList->setIconSize(QSize(IconSize(KIconLoader::Dialog), IconSize(KIconLoader::Dialog))); | 56 | const auto iconSize = style()->pixelMetric(QStyle::PM_LargeIconSize); | ||
57 | m_ui->userList->setIconSize(QSize(iconSize, iconSize)); | ||||
58 | 58 | | |||
59 | ModelTest* test = new ModelTest(m_model, nullptr); | 59 | ModelTest* test = new ModelTest(m_model, nullptr); | ||
60 | Q_UNUSED(test) | 60 | Q_UNUSED(test) | ||
61 | 61 | | |||
62 | connect(m_ui->addBtn, &QAbstractButton::clicked, this, &UserManager::addNewUser); | 62 | connect(m_ui->addBtn, &QAbstractButton::clicked, this, &UserManager::addNewUser); | ||
63 | connect(m_ui->removeBtn, &QAbstractButton::clicked, this, &UserManager::removeUser); | 63 | connect(m_ui->removeBtn, &QAbstractButton::clicked, this, &UserManager::removeUser); | ||
64 | connect(m_widget, SIGNAL(changed(bool)), SIGNAL(changed(bool))); | 64 | connect(m_widget, SIGNAL(changed(bool)), SIGNAL(changed(bool))); | ||
65 | connect(m_model, &QAbstractItemModel::dataChanged, this, &UserManager::dataChanged); | 65 | connect(m_model, &QAbstractItemModel::dataChanged, this, &UserManager::dataChanged); | ||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |