calendarui/caleneditor/inc/caleneditor_p.h
changeset 45 b6db4fd4947b
parent 23 fd30d51f876b
child 55 2c54b51f39c4
equal deleted inserted replaced
23:fd30d51f876b 45:b6db4fd4947b
    18 #ifndef CalenEditorPrivate_P_H
    18 #ifndef CalenEditorPrivate_P_H
    19 #define CalenEditorPrivate_P_H
    19 #define CalenEditorPrivate_P_H
    20 
    20 
    21 // System includes
    21 // System includes
    22 #include <QObject>
    22 #include <QObject>
       
    23 #include <QPointer>
    23 #include <hbmainwindow.h>
    24 #include <hbmainwindow.h>
    24 #include <QHash>
    25 #include <QHash>
    25 #include <QDateTime>
    26 #include <QDateTime>
    26 
    27 
    27 //user includes
    28 //user includes
    29 
    30 
    30 #include "caleneditor.h"
    31 #include "caleneditor.h"
    31 #include "caleneditorcommon.h"
    32 #include "caleneditorcommon.h"
    32 
    33 
    33 //forward declarations
    34 //forward declarations
    34 class QTranslator;
       
    35 class QFile;
    35 class QFile;
    36 class HbDataForm;
    36 class HbDataForm;
    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 HbCheckBox;
    42 class HbCheckBox;
    43 class HbComboBox;
    43 class HbComboBox;
    44 class HbView;
    44 class HbView;
       
    45 class HbTranslator;
    45 class MCalenServices;
    46 class MCalenServices;
    46 class AgendaEntry;
    47 class AgendaEntry;
    47 class AgendaUtil;
    48 class AgendaUtil;
    48 class CalenEditor;
    49 class CalenEditor;
    49 class CalenEditorDocLoader;
    50 class CalenEditorDocLoader;
    90 			AllDayItem,
    91 			AllDayItem,
    91 			DateTimeFromItem,
    92 			DateTimeFromItem,
    92 			DateTimeToItem,
    93 			DateTimeToItem,
    93 			LocationItem,
    94 			LocationItem,
    94 			ReminderItem,
    95 			ReminderItem,
       
    96 			ReminderTimeForAllDayItem,
    95 			RepeatItem,
    97 			RepeatItem,
    96 			RepeatUntilItem
    98 			RepeatUntilItem
    97 			};
    99 			};
    98 public:
   100 public:
    99 	CalenEditorPrivate(AgendaUtil *agendaUtil,
   101 	CalenEditorPrivate(AgendaUtil *agendaUtil,
   102 	void addDiscardAction();
   104 	void addDiscardAction();
   103 	AgendaEntry* editedEntry();
   105 	AgendaEntry* editedEntry();
   104 	AgendaEntry* originalEntry();
   106 	AgendaEntry* originalEntry();
   105 	bool isNewEntry();
   107 	bool isNewEntry();
   106 	HbDataFormModelItem* allDayCheckBoxItem();
   108 	HbDataFormModelItem* allDayCheckBoxItem();
   107 
   109 	bool isReminderTimeForAllDayAdded();
       
   110 	bool isAllDayEvent();
       
   111 	void updateReminderChoices();
       
   112 	int currentIndexOfReminderField();
       
   113 	void setCurrentIndexOfReminderField(int index);
       
   114 	void setReminderChoices();
       
   115 	bool isEditRangeThisOnly();
       
   116 	bool isAllDayFieldAdded();
   108 private:
   117 private:
   109 	void edit(const QFile &handle, bool launchCalendar);
   118 	void edit(const QFile &handle, bool launchCalendar);
   110 	void edit(AgendaEntry entry, bool launchCalendar);
   119 	void edit(AgendaEntry entry, bool launchCalendar);
   111 	void edit(ulong id, bool launchCalendar);
   120 	void edit(ulong id, bool launchCalendar);
   112 	void create(CalenEditor::CreateType type, QDateTime newEntryDateTime, 
   121 	void create(CalenEditor::CreateType type, QDateTime newEntryDateTime, 
   113 	            bool launchCalendar);
   122 	            bool launchCalendar);
   114 	void create(CalenEditor::CreateType type, AgendaEntry entry, 
   123 	void create(CalenEditor::CreateType type, AgendaEntry entry, 
   115 		            bool launchCalendar);
   124 		            bool launchCalendar);
       
   125 	void openEditor(AgendaEntry entry);
   116 	void showEditor(AgendaEntry entry);
   126 	void showEditor(AgendaEntry entry);
   117 	void showEditOccurencePopup();
   127 	void showEditOccurencePopup();
   118 	void setUpView();
   128 	void setUpView();
   119 	void initModel();
   129 	void initModel();
   120 	void addSubjectItem();
   130 	void addSubjectItem();
   133 	void populateCustomItemLocation();
   143 	void populateCustomItemLocation();
   134 	void populateLocationItem();
   144 	void populateLocationItem();
   135 	void populateRepeatItem();
   145 	void populateRepeatItem();
   136 	void populateDescriptionItem();
   146 	void populateDescriptionItem();
   137 	void removeDescriptionItem();
   147 	void removeDescriptionItem();
   138 	void closeEditor();
       
   139 		
   148 		
   140 	bool isChild() const ;
   149 	bool isChild() const ;
   141 	
   150 	
   142 	Action handleDone();
   151 	Action handleDone();
   143 	bool saveEntry();
   152 	bool saveEntry();
   144 	void deleteEntry(bool close = false);
   153 	void deleteEntry(bool close = false);
   145 	bool handleAllDayToSave();
   154 	bool handleAllDayToSave();
   146 	void enableFromTotimeFileds(bool, QDateTime, QDateTime);
   155 	void enableFromTotimeFileds(bool, QDateTime, QDateTime);
   147 	int showDeleteConfirmationQuery();
       
   148 	
   156 	
   149 private slots:
   157 private slots:
   150 	void handleSubjectChange(const QString subject);
   158 	void handleSubjectChange(const QString subject);
   151 	void handleAllDayChange(int state);
   159 	void handleAllDayChange(int state);
   152 	void saveFromDateTime(QDateTime& fromDateTime);
   160 	void saveFromDateTime(QDateTime& fromDateTime);
   153 	void saveToDateTime(QDateTime& toDateTime);
   161 	void saveToDateTime(QDateTime& toDateTime);
   154 	void handleLocationChange(const QString location);
   162 	void handleLocationChange(const QString location);
       
   163 	void handleLocationChange(const QString location, 
       
   164             const double geoLatitude, const double geoLongitude);
   155 	void handleDescriptionChange(const QString description);
   165 	void handleDescriptionChange(const QString description);
   156 	void saveAndCloseEditor();
   166 	void saveAndCloseEditor();
       
   167 	void showDeleteConfirmationQuery(bool closeEditor = false);
   157 	void handleDeleteAction();
   168 	void handleDeleteAction();
   158 	void launchSettingsView();
   169 	void launchSettingsView();
   159 	void discardChanges();
   170 	void discardChanges();
   160 	void handleDescriptionAction();
   171 	void handleDescriptionAction();
   161 	void handleEditOccurence(int index);
   172 	void handleEditOccurence(int index);
   162 	void handleCancel();
   173 	void handleCancel();
   163 	void handleCalendarLaunchError(int error);
   174 	void handleCalendarLaunchError(int error);
       
   175 	void closeEditor();
       
   176 	void handleLocationEditingFinished();
       
   177 	void selectEditingFinishedAction(HbAction* action);	
   164 	
   178 	
   165 private:
   179 private:
   166 	enum EditRange {
   180 	enum EditRange {
   167 		ThisOnly,
   181 		ThisOnly,
   168 		ThisAndAll,
   182 		ThisAndAll,
   169 		UserCancelled
   183 		UserCancelled
   170 	};
   184 	};
   171 	
   185 	
   172 	CalenEditor *q_ptr;
   186 	CalenEditor *q_ptr;
   173 	AgendaUtil *mAgendaUtil;
   187 	QPointer<AgendaUtil> mAgendaUtil;
   174 	
   188 	
   175 	CalenEditorDocLoader *mEditorDocLoader;
   189 	CalenEditorDocLoader *mEditorDocLoader;
   176 	HbView *mEditorView;
   190 	HbView *mEditorView;
   177 	CalenEditorDataHandler* mDataHandler;
   191 	CalenEditorDataHandler* mDataHandler;
   178 	HbDataForm *mCalenEditorForm;
   192 	HbDataForm *mCalenEditorForm;
   189 	HbDataFormModelItem *mDescriptionItem;
   203 	HbDataFormModelItem *mDescriptionItem;
   190 	
   204 	
   191 	EditRange mEditRange;
   205 	EditRange mEditRange;
   192 	
   206 	
   193 	QDateTime mNewEntryDateTime;
   207 	QDateTime mNewEntryDateTime;
   194 		
   208 	
       
   209 	AgendaEntry mEntry;
   195 	AgendaEntry *mOriginalEntry;
   210 	AgendaEntry *mOriginalEntry;
   196 	AgendaEntry *mEditedEntry;
   211 	AgendaEntry *mEditedEntry;
   197 
   212 
   198 	HbAction *mSoftKeyAction;
   213 	HbAction *mSoftKeyAction;
   199 	HbAction *mDescriptionAction;
   214 	HbAction *mDescriptionAction;
   200 	HbMainWindow *mMainWindow;
   215 	HbMainWindow *mMainWindow;
   201 	QTranslator *mTranslator;
   216 	HbTranslator *mTranslator;
   202 	
   217 	
   203 	bool mNewEntry;
   218 	bool mNewEntry;
   204 	bool mDescriptionItemAdded;
   219 	bool mDescriptionItemAdded;
   205 	bool mIsChild;
   220 	bool mIsChild;
   206 	bool mIsAllDayItemAdded;
   221 	bool mIsAllDayItemAdded;