File indexing completed on 2024-06-23 05:13:49

0001 /* crypto/gui/decryptverifyfilesdialog.h
0002 
0003     This file is part of Kleopatra, the KDE keymanager
0004     SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
0005     SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
0006     SPDX-FileContributor: Intevation GmbH
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #pragma once
0011 
0012 #include "crypto/task.h"
0013 #include <QDialog>
0014 #include <QDialogButtonBox>
0015 #include <QHash>
0016 #include <QString>
0017 
0018 #include <memory>
0019 
0020 class QVBoxLayout;
0021 class QProgressBar;
0022 template<typename K, typename U>
0023 class QHash;
0024 class QLabel;
0025 
0026 namespace Kleo
0027 {
0028 class FileNameRequester;
0029 namespace Crypto
0030 {
0031 class TaskCollection;
0032 
0033 namespace Gui
0034 {
0035 class ResultListWidget;
0036 
0037 class DecryptVerifyFilesDialog : public QDialog
0038 {
0039     Q_OBJECT
0040 public:
0041     explicit DecryptVerifyFilesDialog(const std::shared_ptr<TaskCollection> &coll, QWidget *parent = nullptr);
0042     ~DecryptVerifyFilesDialog() override;
0043 
0044     void setOutputLocation(const QString &dir);
0045     QString outputLocation() const;
0046 
0047 protected Q_SLOTS:
0048     void progress(int progress, int total);
0049     void started(const std::shared_ptr<Task> &result);
0050     void allDone();
0051     void btnClicked(QAbstractButton *btn);
0052     void checkAccept();
0053     void showContent(const std::shared_ptr<const Task::Result> &result);
0054 
0055 protected:
0056     void readConfig();
0057     void writeConfig();
0058 
0059 protected:
0060     QLabel *labelForTag(const QString &tag);
0061 
0062 private:
0063     std::shared_ptr<TaskCollection> m_tasks;
0064     QProgressBar *m_progressBar;
0065     QHash<QString, QLabel *> m_progressLabelByTag;
0066     QVBoxLayout *m_progressLabelLayout;
0067     int m_lastErrorItemIndex;
0068     ResultListWidget *m_resultList;
0069     FileNameRequester *m_outputLocationFNR;
0070     QDialogButtonBox::StandardButton m_saveButton = QDialogButtonBox::NoButton;
0071     QDialogButtonBox *const m_buttonBox;
0072 };
0073 
0074 } // namespace Gui
0075 } // namespace Crypto;
0076 } // namespace Kleo