[Panel-devel] "Add Applet to panel" dialog ported to Qt4

Rafael Fernández López ereslibre at gmail.com
Sat Oct 21 21:47:20 CEST 2006


Hi,

I've been porting these days "Add applet to panel" dialog. Now it is
finished, and I attach a screenshot of how it looks. It can be easily
modificable since it has the Model/View/Delegate hierarchy.

I fixed an issue in the previous dialog:

( * ) Select an applet. Don't add it, just select it. (E.g. bookmarks)
( * ) Search for "whatever", so your selection dissapears [not shown, but
still selected !!].
( * ) Click on "Add applet to panel" button. Your selection was added to
kicker, but it was not shown.

For me this is not intuitive. I fixed it this way:

If you select an item and you search, and you selected item is in the result
list, it remains selected... but it your selection wasn't in the result list
then the "add applet to panel" button disables and the selection gets
cleared.

I think to add another feature too, but is not in the current patch. By now,
if you add a isUnique applet to kicker, it dissapears from the list. The
user could think he just lost it. From my point of view, I think it should
get disabled instead of disappearing, and instead of showing the applet
name, to show something like "Name of the applet (this applet has been
already added to kicker)", so the user will notice that the applet can only
be added once.

There's only one FIXME that I expect to fix this week. When adding an applet
to kicker, the "flying" effect starts at the widget that has the applet
added. I haven't found the way of getting that QPoint. So by now, the
"flying" effect starts at QPoint(0,0), that is not really bad.

Thank you,
Rafael Fernández López.

