File indexing completed on 2024-12-22 05:01:09

0001 /*  -*- c++ -*-
0002     encodedimagepicker.h
0003 
0004     KMail, the KDE mail client.
0005     SPDX-FileCopyrightText: 2021 the KMail authors.
0006     See file AUTHORS for details
0007 
0008     SPDX-License-Identifier: GPL-2.0-only
0009 */
0010 
0011 #pragma once
0012 
0013 #include <QGroupBox>
0014 #include <memory>
0015 class KJob;
0016 
0017 namespace Ui
0018 {
0019 class EncodedImagePicker;
0020 }
0021 
0022 namespace KMail
0023 {
0024 class EncodedImagePicker : public QGroupBox
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit EncodedImagePicker(QWidget *parent = nullptr);
0029     ~EncodedImagePicker() override;
0030 
0031     void setInfo(const QString &info);
0032 
0033     [[nodiscard]] QString source() const;
0034     void setSource(const QString &source);
0035     void setImage(const QImage &image);
0036 
0037 Q_SIGNALS:
0038     void imageSelected(const QImage &);
0039     void sourceChanged();
0040 
0041 private:
0042     void setFromFile(const QUrl &url);
0043 
0044     void selectFile();
0045     void setFromFileDone(KJob *);
0046     void selectFromAddressBook();
0047     void selectFromAddressBookDone(KJob *);
0048 
0049 private:
0050     std::unique_ptr<Ui::EncodedImagePicker> mUi;
0051 };
0052 } // namespace KMail