calendarui/caleneditor/inc/caleneditor_p.h
changeset 23 fd30d51f876b
parent 18 c198609911f9
child 26 a949c2543c15
child 45 b6db4fd4947b
equal deleted inserted replaced
18:c198609911f9 23:fd30d51f876b
    37 class HbDataFormModel;
    37 class HbDataFormModel;
    38 class HbDataFormModelItem;
    38 class HbDataFormModelItem;
    39 class HbAction;
    39 class HbAction;
    40 class HbLineEdit;
    40 class HbLineEdit;
    41 class HbPushButton;
    41 class HbPushButton;
    42 class HbDateTimePicker;
       
    43 class HbListWidget;
       
    44 class HbListWidgetItem;
       
    45 class HbCheckBox;
    42 class HbCheckBox;
    46 class HbComboBox;
    43 class HbComboBox;
    47 class HbView;
    44 class HbView;
    48 class HbRadioButtonList;
       
    49 class MCalenServices;
    45 class MCalenServices;
    50 class AgendaEntry;
    46 class AgendaEntry;
    51 class AgendaUtil;
    47 class AgendaUtil;
    52 class CalenEditor;
    48 class CalenEditor;
    53 class CalenEditorDocLoader;
    49 class CalenEditorDocLoader;
    54 class CalenEditorCustomItem;
    50 class CalenEditorCustomItem;
       
    51 class CalenEditorReminderField;
       
    52 class CalenEditorRepeatField;
       
    53 class CalenEditorDataHandler;
       
    54 
       
    55 // Constants
       
    56 const int KNoOfDaysInWeek = 7;
    55 
    57 
    56 class CalenEditorPrivate : public QObject
    58 class CalenEditorPrivate : public QObject
    57 {
    59 {
    58 	Q_OBJECT
    60 	Q_OBJECT
    59 	Q_DECLARE_PUBLIC(CalenEditor)
    61 	Q_DECLARE_PUBLIC(CalenEditor)
    95 			};
    97 			};
    96 public:
    98 public:
    97 	CalenEditorPrivate(AgendaUtil *agendaUtil,
    99 	CalenEditorPrivate(AgendaUtil *agendaUtil,
    98 	                   QObject *parent);
   100 	                   QObject *parent);
    99 	virtual ~CalenEditorPrivate();
   101 	virtual ~CalenEditorPrivate();
       
   102 	void addDiscardAction();
       
   103 	AgendaEntry* editedEntry();
       
   104 	AgendaEntry* originalEntry();
       
   105 	bool isNewEntry();
       
   106 	HbDataFormModelItem* allDayCheckBoxItem();
   100 
   107 
   101 private:
   108 private:
   102 	void edit(const QFile &handle, bool launchCalendar);
   109 	void edit(const QFile &handle, bool launchCalendar);
   103 	void edit(AgendaEntry entry, bool launchCalendar);
   110 	void edit(AgendaEntry entry, bool launchCalendar);
   104 	void edit(ulong id, bool launchCalendar);
   111 	void edit(ulong id, bool launchCalendar);
   106 	            bool launchCalendar);
   113 	            bool launchCalendar);
   107 	void create(CalenEditor::CreateType type, AgendaEntry entry, 
   114 	void create(CalenEditor::CreateType type, AgendaEntry entry, 
   108 		            bool launchCalendar);
   115 		            bool launchCalendar);
   109 	void showEditor(AgendaEntry entry);
   116 	void showEditor(AgendaEntry entry);
   110 	void showEditOccurencePopup();
   117 	void showEditOccurencePopup();
   111 	void addDiscardAction();
       
   112 	void setUpView();
   118 	void setUpView();
   113 	void initModel();
   119 	void initModel();
   114 	void addSubjectItem();
   120 	void addSubjectItem();
   115 	void addAllDayCheckBoxItem();
   121 	void addAllDayCheckBoxItem();
   116 	void addCustomItemFrom();
   122 	void addCustomItemFrom();
   117 	void addCustomItemTo();
   123 	void addCustomItemTo();
   118 	void addLocationItem();
   124     void addCustomItemLocation();
   119 	void addReminderItem();
   125 	void addReminderItem();
   120 	void addRepeatItem();
   126 	void addRepeatItem();
   121 	void insertRepeatUntilItem();
   127 	void insertRepeatUntilItem();
   122 	
   128 	
   123 	void populateModel();
   129 	void populateModel();
   124 	void populateSubjectItem();
   130 	void populateSubjectItem();
   125 	void populateAllDayItem();
   131 	void populateAllDayItem();
   126 	void populateCustomItemDateTime();
   132 	void populateCustomItemDateTime();
       
   133 	void populateCustomItemLocation();
   127 	void populateLocationItem();
   134 	void populateLocationItem();
   128 	void populateReminderItem();
       
   129 	void populateRepeatItem();
   135 	void populateRepeatItem();
   130 	void populateDescriptionItem();
   136 	void populateDescriptionItem();
   131 	void removeDescriptionItem();
   137 	void removeDescriptionItem();
   132 	void closeEditor();
   138 	void closeEditor();
   133 		
   139 		
   134 	bool isChild() const ;
   140 	bool isChild() const ;
   135 	Error checkErrorsForThisAndAll();
   141 	
   136 	bool isEdited() const;
       
   137 	bool isSummaryEdited() const;
       
   138 	bool isAllDayEdited() const;
       
   139 	bool isLocationEdited() const;
       
   140 	bool isStartDateTimeEdited() const;
       
   141 	bool isEndDateTimeEdited() const;
       
   142 	bool isAlarmEdited() const;
       
   143 	bool isRepeatRuleEdited() const;
       
   144 	bool isDescriptionEdited() const;
       
   145 	bool nonTextItemsEdited() const;
       
   146 	bool areTextItemsEmpty() const;
       
   147 	bool areTextItemsCleared() const;
       
   148 	bool isSummaryEmptied() const;
       
   149 	bool isLocationEmptied() const;
       
   150 	bool isDescriptionEmptied() const;
       
   151 	Action shouldSaveOrDeleteOrDoNothing() const;
       
   152 	bool durationGreaterThanRepeatIntervalError() const;
       
   153 	Error checkAlarmFieldsForErrors(bool series = false) const;
       
   154 	bool isAlarmInAcceptablePeriod(Error &error, const QDateTime &alarmTime,
       
   155 	                               const QDateTime &startTime) const;
       
   156 	Action handleDone();
   142 	Action handleDone();
   157 	void updateEditedEntry();
       
   158 	bool saveEntry();
   143 	bool saveEntry();
   159 	void deleteEntry(bool close = false);
   144 	void deleteEntry(bool close = false);
   160 	void displayErrorMsg(int error);
       
   161 	void dispalyErrorMsgByRepeatType();
       
   162 	bool handleAllDayToSave();
   145 	bool handleAllDayToSave();
   163 	void enableFromTotimeFileds(bool, QDateTime, QDateTime);
   146 	void enableFromTotimeFileds(bool, QDateTime, QDateTime);
   164 	void connectSlots(bool toConnect);
       
   165 	int showDeleteConfirmationQuery();
   147 	int showDeleteConfirmationQuery();
   166 	void updateRepeatChoices();
       
   167 	
   148 	
   168 private slots:
   149 private slots:
   169 	void handleSubjectChange(const QString subject);
   150 	void handleSubjectChange(const QString subject);
   170 	void handleAllDayChange(int state);
   151 	void handleAllDayChange(int state);
   171 	void saveFromDateTime(QDateTime& fromDateTime);
   152 	void saveFromDateTime(QDateTime& fromDateTime);
   172 	void saveToDateTime(QDateTime& toDateTime);
   153 	void saveToDateTime(QDateTime& toDateTime);
   173 	void handleLocationChange(const QString location);
   154 	void handleLocationChange(const QString location);
   174 	void handleReminderIndexChanged(int index);
       
   175 	void handleRepeatIndexChanged(int index);
       
   176 	void handleDescriptionChange(const QString description);
   155 	void handleDescriptionChange(const QString description);
   177 	void saveAndCloseEditor();
   156 	void saveAndCloseEditor();
   178 	void handleDeleteAction();
   157 	void handleDeleteAction();
   179 	void launchSettingsView();
   158 	void launchSettingsView();
   180 	void discardChanges();
   159 	void discardChanges();
   181 	void launchRepeatUntilDatePicker();
       
   182 	void setRepeatUntilDate();
       
   183 	void handleDescriptionAction();
   160 	void handleDescriptionAction();
   184 	void handleEditOccurence(int index);
   161 	void handleEditOccurence(int index);
   185 	void handleCancel();
   162 	void handleCancel();
   186 	void handleCalendarLaunchError(int error);
   163 	void handleCalendarLaunchError(int error);
   187 
   164 	
   188 private:
   165 private:
   189 	enum EditRange {
   166 	enum EditRange {
   190 		ThisOnly,
   167 		ThisOnly,
   191 		ThisAndAll,
   168 		ThisAndAll,
   192 		UserCancelled
   169 		UserCancelled
   193 	};
   170 	};
   194 	
   171 	
   195 	enum RepeatTypes {
       
   196 		RepeatOnce,
       
   197 		RepeatDaily,
       
   198 		RepeatWeekly,
       
   199 		RepeatBiWeekly,
       
   200 		RepeatMonthly,
       
   201 		RepeatYearly
       
   202 	};
       
   203 	CalenEditor *q_ptr;
   172 	CalenEditor *q_ptr;
   204 	AgendaUtil *mAgendaUtil;
   173 	AgendaUtil *mAgendaUtil;
   205 	EditRange mEditRange;
   174 	
   206 	CalenEditorDocLoader *mEditorDocLoader;
   175 	CalenEditorDocLoader *mEditorDocLoader;
       
   176 	HbView *mEditorView;
       
   177 	CalenEditorDataHandler* mDataHandler;
       
   178 	HbDataForm *mCalenEditorForm;
       
   179 	HbDataFormModel *mCalenEditorModel;
       
   180 	
       
   181 	HbDataFormModelItem *mSubjectItem;
   207 	CalenEditorCustomItem *mViewFromItem;
   182 	CalenEditorCustomItem *mViewFromItem;
   208 	CalenEditorCustomItem *mViewToItem;
   183 	CalenEditorCustomItem *mViewToItem;
   209 	HbView *mEditorView;
   184 	CalenEditorCustomItem *mViewLocationItem;
   210 	HbDataForm *mCalenEditorForm;
       
   211 	HbDataFormModel *mCalenEditorModel;
       
   212 	HbDataFormModelItem *mSubjectItem;
       
   213 	HbDataFormModelItem *mAllDayCheckBoxItem;
   185 	HbDataFormModelItem *mAllDayCheckBoxItem;
   214 	HbDataFormModelItem *mLocationItem;
   186 
   215 	HbDataFormModelItem *mReminderItem;
   187 	CalenEditorReminderField *mReminderField;
   216 	HbDataFormModelItem *mRepeatItem;
   188 	CalenEditorRepeatField *mRepeatField;
   217 	HbDataFormModelItem *mCustomRepeatUntilItem;
       
   218 	HbDataFormModelItem *mDescriptionItem;
   189 	HbDataFormModelItem *mDescriptionItem;
   219 	
   190 	
   220 	HbComboBox *mRepeatComboBox;
   191 	EditRange mEditRange;
   221 	HbDateTimePicker* mDatePicker;
   192 	
   222 	QHash<int, int> mReminderHash;
       
   223 	QDateTime mNewEntryDateTime;
   193 	QDateTime mNewEntryDateTime;
   224 	QDate mRepeatUntilDate;
       
   225 	AgendaRepeatRule::RuleType mRepeatRuleType;
       
   226 		
   194 		
   227 	AgendaEntry *mOriginalEntry;
   195 	AgendaEntry *mOriginalEntry;
   228 	AgendaEntry *mEditedEntry;
   196 	AgendaEntry *mEditedEntry;
   229 
   197 
   230 	HbAction *mSoftKeyAction;
   198 	HbAction *mSoftKeyAction;
   231 	HbAction *mDescriptionAction;
   199 	HbAction *mDescriptionAction;
   232 	HbMainWindow *mMainWindow;
   200 	HbMainWindow *mMainWindow;
   233 	QTranslator *mTranslator;
   201 	QTranslator *mTranslator;
   234 	int mMinutes;
       
   235 	int mHour;
       
   236 	
   202 	
   237 	bool mNewEntry;
   203 	bool mNewEntry;
   238 	bool mRepeatUntilItemAdded;
       
   239 	bool mDescriptionItemAdded;
   204 	bool mDescriptionItemAdded;
   240 	bool mIsBiWeekly;
       
   241 	bool mIsChild;
   205 	bool mIsChild;
   242 	bool mIsAllDayItemAdded;
   206 	bool mIsAllDayItemAdded;
   243 	bool mOwnsAgendaUtil;
   207 	bool mOwnsAgendaUtil;
   244 	bool mLaunchCalendar;
   208 	bool mLaunchCalendar;
   245 	bool mMenuItemAdded;
   209 	bool mMenuItemAdded;