calendarui/agendaeventviewer/src/agendaeventviewer_p.cpp
changeset 55 2c54b51f39c4
parent 45 b6db4fd4947b
child 63 a3cb48f6c889
equal deleted inserted replaced
51:0b38fc5b94c6 55:2c54b51f39c4
    23 #include <agendautil.h>
    23 #include <agendautil.h>
    24 #include <agendaentry.h>
    24 #include <agendaentry.h>
    25 #include "agendaeventviewer_p.h"
    25 #include "agendaeventviewer_p.h"
    26 #include "agendaeventviewer.h"
    26 #include "agendaeventviewer.h"
    27 #include "agendaeventview.h"
    27 #include "agendaeventview.h"
       
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "agendaeventviewer_pTraces.h"
       
    31 #endif
       
    32 
    28 
    33 
    29 /*!
    34 /*!
    30 	\class AgendaEventViewerPrivate
    35 	\class AgendaEventViewerPrivate
    31 
    36 
    32 	Private class implementation of AgendaEventViewer.It is responsible for
    37 	Private class implementation of AgendaEventViewer.It is responsible for
    40 	\param agendaUtil Pointer to AgendaUtil.
    45 	\param agendaUtil Pointer to AgendaUtil.
    41 	\param parent Pointer to QObject.
    46 	\param parent Pointer to QObject.
    42  */
    47  */
    43 AgendaEventViewerPrivate::AgendaEventViewerPrivate(
    48 AgendaEventViewerPrivate::AgendaEventViewerPrivate(
    44 		AgendaUtil *agendaUtil, QObject *parent)
    49 		AgendaUtil *agendaUtil, QObject *parent)
    45 : QObject(parent),mShowEventViewById(false),mShowEventViewByFileHandle(false),mFileName(NULL),mAction(AgendaEventViewer::ActionNothing)
    50 : QObject(parent),mAction(AgendaEventViewer::ActionNothing),mShowEventViewById(false),mShowEventViewByFileHandle(false),mFileName(NULL)
    46 {
    51 {
       
    52     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_AGENDAEVENTVIEWERPRIVATE_ENTRY );
    47 
    53 
    48 	// Get the q-pointer.from parent
    54 	// Get the q-pointer.from parent
    49 	q_ptr = static_cast<AgendaEventViewer *> (parent);
    55 	q_ptr = static_cast<AgendaEventViewer *> (parent);
    50 
    56 
    51 	// Check for agendaUtil sent by client. If null agendaUtil will be
    57 	// Check for agendaUtil sent by client. If null agendaUtil will be
    67 	// Register for the calenInstance view creation sucessfully
    73 	// Register for the calenInstance view creation sucessfully
    68 	connect(
    74 	connect(
    69 	        mAgendaUtil, SIGNAL(entryViewCreationCompleted(int)),
    75 	        mAgendaUtil, SIGNAL(entryViewCreationCompleted(int)),
    70 	        this, SLOT(viewCreationCompleted(int)));
    76 	        this, SLOT(viewCreationCompleted(int)));
    71 
    77 
       
    78 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_AGENDAEVENTVIEWERPRIVATE_EXIT );
    72 }
    79 }
    73 
    80 
    74 /*!
    81 /*!
    75 	Destructor.
    82 	Destructor.
    76  */
    83  */
    77 AgendaEventViewerPrivate::~AgendaEventViewerPrivate()
    84 AgendaEventViewerPrivate::~AgendaEventViewerPrivate()
    78 {
    85 {
       
    86     OstTraceFunctionEntry0( DUP1_AGENDAEVENTVIEWERPRIVATE_AGENDAEVENTVIEWERPRIVATE_ENTRY );
    79 
    87 
    80 	if (mViewerOwnsAgendaUtil) {
    88 	if (mViewerOwnsAgendaUtil) {
    81 		delete mAgendaUtil;
    89 		delete mAgendaUtil;
    82 		mAgendaUtil = 0;
    90 		mAgendaUtil = 0;
    83 	}
    91 	}
    84 
    92 
       
    93 	OstTraceFunctionExit0( DUP1_AGENDAEVENTVIEWERPRIVATE_AGENDAEVENTVIEWERPRIVATE_EXIT );
    85 }
    94 }
    86 
    95 
    87 /*!
    96 /*!
    88 	Launches the event viewer.Id is used for fetching
    97 	Launches the event viewer.Id is used for fetching
    89 	the calendar entry information.
    98 	the calendar entry information.
    91 	\param id Local Uid of the calendar entry to be viewed
   100 	\param id Local Uid of the calendar entry to be viewed
    92  */
   101  */
    93 void AgendaEventViewerPrivate::view(const ulong id, 
   102 void AgendaEventViewerPrivate::view(const ulong id, 
    94                                     AgendaEventViewer::Actions action)
   103                                     AgendaEventViewer::Actions action)
    95 {
   104 {
       
   105 	OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_VIEW_ENTRY );
    96 	
   106 	
    97 	AgendaEntry entry = mAgendaUtil->fetchById(id);
   107 	AgendaEntry entry = mAgendaUtil->fetchById(id);
    98 	
   108 	
    99 	if (entry.isNull()) {
   109 	if (entry.isNull()) {
   100         // save the entries , to show the entry once instances are created
   110         // save the entries , to show the entry once instances are created
   101         // if entry is null exit ,later  call back comes in viewCreationCompleted 
   111         // if entry is null exit ,later  call back comes in viewCreationCompleted 
   102 	    mAction = action;
   112 	    mAction = action;
   103         mId =id;
   113         mId =id;
   104         //to avoid view creation multiple times
   114         //to avoid view creation multiple times
   105         mShowEventViewById = true;
   115         mShowEventViewById = true;
       
   116 		OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_VIEW_EXIT );
   106 		return;
   117 		return;
   107 	}
   118 	}
   108 	// Construct the agenda event view
   119 	// Construct the agenda event view
   109 	mAgendaEventView = new AgendaEventView(this);
   120 	mAgendaEventView = new AgendaEventView(this);
   110 	mAgendaEventView->execute(entry, action);
   121 	mAgendaEventView->execute(entry, action);
   111 
   122 
       
   123 	OstTraceFunctionExit0( DUP1_AGENDAEVENTVIEWERPRIVATE_VIEW_EXIT );
   112 }
   124 }
   113 
   125 
   114 /*!
   126 /*!
   115 	Launches the event viewer.File handle of any vcs/ics
   127 	Launches the event viewer.File handle of any vcs/ics
   116 	file can be given as input to view the calendar entry information.
   128 	file can be given as input to view the calendar entry information.
   118 	\param fileHandle reference to the file handle of vcs/ics file
   130 	\param fileHandle reference to the file handle of vcs/ics file
   119  */
   131  */
   120 void AgendaEventViewerPrivate::view(const QFile &fileHandle, 
   132 void AgendaEventViewerPrivate::view(const QFile &fileHandle, 
   121                                     AgendaEventViewer::Actions action)
   133                                     AgendaEventViewer::Actions action)
   122 {
   134 {
       
   135     OstTraceFunctionEntry0( DUP1_AGENDAEVENTVIEWERPRIVATE_VIEW_ENTRY );
   123 
   136 
   124 	// Using calendar importer read the filehandle and generate agenda entry
   137 	// Using calendar importer read the filehandle and generate agenda entry
   125 	QString filePath = fileHandle.fileName();
   138 	QString filePath = fileHandle.fileName();
   126 	QString nativeFilePath = QDir::toNativeSeparators(filePath);
   139 	QString nativeFilePath = QDir::toNativeSeparators(filePath);
   127 	AgendaEntry entry;
   140 	AgendaEntry entry;
   134         mFileName = filePath ;
   147         mFileName = filePath ;
   135         mAction = action ;
   148         mAction = action ;
   136         mShowEventViewByFileHandle = true;
   149         mShowEventViewByFileHandle = true;
   137         q_ptr->viewingCompleted(QDateTime::currentDateTime().date());
   150         q_ptr->viewingCompleted(QDateTime::currentDateTime().date());
   138 	}
   151 	}
       
   152 	OstTraceFunctionExit0( DUP2_AGENDAEVENTVIEWERPRIVATE_VIEW_EXIT );
   139 }
   153 }
   140 
   154 
   141 /*!
   155 /*!
   142 	Launches the event viewer.AgendaEntry can be given as input to view the
   156 	Launches the event viewer.AgendaEntry can be given as input to view the
   143 	calendar entry information
   157 	calendar entry information
   144  */
   158  */
   145 void AgendaEventViewerPrivate::view(AgendaEntry entry, 
   159 void AgendaEventViewerPrivate::view(AgendaEntry entry, 
   146                                     AgendaEventViewer::Actions action)
   160                                     AgendaEventViewer::Actions action)
   147 {
   161 {
       
   162     OstTraceFunctionEntry0( DUP2_AGENDAEVENTVIEWERPRIVATE_VIEW_ENTRY );
   148 
   163 
   149 	if (entry.isNull()) {
   164 	if (entry.isNull()) {
       
   165 			OstTraceFunctionExit0( DUP3_AGENDAEVENTVIEWERPRIVATE_VIEW_EXIT );
   150 			return;
   166 			return;
   151 		}
   167 		}
   152 	// Construct the agenda event view
   168 	// Construct the agenda event view
   153 	mAgendaEventView = new AgendaEventView(this);
   169 	mAgendaEventView = new AgendaEventView(this);
   154 	mAgendaEventView->execute(entry, action);
   170 	mAgendaEventView->execute(entry, action);
   155 
   171 
       
   172 	OstTraceFunctionExit0( DUP4_AGENDAEVENTVIEWERPRIVATE_VIEW_EXIT );
   156 }
   173 }
   157 
   174 
   158 /*!
   175 /*!
   159 	Emits the signal viewing completed to the clients
   176 	Emits the signal viewing completed to the clients
   160 
   177 
   161 	\param status true if viewing completed otherwise false.
   178 	\param status true if viewing completed otherwise false.
   162  */
   179  */
   163 void AgendaEventViewerPrivate::viewingCompleted(const QDate date)
   180 void AgendaEventViewerPrivate::viewingCompleted(const QDate date)
   164 {
   181 {
       
   182     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_VIEWINGCOMPLETED_ENTRY );
   165 
   183 
   166 	emit q_ptr->viewingCompleted(date);
   184 	emit q_ptr->viewingCompleted(date);
   167 
   185 
   168 	// Cleanup viewer.
   186 	// Cleanup viewer.
   169 	if (mAgendaEventView) {
   187 	if (mAgendaEventView) {
   170 		mAgendaEventView->deleteLater();
   188 		mAgendaEventView->deleteLater();
   171 	}
   189 	}
   172 
   190 
       
   191 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_VIEWINGCOMPLETED_EXIT );
   173 }
   192 }
   174 
   193 
   175 /*!
   194 /*!
   176 	Emits the signal editing started to the clients
   195 	Emits the signal editing started to the clients
   177  */
   196  */
   178 void AgendaEventViewerPrivate::editingStarted()
   197 void AgendaEventViewerPrivate::editingStarted()
   179 {
   198 {
       
   199     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_EDITINGSTARTED_ENTRY );
   180 
   200 
   181 	emit q_ptr->editingStarted();
   201 	emit q_ptr->editingStarted();
   182 
   202 
       
   203 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_EDITINGSTARTED_EXIT );
   183 }
   204 }
   184 
   205 
   185 /*!
   206 /*!
   186 	Emits the signal editing completed to the clients
   207 	Emits the signal editing completed to the clients
   187  */
   208  */
   188 void AgendaEventViewerPrivate::editingCompleted()
   209 void AgendaEventViewerPrivate::editingCompleted()
   189 {
   210 {
       
   211     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_EDITINGCOMPLETED_ENTRY );
   190 
   212 
   191 	emit q_ptr->editingCompleted();
   213 	emit q_ptr->editingCompleted();
   192 
   214 
       
   215 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_EDITINGCOMPLETED_EXIT );
   193 }
   216 }
   194 
   217 
   195 /*!
   218 /*!
   196 	Emits the signal deleting started to the clients
   219 	Emits the signal deleting started to the clients
   197  */
   220  */
   198 void AgendaEventViewerPrivate::deletingStarted()
   221 void AgendaEventViewerPrivate::deletingStarted()
   199 {
   222 {
       
   223     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_DELETINGSTARTED_ENTRY );
   200 
   224 
   201 	emit q_ptr->deletingStarted();
   225 	emit q_ptr->deletingStarted();
   202 
   226 
       
   227 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_DELETINGSTARTED_EXIT );
   203 }
   228 }
   204 
   229 
   205 /*!
   230 /*!
   206 	Emits the signal deleting completed to the clients
   231 	Emits the signal deleting completed to the clients
   207  */
   232  */
   208 void AgendaEventViewerPrivate::deletingCompleted()
   233 void AgendaEventViewerPrivate::deletingCompleted()
   209 {
   234 {
       
   235     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_DELETINGCOMPLETED_ENTRY );
   210 
   236 
   211 	emit q_ptr->deletingCompleted();
   237 	emit q_ptr->deletingCompleted();
   212 
   238 
       
   239 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_DELETINGCOMPLETED_EXIT );
   213 }
   240 }
   214 
   241 
   215 
   242 
   216 /*!
   243 /*!
   217      calls when instances of calenInstanceview and 
   244      calls when instances of calenInstanceview and 
   218      entryInstanceview is created successfully
   245      entryInstanceview is created successfully
   219  */
   246  */
   220 void AgendaEventViewerPrivate::viewCreationCompleted(int error)
   247 void AgendaEventViewerPrivate::viewCreationCompleted(int error)
   221     {
   248     {
       
   249     OstTraceFunctionEntry0( AGENDAEVENTVIEWERPRIVATE_VIEWCREATIONCOMPLETED_ENTRY );
   222     
   250     
   223     if((KErrNone == error))
   251     if((KErrNone == error))
   224         {
   252         {
   225         AgendaEntry entry;
   253         AgendaEntry entry;
   226         if (mShowEventViewById)
   254         if (mShowEventViewById)
   243     mId = 0;
   271     mId = 0;
   244     mFileName.clear();
   272     mFileName.clear();
   245     mShowEventViewById = false;
   273     mShowEventViewById = false;
   246     mShowEventViewByFileHandle = false;
   274     mShowEventViewByFileHandle = false;
   247     mAction = AgendaEventViewer::ActionNothing;
   275     mAction = AgendaEventViewer::ActionNothing;
       
   276 	OstTraceFunctionExit0( AGENDAEVENTVIEWERPRIVATE_VIEWCREATIONCOMPLETED_EXIT );
   248 	}
   277 	}
   249 // End of file
   278 // End of file