Esempio n. 1
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_currentZoom(100)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_page(0)
    , m_actionReload(0)
    , m_actionStop(0)
    , m_actionsInitialized(false)
    , m_disableTouchMocking(false)
    , m_isReloading(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));

    // Zoom levels same as in firefox
    m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;

#if QTWEBKIT_TO_2_3
    installEventFilter(this);
#endif

#ifdef Q_OS_MAC
    new MacWebViewScroller(this);
#endif
}
Esempio n. 2
0
TabbedWebView::TabbedWebView(QupZilla* mainClass, WebTab* webTab)
    : WebView(webTab)
    , p_QupZilla(mainClass)
    , m_tabWidget(p_QupZilla->tabWidget())
    , m_page(0)
    , m_webTab(webTab)
    , m_menu(new Menu(this))
    , m_mouseTrack(false)
    , m_navigationVisible(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(loadingProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));

    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
    connect(this, SIGNAL(titleChanged(QString)), this, SLOT(titleChanged()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));

    connect(this, SIGNAL(statusBarMessage(QString)), p_QupZilla->statusBar(), SLOT(showMessage(QString)));

    connect(mApp->networkManager(), SIGNAL(wantsFocus(QUrl)), this, SLOT(getFocus(QUrl)));

    connect(p_QupZilla, SIGNAL(setWebViewMouseTracking(bool)), this, SLOT(trackMouse(bool)));

    // Tracking mouse also on tabs created in fullscreen
    trackMouse(p_QupZilla->isFullScreen());
}
Esempio n. 3
0
void EWAUserActionsEditorDialog::setSitePtr( EWASiteHandle* pSite )
{
    if( pSite )
    {
        m_sitePtr = pSite;
        m_pStoredPages = new QVector<EWAUserActionsCollection*>();
        createUserActivitysCopy( m_sitePtr->getEWANetworkManagerPtr()->getGesturesPlayer()->getPagesPtr(),
            m_pStoredPages );
        
        if( m_pStoredPages->first()->getActionsCount() )
        {
            QSize initSize = m_pStoredPages->first()->getActionsPtr()->at( 0 )->getWebViewSize();
            ui.pWebView->resize( initSize );
            ui.scrollArea->widget()->resize( initSize );
            ui.scrollArea->update();
        }
        
        connect( ui.pWebView, SIGNAL( loadStarted() ),
            this, SLOT( slotLoadStarted() ) );
        connect( ui.pWebView, SIGNAL( loadFinished(bool) ),
            this, SLOT( slotLoadFinished(bool) ) );
            
        setWindowTitle( tr( "User's Activities Editor - [%1]" ).arg( m_sitePtr->getVisibleMsgTitle() ) );
        
        initModel();
        
        ui.pWebView->setUrl( pSite->getUrl() );
    }
}
Esempio n. 4
0
void PopupWebPage::checkBehaviour()
{
    if (m_createNewWindow) {
        PopupWebView* view = new PopupWebView;
        view->setWebPage(this);

        PopupWindow* popup = new PopupWindow(view);
        popup->setWindowGeometry(m_geometry);
        popup->setMenuBarVisibility(m_menuBarVisible);
        popup->setStatusBarVisibility(m_statusBarVisible);
        popup->setToolBarVisibility(m_toolBarVisible);
        popup->show();

        p_QupZilla->addDeleteOnCloseWidget(popup);

        disconnect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
        disconnect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
        disconnect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
        disconnect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));

        disconnect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
        disconnect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
        disconnect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
    }
    else {
Esempio n. 5
0
ShibbolethWebView::ShibbolethWebView(Account* account, QWidget* parent)
    : QWebView(parent)
    , _account(account)
    , _accepted(false)
    , _cursorOverriden(false)
{
    // no minimize
    setWindowFlags(Qt::Dialog);
    setAttribute(Qt::WA_DeleteOnClose);
    QWebPage* page = new QWebPage(this);
    page->setNetworkAccessManager(account->networkAccessManager());
    connect(page, SIGNAL(loadStarted()),
            this, SLOT(slotLoadStarted()));
    connect(page, SIGNAL(loadFinished(bool)),
            this, SLOT(slotLoadFinished(bool)));


    connect(page->networkAccessManager()->cookieJar(),
            SIGNAL(newCookiesForUrl (QList<QNetworkCookie>, QUrl)),
            this, SLOT(onNewCookiesForUrl (QList<QNetworkCookie>, QUrl)));
    page->mainFrame()->load(account->url());
    this->setPage(page);
    setWindowTitle(tr("%1 - Authenticate").arg(Theme::instance()->appNameGUI()));

    // If we have a valid cookie, it's most likely expired. We can use this as
    // as a criteria to tell the user why the browser window pops up
    QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account, ShibbolethCredentials::accountCookies(_account));
    if (shibCookie != QNetworkCookie()) {
        Logger::instance()->postOptionalGuiLog(tr("Reauthentication required"), tr("Your session has expired. You need to re-login to continue to use the client."));
    }
}
Esempio n. 6
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_page(0)
    , m_actionReload(0)
    , m_actionStop(0)
    , m_actionsInitialized(false)
    , m_disableTouchMocking(false)
    , m_isReloading(false)
    , m_hasRss(false)
    , m_rssChecked(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(slotUrlChanged(QUrl)));

    m_zoomLevels = zoomLevels();
    m_currentZoomLevel = m_zoomLevels.indexOf(100);

    installEventFilter(this);

