File indexing completed on 2025-01-05 04:58:21
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 */ 0007 0008 #pragma once 0009 0010 #include "pimcommonakonadi_export.h" 0011 #include <QStringList> 0012 #include <QWidget> 0013 class KConfig; 0014 class QListWidget; 0015 class QLineEdit; 0016 class QToolButton; 0017 0018 namespace PimCommon 0019 { 0020 /** 0021 * @brief The RecentAddressWidget class 0022 * @author Laurent Montel <montel@kde.org> 0023 */ 0024 class PIMCOMMONAKONADI_EXPORT RecentAddressWidget : public QWidget 0025 { 0026 Q_OBJECT 0027 public: 0028 explicit RecentAddressWidget(QWidget *parent = nullptr); 0029 ~RecentAddressWidget() override; 0030 0031 void setAddresses(const QStringList &addrs); 0032 void storeAddresses(KConfig *config); 0033 [[nodiscard]] bool wasChanged() const; 0034 0035 protected: 0036 void updateButtonState(); 0037 bool eventFilter(QObject *o, QEvent *e) override; 0038 0039 private: 0040 PIMCOMMONAKONADI_NO_EXPORT void slotAddItem(); 0041 PIMCOMMONAKONADI_NO_EXPORT void slotRemoveItem(); 0042 PIMCOMMONAKONADI_NO_EXPORT void slotUpdateAddButton(const QString &str); 0043 PIMCOMMONAKONADI_NO_EXPORT void slotCustomContextMenuRequested(const QPoint &pos); 0044 QLineEdit *const mLineEdit; 0045 QToolButton *const mNewButton; 0046 QToolButton *const mRemoveButton; 0047 QListWidget *const mListView; 0048 bool mDirty = false; 0049 }; 0050 }