[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:50:22 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 324f8184799a69f2c11809cfbe7820f718ad517b
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 15 14:23:26 2001 +0000

    Changes and additions to make the WebViewTest work, and to begin
    the process of bringing WebCore and WebKit together
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@322 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/include/WCURICache.h b/WebCore/include/WCURICache.h
new file mode 100644
index 0000000..ce520c9
--- /dev/null
+++ b/WebCore/include/WCURICache.h
@@ -0,0 +1,31 @@
+/*	WCURICache.h
+	Copyright 2001, Apple, Inc. All rights reserved.
+*/
+
+#import <Foundation/Foundation.h>
+
+#import <WCURICacheClient.h>
+#import <WCURICacheJobID.h>
+
+ at protocol WCURICache 
+
+-(NSString *)requestWithURL:(NSURL *)url requestor:(id)requestor;
+-(NSString *)requestWithString:(NSString *)uriString requestor:(id)requestor;
+
+-(void)cancelRequest:(id <WCURICacheJobID>)jobID;
+-(void)cancelAllRequestsWithURL:(NSURL *)url;
+-(void)cancelAllRequestsWithString:(NSString *)uriString;
+
+ at end
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+// *** Function to access WCURICache singleton
+
+id <WCURICache> WCGetDefaultURICache(); 
+
+#if defined(__cplusplus)
+} // extern "C"
+#endif
diff --git a/WebCore/include/WCURICacheData.h b/WebCore/include/WCURICacheData.h
new file mode 100644
index 0000000..1aa79f9
--- /dev/null
+++ b/WebCore/include/WCURICacheData.h
@@ -0,0 +1,17 @@
+/*	WCURICacheData.h
+	Copyright 2001, Apple, Inc. All rights reserved.
+*/
+
+#import <Foundation/Foundation.h>
+
+#import <WCURICacheJobID.h>
+
+ at protocol WCURICacheData
+
+-(id <WCURICacheJobID>)jobID;
+-(NSURL *)url;
+-(unsigned char *)cacheData;
+-(int)cacheDataSize;
+-(void *)userInfo;
+
+ at end
diff --git a/WebCore/include/WCURICacheJobID.h b/WebCore/include/WCURICacheJobID.h
new file mode 100644
index 0000000..6c8dc69
--- /dev/null
+++ b/WebCore/include/WCURICacheJobID.h
@@ -0,0 +1,9 @@
+/*	WCURICacheJobID.h
+	Copyright 2001, Apple, Inc. All rights reserved.
+*/
+
+#import <Foundation/Foundation.h>
+
+
+ at protocol WCURICacheJobID
+ at end
diff --git a/WebCore/kwq/KWQCString.mm b/WebCore/kwq/KWQCString.mm
index a991f07..bb48df7 100644
--- a/WebCore/kwq/KWQCString.mm
+++ b/WebCore/kwq/KWQCString.mm
@@ -322,6 +322,25 @@ QCString &QCString::operator+=(char c)
     return *this;
 }
 
+bool operator==(const char *s1, const QCString &s2)
+{
+    return (strcmp(s1, s2) == 0);
+}
+
+bool operator==(const QCString &s1, const char *s2)
+{
+    return (strcmp(s1, s2) == 0);
+}
+
+bool operator!=(const char *s1, const QCString &s2)
+{
+    return (strcmp(s1, s2) != 0);
+}
+
+bool operator!=(const QCString &s1, const char *s2)
+{
+    return (strcmp(s1, s2) != 0);
+}
 
 #ifdef _KWQ_IOSTREAM_
 ostream &operator<<(ostream &o, const QCString &s)
diff --git a/WebCore/kwq/KWQKCharsets.mm b/WebCore/kwq/KWQKCharsets.mm
index dc31b8a..a64b703 100644
--- a/WebCore/kwq/KWQKCharsets.mm
+++ b/WebCore/kwq/KWQKCharsets.mm
@@ -25,7 +25,7 @@
 #include <kwqdebug.h>
 
 #include <qstring.h>
-
+#include <qtextcodec.h>
 #include <kcharsets.h>
 
 KCharsets::KCharsets()
@@ -40,15 +40,19 @@ KCharsets::~KCharsets()
 }
 
 
-QTextCodec *KCharsets::codecForName(const QString &) const
+QTextCodec *KCharsets::codecForName(const QString &s) const
 {
-    _logNotYetImplemented();
+    //_logNotYetImplemented();
+    // FIXME: implement correctly
+    QTextCodec::codecForName(s.latin1());
 }
 
 
-QTextCodec *KCharsets::codecForName(const QString &, bool &) const
+QTextCodec *KCharsets::codecForName(const QString &s, bool &b) const
 {
-    _logNotYetImplemented();
+    //_logNotYetImplemented();
+    // FIXME: implement correctly
+    QTextCodec::codecForName(s.latin1());
 }
 
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 0b0154b..09dff27 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -28,14 +28,49 @@
 #include <qfont.h>
 #include <qtextcodec.h>
 
+#include <Foundation/Foundation.h>
+
+#include <job.h>
+#include <jobclasses.h>
 #include <khtml_settings.h>
 #include <khtml_factory.h>
 #include <kcharsets.h>
 #include <kglobal.h>
 #include <html/htmltokenizer.h>
 #include <xml/dom_docimpl.h>
+#include <html/html_documentimpl.h>
+#include <loader.h>
 
 #include <KWQKHTMLPart.h>