#ifdef Q_OS_MAC
    new MacWebViewScroller(this);
#endif
}
Esempio n. 7
0
void AMPWebView::setNetworkReply( QNetworkReply *r )
{
    qDebug( "AMPWebView::setNetworkReply()" );
    if ( !r ) return;
    _reply=r;
    connect( _reply, SIGNAL( finished() ), this, SLOT( slotReplyFinished() ) );
    connect( _reply, SIGNAL( downloadProgress( qint64, qint64 ) ), this,
        SLOT( slotReplyDownloadProgress( qint64, qint64 ) ) );
    slotLoadStarted();
}
Esempio n. 8
0
TabbedWebView::TabbedWebView(WebTab* webTab)
    : WebView(webTab)
    , m_window(0)
    , m_webTab(webTab)
    , m_menu(new Menu(this))
{
    m_menu->setCloseOnMiddleClick(true);

    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));
    connect(this, SIGNAL(urlChanged(QUrl)), this, SLOT(urlChanged(QUrl)));
}
Esempio n. 9
0
AMPWebView::AMPWebView( PHIAHistory *history, QWidget *parent )
    : PHIAAbstractWebView( history, parent ), _webPage( 0 ), _webView( 0 ),
    _isLoading( false ), _reply( 0 )
    //_cursorSetByWebCore( false ), _usesWebCoreCursor( true )
{
    qDebug( "AMPWebView::AMPWebView()" );
    _webView=new QWebView( this );
    _webPage=new AMPWebPage( this );
    QVBoxLayout *layout=new QVBoxLayout();
    layout->setContentsMargins( 0, 0, 0 ,0 );
    layout->addWidget( _webView );
    setLayout( layout );

    Q_ASSERT( _networkAccessManager );
    _webPage->setNetworkAccessManager( _networkAccessManager );
    _webPage->setForwardUnsupportedContent( true );
    _webView->setPage( _webPage );
    //_webPage->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );

    QWebFrame *frame=_webPage->mainFrame();
    connect( frame, SIGNAL( titleChanged( const QString& ) ), this, SLOT( slotTitleChanged( const QString& ) ) );
    connect( frame, SIGNAL( iconChanged() ), this, SLOT( slotIconChanged() ) );
    connect( frame, SIGNAL( urlChanged( const QUrl& ) ), this, SLOT( slotUrlChanged( const QUrl& ) ) );
    connect( _webPage, SIGNAL( loadProgress( int ) ), this, SIGNAL( loadProgress( int ) ) );
    connect( _webPage, SIGNAL( statusBarMessage( const QString& ) ), this,
        SLOT( slotStatusBarMessage( const QString& ) ) );
    connect( _webPage, SIGNAL( windowCloseRequested() ), this, SIGNAL( windowCloseRequested() ) );
    connect( _webPage, SIGNAL( unsupportedContent( QNetworkReply* ) ), this,
        SLOT( slotUnsupportedContent( QNetworkReply* ) ) );
    connect( _webPage, SIGNAL( linkHovered( const QString&, const QString&, const QString& ) ), this,
        SLOT( slotLinkHovered( const QString&, const QString&, const QString& ) ) );
    connect( _webPage, SIGNAL( loadFinished( bool ) ), this, SLOT( slotLoadFinished( bool ) ) );
    connect( _webPage, SIGNAL( loadStarted() ), this, SLOT( slotLoadStarted() ) );
    connect( _webPage, SIGNAL( javaScriptMessage( const QString&, int, const QString& ) ), this,
        SIGNAL( javaScriptConsoleMessage( const QString&, int, const QString& ) ) );
    connect( _webPage, SIGNAL( geometryChangeRequested( const QRect& ) ), this,
        SIGNAL( geometryChangeRequested( const QRect& ) ) );
    connect( _webPage, SIGNAL( statusBarVisibilityChangeRequested( bool ) ), this,
        SIGNAL( statusBarVisibilityChangeRequested( bool ) ) );
    connect( _webPage, SIGNAL( menuBarVisibilityChangeRequested( bool ) ), this,
        SIGNAL( menuBarVisibilityChangeRequested( bool ) ) );
    connect( _webPage, SIGNAL( toolBarVisibilityChangeRequested( bool ) ), this,
        SIGNAL( toolBarVisibilityChangeRequested( bool ) ) );
    connect( _webPage, SIGNAL( printRequested( QWebFrame* ) ), this,
        SLOT( slotPrintRequest( QWebFrame* ) ) );
    connect( _networkAccessManager, SIGNAL( finished( QNetworkReply* ) ), this,
        SLOT( slotReplyFinished( QNetworkReply* ) ) );
    update();
}
Esempio n. 10
0
void KWebKitPart::connectWebPageSignals(WebPage* page)
{
    if (!page)
        return;

    connect(page, SIGNAL(loadStarted()),
            this, SLOT(slotLoadStarted()));
    connect(page, SIGNAL(loadAborted(QUrl)),
            this, SLOT(slotLoadAborted(QUrl)));
    connect(page, SIGNAL(linkHovered(QString,QString,QString)),
            this, SLOT(slotLinkHovered(QString,QString,QString)));
    connect(page, SIGNAL(saveFrameStateRequested(QWebFrame*,QWebHistoryItem*)),
            this, SLOT(slotSaveFrameState(QWebFrame*,QWebHistoryItem*)));
    connect(page, SIGNAL(restoreFrameStateRequested(QWebFrame*)),
            this, SLOT(slotRestoreFrameState(QWebFrame*)));
    connect(page, SIGNAL(statusBarMessage(QString)),
            this, SLOT(slotSetStatusBarText(QString)));
    connect(page, SIGNAL(windowCloseRequested()),
            this, SLOT(slotWindowCloseRequested()));
    connect(page, SIGNAL(printRequested(QWebFrame*)),
            m_browserExtension, SLOT(slotPrintRequested(QWebFrame*)));
    connect(page, SIGNAL(frameCreated(QWebFrame*)),
            this, SLOT(slotFrameCreated(QWebFrame*)));

    connect(m_webView, SIGNAL(linkShiftClicked(QUrl)),
            page, SLOT(downloadUrl(QUrl)));

    connect(page, SIGNAL(loadProgress(int)),
            m_browserExtension, SIGNAL(loadingProgress(int)));
    connect(page, SIGNAL(selectionChanged()),
            m_browserExtension, SLOT(updateEditActions()));
    connect(m_browserExtension, SIGNAL(saveUrl(QUrl)),
            page, SLOT(downloadUrl(QUrl)));

    connect(page->mainFrame(), SIGNAL(loadFinished(bool)),
            this, SLOT(slotMainFrameLoadFinished(bool)));


    KWebWallet *wallet = page->wallet();
    if (wallet) {
        connect(wallet, SIGNAL(saveFormDataRequested(QString,QUrl)),
                this, SLOT(slotSaveFormDataRequested(QString,QUrl)));
        connect(wallet, SIGNAL(fillFormRequestCompleted(bool)),
                this, SLOT(slotFillFormRequestCompleted(bool)));
        connect(wallet, SIGNAL(walletClosed()), this, SLOT(slotWalletClosed()));
    }
}
Esempio n. 11
0
WebView::WebView(QWidget* parent)
    : QWebView(parent)
    , m_currentZoom(100)
    , m_isLoading(false)
    , m_progress(0)
    , m_clickedFrame(0)
    , m_actionsHaveImages(false)
{
    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished()));

    connect(this, SIGNAL(iconChanged()), this, SLOT(slotIconChanged()));

    // Zoom levels same as in firefox
    m_zoomLevels << 30 << 50 << 67 << 80 << 90 << 100 << 110 << 120 << 133 << 150 << 170 << 200 << 240 << 300;

    qApp->installEventFilter(this);
}
Esempio n. 12
0
ShibbolethWebView::ShibbolethWebView(AccountPtr account, QWidget* parent)
    : QWebView(parent)
    , _account(account)
    , _accepted(false)
    , _cursorOverriden(false)
{
    // no minimize
    setWindowFlags(Qt::Dialog);
    setAttribute(Qt::WA_DeleteOnClose);

    QWebPage* page = new QWebPage(this);
    connect(page, SIGNAL(loadStarted()),
            this, SLOT(slotLoadStarted()));
    connect(page, SIGNAL(loadFinished(bool)),
            this, SLOT(slotLoadFinished(bool)));

    // Make sure to accept the same SSL certificate issues as the regular QNAM we use for syncing
    QObject::connect(page->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
            _account.data(), SLOT(slotHandleSslErrors(QNetworkReply*,QList<QSslError>)));

    // The Account keeps ownership of the cookie jar, it must outlive this webview.
    account->lendCookieJarTo(page->networkAccessManager());
    connect(page->networkAccessManager()->cookieJar(),
            SIGNAL(newCookiesForUrl (QList<QNetworkCookie>, QUrl)),
            this, SLOT(onNewCookiesForUrl (QList<QNetworkCookie>, QUrl)));
    page->mainFrame()->load(account->url());
    this->setPage(page);
    setWindowTitle(tr("%1 - Authenticate").arg(Theme::instance()->appNameGUI()));

    // If we have a valid cookie, it's most likely expired. We can use this as
    // as a criteria to tell the user why the browser window pops up
    QNetworkCookie shibCookie = ShibbolethCredentials::findShibCookie(_account.data(), ShibbolethCredentials::accountCookies(_account.data()));
    if (shibCookie != QNetworkCookie()) {
        Logger::instance()->postOptionalGuiLog(tr("Reauthentication required"), tr("Your session has expired. You need to re-login to continue to use the client."));
    }

    ConfigFile config;
    QSettings settings(config.configFile());
    resize(900, 700); // only effective the first time, later overridden by restoreGeometry
    restoreGeometry(settings.value(ShibbolethWebViewGeometryC).toByteArray());
}
Esempio n. 13
0
PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass)
    : WebPage(mainClass)
    , p_QupZilla(mainClass)
    , m_type(type)
    , m_createNewWindow(false)
    , m_menuBarVisible(false)
    , m_statusBarVisible(false)
    , m_toolBarVisible(false)
    , m_isLoading(false)
    , m_progress(0)
{
    connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
    connect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
    connect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
    connect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));

    connect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
    connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));

    QTimer::singleShot(0, this, SLOT(checkBehaviour()));
}
Esempio n. 14
0
void PopupWebPage::checkBehaviour()
{
    // If menubar/statusbar/toolbar visibility is explicitly set in window.open call,
    // at least one of those variables will be false.
    // If so, we should open new window.
    // But not when all visibilities are false, it occurs with target=_blank links

    if (!m_createNewWindow && (!m_menuBarVisible || !m_statusBarVisible || !m_toolBarVisible)
            && !(!m_menuBarVisible && !m_statusBarVisible && !m_toolBarVisible)) {
        m_createNewWindow = true;
    }

    if (m_createNewWindow) {
        PopupWebView* view = new PopupWebView;
        view->setWebPage(this);

        PopupWindow* popup = new PopupWindow(view);
        popup->setWindowGeometry(m_geometry);
        popup->setMenuBarVisibility(m_menuBarVisible);
        popup->setStatusBarVisibility(m_statusBarVisible);
        popup->setToolBarVisibility(m_toolBarVisible);
        popup->show();

        if (m_isLoading) {
            view->fakeLoadingProgress(m_progress);
        }

        p_QupZilla->addDeleteOnCloseWidget(popup);

        disconnect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect)));
        disconnect(this, SIGNAL(menuBarVisibilityChangeRequested(bool)), this, SLOT(slotMenuBarVisibilityChangeRequested(bool)));
        disconnect(this, SIGNAL(toolBarVisibilityChangeRequested(bool)), this, SLOT(slotToolBarVisibilityChangeRequested(bool)));
        disconnect(this, SIGNAL(statusBarVisibilityChangeRequested(bool)), this, SLOT(slotStatusBarVisibilityChangeRequested(bool)));

        disconnect(this, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted()));
        disconnect(this, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int)));
        disconnect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool)));
    }
    else {