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

0001 /*
0002   SPDX-FileCopyrightText: 2010 Casey Link <unnamedrambler@gmail.com>
0003   SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0004 
0005   SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "ui_schedulingdialog.h"
0011 
0012 #include <QDateTime>
0013 #include <QDialog>
0014 
0015 namespace CalendarSupport
0016 {
0017 class FreePeriodModel;
0018 }
0019 
0020 namespace IncidenceEditorNG
0021 {
0022 class ConflictResolver;
0023 class VisualFreeBusyWidget;
0024 
0025 class SchedulingDialog : public QDialog, private Ui_Dialog
0026 {
0027     Q_OBJECT
0028 public:
0029     explicit SchedulingDialog(QDate startDate, QTime startTime, int duration, ConflictResolver *resolver, QWidget *parent);
0030     ~SchedulingDialog() override;
0031 
0032     [[nodiscard]] QDate selectedStartDate() const;
0033     [[nodiscard]] QTime selectedStartTime() const;
0034 
0035 public Q_SLOTS:
0036     void slotUpdateIncidenceStartEnd(const QDateTime &startDateTime, const QDateTime &endDateTime);
0037 
0038 Q_SIGNALS:
0039     void startDateChanged(const QDate &newDate);
0040     void startTimeChanged(const QTime &newTime);
0041     void endDateChanged(const QDate &newDate);
0042     void endTimeChanged(const QTime &newTime);
0043 
0044 private:
0045     void slotWeekdaysChanged();
0046     void slotMandatoryRolesChanged();
0047     void slotStartDateChanged(const QDate &newDate);
0048 
0049     void slotRowSelectionChanged(const QModelIndex &current, const QModelIndex &previous);
0050     void slotSetEndTimeLabel(const QTime &startTime);
0051     void updateWeekDays(const QDate &oldDate);
0052     void fillCombos();
0053 
0054     QDate mStDate;
0055     QDate mSelectedDate;
0056     QTime mSelectedTime;
0057     int mDuration; //!< In seconds
0058 
0059     ConflictResolver *const mResolver;
0060     CalendarSupport::FreePeriodModel *const mPeriodModel;
0061     VisualFreeBusyWidget *mVisualWidget = nullptr;
0062 };
0063 }