PS: Please forward the replies to ereslibre at gmail.com, since I'm not
suscribed to panel-devel at kde.org list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/panel-devel/attachments/20061021/83d36b2e/attachment-0001.html 
-------------- next part --------------
Index: workspace/kicker/kicker/core/CMakeLists.txt
===================================================================
Index: workspace/kicker/kicker/ui/appletitem.ui
===================================================================
--- workspace/kicker/kicker/ui/appletitem.ui	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/appletitem.ui	(copia de trabajo)
@@ -1,132 +0,0 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>AppletItem</class>
-<widget class="QWidget">
-    <property name="name">
-        <cstring>AppletItem</cstring>
-    </property>
-    <property name="geometry">
-        <rect>
-            <x>0</x>
-            <y>0</y>
-            <width>506</width>
-            <height>80</height>
-        </rect>
-    </property>
-    <property name="sizePolicy">
-        <sizepolicy>
-            <hsizetype>7</hsizetype>
-            <vsizetype>5</vsizetype>
-            <horstretch>0</horstretch>
-            <verstretch>0</verstretch>
-        </sizepolicy>
-    </property>
-    <property name="minimumSize">
-        <size>
-            <width>0</width>
-            <height>0</height>
-        </size>
-    </property>
-    <property name="maximumSize">
-        <size>
-            <width>32767</width>
-            <height>80</height>
-        </size>
-    </property>
-    <grid>
-        <property name="name">
-            <cstring>unnamed</cstring>
-        </property>
-        <property name="margin">
-            <number>2</number>
-        </property>
-        <widget class="QLayoutWidget" row="0" column="1">
-            <property name="name">
-                <cstring>layout11</cstring>
-            </property>
-            <vbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>itemTitle</cstring>
-                    </property>
-                    <property name="sizePolicy">
-                        <sizepolicy>
-                            <hsizetype>7</hsizetype>
-                            <vsizetype>1</vsizetype>
-                            <horstretch>1</horstretch>
-                            <verstretch>0</verstretch>
-                        </sizepolicy>
-                    </property>
-                    <property name="text">
-                        <string></string>
-                    </property>
-                    <property name="textFormat">
-                        <enum>RichText</enum>
-                    </property>
-                    <property name="alignment">
-                        <set>AlignTop</set>
-                    </property>
-                    <property name="wordWrap">
-                        <bool>true</bool>
-                    </property>
-                </widget>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>itemDescription</cstring>
-                    </property>
-                    <property name="sizePolicy">
-                        <sizepolicy>
-                            <hsizetype>7</hsizetype>
-                            <vsizetype>7</vsizetype>
-                            <horstretch>0</horstretch>
-                            <verstretch>1</verstretch>
-                        </sizepolicy>
-                    </property>
-                    <property name="text">
-                        <string></string>
-                    </property>
-                    <property name="textFormat">
-                        <enum>RichText</enum>
-                    </property>
-                    <property name="alignment">
-                        <set>AlignTop</set>
-                    </property>
-                    <property name="wordWrap">
-                        <bool>true</bool>
-                    </property>
-                </widget>
-            </vbox>
-        </widget>
-        <widget class="QLayoutWidget" row="0" column="0">
-            <property name="name">
-                <cstring>layout4</cstring>
-            </property>
-            <vbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>itemPixmap</cstring>
-                    </property>
-                    <property name="minimumSize">
-                        <size>
-                            <width>64</width>
-                            <height>64</height>
-                        </size>
-                    </property>
-                    <property name="text">
-                        <string></string>
-                    </property>
-                    <property name="alignment">
-                        <set>AlignTop</set>
-                    </property>
-                </widget>
-            </vbox>
-        </widget>
-    </grid>
-</widget>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
Index: workspace/kicker/kicker/ui/appletitemdelegate.cpp
===================================================================
--- workspace/kicker/kicker/ui/appletitemdelegate.cpp	(revisi��n: 0)
+++ workspace/kicker/kicker/ui/appletitemdelegate.cpp	(revisi��n: 0)
@@ -0,0 +1,58 @@
+/**
+  * This file is part of the KDE project
+  * Copyright (C) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License version 2 as published by the Free Software Foundation.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public License
+  * along with this library; see the file COPYING.LIB.  If not, write to
+  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  * Boston, MA 02110-1301, USA.
+  */
+
+#include "appletitemdelegate.h"
+
+AppletItemDelegate::AppletItemDelegate(QObject *parent)
+	: QItemDelegate(parent)
+{
+}
+
+void AppletItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+	if (option.state & QStyle::State_Selected)
+		painter->fillRect(option.rect, option.palette.highlight());
+
+	QVariant icon = index.model()->data(index, Qt::DecorationRole);
+	icon.convert(QVariant::Icon);
+	QPixmap iconPixmap = icon.value<QIcon>().pixmap(48, 48);
+
+	QFont title(painter->font());
+	QFont previousFont(painter->font());
+
+	title.setPointSize(title.pointSize() + 2);
+	title.setWeight(QFont::Bold);
+
+	painter->save();
+	painter->setRenderHint(QPainter::Antialiasing, true);
+	painter->setFont(title);
+	painter->drawText(40 + iconPixmap.width(), 30 + option.rect.top(), index.model()->data(index, Qt::DisplayRole).toString());
+	painter->setFont(previousFont);
+	painter->drawText(40 + iconPixmap.width(), 60  + option.rect.top(), index.model()->data(index, Qt::UserRole).toString());
+	painter->drawPixmap(20, (option.rect.height() / 2) + option.rect.top() - (iconPixmap.height() / 2), iconPixmap);
+	painter->restore();
+
+}
+
+QSize AppletItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+	return QSize(78, 78);
+}
+
+#include "appletitemdelegate.moc"
Index: workspace/kicker/kicker/ui/addapplet.h
===================================================================
--- workspace/kicker/kicker/ui/addapplet.h	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/addapplet.h	(copia de trabajo)
@@ -1,5 +1,6 @@
 /*****************************************************************
 
+Copyright (c) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
 Copyright (c) 2005 Marc Cramdal
 Copyright (c) 2005 Aaron Seigo <aseigo at kde.org>
 
@@ -35,44 +36,43 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 #include <kdialog.h>
 
 #include "appletinfo.h"
+#include "ui_appletview.h"
+#include "appletlistmodel.h"
+#include "appletitemdelegate.h"
 
 class ContainerArea;
-class AppletView;
-class AppletWidget;
 
 class AddAppletDialog : public KDialog
 {
     Q_OBJECT
 
-    public:
-        AddAppletDialog(ContainerArea* cArea, QWidget* parent, const char* name);
+public:
+	AddAppletDialog(ContainerArea *cArea, QWidget *parent, const char *name);
         void updateInsertionPoint();
 
-    protected:
-        void closeEvent(QCloseEvent*);
+protected:
+	void closeEvent(QCloseEvent *);
 
-    private Q_SLOTS:
+private Q_SLOTS:
         void populateApplets();
-        void addCurrentApplet();
-        void addApplet(AppletWidget* applet);
+	void selectApplet(const QModelIndex &applet);
+	void addCurrentApplet(const QModelIndex &selectedApplet);
         void search(const QString &s);
         void filter(int i);
-        void selectApplet(AppletWidget* applet);
+	void slotUser1Clicked();
 
-    private:
-        bool appletMatchesSearch(const AppletWidget* w, const QString& s);
+private:
+   bool appletMatchesSearch(const AppletInfo *i, const QString &s);
 
-        AppletView *m_mainWidget;
+	AppletListModel *m_listModel;
+	Ui::AppletView *m_mainWidgetView;
+	QWidget *m_mainWidget;
 
+	QModelIndex selectedApplet;
         AppletInfo::List m_applets;
-
-        QList<AppletWidget*> m_appletWidgetList;
-        AppletWidget* m_selectedApplet;
-
-        ContainerArea* m_containerArea;
+	ContainerArea *m_containerArea;
         AppletInfo::AppletType m_selectedType;
         QPoint m_insertionPoint;
-        bool m_closing;
 };
 
 #endif
Index: workspace/kicker/kicker/ui/appletlistmodel.h
===================================================================
--- workspace/kicker/kicker/ui/appletlistmodel.h	(revisi��n: 0)
+++ workspace/kicker/kicker/ui/appletlistmodel.h	(revisi��n: 0)
@@ -0,0 +1,68 @@
+/**
+  * This file is part of the KDE project
+  * Copyright (C) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License version 2 as published by the Free Software Foundation.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public License
+  * along with this library; see the file COPYING.LIB.  If not, write to
+  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  * Boston, MA 02110-1301, USA.
+  */
+
+#ifndef APPLETLISTMODEL_H
+#define APPLETLISTMODEL_H
+
+#include <QAbstractListModel>
+#include <kicon.h>
+
+#include "appletinfo.h"
+
+/**
+  * Qt::UserRole = Description
+  */
+
+class AppletListModel
+	: public QAbstractListModel
+{
+	Q_OBJECT
+
+public:
+	/**
+	  * @brief Constructor for the model of an applet list.
+	  */
+	AppletListModel(const AppletInfo::List &appletInfoList, QObject *parent = 0);
+
+	/**
+	  * @brief Destructor for the model of an applet list.
+	  */
+	~AppletListModel();
+
+	/**
+	  * @brief Returns data from the data structure.
+	  */
+	QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+	/**
+	  * @brief Get the children model index for the given row.
+	  */
+	QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
+
+	/**
+	  * @brief Get the number of applets added to the list.
+	  */
+	int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+private:
+	class Private;
+	Private *d;
+};
+
+#endif
Index: workspace/kicker/kicker/ui/addappletvisualfeedback.cpp
===================================================================
--- workspace/kicker/kicker/ui/addappletvisualfeedback.cpp	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/addappletvisualfeedback.cpp	(copia de trabajo)
@@ -1,5 +1,6 @@
 /*****************************************************************
 
+Copyright (c) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
 Copyright (c) 2004-2005 Aaron J. Seigo <aseigo at kde.org>
 Copyright (c) 2004 Zack Rusin <zrusin at kde.org>
                    Sami Kyostil <skyostil at kempele.fi>
@@ -34,7 +35,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 
 #include "utils.h"
 #include "appletinfo.h"
-#include "appletwidget.h"
 #include "kickerSettings.h"
 #include "addappletvisualfeedback.h"
 #include "addappletvisualfeedback.moc"
@@ -42,28 +42,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 
 #define DEFAULT_FRAMES_PER_SECOND 30
 
-AddAppletVisualFeedback::AddAppletVisualFeedback(AppletWidget* widget,
+AddAppletVisualFeedback::AddAppletVisualFeedback(const QModelIndex* index,
                                                  const QWidget* target,
                                                  Plasma::Position direction)
     : QWidget(0, Qt::X11BypassWindowManagerHint),
       m_target(target),
       m_direction(direction),
-      m_icon(*widget->itemPixmap->pixmap()),
       m_richText(0),
       m_dissolveSize(24),
       m_dissolveDelta(-1),
       m_frames(1)
 {
+    AppletInfo *appletData = static_cast<AppletInfo*>(index->internalPointer());
+
+    m_icon = KIcon(appletData->icon()).pixmap(QSize(64, 64));
+
     setObjectName("animtt");
     setFocusPolicy(Qt::NoFocus);
     setAttribute(Qt::WA_NoSystemBackground, true);
     connect(&m_moveTimer, SIGNAL(timeout()), SLOT(swoopCloser()));
 
-    QString m = "<qt><h3>" + i18n("%1 Added", widget->info().name());
+	 QString m = "<qt><h3>" + i18n("%1 Added", appletData->name());
 
-    if (widget->info().name() != widget->info().comment())
+	 if (appletData->name() != appletData->comment())
     {
-        m += "</h3><p>" + widget->info().comment() + "</p></qt>";
+		 m += "</h3><p>" + appletData->comment() + "</p></qt>";
     }
 
     m_richText = new Q3SimpleRichText(m, font());
@@ -72,8 +75,7 @@ AddAppletVisualFeedback::AddAppletVisual
     displayInternal();
 
     m_destination = Plasma::popupPosition(m_direction, this, m_target);
-    QPoint startAt = widget->itemPixmap->geometry().topLeft();
-    startAt = widget->itemPixmap->mapToGlobal(startAt);
+	 QPoint startAt(0,0); // FIXME: how to get the widget icon's origin ? (ereslibre)
     move(startAt);
 
     m_frames = (m_destination - startAt).manhattanLength() / 20;
Index: workspace/kicker/kicker/ui/appletwidget.h
===================================================================
--- workspace/kicker/kicker/ui/appletwidget.h	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/appletwidget.h	(copia de trabajo)
@@ -1,76 +0,0 @@
-/*****************************************************************
-
-Copyright (c) 2005 Marc Cramdal
-Copyright (c) 2005 Aaron Seigo <aseigo at kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-******************************************************************/
-
-#ifndef _appletwidget_h_
-#define _appletwidget_h_
-
-#include <QPoint>
-
-#include <QList>
-#include <QMouseEvent>
-#include <QEvent>
-
-#include <klocale.h>
-#include <kdialog.h>
-
-#include "appletinfo.h"
-#include "appletitem.h"
-
-class AppletWidget: public AppletItem
-{
-    Q_OBJECT
-
-    public:
-        typedef QList<AppletWidget*> List;
-
-        AppletWidget(const AppletInfo& info, bool odd, QWidget *parent);
-        const AppletInfo& info() const { return m_appletInfo; }
-        virtual bool eventFilter(QObject* watched, QEvent* e);
-
-        void setSelected(bool selected);
-        void setOdd(bool odd);
-        bool odd() { return m_odd; }
-
-    Q_SIGNALS:
-        void clicked(AppletWidget*);
-        void doubleClicked(AppletWidget*);
-
-    protected:
-        void keyPressEvent(QKeyEvent *e);
-        void mousePressEvent(QMouseEvent *e);
-        void mouseMoveEvent(QMouseEvent *e);
-        void mouseReleaseEvent(QMouseEvent *e);
-        void mouseDoubleClickEvent(QMouseEvent *e);
-        void focusInEvent(QFocusEvent* e);
-        void focusOutEvent(QFocusEvent* e);
-
-    private:
-        AppletInfo m_appletInfo;
-        bool m_odd;
-        bool m_selected;
-        QPoint m_dragStart;
-};
-
-#endif
-
Index: workspace/kicker/kicker/ui/addapplet.cpp
===================================================================
--- workspace/kicker/kicker/ui/addapplet.cpp	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/addapplet.cpp	(copia de trabajo)
@@ -1,5 +1,6 @@
 /*****************************************************************
 
+Copyright (c) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
 Copyright (c) 2005 Marc Cramdal
 Copyright (c) 2005 Aaron Seigo <aseigo at kde.org>
 
@@ -48,8 +49,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 
 #include "addapplet.h"
 #include "addappletvisualfeedback.h"
-#include "appletwidget.h"
-#include "appletview.h"
 #include "container_applet.h"
 #include "container_extension.h"
 #include "containerarea.h"
@@ -58,208 +57,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 #include "menuinfo.h"
 #include "pluginmanager.h"
 
-AppletWidget::AppletWidget(const AppletInfo& info, bool odd, QWidget *parent)
-    : AppletItem(parent),
-      m_appletInfo(info),
-      m_odd(odd),
-      m_selected(false)
-{
-    setFocusPolicy(Qt::StrongFocus);
-    setSelected(m_selected);
-
-    itemTitle->setText("<h3>" + info.name() + "</h3>");
-    itemTitle->installEventFilter(this);
-
-    if (info.comment() != info.name())
-    {
-        itemDescription->setText(info.comment());
-    }
-
-    itemDescription->installEventFilter(this);
-
-    KIconLoader * ldr = KGlobal::iconLoader();
-    QPixmap icon = ldr->loadIcon(info.icon(), K3Icon::Panel, K3Icon::SizeLarge);
-    itemPixmap->setPixmap(icon);
-    itemPixmap->installEventFilter(this);
-}
-
-bool AppletWidget::eventFilter(QObject*, QEvent* e)
-{
-    if (e->type() == QEvent::MouseButtonPress)
-    {
-        QMouseEvent* me = static_cast<QMouseEvent*>(e);
-        if (me->button() & Qt::LeftButton)
-        {
-            m_dragStart = me->pos();
-        }
-    }
-    else if (m_dragStart.isNull())
-    {
-        return false;
-    }
-
-    if (e->type() == QEvent::MouseMove)
-    {
-        QMouseEvent* me = static_cast<QMouseEvent*>(e);
-        if ((me->pos() - m_dragStart).manhattanLength() >
-            KGlobalSettings::dndEventDelay())
-        {
-            QMimeData* data = new QMimeData;
-            m_appletInfo.populateMimeData(data);
-
-            QDrag* drag = new QDrag(this);
-            drag->setMimeData(data);
-
-            if (itemPixmap->pixmap())
-            {
-                drag->setPixmap(*itemPixmap->pixmap());
-            }
-
-            drag->start(Qt::CopyAction);
-        }
-    }
-    else if (e->type() == QEvent::MouseButtonRelease)
-    {
-        m_dragStart = QPoint();
-    }
-
-    return false;
-}
-
-void AppletWidget::keyPressEvent(QKeyEvent *e)
-{
-    if (e->key() == Qt::Key_Enter ||
-        e->key() == Qt::Key_Return)
-    {
-        emit doubleClicked(this);
-    }
-    else if (e->key() == Qt::Key_Up)
-    {
-        QKeyEvent fakedKeyPress(QEvent::KeyPress, Qt::Key_Backtab, 0);
-        QKeyEvent fakedKeyRelease(QEvent::KeyRelease, Qt::Key_Backtab, 0);
-        QApplication::sendEvent(this, &fakedKeyPress);
-        QApplication::sendEvent(this, &fakedKeyRelease);
-    }
-    else if (e->key() == Qt::Key_Down)
-    {
-        QKeyEvent fakedKeyPress(QEvent::KeyPress, Qt::Key_Tab, 0);
-        QKeyEvent fakedKeyRelease(QEvent::KeyRelease, Qt::Key_Escape, 0);
-        QApplication::sendEvent(this, &fakedKeyPress);
-        QApplication::sendEvent(this, &fakedKeyRelease);
-    }
-    else
-    {
-        AppletItem::keyPressEvent(e);
-    }
-}
-
-
-void AppletWidget::mousePressEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::LeftButton)
-    {
-        emit clicked(this);
-        m_dragStart = e->pos();
-    }
-}
-
-void AppletWidget::mouseMoveEvent(QMouseEvent *e)
-{
-    if (e->button() == Qt::LeftButton &&
-        !m_dragStart.isNull() &&
-        (e->pos() - m_dragStart).manhattanLength() >
-         KGlobalSettings::dndEventDelay())
-    {
-        QMimeData* data = new QMimeData;
-        m_appletInfo.populateMimeData(data);
-
-        QDrag* drag = new QDrag(this);
-        drag->setMimeData(data);
-
-        if (itemPixmap->pixmap())
-        {
-            drag->setPixmap(*itemPixmap->pixmap());
-        }
-
-        drag->start(Qt::CopyAction);
-    }
-}
-
-void AppletWidget::mouseReleaseEvent(QMouseEvent *)
-{
-    m_dragStart = QPoint();
-}
-
-void AppletWidget::mouseDoubleClickEvent(QMouseEvent *e)
-{
-    if (!e->button() == Qt::LeftButton)
-    {
-        AppletItem::mouseDoubleClickEvent(e);
-        return;
-    }
-
-    emit doubleClicked(this);
-}
-
-void AppletWidget::setSelected(bool selected)
-{
-    m_selected = selected;
-
-    // for now just used to switch colours around =)
-    QPalette p = palette();
-    if (m_selected)
-    {
-        p.setColor(backgroundRole(),KGlobalSettings::highlightColor());
-        p.setColor(foregroundRole(),KGlobalSettings::highlightedTextColor());
-    }
-    else if (m_odd)
-    {
-        p.setColor(backgroundRole(),KGlobalSettings::baseColor());
-        p.setColor(foregroundRole(),KGlobalSettings::textColor());
-    }
-    else
-    {
-        p.setColor(backgroundRole(),KGlobalSettings::alternateBackgroundColor());
-        p.setColor(foregroundRole(),KGlobalSettings::textColor());
-    }
-    setPalette(p);
-}
-
-void AppletWidget::setOdd(bool odd)
-{
-    m_odd = odd;
-    setSelected(m_selected);
-}
-
-void AppletWidget::focusInEvent(QFocusEvent*)
-{
-    m_selected = true;
-    setSelected(m_selected);
-}
-
-void AppletWidget::focusOutEvent(QFocusEvent*)
-{
-    m_selected = false;
-    setSelected(m_selected);
-}
-
-AddAppletDialog::AddAppletDialog(ContainerArea* cArea,
-                                 QWidget* parent,
-                                 const char* name)
-    : KDialog(parent),
-      m_selectedApplet(0),
-      m_containerArea(cArea),
-      m_insertionPoint(Kicker::self()->insertionPoint()),
-      m_closing(false)
+AddAppletDialog::AddAppletDialog(ContainerArea *cArea,
+                                 QWidget *parent,
+                                 const char *name)
+	: KDialog(parent)
+	, m_mainWidgetView(new Ui::AppletView())
+	, m_containerArea(cArea)
+	, m_insertionPoint(Kicker::self()->insertionPoint())
 {
     setCaption(i18n("Add Applet"));
     Q_UNUSED(name);
     setModal(false);
 
-    m_mainWidget = new AppletView(this);
-    m_mainWidget->setObjectName("AddAppletDialog::m_mainWidget");
-    m_mainWidget->appletScrollView->setWidgetResizable( true );
-    setMainWidget(m_mainWidget);
+	setButtons(KDialog::User1 | KDialog::Close);
+	setButtonGuiItem(User1, KGuiItem(i18n("Load Applet"), "ok"));
+	enableButton(KDialog::User1, false);
 
     KConfig *cfg = KGlobal::config();
     cfg->setGroup("AddAppletDialog Settings");
@@ -267,16 +79,15 @@ AddAppletDialog::AddAppletDialog(Contain
 
     centerOnScreen(this);
 
-    KGuiItem addGuiItem = KStdGuiItem::add();
-    addGuiItem.setText(m_mainWidget->appletInstall->text());
-    m_mainWidget->appletInstall->setEnabled(false);
-    m_mainWidget->appletInstall->setGuiItem(addGuiItem);
-    m_mainWidget->closeButton->setGuiItem(KStdGuiItem::close());
-
-    connect(m_mainWidget->appletSearch, SIGNAL(textChanged(const QString&)), this, SLOT(search(const QString&)));
-    connect(m_mainWidget->appletFilter, SIGNAL(activated(int)), this, SLOT(filter(int)));
-    connect(m_mainWidget->appletInstall, SIGNAL(clicked()), this, SLOT(addCurrentApplet()));
-    connect(m_mainWidget->closeButton, SIGNAL(clicked()), this, SLOT(close()));
+	m_mainWidget = new QWidget(this);
+	m_mainWidgetView->setupUi(m_mainWidget);
+	setMainWidget(m_mainWidget);
+
+	connect(m_mainWidgetView->appletSearch, SIGNAL(textChanged(const QString&)), this, SLOT(search(const QString&)));
+	connect(m_mainWidgetView->appletFilter, SIGNAL(activated(int)), this, SLOT(filter(int)));
+	connect(m_mainWidgetView->appletListView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(selectApplet(const QModelIndex&)));
+	connect(m_mainWidgetView->appletListView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(addCurrentApplet(const QModelIndex&)));
+	connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUser1Clicked()));
 
     m_selectedType = AppletInfo::Undefined;
 
@@ -288,11 +99,8 @@ void AddAppletDialog::updateInsertionPoi
     m_insertionPoint = Kicker::self()->insertionPoint();
 }
 
-
-void AddAppletDialog::closeEvent(QCloseEvent* e)
+void AddAppletDialog::closeEvent(QCloseEvent *e)
 {
-    m_closing = true;
-
     KConfig *cfg = KGlobal::config();
     cfg->setGroup("AddAppletDialog Settings");
     KDialog::saveDialogSize(cfg);
@@ -302,151 +110,74 @@ void AddAppletDialog::closeEvent(QCloseE
 
 void AddAppletDialog::populateApplets()
 {
-    QWidget *appletBox = new QWidget(m_mainWidget->appletScrollView->viewport());
-    QPalette p = palette();
-    p.setColor(backgroundRole(),KGlobalSettings::baseColor());
-    setPalette(p);
-    m_mainWidget->appletScrollView->setWidget(appletBox);
-    appletBox->show();
-
-    QVBoxLayout* layout = new QVBoxLayout(appletBox);
-    layout->addStretch(1);
-    layout->setMargin(0);
-
-    /* Three steps
-     * - First we load the applets
-     * - We load the special buttons
-     * - Then we begin to populate the scrollview with the AppletWidget(s)
-     */
-
     // Loading applets
