[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdegraphics/kpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-09-01 14:08:18
Message-ID: 1125583698.581482.12520.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 455836 by aacid:

Fordwardport
If somebody from the upper spheres (like Konqui for example) gives us the
mimetype use it instead trying to guess the mimetype ourselves for the file we
are opening, fixes problem in opening a pdf file generated by php code


 M  +1 -3      core/document.cpp  
 M  +3 -1      core/document.h  
 M  +10 -2     part.cpp  


--- trunk/KDE/kdegraphics/kpdf/core/document.cpp #455835:455836
@@ -25,7 +25,6 @@
 #include <kmessagebox.h>
 #include <kapplication.h>
 #include <kuserprofile.h>
-#include <kmimetype.h>
 #include <krun.h>
 #include <kstandarddirs.h>
 
@@ -133,7 +132,7 @@
 }
 
 
-bool KPDFDocument::openDocument( const QString & docFile, const KURL & url )
+bool KPDFDocument::openDocument( const QString & docFile, const KURL & url, const KMimeType::Ptr &mime )
 {
     // docFile is always local so we can use QFile on it
     QFile fileReadTest( docFile );
@@ -151,7 +150,6 @@
     d->xmlFileName = locateLocal( "data", fn );
 
     // create the generator based on the file's mimetype
-    KMimeType::Ptr mime = KMimeType::findByPath( docFile );
     if ( (*mime).is( "application/pdf" ) )
         generator = new PDFGenerator( this );
 //    else if ( mimeName == "application/postscript" )
--- trunk/KDE/kdegraphics/kpdf/core/document.h #455835:455836
@@ -18,6 +18,8 @@
 
 class QColor;
 
+#include <kmimetype.h>
+
 class KPDFPage;
 class KPDFLink;
 class DocumentObserver;
@@ -55,7 +57,7 @@
         ~KPDFDocument();
 
         // document handling
-        bool openDocument( const QString & docFile, const KURL & url );
+        bool openDocument( const QString & docFile, const KURL & url, const KMimeType::Ptr &mime );
         void closeDocument();
 
         // misc methods
--- trunk/KDE/kdegraphics/kpdf/part.cpp #455835:455836
@@ -347,7 +347,15 @@
 
 bool Part::openFile()
 {
-    KMimeType::Ptr mime = KMimeType::findByPath( m_file );
+    KMimeType::Ptr mime;
+    if ( m_bExtension->urlArgs().serviceType.isEmpty() )
+    {
+        mime = KMimeType::findByPath( m_file );
+    }
+    else
+    {
+        mime = KMimeType::mimeType( m_bExtension->urlArgs().serviceType );
+    }
     if ( (*mime).is( "application/postscript" ) )
     {
         QString app = KStandardDirs::findExe( "ps2pdf" );
@@ -377,7 +385,7 @@
 
     m_temporaryLocalFile = QString::null;
 
-    bool ok = m_document->openDocument( m_file, url() );
+    bool ok = m_document->openDocument( m_file, url(), mime );
 
     // update one-time actions
     m_find->setEnabled( ok && m_document-> supportsSearching());
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic