diff options
-rw-r--r-- | src/application.cpp | 13 | ||||
-rw-r--r-- | src/bookmarks/bookmarkowner.cpp | 2 | ||||
-rw-r--r-- | src/newtabpage.cpp | 11 | ||||
-rw-r--r-- | src/protocolhandler.cpp | 5 | ||||
-rw-r--r-- | src/urlbar/urlresolver.cpp | 2 | ||||
-rw-r--r-- | src/webtab.cpp | 38 | ||||
-rw-r--r-- | src/webtab.h | 8 |
7 files changed, 53 insertions, 26 deletions
diff --git a/src/application.cpp b/src/application.cpp index e5677a0d..df4c3d51 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -341,18 +341,19 @@ KIcon Application::icon(const KUrl &url) if (url.isEmpty()) return KIcon("text-html"); + QByteArray encodedUrl = url.toEncoded(); // rekonq icons.. - if (url == KUrl("about:home")) + if (encodedUrl == QByteArray("about:home")) return KIcon("go-home"); - if (url == KUrl("about:closedTabs")) + if (encodedUrl == QByteArray("about:closedTabs")) return KIcon("tab-close"); - if (url == KUrl("about:history")) + if (encodedUrl == QByteArray("about:history")) return KIcon("view-history"); - if (url == KUrl("about:bookmarks")) + if (encodedUrl == QByteArray("about:bookmarks")) return KIcon("bookmarks"); - if (url == KUrl("about:favorites")) + if (encodedUrl == QByteArray("about:favorites")) return KIcon("emblem-favorite"); - if (url == KUrl("about:downloads")) + if (encodedUrl == QByteArray("about:downloads")) return KIcon("download"); KIcon icon = KIcon(QWebSettings::iconForUrl(url)); diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 862a7de4..530ad199 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -341,7 +341,7 @@ void BookmarkOwner::setupActions() createAction(NEW_FOLDER, i18n("New Folder"), "folder-new", i18n("Create a new bookmark folder"), SLOT(newBookmarkFolder())); createAction(NEW_SEPARATOR, i18n("New Separator"), "edit-clear", - i18n("Create a new bookmark separatork"), SLOT(newSeparator())); + i18n("Create a new bookmark separator"), SLOT(newSeparator())); createAction(COPY, i18n("Copy Link"), "edit-copy", i18n("Copy the bookmark's link address"), SLOT(copyLink())); createAction(EDIT, i18n("Edit"), "configure", diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 44b76e11..51081816 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -134,27 +134,28 @@ void NewTabPage::generate(const KUrl &url) browsingMenu(url); QString title; - if (url == KUrl("about:favorites")) + QByteArray encodedUrl = url.toEncoded(); + if (encodedUrl == QByteArray("about:favorites")) { favoritesPage(); title = i18n("Favorites"); } - else if (url == KUrl("about:closedTabs")) + else if (encodedUrl == QByteArray("about:closedTabs")) { closedTabsPage(); title = i18n("Closed Tabs"); } - else if (url == KUrl("about:history")) + else if (encodedUrl == QByteArray("about:history")) { historyPage(); title = i18n("History"); } - else if (url == KUrl("about:bookmarks")) + else if (encodedUrl == QByteArray("about:bookmarks")) { bookmarksPage(); title = i18n("Bookmarks"); } - else if (url == KUrl("about:downloads")) + else if (encodedUrl == QByteArray("about:downloads")) { downloadsPage(); title = i18n("Downloads"); diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 1f84b420..5cc09f44 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -145,13 +145,14 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra // "about" handling if (_url.protocol() == QL1S("about")) { + QByteArray encodedUrl = _url.toEncoded(); // let webkit manage the about:blank url... - if (_url == KUrl("about:blank")) + if (encodedUrl == QByteArray("about:blank")) { return false; } - if (_url == KUrl("about:home")) + if (encodedUrl == QByteArray("about:home")) { switch (ReKonfig::newTabStartPage()) { diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index d60dc563..84c9e20b 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -71,7 +71,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) { kDebug() << "browse regexp empty. Setting value.."; - QString protocol = "^(http://|https://|file://|ftp://|man:|info:|apt:)"; + QString protocol = "^(http://|https://|file://|ftp://|man:|info:|apt:|about:)"; QString localhost = "^localhost"; diff --git a/src/webtab.cpp b/src/webtab.cpp index 0b58d7c5..d5c5b478 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -92,6 +92,8 @@ WebTab::WebTab(QWidget *parent) WebTab::~WebTab() { + _walletBar.clear(); + _previewSelectorBar.clear(); } @@ -131,6 +133,12 @@ void WebTab::updateProgress(int p) void WebTab::loadFinished(bool) { m_progress = 0; + if(_walletBar.isNull()) + { + kDebug() << "OK, it's null"; + } + else + kDebug() << "NO, it's NOT null"; } @@ -142,27 +150,35 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url) if (blackList.contains(urlString)) return; + if(!_walletBar.isNull()) + { + _walletBar.clear(); + } KWebWallet *wallet = page()->wallet(); - WalletBar *walletBar = new WalletBar(this); - walletBar->onSaveFormData(key, url); - qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, walletBar); + _walletBar = new WalletBar(this); + _walletBar.data()->onSaveFormData(key, url); + qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, _walletBar.data() ); - connect(walletBar, SIGNAL(saveFormDataAccepted(const QString &)), + connect(_walletBar.data(), SIGNAL(saveFormDataAccepted(const QString &)), wallet, SLOT(acceptSaveFormDataRequest(const QString &))); - connect(walletBar, SIGNAL(saveFormDataRejected(const QString &)), + connect(_walletBar.data(), SIGNAL(saveFormDataRejected(const QString &)), wallet, SLOT(rejectSaveFormDataRequest(const QString &))); } void WebTab::createPreviewSelectorBar(int index) { - PreviewSelectorBar *bar = new PreviewSelectorBar(index, this); - qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, bar); + if(!_previewSelectorBar.isNull()) + { + _previewSelectorBar.clear(); + } + _previewSelectorBar = new PreviewSelectorBar(index, this); + qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, _previewSelectorBar.data()); - connect(page(), SIGNAL(loadStarted()), bar, SLOT(loadProgress())); - connect(page(), SIGNAL(loadProgress(int)), bar, SLOT(loadProgress())); - connect(page(), SIGNAL(loadFinished(bool)), bar, SLOT(loadFinished())); - connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), bar, SLOT(verifyUrl())); + connect(page(), SIGNAL(loadStarted()), _previewSelectorBar.data(), SLOT(loadProgress())); + connect(page(), SIGNAL(loadProgress(int)), _previewSelectorBar.data(), SLOT(loadProgress())); + connect(page(), SIGNAL(loadFinished(bool)), _previewSelectorBar.data(), SLOT(loadFinished())); + connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), _previewSelectorBar.data(), SLOT(verifyUrl())); } diff --git a/src/webtab.h b/src/webtab.h index e34bbccf..a24418ef 100644 --- a/src/webtab.h +++ b/src/webtab.h @@ -41,6 +41,11 @@ // Qt Includes #include <QWidget> +#include <QWeakPointer> + +// Forward Declarations +class WalletBar; +class PreviewSelectorBar; class REKONQ_TESTS_EXPORT WebTab : public QWidget @@ -74,6 +79,9 @@ private: WebView *_view; int m_progress; + + QWeakPointer<WalletBar> _walletBar; + QWeakPointer<PreviewSelectorBar> _previewSelectorBar; }; #endif |