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 { Photo, Logo };
30
31 explicit ImageWidget(Type type, QWidget *parent = nullptr);
32 ~ImageWidget() override;
33
34 void loadContact(const KContacts::Addressee &contact);
35 void storeContact(KContacts::Addressee &contact) const;
36
37 void setReadOnly(bool readOnly);
38
39protected:
40 // image drop handling
41 void dragEnterEvent(QDragEnterEvent *event) override;
42 void dropEvent(QDropEvent *event) override;
43
44 // image drag handling
45 void mousePressEvent(QMouseEvent *event) override;
46 void mouseMoveEvent(QMouseEvent *event) override;
47
48 // context menu handling
49 void contextMenuEvent(QContextMenuEvent *event) override;
50
51private:
52 void updateView();
53
54 void changeImage();
55 void changeUrl();
56 void saveImage();
57 void deleteImage();
58 ImageLoader *imageLoader();
59
60 KContacts::Picture mPicture;
61 QPoint mDragStartPos;
62 ImageLoader *mImageLoader = nullptr;
63 Type mType;
64 bool mHasImage;
65 bool mReadOnly;
66};
67}
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 Tue Mar 26 2024 11:13:20 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.