rrenkert@582: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik rrenkert@582: * Software engineering by Intevation GmbH rrenkert@582: * rrenkert@582: * This file is Free Software under the GNU GPL (v>=2) rrenkert@582: * and comes with ABSOLUTELY NO WARRANTY! rrenkert@582: * See LICENSE.txt for details. rrenkert@582: */ rrenkert@582: #ifndef CERTIFICATELISTITEM_H rrenkert@582: #define CERTIFICATELISTITEM_H rrenkert@582: /** rrenkert@582: * @file certificateitemdelegate.h rrenkert@582: * @brief Item delegate drawing custom certificate items in list views. rrenkert@582: * rrenkert@582: */ rrenkert@582: #include rrenkert@582: #include rrenkert@582: #include rrenkert@582: rrenkert@582: #include "certificate.h" andre@701: /** @brief A combo box that shows the text only in the popup andre@701: * andre@701: * The text shown is the data set as Qt::UserRole andre@701: */ andre@701: class IconOnlyTextPopupBox : public QComboBox andre@701: { andre@701: protected: andre@701: virtual void showPopup(); andre@701: virtual void hidePopup(); andre@701: }; andre@701: rrenkert@582: rrenkert@582: class CertificateItemWidget : public QWidget rrenkert@582: { rrenkert@627: Q_OBJECT rrenkert@582: public: rrenkert@638: CertificateItemWidget( rrenkert@638: QWidget *parent = 0, rrenkert@638: const Certificate &cert = Certificate(), rrenkert@638: bool state = false, andre@687: bool editable = true, andre@687: const QString& installLabel = tr("install"), andre@687: const QString& removeLabel = tr("remove")); rrenkert@582: rrenkert@627: bool state(); rrenkert@638: void setState(bool state); rrenkert@627: Certificate certificate(); rrenkert@627: rrenkert@582: private: rrenkert@582: void setupGUI(); rrenkert@582: rrenkert@582: Certificate mCertificate; rrenkert@638: bool mState; rrenkert@638: bool mEditable; rrenkert@582: QLabel *mLabel; andre@701: IconOnlyTextPopupBox *mComboBox; andre@687: QString mInstallLabel; andre@687: QString mRemoveLabel; rrenkert@627: rrenkert@627: private slots: rrenkert@627: void currentStateChanged(int ndx); rrenkert@627: rrenkert@627: signals: rrenkert@627: void stateChanged(bool state, const Certificate &cert); rrenkert@582: }; rrenkert@582: #endif