diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 13 | ||||
-rw-r--r-- | src/bookmarks/bookmarkowner.cpp | 2 | ||||
-rw-r--r-- | src/bookmarks/bookmarkprovider.cpp | 16 | ||||
-rw-r--r-- | src/data/rekonq.desktop | 3 | ||||
-rw-r--r-- | src/history/historymanager.cpp | 14 | ||||
-rw-r--r-- | src/newtabpage.cpp | 11 | ||||
-rw-r--r-- | src/protocolhandler.cpp | 5 | ||||
-rw-r--r-- | src/urlbar/listitem.cpp | 17 | ||||
-rw-r--r-- | src/urlbar/urlresolver.cpp | 2 | ||||
-rw-r--r-- | src/websnap.cpp | 13 | ||||
-rw-r--r-- | src/webtab.cpp | 38 | ||||
-rw-r--r-- | src/webtab.h | 8 |
12 files changed, 96 insertions, 46 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/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index f07c5164..ec02ed31 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -253,9 +253,21 @@ void BookmarkProvider::find(QList<KBookmark> *list, const KBookmark &bookmark, c for (KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm)) find(list, bm, text); } - else if (bookmark.url().url().contains(text) || bookmark.fullText().contains(text)) + else { - *list << bookmark; + QStringList words = text.split(" "); + bool matches = true; + foreach (const QString &word, words) + { + if (!bookmark.url().url().contains(word, Qt::CaseInsensitive) + && !bookmark.fullText().contains(word, Qt::CaseInsensitive)) + { + matches = false; + break; + } + } + if (matches) + *list << bookmark; } } diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop index 7c45af77..3c2db7ee 100644 --- a/src/data/rekonq.desktop +++ b/src/data/rekonq.desktop @@ -4,6 +4,7 @@ Name[bg]=rekonq Name[cs]=rekonq Name[da]=rekonq Name[de]=rekonq +Name[el]=rekonq Name[en_GB]=rekonq Name[es]=rekonq Name[et]=rekonq @@ -31,10 +32,12 @@ Name[zh_TW]=rekonq GenericName=Web Browser GenericName[da]=Webbrowser GenericName[de]=Webbrowser +GenericName[el]=Περιηγητής ιστού GenericName[en_GB]=Web Browser GenericName[es]=Navegador web GenericName[fr]=Navigateur web GenericName[it]=Browser Web +GenericName[nds]=Nettkieker GenericName[pt]=Navegador Web GenericName[pt_BR]=Navegador Web GenericName[ru]=Веб-браузер diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index 5cd85cd7..4a3039f3 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -239,8 +239,18 @@ QList<HistoryItem> HistoryManager::find(const QString &text) { int index = m_historyFilterModel->historyLocation(url); HistoryItem item = m_history.at(index); - - if(url.contains(text) || item.title.contains(text)) + + QStringList words = text.split(" "); + bool matches = true; + foreach (const QString &word, words) + { + if (!url.contains(word, Qt::CaseInsensitive) + && !item.title.contains(word, Qt::CaseInsensitive)) { + matches = false; + break; + } + } + if (matches) list << item; } 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/listitem.cpp b/src/urlbar/listitem.cpp index e9bb6fbb..5bd2253f 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -200,8 +200,17 @@ TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget : QLabel(parent) { QString t = text; - if (!textToPointOut.isEmpty()) - t = t.replace(QRegExp('(' + textToPointOut + ')', Qt::CaseInsensitive), "<b>\\1</b>"); + const bool wasItalic = t.startsWith("<i>"); + if (wasItalic) + t.remove(QRegExp("<[/ib]*>")); + t = Qt::escape(t); + QStringList words = textToPointOut.split(" "); + foreach (const QString &wordToPointOut, words) { + if (!wordToPointOut.isEmpty()) + t.replace(QRegExp('(' + wordToPointOut + ')', Qt::CaseInsensitive), "<b>\\1</b>"); + } + if (wasItalic) + t = QL1S("<i>") + t + QL1S("</i>"); setText(t); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); @@ -286,7 +295,7 @@ SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, Q m_url = SearchEngine::buildQuery(engine, query); m_iconLabel = new IconLabel("edit-find", this); //TODO: get the default engine icon (will be easy in KDE SC 4.5) - m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), QString(), this); + m_titleLabel = new TextLabel(searchItemTitle(engine->name(), query), query, this); m_engineBar = new EngineBar(engine, parent); QHBoxLayout *hLayout = new QHBoxLayout; @@ -312,7 +321,7 @@ QString SearchListItem::text() QString SearchListItem::searchItemTitle(QString engine, QString text) { - return QString(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for <b>%2</b>", engine, Qt::escape(text))); + return QString(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for %2", engine, Qt::escape(text))); } 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/websnap.cpp b/src/websnap.cpp index 1405fb6e..afa08c64 100644 --- a/src/websnap.cpp +++ b/src/websnap.cpp @@ -185,18 +185,7 @@ QString WebSnap::imagePathFromUrl(const KUrl &url) { QUrl temp = QUrl(url.url()); QString name = temp.toString(QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash); - - // TODO learn Regular Expressions :) - // and implement something better here.. - name.remove('/'); - name.remove('&'); - name.remove('.'); - name.remove('-'); - name.remove('_'); - name.remove('?'); - name.remove('='); - name.remove('+'); - + name.remove(QRegExp(QL1S("[&+=_?./-]"))); return KStandardDirs::locateLocal("cache", QString("thumbs/") + name + ".png", true); } 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 |