-    AppletInfo::List appletInfoList = PluginManager::applets(false, &appletInfoList);
+	m_applets = PluginManager::applets(false, &m_applets);
 
     // Loading built in buttons
-    appletInfoList = PluginManager::builtinButtons(false, &appletInfoList);
+	m_applets = PluginManager::builtinButtons(false, &m_applets);
 
     // Loading special buttons
-    appletInfoList = PluginManager::specialButtons(false, &appletInfoList);
+	m_applets = PluginManager::specialButtons(false, &m_applets);
 
-    qHeapSort(appletInfoList);
+	qHeapSort(m_applets);
 
     int i = 0;
-    bool odd = true;
-    QWidget* prevTabWidget = m_mainWidget->appletFilter;
-    for (AppletInfo::List::iterator it = appletInfoList.begin();
-         !m_closing && it != appletInfoList.end();
+	for (AppletInfo::List::iterator it = m_applets.begin();
+		  it != m_applets.end();
          ++i)
     {
         if ((*it).isHidden() || (*it).name().isEmpty() ||
             ((*it).isUniqueApplet() &&
              PluginManager::self()->hasInstance(*it)))
         {
-            it = appletInfoList.erase(it);
+			it = m_applets.erase(it);
             --i;
             continue;
         }
 
-        AppletWidget *itemWidget = new AppletWidget(*it, odd, appletBox);
-
-        if (m_mainWidget->appletSearch->text().isEmpty() ||
-            appletMatchesSearch(itemWidget, m_mainWidget->appletSearch->text()))
-        {
-            itemWidget->show();
-            odd = !odd;
-        }
-        else
-        {
-            itemWidget->hide();
-        }
-
-        layout->insertWidget(i, itemWidget);
-        m_appletWidgetList.append(itemWidget);
-        setTabOrder(prevTabWidget, itemWidget);
-        prevTabWidget = itemWidget;
-
-        connect(itemWidget, SIGNAL(clicked(AppletWidget*)),
-                this, SLOT(selectApplet(AppletWidget*)));
-        connect(itemWidget, SIGNAL(doubleClicked(AppletWidget*)),
-                this, SLOT(addApplet(AppletWidget*)));
-
-        if (m_closing)
-        {
-            return;
-        }
-
         ++it;
     }
 
-    m_mainWidget->closeButton->setEnabled(true);
-}
-
-void AddAppletDialog::selectApplet(AppletWidget *applet)
-{
-    m_mainWidget->appletInstall->setEnabled(true);
-
-    if (m_selectedApplet)
-    {
-        m_selectedApplet->setSelected(false);
-    }
-
-    m_selectedApplet = applet;
+	 m_listModel = new AppletListModel(m_applets, this);
+	 m_mainWidgetView->appletListView->setModel(m_listModel);
 
-    if (m_selectedApplet)
-    {
-        m_selectedApplet->setSelected(true);
-
-        if (m_selectedApplet->info().isUniqueApplet() &&
-            PluginManager::self()->hasInstance(m_selectedApplet->info()))
-        {
-            m_mainWidget->appletInstall->setEnabled(false);
-        }
-    }
+	 AppletItemDelegate *appletItemDelegate = new AppletItemDelegate(this);
+	 m_mainWidgetView->appletListView->setItemDelegate(appletItemDelegate);
 }
 
