Akonadi Contacts

imagewidget.h
1/*
2 This file is part of Contact Editor.
3
4 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#pragma once
10
11#include <KContacts/Picture>
12
13#include <QPoint>
14#include <QPushButton>
15
16namespace KContacts
17{
18class Addressee;
19}
20namespace Akonadi
21{
22class ImageLoader;
23
24class ImageWidget : public QPushButton
25{
27
28public:
29 enum Type {
30 Photo,
31 Logo
32 };
33
34 explicit ImageWidget(Type type, QWidget *parent = nullptr);
35 ~ImageWidget() override;
36
37 void loadContact(const KContacts::Addressee &contact);
38 void storeContact(KContacts::Addressee &contact) const;
39
40 void setReadOnly(bool readOnly);
41
42protected:
43 // image drop handling
44 void dragEnterEvent(QDragEnterEvent *event) override;
45 void dropEvent(QDropEvent *event) override;
46
47 // image drag handling
48 void mousePressEvent(QMouseEvent *event) override;
49 void mouseMoveEvent(QMouseEvent *event) override;
50
51 // context menu handling
52 void contextMenuEvent(QContextMenuEvent *event) override;
53
54private:
55 void updateView();
56
57 void changeImage();
58 void changeUrl();
59 void saveImage();
60 void deleteImage();
61 ImageLoader *imageLoader();
62
63 KContacts::Picture mPicture;
64 QPoint mDragStartPos;
65 ImageLoader *mImageLoader = nullptr;
66 Type mType;
67 bool mHasImage;
68 bool mReadOnly;
69};
70}
A widget for editing the display name of a contact.
Q_OBJECTQ_OBJECT
QObject * parent() const const
virtual bool event(QEvent *e) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.