File: kwalletmanagerwidget.h

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 (53 lines) | stat: -rw-r--r-- 1,469 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
42
43
44
45
46
47
48
49
50
51
52
53
/*
    This file is part of the KDE libraries
    SPDX-FileCopyrightText: 2013 Valentin Rusu <kde@rusu.info>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/
#ifndef KWALLETMANAGERWIDGET_H
#define KWALLETMANAGERWIDGET_H

#include <KPageWidget>
#include <QLabel>

class QUrl;
class QDropEvent;
class KWalletManagerWidgetItem;
class QDragEnterEvent;
class QDragMoveEvent;

class KWalletManagerWidget : public KPageWidget
{
    Q_OBJECT
public:
    explicit KWalletManagerWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = {});
    ~KWalletManagerWidget() override;

    void updateWalletDisplay(const QString &selectWallet = QString());
    bool hasWallet(const QString &) const;
    bool openWalletFile(const QString &path);
    bool openWallet(const QString &name);

    QString activeWalletName() const;
    bool hasUnsavedChanges(const QString &name) const;

    void setErrorMessage(const QString &message);

protected:
    void dragEnterEvent(QDragEnterEvent *e) override;
    void dragMoveEvent(QDragMoveEvent *e) override;
    void dropEvent(QDropEvent *e) override;

private Q_SLOTS:
    void onCurrentPageChanged(KPageWidgetItem *, KPageWidgetItem *);

private:
    bool shouldIgnoreDropEvent(const QDropEvent *e, QUrl *u) const;

    using WalletPagesHash = QHash<QString, KWalletManagerWidgetItem *>;
    WalletPagesHash _walletPages;
    KPageWidgetItem *_errorItem = nullptr;
    QLabel *_errorLabel = nullptr;
};

#endif // KWALLETMANAGERWIDGET_H