+#import <WCURICacheData.h>
+
+static bool cache_init = false;
+
+// Class KHTMLPartNotificationReceiver ==============================================================
+
+ at interface KHTMLPartNotificationReceiver : NSObject
+{
+    @public
+    KHTMLPart *m_part;
+}
+ at end
+
+ at implementation KHTMLPartNotificationReceiver
+
+-(void)cacheDataAvailable:(NSNotification *)notification
+{
+    id <WCURICacheData> data;
+    
+    data = [notification object];
+    m_part->write((const char *)[data cacheData], [data cacheDataSize]);    
+}
+
+-(void)cacheFinished:(NSNotification *)notification
+{
+    // FIXME: need an implementation for this
+}
+
+ at end
 
 // Class KHTMLPartPrivate ================================================================================
 
@@ -48,21 +83,37 @@ public:
     QString m_encoding;
     QFont::CharSet m_charset;
     KHTMLSettings *m_settings;
-
+    
     KURL m_workingURL;
+    
+    KHTMLPart *m_part;
+    KHTMLPartNotificationReceiver *m_recv;
 
     bool m_bFirstData:1;
     bool m_haveEncoding:1;
     bool m_haveCharset:1;
-    
-    KHTMLPartPrivate()
+
+    KHTMLPartPrivate(KHTMLPart *part)
     {
-        m_doc = 0L;
+        if (!cache_init) {
+            khtml::Cache::init();
+            cache_init = true;
+        }
+        m_part = part;
+        m_doc = new HTMLDocumentImpl(NULL);
         m_decoder = 0L;
         m_bFirstData = true;
         m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
         m_haveEncoding = false;
+        m_recv = [[KHTMLPartNotificationReceiver alloc] init];
+        m_recv->m_part = part;
+    }
+
+    ~KHTMLPartPrivate()
+    {
+        [m_recv autorelease];   
     }
+
 };
 
 
@@ -81,12 +132,13 @@ KHTMLPart::KHTMLPart(const KURL &url )
 
 void KHTMLPart::init()
 {
-    d = new KHTMLPartPrivate();
+    d = new KHTMLPartPrivate(this);
 }
 
 
 KHTMLPart::~KHTMLPart()
 {
+    delete d;
     _logNotYetImplemented();
 }
 
@@ -112,12 +164,12 @@ bool KHTMLPart::openURL( const KURL &url )
     //        SLOT( slotRedirection(KIO::Job*,const KURL&) ) );
     
     // Initiate request for URL data.
-    
-    // Setup callbacks for incoming data.
+    //d->m_job = KIO::get( url, false, false );
+    //d->m_job = KIO::get( url, false, false );
     
     // Keep a reference to the current working URL.
     d->m_workingURL = url;
-        
+
     return true;
 }
 
@@ -254,8 +306,9 @@ void KHTMLPart::write( const char *str, int len)
         d->m_decoder = new khtml::Decoder();
         if(d->m_encoding != QString::null)
             d->m_decoder->setEncoding(d->m_encoding.latin1(), d->m_haveEncoding);
-        else
-            d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+        else {
+            //FIXME: d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+        }
     }
     if ( len == 0 )
         return;
@@ -682,5 +735,3 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
-
-
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 0b0154b..09dff27 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -28,14 +28,49 @@
 #include <qfont.h>
 #include <qtextcodec.h>
 
+#include <Foundation/Foundation.h>
+
+#include <job.h>
+#include <jobclasses.h>
 #include <khtml_settings.h>
 #include <khtml_factory.h>
 #include <kcharsets.h>
 #include <kglobal.h>
 #include <html/htmltokenizer.h>
 #include <xml/dom_docimpl.h>
+#include <html/html_documentimpl.h>
+#include <loader.h>
 
 #include <KWQKHTMLPart.h>
+#import <WCURICacheData.h>
+
+static bool cache_init = false;
+
+// Class KHTMLPartNotificationReceiver ==============================================================
+
+ at interface KHTMLPartNotificationReceiver : NSObject
+{
+    @public
+    KHTMLPart *m_part;
+}
+ at end
+
+ at implementation KHTMLPartNotificationReceiver
+
+-(void)cacheDataAvailable:(NSNotification *)notification
+{
+    id <WCURICacheData> data;
+    
+    data = [notification object];
+    m_part->write((const char *)[data cacheData], [data cacheDataSize]);    
+}
+
+-(void)cacheFinished:(NSNotification *)notification
+{
+    // FIXME: need an implementation for this
+}
+
+ at end
 
 // Class KHTMLPartPrivate ================================================================================
 
@@ -48,21 +83,37 @@ public:
     QString m_encoding;
     QFont::CharSet m_charset;
     KHTMLSettings *m_settings;
-
+    
     KURL m_workingURL;
+    
+    KHTMLPart *m_part;
+    KHTMLPartNotificationReceiver *m_recv;
 
     bool m_bFirstData:1;
     bool m_haveEncoding:1;
     bool m_haveCharset:1;
-    
-    KHTMLPartPrivate()
+
+    KHTMLPartPrivate(KHTMLPart *part)
     {
-        m_doc = 0L;
+        if (!cache_init) {
+            khtml::Cache::init();
+            cache_init = true;
+        }
+        m_part = part;
+        m_doc = new HTMLDocumentImpl(NULL);
         m_decoder = 0L;
         m_bFirstData = true;
         m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
         m_haveEncoding = false;
+        m_recv = [[KHTMLPartNotificationReceiver alloc] init];
+        m_recv->m_part = part;
+    }
+
+    ~KHTMLPartPrivate()
+    {
+        [m_recv autorelease];   
     }
+
 };
 
 
@@ -81,12 +132,13 @@ KHTMLPart::KHTMLPart(const KURL &url )
 
 void KHTMLPart::init()
 {
-    d = new KHTMLPartPrivate();
+    d = new KHTMLPartPrivate(this);
 }
 
 
 KHTMLPart::~KHTMLPart()
 {
+    delete d;
     _logNotYetImplemented();
 }
 
@@ -112,12 +164,12 @@ bool KHTMLPart::openURL( const KURL &url )
     //        SLOT( slotRedirection(KIO::Job*,const KURL&) ) );
     
     // Initiate request for URL data.
-    
-    // Setup callbacks for incoming data.
+    //d->m_job = KIO::get( url, false, false );
+    //d->m_job = KIO::get( url, false, false );
     
     // Keep a reference to the current working URL.
     d->m_workingURL = url;
-        
+
     return true;
 }
 
@@ -254,8 +306,9 @@ void KHTMLPart::write( const char *str, int len)
         d->m_decoder = new khtml::Decoder();
         if(d->m_encoding != QString::null)
             d->m_decoder->setEncoding(d->m_encoding.latin1(), d->m_haveEncoding);
-        else
-            d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+        else {
+            //FIXME: d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+        }
     }
     if ( len == 0 )
         return;
@@ -682,5 +735,3 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
-
-
diff --git a/WebCore/kwq/KWQKJob.mm b/WebCore/kwq/KWQKJob.mm
index f79ab9a..64fb272 100644
--- a/WebCore/kwq/KWQKJob.mm
+++ b/WebCore/kwq/KWQKJob.mm
@@ -25,16 +25,20 @@
 
 #include <job.h>
 
-
 namespace KIO {
 
 SimpleJob *http_update_cache(const KURL &, bool, time_t)
 {
 }
 
-TransferJob *get(const KURL &url, bool reload=false, 
-    bool showProgressInfo=true)
+TransferJob *get(const KURL &url, bool reload=false, bool showProgressInfo=true)
 {
+    TransferJob *result;
+    
+    result = new TransferJob(url, reload, showProgressInfo);
+    result->begin();
+
+    return result;
 }
 
 } // namespace KIO
diff --git a/WebCore/kwq/KWQKJobClasses.h b/WebCore/kwq/KWQKJobClasses.h
index 975bfff..a09ac43 100644
--- a/WebCore/kwq/KWQKJobClasses.h
+++ b/WebCore/kwq/KWQKJobClasses.h
@@ -36,6 +36,8 @@
 
 namespace KIO {
 
+class TransferJobPrivate;
+
 // class Job ===================================================================
 
 class Job : public QObject {
@@ -147,17 +149,18 @@ public:
     TransferJob() {}
 #endif
 
-// add no-op destructor
-#ifdef _KWQ_PEDANTIC_
-    ~TransferJob() {}
-#endif
+    ~TransferJob();
 
     // member functions --------------------------------------------------------
 
     bool isErrorPage() const;
+    QString queryMetaData(const QString &key);
     void addMetaData(const QString &key, const QString &value);
     void kill(bool quietly=TRUE);
 
+    // this is special sauce for our implementation
+    void begin();
+
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -167,8 +170,8 @@ private:
     KURL _url;
     bool _reload;
     bool _showProgressInfo;
-
-    void doLoad();
+    int _status;
+    TransferJobPrivate *d;
 
 // add copy constructor
 // this private declaration prevents copying
diff --git a/WebCore/kwq/KWQKJobClasses.mm b/WebCore/kwq/KWQKJobClasses.mm
index eadb46c..1d8d3aa 100644
--- a/WebCore/kwq/KWQKJobClasses.mm
+++ b/WebCore/kwq/KWQKJobClasses.mm
@@ -23,8 +23,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#include <qstring.h>
 #include <jobclasses.h>
 
+#include <Foundation/Foundation.h>
+#include <WCURICache.h>
+
 namespace KIO {
 
 // class Job ===================================================================
@@ -61,32 +65,97 @@ SimpleJob::~SimpleJob()
 }
 
 
+// class TransferJobPrivate ====================================================
+
+class TransferJobPrivate
+{
+friend class TransferJob;
+public:
+
+    TransferJobPrivate(TransferJob *parent, KURL &kurl) {
+        metaData = [[NSMutableDictionary alloc] initWithCapacity:37];
+
+        // FIXME: create NSURL for now, later KURL and NSURL should play better together
+        NSString *string = [NSString stringWithCString:kurl.url().latin1()];
+        url = [[NSURL URLWithString:string] retain];
+    }
+
+    ~TransferJobPrivate() {
+        [metaData autorelease];
+        [url autorelease];
+        [jobID autorelease];
+    }
+
+private:
+    TransferJob *parent;
+    NSMutableDictionary *metaData;
+    NSURL *url;
+    id <WCURICacheJobID> jobID;
+};
+
 // class TransferJob ===========================================================
 
-TransferJob::TransferJob(const KURL &, bool reload=false, bool showProgressInfo=true)
+TransferJob::TransferJob(const KURL &url, bool reload=false, bool showProgressInfo=true)
 {
+    NSString *string;
+
+    _url = url;
+    _reload = reload;
+    _showProgressInfo = showProgressInfo;
+    _status = 0;
+
+    d = new TransferJobPrivate(this, _url);
 }
 
 
-bool TransferJob::isErrorPage() const
+TransferJob::~TransferJob()
 {
+    delete d;
 }
 
+bool TransferJob::isErrorPage() const
+{
+    return (_status != 0);
+}
 
+QString TransferJob::queryMetaData(const QString &key)
+{
+    NSString *_key;
+    NSString *_value;
+    
+    _key = QSTRING_TO_NSSTRING(key);
+    _value = [d->metaData objectForKey:_key]; 
+    if (!_value) {
+        return QString::null;
+    }
+    else {
+        return NSSTRING_TO_QSTRING(_value);
+    }
+}
+ 
 void TransferJob::addMetaData(const QString &key, const QString &value)
 {
+    NSString *_key = QSTRING_TO_NSSTRING(key);
+    NSString *_value = QSTRING_TO_NSSTRING(value);
+    [d->metaData setObject:_value forKey:_key];
 }
 
-
 void TransferJob::kill(bool quietly=TRUE)
 {
-}
+    id <WCURICache> uriCache;
 
+    uriCache = WCGetDefaultURICache();
+    [uriCache cancelRequest:d->jobID];
+}
 
-void TransferJob::doLoad()
+void TransferJob::begin()
 {
-}
+    id <WCURICache> uriCache;
 
+    uriCache = WCGetDefaultURICache();
+    //FIXME: load uri
+    //[uriCache requestWithURL:d->url requestor:];
+}
 
 } // namespace KIO
 
diff --git a/WebCore/kwq/KWQTextCodec.mm b/WebCore/kwq/KWQTextCodec.mm
index ea0359f..90ae203 100644
--- a/WebCore/kwq/KWQTextCodec.mm
+++ b/WebCore/kwq/KWQTextCodec.mm
@@ -25,6 +25,37 @@
 
 #include <qtextcodec.h>
 
+class QTextCodec;
+
+class KWQSimpleTextCodec : public QTextCodec {
+public:
+
+    virtual ~KWQSimpleTextCodec() {}
+
+    int KWQSimpleTextCodec::mibEnum() const {
+        // FIXME: do real work here
+        return 0;
+    }
+
+    const char *KWQSimpleTextCodec::name() const
+    {
+        // FIXME: do real work here
+        return "KWQSimpleTextCodec";
+    }
+
+};
+
+
+class KWQSimpleTextDecoder : public QTextDecoder {
+public:
+
+    virtual ~KWQSimpleTextDecoder() {}
+
+    QString KWQSimpleTextDecoder::toUnicode(const char *s, int i) {
+        return QString(s);
+    }
+};
+
 // class QTextDecoder ==========================================================
 
 
@@ -37,16 +68,22 @@ QTextDecoder::~QTextDecoder()
 
 QTextCodec *QTextCodec::codecForMib(int)
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextCodec();
 }
 
 
 QTextCodec *QTextCodec::codecForName(const char *, int accuracy=0)
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextCodec();
 }
 
 
 QTextCodec *QTextCodec::codecForLocale()
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextCodec();
 }
 
 
@@ -54,29 +91,34 @@ QTextCodec::~QTextCodec()
 {
 }
 
-
 // member functions --------------------------------------------------------
 
 QTextDecoder *QTextCodec::makeDecoder() const
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextDecoder();
 }
 
 
-QCString QTextCodec::fromUnicode(const QString &) const
+QCString QTextCodec::fromUnicode(const QString &s) const
 {
+    return QCString(s.latin1());
 }
 
 
-QString QTextCodec::toUnicode(const char *, int) const
+QString QTextCodec::toUnicode(const char *s, int) const
 {
+    return QString(s);
 }
 
-QString QTextCodec::toUnicode(const QByteArray &, int) const
+QString QTextCodec::toUnicode(const QByteArray &array, int) const
 {
+    return QString(array);
 }
 
 
-QString QTextCodec::toUnicode(const char *) const
+QString QTextCodec::toUnicode(const char *s) const
 {
+    return QString(s);
 }
 
diff --git a/WebCore/kwq/Makefile.in b/WebCore/kwq/Makefile.in
index 140e5c0..b981dd4 100644
--- a/WebCore/kwq/Makefile.in
+++ b/WebCore/kwq/Makefile.in
@@ -137,9 +137,12 @@ CLEAN_FILES = $(OBJECTS) \
 CMMFLAGS = $(BASECMMFLAGS) \
     -g \
     -I$(TOPSRCDIR) \
+    -I$(TOPSRCDIR)/include \
     -I$(TOPSRCDIR)/src/kdelibs/khtml \
-    -I$(TOPSRCDIR)/src/kdelibs/khtml/misc \
     -I$(TOPSRCDIR)/src/kdelibs/khtml/dom \
+    -I$(TOPSRCDIR)/src/kdelibs/khtml/html \
+    -I$(TOPSRCDIR)/src/kdelibs/khtml/misc \
+    -I$(TOPSRCDIR)/src/kdelibs/khtml/xml \
     -I$(TOPSRCDIR)/src/kwq \
     -I$(TOPSRCDIR)/src/kwq/dcop \
     -I$(TOPSRCDIR)/src/kwq/qt \
diff --git a/WebCore/kwq/kio/jobclasses.h b/WebCore/kwq/kio/jobclasses.h
index 975bfff..a09ac43 100644
--- a/WebCore/kwq/kio/jobclasses.h
+++ b/WebCore/kwq/kio/jobclasses.h
@@ -36,6 +36,8 @@
 
 namespace KIO {
 
+class TransferJobPrivate;
+
 // class Job ===================================================================
 
 class Job : public QObject {
@@ -147,17 +149,18 @@ public:
     TransferJob() {}
 #endif
 
-// add no-op destructor
-#ifdef _KWQ_PEDANTIC_
-    ~TransferJob() {}
-#endif
+    ~TransferJob();
 
     // member functions --------------------------------------------------------
 
     bool isErrorPage() const;
+    QString queryMetaData(const QString &key);
     void addMetaData(const QString &key, const QString &value);
     void kill(bool quietly=TRUE);
 
+    // this is special sauce for our implementation
+    void begin();
+
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -167,8 +170,8 @@ private:
     KURL _url;
     bool _reload;
     bool _showProgressInfo;
-
-    void doLoad();
+    int _status;
+    TransferJobPrivate *d;
 
 // add copy constructor
 // this private declaration prevents copying
diff --git a/WebCore/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj b/WebCore/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj
index 85cee46..9fd6ae7 100644
--- a/WebCore/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj
+++ b/WebCore/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj
@@ -65,6 +65,7 @@
 		};
 		1058C7A2FEA54F0111CA2CBB = {
 			children = (
+				2587FFAC017B21AB0ECA149E,
 				29B97325FDCFA39411CA2CEA,
 				29B97324FDCFA39411CA2CEA,
 			);
@@ -116,6 +117,40 @@
 //192
 //193
 //194
+//250
+//251
+//252
+//253
+//254
+		253C4A130177AF4C0ECA149E = {
+			isa = PBXFileReference;
+			name = draw.mm;
+			path = /Volumes/Shared/Projects/cvs/Labyrinth/WebCore/src/kwq/tests/khtmlview/draw.mm;
+			refType = 0;
+		};
+		253C4A140177AF4C0ECA149E = {
+			fileRef = 253C4A130177AF4C0ECA149E;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		2587FFAC017B21AB0ECA149E = {
+			isa = PBXFrameworkReference;
+			name = WebKit.framework;
+			path = ../../../../../../../../../../../Network/Servers/noether/homes/gandalf/kocienda/symroots/WebKit.framework;
+			refType = 2;
+		};
+		2587FFAD017B21AB0ECA149E = {
+			fileRef = 2587FFAC017B21AB0ECA149E;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+//250
+//251
+//252
+//253
+//254
 //290
 //291
 //292
@@ -148,7 +183,7 @@
 		};
 		29B97315FDCFA39411CA2CEA = {
 			children = (
-				9CE32C34016BAA500ECA16EA,
+				253C4A130177AF4C0ECA149E,
 			);
 			isa = PBXGroup;
 			name = "Other Sources";
@@ -210,7 +245,7 @@
 				29B9732DFDCFA39411CA2CEA,
 			);
 			buildSettings = {
-				FRAMEWORK_SEARCH_PATHS = "";
+				FRAMEWORK_SEARCH_PATHS = /Network/Servers/noether/homes/gandalf/kocienda/symroots;
 				HEADER_SEARCH_PATHS = "";
 				INSTALL_PATH = "$(HOME)/Applications";
 				LIBRARY_SEARCH_PATHS = "";
@@ -274,7 +309,7 @@
 		29B9732BFDCFA39411CA2CEA = {
 			buildActionMask = 2147483647;
 			files = (
-				9CE32C35016BAA500ECA16EA,
+				253C4A140177AF4C0ECA149E,
 			);
 			isa = PBXSourcesBuildPhase;
 			name = Sources;
@@ -283,6 +318,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				1058C7A3FEA54F0111CA2CBB,
+				2587FFAD017B21AB0ECA149E,
 			);
 			isa = PBXFrameworksBuildPhase;
 			name = "Frameworks & Libraries";
@@ -316,28 +352,6 @@
 			isa = PBXBuildStyle;
 			name = Deployment;
 		};
-//4A0
-//4A1
-//4A2
-//4A3
-//4A4
-//9C0
-//9C1
-//9C2
-//9C3
-//9C4
-		9CE32C34016BAA500ECA16EA = {
-			isa = PBXFileReference;
-			name = draw.mm;
-			path = /Network/Servers/abel/homes/gimli/rjw/src/Labyrinth/WebPageView/src/kwq/tests/khtmlview/draw.mm;
-			refType = 0;
-		};
-		9CE32C35016BAA500ECA16EA = {
-			fileRef = 9CE32C34016BAA500ECA16EA;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 	};
 	rootObject = 29B97313FDCFA39411CA2CEA;
 }
diff --git a/WebCore/src/kwq/KWQCString.mm b/WebCore/src/kwq/KWQCString.mm
index a991f07..bb48df7 100644
--- a/WebCore/src/kwq/KWQCString.mm
+++ b/WebCore/src/kwq/KWQCString.mm
@@ -322,6 +322,25 @@ QCString &QCString::operator+=(char c)
     return *this;
 }
 
+bool operator==(const char *s1, const QCString &s2)
+{
+    return (strcmp(s1, s2) == 0);
+}
+
+bool operator==(const QCString &s1, const char *s2)
+{
+    return (strcmp(s1, s2) == 0);
+}
+
+bool operator!=(const char *s1, const QCString &s2)
+{
+    return (strcmp(s1, s2) != 0);
+}
+
+bool operator!=(const QCString &s1, const char *s2)
+{
+    return (strcmp(s1, s2) != 0);
+}
 
 #ifdef _KWQ_IOSTREAM_
 ostream &operator<<(ostream &o, const QCString &s)
diff --git a/WebCore/src/kwq/KWQKCharsets.mm b/WebCore/src/kwq/KWQKCharsets.mm
index dc31b8a..a64b703 100644
--- a/WebCore/src/kwq/KWQKCharsets.mm
+++ b/WebCore/src/kwq/KWQKCharsets.mm
@@ -25,7 +25,7 @@
 #include <kwqdebug.h>
 
 #include <qstring.h>
-
+#include <qtextcodec.h>
 #include <kcharsets.h>
 
 KCharsets::KCharsets()
@@ -40,15 +40,19 @@ KCharsets::~KCharsets()
 }
 
 
-QTextCodec *KCharsets::codecForName(const QString &) const
+QTextCodec *KCharsets::codecForName(const QString &s) const
 {
-    _logNotYetImplemented();
+    //_logNotYetImplemented();
+    // FIXME: implement correctly
+    QTextCodec::codecForName(s.latin1());
 }
 
 
-QTextCodec *KCharsets::codecForName(const QString &, bool &) const
+QTextCodec *KCharsets::codecForName(const QString &s, bool &b) const
 {
-    _logNotYetImplemented();
+    //_logNotYetImplemented();
+    // FIXME: implement correctly
+    QTextCodec::codecForName(s.latin1());
 }
 
 
diff --git a/WebCore/src/kwq/KWQKHTMLPart.mm b/WebCore/src/kwq/KWQKHTMLPart.mm
index 0b0154b..09dff27 100644
--- a/WebCore/src/kwq/KWQKHTMLPart.mm
+++ b/WebCore/src/kwq/KWQKHTMLPart.mm
@@ -28,14 +28,49 @@
 #include <qfont.h>
 #include <qtextcodec.h>
 
+#include <Foundation/Foundation.h>
+
+#include <job.h>
+#include <jobclasses.h>
 #include <khtml_settings.h>
 #include <khtml_factory.h>
 #include <kcharsets.h>
 #include <kglobal.h>
 #include <html/htmltokenizer.h>
 #include <xml/dom_docimpl.h>
+#include <html/html_documentimpl.h>
+#include <loader.h>
 
 #include <KWQKHTMLPart.h>
+#import <WCURICacheData.h>
+
+static bool cache_init = false;
+
+// Class KHTMLPartNotificationReceiver ==============================================================
+
+ at interface KHTMLPartNotificationReceiver : NSObject
+{
+    @public
+    KHTMLPart *m_part;
+}
+ at end
+
+ at implementation KHTMLPartNotificationReceiver
+
+-(void)cacheDataAvailable:(NSNotification *)notification
+{
+    id <WCURICacheData> data;
+    
+    data = [notification object];
+    m_part->write((const char *)[data cacheData], [data cacheDataSize]);    
+}
+
+-(void)cacheFinished:(NSNotification *)notification
+{
+    // FIXME: need an implementation for this
+}
+
+ at end
 
 // Class KHTMLPartPrivate ================================================================================
 
@@ -48,21 +83,37 @@ public:
     QString m_encoding;
     QFont::CharSet m_charset;
     KHTMLSettings *m_settings;
-
+    
     KURL m_workingURL;
+    
+    KHTMLPart *m_part;
+    KHTMLPartNotificationReceiver *m_recv;
 
     bool m_bFirstData:1;
     bool m_haveEncoding:1;
     bool m_haveCharset:1;
-    
-    KHTMLPartPrivate()
+
+    KHTMLPartPrivate(KHTMLPart *part)
     {
-        m_doc = 0L;
+        if (!cache_init) {
+            khtml::Cache::init();
+            cache_init = true;
+        }
+        m_part = part;
+        m_doc = new HTMLDocumentImpl(NULL);
         m_decoder = 0L;
         m_bFirstData = true;
         m_settings = new KHTMLSettings(*KHTMLFactory::defaultHTMLSettings());
         m_haveEncoding = false;
+        m_recv = [[KHTMLPartNotificationReceiver alloc] init];
+        m_recv->m_part = part;
+    }
+
+    ~KHTMLPartPrivate()
+    {
+        [m_recv autorelease];   
     }
+
 };
 
 
@@ -81,12 +132,13 @@ KHTMLPart::KHTMLPart(const KURL &url )
 
 void KHTMLPart::init()
 {
-    d = new KHTMLPartPrivate();
+    d = new KHTMLPartPrivate(this);
 }
 
 
 KHTMLPart::~KHTMLPart()
 {
+    delete d;
     _logNotYetImplemented();
 }
 
@@ -112,12 +164,12 @@ bool KHTMLPart::openURL( const KURL &url )
     //        SLOT( slotRedirection(KIO::Job*,const KURL&) ) );
     
     // Initiate request for URL data.
-    
-    // Setup callbacks for incoming data.
+    //d->m_job = KIO::get( url, false, false );
+    //d->m_job = KIO::get( url, false, false );
     
     // Keep a reference to the current working URL.
     d->m_workingURL = url;
-        
+
     return true;
 }
 
@@ -254,8 +306,9 @@ void KHTMLPart::write( const char *str, int len)
         d->m_decoder = new khtml::Decoder();
         if(d->m_encoding != QString::null)
             d->m_decoder->setEncoding(d->m_encoding.latin1(), d->m_haveEncoding);
-        else
-            d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+        else {
+            //FIXME: d->m_decoder->setEncoding(settings()->encoding().latin1(), d->m_haveEncoding);
+        }
     }
     if ( len == 0 )
         return;
@@ -682,5 +735,3 @@ void KHTMLPart::overURL( const QString &url, const QString &target )
     _logNeverImplemented();
 }
 
-
-
diff --git a/WebCore/src/kwq/KWQKJob.mm b/WebCore/src/kwq/KWQKJob.mm
index f79ab9a..64fb272 100644
--- a/WebCore/src/kwq/KWQKJob.mm
+++ b/WebCore/src/kwq/KWQKJob.mm
@@ -25,16 +25,20 @@
 
 #include <job.h>
 
-
 namespace KIO {
 
 SimpleJob *http_update_cache(const KURL &, bool, time_t)
 {
 }
 
-TransferJob *get(const KURL &url, bool reload=false, 
-    bool showProgressInfo=true)
+TransferJob *get(const KURL &url, bool reload=false, bool showProgressInfo=true)
 {
+    TransferJob *result;
+    
+    result = new TransferJob(url, reload, showProgressInfo);
+    result->begin();
+
+    return result;
 }
 
 } // namespace KIO
diff --git a/WebCore/src/kwq/KWQKjobclasses.mm b/WebCore/src/kwq/KWQKjobclasses.mm
index eadb46c..1d8d3aa 100644
--- a/WebCore/src/kwq/KWQKjobclasses.mm
+++ b/WebCore/src/kwq/KWQKjobclasses.mm
@@ -23,8 +23,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+#include <qstring.h>
 #include <jobclasses.h>
 
+#include <Foundation/Foundation.h>
+#include <WCURICache.h>
+
 namespace KIO {
 
 // class Job ===================================================================
@@ -61,32 +65,97 @@ SimpleJob::~SimpleJob()
 }
 
 
+// class TransferJobPrivate ====================================================
+
+class TransferJobPrivate
+{
+friend class TransferJob;
+public:
+
+    TransferJobPrivate(TransferJob *parent, KURL &kurl) {
+        metaData = [[NSMutableDictionary alloc] initWithCapacity:37];
+
+        // FIXME: create NSURL for now, later KURL and NSURL should play better together
+        NSString *string = [NSString stringWithCString:kurl.url().latin1()];
+        url = [[NSURL URLWithString:string] retain];
+    }
+
+    ~TransferJobPrivate() {
+        [metaData autorelease];
+        [url autorelease];
+        [jobID autorelease];
+    }
+
+private:
+    TransferJob *parent;
+    NSMutableDictionary *metaData;
+    NSURL *url;
+    id <WCURICacheJobID> jobID;
+};
+
 // class TransferJob ===========================================================
 
-TransferJob::TransferJob(const KURL &, bool reload=false, bool showProgressInfo=true)
+TransferJob::TransferJob(const KURL &url, bool reload=false, bool showProgressInfo=true)
 {
+    NSString *string;
+
+    _url = url;
+    _reload = reload;
+    _showProgressInfo = showProgressInfo;
+    _status = 0;
+
+    d = new TransferJobPrivate(this, _url);
 }
 
 
-bool TransferJob::isErrorPage() const
+TransferJob::~TransferJob()
 {
+    delete d;
 }
 
+bool TransferJob::isErrorPage() const
+{
+    return (_status != 0);
+}
 
+QString TransferJob::queryMetaData(const QString &key)
+{
+    NSString *_key;
+    NSString *_value;
+    
+    _key = QSTRING_TO_NSSTRING(key);
+    _value = [d->metaData objectForKey:_key]; 
+    if (!_value) {
+        return QString::null;
+    }
+    else {
+        return NSSTRING_TO_QSTRING(_value);
+    }
+}
+ 
 void TransferJob::addMetaData(const QString &key, const QString &value)
 {
+    NSString *_key = QSTRING_TO_NSSTRING(key);
+    NSString *_value = QSTRING_TO_NSSTRING(value);
+    [d->metaData setObject:_value forKey:_key];
 }
 
-
 void TransferJob::kill(bool quietly=TRUE)
 {
-}
+    id <WCURICache> uriCache;
 
+    uriCache = WCGetDefaultURICache();
+    [uriCache cancelRequest:d->jobID];
+}
 
-void TransferJob::doLoad()
+void TransferJob::begin()
 {
-}
+    id <WCURICache> uriCache;
 
+    uriCache = WCGetDefaultURICache();
+    //FIXME: load uri
+    //[uriCache requestWithURL:d->url requestor:];
+}
 
 } // namespace KIO
 
diff --git a/WebCore/src/kwq/KWQtextcodec.mm b/WebCore/src/kwq/KWQtextcodec.mm
index ea0359f..90ae203 100644
--- a/WebCore/src/kwq/KWQtextcodec.mm
+++ b/WebCore/src/kwq/KWQtextcodec.mm
@@ -25,6 +25,37 @@
 
 #include <qtextcodec.h>
 
+class QTextCodec;
+
+class KWQSimpleTextCodec : public QTextCodec {
+public:
+
+    virtual ~KWQSimpleTextCodec() {}
+
+    int KWQSimpleTextCodec::mibEnum() const {
+        // FIXME: do real work here
+        return 0;
+    }
+
+    const char *KWQSimpleTextCodec::name() const
+    {
+        // FIXME: do real work here
+        return "KWQSimpleTextCodec";
+    }
+
+};
+
+
+class KWQSimpleTextDecoder : public QTextDecoder {
+public:
+
+    virtual ~KWQSimpleTextDecoder() {}
+
+    QString KWQSimpleTextDecoder::toUnicode(const char *s, int i) {
+        return QString(s);
+    }
+};
+
 // class QTextDecoder ==========================================================
 
 
@@ -37,16 +68,22 @@ QTextDecoder::~QTextDecoder()
 
 QTextCodec *QTextCodec::codecForMib(int)
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextCodec();
 }
 
 
 QTextCodec *QTextCodec::codecForName(const char *, int accuracy=0)
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextCodec();
 }
 
 
 QTextCodec *QTextCodec::codecForLocale()
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextCodec();
 }
 
 
@@ -54,29 +91,34 @@ QTextCodec::~QTextCodec()
 {
 }
 
-
 // member functions --------------------------------------------------------
 
 QTextDecoder *QTextCodec::makeDecoder() const
 {
+    // FIXME: do real work here
+    return new KWQSimpleTextDecoder();
 }
 
 
-QCString QTextCodec::fromUnicode(const QString &) const
+QCString QTextCodec::fromUnicode(const QString &s) const
 {
+    return QCString(s.latin1());
 }
 
 
-QString QTextCodec::toUnicode(const char *, int) const
+QString QTextCodec::toUnicode(const char *s, int) const
 {
+    return QString(s);
 }
 
-QString QTextCodec::toUnicode(const QByteArray &, int) const
+QString QTextCodec::toUnicode(const QByteArray &array, int) const
 {
+    return QString(array);
 }
 
 
-QString QTextCodec::toUnicode(const char *) const
+QString QTextCodec::toUnicode(const char *s) const
 {
+    return QString(s);
 }
 
diff --git a/WebCore/src/kwq/Makefile.in b/WebCore/src/kwq/Makefile.in
index 140e5c0..b981dd4 100644
--- a/WebCore/src/kwq/Makefile.in
+++ b/WebCore/src/kwq/Makefile.in
@@ -137,9 +137,12 @@ CLEAN_FILES = $(OBJECTS) \
 CMMFLAGS = $(BASECMMFLAGS) \
     -g \
     -I$(TOPSRCDIR) \
+    -I$(TOPSRCDIR)/include \
     -I$(TOPSRCDIR)/src/kdelibs/khtml \
-    -I$(TOPSRCDIR)/src/kdelibs/khtml/misc \
     -I$(TOPSRCDIR)/src/kdelibs/khtml/dom \
+    -I$(TOPSRCDIR)/src/kdelibs/khtml/html \
+    -I$(TOPSRCDIR)/src/kdelibs/khtml/misc \
+    -I$(TOPSRCDIR)/src/kdelibs/khtml/xml \
     -I$(TOPSRCDIR)/src/kwq \
     -I$(TOPSRCDIR)/src/kwq/dcop \
     -I$(TOPSRCDIR)/src/kwq/qt \
diff --git a/WebCore/src/kwq/kio/jobclasses.h b/WebCore/src/kwq/kio/jobclasses.h
index 975bfff..a09ac43 100644
--- a/WebCore/src/kwq/kio/jobclasses.h
+++ b/WebCore/src/kwq/kio/jobclasses.h
@@ -36,6 +36,8 @@
 
 namespace KIO {
 
+class TransferJobPrivate;
+
 // class Job ===================================================================
 
 class Job : public QObject {
@@ -147,17 +149,18 @@ public:
     TransferJob() {}
 #endif
 
-// add no-op destructor
-#ifdef _KWQ_PEDANTIC_
-    ~TransferJob() {}
-#endif
+    ~TransferJob();
 
     // member functions --------------------------------------------------------
 
     bool isErrorPage() const;
+    QString queryMetaData(const QString &key);
     void addMetaData(const QString &key, const QString &value);
     void kill(bool quietly=TRUE);
 
+    // this is special sauce for our implementation
+    void begin();
+
     // operators ---------------------------------------------------------------
 
 // protected -------------------------------------------------------------------
@@ -167,8 +170,8 @@ private:
     KURL _url;
     bool _reload;
     bool _showProgressInfo;
-
-    void doLoad();
+    int _status;
+    TransferJobPrivate *d;
 
 // add copy constructor
 // this private declaration prevents copying
diff --git a/WebCore/src/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj b/WebCore/src/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj
index 85cee46..9fd6ae7 100644
--- a/WebCore/src/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj
+++ b/WebCore/src/kwq/tests/khtmlview/WebViewTest/WebViewTest.pbproj/project.pbxproj
@@ -65,6 +65,7 @@
 		};
 		1058C7A2FEA54F0111CA2CBB = {
 			children = (
+				2587FFAC017B21AB0ECA149E,
 				29B97325FDCFA39411CA2CEA,
 				29B97324FDCFA39411CA2CEA,
 			);
@@ -116,6 +117,40 @@
 //192
 //193
 //194
+//250
+//251
+//252
+//253
+//254
+		253C4A130177AF4C0ECA149E = {
+			isa = PBXFileReference;
+			name = draw.mm;
+			path = /Volumes/Shared/Projects/cvs/Labyrinth/WebCore/src/kwq/tests/khtmlview/draw.mm;
+			refType = 0;
+		};
+		253C4A140177AF4C0ECA149E = {
+			fileRef = 253C4A130177AF4C0ECA149E;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		2587FFAC017B21AB0ECA149E = {
+			isa = PBXFrameworkReference;
+			name = WebKit.framework;
+			path = ../../../../../../../../../../../Network/Servers/noether/homes/gandalf/kocienda/symroots/WebKit.framework;
+			refType = 2;
+		};
+		2587FFAD017B21AB0ECA149E = {
+			fileRef = 2587FFAC017B21AB0ECA149E;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+//250
+//251
+//252
+//253
+//254
 //290
 //291
 //292
@@ -148,7 +183,7 @@
 		};
 		29B97315FDCFA39411CA2CEA = {
 			children = (
-				9CE32C34016BAA500ECA16EA,
+				253C4A130177AF4C0ECA149E,
 			);
 			isa = PBXGroup;
 			name = "Other Sources";
@@ -210,7 +245,7 @@
 				29B9732DFDCFA39411CA2CEA,
 			);
 			buildSettings = {
-				FRAMEWORK_SEARCH_PATHS = "";
+				FRAMEWORK_SEARCH_PATHS = /Network/Servers/noether/homes/gandalf/kocienda/symroots;
 				HEADER_SEARCH_PATHS = "";
 				INSTALL_PATH = "$(HOME)/Applications";
 				LIBRARY_SEARCH_PATHS = "";
@@ -274,7 +309,7 @@
 		29B9732BFDCFA39411CA2CEA = {
 			buildActionMask = 2147483647;
 			files = (
-				9CE32C35016BAA500ECA16EA,
+				253C4A140177AF4C0ECA149E,
 			);
 			isa = PBXSourcesBuildPhase;
 			name = Sources;
@@ -283,6 +318,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				1058C7A3FEA54F0111CA2CBB,
+				2587FFAD017B21AB0ECA149E,
 			);
 			isa = PBXFrameworksBuildPhase;
 			name = "Frameworks & Libraries";
@@ -316,28 +352,6 @@
 			isa = PBXBuildStyle;
 			name = Deployment;
 		};
-//4A0
-//4A1
-//4A2
-//4A3
-//4A4
-//9C0
-//9C1
-//9C2
-//9C3
-//9C4
-		9CE32C34016BAA500ECA16EA = {
-			isa = PBXFileReference;
-			name = draw.mm;
-			path = /Network/Servers/abel/homes/gimli/rjw/src/Labyrinth/WebPageView/src/kwq/tests/khtmlview/draw.mm;
-			refType = 0;
-		};
-		9CE32C35016BAA500ECA16EA = {
-			fileRef = 9CE32C34016BAA500ECA16EA;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 	};
 	rootObject = 29B97313FDCFA39411CA2CEA;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list