From e3cdb49f2aa6b84f60deabbd20945e02a48193c7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 1 Jul 2011 10:56:10 +0200 Subject: Move to KMessageWidget Port rekonq notification bars to KMessageWidget: walletbar, crash notification bar, set favorite preview bar. Remove old no more used notification bar. --- src/CMakeLists.txt | 1 - src/application.cpp | 8 ++-- src/messagebar.cpp | 113 +++++++++++---------------------------------- src/messagebar.h | 43 ++++------------- src/notificationbar.cpp | 63 ------------------------- src/notificationbar.h | 98 --------------------------------------- src/previewselectorbar.cpp | 71 +++++++++++++--------------- src/previewselectorbar.h | 16 +++---- src/walletbar.cpp | 62 +++++++++++-------------- src/walletbar.h | 21 ++++----- src/webtab.cpp | 24 ++++------ src/webtab.h | 1 - 12 files changed, 125 insertions(+), 396 deletions(-) delete mode 100644 src/notificationbar.cpp delete mode 100644 src/notificationbar.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index db9506aa..f623adfd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -19,7 +19,6 @@ SET( rekonq_KDEINIT_SRCS messagebar.cpp networkaccessmanager.cpp newtabpage.cpp - notificationbar.cpp paneltreeview.cpp previewselectorbar.cpp protocolhandler.cpp diff --git a/src/application.cpp b/src/application.cpp index c00f3f96..a61c1ce3 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -165,12 +165,10 @@ int Application::newInstance() loadUrl(KUrl("about:closedTabs"), Rekonq::NewWindow); MessageBar *msgBar = new MessageBar(i18n("It seems rekonq was not closed properly. Do you want " "to restore the last saved session?") - , mainWindow()->currentTab() - , QMessageBox::Warning - , MessageBar::Yes | MessageBar::No); - + , mainWindow()->currentTab()); + connect(msgBar, SIGNAL(accepted()), sessionManager(), SLOT(restoreSession())); - mainWindow()->currentTab()->insertBar(msgBar); + msgBar->animatedShow(); } if (areThereArguments) diff --git a/src/messagebar.cpp b/src/messagebar.cpp index b5959d59..2fc09f09 100644 --- a/src/messagebar.cpp +++ b/src/messagebar.cpp @@ -3,6 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010-2011 by Pierre Rossi +* Copyright (C) 2011 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or @@ -34,97 +35,39 @@ #include // Qt Includes -#include -#include -#include -#include +#include -MessageBar::MessageBar(const QString &message, QWidget *parent, QMessageBox::Icon icon, StandardButtons buttons) - : NotificationBar(parent) - , m_icon(0) - , m_text(0) +MessageBar::MessageBar(const QString &message, QWidget *parent) + : KMessageWidget(parent) { - QToolButton *closeButton = new QToolButton(this); - closeButton->setAutoRaise(true); - closeButton->setIcon(KIcon("dialog-close")); - connect(closeButton, SIGNAL(clicked()), this, SLOT(destroy())); + connect(this, SIGNAL(accepted()), this, SLOT(hideAndDelete())); + connect(this, SIGNAL(rejected()), this, SLOT(hideAndDelete())); + + setMessageType(KMessageWidget::Error); + + QSize sz = size(); + sz.setWidth( qobject_cast(parent)->size().width() ); + resize(sz); + + setCloseButtonVisible(false); + + setText( message ); - m_text = new QLabel(message, this); - m_text->setWordWrap(true); - - m_icon = new QLabel; - QString icon_name; - switch (icon) - { - case QMessageBox::NoIcon: - break; - case QMessageBox::Information: - icon_name = "dialog-information"; - break; - case QMessageBox::Warning: - icon_name = "dialog-warning"; - break; - case QMessageBox::Critical: - icon_name = "dialog-error"; - break; - default: - break; - } - if (!icon_name.isEmpty()) - m_icon->setPixmap(KIcon(icon_name).pixmap(int(KIconLoader::SizeSmallMedium))); - - QPushButton *button; - if (buttons & Ok) - { - button = new QPushButton(KIcon("dialog-ok"), i18n("Ok")); - connect(button, SIGNAL(clicked()), this, SIGNAL(accepted())); - connect(button, SIGNAL(clicked()), this, SLOT(destroy())); - m_buttons.append(button); - } - if (buttons & Cancel) - { - button = new QPushButton(KIcon("dialog-cancel"), i18n("Cancel")); - connect(button, SIGNAL(clicked()), this, SIGNAL(rejected())); - connect(button, SIGNAL(clicked()), this, SLOT(destroy())); - m_buttons.append(button); - } - if (buttons & Yes) - { - button = new QPushButton(i18n("Yes")); - connect(button, SIGNAL(clicked()), this, SIGNAL(accepted())); - connect(button, SIGNAL(clicked()), this, SLOT(destroy())); - m_buttons.append(button); - } - if (buttons & No) - { - button = new QPushButton(i18n("No")); - connect(button, SIGNAL(clicked()), this, SIGNAL(rejected())); - connect(button, SIGNAL(clicked()), this, SLOT(destroy())); - m_buttons.append(button); - } - if (buttons & Continue) - { - button = new QPushButton(i18n("Continue")); - connect(button, SIGNAL(clicked()), this, SIGNAL(accepted())); - connect(button, SIGNAL(clicked()), this, SLOT(destroy())); - m_buttons.append(button); - } - - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(2, 0, 2, 0); - layout->addWidget(closeButton); - layout->addWidget(m_icon); - layout->addWidget(m_text); - foreach(QPushButton *button, m_buttons) - layout->addWidget(button, 2); - layout->setStretch(2, 20); - - setLayout(layout); + QAction *acceptAction = new QAction( i18n("Yes"), this ); + connect(acceptAction, SIGNAL(triggered(bool)), this, SIGNAL(accepted())); + addAction(acceptAction); + QAction *rejectAction = new QAction( i18n("No"), this ); + connect(rejectAction, SIGNAL(triggered(bool)), this, SIGNAL(rejected())); + addAction(rejectAction); } -MessageBar::~MessageBar() + +void MessageBar::hideAndDelete() { - qDeleteAll(m_buttons); + animatedHide(); + deleteLater(); } + + \ No newline at end of file diff --git a/src/messagebar.h b/src/messagebar.h index 65313662..6125bfa1 100644 --- a/src/messagebar.h +++ b/src/messagebar.h @@ -3,6 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2010-2011 by Pierre Rossi +* Copyright (C) 2011 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or @@ -23,57 +24,31 @@ * * ============================================================ */ + #ifndef MESSAGEBAR_H #define MESSAGEBAR_H // Rekonq Includes #include "rekonq_defines.h" -#include "notificationbar.h" - -// Qt Includes -#include -// Forward Declarations -class QLabel; -class QPushButton; +// KDE Includes +#include -class REKONQ_TESTS_EXPORT MessageBar : public NotificationBar +class REKONQ_TESTS_EXPORT MessageBar : public KMessageWidget { Q_OBJECT - Q_FLAGS(StandardButtons) - public: + explicit MessageBar(const QString & message, QWidget *parent); - enum StandardButton - { - NoButton = 0x00000000, - Ok = 0x00000001, - Cancel = 0x00000002, - Yes = 0x00000004, - No = 0x00000008, - Continue = 0x00000010 - }; - - Q_DECLARE_FLAGS(StandardButtons, StandardButton) - - explicit MessageBar(const QString & message, QWidget *parent - , QMessageBox::Icon icon = QMessageBox::NoIcon - , StandardButtons buttons = NoButton); - ~MessageBar(); - +private Q_SLOTS: + void hideAndDelete(); + Q_SIGNALS: void accepted(); void rejected(); - -private: - QLabel *m_icon; - QLabel *m_text; - QList m_buttons; - }; -Q_DECLARE_OPERATORS_FOR_FLAGS(MessageBar::StandardButtons) #endif // MESSAGEBAR_H diff --git a/src/notificationbar.cpp b/src/notificationbar.cpp deleted file mode 100644 index e7ee77d4..00000000 --- a/src/notificationbar.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Pierre Rossi -* -* -* 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 . -* -* ============================================================ */ - - -// Self includes -#include "notificationbar.h" -#include "notificationbar.moc" - -// Qt Includes - -#include -#include - - -NotificationBar::NotificationBar(QWidget *parent) - : QWidget(parent) - , m_blinkEffect(new BlinkEffect(this)) - , m_opacityAnimation(new QPropertyAnimation(m_blinkEffect, "opacity", this)) -{ - m_blinkEffect->setOpacity(0); - setGraphicsEffect(m_blinkEffect); -} - - -void NotificationBar::notifyUser(int animationDuration) -{ - m_opacityAnimation->setDuration(animationDuration); - m_opacityAnimation->setStartValue(0.9); - m_opacityAnimation->setEndValue(0.0); - m_opacityAnimation->start(); - -} - - -void NotificationBar::destroy() -{ - qDebug() << Q_FUNC_INFO << "deleting the bar" << this; - if (parentWidget() && parentWidget()->layout()) - parentWidget()->layout()->removeWidget(this); - deleteLater(); -} diff --git a/src/notificationbar.h b/src/notificationbar.h deleted file mode 100644 index 49fc8e8d..00000000 --- a/src/notificationbar.h +++ /dev/null @@ -1,98 +0,0 @@ -/* ============================================================ -* -* This file is a part of the rekonq project -* -* Copyright (C) 2010-2011 by Pierre Rossi -* -* -* 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 . -* -* ============================================================ */ - - -#ifndef NOTIFICATIONBAR_H -#define NOTIFICATIONBAR_H - -// Qt Includes -#include -#include -#include -#include -#include -#include - -// Forward Declarations -class QPropertyAnimation; - - -class BlinkEffect : public QGraphicsEffect -{ - Q_OBJECT - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) - -public: - BlinkEffect(QObject *parent = 0) - : QGraphicsEffect(parent) - , m_opacity(0) - , m_backgroundColor(QApplication::palette().highlight().color().lighter()) - {} - - qreal opacity() const - { - return m_opacity; - } - void setOpacity(qreal opacity) - { - m_opacity = opacity; - update(); - } - -protected: - void draw(QPainter *painter) - { - painter->drawPixmap(QPoint(0, 0), sourcePixmap()); - painter->setOpacity(m_opacity); - painter->fillRect(boundingRect(), m_backgroundColor); - } - -private: - double m_opacity; - QColor m_backgroundColor; - -}; - - -// ------------------------------------------------------------------------------------------ - - -class NotificationBar : public QWidget -{ - Q_OBJECT -public: - explicit NotificationBar(QWidget *parent = 0); - - void notifyUser(int animationDuration = 400); - -private: - BlinkEffect *m_blinkEffect; - QPropertyAnimation *m_opacityAnimation; -protected slots: - void destroy(); - -}; - -#endif // NOTIFICATIONBAR_H diff --git a/src/previewselectorbar.cpp b/src/previewselectorbar.cpp index 16f4a9c1..344a3dc9 100644 --- a/src/previewselectorbar.cpp +++ b/src/previewselectorbar.cpp @@ -29,8 +29,10 @@ #include "previewselectorbar.h" #include "previewselectorbar.moc" -// Self Includes +// Auto Includes #include "rekonq.h" + +// Self Includes #include "websnap.h" // Local Include @@ -44,40 +46,27 @@ #include // Qt Includes -#include -#include -#include -#include - +#include PreviewSelectorBar::PreviewSelectorBar(int index, QWidget* parent) - : NotificationBar(parent) - , m_button(0) - , m_label(0) - , m_previewIndex(index) + : KMessageWidget(parent) + , m_previewIndex(index) + , m_insertAction(0) { - m_label = new QLabel(i18n("Please open up the webpage you want to add as favorite"), this); - m_label->setWordWrap(true); - - QToolButton *closeButton = new QToolButton(this); - closeButton->setAutoRaise(true); - closeButton->setIcon(KIcon("dialog-close")); - connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(destroy())); - - m_button = new QPushButton(KIcon("insert-image"), i18n("Set to This Page"), this); - m_button->setMaximumWidth(250); - connect(m_button, SIGNAL(clicked(bool)), this, SLOT(clicked())); - - // layout - QHBoxLayout *layout = new QHBoxLayout(this); - layout->addWidget(closeButton); - layout->addWidget(m_label); - layout->addWidget(m_button); - - layout->setContentsMargins(2, 0, 2, 0); - - setLayout(layout); + setMessageType(KMessageWidget::Warning); + + QSize sz = size(); + sz.setWidth( qobject_cast(parent)->size().width() ); + resize(sz); + + setCloseButtonVisible(false); + + setText( i18n("Please open up the webpage you want to add as favorite") ); + + m_insertAction = new QAction(KIcon("insert-image"), i18n("Set to This Page"), this); + connect(m_insertAction, SIGNAL(triggered(bool)), this, SLOT(clicked())); + addAction(m_insertAction); } @@ -86,28 +75,28 @@ void PreviewSelectorBar::verifyUrl() if (rApp->mainWindow()->currentTab()->page()->mainFrame()->url().scheme() != "about") { - m_button->setEnabled(true); - m_button->setToolTip(""); + m_insertAction->setEnabled(true); + m_insertAction->setToolTip(""); } else { - m_button->setEnabled(false); - m_button->setToolTip(i18n("You cannot add this webpage as favorite")); + m_insertAction->setEnabled(false); + m_insertAction->setToolTip(i18n("You cannot add this webpage as favorite")); } } void PreviewSelectorBar::loadProgress() { - m_button->setEnabled(false); - m_button->setToolTip(i18n("Page is loading...")); + m_insertAction->setEnabled(false); + m_insertAction->setToolTip(i18n("Page is loading...")); } void PreviewSelectorBar::loadFinished() { - m_button->setEnabled(true); - m_button->setToolTip(""); + m_insertAction->setEnabled(true); + m_insertAction->setToolTip(""); verifyUrl(); } @@ -122,6 +111,7 @@ void PreviewSelectorBar::clicked() KUrl url = page->mainFrame()->url(); QStringList names = ReKonfig::previewNames(); QStringList urls = ReKonfig::previewUrls(); + //cleanup the previous image from the cache (useful to refresh the snapshot) QFile::remove(WebSnap::imagePathFromUrl(urls.at(m_previewIndex))); page->mainFrame()->setScrollBarValue(Qt::Vertical, 0); @@ -140,5 +130,6 @@ void PreviewSelectorBar::clicked() page->mainFrame()->load(KUrl("about:favorites")); } - destroy(); + animatedHide(); + deleteLater(); } diff --git a/src/previewselectorbar.h b/src/previewselectorbar.h index 396f763f..3be750b2 100644 --- a/src/previewselectorbar.h +++ b/src/previewselectorbar.h @@ -28,16 +28,18 @@ #ifndef PREVIEWSELECTORBAR_H #define PREVIEWSELECTORBAR_H + // Rekonq Includes #include "rekonq_defines.h" -#include "notificationbar.h" + +// KDE Includes +#include // Forward Declarations -class QLabel; -class QPushButton; +class QAction; -class REKONQ_TESTS_EXPORT PreviewSelectorBar : public NotificationBar +class REKONQ_TESTS_EXPORT PreviewSelectorBar : public KMessageWidget { Q_OBJECT @@ -49,7 +51,7 @@ public: m_previewIndex = index; } -private slots: +private Q_SLOTS: void clicked(); void loadProgress(); @@ -58,10 +60,8 @@ private slots: void verifyUrl(); private: - QPushButton *m_button; - QLabel *m_label; - int m_previewIndex; + QAction *m_insertAction; }; #endif // PREVIEWSELECTORBAR_H diff --git a/src/walletbar.cpp b/src/walletbar.cpp index cc084001..cf30e6d8 100644 --- a/src/walletbar.cpp +++ b/src/walletbar.cpp @@ -36,48 +36,40 @@ #include // Qt Includes -#include -#include -#include -#include +#include WalletBar::WalletBar(QWidget *parent) - : NotificationBar(parent) - , m_label(new QLabel(this)) + : KMessageWidget(parent) { - m_label->setWordWrap(true); - - QToolButton *closeButton = new QToolButton(this); - closeButton->setAutoRaise(true); - closeButton->setIcon(KIcon("dialog-close")); - - QPushButton *rememberButton = new QPushButton(KIcon("document-save"), i18n("Remember"), this); - QPushButton *neverHereButton = new QPushButton(KIcon("process-stop"), i18n("Never for This Site"), this); - QPushButton *notNowButton = new QPushButton(KIcon("dialog-cancel"), i18n("Not Now"), this); - - connect(closeButton, SIGNAL(clicked()), this, SLOT(notNowRememberData())); - connect(rememberButton, SIGNAL(clicked()), this, SLOT(rememberData())); - connect(neverHereButton, SIGNAL(clicked()), this, SLOT(neverRememberData())); - connect(notNowButton, SIGNAL(clicked()), this, SLOT(notNowRememberData())); - - // layout - QGridLayout *layout = new QGridLayout(this); - layout->addWidget(closeButton, 0, 0); - layout->addWidget(m_label, 0, 1); - layout->addWidget(rememberButton, 0, 2); - layout->addWidget(neverHereButton, 0, 3); - layout->addWidget(notNowButton, 0, 4); - layout->setColumnStretch(1, 100); - - setLayout(layout); + setMessageType(KMessageWidget::Warning); + + QSize sz = size(); + sz.setWidth( qobject_cast(parent)->size().width() ); + resize(sz); + + setCloseButtonVisible(false); + + QAction *rememberAction = new QAction(KIcon("document-save"), i18n("Remember"), this); + connect(rememberAction, SIGNAL(triggered(bool)), this, SLOT(rememberData())); + addAction(rememberAction); + + QAction *neverHereAction = new QAction(KIcon("process-stop"), i18n("Never for This Site"), this); + connect(neverHereAction, SIGNAL(triggered(bool)), this, SLOT(neverRememberData())); + addAction(neverHereAction); + + QAction *notNowAction = new QAction(KIcon("dialog-cancel"), i18n("Not Now"), this); + connect(notNowAction, SIGNAL(triggered(bool)), this, SLOT(notNowRememberData())); + addAction(notNowAction); } void WalletBar::rememberData() { emit saveFormDataAccepted(m_key); - destroy(); + + animatedHide(); + deleteLater(); } @@ -95,14 +87,16 @@ void WalletBar::neverRememberData() void WalletBar::notNowRememberData() { emit saveFormDataRejected(m_key); - destroy(); + + animatedHide(); + deleteLater(); } void WalletBar::onSaveFormData(const QString &key, const QUrl &url) { - m_label->setText(i18n("Do you want rekonq to remember the password on %1?", url.host())); + setText(i18n("Do you want rekonq to remember the password on %1?", url.host())); m_key = key; m_url = url; diff --git a/src/walletbar.h b/src/walletbar.h index 8c85c442..13429eb9 100644 --- a/src/walletbar.h +++ b/src/walletbar.h @@ -30,39 +30,36 @@ // Rekonq Includes #include "rekonq_defines.h" -#include "notificationbar.h" + +// KDE Includes +#include // Qt Includes -#include +#include -class QLabel; -class REKONQ_TESTS_EXPORT WalletBar : public NotificationBar +class REKONQ_TESTS_EXPORT WalletBar : public KMessageWidget { Q_OBJECT public: WalletBar(QWidget *parent); - -private slots: - + +private Q_SLOTS: void rememberData(); void neverRememberData(); void notNowRememberData(); -public slots: +public Q_SLOTS: void onSaveFormData(const QString &, const QUrl &); -signals: +Q_SIGNALS: void saveFormDataAccepted(const QString &); void saveFormDataRejected(const QString &); private: - QString m_key; QUrl m_url; - - QLabel *m_label; }; #endif // WALLET_BAR_H diff --git a/src/webtab.cpp b/src/webtab.cpp index 09940173..386ad5dc 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -27,8 +27,8 @@ // Self Includes #include "webtab.h" -#include "rekonq_defines.h" #include "webtab.moc" + // Auto Includes #include "rekonq.h" @@ -140,12 +140,12 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url) { m_walletBar = new WalletBar(this); m_walletBar.data()->onSaveFormData(key, url); - qobject_cast(layout())->insertWidget(0, m_walletBar.data()); + m_walletBar.data()->animatedShow(); } else { disconnect(wallet); - m_walletBar.data()->notifyUser(); + m_walletBar.data()->animatedShow(); } connect(m_walletBar.data(), SIGNAL(saveFormDataAccepted(const QString &)), @@ -160,13 +160,13 @@ void WebTab::createPreviewSelectorBar(int index) if (m_previewSelectorBar.isNull()) { m_previewSelectorBar = new PreviewSelectorBar(index, this); - qobject_cast(layout())->insertWidget(0, m_previewSelectorBar.data()); + m_previewSelectorBar.data()->animatedShow(); } else { disconnect(m_previewSelectorBar.data()); m_previewSelectorBar.data()->setIndex(index); - m_previewSelectorBar.data()->notifyUser(); + m_previewSelectorBar.data()->animatedHide(); } connect(page(), SIGNAL(loadStarted()), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection); @@ -176,12 +176,6 @@ void WebTab::createPreviewSelectorBar(int index) } -void WebTab::insertBar(NotificationBar *bar) -{ - qobject_cast(layout())->insertWidget(0, bar); -} - - bool WebTab::hasRSSInfo() { QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]"); @@ -254,7 +248,7 @@ void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u) KUrl WebTab::extractOpensearchUrl(QWebElement e) { - QString href = e.attribute(QLatin1String("href")); + QString href = e.attribute(QL1S("href")); KUrl url = KUrl(href); if (!href.contains(":")) { @@ -272,15 +266,15 @@ KUrl WebTab::extractOpensearchUrl(QWebElement e) bool WebTab::hasNewSearchEngine() { - QWebElement e = page()->mainFrame()->findFirstElement(QLatin1String("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]")); + QWebElement e = page()->mainFrame()->findFirstElement(QL1S("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]")); return !e.isNull() && !rApp->opensearchManager()->engineExists(extractOpensearchUrl(e)); } void WebTab::showSearchEngine(const QPoint &pos) { - QWebElement e = page()->mainFrame()->findFirstElement(QLatin1String("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]")); - QString title = e.attribute(QLatin1String("title")); + QWebElement e = page()->mainFrame()->findFirstElement(QL1S("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]")); + QString title = e.attribute(QL1S("title")); if (!title.isEmpty()) { WebShortcutWidget *widget = new WebShortcutWidget(window()); diff --git a/src/webtab.h b/src/webtab.h index 092d6ce9..ff347414 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -77,7 +77,6 @@ public: KUrl url(); void createPreviewSelectorBar(int index); - void insertBar(NotificationBar* bar); bool hasRSSInfo(); -- cgit v1.2.1