-void AddAppletDialog::addCurrentApplet()
+void AddAppletDialog::selectApplet(const QModelIndex &applet)
 {
-    addApplet(m_selectedApplet);
+	selectedApplet = applet;
+
+	if (!isButtonEnabled(KDialog::User1))
+		enableButton(KDialog::User1, true);
 }
 
-void AddAppletDialog::addApplet(AppletWidget* applet)
+void AddAppletDialog::addCurrentApplet(const QModelIndex &selectedApplet)
 {
-    if (!applet)
-    {
-        return;
-    }
+	this->selectedApplet = selectedApplet;
+	AppletInfo applet(m_applets[selectedApplet.row()]);
 
     QPoint prevInsertionPoint = Kicker::self()->insertionPoint();
     Kicker::self()->setInsertionPoint(m_insertionPoint);
 
     const QWidget* appletContainer = 0;
 
-    if (applet->info().type() == AppletInfo::Applet)
+	if (applet.type() == AppletInfo::Applet)
     {
-        appletContainer = m_containerArea->addApplet(applet->info());
-
-        if (applet->info().isUniqueApplet() &&
-            PluginManager::self()->hasInstance(applet->info()))
-        {
-            applet->hide();
-
-            // reset the odd/even colouring from this item on down in the list
-            bool odd = applet->odd();
-            int idx = m_appletWidgetList.indexOf(applet);
-            for (; idx != -1 && idx < m_appletWidgetList.count(); idx++)
-            {
-                if (m_appletWidgetList[idx]->isHidden())
+		appletContainer = m_containerArea->addApplet(applet);
+	}
+	else if (applet.type() & AppletInfo::Button)
                 {
-                    continue;
+		appletContainer = m_containerArea->addButton(applet);
                 }
 
-                m_appletWidgetList[idx]->setOdd(odd);
-                odd = !odd;
-            }
-        }
-    }
-    else if (applet->info().type() & AppletInfo::Button)
+	if (applet.isUniqueApplet() &&
+		 PluginManager::self()->hasInstance(applet))
     {
-        appletContainer = m_containerArea->addButton(applet->info());
+		m_mainWidgetView->appletListView->setRowHidden(selectedApplet.row(), true);
+		m_mainWidgetView->appletListView->clearSelection();
+		enableButton(KDialog::User1, false);
     }
 
     if (appletContainer)
