File indexing completed on 2024-12-01 04:36:36

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "authenticationbutton.h"
0008 #include <KLocalizedString>
0009 
0010 AuthenticationButton::AuthenticationButton(QWidget *parent)
0011     : QPushButton(parent)
0012 {
0013     connect(this, &QPushButton::clicked, this, [this]() {
0014         Q_EMIT authentication(mAuthenticationInfo.oauthType());
0015     });
0016 }
0017 
0018 AuthenticationButton::~AuthenticationButton() = default;
0019 
0020 void AuthenticationButton::setAuthenticationInfo(const AuthenticationInfo &info)
0021 {
0022     mAuthenticationInfo = info;
0023     setText(i18n("Sign in with %1", info.name()));
0024     setIcon(QIcon::fromTheme(info.iconName()));
0025 }
0026 
0027 AuthenticationInfo AuthenticationButton::authenticationInfo() const
0028 {
0029     return mAuthenticationInfo;
0030 }
0031 
0032 #include "moc_authenticationbutton.cpp"