File: kwalletmanagerwidgetitem.cpp

package info (click to toggle)
kwalletmanager 4%3A25.04.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,580 kB
  • sloc: cpp: 4,234; xml: 188; sh: 5; makefile: 3
file content (41 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
    This file is part of the KDE libraries
    SPDX-FileCopyrightText: 2013 Valentin Rusu <kde@rusu.info>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#include "kwalletmanagerwidgetitem.h"
#include "walletcontrolwidget.h"

#include <KWallet>
#include <QIcon>

KWalletManagerWidgetItem::KWalletManagerWidgetItem(QWidget *widgetParent, const QString &walletName)
    : KPageWidgetItem(_controlWidget = new WalletControlWidget(widgetParent, walletName), walletName)
    , _walletName(walletName)
{
    updateWalletDisplay();
}

void KWalletManagerWidgetItem::updateWalletDisplay()
{
    if (KWallet::Wallet::isOpen(_walletName)) {
        setIcon(QIcon::fromTheme(QStringLiteral("wallet-open")));
    } else {
        setIcon(QIcon::fromTheme(QStringLiteral("wallet-closed")));
    }
    _controlWidget->updateWalletDisplay();
}

bool KWalletManagerWidgetItem::openWallet()
{
    return _controlWidget->openWallet();
}

bool KWalletManagerWidgetItem::hasUnsavedChanges() const
{
    return (_controlWidget ? _controlWidget->hasUnsavedChanges() : false);
}

#include "moc_kwalletmanagerwidgetitem.cpp"