@@ -461,49 +192,50 @@ void AddAppletDialog::addApplet(AppletWi
             ec->unhideIfHidden(KickerSettings::mouseOversSpeed() + 2500);
         }
 
-        new AddAppletVisualFeedback(applet, appletContainer,
+		new AddAppletVisualFeedback(&selectedApplet,
+											 appletContainer,
                                     m_containerArea->popupDirection());
     }
 
     Kicker::self()->setInsertionPoint(prevInsertionPoint);
 }
 
-bool AddAppletDialog::appletMatchesSearch(const AppletWidget* w,
-                                          const QString& s)
+bool AddAppletDialog::appletMatchesSearch(const AppletInfo *i, const QString &s)
 {
-    if (w->info().type() == AppletInfo::Applet &&
-        w->info().isUniqueApplet() &&
-        PluginManager::self()->hasInstance(w->info()))
+	if (i->type() == AppletInfo::Applet &&
+		 i->isUniqueApplet() &&
+		 PluginManager::self()->hasInstance(*i))
     {
         return false;
     }
 
     return (m_selectedType == AppletInfo::Undefined ||
-            w->info().type() & m_selectedType) &&
-           (w->info().name().contains(s, Qt::CaseInsensitive) ||
-            w->info().comment().contains(s, Qt::CaseInsensitive));
+			  i->type() & m_selectedType) &&
+			 (i->name().contains(s, Qt::CaseInsensitive) ||
+			  i->comment().contains(s, Qt::CaseInsensitive));
 }
 
 void AddAppletDialog::search(const QString &s)
 {
-    QList<AppletWidget*>::const_iterator itEnd = m_appletWidgetList.constEnd();
-
-    bool odd = true;
-    for ( QList<AppletWidget*>::const_iterator it = m_appletWidgetList.constBegin();
-          it != itEnd;
-          ++it)
+	AppletInfo *appletInfo;
+	for (int i = 0; i < m_listModel->rowCount(); i++)
     {
-        AppletWidget* w = *it;
-        if (appletMatchesSearch(w, s))
-        {
-            w->setOdd(odd);
-            w->show();
-            odd = !odd;
+		appletInfo = static_cast<AppletInfo*>(m_listModel->index(i).internalPointer());
+		m_mainWidgetView->appletListView->setRowHidden(i, !appletMatchesSearch(appletInfo, s) ||
+																			(appletInfo->isUniqueApplet() &&
+																			 PluginManager::self()->hasInstance(*appletInfo)));
         }
-        else
+
+	/**
+	  * If our selection gets hidden because of searching, we deselect it and
+	  * disable the "Add Applet" button.
+	  */
+	if ((selectedApplet.isValid() &&
+		 (m_mainWidgetView->appletListView->isRowHidden(selectedApplet.row()))) ||
+		 (!selectedApplet.isValid()))
         {
-            w->hide();
-        }
+		m_mainWidgetView->appletListView->clearSelection();
+		enableButton(KDialog::User1, false);
     }
 }
 
@@ -520,29 +252,35 @@ void AddAppletDialog::filter(int i)
         m_selectedType = AppletInfo::Button;
     }
 
