ginebra2/emulator/BrowserMainS60.h
changeset 3 0954f5dd2cd0
equal deleted inserted replaced
1:b0dd75e285d2 3:0954f5dd2cd0
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 *
       
     5 * This program is free software: you can redistribute it and/or modify
       
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 *
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
       
    13 *
       
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not,
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
       
    17 *
       
    18 * Description:
       
    19 *
       
    20 */
       
    21 
       
    22 #ifndef BROWSERMAINS60_H_
       
    23 #define BROWSERMAINS60_H_
       
    24 
       
    25 #include <QtGui/QS60MainApplication>
       
    26 #include <QtGui/QS60MainDocument>
       
    27 #include <QtGui/QS60MainAppUi>
       
    28 #include <QDebug>
       
    29 #include <QtGui>
       
    30 
       
    31 #include "browser.h"
       
    32 #include "singleton.h"
       
    33 
       
    34 /*
       
    35  * Handles calls from other apps to QDesktopServices.openUrl
       
    36  */
       
    37 
       
    38 class BrowserMainAppUiS60 : public QS60MainAppUi
       
    39 {
       
    40   public:
       
    41     BrowserMainAppUiS60() : QS60MainAppUi() {};
       
    42 
       
    43     // This function handles when an app calls QDesktopServices.openUrl when the browser is already started
       
    44     MCoeMessageObserver::TMessageResponse HandleMessageL(TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid, const TDesC8 &aMessageParameters);
       
    45 
       
    46     // These functions handle when an app calls QDesktopServices.openUrl when the browser isn't already started
       
    47     TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aFilename);
       
    48     TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aFilename, const TDesC8& aTail);
       
    49 };
       
    50 
       
    51 class BrowserMainDocumentS60 : public QS60MainDocument
       
    52 {
       
    53   public:
       
    54     BrowserMainDocumentS60(CEikApplication &eikApp) : QS60MainDocument(eikApp) {};
       
    55     CEikAppUi *CreateAppUiL();
       
    56 };
       
    57 
       
    58 class BrowserMainApplicationS60 : public  QS60MainApplication
       
    59 {
       
    60   
       
    61   public:
       
    62     BrowserMainApplicationS60();
       
    63     void SetInitialUrl(QString url) { initialUrl = url; }
       
    64     QString InitialUrl() { return initialUrl; }
       
    65     void setUrlHandler(GinebraBrowser *uh);
       
    66     GinebraBrowser *UrlHandler() { return urlHandler; }
       
    67 
       
    68   protected:
       
    69     CApaDocument *CreateDocumentL();
       
    70 
       
    71   private:
       
    72     QString initialUrl;
       
    73     GinebraBrowser *urlHandler;
       
    74 };
       
    75 
       
    76 // Define the Meyer's singleton for BrowserMainApplicationS60
       
    77 typedef Singleton<BrowserMainApplicationS60, CreateGamma> CBrowserMainAppSingleton;
       
    78 
       
    79 #endif /* BROWSERMAINS60_H_ */