File indexing completed on 2024-05-19 05:55:47
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2013 Valentin Rusu <kde@rusu.info> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "kwalletmanagerwidgetitem.h" 0009 #include "walletcontrolwidget.h" 0010 0011 #include <KWallet> 0012 #include <QIcon> 0013 0014 KWalletManagerWidgetItem::KWalletManagerWidgetItem(QWidget *widgetParent, const QString &walletName): 0015 KPageWidgetItem(_controlWidget = new WalletControlWidget(widgetParent, walletName), walletName), 0016 _walletName(walletName) 0017 { 0018 updateWalletDisplay(); 0019 } 0020 0021 void KWalletManagerWidgetItem::updateWalletDisplay() 0022 { 0023 if (KWallet::Wallet::isOpen(_walletName)) { 0024 setIcon(QIcon::fromTheme(QStringLiteral("wallet-open"))); 0025 } else { 0026 setIcon(QIcon::fromTheme(QStringLiteral("wallet-closed"))); 0027 } 0028 _controlWidget->updateWalletDisplay(); 0029 } 0030 0031 bool KWalletManagerWidgetItem::openWallet() 0032 { 0033 return _controlWidget->openWallet(); 0034 } 0035 0036 bool KWalletManagerWidgetItem::hasUnsavedChanges() const 0037 { 0038 return (_controlWidget ? _controlWidget->hasUnsavedChanges() : false); 0039 } 0040 0041 #include "moc_kwalletmanagerwidgetitem.cpp"