-    QList<AppletWidget*>::const_iterator itEnd = m_appletWidgetList.constEnd();
+	AppletInfo *appletInfo;
+	QString searchString = m_mainWidgetView->appletSearch->text();
+	for (int j = 0; j < m_listModel->rowCount(); j++)
+	{
+		appletInfo = static_cast<AppletInfo*>(m_listModel->index(j).internalPointer());
+		m_mainWidgetView->appletListView->setRowHidden(j, !appletMatchesSearch(appletInfo, searchString) ||
+																			(appletInfo->isUniqueApplet() &&
+																			 PluginManager::self()->hasInstance(*appletInfo)));
+	}
 
-    bool odd = true;
-    QString searchString = m_mainWidget->appletSearch->text();
-    for (QList<AppletWidget*>::const_iterator it = m_appletWidgetList.constBegin();
-         it != itEnd;
-         ++it)
-    {
-        AppletWidget* w = *it;
-        if (appletMatchesSearch(w, searchString))
+	/**
+	  * If our selection gets hidden because of filtering, we deselect it and
+	  * disable the "Add Applet" button.
+	  */
+	if ((selectedApplet.isValid() &&
+		 (m_mainWidgetView->appletListView->isRowHidden(selectedApplet.row()))) ||
+		 (!selectedApplet.isValid()))
         {
-            w->setOdd(odd);
-            w->show();
-            odd = !odd;
+		m_mainWidgetView->appletListView->clearSelection();
+		enableButton(KDialog::User1, false);
         }
-        else
+}
+
+void AddAppletDialog::slotUser1Clicked()
+{
+	if (selectedApplet.isValid())
         {
-            w->hide();
-        }
+		addCurrentApplet(selectedApplet);
     }
-
 }
 
 #include "addapplet.moc"
-#include "appletwidget.moc"
-
Index: workspace/kicker/kicker/ui/appletlistmodel.cpp
===================================================================
--- workspace/kicker/kicker/ui/appletlistmodel.cpp	(revisi��n: 0)
+++ workspace/kicker/kicker/ui/appletlistmodel.cpp	(revisi��n: 0)
@@ -0,0 +1,100 @@
+/**
+  * This file is part of the KDE project
+  * Copyright (C) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License version 2 as published by the Free Software Foundation.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public License
+  * along with this library; see the file COPYING.LIB.  If not, write to
+  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  * Boston, MA 02110-1301, USA.
+  */
+
+#include "appletlistmodel.h"
+
+class AppletListModel::Private
+{
+public:
+	Private()
+	{
+	}
+
+	~Private()
+	{
+	}
+
+	AppletInfo::List appletInfoList;
+};
+
+AppletListModel::AppletListModel(const AppletInfo::List &appletInfoList, QObject *parent)
+	: QAbstractListModel(parent)
+	, d(new Private)
+{
+	d->appletInfoList = appletInfoList;
+}
+
+AppletListModel::~AppletListModel()
+{
+	delete d;
+}
+
+QVariant AppletListModel::data(const QModelIndex &index, int role) const
+{
+	if (!index.isValid())
+		return QVariant();
+
+	AppletInfo *myAppletInfo = static_cast<AppletInfo*>(index.internalPointer());
+
+	QVariant returnValue;
+
+	switch (role)
+	{
+		case Qt::DisplayRole:
+			returnValue = myAppletInfo->name();
+			break;
+
+		case Qt::DecorationRole:
+			returnValue = KIcon(myAppletInfo->icon());
+			break;
+
+		case Qt::UserRole:
+			returnValue = myAppletInfo->comment();
+			break;
+	}
+
+	return returnValue;
+}
+
+QModelIndex AppletListModel::index(int row, int column, const QModelIndex &parent) const
+{
+	if (row < 0)
+		row = 0;
+
+	if (row < d->appletInfoList.count())
+	{
+		return createIndex(row, column, &d->appletInfoList[row]);
+	}
+	else if (!d->appletInfoList.empty())
+	{
+		int lastRow = d->appletInfoList.count() - 1;
+		return createIndex(lastRow, column, &d->appletInfoList[lastRow]);
+	}
+
+	return QModelIndex(); // We have an empty list
+}
+
+int AppletListModel::rowCount(const QModelIndex &parent) const
+{
+	Q_UNUSED(parent);
+	
+	return d->appletInfoList.count();
+}
+
+#include "appletlistmodel.moc"
Index: workspace/kicker/kicker/ui/appletitemdelegate.h
===================================================================
--- workspace/kicker/kicker/ui/appletitemdelegate.h	(revisi��n: 0)
+++ workspace/kicker/kicker/ui/appletitemdelegate.h	(revisi��n: 0)
@@ -0,0 +1,52 @@
+/**
+  * This file is part of the KDE project
+  * Copyright (C) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Library General Public
+  * License version 2 as published by the Free Software Foundation.
+  *
+  * This library is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Library General Public License for more details.
+  *
+  * You should have received a copy of the GNU Library General Public License
+  * along with this library; see the file COPYING.LIB.  If not, write to
+  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+  * Boston, MA 02110-1301, USA.
+  */
+
+#ifndef APPLETITEMDELEGATE_H
+#define APPLETITEMDELEGATE_H
+
+#include <QItemDelegate>
+#include <QModelIndex>
+#include <QPixmap>
+#include <QPainter>
+#include <kicon.h>
+
+class AppletItemDelegate
+	: public QItemDelegate
+{
+	Q_OBJECT
+
+public:
+	/**
+	  * @brief Constructor for the item delegate.
+	  */
+	AppletItemDelegate(QObject *parent = 0);
+
+
+	/**
+	  * @brief Paints the item delegate.
+	  */
+	void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
+
+	/**
+	  * @brief Gets the size of the item delegate.
+	  */
+	QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
+};
+
+#endif
Index: workspace/kicker/kicker/ui/appletview.ui
===================================================================
--- workspace/kicker/kicker/ui/appletview.ui	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/appletview.ui	(copia de trabajo)
@@ -1,48 +1,45 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>AppletView</class>
-<widget class="QWidget">
-    <property name="name">
-        <cstring>AppletView</cstring>
-    </property>
-    <property name="geometry">
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>AppletView</class>
+ <widget class="QWidget" name="AppletView" >
+  <property name="geometry" >
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>490</width>
-            <height>334</height>
+    <width>586</width>
+    <height>502</height>
         </rect>
     </property>
-    <vbox>
-        <property name="name">
-            <cstring>unnamed</cstring>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>0</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
         </property>
-        <property name="margin">
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
             <number>0</number>
         </property>
-        <widget class="QLayoutWidget">
-            <property name="name">
-                <cstring>layout8</cstring>
-            </property>
-            <hbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
-                </property>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>textLabel8</cstring>
+     <property name="spacing" >
+      <number>6</number>
                     </property>
-                    <property name="text">
+     <item>
+      <widget class="QLabel" name="textLabel8" >
+       <property name="text" >
                         <string>&amp;Search:</string>
                     </property>
