/** * @RDE_HEADER@ * $Id$ * $HeadURL$ * $Author$ * Created by Philipp Last, SLSE, 2017-11-10 */ #pragma once #include #include #include #include #include #include namespace ParticipantManagement { class ParticipantEditModel; class ParticipantTreeFilterProxyModel; class PPMCOMMON_EXPORT ParticipantTreeEditHandler : public QObject, protected ParticipantManagement::Interface::Ftc::ModifyParticipantDataReplyHandler { Q_OBJECT public: ParticipantTreeEditHandler(LtsDataView::LtsDataView *dataView, const std::shared_ptr &dtc, const std::shared_ptr &ftc, bool asSupportService, QObject *parent = nullptr); void setEditParticipantsAllowed(bool bAllow) { m_editParticipantsAllowed = bAllow; } QModelIndex selectedIndexView() const; bool isSelectedIndexValid() const; bool isSelectedIndexRemovable() const; bool isContainer() const; QVector usedEquipmentNumbers() const; ParticipantManagement::ParticipantData getSelectedData() const; void beautifyTreeView(bool keepExpanded); void partyHasChanged(int newPartyId, bool keepExpanded = true); signals: void signalChangesMade(); void signalDoubleClicked(); void signalSelectionChanged(); void signalEditParticipant(); // use getSelectedData() to retrieve the current participant data public slots: bool onApplyChanges(); void onRemoveItem(); void showContextMenu(const QPoint &position); private: void expandNodeChildren(QTreeView *pTreeView, const QModelIndex &index, bool expand); void removeCurrentRow(); void onModifyParticipantDataReply(const Core::FunctionReplyObject &replyObject) override final; LtsDataView::LtsDataView *m_dataView; ParticipantEditModel *m_model; bool m_asSupportService; bool m_editParticipantsAllowed; std::shared_ptr m_dtc; std::shared_ptr m_ftc; LtsUtils::RequestHelper *m_requestHelper; }; }