browsercore/appfw/Api/Managers/downloadcontroller.h
changeset 3 0954f5dd2cd0
parent 0 1450b09d0cfd
child 12 afcd8e6d025b
equal deleted inserted replaced
1:b0dd75e285d2 3:0954f5dd2cd0
     1 /*
     1 /*
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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 *
     4 *
     9 * Initial Contributors:
     5 * This program is free software: you can redistribute it and/or modify
    10 * Nokia Corporation - initial contribution.
     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.
    11 *
    13 *
    12 * Contributors:
    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/".
    13 *
    17 *
    14 * Description: 
    18 * Description:
    15 *
    19 *
    16 */
    20 */
    17 
       
    18 
    21 
    19 #ifndef __DOWNLOAD_CONTROLLER_H__
    22 #ifndef __DOWNLOAD_CONTROLLER_H__
    20 #define __DOWNLOAD_CONTROLLER_H__
    23 #define __DOWNLOAD_CONTROLLER_H__
    21 
    24 
    22 #include <QObject>
    25 #include <QObject>
    23 #include "BWFGlobal.h"
    26 #include "BWFGlobal.h"
    24 
    27 
       
    28 #include "downloadproxy.h"
       
    29 
       
    30 class QFileInfo;
    25 class QNetworkProxy;
    31 class QNetworkProxy;
    26 class QNetworkReply;
    32 class QNetworkReply;
    27 class QNetworkRequest;
    33 class QNetworkRequest;
    28 class QString;
    34 class QString;
    29 class QUrl;
    35 class QUrl;
    30 class QWebPage;
    36 class QWebPage;
    31 
       
    32 class Download;
       
    33 
    37 
    34 class DownloadControllerPrivate;
    38 class DownloadControllerPrivate;
    35 
    39 
    36 class BWF_EXPORT DownloadController : public QObject
    40 class BWF_EXPORT DownloadController : public QObject
    37 {
    41 {
    39 
    43 
    40 public:
    44 public:
    41     DownloadController(const QString & client, const QNetworkProxy & proxy);
    45     DownloadController(const QString & client, const QNetworkProxy & proxy);
    42     ~DownloadController();
    46     ~DownloadController();
    43 
    47 
    44     static void debugDownload(Download * download);
       
    45 
       
    46 public slots:
    48 public slots:
    47     bool handlePage(QWebPage * page);
    49     bool handlePage(QWebPage * page);
       
    50 
       
    51     void startDownload(const QUrl & url, const QFileInfo & info);
    48 
    52 
    49 private slots:
    53 private slots:
    50     void startDownload(QNetworkReply * reply);
    54     void startDownload(QNetworkReply * reply);
    51     void startDownload(const QNetworkRequest & request);
    55     void startDownload(const QNetworkRequest & request);
    52 
    56 
    53 signals:
    57 signals:
    54     void downloadCreated(Download * download);
    58     void downloadCreated(DownloadProxy downloadProxy);
    55 
    59 
    56     void downloadStarted(Download * download);
    60     void downloadStarted(DownloadProxy downloadProxy);
    57 
    61 
    58     void downloadHeaderReceived(Download * download);
    62     void downloadHeaderReceived(DownloadProxy downloadProxy);
    59 
    63 
    60     void downloadProgress(Download * download);
    64     void downloadProgress(DownloadProxy downloadProxy);
    61 
    65 
    62     void downloadFinished(Download * download);
    66     void downloadFinished(DownloadProxy downloadProxy);
    63 
    67 
    64     void downloadPaused(Download * download, const QString & error);
    68     void downloadPaused(DownloadProxy downloadProxy, const QString & error);
    65 
    69 
    66     void downloadCancelled(Download * download, const QString & error);
    70     void downloadCancelled(DownloadProxy downloadProxy, const QString & error);
    67 
    71 
    68     void downloadFailed(Download * download, const QString & error);
    72     void downloadFailed(DownloadProxy downloadProxy, const QString & error);
    69 
    73 
    70     void downloadNetworkLoss(Download * download, const QString & error);
    74     void downloadNetworkLoss(DownloadProxy downloadProxy, const QString & error);
    71 
    75 
    72     void downloadError(Download * download, const QString & error);
    76     void downloadError(DownloadProxy downloadProxy, const QString & error);
    73 
    77 
    74     void downloadsCleared();
    78     void downloadsCleared();
       
    79 
       
    80     void unsupportedDownload(const QUrl & url);
    75 
    81 
    76 private:
    82 private:
    77     DownloadControllerPrivate * d;
    83     DownloadControllerPrivate * d;
    78 
    84 
    79     // Signals are protected, so they can't normally be emitted from methods
    85     // Signals are protected, so they can't normally be emitted from methods