-                    <property name="buddy" stdset="0">
+       <property name="buddy" >
                         <cstring>appletSearch</cstring>
                     </property>
                 </widget>
-                <widget class="QLineEdit">
-                    <property name="name">
-                        <cstring>appletSearch</cstring>
-                    </property>
-                    <property name="sizePolicy">
+     </item>
+     <item>
+      <widget class="QLineEdit" name="appletSearch" >
+       <property name="sizePolicy" >
                         <sizepolicy>
                             <hsizetype>7</hsizetype>
                             <vsizetype>0</vsizetype>
@@ -50,138 +47,128 @@
                             <verstretch>0</verstretch>
                         </sizepolicy>
                     </property>
-                    <property name="whatsThis" stdset="0">
-                        <string>&lt;qt&gt;Type here some text to filter on the applet names and comments&lt;/qt&gt;</string>
+       <property name="whatsThis" >
+        <string>&lt;qt>Type here some text to filter on the applet names and comments&lt;/qt></string>
                     </property>
                 </widget>
-                <widget class="QLabel">
-                    <property name="name">
-                        <cstring>textLabel1</cstring>
-                    </property>
-                    <property name="text">
+     </item>
+     <item>
+      <widget class="QLabel" name="textLabel1" >
+       <property name="text" >
                         <string>S&amp;how:</string>
                     </property>
-                    <property name="buddy" stdset="0">
+       <property name="buddy" >
                         <cstring>appletFilter</cstring>
                     </property>
                 </widget>
-                <widget class="QComboBox">
+     </item>
                     <item>
-                        <property name="text">
+      <widget class="QComboBox" name="appletFilter" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>1</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>1</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="whatsThis" >
+        <string>&lt;qt>Select here the only applet category that you want to show&lt;/qt></string>
+       </property>
+       <item>
+        <property name="text" >
                             <string>All</string>
                         </property>
                     </item>
                     <item>
-                        <property name="text">
+        <property name="text" >
                             <string>Applets</string>
                         </property>
                     </item>
                     <item>
-                        <property name="text">
+        <property name="text" >
                             <string>Special Buttons</string>
                         </property>
                     </item>
-                    <property name="name">
-                        <cstring>appletFilter</cstring>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
                     </property>
-                    <property name="sizePolicy">
-                        <sizepolicy>
-                            <hsizetype>1</hsizetype>
-                            <vsizetype>0</vsizetype>
-                            <horstretch>1</horstretch>
-                            <verstretch>0</verstretch>
-                        </sizepolicy>
+     <property name="spacing" >
+      <number>6</number>
                     </property>
-                    <property name="whatsThis" stdset="0">
-                        <string>&lt;qt&gt;Select here the only applet category that you want to show&lt;/qt&gt;</string>
+     <item>
+      <widget class="QListView" name="appletListView" >
+       <property name="autoScroll" >
+        <bool>false</bool>
                     </property>
-                </widget>
-            </hbox>
-        </widget>
-        <widget class="QScrollArea">
-            <property name="name">
-                <cstring>appletScrollView</cstring>
+       <property name="editTriggers" >
+        <set>QAbstractItemView::NoEditTriggers</set>
             </property>
-            <property name="sizePolicy">
-                <sizepolicy>
-                    <hsizetype>5</hsizetype>
-                    <vsizetype>5</vsizetype>
-                    <horstretch>0</horstretch>
-                    <verstretch>1</verstretch>
-                </sizepolicy>
+       <property name="alternatingRowColors" >
+        <bool>true</bool>
             </property>
-            <property name="maximumSize">
-                <size>
-                    <width>32767</width>
-                    <height>32767</height>
-                </size>
+       <property name="selectionBehavior" >
+        <enum>QAbstractItemView::SelectRows</enum>
+       </property>
+       <property name="movement" >
+        <enum>QListView::Static</enum>
+       </property>
+       <property name="isWrapping" stdset="0" >
+        <bool>false</bool>
+       </property>
+       <property name="resizeMode" >
+        <enum>QListView::Fixed</enum>
             </property>
-            <property name="focusPolicy">
-                <enum>Qt::NoFocus</enum>
+       <property name="viewMode" >
+        <enum>QListView::ListMode</enum>
             </property>
-            <property name="whatsThis" stdset="0">
-                <string>&lt;qt&gt;This is the applet list. Select and applet and click on &lt;b&gt;Add to panel&lt;/b&gt; to add it&lt;/qt&gt;</string>
+       <property name="uniformItemSizes" >
+        <bool>true</bool>
             </property>
         </widget>
-        <widget class="QLayoutWidget">
-            <property name="name">
-                <cstring>layout3</cstring>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
             </property>
-            <hbox>
-                <property name="name">
-                    <cstring>unnamed</cstring>
+     <property name="spacing" >
+      <number>6</number>
                 </property>
+     <item>
                 <spacer>
-                    <property name="name">
-                        <cstring>spacer8</cstring>
-                    </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
                     </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
                     </property>
-                    <property name="sizeHint">
+       <property name="sizeHint" >
                         <size>
                             <width>284</width>
                             <height>20</height>
                         </size>
                     </property>
                 </spacer>
-                <widget class="KPushButton">
-                    <property name="name">
-                        <cstring>appletInstall</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Add to Panel</string>
-                    </property>
-                </widget>
-                <widget class="KPushButton">
-                    <property name="name">
-                        <cstring>closeButton</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;Close</string>
-                    </property>
-                </widget>
-            </hbox>
-        </widget>
-    </vbox>
-</widget>
-<customwidgets>
-</customwidgets>
-<images>
-    <image name="image0">
-        <data format="PNG" length="872">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000032f49444154789cb5953148254718c77f1e5b7c030ab3e0c12e5ce00927f88a14af7d87c5590ac29d6013b0497b844008a9120e1248938354a6b1482131cde5a510b4f03081f07c8d4421c2063cd85708bbe0831938613ec8c0a5588dd1dc33452e5f33bb33c36f7ffbed7fd889fe7e9fcb7ad07df09ab750fdfdfec4c425787b6bfb757bae8df79e6a54e1bcc36008845b47e71dc549c1e06000f10a9e5c9a3effee39690ef92cb4a25e2c3b4804709844807035cfd57d7122f0ad65f0c25f0703d4a39af41d28473fa0af4a42548c81f007f85aa86a4510cc34cccc8288420405640ad2bbcadfeb2fb01b39021e7d5513a2c74c59ca43d8db510e0f6a24018d8a2496ecbeb0b892d29d0f08cdbc9d149ac7dc0057bea2831262853196fd5d6573dd43046b85fcbe2002d55019be54bef9a2a45ecd585e059106fe46639318403153427908bd0be8e2a38c874b90e70692806acade4ea0b7eee96d0cc9b2360b8f0d92e835e33b97172106400801b6b73c1a95c54719cbef439a2b9a54f833c3f68f8ec59594f73eb090089b1b153afa67e4ae1b270e5fa7144725d636a6228d853fcf59fbca511e7bdc193cf92467b0eb297f578a2220721d7ccdd82442553b48206f417a1714c5fb94b5cf2b8a638f58a13b9fc2a4a3ddb16854aa53d03806dcf4180481a8d8c98b8f7296b3f6a5a33c6ee2652785fc1ea4d2bcaf248246901bca377a0c661a482cc5505135ecbd088de9a490ddb30c8735cf9e5614872955a96854665a066e4f85a33d0bad96500f95bd9dc0f26a8a3b53ba0f53f20c9e3d85e1cb9a4f3facd0734f9659da1da8ea5b7a0c02a22cae081a95deba676fc7f1e4a39cce7ca0d5097cfc594e9659fca88608dd25cbccdcbfe6384014baf3509f66f436866c7e0d835d4ffb5d0b0954a5c38fb4e92d4af18b521c19ac8c39796ee42ecebe22c0f2aa90656d7adf5714c74a71346c7647b0d39685c7965f7f52aa738fc6947a34c6b83829284a41d2c6441258580a74e7738a22509d36d0bc65687760660e8a25033187c451fec69bc1838301ac0b69de444ad53779c32317bb2481f2d437b9dd6adae13d14874a558f3126c2e0e7cbc59be3b81abf7e67ecca7fac3bd0fca3fe17f0db86f7f7fb137f0208c29bb28f971c5b0000000049454e44ae426082</data>
-    </image>
-</images>
-<tabstops>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction></pixmapfunction>
+ <tabstops>
     <tabstop>appletSearch</tabstop>
     <tabstop>appletFilter</tabstop>
