author | eckhart.koppen@nokia.com |
Wed, 31 Mar 2010 11:06:36 +0300 | |
changeset 7 | f7bc934e204c |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the Symbian application wrapper of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
// INCLUDE FILES |
|
43 |
#include <exception> |
|
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
0
diff
changeset
|
44 |
#include <private/qcore_symbian_p.h> |
0 | 45 |
#include "qs60maindocument.h" |
46 |
#include "qs60mainapplication_p.h" |
|
47 |
#include "qs60mainapplication.h" |
|
48 |
#include <bautils.h> |
|
49 |
#include <coemain.h> |
|
50 |
||
51 |
QT_BEGIN_NAMESPACE |
|
52 |
||
53 |
/** |
|
54 |
* factory function to create the QS60Main application class |
|
55 |
*/ |
|
56 |
CApaApplication *newS60Application() |
|
57 |
{ |
|
58 |
return new QS60MainApplication; |
|
59 |
} |
|
60 |
||
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
0
diff
changeset
|
61 |
_LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main" QT_LIBINFIX_UNICODE L".rsc"); |
0 | 62 |
|
63 |
/*! |
|
64 |
\class QS60MainApplication |
|
65 |
\since 4.6 |
|
66 |
\brief The QS60MainApplication class provides support for migration from S60. |
|
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
0
diff
changeset
|
67 |
|
0 | 68 |
\warning This class is provided only to get access to S60 specific |
69 |
functionality in the application framework classes. It is not |
|
70 |
portable. We strongly recommend against using it in new applications. |
|
7
f7bc934e204c
5cabc75a39ca2f064f70b40f72ed93c74c4dc19b
eckhart.koppen@nokia.com
parents:
0
diff
changeset
|
71 |
|
0 | 72 |
The QS60MainApplication provides a helper class for use in migrating |
73 |
from existing S60 based applications to Qt based applications. It is |
|
74 |
used in the exact same way as the \c CAknApplication class from |
|
75 |
Symbian, but internally provides extensions used by Qt. |
|
76 |
||
77 |
When modifying old S60 applications that rely on implementing |
|
78 |
functions in \c CAknApplication, the class should be modified to |
|
79 |
inherit from this class instead of \c CAknApplication. Then the |
|
80 |
application can choose to override only certain functions. To make |
|
81 |
Qt use the custom application objects, pass a factory function to |
|
82 |
\c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}. |
|
83 |
||
84 |
For more information on \c CAknApplication, please see the S60 documentation. |
|
85 |
||
86 |
Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian |
|
87 |
leaves. |
|
88 |
||
89 |
\sa QS60MainDocument, QS60MainAppUi, QApplication::QS60MainApplicationFactory |
|
90 |
*/ |
|
91 |
||
92 |
/*! |
|
93 |
* \brief Contructs an instance of QS60MainApplication. |
|
94 |
*/ |
|
95 |
QS60MainApplication::QS60MainApplication() |
|
96 |
{ |
|
97 |
} |
|
98 |
||
99 |
/*! |
|
100 |
* \brief Destroys the QS60MainApplication. |
|
101 |
*/ |
|
102 |
QS60MainApplication::~QS60MainApplication() |
|
103 |
{ |
|
104 |
} |
|
105 |
||
106 |
/*! |
|
107 |
* \brief Creates an instance of QS60MainDocument. |
|
108 |
* |
|
109 |
* \sa QS60MainDocument |
|
110 |
*/ |
|
111 |
CApaDocument *QS60MainApplication::CreateDocumentL() |
|
112 |
{ |
|
113 |
// Create an QtS60Main document, and return a pointer to it |
|
114 |
return new (ELeave) QS60MainDocument(*this); |
|
115 |
} |
|
116 |
||
117 |
||
118 |
/*! |
|
119 |
* \brief Returns the UID of the application. |
|
120 |
*/ |
|
121 |
TUid QS60MainApplication::AppDllUid() const |
|
122 |
{ |
|
123 |
// Return the UID for the QtS60Main application |
|
124 |
return RProcess().SecureId().operator TUid(); |
|
125 |
} |
|
126 |
||
127 |
/*! |
|
128 |
* \brief Returns the resource file name. |
|
129 |
*/ |
|
130 |
TFileName QS60MainApplication::ResourceFileName() const |
|
131 |
{ |
|
132 |
TFindFile finder(iCoeEnv->FsSession()); |
|
133 |
TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC); |
|
134 |
if (err == KErrNone) |
|
135 |
return finder.File(); |
|
136 |
return KNullDesC(); |
|
137 |
} |
|
138 |
||
139 |
QT_END_NAMESPACE |