| 1 | /* |
|---|
| 2 | * WengoPhone, a voice over Internet phone |
|---|
| 3 | * Copyright (C) 2004-2006 Wengo |
|---|
| 4 | * |
|---|
| 5 | * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef OWQTBROWSERWIDGET_H |
|---|
| 21 | #define OWQTBROWSERWIDGET_H |
|---|
| 22 | |
|---|
| 23 | #include <QtCore/QObject> |
|---|
| 24 | |
|---|
| 25 | #include <util/NonCopyable.h> |
|---|
| 26 | |
|---|
| 27 | #include <string> |
|---|
| 28 | |
|---|
| 29 | #include<QtNetwork/QtNetwork> |
|---|
| 30 | #include<QtGui/QtGui> |
|---|
| 31 | #include<QtWebKit/QtWebKit> |
|---|
| 32 | |
|---|
| 33 | class QtWengoPhone; |
|---|
| 34 | |
|---|
| 35 | /** |
|---|
| 36 | * Embedded HTML browser widget inside the main window. |
|---|
| 37 | * |
|---|
| 38 | * Works only under Windows for the moment using a ActiveX control. |
|---|
| 39 | * |
|---|
| 40 | * @author Tanguy Krotoff |
|---|
| 41 | * @author Mathieu Stute |
|---|
| 42 | */ |
|---|
| 43 | |
|---|
| 44 | class QtWebPage :public QWebPage |
|---|
| 45 | { |
|---|
| 46 | protected: |
|---|
| 47 | bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) |
|---|
| 48 | { |
|---|
| 49 | //if(type == QWebPage::NavigationTypeOther) |
|---|
| 50 | // QDesktopServices::openUrl(request.url()); |
|---|
| 51 | |
|---|
| 52 | return QWebPage::acceptNavigationRequest(frame,request,type); |
|---|
| 53 | } |
|---|
| 54 | }; |
|---|
| 55 | |
|---|
| 56 | class QtBrowserWidget : public QObject, NonCopyable { |
|---|
| 57 | Q_OBJECT |
|---|
| 58 | public: |
|---|
| 59 | |
|---|
| 60 | QtBrowserWidget(QtWengoPhone & qtWengoPhone); |
|---|
| 61 | |
|---|
| 62 | ~QtBrowserWidget(); |
|---|
| 63 | |
|---|
| 64 | QWidget * getWidget() const; |
|---|
| 65 | |
|---|
| 66 | /** |
|---|
| 67 | * Loads the default URL, loaded at startup. |
|---|
| 68 | */ |
|---|
| 69 | void loadDefaultURL(); |
|---|
| 70 | |
|---|
| 71 | /** |
|---|
| 72 | * Loads the URL when the user is connected. |
|---|
| 73 | */ |
|---|
| 74 | void loadAccountURL(); |
|---|
| 75 | |
|---|
| 76 | private Q_SLOTS: |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * delete the browser. |
|---|
| 80 | */ |
|---|
| 81 | void slotUserProfileDeleted(); |
|---|
| 82 | |
|---|
| 83 | void linkClicked_slot(const QUrl & url); |
|---|
| 84 | |
|---|
| 85 | private: |
|---|
| 86 | |
|---|
| 87 | QtWengoPhone & _qtWengoPhone; |
|---|
| 88 | |
|---|
| 89 | QWebView * _qtBrowser; |
|---|
| 90 | |
|---|
| 91 | std::string base_path; |
|---|
| 92 | |
|---|
| 93 | Q_SIGNALS: |
|---|
| 94 | void openwengo_phonebook_signal(); |
|---|
| 95 | void openwengo_log_signal(); |
|---|
| 96 | void openwengo_configuration_signal(); |
|---|
| 97 | void openwengo_dial_signal(); |
|---|
| 98 | void openwengo_addcontact_signal(); |
|---|
| 99 | void openwengo_selfcare_signal(); |
|---|
| 100 | void openwengo_forum_signal(); |
|---|
| 101 | void openwengo_smartdirectory_signal(); |
|---|
| 102 | void openwengo_secret_permanent_signal(); |
|---|
| 103 | }; |
|---|
| 104 | |
|---|
| 105 | #endif //OWQTBROWSERWIDGET_H |
|---|