-</tabstops>
-<layoutdefaults spacing="6" margin="11"/>
-<includehints>
-    <includehint>kpushbutton.h</includehint>
-    <includehint>kpushbutton.h</includehint>
-</includehints>
-</UI>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
Index: workspace/kicker/kicker/ui/Makefile.am
===================================================================
--- workspace/kicker/kicker/ui/Makefile.am	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/Makefile.am	(copia de trabajo)
@@ -5,7 +5,7 @@ INCLUDES = -I$(srcdir)/../core -I../core
 
 noinst_LTLIBRARIES = libkicker_ui.la
 
-libkicker_ui_la_SOURCES = addbutton_mnu.cpp appletitem.ui appletview.ui addapplet.cpp \
+libkicker_ui_la_SOURCES = addbutton_mnu.cpp appletview.ui addapplet.cpp \
         addapplet_mnu.cpp appletop_mnu.cpp \
         browser_mnu.cpp client_mnu.cpp \
         nonKDEButtonSettings.ui exe_dlg.cpp k_mnu.cpp k_mnu.skel\
Index: workspace/kicker/kicker/ui/addappletvisualfeedback.h
===================================================================
--- workspace/kicker/kicker/ui/addappletvisualfeedback.h	(revisi��n: 597338)
+++ workspace/kicker/kicker/ui/addappletvisualfeedback.h	(copia de trabajo)
@@ -1,5 +1,6 @@
 /*****************************************************************
 
+Copyright (c) 2006 Rafael Fern��ndez L��pez <ereslibre at gmail.com>
 Copyright (c) 2004-2005 Aaron J. Seigo <aseigo at kde.org>
 Copyright (c) 2004 Zack Rusin <zrusin at kde.org>
                    Sami Kyostil <skyostil at kempele.fi>
@@ -30,9 +31,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 #include <QPixmap>
 #include <QTimer>
 #include <QWidget>
+#include <QPaintEvent>
+#include <QModelIndex>
 
 #include <utils.h>
 
+#include <kicon.h>
+
 class AppletItem;
 class QPaintEvent;
 class Q3SimpleRichText;
@@ -43,7 +48,7 @@ class AddAppletVisualFeedback : QWidget
     Q_OBJECT
 
     public:
-        AddAppletVisualFeedback(AppletWidget* parent,
+        AddAppletVisualFeedback(const QModelIndex* index,
                                 const QWidget* destination,
                                 Plasma::Position direction);
 
Index: workspace/kicker/kicker/CMakeLists.txt
===================================================================
--- workspace/kicker/kicker/CMakeLists.txt	(revisi��n: 597338)
+++ workspace/kicker/kicker/CMakeLists.txt	(copia de trabajo)
@@ -15,7 +15,8 @@ include_directories(
 ########### next target ###############
 
 
-kde4_add_ui3_files(libkicker_ui_SRCS ui/appletitem.ui ui/appletview.ui ui/nonKDEButtonSettings.ui)
+kde4_add_ui3_files(libkicker_ui_SRCS ui/nonKDEButtonSettings.ui)
+kde4_add_ui_files(libkicker_ui_SRCS ui/appletview.ui)
 qt4_add_dbus_interface(libkicker_ui_SRCS ../../kdesktop/org.kde.kdesktop.Desktop.xml kdesktop_interface )
 qt4_add_dbus_interface(libkicker_ui_SRCS ../../kdesktop/org.kde.kdesktop.ScreenSaver.xml kdesktop_screensaver_interface )
 
Index: workspace/kicker/applets/launcher/CMakeLists.txt
===================================================================
--- workspace/kicker/applets/launcher/CMakeLists.txt	(revisi��n: 597338)
+++ workspace/kicker/applets/launcher/CMakeLists.txt	(copia de trabajo)
@@ -1,4 +1,4 @@
-include_directories( ${CMAKE_SOURCE_DIR}/libkonq ${CMAKE_SOURCE_DIR}/workspace/kdmlib ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/buttons ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/core ${CMAKE_SOURCE_DIR}/kicker/kicker/ui  ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui  )
+include_directories( ${CMAKE_SOURCE_DIR}/libkonq ${CMAKE_SOURCE_DIR}/workspace/kdmlib ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/buttons ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/core ${CMAKE_SOURCE_DIR}/kicker/kicker/ui  ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui ${CMAKE_BINARY_DIR}/workspace/kicker/kicker  )
 
 
 ########### next target ###############
@@ -15,7 +15,7 @@ set(launcher_panelapplet_PART_SRCS  ${kd
    popularity.cpp 
    configdlg.cpp )
 
-kde4_add_ui3_files(launcher_panelapplet_PART_SRCS ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui/appletitem.ui ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui/appletview.ui ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui/nonKDEButtonSettings.ui)
+kde4_add_ui3_files(launcher_panelapplet_PART_SRCS ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui/appletview.ui ${CMAKE_SOURCE_DIR}/workspace/kicker/kicker/ui/nonKDEButtonSettings.ui)
 
 
 
Index: workspace/kicker/CMakeLists.txt
===================================================================
--- workspace/kicker/CMakeLists.txt	(revisi��n: 597338)
+++ workspace/kicker/CMakeLists.txt	(copia de trabajo)
@@ -53,6 +53,8 @@ set(libkicker_ui_SRCS
     ${CMAKE_CURRENT_SOURCE_DIR}/kicker/ui/removebutton_mnu.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kicker/ui/hidebutton.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/kicker/ui/addappletvisualfeedback.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/kicker/ui/appletlistmodel.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/kicker/ui/appletitemdelegate.cpp
 )
 
 # Those include dirs also apply to all our subdirs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snapshot.png
Type: image/png
Size: 83316 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20061021/83d36b2e/attachment-0001.png 


More information about the Panel-devel mailing list