File indexing completed on 2025-03-09 04:54:36

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "messageviewer_export.h"
0010 #include "openwithurlinfo.h"
0011 #include <QList>
0012 #include <QObject>
0013 namespace MessageViewer
0014 {
0015 class MESSAGEVIEWER_EXPORT OpenUrlWithManager : public QObject
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit OpenUrlWithManager(QObject *parent = nullptr);
0020     ~OpenUrlWithManager() override;
0021 
0022     static OpenUrlWithManager *self();
0023 
0024     void clear();
0025 
0026     [[nodiscard]] const QList<OpenWithUrlInfo> &openWithUrlInfo() const;
0027     void setOpenWithUrlInfo(const QList<OpenWithUrlInfo> &newOpenWithUrlInfo);
0028     void saveRules();
0029 
0030     [[nodiscard]] OpenWithUrlInfo openWith(const QUrl &url);
0031 
0032 private:
0033     MESSAGEVIEWER_NO_EXPORT void loadSettings();
0034 
0035     QList<OpenWithUrlInfo> mOpenWithUrlInfo;
0036 };
0037 }