From 99609d109dfdb712ecf54cdb6be296f31ef5e8a3 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sat, 11 Feb 2012 11:38:02 +0100 Subject: [PATCH] Little improvements in guessing download file info + in websearchbar. - guessing file type and icon should now be more accurate - when changing search engine in web searchbar and text in it is not empty, it will automatically load search results. --- src/downloads/downloadfilehelper.cpp | 3 ++- src/navigation/websearchbar.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/downloads/downloadfilehelper.cpp b/src/downloads/downloadfilehelper.cpp index fbc3424c7..32f5dc94a 100644 --- a/src/downloads/downloadfilehelper.cpp +++ b/src/downloads/downloadfilehelper.cpp @@ -56,9 +56,10 @@ void DownloadFileHelper::handleUnsupportedContent(QNetworkReply* reply, bool ask m_h_fileName = getFileName(reply); m_reply = reply; - QFileInfo info(reply->url().toString()); + QFileInfo info(m_h_fileName); QTemporaryFile tempFile("XXXXXX." + info.suffix()); tempFile.open(); + tempFile.write(m_reply->peek(1024 * 1024)); QFileInfo tempInfo(tempFile.fileName()); m_fileIcon = m_iconProvider->icon(tempInfo).pixmap(30, 30); QString mimeType = m_iconProvider->type(tempInfo); diff --git a/src/navigation/websearchbar.cpp b/src/navigation/websearchbar.cpp index c77db3f28..8e25d82b9 100644 --- a/src/navigation/websearchbar.cpp +++ b/src/navigation/websearchbar.cpp @@ -139,6 +139,10 @@ void WebSearchBar::searchChanged(const ButtonWithMenu::Item &item) m_openSearchEngine->setSuggestionsParameters(m_activeEngine.suggestionsParameters); m_searchManager->setActiveEngine(m_activeEngine); + + if (!text().isEmpty()) { + search(); + } } void WebSearchBar::search()