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

List:       kde-commits
Subject:    kdelibs/khtml/rendering
From:       Lars Knoll <knoll () kde ! org>
Date:       2003-09-07 20:52:29
[Download RAW message or body]

CVS commit by knoll: 

fix most of the issues with <input type=file>


  M +25 -1     render_form.cpp   1.234
  M +6 -5      render_form.h   1.99


--- kdelibs/khtml/rendering/render_form.cpp  #1.233:1.234
@@ -729,4 +729,6 @@ public:
         setMask(mask);
     }
+protected:
+    virtual void paintEvent(QPaintEvent *);
 
 private:
@@ -734,4 +736,14 @@ private:
 };
 
+void TransHBox::paintEvent(QPaintEvent *)
+{
+    QPainter p(this);
+    QWidget *w = m_owner->lineEdit();
+    RenderWidget::paintWidget(&p, w, 0, 0, width(), height(), w->x(), w->y());
+    w = const_cast<QPushButton *>(m_owner->pushButton());
+    RenderWidget::paintWidget(&p, w, 0, 0, width(), height(), w->x(), w->y());
+}
+
+
 RenderFileButton::RenderFileButton(HTMLInputElementImpl *element)
     : RenderFormElement(element)
@@ -750,4 +762,5 @@ RenderFileButton::RenderFileButton(HTMLI
     m_button = new QPushButton(i18n("Browse..."), w);
     m_button->setFocusPolicy(QWidget::ClickFocus);
+    connect(m_button,SIGNAL(clicked()), this, SLOT(slotClicked()));
 
     w->setStretchFactor(m_edit, 2);
@@ -806,4 +821,13 @@ void RenderFileButton::slotReturnPressed
     if (element()->form())
         element()->form()->submitFromKeyboard();
+}
+
+void RenderFileButton::slotClicked()
+{
+    QString file_name = KFileDialog::getOpenFileName(QString::null, QString::null, \
0, i18n("Browse...")); +    if (!file_name.isNull()) {
+        element()->m_value = DOMString(file_name);
+        m_edit->setText(file_name);
+    }
 }
 

--- kdelibs/khtml/rendering/render_form.h  #1.98:1.99
@@ -122,5 +122,5 @@ public:
     virtual void calcMinMaxWidth();
 
-    virtual bool handleEvent(const DOM::EventImpl& ev) { return false; }
+    virtual bool handleEvent(const DOM::EventImpl&) { return false; }
 
     QCheckBox *widget() const { return static_cast<QCheckBox*>(m_widget); }
@@ -142,5 +142,5 @@ public:
     virtual void updateFromElement();
 
-    virtual bool handleEvent(const DOM::EventImpl& ev) { return false; }
+    virtual bool handleEvent(const DOM::EventImpl&) { return false; }
 
     QRadioButton *widget() const { return static_cast<QRadioButton*>(m_widget); }
@@ -308,6 +308,7 @@ public:
 
 public slots:
-    virtual void slotReturnPressed();
-    virtual void slotTextChanged(const QString &string);
+    void slotReturnPressed();
+    void slotTextChanged(const QString &string);
+    void slotClicked();
 
 protected:


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

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