calendarui/caleneditor/src/caleneditor.cpp
branchRCL_3
changeset 65 12af337248b1
equal deleted inserted replaced
60:96907930389d 65:12af337248b1
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Definition of CalenEditor class.
       
    16 *
       
    17 */
       
    18 
       
    19 // System includes.
       
    20 #include <QDateTime>
       
    21 
       
    22 // User includes
       
    23 #include <agendaentry.h>
       
    24 #include <agendautil.h>
       
    25 #include <caleneditor.h>
       
    26 
       
    27 #include "caleneditor_p.h"
       
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "caleneditorTraces.h"
       
    31 #endif
       
    32 
       
    33 /*!
       
    34 	\class CalenEditor
       
    35  */
       
    36 /*!
       
    37 	Constructor.
       
    38 
       
    39 	\param parent HbView pointer.
       
    40  */
       
    41 CalenEditor::CalenEditor(QObject *parent)
       
    42 :QObject(parent),d_ptr(new CalenEditorPrivate(0, this))
       
    43 {
       
    44 	OstTraceFunctionEntry0( CALENEDITOR_CALENEDITOR_ENTRY );
       
    45 	
       
    46 	OstTraceFunctionExit0( CALENEDITOR_CALENEDITOR_EXIT );
       
    47 }
       
    48 
       
    49 /*!
       
    50 	Constructor.
       
    51 
       
    52 	\param agendaUtil pointer to agenda utility
       
    53 	\param parent HbView pointer.
       
    54  */
       
    55 CalenEditor::CalenEditor(AgendaUtil *agendaUtil, QObject *parent)
       
    56 :QObject(parent), d_ptr(new CalenEditorPrivate(agendaUtil, this))
       
    57 {
       
    58 	OstTraceFunctionEntry0( DUP1_CALENEDITOR_CALENEDITOR_ENTRY );
       
    59 	
       
    60 	OstTraceFunctionExit0( DUP1_CALENEDITOR_CALENEDITOR_EXIT );
       
    61 }
       
    62 
       
    63 /*!
       
    64 	Destructor.
       
    65  */
       
    66 CalenEditor::~CalenEditor()
       
    67 {
       
    68 	OstTraceFunctionEntry0( DUP2_CALENEDITOR_CALENEDITOR_ENTRY );
       
    69 	if (d_ptr) {
       
    70 		delete d_ptr;
       
    71 	}
       
    72 	OstTraceFunctionExit0( DUP2_CALENEDITOR_CALENEDITOR_EXIT );
       
    73 }
       
    74 
       
    75 /*!
       
    76 	Shows the caleneditor by parsing a .vcs file which will be edited.
       
    77 	\param handle reference to QFile handle.
       
    78 	\param launchCalendar bool to tell whether calendar has to be launched after 
       
    79 	 coming back from editor
       
    80  */
       
    81 void CalenEditor::edit(const QFile &handle, bool launchCalendar)
       
    82 {
       
    83 	OstTraceFunctionEntry0( CALENEDITOR_EDIT_ENTRY );
       
    84 	d_ptr->edit(handle, launchCalendar);
       
    85 	OstTraceFunctionExit0( CALENEDITOR_EDIT_EXIT );
       
    86 }
       
    87 
       
    88 /*!
       
    89 	Shows the caleneditor, by parsing an AgendaEntry.
       
    90 	\param entry An object of AgendaEntry.
       
    91 	\param launchCalendar bool to tell whether calendar has to be launched after 
       
    92 	 coming back from editor
       
    93  */
       
    94 void CalenEditor::edit(AgendaEntry entry, bool launchCalendar)
       
    95 {
       
    96 	OstTraceFunctionEntry0( DUP1_CALENEDITOR_EDIT_ENTRY );
       
    97 	if(entry.isNull()) {
       
    98 		OstTraceFunctionExit0( DUP1_CALENEDITOR_EDIT_EXIT );
       
    99 		return;
       
   100 	}
       
   101 	d_ptr->edit(entry, launchCalendar);
       
   102 	OstTraceFunctionExit0( DUP2_CALENEDITOR_EDIT_EXIT );
       
   103 }
       
   104 
       
   105 /*!
       
   106 	Shows the caleneditor, by using the entry id provided.
       
   107 	\param id entry id.
       
   108  */
       
   109 void CalenEditor::edit(ulong id, bool launchCalendar)
       
   110 {
       
   111 	OstTraceFunctionEntry0( DUP2_CALENEDITOR_EDIT_ENTRY );
       
   112 	d_ptr->edit(id, launchCalendar);
       
   113 	OstTraceFunctionExit0( DUP3_CALENEDITOR_EDIT_EXIT );
       
   114 }
       
   115 
       
   116 /*!
       
   117 	Creates a new entry based on the create type.It launches the
       
   118 	editor for editing
       
   119 	\param QDateTime newEntryDateTime is the event start time.
       
   120 	\param launchCalendar bool to tell whether calendar has to be launched after 
       
   121 	 coming back from editor
       
   122 	\param type type of the editor to be shown for creating new entry.
       
   123  */
       
   124 void CalenEditor::create(QDateTime newEntryDateTime, bool launchCalendar, 
       
   125                          CalenEditor::CreateType type)
       
   126 {
       
   127 	OstTraceFunctionEntry0( CALENEDITOR_CREATE_ENTRY );
       
   128 	d_ptr->create(type, newEntryDateTime, launchCalendar);
       
   129 	OstTraceFunctionExit0( CALENEDITOR_CREATE_EXIT );
       
   130 }
       
   131 
       
   132 /*!
       
   133 	Creates a new entry based on the create type by copying the
       
   134 	details of passed entry.It launches the editor for editing
       
   135 	\param entry AgendaEntry from which new entry has to be created
       
   136 	\param launchCalendar bool to tell whether calendar has to be launched after 
       
   137 	 coming back from editor
       
   138 	\param type type of the editor to be shown for creating new entry.
       
   139  */
       
   140 void CalenEditor::create(AgendaEntry entry, bool launchCalendar, 
       
   141                          CalenEditor::CreateType type)
       
   142 {
       
   143 	OstTraceFunctionEntry0( DUP1_CALENEDITOR_CREATE_ENTRY );
       
   144 	if(entry.isNull()) {
       
   145 		OstTraceFunctionExit0( DUP1_CALENEDITOR_CREATE_EXIT );
       
   146 		return;
       
   147 	}
       
   148 	d_ptr->create(type, entry, launchCalendar);
       
   149 	OstTraceFunctionExit0( DUP2_CALENEDITOR_CREATE_EXIT );
       
   150 }
       
   151 /*!
       
   152     Save the entry from editor 
       
   153     should be called only if  edit or create function of editor has called. 
       
   154  */
       
   155 void CalenEditor::saveAndCloseEditor()
       
   156 {
       
   157     d_ptr->forcedSaveEntry();
       
   158 }
       
   159 
       
   160 // End of file	--Don't remove this.