Changeset View
Changeset View
Standalone View
Standalone View
src/accountinfo.cpp
Show All 30 Lines | |||||
31 | #include <QStandardPaths> | 31 | #include <QStandardPaths> | ||
32 | #include <QImageReader> | 32 | #include <QImageReader> | ||
33 | #include <QFontDatabase> | 33 | #include <QFontDatabase> | ||
34 | #include <QFileDialog> | 34 | #include <QFileDialog> | ||
35 | 35 | | |||
36 | #include "user_manager_debug.h" | 36 | #include "user_manager_debug.h" | ||
37 | #include <KJob> | 37 | #include <KJob> | ||
38 | #include <KIO/CopyJob> | 38 | #include <KIO/CopyJob> | ||
39 | #include <KIconLoader> | | |||
40 | #include <KUser> | 39 | #include <KUser> | ||
41 | #include <KI18n/klocalizedstring.h> | 40 | #include <KI18n/klocalizedstring.h> | ||
42 | 41 | | |||
43 | AccountInfo::AccountInfo(AccountModel* model, QWidget* parent, Qt::WindowFlags f) | 42 | AccountInfo::AccountInfo(AccountModel* model, QWidget* parent, Qt::WindowFlags f) | ||
44 | : QWidget(parent, f) | 43 | : QWidget(parent, f) | ||
45 | , m_info(new Ui::AccountInfo()) | 44 | , m_info(new Ui::AccountInfo()) | ||
46 | , m_model(model) | 45 | , m_model(model) | ||
47 | { | 46 | { | ||
Show All 25 Lines | |||||
73 | QAction *editClear = new QAction(i18n("Clear Avatar"), this); | 72 | QAction *editClear = new QAction(i18n("Clear Avatar"), this); | ||
74 | editClear->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear"))); | 73 | editClear->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear"))); | ||
75 | connect(editClear, &QAction::triggered, this, &AccountInfo::clearAvatar); | 74 | connect(editClear, &QAction::triggered, this, &AccountInfo::clearAvatar); | ||
76 | 75 | | |||
77 | menu->addAction(gallery); | 76 | menu->addAction(gallery); | ||
78 | menu->addAction(openAvatar); | 77 | menu->addAction(openAvatar); | ||
79 | menu->addAction(editClear); | 78 | menu->addAction(editClear); | ||
80 | 79 | | |||
81 | int iconSizeX = IconSize(KIconLoader::Dialog); | 80 | int iconSizeX = style()->pixelMetric(QStyle::PM_LargeIconSize); | ||
82 | QSize iconSize(iconSizeX, iconSizeX); | 81 | QSize iconSize(iconSizeX, iconSizeX); | ||
83 | m_info->face->setIconSize(iconSize); | 82 | m_info->face->setIconSize(iconSize); | ||
84 | m_info->face->setMinimumSize(iconSize); | 83 | m_info->face->setMinimumSize(iconSize); | ||
85 | m_info->face->setMenu(menu); | 84 | m_info->face->setMenu(menu); | ||
86 | 85 | | |||
87 | int size = QFontMetrics(QFontDatabase::systemFont(QFontDatabase::FixedFont)).xHeight() * 29; | 86 | int size = QFontMetrics(QFontDatabase::systemFont(QFontDatabase::FixedFont)).xHeight() * 29; | ||
88 | m_info->username->setMinimumWidth(size); | 87 | m_info->username->setMinimumWidth(size); | ||
89 | m_info->realName->setMinimumWidth(size); | 88 | m_info->realName->setMinimumWidth(size); | ||
▲ Show 20 Lines • Show All 363 Lines • ▼ Show 20 Line(s) | 448 | { | |||
453 | // If there is a leftover temp file, remove it | 452 | // If there is a leftover temp file, remove it | ||
454 | if (cJob->srcUrls().constFirst().path().startsWith(QLatin1String("/tmp/"))) { | 453 | if (cJob->srcUrls().constFirst().path().startsWith(QLatin1String("/tmp/"))) { | ||
455 | QFile::remove(cJob->srcUrls().constFirst().path()); | 454 | QFile::remove(cJob->srcUrls().constFirst().path()); | ||
456 | } | 455 | } | ||
457 | } | 456 | } | ||
458 | 457 | | |||
459 | void AccountInfo::clearAvatar() | 458 | void AccountInfo::clearAvatar() | ||
460 | { | 459 | { | ||
461 | QSize icon(IconSize(KIconLoader::Dialog), IconSize(KIconLoader::Dialog)); | | |||
462 | m_info->face->setIcon(QIcon::fromTheme(QStringLiteral("user-identity")).pixmap(48, 48)); | 460 | m_info->face->setIcon(QIcon::fromTheme(QStringLiteral("user-identity")).pixmap(48, 48)); | ||
463 | m_infoToSave.insert(AccountModel::Face, QString()); | 461 | m_infoToSave.insert(AccountModel::Face, QString()); | ||
464 | Q_EMIT changed(true); | 462 | Q_EMIT changed(true); | ||
465 | } | 463 | } | ||
466 | 464 | | |||
467 | void AccountInfo::changePassword() | 465 | void AccountInfo::changePassword() | ||
468 | { | 466 | { | ||
469 | QScopedPointer<PasswordDialog> dialog(new PasswordDialog(this)); | 467 | QScopedPointer<PasswordDialog> dialog(new PasswordDialog(this)); | ||
Show All 9 Lines |