diff options
| -rw-r--r-- | src/analyzer/analyzerpanel.cpp | 8 | ||||
| -rw-r--r-- | src/data/rekonq.desktop | 1 | ||||
| -rw-r--r-- | src/findbar.cpp | 6 | ||||
| -rw-r--r-- | src/findbar.h | 2 | ||||
| -rw-r--r-- | src/mainview.cpp | 19 | ||||
| -rw-r--r-- | src/mainview.h | 7 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 61 | ||||
| -rw-r--r-- | src/mainwindow.h | 9 | ||||
| -rw-r--r-- | src/urlbar/rsswidget.cpp | 26 | ||||
| -rw-r--r-- | src/urlbar/urlresolver.cpp | 4 | ||||
| -rw-r--r-- | src/webinspectorpanel.cpp | 27 | ||||
| -rw-r--r-- | src/webinspectorpanel.h | 9 | ||||
| -rw-r--r-- | src/webtab.cpp | 19 | ||||
| -rw-r--r-- | src/webtab.h | 16 | ||||
| -rw-r--r-- | src/webview.cpp | 6 | ||||
| -rw-r--r-- | src/webview.h | 3 | 
16 files changed, 101 insertions, 122 deletions
| diff --git a/src/analyzer/analyzerpanel.cpp b/src/analyzer/analyzerpanel.cpp index be346300..9198cade 100644 --- a/src/analyzer/analyzerpanel.cpp +++ b/src/analyzer/analyzerpanel.cpp @@ -79,10 +79,7 @@ void NetworkAnalyzerPanel::toggle(bool enable)          connect(manager, SIGNAL(networkData(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *)),                      _viewer, SLOT(addRequest(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *) ) ); -                     -//         mainWindow()->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); -//         findChild<QWebInspector *>()->setPage(mainWindow()->currentTab()->page()); -        show(); +         show();      }      else      { @@ -91,13 +88,12 @@ void NetworkAnalyzerPanel::toggle(bool enable)                      _viewer, SLOT(addRequest(QNetworkAccessManager::Operation, const QNetworkRequest &, QNetworkReply *) ) );          hide(); -//         mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);      }  }  void NetworkAnalyzerPanel::changeCurrentPage()  { -    bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled); +    bool enable = mainWindow()->currentTab()->page()->hasNetworkAnalyzerEnabled();      toggle(enable);  } diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop index 050e46b7..a4eb1b00 100644 --- a/src/data/rekonq.desktop +++ b/src/data/rekonq.desktop @@ -11,6 +11,7 @@ Name[uk]=rekonq  Name[x-test]=xxrekonqxx  Name[zh_CN]=rekonq  GenericName=WebKit KDE Browser +GenericName[da]=KDE-browser baseret på WebKit  GenericName[pt]=Navegador do KDE Usando o WebKit  GenericName[pt_BR]=Navegador WebKit do KDE  GenericName[sv]=Webkit webbläsare för KDE diff --git a/src/findbar.cpp b/src/findbar.cpp index f89cde60..10b63186 100644 --- a/src/findbar.cpp +++ b/src/findbar.cpp @@ -126,12 +126,6 @@ FindBar::~FindBar()  } -KLineEdit *FindBar::lineEdit() const -{ -    return m_lineEdit; -} - -  bool FindBar::matchCase() const  {      return m_matchCase->isChecked(); diff --git a/src/findbar.h b/src/findbar.h index 39bb28c9..83334b4f 100644 --- a/src/findbar.h +++ b/src/findbar.h @@ -50,7 +50,7 @@ class REKONQ_TESTS_EXPORT FindBar : public QWidget  public:      FindBar(QWidget *parent);      ~FindBar(); -    KLineEdit *lineEdit() const; +      bool matchCase() const;      void notifyMatch(bool match);      bool highlightAllState() const; diff --git a/src/mainview.cpp b/src/mainview.cpp index 58247d53..1c36adcf 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -35,7 +35,6 @@  #include "rekonq.h"  // Local Includes -#include "webtab.h"  #include "tabbar.h"  #include "urlbar.h"  #include "sessionmanager.h" @@ -166,12 +165,6 @@ void MainView::updateTabButtonPosition()  } -QToolButton *MainView::addTabButton() const -{ -    return m_addTabButton; -} - -  TabBar *MainView::tabBar() const  {      TabBar *tabBar = qobject_cast<TabBar *>(KTabWidget::tabBar()); @@ -185,12 +178,6 @@ UrlBar *MainView::urlBar() const  } -StackedUrlBar *MainView::widgetBar() const -{ -    return _widgetBar; -} - -  WebTab *MainView::currentWebTab() const  {      return webTab(currentIndex()); @@ -693,12 +680,6 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)  } -QList<HistoryItem> MainView::recentlyClosedTabs() -{ -    return m_recentlyClosedTabs; -} - -  void MainView::resizeEvent(QResizeEvent *event)  {      updateTabBar(); diff --git a/src/mainview.h b/src/mainview.h index 6eacc104..0cff4c81 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -37,6 +37,7 @@  // Local Includes  #include "webview.h"  #include "webpage.h" +#include "webtab.h"  #include "application.h"  #include "historymanager.h"  #include "mainwindow.h" @@ -72,7 +73,7 @@ public:      MainView(MainWindow *parent);      ~MainView(); -    StackedUrlBar *widgetBar() const; +    inline StackedUrlBar *widgetBar() const { return _widgetBar; }      UrlBar *urlBar() const;      WebTab *webTab(int index) const; @@ -88,7 +89,7 @@ public:      void setTabBarHidden(bool hide); -    QToolButton *addTabButton() const; +    inline QToolButton *addTabButton() const { return m_addTabButton; }      /**       * This function creates a new empty tab @@ -100,7 +101,7 @@ public:       */      WebTab *newWebTab(bool focused = true, bool nearParent = false); -    QList<HistoryItem> recentlyClosedTabs(); +    inline QList<HistoryItem> recentlyClosedTabs() { return m_recentlyClosedTabs; }  signals:      // tab widget signals diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index efc6e3c7..2287370c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -265,12 +265,6 @@ QSize MainWindow::sizeHint() const  } -KActionCollection *MainWindow::actionCollection() const -{ -    return m_ac; -} - -  void MainWindow::setupActions()  {      // this let shortcuts work.. @@ -984,13 +978,6 @@ void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k  } -MainView *MainWindow::mainView() const -{ -    return m_view; -} - - -  WebTab *MainWindow::currentTab() const  {      return m_view->currentWebTab(); @@ -1124,20 +1111,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)  } -QAction *MainWindow::actionByName(const QString &name) -{ -    QAction *ret = actionCollection()->action(name); - -    if (ret) -        return ret; - -    /* else */ -    kDebug() << "Action named: " << name << " not found, returning empty action."; - -    return new QAction(this);  // return empty object instead of NULL pointer -} - -  void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)  {      if (this != QApplication::activeWindow()) @@ -1399,3 +1372,37 @@ void MainWindow::enableNetworkAnalysis(bool b)      currentTab()->page()->enableNetworkAnalyzer(b);      m_analyzerPanel->toggle(b);  } + + +bool MainWindow::queryClose() +{ +    if (m_view->count() > 1)                                                                                                               +    { +        int answer = KMessageBox::questionYesNoCancel(                                                                                     +                        this,                                                                                                             +                        i18np("Are you sure you want to close the window?\n" "You have 1 tab open", +                         "Are you sure you want to close the window?\n" "You have %1 tabs open" ,  +                        m_view->count()), +                        i18n("Are you sure you want to close the window?"),                                                               +                        KStandardGuiItem::quit(),                                                                                         +                        KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")),                                                         +                        KStandardGuiItem::cancel(),                                                                                       +                        "confirmClosingMultipleTabs"                                                                                      +                                                        );                                                                                                                    +                                                                                                                     +        switch (answer)                                                                                                                    +        {                                                                                                                                  +            case KMessageBox::Yes:   +                // Quit                                                                                                                          +                return true;                                                                                                                   +             +            case KMessageBox::No:                                                                                                              +                // Close only the current tab                                                                                                  +                m_view->closeTab(); +             +            default:                                                                                                                           +                return false;                                                                                                                  +        }                                                                                                                                  +    }                                                                                                                                      +    return true;                                                                                                                           +} diff --git a/src/mainwindow.h b/src/mainwindow.h index d8f6114f..ffc91086 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -70,11 +70,12 @@ public:      MainWindow();      ~MainWindow(); -    MainView *mainView() const; +    inline MainView *mainView() const { return m_view; } +    inline KActionCollection *actionCollection() const { return m_ac; } +    inline QAction *actionByName(const QString &name) { return actionCollection()->action(name); } +          WebTab *currentTab() const; -    QAction *actionByName(const QString &name);      virtual QSize sizeHint() const; -    virtual KActionCollection *actionCollection() const;      void setWidgetsVisible(bool makeFullScreen);      void setZoomSliderFactor(qreal factor); @@ -115,6 +116,8 @@ protected:      */      void keyPressEvent(QKeyEvent *event); +    bool queryClose(); +      private slots:      void postLaunch();      void browserLoading(bool); diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp index 395d7bab..35095c07 100644 --- a/src/urlbar/rsswidget.cpp +++ b/src/urlbar/rsswidget.cpp @@ -56,26 +56,35 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent)          , m_map(map)  {      setAttribute(Qt::WA_DeleteOnClose); -    setFixedWidth(250); +     +    setMinimumWidth(200);      setFrameStyle(Panel);      QFormLayout *layout = new QFormLayout(this);      setLayout(layout); +    QLabel *title = new QLabel(this); +    title->setText(i18n("<h4>Subscribe to RSS Feeds</h4>")); +    layout->addRow(title); + +    // Agregators      QLabel *agregator = new QLabel(this);      agregator->setText(i18n("Aggregator:"));      m_agregators = new KComboBox(this); -    m_agregators->addItem(KIcon("application-rss+xml"), QString("Akregator")); +    m_agregators->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); +     +    m_agregators->addItem(KIcon("akregator"), QString("Akregator"));      m_agregators->addItem(Application::icon(KUrl("http://google.com/reader")), i18n("Google Reader"));      layout->addRow(agregator, m_agregators); - +    // Feeds List      QLabel *feed = new QLabel(this);      feed->setText(i18n("Feed:"));      m_feeds = new KComboBox(this); +    m_feeds->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);      foreach(const QString &title, m_map)      { @@ -84,13 +93,16 @@ RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent)      layout->addRow(feed, m_feeds); - -    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); -    buttonBox->button(QDialogButtonBox::Ok)->setText(i18n("Add Feed")); +    // Buttons +    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this); +     +    QPushButton *addFeed = new QPushButton(KIcon("list-add"), i18n("Add Feed"), buttonBox); +    buttonBox->addButton(addFeed, QDialogButtonBox::AcceptRole); +          connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));      connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); -    layout->addWidget(buttonBox); +    layout->addRow(buttonBox);  } diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 4313d569..21e3fe9c 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -76,6 +76,8 @@ UrlResolver::UrlResolver(const QString &typedUrl)          QString protocol = "^(http://|https://|file://|ftp://)"; +        QString local = "^/"; +                  QString ipv4 = "^0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])"\          "\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])"; @@ -89,7 +91,7 @@ UrlResolver::UrlResolver(const QString &typedUrl)          "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\          "pro)"; -        _browseRegexp = QRegExp("(" + protocol + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")"); +        _browseRegexp = QRegExp("(" + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")");      }  } diff --git a/src/webinspectorpanel.cpp b/src/webinspectorpanel.cpp index 31833ea9..3d1a5a1e 100644 --- a/src/webinspectorpanel.cpp +++ b/src/webinspectorpanel.cpp @@ -42,9 +42,9 @@  WebInspectorPanel::WebInspectorPanel(QString title, QWidget *parent)          : QDockWidget(title, parent) +        , _inspector(0)  {      setObjectName("webInspectorDock"); -    setWidget(new QWebInspector(this));  } @@ -55,31 +55,34 @@ void WebInspectorPanel::closeEvent(QCloseEvent *event)  } -MainWindow* WebInspectorPanel::mainWindow() -{ -    return qobject_cast< MainWindow* >(parentWidget()); -} - -  void WebInspectorPanel::toggle(bool enable)  { -    mainWindow()->actionByName("web_inspector")->setChecked(enable); +    MainWindow *w = qobject_cast<MainWindow *>(parent()); +    w->actionByName( QL1S("web_inspector") )->setChecked(enable);      if (enable)      { -        mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); -        findChild<QWebInspector *>()->setPage(mainWindow()->currentTab()->page()); +        w->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); +        if(!_inspector) +        { +            _inspector = new QWebInspector(this); +            _inspector->setPage( w->currentTab()->page() ); +            setWidget(_inspector); +        }          show();      }      else      { +        w->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false); +        delete _inspector; +        _inspector = 0;          hide(); -        mainWindow()->currentTab()->view()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);      }  }  void WebInspectorPanel::changeCurrentPage()  { -    bool enable = mainWindow()->currentTab()->view()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled); +    MainWindow *w = qobject_cast<MainWindow *>(parent()); +    bool enable = w->currentTab()->page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);      toggle(enable);  } diff --git a/src/webinspectorpanel.h b/src/webinspectorpanel.h index 8b1e3507..1f0ea06b 100644 --- a/src/webinspectorpanel.h +++ b/src/webinspectorpanel.h @@ -35,7 +35,11 @@  #include "mainwindow.h"  // Qt Includes -#include <QDockWidget> +#include <QtGui/QDockWidget> + +// Forward +class QWebInspector; +  /**      Docked web inspector @@ -54,8 +58,7 @@ public slots:  protected:      virtual void closeEvent(QCloseEvent *event); -    MainWindow *mainWindow(); - +    QWebInspector *_inspector;  };  #endif diff --git a/src/webtab.cpp b/src/webtab.cpp index d8fff875..a6bedc97 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -36,7 +36,6 @@  #include "application.h"  #include "mainwindow.h"  #include "mainview.h" -#include "webpage.h"  #include "bookmarksmanager.h"  #include "walletbar.h"  #include "previewselectorbar.h" @@ -96,18 +95,6 @@ WebTab::~WebTab()  } -WebView *WebTab::view() -{ -    return _view; -} - - -WebPage *WebTab::page() -{ -    return view()->page(); -} - -  // TODO:  // Import the "about" check and the one in protocolhandler  // in some (static?) methods in NewTabPage @@ -134,12 +121,6 @@ KUrl WebTab::url()  } -int WebTab::progress() -{ -    return m_progress; -} - -  void WebTab::updateProgress(int p)  {      m_progress = p; diff --git a/src/webtab.h b/src/webtab.h index 309ecd9a..bc07a3e9 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -32,16 +32,16 @@  // Rekonq Includes  #include "rekonq_defines.h" +// Local Includes +#include "webpage.h" +#include "webview.h" +  // KDE Includes  #include <KUrl>  // Qt Includes  #include <QWidget> -// Forward Declarations -class WebPage; -class WebView; -  class REKONQ_TESTS_EXPORT WebTab : public QWidget  { @@ -51,11 +51,11 @@ public:      explicit WebTab(QWidget *parent = 0);      ~WebTab(); -    WebView *view(); -    WebPage *page(); +    inline WebView *view() { return _view; } +    inline WebPage *page() { return view()->page(); } +    inline int progress() { return m_progress; } +          KUrl url(); - -    int progress();      void createPreviewSelectorBar(int index);      bool hasRSSInfo(); diff --git a/src/webview.cpp b/src/webview.cpp index 1996d6af..86b60fac 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -374,12 +374,6 @@ void WebView::mouseMoveEvent(QMouseEvent *event)  } -QPoint WebView::mousePos() -{ -    return _mousePos; -} - -  void WebView::search()  {      KAction *a = qobject_cast<KAction*>(sender()); diff --git a/src/webview.h b/src/webview.h index 71e3047f..bac12e99 100644 --- a/src/webview.h +++ b/src/webview.h @@ -48,7 +48,8 @@ public:      ~WebView();      WebPage *page(); -    QPoint mousePos(); +     +    inline QPoint mousePos() { return _mousePos; }  protected:      void contextMenuEvent(QContextMenuEvent *event); | 
