| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the examples of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:BSD$ |
| 9 | ** You may use this file under the terms of the BSD license as follows: |
| 10 | ** |
| 11 | ** "Redistribution and use in source and binary forms, with or without |
| 12 | ** modification, are permitted provided that the following conditions are |
| 13 | ** met: |
| 14 | ** * Redistributions of source code must retain the above copyright |
| 15 | ** notice, this list of conditions and the following disclaimer. |
| 16 | ** * Redistributions in binary form must reproduce the above copyright |
| 17 | ** notice, this list of conditions and the following disclaimer in |
| 18 | ** the documentation and/or other materials provided with the |
| 19 | ** distribution. |
| 20 | ** * Neither the name of The Qt Company Ltd nor the names of its |
| 21 | ** contributors may be used to endorse or promote products derived |
| 22 | ** from this software without specific prior written permission. |
| 23 | ** |
| 24 | ** |
| 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
| 36 | ** |
| 37 | ** $QT_END_LICENSE$ |
| 38 | ** |
| 39 | ****************************************************************************/ |
| 40 | |
| 41 | #ifndef CALENDARDEMO_H |
| 42 | #define CALENDARDEMO_H |
| 43 | |
| 44 | #include <QMainWindow> |
| 45 | #include <QDate> |
| 46 | #include <QtOrganizer/qorganizeritemsaverequest.h> |
| 47 | #include <QtOrganizer/qorganizeritemremovebyidrequest.h> |
| 48 | |
| 49 | QT_BEGIN_NAMESPACE_ORGANIZER |
| 50 | class QOrganizerManager; |
| 51 | class QOrganizerItem; |
| 52 | QT_END_NAMESPACE_ORGANIZER |
| 53 | |
| 54 | QTORGANIZER_USE_NAMESPACE |
| 55 | |
| 56 | #define ORGANIZER_ITEM_ROLE Qt::UserRole+1 |
| 57 | #define ORGANIZER_CALENDAR_ROLE Qt::UserRole+2 |
| 58 | |
| 59 | QT_BEGIN_NAMESPACE |
| 60 | class QProgressDialog; |
| 61 | class QStackedWidget; |
| 62 | QT_END_NAMESPACE |
| 63 | |
| 64 | class MonthPage; |
| 65 | class DayPage; |
| 66 | class EventEditPage; |
| 67 | class TodoEditPage; |
| 68 | class JournalEditPage; |
| 69 | class EventOccurrenceEditPage; |
| 70 | class AddCalendarPage; |
| 71 | class EditCalendarsPage; |
| 72 | |
| 73 | class CalendarDemo : public QMainWindow |
| 74 | { |
| 75 | Q_OBJECT |
| 76 | |
| 77 | public: |
| 78 | CalendarDemo(QWidget *parent = Q_NULLPTR); |
| 79 | ~CalendarDemo(); |
| 80 | |
| 81 | public Q_SLOTS: |
| 82 | void activateMonthPage(); |
| 83 | void activateDayPage(); |
| 84 | void activateEditPage(const QOrganizerItem &item); |
| 85 | void activatePreviousPage(); |
| 86 | void addNewEvent(); |
| 87 | void addNewTodo(); |
| 88 | void addNewJournal(); |
| 89 | void changeManager(QOrganizerManager *manager); |
| 90 | void updateSelectedDay(const QDate& date); |
| 91 | |
| 92 | private Q_SLOTS: |
| 93 | void switchView(); |
| 94 | void editItem(); |
| 95 | void removeItem(); |
| 96 | void addEvents(); |
| 97 | void importItems(); |
| 98 | void exportItems(); |
| 99 | void deleteAllEntries(); |
| 100 | void addCalendar(); |
| 101 | void editCalendar(); |
| 102 | void editExistingCalendar(QOrganizerManager *manager, QOrganizerCollection* calendar); |
| 103 | void saveReqStateChanged(QOrganizerAbstractRequest::State); |
| 104 | void removeReqStateChanged(QOrganizerAbstractRequest::State); |
| 105 | |
| 106 | private: |
| 107 | void (); |
| 108 | |
| 109 | QDate m_currentDate; |
| 110 | QOrganizerManager *m_manager; |
| 111 | QStackedWidget *m_stackedWidget; |
| 112 | MonthPage *m_monthPage; |
| 113 | DayPage *m_dayPage; |
| 114 | EventEditPage *m_eventEditPage; |
| 115 | TodoEditPage *m_todoEditPage; |
| 116 | JournalEditPage *m_journalEditPage; |
| 117 | EventOccurrenceEditPage *m_eventOccurrenceEditPage; |
| 118 | AddCalendarPage *m_addCalendarPage; |
| 119 | EditCalendarsPage *m_editCalendarsPage; |
| 120 | |
| 121 | int m_previousPage; |
| 122 | QOrganizerItem m_previousItem; |
| 123 | |
| 124 | QAction *m_switchViewAction; |
| 125 | |
| 126 | QOrganizerItemSaveRequest m_saveReq; |
| 127 | QOrganizerItemRemoveByIdRequest m_remReq; |
| 128 | QProgressDialog *m_progressDlg; |
| 129 | }; |
| 130 | |
| 131 | #endif // CALENDARDEMO_H |
| 132 | |