File indexing completed on 2024-06-23 05:14:20

0001 /*  keycacheoverlay.h
0002 
0003     This file is part of Kleopatra, the KDE keymanager
0004     SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
0005     SPDX-FileContributor: Intevation GmbH
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QTimer>
0012 #include <QWidget>
0013 
0014 namespace Kleo
0015 {
0016 
0017 /**
0018  * @internal
0019  * Overlay widget to block KeyCache-dependent widgets if the Keycache
0020  * is not initialized.
0021  */
0022 class KeyCacheOverlay : public QWidget
0023 {
0024     Q_OBJECT
0025 public:
0026     /**
0027      * Create an overlay widget for @p baseWidget.
0028      * @p baseWidget must not be null.
0029      * @p parent must not be equal to @p baseWidget
0030      */
0031     explicit KeyCacheOverlay(QWidget *baseWidget, QWidget *parent = nullptr);
0032 
0033 protected:
0034     bool eventFilter(QObject *object, QEvent *event) override;
0035 
0036 private:
0037     void reposition();
0038 
0039 private Q_SLOTS:
0040     /** Hides the overlay and triggers deletion. */
0041     void hideOverlay();
0042 
0043 private:
0044     QWidget *mBaseWidget;
0045     QTimer mTimer;
0046 };
0047 
0048 } // namespace Kleo