diff options
| author | Andrea Diamantini <adjam7@gmail.com> | 2009-01-09 12:26:38 +0100 | 
|---|---|---|
| committer | Andrea Diamantini <adjam7@gmail.com> | 2009-01-09 12:26:38 +0100 | 
| commit | 910f1cc073f95f2928cb29d87561f71a27513872 (patch) | |
| tree | eed922dd43bc0815b0aa051faac5cdfafbca52f2 /src | |
| parent | BIG change!! (diff) | |
| download | rekonq-910f1cc073f95f2928cb29d87561f71a27513872.tar.xz | |
Removed WebActionMapper class!
Now we are really starting to have adjam web browser..
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainview.cpp | 125 | ||||
| -rw-r--r-- | src/mainview.h | 44 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 12 | 
3 files changed, 8 insertions, 173 deletions
| diff --git a/src/mainview.cpp b/src/mainview.cpp index f61a7593..21c318ed 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -42,103 +42,6 @@ - -WebActionMapper::WebActionMapper(KAction *root, QWebPage::WebAction webAction, QObject *parent) -    : QObject(parent) -    , m_currentParent(0) -    , m_root(root) -    , m_webAction(webAction) -{ -    if ( !m_root ) -    { -        return; -    } -    connect(m_root, SIGNAL( triggered() ), this, SLOT( rootTriggered() ) ); -    connect(root, SIGNAL( destroyed(QObject *) ), this, SLOT( rootDestroyed() ) ); -     -    root->setEnabled(false); -} - - -void WebActionMapper::rootDestroyed() -{ -    m_root = 0; -} - - -void WebActionMapper::currentDestroyed() -{ -    updateCurrent(0); -} - - -void WebActionMapper::addChild(KAction *action) -{ -    if ( !action ) -    { -        return; -    } -    connect(action, SIGNAL( changed() ), this, SLOT( childChanged() ) ); -} - -QWebPage::WebAction WebActionMapper::webAction() const -{ -    return m_webAction; -} - - -void WebActionMapper::rootTriggered() -{ -    if (m_currentParent)  -    { -        KAction *gotoAction = new KAction( m_currentParent->action(m_webAction) ); -        gotoAction->trigger(); -    } -} - - -void WebActionMapper::childChanged() -{ -    if (KAction *source = qobject_cast<KAction*>(sender()))  -    { -        if (m_root -            && m_currentParent -            && source->parent() == m_currentParent)  -        { -            m_root->setChecked(source->isChecked()); -            m_root->setEnabled(source->isEnabled()); -        } -    } -} - - -void WebActionMapper::updateCurrent(QWebPage *currentParent) -{ -    if (m_currentParent) -        disconnect(m_currentParent, SIGNAL(destroyed(QObject *)), -                   this, SLOT(currentDestroyed())); - -    m_currentParent = currentParent; -    if (!m_root) -    { -        return; -    } -    if (!m_currentParent)  -    { -        m_root->setEnabled(false); -        m_root->setChecked(false); -        return; -    } -    KAction *source = new KAction( m_currentParent->action(m_webAction) ); -    m_root->setChecked(source->isChecked()); -    m_root->setEnabled(source->isEnabled()); -    connect(m_currentParent, SIGNAL( destroyed(QObject *) ), this, SLOT( currentDestroyed() ) ); -} - - -// ---------------------------------------------------------------------------------------------------------- - -  MainView::MainView(QWidget *parent)      : KTabWidget(parent)      , m_recentlyClosedTabsAction(0) @@ -338,14 +241,6 @@ void MainView::reloadTab(int index)  } -void MainView::addWebAction(KAction *action, QWebPage::WebAction webAction) -{ -    if (!action) -        return; -    m_webActionList.append(new WebActionMapper(action, webAction, this)); -} - -  void MainView::currentChanged(int index)  {      WebView *webView = this->webView(index); @@ -366,11 +261,6 @@ void MainView::currentChanged(int index)      connect(webView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&)));      connect(webView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int))); -    for (int i = 0; i < m_webActionList.count(); ++i)  -    { -        WebActionMapper *mapper = m_webActionList[i]; -        mapper->updateCurrent(webView->page()); -    }      emit setCurrentTitle(webView->title());      m_lineEdits->setCurrentIndex(index);      emit loadProgress(webView->progress()); @@ -499,13 +389,6 @@ WebView *MainView::newTab(bool makeCurrent)      if (makeCurrent)          setCurrentWidget(webView); -    // webview actions -    for (int i = 0; i < m_webActionList.count(); ++i)  -    { -        WebActionMapper *mapper = m_webActionList[i]; -        mapper->addChild( new KAction( webView->page()->action( mapper->webAction() ) )  ); -    } -      if (count() == 1)          currentChanged(currentIndex());      emit tabsChanged(); @@ -591,10 +474,10 @@ void MainView::closeTab(int index)          if (tab->isModified())           {              int risp = KMessageBox::questionYesNo( this ,  -                                                                            i18n("You have modified this page and when closing it you would lose the modification.\n" -                                                                            "Do you really want to close this page?\n"), -                                                                            i18n("Do you really want to close this page?"), -                                                                            KStandardGuiItem::no() ); +                                                   i18n("You have modified this page and when closing it you would lose the modification.\n" +                                                   "Do you really want to close this page?\n"), +                                                   i18n("Do you really want to close this page?"), +                                                   KStandardGuiItem::no() );              if( risp == KMessageBox::No )                  return;          } diff --git a/src/mainview.h b/src/mainview.h index 135bad13..9fdc24bd 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -2,7 +2,6 @@   *   * This file is a part of the rekonq project   * - * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved   * Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com>   *   * @@ -23,54 +22,19 @@  #ifndef TABWIDGET_H  #define TABWIDGET_H -// Qt Includes -#include <QWebPage> -// KDE Includes -#include <KAction> - -class WebView; -/** - *   A proxy object that connects a single browser action - *   to one child webpage action at a time. - * - *   Example usage: used to keep the main window stop action in sync with - *   the current tabs webview's stop action. - */ -class WebActionMapper : public QObject -{ -    Q_OBJECT - -public: -    WebActionMapper(KAction *root, QWebPage::WebAction webAction, QObject *parent); -    QWebPage::WebAction webAction() const; -    void addChild(KAction *action); -    void updateCurrent(QWebPage *currentParent); - -private slots: -    void rootTriggered(); -    void childChanged(); -    void rootDestroyed(); -    void currentDestroyed(); - -private: -    QWebPage *m_currentParent; -    KAction *m_root; -    QWebPage::WebAction m_webAction; -}; - - -// ---------------------------------------------------------------------------------------------------------------------------- -  // Local Includes  #include "tabbar.h" +#include "webview.h"  // KDE Includes  #include <KUrl>  #include <KMenu>  #include <KTabWidget> +#include <KAction>  // Qt Includes  #include <QLineEdit> +#include <QWebPage>  QT_BEGIN_NAMESPACE  class QCompleter; @@ -111,7 +75,6 @@ signals:  public:      void clear(); -    void addWebAction(KAction *action, QWebPage::WebAction webAction);      KAction *newTabAction() const;      KAction *closeTabAction() const; @@ -176,7 +139,6 @@ private:      KMenu *m_recentlyClosedTabsMenu;      static const int m_recentlyClosedTabsSize = 10;      QList<KUrl> m_recentlyClosedTabs; -    QList<WebActionMapper*> m_webActionList;      QCompleter *m_lineEditCompleter;      QStackedWidget *m_lineEdits; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e85cd7b2..e14f8611 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -148,16 +148,6 @@ void MainWindow::setupActions()      KStandardAction::paste( m_tabWidget, SLOT( slotWebPaste() ), actionCollection() );      KStandardAction::selectAll( m_tabWidget, SLOT( slotWebSelectAll() ), actionCollection() ); -//     m_tabWidget->addWebAction( KStandardAction::redisplay( this, 0, actionCollection() )    , QWebPage::Reload ); -//     m_tabWidget->addWebAction( KStandardAction::back( this, 0, actionCollection() )         , QWebPage::Back ); -//     m_tabWidget->addWebAction( KStandardAction::forward( this, 0, actionCollection() )      , QWebPage::Forward ); -//     m_tabWidget->addWebAction( KStandardAction::undo( this , 0 , actionCollection() )       , QWebPage::Undo ); -//     m_tabWidget->addWebAction( KStandardAction::redo( this , 0 , actionCollection() )       , QWebPage::Redo ); -//     m_tabWidget->addWebAction( KStandardAction::cut( this , 0 , actionCollection() )        , QWebPage::Cut ); -//     m_tabWidget->addWebAction( KStandardAction::copy( this , 0 , actionCollection() )       , QWebPage::Copy ); -//     m_tabWidget->addWebAction( KStandardAction::paste( this , 0 , actionCollection() )      , QWebPage::Paste ); -//     m_tabWidget->addWebAction( KStandardAction::selectAll( this , 0 , actionCollection() )  , QWebPage::SelectEndOfDocument ); -      // stop reload Action       m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this );      actionCollection()->addAction( QLatin1String("stop reload") , m_stopReload ); @@ -166,7 +156,7 @@ void MainWindow::setupActions()      a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this );      a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) );      actionCollection()->addAction( QLatin1String("stop"), a ); -    m_tabWidget->addWebAction( a, QWebPage::Stop); +// FIXME     m_tabWidget->addWebAction( a, QWebPage::Stop);      a = new KAction( KIcon(), i18n("Open Location"), this);       actionCollection()->addAction( QLatin1String("open location"), a ); | 
