src/gui/s60framework/qs60mainapplication.cpp
changeset 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     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>
       
    44 #include "qs60maindocument.h"
       
    45 #include "qs60mainapplication_p.h"
       
    46 #include "qs60mainapplication.h"
       
    47 #include <bautils.h>
       
    48 #include <coemain.h>
       
    49 
       
    50 QT_BEGIN_NAMESPACE
       
    51 
       
    52 /**
       
    53  * factory function to create the QS60Main application class
       
    54  */
       
    55 CApaApplication *newS60Application()
       
    56 {
       
    57     return new QS60MainApplication;
       
    58 }
       
    59 
       
    60 _LIT(KQtWrapperResourceFile, "\\resource\\apps\\s60main.rsc");
       
    61 
       
    62 /*!
       
    63   \class QS60MainApplication
       
    64   \since 4.6
       
    65   \brief The QS60MainApplication class provides support for migration from S60.
       
    66  
       
    67   \warning This class is provided only to get access to S60 specific
       
    68   functionality in the application framework classes. It is not
       
    69   portable. We strongly recommend against using it in new applications.
       
    70  
       
    71   The QS60MainApplication provides a helper class for use in migrating
       
    72   from existing S60 based applications to Qt based applications. It is
       
    73   used in the exact same way as the \c CAknApplication class from
       
    74   Symbian, but internally provides extensions used by Qt.
       
    75 
       
    76   When modifying old S60 applications that rely on implementing
       
    77   functions in \c CAknApplication, the class should be modified to
       
    78   inherit from this class instead of \c CAknApplication. Then the
       
    79   application can choose to override only certain functions. To make
       
    80   Qt use the custom application objects, pass a factory function to
       
    81   \c{QApplication::QApplication(QApplication::QS60MainApplicationFactory, int &, char **)}.
       
    82 
       
    83   For more information on \c CAknApplication, please see the S60 documentation.
       
    84 
       
    85   Unlike other Qt classes, QS60MainApplication behaves like an S60 class, and can throw Symbian
       
    86   leaves.
       
    87 
       
    88   \sa QS60MainDocument, QS60MainAppUi, QApplication::QS60MainApplicationFactory
       
    89  */
       
    90 
       
    91 /*!
       
    92  * \brief Contructs an instance of QS60MainApplication.
       
    93  */
       
    94 QS60MainApplication::QS60MainApplication()
       
    95 {
       
    96 }
       
    97 
       
    98 /*!
       
    99  * \brief Destroys the QS60MainApplication.
       
   100  */
       
   101 QS60MainApplication::~QS60MainApplication()
       
   102 {
       
   103 }
       
   104 
       
   105 /*!
       
   106  * \brief Creates an instance of QS60MainDocument.
       
   107  *
       
   108  * \sa QS60MainDocument
       
   109  */
       
   110 CApaDocument *QS60MainApplication::CreateDocumentL()
       
   111 {
       
   112     // Create an QtS60Main document, and return a pointer to it
       
   113     return new (ELeave) QS60MainDocument(*this);
       
   114 }
       
   115 
       
   116 
       
   117 /*!
       
   118  * \brief Returns the UID of the application.
       
   119  */
       
   120 TUid QS60MainApplication::AppDllUid() const
       
   121 {
       
   122     // Return the UID for the QtS60Main application
       
   123     return RProcess().SecureId().operator TUid();
       
   124 }
       
   125 
       
   126 /*!
       
   127  * \brief Returns the resource file name.
       
   128  */
       
   129 TFileName QS60MainApplication::ResourceFileName() const
       
   130 {
       
   131     TFindFile finder(iCoeEnv->FsSession());
       
   132     TInt err = finder.FindByDir(KQtWrapperResourceFile, KNullDesC);
       
   133     if (err == KErrNone)
       
   134         return finder.File();
       
   135     return KNullDesC();
       
   136 }
       
   137 
       
   138 QT_END_NAMESPACE