|
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: This is the Definition file for NotesModelHandler class. |
|
15 * |
|
16 */ |
|
17 |
|
18 // System includes |
|
19 #include <QtGui> |
|
20 #include <QDebug> |
|
21 |
|
22 // User includes |
|
23 #include "notesmodelhandler.h" |
|
24 #include "agendautil.h" |
|
25 #include "notesmodel.h" |
|
26 |
|
27 /*! |
|
28 \class NotesModelHandler |
|
29 |
|
30 This is responsible for holding the notesmodel and agendautil objects. |
|
31 */ |
|
32 |
|
33 /*! |
|
34 Default constructor. |
|
35 */ |
|
36 NotesModelHandler::NotesModelHandler(QObject *parent) |
|
37 :QObject(parent), |
|
38 mAgendaUtil(0), |
|
39 mNotesModel(0) |
|
40 { |
|
41 qDebug() << "notes: NotesModelHandler::NotesModelHandler -->"; |
|
42 |
|
43 QT_TRAP_THROWING(mAgendaUtil = new AgendaUtil(this)); |
|
44 Q_ASSERT_X(mAgendaUtil, "notesviewmanager.cpp", "mAgendaUtil is 0"); |
|
45 |
|
46 // Construct the source model here. |
|
47 mNotesModel = new NotesModel(mAgendaUtil, this); |
|
48 |
|
49 qDebug() << "notes: NotesModelHandler::NotesModelHandler <--"; |
|
50 } |
|
51 |
|
52 /*! |
|
53 Destructor |
|
54 */ |
|
55 NotesModelHandler::~NotesModelHandler() |
|
56 { |
|
57 qDebug() << "notes: NotesModelHandler::~NotesModelHandler -->"; |
|
58 |
|
59 if (mAgendaUtil) { |
|
60 delete mAgendaUtil; |
|
61 mAgendaUtil = 0; |
|
62 } |
|
63 if (mNotesModel) { |
|
64 delete mNotesModel; |
|
65 mNotesModel = 0; |
|
66 } |
|
67 |
|
68 qDebug() << "notes: NotesModelHandler::~NotesModelHandler <--"; |
|
69 } |
|
70 |
|
71 /*! |
|
72 Returns a pointer to the agenda interface. |
|
73 |
|
74 \return AgendaUtil pointer. |
|
75 */ |
|
76 AgendaUtil *NotesModelHandler::agendaInterface() |
|
77 { |
|
78 qDebug() << "notes: NotesModelHandler::agendaInterface -->"; |
|
79 |
|
80 Q_ASSERT(mAgendaUtil); |
|
81 |
|
82 qDebug() << "notes: NotesModelHandler::agendaInterface <--"; |
|
83 |
|
84 return mAgendaUtil; |
|
85 } |
|
86 |
|
87 /*! |
|
88 Returns a pointer to the notes application model. |
|
89 |
|
90 \return NotesModel pointer. |
|
91 */ |
|
92 NotesModel *NotesModelHandler::notesModel() |
|
93 { |
|
94 qDebug() << "notes: NotesModelHandler::notesModel -->"; |
|
95 |
|
96 Q_ASSERT(mNotesModel); |
|
97 |
|
98 qDebug() << "notes: NotesModelHandler::notesModel <--"; |
|
99 |
|
100 return mNotesModel; |
|
101 } |
|
102 |
|
103 // End of file --Don't remove this. |