diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/application.cpp | 4 | ||||
| -rw-r--r-- | src/downloadmanager.cpp | 45 | ||||
| -rw-r--r-- | src/downloadmanager.h | 5 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 19 | ||||
| -rw-r--r-- | src/mainwindow.h | 3 | ||||
| -rw-r--r-- | src/newtabpage.cpp | 2 | ||||
| -rw-r--r-- | src/rekonqmenu.cpp | 96 | ||||
| -rw-r--r-- | src/rekonqmenu.h | 61 | ||||
| -rw-r--r-- | src/sessionmanager.cpp | 124 | ||||
| -rw-r--r-- | src/settings/settingsdialog.cpp | 4 | ||||
| -rw-r--r-- | src/settings/settingsdialog.h | 2 | ||||
| -rw-r--r-- | src/sslinfo.ui | 52 | ||||
| -rw-r--r-- | src/sslinfodialog.cpp | 9 | ||||
| -rw-r--r-- | src/sslinfodialog.h | 2 | ||||
| -rw-r--r-- | src/urlbar/listitem.cpp | 11 | ||||
| -rw-r--r-- | src/urlbar/listitem.h | 2 | ||||
| -rw-r--r-- | src/urlbar/sslwidget.cpp | 4 | ||||
| -rw-r--r-- | src/urlbar/sslwidget.h | 2 | ||||
| -rw-r--r-- | src/useragent/useragentinfo.cpp | 8 | ||||
| -rw-r--r-- | src/useragent/useragentinfo.h | 2 | ||||
| -rw-r--r-- | src/useragent/useragentmanager.cpp | 2 | ||||
| -rw-r--r-- | src/useragent/useragentmanager.h | 2 | ||||
| -rw-r--r-- | src/webpage.cpp | 40 | ||||
| -rw-r--r-- | src/webpage.h | 3 | ||||
| -rw-r--r-- | src/webview.cpp | 142 | 
26 files changed, 395 insertions, 252 deletions
| diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f82d28d..82cf6066 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,6 +23,7 @@ SET( rekonq_KDEINIT_SRCS      paneltreeview.cpp      previewselectorbar.cpp      protocolhandler.cpp +    rekonqmenu.cpp      sessionmanager.cpp      sslinfodialog.cpp      tabpreviewpopup.cpp diff --git a/src/application.cpp b/src/application.cpp index 18d19d9d..d8044e24 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -474,6 +474,10 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)          ? newMainWindow()          : mainWindow(); +    // be SURE window exists +    if (!w) +        w = newMainWindow(); +      switch (newType)      {      case Rekonq::NewTab: diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 6241394a..dd3cb119 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -141,13 +141,14 @@ void DownloadManager::downloadLinksWithKGet(const QVariant &contentList)  // In this way, we can easily provide the extra functionality we need:  // 1. KGet Integration  // 2. Save downloads history -bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &metaData, QWidget *parent, const QString &suggestedName) +bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &metaData, +                                       QWidget *parent, bool forceDirRequest, const QString &suggestedName)  {      KUrl destUrl;      const QString fileName((suggestedName.isEmpty() ? srcUrl.fileName() : suggestedName)); -    if (ReKonfig::askDownloadPath()) +    if (forceDirRequest || ReKonfig::askDownloadPath())      {          // follow bug:184202 fixes          destUrl = KFileDialog::getSaveFileName(KUrl::fromPath(fileName), QString(), parent); @@ -201,43 +202,3 @@ bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &      job->uiDelegate()->setAutoErrorHandlingEnabled(true);      return true;  } - - -// ------------------------------------------------------------------------------------------------------------------- - - -// STATIC -void DownloadManager::extractSuggestedFileName(const QNetworkReply* reply, QString& fileName) -{ -    fileName.clear(); -    const KIO::MetaData& metaData = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(); -    if (metaData.value(QL1S("content-disposition-type")).compare(QL1S("attachment"), Qt::CaseInsensitive) == 0) -        fileName = metaData.value(QL1S("content-disposition-filename")); - -    if (!fileName.isEmpty()) -        return; - -    if (!reply->hasRawHeader("Content-Disposition")) -        return; - -    const QString value(QL1S(reply->rawHeader("Content-Disposition").simplified().constData())); -    if (value.startsWith(QL1S("attachment"), Qt::CaseInsensitive) || value.startsWith(QL1S("inline"), Qt::CaseInsensitive)) -    { -        const int length = value.size(); -        int pos = value.indexOf(QL1S("filename"), 0, Qt::CaseInsensitive); -        if (pos > -1) -        { -            pos += 9; -            while (pos < length && (value.at(pos) == QL1C(' ') || value.at(pos) == QL1C('=') || value.at(pos) == QL1C('"'))) -                pos++; - -            int endPos = pos; -            while (endPos < length && value.at(endPos) != QL1C('"') && value.at(endPos) != QL1C(';')) -                endPos++; - -            if (endPos > pos) -                fileName = value.mid(pos, (endPos - pos)).trimmed(); -        } -    } -} - diff --git a/src/downloadmanager.h b/src/downloadmanager.h index 2eee1924..c3a91939 100644 --- a/src/downloadmanager.h +++ b/src/downloadmanager.h @@ -58,15 +58,14 @@ public:      {          return m_downloadList;      } +      bool clearDownloadsHistory();      bool downloadResource(const KUrl &url, const KIO::MetaData &metaData = KIO::MetaData(), -                          QWidget *parent = 0, const QString &suggestedName = QString()); +                          QWidget *parent = 0, bool forceDirRequest = false, const QString &suggestedName = QString());      void downloadLinksWithKGet(const QVariant &contentList); -    static void extractSuggestedFileName(const QNetworkReply* reply, QString& fileName); -  Q_SIGNALS:      void newDownloadAdded(QObject *item);      void notifyDownload(const QString&, Rekonq::Notify = Rekonq::Download); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb5eb0fe..c2fbafd7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -46,6 +46,7 @@  #include "historypanel.h"  #include "iconmanager.h"  #include "mainview.h" +#include "rekonqmenu.h"  #include "sessionmanager.h"  #include "settingsdialog.h"  #include "stackedurlbar.h" @@ -78,6 +79,7 @@  #include <KTemporaryFile>  #include <KToggleFullScreenAction>  #include <KXMLGUIFactory> +#include <kdeprintdialog.h>  #include <KParts/Part>  #include <KParts/BrowserExtension> @@ -93,7 +95,6 @@  #include <QtGui/QLabel>  #include <QtGui/QPrintDialog>  #include <QtGui/QPrinter> -#include <QtGui/QPrintPreviewDialog>  #include <QtGui/QVBoxLayout>  #include <QtWebKit/QWebHistory> @@ -555,7 +556,7 @@ void MainWindow::setupTools()      toolsAction->setDelayed(false);      toolsAction->setShortcutConfigurable(true);      toolsAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_T)); -    m_rekonqMenu = new KMenu(this); +    m_rekonqMenu = new RekonqMenu(this);      toolsAction->setMenu(m_rekonqMenu); // dummy menu to have the dropdown arrow      // adding rekonq_tools to rekonq actionCollection @@ -832,11 +833,16 @@ void MainWindow::printRequested(QWebFrame *frame)      }      QPrinter printer; -    QPrintPreviewDialog previewdlg(&printer, this); +    printer.setDocName(printFrame->title()); +    QPrintDialog *printDialog = KdePrint::createPrintDialog(&printer, this); -    connect(&previewdlg, SIGNAL(paintRequested(QPrinter*)), printFrame, SLOT(print(QPrinter*))); +    if (printDialog) //check if the Dialog was created +    { +        if (printDialog->exec()) +            printFrame->print(&printer); -    previewdlg.exec(); +        delete printDialog; +    }  } @@ -1526,6 +1532,9 @@ void MainWindow::setupBookmarksAndToolsShortcuts()      if (toolsButton)      {          connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu())); + +        // HACK: set button widget in rekonq menu +        m_rekonqMenu->setButtonWidget(toolsButton);      }  } diff --git a/src/mainwindow.h b/src/mainwindow.h index 0b1380da..789c0c1a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -45,6 +45,7 @@ class FindBar;  class HistoryPanel;  class MainView;  class NetworkAnalyzerPanel; +class RekonqMenu;  class WebInspectorPanel;  class WebTab;  class ZoomBar; @@ -215,7 +216,7 @@ private:      QLabel *m_popup;      QTimer *m_hidePopupTimer; -    KMenu *m_rekonqMenu; +    RekonqMenu *m_rekonqMenu;  };  #endif // MAINWINDOW_H diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 7392c920..f22f0d50 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -537,8 +537,6 @@ void NewTabPage::tabsPage()          for (int i = 0; i < tabCount; ++i)          {              KUrl url = w->mainView()->webTab(i)->url(); -            if (url.protocol() == QL1S("about")) -                continue;              if (!WebSnap::existsImage(url))              { diff --git a/src/rekonqmenu.cpp b/src/rekonqmenu.cpp new file mode 100644 index 00000000..26ea6119 --- /dev/null +++ b/src/rekonqmenu.cpp @@ -0,0 +1,96 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> +* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License or (at your option) version 3 or any later version +* accepted by the membership of KDE e.V. (or its successor approved +* by the membership of KDE e.V.), which shall act as a proxy +* defined in Section 14 of version 3 of the license. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program.  If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + +// Self Includes +#include "rekonqmenu.h" +#include "rekonqmenu.moc" + +// Qt Includes +#include <QApplication> +#include <QDesktopWidget> +#include <QWidget> + + +RekonqMenu::RekonqMenu(QWidget *parent) +    : KMenu(parent) +{ +} + + +void RekonqMenu::setButtonWidget(QWidget *w) +{ +    m_button = w; +} + + +void RekonqMenu::showEvent(QShowEvent* event) +{ +    KMenu::showEvent(event); + +    // Adjust the position of the menu to be shown within the +    // rekonq window to reduce the cases that sub-menus might overlap +    // the right screen border. +    QPoint pos; +    if (layoutDirection() == Qt::RightToLeft) +    { +        pos = m_button->mapToGlobal(QPoint(0, m_button->height())); +    } +    else +    { +        pos = m_button->mapToGlobal(QPoint(m_button->width(), m_button->height())); +        pos.rx() -= width(); +    } + +    // Assure that the menu is not shown outside the screen boundaries and +    // that it does not overlap with the parent button. +    const QRect screen = QApplication::desktop()->screenGeometry(QCursor::pos()); +    if (pos.x() < screen.x()) +    { +        pos.rx() = screen.x(); +    } +    else +    { +        if (pos.x() + width() > screen.x() + screen.width()) +        { +            pos.rx() = screen.x() + screen.width() - width(); +        } +    } + +    if (pos.y() < screen.y()) +    { +        pos.ry() = screen.y(); +    } +    else +    { +        if (pos.y() + height() > screen.y() + screen.height()) +        { +            pos.ry() = m_button->mapToGlobal(QPoint(0, 0)).y() + height(); +        } +    } + +    move(pos); +} diff --git a/src/rekonqmenu.h b/src/rekonqmenu.h new file mode 100644 index 00000000..e3d659f7 --- /dev/null +++ b/src/rekonqmenu.h @@ -0,0 +1,61 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> +* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com> +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License or (at your option) version 3 or any later version +* accepted by the membership of KDE e.V. (or its successor approved +* by the membership of KDE e.V.), which shall act as a proxy +* defined in Section 14 of version 3 of the license. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program.  If not, see <http://www.gnu.org/licenses/>. +* +* ============================================================ */ + + + +#ifndef REKONQ_MENU_H +#define REKONQ_MENU_H + + +// Rekonq Includes +#include "rekonq_defines.h" + +// KDE Includes +#include <KMenu> + + +/** + * Menu shown inside rekonq window. + * Inspired by Dolphin solution. + * + */ +class REKONQ_TESTS_EXPORT RekonqMenu : public KMenu +{ +    Q_OBJECT + +public: +    RekonqMenu(QWidget *parent); + +    void setButtonWidget(QWidget *); + +protected: +    virtual void showEvent(QShowEvent* event); + +private: +    QWidget *m_button; +}; + +#endif // REKONQ_MENU_H diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp index 0557fcb4..b0ef1fce 100644 --- a/src/sessionmanager.cpp +++ b/src/sessionmanager.cpp @@ -43,6 +43,7 @@  // Qt Includes  #include <QtCore/QFile> +  // Only used internally  bool readSessionDocument(QDomDocument & document, const QString & sessionFilePath)  { @@ -66,6 +67,41 @@ bool readSessionDocument(QDomDocument & document, const QString & sessionFilePat      return true;  } + +int loadViewTabs(MainView *mv, QDomElement & window, bool checkViewExists) +{ +    int currentTab = 0; + +    for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++) +    { +        QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); +        if (tab.hasAttribute("currentTab")) +            currentTab = tabNo; + +        WebView * view = 0; +        if (tabNo == 0 && checkViewExists) +            view = mv->webTab(0)->view(); +        else +            view = mv->newWebTab()->view(); + +        QDomCDATASection historySection = tab.firstChild().toCDATASection(); +        QByteArray history = QByteArray::fromBase64(historySection.data().toAscii()); + +        QDataStream readingStream(&history, QIODevice::ReadOnly); +        readingStream >> *(view->history()); + +        // Get sure about urls and/or pdf are loaded +        KUrl u = KUrl(tab.attribute("url")); +        view->load(u); +    } + +    return currentTab; +} + + +// --------------------------------------------------------------------- + +  SessionManager::SessionManager(QObject *parent)      : QObject(parent)      , m_safe(true) @@ -105,10 +141,7 @@ void SessionManager::saveSession()          for (signed int tabNo = 0; tabNo < mv->count(); tabNo++)          { -            // IGNORE about urls              KUrl u = mv->webTab(tabNo)->url(); -            if (u.protocol() == QL1S("about")) -                continue;              tabInserted++;              QDomElement tab = document.createElement("tab"); @@ -150,32 +183,10 @@ bool SessionManager::restoreSessionFromScratch()      for (unsigned int winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)      {          QDomElement window = document.elementsByTagName("window").at(winNo).toElement(); -        int currentTab = 0;          MainView *mv = rApp->newMainWindow(false)->mainView(); -        for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++) -        { -            QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); -            if (tab.hasAttribute("currentTab")) -                currentTab = tabNo; - -            WebView *view = mv->newWebTab()->view(); - -            QDomCDATASection historySection = tab.firstChild().toCDATASection(); -            QByteArray history = QByteArray::fromBase64(historySection.data().toAscii()); - -            QDataStream readingStream(&history, QIODevice::ReadOnly); -            readingStream >> *(view->history()); - -            // IGNORE "eventual" about urls -            KUrl u = KUrl(tab.attribute("url")); -            if (u.protocol() == QL1S("about")) -                continue; - -            // This is needed for particular URLs, eg pdfs -            view->load(u); -        } +        int currentTab = loadViewTabs(mv, window, false);          mv->tabBar()->setCurrentIndex(currentTab);      } @@ -194,28 +205,11 @@ void SessionManager::restoreCrashedSession()      for (unsigned int winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)      {          QDomElement window = document.elementsByTagName("window").at(winNo).toElement(); -        int currentTab = 0;          MainView *mv = (winNo == 0) ? rApp->mainWindow()->mainView() : rApp->newMainWindow()->mainView(); -        for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++) -        { -            QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); -            if (tab.hasAttribute("currentTab")) -                currentTab = tabNo; - -            WebView *view = (tabNo == 0) ? mv->webTab(0)->view() : mv->newWebTab()->view(); - -            QDomCDATASection historySection = tab.firstChild().toCDATASection(); -            QByteArray history = QByteArray::fromBase64(historySection.data().toAscii()); +        int currentTab = loadViewTabs(mv, window, true); -            QDataStream readingStream(&history, QIODevice::ReadOnly); -            readingStream >> *(view->history()); - -            // Get sure about urls and/or pdf are loaded -            KUrl u = KUrl(tab.attribute("url")); -            view->load(u); -        }          mv->tabBar()->setCurrentIndex(currentTab);      } @@ -235,34 +229,18 @@ int SessionManager::restoreSavedSession()      for (winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)      {          QDomElement window = document.elementsByTagName("window").at(winNo).toElement(); -        int currentTab = 0;          MainView *mv = rApp->newMainWindow()->mainView(); -        for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++) -        { -            QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement(); -            if (tab.hasAttribute("currentTab")) -                currentTab = tabNo; - -            WebView *view = (tabNo == 0) ? mv->webTab(0)->view() : mv->newWebTab()->view(); - -            QDomCDATASection historySection = tab.firstChild().toCDATASection(); -            QByteArray history = QByteArray::fromBase64(historySection.data().toAscii()); +        int currentTab = loadViewTabs(mv, window, true); -            QDataStream readingStream(&history, QIODevice::ReadOnly); -            readingStream >> *(view->history()); - -            // Get sure about urls and/or pdfs are loaded -            KUrl u = KUrl(tab.attribute("url")); -            view->load(u); -        }          mv->tabBar()->setCurrentIndex(currentTab);      }      return winNo;  } +  bool SessionManager::restoreMainWindow(MainWindow* window)  {      QDomDocument document("session"); @@ -275,32 +253,13 @@ bool SessionManager::restoreMainWindow(MainWindow* window)      for (winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)      {          QDomElement savedWindowElement = document.elementsByTagName("window").at(winNo).toElement(); -        int currentTab = 0;          if (window->objectName() != savedWindowElement.attribute("name", ""))              continue;          MainView *mv = window->mainView(); -        for (unsigned int tabNo = 0; tabNo < savedWindowElement.elementsByTagName("tab").length(); tabNo++) -        { -            QDomElement tab = savedWindowElement.elementsByTagName("tab").at(tabNo).toElement(); -            if (tab.hasAttribute("currentTab")) -                currentTab = tabNo; - -            WebView *view = mv->newWebTab()->view(); - -            QDomCDATASection historySection = tab.firstChild().toCDATASection(); -            QByteArray history = QByteArray::fromBase64(historySection.data().toAscii()); - -            QDataStream readingStream(&history, QIODevice::ReadOnly); -            readingStream >> *(view->history()); - -            // Get sure about urls are loaded -            KUrl u = KUrl(tab.attribute("url")); -            if (u.protocol() == QL1S("about")) -                view->load(u); -        } +        int currentTab = loadViewTabs(mv, savedWindowElement, false);          mv->tabBar()->setCurrentIndex(currentTab); @@ -310,6 +269,7 @@ bool SessionManager::restoreMainWindow(MainWindow* window)      return false;  } +  QList<TabHistory> SessionManager::closedSites()  {      QList<TabHistory> list; diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 061430d3..ef01a32f 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>  * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>  *  * @@ -133,7 +133,7 @@ Private::Private(SettingsDialog *parent)      // WARNING      // remember wheh changing here that the smallest netbooks      // have a 1024x576 resolution. So DON'T bother that limits!! -    parent->setMinimumSize(700, 525); +    parent->setMinimumSize(700, 576);  } diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h index 98089990..40a2aeff 100644 --- a/src/settings/settingsdialog.h +++ b/src/settings/settingsdialog.h @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>  * Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>  *  * diff --git a/src/sslinfo.ui b/src/sslinfo.ui index 3ed117a8..c1c67b47 100644 --- a/src/sslinfo.ui +++ b/src/sslinfo.ui @@ -6,8 +6,8 @@     <rect>      <x>0</x>      <y>0</y> -    <width>427</width> -    <height>481</height> +    <width>539</width> +    <height>459</height>     </rect>    </property>    <layout class="QVBoxLayout" name="verticalLayout_2"> @@ -108,6 +108,18 @@         <layout class="QGridLayout" name="gridLayout">          <item row="0" column="0">           <widget class="QLabel" name="label_6"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>160</width> +            <height>0</height> +           </size> +          </property>            <property name="text">             <string>Common Name (CN):</string>            </property> @@ -188,6 +200,18 @@         <layout class="QGridLayout" name="gridLayout_2">          <item row="0" column="0">           <widget class="QLabel" name="label_10"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>160</width> +            <height>0</height> +           </size> +          </property>            <property name="text">             <string>Common Name (CN):</string>            </property> @@ -254,6 +278,18 @@         <layout class="QGridLayout" name="gridLayout_3">          <item row="0" column="0">           <widget class="QLabel" name="label_14"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>160</width> +            <height>0</height> +           </size> +          </property>            <property name="text">             <string>Issued on:</string>            </property> @@ -306,6 +342,18 @@         <layout class="QGridLayout" name="gridLayout_5">          <item row="0" column="0">           <widget class="QLabel" name="label_36"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>160</width> +            <height>0</height> +           </size> +          </property>            <property name="text">             <string>Md5:</string>            </property> diff --git a/src/sslinfodialog.cpp b/src/sslinfodialog.cpp index 892bae27..234dbb82 100644 --- a/src/sslinfodialog.cpp +++ b/src/sslinfodialog.cpp @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or @@ -66,7 +66,12 @@ SslInfoDialog::SslInfoDialog(const QString &host, const WebSslInfo &info, QWidge      Q_FOREACH(const QSslCertificate & cert, caList)      { -        ui.comboBox->addItem(cert.subjectInfo(QSslCertificate::CommonName)); +        QString name = cert.subjectInfo(QSslCertificate::CommonName); +        if (name.isEmpty()) +            name = cert.subjectInfo(QSslCertificate::Organization); +        if (name.isEmpty()) +            name = cert.serialNumber(); +        ui.comboBox->addItem(name);      }      connect(ui.comboBox, SIGNAL(activated(int)), this, SLOT(displayFromChain(int))); diff --git a/src/sslinfodialog.h b/src/sslinfodialog.h index b40ce4f0..0c7f97ce 100644 --- a/src/sslinfodialog.h +++ b/src/sslinfodialog.h @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index d285e395..d3e95ef3 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or @@ -309,7 +309,7 @@ DescriptionLabel::DescriptionLabel(const QString &text, QWidget *parent)      if (wasItalic)          t = QL1S("<i>") + t + QL1S("</i>"); -    setWordWrap(false); //TODO: why setWordWrap(true) make items have a strange behavior ? +    setWordWrap(false); //NOTE: why setWordWrap(true) make items have a strange behavior ?      setText(t);      setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);  } @@ -451,8 +451,11 @@ QString SearchListItem::text()  void SearchListItem::changeSearchEngine(KService::Ptr engine)  { -    UrlResolver::setSearchEngine(engine); -    emit updateList(); +    // NOTE: This to let rekonq loading text typed in the requested engine on click. +    // There probably is a better way to do it. I just cannot see it now... +    UrlSearchItem item = UrlSearchItem(UrlSearchItem::Search, SearchEngine::buildQuery(engine, m_text), m_text); +    SearchListItem sItem(item, m_text, this); +    emit itemClicked(&sItem, Qt::LeftButton, Qt::NoModifier);  } diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index 1768438a..c2f79c93 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or diff --git a/src/urlbar/sslwidget.cpp b/src/urlbar/sslwidget.cpp index 4dd5a4bf..127dae86 100644 --- a/src/urlbar/sslwidget.cpp +++ b/src/urlbar/sslwidget.cpp @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or @@ -112,7 +112,7 @@ SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)          label = new QLabel(this);          label->setWordWrap(true); -        label->setText(QL1S("\"<a href=\"moresslinfos\">") + i18n("Certificate Information") + QL1S("</a>")); +        label->setText(QL1S("<a href=\"moresslinfos\">") + i18n("Certificate Information") + QL1S("</a>"));          connect(label, SIGNAL(linkActivated(QString)), this, SLOT(showMoreSslInfos(QString)));          layout->addWidget(label, rows++, 1);      } diff --git a/src/urlbar/sslwidget.h b/src/urlbar/sslwidget.h index 94f0494a..bc1e2291 100644 --- a/src/urlbar/sslwidget.h +++ b/src/urlbar/sslwidget.h @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or diff --git a/src/useragent/useragentinfo.cpp b/src/useragent/useragentinfo.cpp index 6ac411ba..00f0a9db 100644 --- a/src/useragent/useragentinfo.cpp +++ b/src/useragent/useragentinfo.cpp @@ -3,7 +3,7 @@  * This file is a part of the rekonq project  *  * Copyright (c) 2001 by Dawit Alemayehu <adawit@kde.org> -* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or @@ -127,12 +127,11 @@ QString UserAgentInfo::userAgentDescription(int i)      QString systemName = m_providers.at(i)->property("X-KDE-UA-SYSNAME").toString();      QString systemRelease = m_providers.at(i)->property("X-KDE-UA-SYSRELEASE").toString(); -    QString systemSummary = QL1S(""); +    QString systemSummary;      if (!systemName.isEmpty() && !systemRelease.isEmpty())      { -        // FIXME: needs a proper translation after stable release -        systemSummary = QL1C(' ') % QL1S("on") % QL1C(' ') % systemName % QL1C(' ') % systemRelease; +        systemSummary = i18nc("describe UA platform, eg: firefox 3.1 \"on Windows XP\"", " on %1 %2", systemName, systemRelease);      }      return userAgentName(i) % QL1C(' ') % userAgentVersion(i) % systemSummary; @@ -197,7 +196,6 @@ bool UserAgentInfo::providerExists(int i)      KService::Ptr s = m_providers.at(i);      if (s.isNull())      { -        //FIXME Add me when string freeze has been reopened: KMessageBox::error(...)          return false;      }      return true; diff --git a/src/useragent/useragentinfo.h b/src/useragent/useragentinfo.h index 86319d9e..3162fa82 100644 --- a/src/useragent/useragentinfo.h +++ b/src/useragent/useragentinfo.h @@ -3,7 +3,7 @@  * This file is a part of the rekonq project  *  * Copyright (c) 2001 by Dawit Alemayehu <adawit@kde.org> -* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or diff --git a/src/useragent/useragentmanager.cpp b/src/useragent/useragentmanager.cpp index 20043549..37bc496a 100644 --- a/src/useragent/useragentmanager.cpp +++ b/src/useragent/useragentmanager.cpp @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or diff --git a/src/useragent/useragentmanager.h b/src/useragent/useragentmanager.h index 0592e55c..84042cf6 100644 --- a/src/useragent/useragentmanager.h +++ b/src/useragent/useragentmanager.h @@ -2,7 +2,7 @@  *  * This file is a part of the rekonq project  * -* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com> +* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>  *  *  * This program is free software; you can redistribute it and/or diff --git a/src/webpage.cpp b/src/webpage.cpp index 89c52e8a..6a6f1bc9 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -289,6 +289,10 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)      if (KParts::BrowserRun::isTextExecutable(_mimeType))          _mimeType = QL1S("text/plain"); +    // Get suggested file name... +    const KIO::MetaData& data = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(); +    _suggestedFileName = data.value(QL1S("content-disposition-filename")); +      kDebug() << "Detected MimeType = " << _mimeType;      kDebug() << "Suggested File Name = " << _suggestedFileName;      // ------------------------------------------------ @@ -302,7 +306,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)      {          isLocal          ? KMessageBox::sorry(view(), i18n("No service can handle this file.")) -        : downloadReply(reply, _suggestedFileName); +        : downloadUrl(reply->url());          return;      } @@ -316,15 +320,20 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)      {          KParts::BrowserOpenOrSaveQuestion dlg(rApp->mainWindow(), replyUrl, _mimeType); -        // Get suggested file name... -        DownloadManager::extractSuggestedFileName(reply, _suggestedFileName);          if (!_suggestedFileName.isEmpty())              dlg.setSuggestedFileName(_suggestedFileName); +        // read askEmbedOrSave preferences. If we don't have to show dialog and rekonq settings are +        // to automatically choose download dir, we won't show local dir choose dialog +        KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals), QL1S("Notification Messages")); +        bool hideDialog = cg.readEntry(QL1S("askEmbedOrSave") + _mimeType, false); + +        kDebug() << "Hide dialog for " << _mimeType << "? " << hideDialog; +          switch (dlg.askEmbedOrSave())          {          case KParts::BrowserOpenOrSaveQuestion::Save: -            downloadReply(reply, _suggestedFileName); +            rApp->downloadManager()->downloadResource(reply->url(), KIO::MetaData(), view(), !hideDialog, _suggestedFileName);              return;          case KParts::BrowserOpenOrSaveQuestion::Cancel: @@ -418,10 +427,6 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)  {      Q_ASSERT(reply); -    // check suggested file name -    if (_suggestedFileName.isEmpty()) -        DownloadManager::extractSuggestedFileName(reply, _suggestedFileName); -      QWebFrame* frame = qobject_cast<QWebFrame *>(reply->request().originatingObject());      const bool isMainFrameRequest = (frame == mainFrame());      const bool isLoadingUrlReply = (mainFrame()->url() == reply->url()); @@ -454,14 +459,11 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)          // ignore this..          return; -    case QNetworkReply::ContentAccessDenied:                 // access to remote content denied (similar to HTTP error 401) +        // WARNING: This is also typical adblocked element error: IGNORE THIS! +    case QNetworkReply::ContentAccessDenied:                 // access to remote content denied          break;      case QNetworkReply::UnknownNetworkError:                 // unknown network-related error detected -        // FIXME: DO WE REALLY NEED THIS??? -        _protHandler.postHandling(reply->request(), frame); -        return; -      case QNetworkReply::ConnectionRefusedError:              // remote server refused connection      case QNetworkReply::HostNotFoundError:                   // invalid hostname      case QNetworkReply::TimeoutError:                        // connection time out @@ -470,7 +472,7 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)      case QNetworkReply::ContentNotFoundError:                // remote content not found on server (similar to HTTP error 404)      case QNetworkReply::ProtocolUnknownError:                // Unknown protocol      case QNetworkReply::ProtocolInvalidOperationError:       // requested operation is invalid for this protocol - +    default:          kDebug() << "ERROR " << reply->error() << ": " << reply->errorString();          if (reply->url() == _loadingUrl)          { @@ -489,10 +491,6 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)          }          break; -    default: -        // Nothing to do here.. -        break; -      }  } @@ -553,12 +551,6 @@ QString WebPage::errorPage(QNetworkReply *reply)  } -void WebPage::downloadReply(const QNetworkReply *reply, const QString &suggestedFileName) -{ -    rApp->downloadManager()->downloadResource(reply->url(), KIO::MetaData(), view(), suggestedFileName); -} - -  void WebPage::downloadRequest(const QNetworkRequest &request)  {      rApp->downloadManager()->downloadResource(request.url(), diff --git a/src/webpage.h b/src/webpage.h index 7e5df309..3b2d37ad 100644 --- a/src/webpage.h +++ b/src/webpage.h @@ -107,9 +107,6 @@ private Q_SLOTS:      void copyToTempFileResult(KJob*);  private: -    void downloadReply(const QNetworkReply *reply, const QString &suggestedFileName = QString()); - -private:      QString errorPage(QNetworkReply *reply);      KUrl _loadingUrl; diff --git a/src/webview.cpp b/src/webview.cpp index 1c2a4028..f2328be5 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -665,74 +665,76 @@ void WebView::keyPressEvent(QKeyEvent *event)          }      } -    bool isContentEditable = page()->mainFrame()->evaluateJavaScript("document.activeElement.isContentEditable").toBool(); -      // Auto Scrolling      if (event->modifiers() == Qt::ShiftModifier              && tagName != QL1S("INPUT")              && tagName != QL1S("TEXTAREA") -            && !isContentEditable         )      { -        kDebug() << "AutoScrolling: " << event->key(); +        // NOTE: I'm doing this check here to prevent this to be done EVERYTIME +        // we'll do it just when SHIFT has been pressed in an element NOT usually editable +        bool isContentEditable = page()->mainFrame()->hitTestContent(QCursor::pos()).isContentEditable(); -        if (event->key() == Qt::Key_Up) +        if (!isContentEditable)          { -            m_verticalAutoScrollSpeed--; -            if (!m_autoScrollTimer->isActive()) -                m_autoScrollTimer->start(); +            if (event->key() == Qt::Key_Up) +            { +                m_verticalAutoScrollSpeed--; +                if (!m_autoScrollTimer->isActive()) +                    m_autoScrollTimer->start(); -            event->accept(); -            return; -        } +                event->accept(); +                return; +            } -        if (event->key() == Qt::Key_Down) -        { -            m_verticalAutoScrollSpeed++; -            if (!m_autoScrollTimer->isActive()) -                m_autoScrollTimer->start(); +            if (event->key() == Qt::Key_Down) +            { +                m_verticalAutoScrollSpeed++; +                if (!m_autoScrollTimer->isActive()) +                    m_autoScrollTimer->start(); -            event->accept(); -            return; -        } +                event->accept(); +                return; +            } -        if (event->key() == Qt::Key_Right) -        { -            m_horizontalAutoScrollSpeed++; -            if (!m_autoScrollTimer->isActive()) -                m_autoScrollTimer->start(); +            if (event->key() == Qt::Key_Right) +            { +                m_horizontalAutoScrollSpeed++; +                if (!m_autoScrollTimer->isActive()) +                    m_autoScrollTimer->start(); -            event->accept(); -            return; -        } +                event->accept(); +                return; +            } -        if (event->key() == Qt::Key_Left) -        { -            m_horizontalAutoScrollSpeed--; -            if (!m_autoScrollTimer->isActive()) -                m_autoScrollTimer->start(); +            if (event->key() == Qt::Key_Left) +            { +                m_horizontalAutoScrollSpeed--; +                if (!m_autoScrollTimer->isActive()) +                    m_autoScrollTimer->start(); -            event->accept(); -            return; -        } +                event->accept(); +                return; +            } -        if (m_autoScrollTimer->isActive()) -        { -            m_autoScrollTimer->stop(); -            event->accept(); -            return; -        } -        else -        { -            if (m_verticalAutoScrollSpeed || m_horizontalAutoScrollSpeed) +            if (m_autoScrollTimer->isActive())              { -                m_autoScrollTimer->start(); +                m_autoScrollTimer->stop();                  event->accept();                  return;              } +            else +            { +                if (m_verticalAutoScrollSpeed || m_horizontalAutoScrollSpeed) +                { +                    m_autoScrollTimer->start(); +                    event->accept(); +                    return; +                } +            }          } -        // if you arrived here, it means SHIFT has been pressed NOT for autoscroll management... +        // if you arrived here, I hope it means SHIFT has been pressed NOT for autoscroll management...      }      if (ReKonfig::accessKeysEnabled() && m_accessKeysActive) @@ -745,28 +747,36 @@ void WebView::keyPressEvent(QKeyEvent *event)      // vi-like navigation      if (ReKonfig::enableViShortcuts())      { -        if (tagName != QL1S("INPUT") && tagName != QL1S("TEXTAREA") && !isContentEditable && event->modifiers() == Qt::NoModifier) +        if (event->modifiers() == Qt::NoModifier +                && tagName != QL1S("INPUT") +                && tagName != QL1S("TEXTAREA") +           )          { -            switch (event->key()) +            bool isContentEditable = page()->mainFrame()->hitTestContent(QCursor::pos()).isContentEditable(); + +            if (!isContentEditable)              { -            case Qt::Key_J: -                event->accept(); -                event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier); -                break; -            case Qt::Key_K: -                event->accept(); -                event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); -                break; -            case Qt::Key_L: -                event->accept(); -                event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier); -                break; -            case Qt::Key_H: -                event->accept(); -                event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier); -                break; -            default: -                break; +                switch (event->key()) +                { +                case Qt::Key_J: +                    event->accept(); +                    event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier); +                    break; +                case Qt::Key_K: +                    event->accept(); +                    event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier); +                    break; +                case Qt::Key_L: +                    event->accept(); +                    event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier); +                    break; +                case Qt::Key_H: +                    event->accept(); +                    event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier); +                    break; +                default: +                    break; +                }              }          }      } | 
