File indexing completed on 2024-04-28 05:11:37

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0005  */
0006 
0007 #pragma once
0008 
0009 #include "incidenceeditor_export.h"
0010 
0011 #include <KLDAPWidgets/LdapClient>
0012 
0013 #include "resourceitem.h"
0014 #include <CalendarSupport/FreeBusyCalendar>
0015 
0016 #include <EventViews/ViewCalendar>
0017 
0018 #include <QDialog>
0019 
0020 class Ui_resourceManagement;
0021 
0022 class QItemSelectionModel;
0023 
0024 namespace EventViews
0025 {
0026 class AgendaView;
0027 }
0028 
0029 namespace IncidenceEditorNG
0030 {
0031 /**
0032  * @brief The ResourceManagement class
0033  */
0034 class INCIDENCEEDITOR_EXPORT ResourceManagement : public QDialog
0035 {
0036     Q_OBJECT
0037 public:
0038     explicit ResourceManagement(QWidget *parent = nullptr);
0039     ~ResourceManagement() override;
0040 
0041     [[nodiscard]] ResourceItem::Ptr selectedItem() const;
0042 
0043 public Q_SLOTS:
0044     void slotDateChanged(const QDate &start, const QDate &end);
0045 
0046 private:
0047     /* Shows the details of a resource
0048      *
0049      */
0050     void showDetails(const KLDAPCore::LdapObject &, const KLDAPWidgets::LdapClient &client);
0051 
0052     QItemSelectionModel *selectionModel = nullptr;
0053 
0054 private:
0055     /* A new searchString is entered
0056      *
0057      */
0058     INCIDENCEEDITOR_NO_EXPORT void slotStartSearch(const QString &);
0059 
0060     /* A detail view is requested
0061      *
0062      */
0063     INCIDENCEEDITOR_NO_EXPORT void slotShowDetails(const QModelIndex &current);
0064 
0065     /**
0066      * The Owner search is done
0067      */
0068     INCIDENCEEDITOR_NO_EXPORT void slotOwnerSearchFinished();
0069 
0070     INCIDENCEEDITOR_NO_EXPORT void slotLayoutChanged();
0071 
0072 private:
0073     INCIDENCEEDITOR_NO_EXPORT void readConfig();
0074     INCIDENCEEDITOR_NO_EXPORT void writeConfig();
0075     CalendarSupport::FreeBusyItemModel *mModel = nullptr;
0076     CalendarSupport::FreeBusyCalendar mFreebusyCalendar;
0077     ResourceItem::Ptr mOwnerItem;
0078     ResourceItem::Ptr mSelectedItem;
0079     EventViews::ViewCalendar::Ptr mFbCalendar;
0080     Ui_resourceManagement *mUi = nullptr;
0081     QMap<QModelIndex, KCalendarCore::Event::Ptr> mFbEvent;
0082     EventViews::AgendaView *mAgendaView = nullptr;
0083 };
0084 }