[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/apps/konqueror/src
From: David Faure <faure () kde ! org>
Date: 2011-01-24 13:17:40
Message-ID: 20110124131740.72C83AC8B9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1216743 by dfaure:
Improve upon r1204922 so that the current servicename isn't reused for viewing \
unrelated mimetypes; e.g. "new tab" while viewing a text file in katepart would \
create a katepart for the about: HTML...
M +5 -0 konqview.cpp
M +11 -0 konqview.h
M +8 -3 konqviewmanager.cpp
--- trunk/KDE/kdebase/apps/konqueror/src/konqview.cpp #1216742:1216743
@@ -1223,6 +1223,11 @@
return KParts::StatusBarExtension::childObject( m_pPart );
}
+KMimeType::Ptr KonqView::mimeType() const
+{
+ return KMimeType::mimeType(serviceType()); // can be null
+}
+
bool KonqView::supportsMimeType( const QString &mimeType ) const
{
KMimeType::Ptr mime = KMimeType::mimeType(mimeType, KMimeType::ResolveAliases);
--- trunk/KDE/kdebase/apps/konqueror/src/konqview.h #1216742:1216743
@@ -25,6 +25,7 @@
#include "konqframe.h"
#include <kservice.h>
+#include <kmimetype.h>
#include <QtCore/QList>
@@ -268,10 +269,20 @@
QString serviceType() const { return m_serviceType; }
/**
+ * The mimetype this view is currently displaying.
+ * Can be null, if serviceType() is not a mimetype.
+ */
+ KMimeType::Ptr mimeType() const;
+
+ /**
* @return the servicetypes this view is capable to display
*/
QStringList serviceTypes() const { return m_service->serviceTypes(); }
+ /**
+ * Returns true if the part used in this view would be able to display
+ * @p mimeType too. WARNING: this often leads to showing HTML in katepart...
+ */
bool supportsMimeType( const QString &mimeType ) const;
// True if showing a directory
--- trunk/KDE/kdebase/apps/konqueror/src/konqviewmanager.cpp #1216742:1216743
@@ -223,15 +223,20 @@
Q_ASSERT( !serviceType.isEmpty() );
QString actualServiceName = serviceName;
- if (serviceType == "text/html" && actualServiceName.isEmpty()) {
- // Use same html part as the current view (e.g. webkit).
+ if (actualServiceName.isEmpty()) {
+ // Use same part as the current view (e.g. khtml/webkit).
// This is down here in this central method because it should work for
// MMB-opens-tab, window.open (createNewWindow), and more.
KonqView* currentView = m_pMainWindow->currentView();
- if (currentView && currentView->supportsMimeType("text/html")) {
+ // Don't use supportsMimeType("text/html"), it's true for katepart too.
+ // (Testcase: view text file, ctrl+shift+n, was showing about page in \
katepart) + if (currentView) {
+ KMimeType::Ptr mime = currentView->mimeType();
+ if (mime && mime->is(serviceType)) {
actualServiceName = currentView->service()->desktopEntryName();
}
}
+ }
KonqViewFactory newViewFactory = createView( serviceType, actualServiceName, \
service, partServiceOffers, appServiceOffers, true /*forceAutoEmbed*/ );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic