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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:40:43 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 7abad7df79fdce4373e79f4b13fe2bda4300d959
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 21 00:42:33 2002 +0000

            * kwq/KWQFileButton.h: Add an icon.
            * kwq/KWQFileButton.mm:
            (KWQFileButton::KWQFileButton): Nil out icon.
            (KWQFileButton::~KWQFileButton): Release icon.
            (KWQFileButton::setFilename): Get icon with [NSWorkspace iconForFile:].
            (KWQFileButton::clicked): Set prompt string to "Choose", and start directory to "~".
            (KWQFileButton::sizeHint): Pad more for icon width.
            (KWQFileButton::frameGeometry): Ditto.
            (KWQFileButton::setFrameGeometry): Ditto.
            (KWQFileButton::paint): Draw icon. Draw "no file selected" if no filename.
    
            * kwq/KWQKFileItem.mm: Our "nonimplementation" is good enough. Stop complaining.
            * kwq/KWQKnetaccess.mm: Ditto. Also just extract path when asked to download.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2109 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 096148e..f02a2ea 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,21 @@
 2002-09-20  Darin Adler  <darin at apple.com>
 
+        * kwq/KWQFileButton.h: Add an icon.
+        * kwq/KWQFileButton.mm:
+        (KWQFileButton::KWQFileButton): Nil out icon.
+        (KWQFileButton::~KWQFileButton): Release icon.
+        (KWQFileButton::setFilename): Get icon with [NSWorkspace iconForFile:].
+        (KWQFileButton::clicked): Set prompt string to "Choose", and start directory to "~".
+        (KWQFileButton::sizeHint): Pad more for icon width.
+        (KWQFileButton::frameGeometry): Ditto.
+        (KWQFileButton::setFrameGeometry): Ditto.
+        (KWQFileButton::paint): Draw icon. Draw "no file selected" if no filename.
+
+        * kwq/KWQKFileItem.mm: Our "nonimplementation" is good enough. Stop complaining.
+        * kwq/KWQKnetaccess.mm: Ditto. Also just extract path when asked to download.
+
+2002-09-20  Darin Adler  <darin at apple.com>
+
 	Some first steps toward implementing input=file.
 
         * khtml/rendering/render_form.cpp:
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 096148e..f02a2ea 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,21 @@
 2002-09-20  Darin Adler  <darin at apple.com>
 
+        * kwq/KWQFileButton.h: Add an icon.
+        * kwq/KWQFileButton.mm:
+        (KWQFileButton::KWQFileButton): Nil out icon.
+        (KWQFileButton::~KWQFileButton): Release icon.
+        (KWQFileButton::setFilename): Get icon with [NSWorkspace iconForFile:].
+        (KWQFileButton::clicked): Set prompt string to "Choose", and start directory to "~".
+        (KWQFileButton::sizeHint): Pad more for icon width.
+        (KWQFileButton::frameGeometry): Ditto.
+        (KWQFileButton::setFrameGeometry): Ditto.
+        (KWQFileButton::paint): Draw icon. Draw "no file selected" if no filename.
+
+        * kwq/KWQKFileItem.mm: Our "nonimplementation" is good enough. Stop complaining.
+        * kwq/KWQKnetaccess.mm: Ditto. Also just extract path when asked to download.
+
+2002-09-20  Darin Adler  <darin at apple.com>
+
 	Some first steps toward implementing input=file.
 
         * khtml/rendering/render_form.cpp:
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 096148e..f02a2ea 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,21 @@
 2002-09-20  Darin Adler  <darin at apple.com>
 
+        * kwq/KWQFileButton.h: Add an icon.
+        * kwq/KWQFileButton.mm:
+        (KWQFileButton::KWQFileButton): Nil out icon.
+        (KWQFileButton::~KWQFileButton): Release icon.
+        (KWQFileButton::setFilename): Get icon with [NSWorkspace iconForFile:].
+        (KWQFileButton::clicked): Set prompt string to "Choose", and start directory to "~".
+        (KWQFileButton::sizeHint): Pad more for icon width.
+        (KWQFileButton::frameGeometry): Ditto.
+        (KWQFileButton::setFrameGeometry): Ditto.
+        (KWQFileButton::paint): Draw icon. Draw "no file selected" if no filename.
+
+        * kwq/KWQKFileItem.mm: Our "nonimplementation" is good enough. Stop complaining.
+        * kwq/KWQKnetaccess.mm: Ditto. Also just extract path when asked to download.
+
+2002-09-20  Darin Adler  <darin at apple.com>
+
 	Some first steps toward implementing input=file.
 
         * khtml/rendering/render_form.cpp:
diff --git a/WebCore/kwq/KWQFileButton.h b/WebCore/kwq/KWQFileButton.h
index 34f7ea5..2273d07 100644
--- a/WebCore/kwq/KWQFileButton.h
+++ b/WebCore/kwq/KWQFileButton.h
@@ -30,8 +30,10 @@
 
 #ifdef __OBJC__
 @class KWQFileButtonAdapter;
+ at class NSImage;
 #else
 class KWQFileButtonAdapter;
+class NSImage;
 #endif
 
 class KWQFileButton : public QPushButton {
@@ -54,6 +56,7 @@ private:
     KWQSignal _textChanged;
     QString _filename;
     KWQFileButtonAdapter *_adapter;
+    NSImage *_icon;
 };
 
 #endif
diff --git a/WebCore/kwq/KWQFileButton.mm b/WebCore/kwq/KWQFileButton.mm
index d41496d..a2660db 100644
--- a/WebCore/kwq/KWQFileButton.mm
+++ b/WebCore/kwq/KWQFileButton.mm
@@ -25,8 +25,14 @@
 
 #import "KWQFileButton.h"
 
-#define BUTTON_FILENAME_SPACING 4
+#define AFTER_BUTTON_SPACING 4
+#define ICON_HEIGHT 16
+#define ICON_WIDTH 16
+#define ICON_FILENAME_SPACING 2
 #define FILENAME_WIDTH 200
+
+#define ADDITIONAL_WIDTH (AFTER_BUTTON_SPACING + ICON_WIDTH + ICON_FILENAME_SPACING + FILENAME_WIDTH)
+
 #define FONT_FAMILY ("Lucida Grande")
 
 // FIXME: Clicks on the text should pull up the sheet too.
@@ -46,6 +52,7 @@ KWQFileButton::KWQFileButton()
     : QPushButton("Choose File", 0)
     , _textChanged(this, SIGNAL(textChanged(const QString &)))
     , _adapter([[KWQFileButtonAdapter alloc] initWithKWQFileButton:this])
+    , _icon(nil)
 {
 }
 
@@ -53,6 +60,7 @@ KWQFileButton::~KWQFileButton()
 {
     _adapter->button = 0;
     [_adapter release];
+    [_icon release];
 }
     
 void KWQFileButton::setFilename(const QString &f)
@@ -63,10 +71,14 @@ void KWQFileButton::setFilename(const QString &f)
     _filename = f;
     _textChanged.call(_filename);
     
-    // Dirty the filename part of the view.
+    // Get the icon.
+    [_icon release];
+    _icon = [[[NSWorkspace sharedWorkspace] iconForFile:_filename.getNSString()] retain];
+    
+    // Dirty the part of the view past the button, including the icon and text.
     QRect r = QPushButton::frameGeometry();
-    r.setX(r.x() + r.width() + BUTTON_FILENAME_SPACING);
-    r.setWidth(FILENAME_WIDTH);
+    r.setX(r.x() + r.width() + AFTER_BUTTON_SPACING);
+    r.setWidth(ADDITIONAL_WIDTH - AFTER_BUTTON_SPACING);
     [[getView() superview] setNeedsDisplayInRect:frameGeometry()];
 }
 
@@ -74,9 +86,11 @@ void KWQFileButton::clicked()
 {
     NSOpenPanel *sheet = [NSOpenPanel openPanel];
     
+    [sheet setPrompt:@"Choose"];
+    
     [_adapter retain];
     
-    [sheet beginSheetForDirectory:@"" file:@"" types:nil
+    [sheet beginSheetForDirectory:@"~" file:@"" types:nil
         modalForWindow:[getView() window] modalDelegate:_adapter
         didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
         contextInfo:nil];
@@ -87,21 +101,21 @@ void KWQFileButton::clicked()
 QSize KWQFileButton::sizeHint() const 
 {
     QSize s = QPushButton::sizeHint();
-    s.setWidth(s.width() + (BUTTON_FILENAME_SPACING + FILENAME_WIDTH));
+    s.setWidth(s.width() + ADDITIONAL_WIDTH);
     return s;
 }
 
 QRect KWQFileButton::frameGeometry() const
 {
     QRect r = QPushButton::frameGeometry();
-    r.setWidth(r.width() + (BUTTON_FILENAME_SPACING + FILENAME_WIDTH));
+    r.setWidth(r.width() + ADDITIONAL_WIDTH);
     return r;
 }
 
 void KWQFileButton::setFrameGeometry(const QRect &rect)
 {
     QRect r = rect;
-    r.setWidth(r.width() - (BUTTON_FILENAME_SPACING + FILENAME_WIDTH));
+    r.setWidth(r.width() - ADDITIONAL_WIDTH);
     QPushButton::setFrameGeometry(r);
 }
 
@@ -114,12 +128,25 @@ void KWQFileButton::paint()
 {
     QPushButton::paint();
     
-    QString leafName = _filename;
-    int slashPosition = leafName.findRev('/');
-    if (slashPosition >= 0 || leafName == "/") {
-        leafName.remove(0, slashPosition + 1);
+    QString text = _filename;
+    if (text.isEmpty()) {
+        text = "no file selected";
+    } else {
+        int slashPosition = text.findRev('/');
+        if (slashPosition >= 0 || text == "/") {
+            text.remove(0, slashPosition + 1);
+        }
     }
     
+    int left = x() + width() - ADDITIONAL_WIDTH + AFTER_BUTTON_SPACING;
+
+    if (_icon) {
+        [_icon drawInRect:NSMakeRect(left, y() + (height() - ICON_HEIGHT) / 2, ICON_WIDTH, ICON_HEIGHT)
+            fromRect:NSMakeRect(0, 0, [_icon size].width, [_icon size].height)
+            operation:NSCompositeSourceOver fraction:1.0];
+        left += ICON_WIDTH + ICON_FILENAME_SPACING;
+    }
+
     // FIXME: Use same font as button, don't hardcode Lucida Grande.
     // FIXME: Ellipsize the text to fit in the box.
     QPainter painter;
@@ -129,7 +156,7 @@ void KWQFileButton::paint()
     painter.save(); // wouldn't be needed in real Qt, but we need it
     painter.addClip(frameGeometry());
     painter.setFont(font);
-    painter.drawText(x() + width() - FILENAME_WIDTH, y() + baselinePosition(), 0, 0, 0, leafName);
+    painter.drawText(left, y() + baselinePosition(), 0, 0, 0, text);
     painter.restore(); // wouldn't be needed in real Qt, but we need it
 }
 
diff --git a/WebCore/kwq/KWQKFileItem.mm b/WebCore/kwq/KWQKFileItem.mm
index 9c73d77..78df31a 100644
--- a/WebCore/kwq/KWQKFileItem.mm
+++ b/WebCore/kwq/KWQKFileItem.mm
@@ -29,13 +29,11 @@
 
 KFileItem::KFileItem(const KIO::UDSEntry &, const KURL &, bool, bool)
 {
-    ERROR("not yet implemented");
 }
 
 bool KFileItem::isDir() const
 {
-    ERROR("not yet implemented");
-    return FALSE;
+    return false;
 }
 
 
diff --git a/WebCore/kwq/KWQKIONetAccess.mm b/WebCore/kwq/KWQKIONetAccess.mm
index d68727c..de80368 100644
--- a/WebCore/kwq/KWQKIONetAccess.mm
+++ b/WebCore/kwq/KWQKIONetAccess.mm
@@ -26,39 +26,29 @@
 #import <KWQLogging.h>
 #import <netaccess.h>
 
-//FIX ME:
-static QString *tempQString;
-
 namespace KIO {
 
 bool NetAccess::stat(const KURL &, KIO::UDSEntry &)
 {
-    ERROR("not yet implemented");
-    return FALSE;
+    return true;
 }
 
 
 QString NetAccess::lastErrorString()
 {
-    ERROR("not yet implemented");
-    if (tempQString == NULL) {
-	tempQString = new QString();
-    }
-
-    return *tempQString;
+    return QString::null;
 }
 
 
-bool NetAccess::download(const KURL &, QString &)
+bool NetAccess::download(const KURL &url, QString &filename)
 {
-    ERROR("not yet implemented");
-    return FALSE;
+    filename = url.path();
+    return true;
 }
 
 
 void NetAccess::removeTempFile(const QString &)
 {
-    ERROR("not yet implemented");
 }
 
 } // namespace KIO
diff --git a/WebCore/kwq/KWQKnetaccess.mm b/WebCore/kwq/KWQKnetaccess.mm
index d68727c..de80368 100644
--- a/WebCore/kwq/KWQKnetaccess.mm
+++ b/WebCore/kwq/KWQKnetaccess.mm
@@ -26,39 +26,29 @@
 #import <KWQLogging.h>
 #import <netaccess.h>
 
-//FIX ME:
-static QString *tempQString;
-
 namespace KIO {
 
 bool NetAccess::stat(const KURL &, KIO::UDSEntry &)
 {
-    ERROR("not yet implemented");
-    return FALSE;
+    return true;
 }
 
 
 QString NetAccess::lastErrorString()
 {
-    ERROR("not yet implemented");
-    if (tempQString == NULL) {
-	tempQString = new QString();
-    }
-
-    return *tempQString;
+    return QString::null;
 }
 
 
-bool NetAccess::download(const KURL &, QString &)
+bool NetAccess::download(const KURL &url, QString &filename)
 {
-    ERROR("not yet implemented");
-    return FALSE;
+    filename = url.path();
+    return true;
 }
 
 
 void NetAccess::removeTempFile(const QString &)
 {
-    ERROR("not yet implemented");
 }
 
 } // namespace KIO

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list