]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Rename KListView to KCategorizedView as decided
authorRafael Fernández López <ereslibre@kde.org>
Mon, 9 Jul 2007 18:08:20 +0000 (18:08 +0000)
committerRafael Fernández López <ereslibre@kde.org>
Mon, 9 Jul 2007 18:08:20 +0000 (18:08 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=685767

src/CMakeLists.txt
src/dolphiniconsview.cpp
src/dolphiniconsview.h
src/kcategorizedview.cpp [moved from src/klistview.cpp with 91% similarity]
src/kcategorizedview.h [moved from src/klistview.h with 92% similarity]
src/kcategorizedview_p.h [moved from src/klistview_p.h with 96% similarity]

index 6b3b5e9eeae38a206d0f514315d5ee1800198525..802e4ffddd3ac8986793885db1b1cea7c418fc50 100644 (file)
@@ -15,7 +15,7 @@ set(dolphinprivate_LIB_SRCS
     dolphiniconsview.cpp
     dolphincolumnview.cpp
     dolphinitemcategorizer.cpp
-    klistview.cpp
+    kcategorizedview.cpp
     ksortfilterproxymodel.cpp
     kitemcategorizer.cpp
     dolphinsettings.cpp
index 968d7c94c1f962ea4d04d9dc1a0aad0c13997f2b..237a319c835e181609db9fb341aa27cf4324879f 100644 (file)
@@ -33,7 +33,7 @@
 #include <QPoint>
 
 DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) :
-    KListView(parent),
+    KCategorizedView(parent),
     m_controller(controller),
     m_dragging(false)
 {
@@ -68,7 +68,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
     const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
     Q_ASSERT(settings != 0);
 
-    m_viewOptions = KListView::viewOptions();
+    m_viewOptions = KCategorizedView::viewOptions();
     m_viewOptions.showDecorationSelected = true;
 
     QFont font(settings->fontFamily(), settings->fontSize());
@@ -100,7 +100,7 @@ QStyleOptionViewItem DolphinIconsView::viewOptions() const
 
 void DolphinIconsView::contextMenuEvent(QContextMenuEvent* event)
 {
-    KListView::contextMenuEvent(event);
+    KCategorizedView::contextMenuEvent(event);
     m_controller->triggerContextMenuRequest(event->pos());
 }
 
@@ -114,7 +114,7 @@ void DolphinIconsView::mousePressEvent(QMouseEvent* event)
         }
     }
 
-    KListView::mousePressEvent(event);
+    KCategorizedView::mousePressEvent(event);
 }
 
 void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
@@ -127,7 +127,7 @@ void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event)
 
 void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event)
 {
-    KListView::dragLeaveEvent(event);
+    KCategorizedView::dragLeaveEvent(event);
 
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     m_dragging = false;
@@ -136,7 +136,7 @@ void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event)
 
 void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event)
 {
-    KListView::dragMoveEvent(event);
+    KCategorizedView::dragMoveEvent(event);
 
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     const QModelIndex index = indexAt(event->pos());
@@ -156,13 +156,13 @@ void DolphinIconsView::dropEvent(QDropEvent* event)
             event->acceptProposedAction();
         }
     }
-    KListView::dropEvent(event);
+    KCategorizedView::dropEvent(event);
     m_dragging = false;
 }
 
 void DolphinIconsView::paintEvent(QPaintEvent* event)
 {
-    KListView::paintEvent(event);
+    KCategorizedView::paintEvent(event);
 
     // TODO: remove this code when the issue #160611 is solved in Qt 4.4
     if (m_dragging) {
index 83ca615f0ade1a47258abcb16711184d22002069..ec18400c6ed992bb6b3f7f4308a1f19ed74e902f 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef DOLPHINICONSVIEW_H
 #define DOLPHINICONSVIEW_H
 
-#include <klistview.h>
+#include <kcategorizedview.h>
 #include <kitemcategorizer.h>
 #include <QtGui/QStyleOption>
 #include <libdolphin_export.h>
@@ -33,7 +33,7 @@ class DolphinController;
  * It is also possible that instead of the icon a preview of the item
  * content is shown.
  */
-class LIBDOLPHINPRIVATE_EXPORT DolphinIconsView : public KListView
+class LIBDOLPHINPRIVATE_EXPORT DolphinIconsView : public KCategorizedView
 {
     Q_OBJECT
 
similarity index 91%
rename from src/klistview.cpp
rename to src/kcategorizedview.cpp
index 4db18e1f478d2e96de8f8118f818924d942708e7..c12f50e23b04ab50e89733a96743a9cfb2d00481 100644 (file)
@@ -18,8 +18,8 @@
   * Boston, MA 02110-1301, USA.
   */
 
-#include "klistview.h"
-#include "klistview_p.h"
+#include "kcategorizedview.h"
+#include "kcategorizedview_p.h"
 
 #include <math.h> // trunc on C99 compliant systems
 #include <kdefakes.h> // trunc for not C99 compliant systems
@@ -75,7 +75,7 @@ private:
 //==============================================================================
 
 
-KListView::Private::Private(KListView *listView)
+KCategorizedView::Private::Private(KCategorizedView *listView)
     : listView(listView)
     , itemCategorizer(0)
     , mouseButtonPressed(false)
@@ -86,11 +86,11 @@ KListView::Private::Private(KListView *listView)
 {
 }
 
-KListView::Private::~Private()
+KCategorizedView::Private::~Private()
 {
 }
 
-const QModelIndexList &KListView::Private::intersectionSet(const QRect &rect)
+const QModelIndexList &KCategorizedView::Private::intersectionSet(const QRect &rect)
 {
     QModelIndex index;
     QRect indexVisualRect;
@@ -138,7 +138,7 @@ const QModelIndexList &KListView::Private::intersectionSet(const QRect &rect)
     return intersectedIndexes;
 }
 
-QRect KListView::Private::visualRectInViewport(const QModelIndex &index) const
+QRect KCategorizedView::Private::visualRectInViewport(const QModelIndex &index) const
 {
     if (!index.isValid())
         return QRect();
@@ -196,7 +196,7 @@ QRect KListView::Private::visualRectInViewport(const QModelIndex &index) const
     return retRect;
 }
 
-QRect KListView::Private::visualCategoryRectInViewport(const QString &category)
+QRect KCategorizedView::Private::visualCategoryRectInViewport(const QString &category)
                                                                            const
 {
     QRect retRect(listView->spacing(),
@@ -248,7 +248,7 @@ QRect KListView::Private::visualCategoryRectInViewport(const QString &category)
 }
 
 // We're sure elementsPosition doesn't contain index
-const QRect &KListView::Private::cacheIndex(const QModelIndex &index)
+const QRect &KCategorizedView::Private::cacheIndex(const QModelIndex &index)
 {
     QRect rect = visualRectInViewport(index);
     elementsPosition[index] = rect;
@@ -257,7 +257,7 @@ const QRect &KListView::Private::cacheIndex(const QModelIndex &index)
 }
 
 // We're sure categoriesPosition doesn't contain category
-const QRect &KListView::Private::cacheCategory(const QString &category)
+const QRect &KCategorizedView::Private::cacheCategory(const QString &category)
 {
     QRect rect = visualCategoryRectInViewport(category);
     categoriesPosition[category] = rect;
@@ -265,7 +265,7 @@ const QRect &KListView::Private::cacheCategory(const QString &category)
     return categoriesPosition[category];
 }
 
-const QRect &KListView::Private::cachedRectIndex(const QModelIndex &index)
+const QRect &KCategorizedView::Private::cachedRectIndex(const QModelIndex &index)
 {
     if (elementsPosition.contains(index)) // If we have it cached
     {                                        // return it
@@ -277,7 +277,7 @@ const QRect &KListView::Private::cachedRectIndex(const QModelIndex &index)
     }
 }
 
-const QRect &KListView::Private::cachedRectCategory(const QString &category)
+const QRect &KCategorizedView::Private::cachedRectCategory(const QString &category)
 {
     if (categoriesPosition.contains(category)) // If we have it cached
     {                                                // return it
@@ -289,7 +289,7 @@ const QRect &KListView::Private::cachedRectCategory(const QString &category)
     }
 }
 
-QRect KListView::Private::visualRect(const QModelIndex &index)
+QRect KCategorizedView::Private::visualRect(const QModelIndex &index)
 {
     QModelIndex mappedIndex = proxyModel->mapToSource(index);
 
@@ -301,7 +301,7 @@ QRect KListView::Private::visualRect(const QModelIndex &index)
     return retRect;
 }
 
-QRect KListView::Private::categoryVisualRect(const QString &category)
+QRect KCategorizedView::Private::categoryVisualRect(const QString &category)
 {
     QRect retRect = cachedRectCategory(category);
     int dx = -listView->horizontalOffset();
@@ -311,7 +311,7 @@ QRect KListView::Private::categoryVisualRect(const QString &category)
     return retRect;
 }
 
-void KListView::Private::drawNewCategory(const QModelIndex &index,
+void KCategorizedView::Private::drawNewCategory(const QModelIndex &index,
                                          int sortRole,
                                          const QStyleOption &option,
                                          QPainter *painter)
@@ -331,7 +331,7 @@ void KListView::Private::drawNewCategory(const QModelIndex &index,
 }
 
 
-void KListView::Private::updateScrollbars()
+void KCategorizedView::Private::updateScrollbars()
 {
     int lastItemBottom = cachedRectIndex(lastIndex).bottom() +
                            listView->spacing() - listView->viewport()->height();
@@ -341,7 +341,7 @@ void KListView::Private::updateScrollbars()
     listView->verticalScrollBar()->setRange(0, lastItemBottom);
 }
 
-void KListView::Private::drawDraggedItems(QPainter *painter)
+void KCategorizedView::Private::drawDraggedItems(QPainter *painter)
 {
     QStyleOptionViewItemV3 option = listView->viewOptions();
     option.state &= ~QStyle::State_MouseOver;
@@ -360,7 +360,7 @@ void KListView::Private::drawDraggedItems(QPainter *painter)
     }
 }
 
-void KListView::Private::drawDraggedItems()
+void KCategorizedView::Private::drawDraggedItems()
 {
     QRect rectToUpdate;
     QRect currentRect;
@@ -387,18 +387,18 @@ void KListView::Private::drawDraggedItems()
 //==============================================================================
 
 
-KListView::KListView(QWidget *parent)
+KCategorizedView::KCategorizedView(QWidget *parent)
     : QListView(parent)
     , d(new Private(this))
 {
 }
 
-KListView::~KListView()
+KCategorizedView::~KCategorizedView()
 {
     delete d;
 }
 
-void KListView::setModel(QAbstractItemModel *model)
+void KCategorizedView::setModel(QAbstractItemModel *model)
 {
     d->lastSelection = QItemSelection();
     d->currentViewIndex = QModelIndex();
@@ -442,9 +442,9 @@ void KListView::setModel(QAbstractItemModel *model)
     }
 }
 
-QRect KListView::visualRect(const QModelIndex &index) const
+QRect KCategorizedView::visualRect(const QModelIndex &index) const
 {
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         return QListView::visualRect(index);
@@ -458,12 +458,12 @@ QRect KListView::visualRect(const QModelIndex &index) const
     return d->visualRect(index);
 }
 
-KItemCategorizer *KListView::itemCategorizer() const
+KItemCategorizer *KCategorizedView::itemCategorizer() const
 {
     return d->itemCategorizer;
 }
 
-void KListView::setItemCategorizer(KItemCategorizer *itemCategorizer)
+void KCategorizedView::setItemCategorizer(KItemCategorizer *itemCategorizer)
 {
     d->lastSelection = QItemSelection();
     d->currentViewIndex = QModelIndex();
@@ -513,9 +513,9 @@ void KListView::setItemCategorizer(KItemCategorizer *itemCategorizer)
     }
 }
 
-QModelIndex KListView::indexAt(const QPoint &point) const
+QModelIndex KCategorizedView::indexAt(const QPoint &point) const
 {
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         return QListView::indexAt(point);
@@ -535,7 +535,7 @@ QModelIndex KListView::indexAt(const QPoint &point) const
     return index;
 }
 
-void KListView::reset()
+void KCategorizedView::reset()
 {
     QListView::reset();
 
@@ -555,9 +555,9 @@ void KListView::reset()
     d->mouseButtonPressed = false;
 }
 
-void KListView::paintEvent(QPaintEvent *event)
+void KCategorizedView::paintEvent(QPaintEvent *event)
 {
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         QListView::paintEvent(event);
@@ -671,7 +671,7 @@ void KListView::paintEvent(QPaintEvent *event)
     painter.restore();
 }
 
-void KListView::resizeEvent(QResizeEvent *event)
+void KCategorizedView::resizeEvent(QResizeEvent *event)
 {
     QListView::resizeEvent(event);
 
@@ -680,7 +680,7 @@ void KListView::resizeEvent(QResizeEvent *event)
     d->categoriesPosition.clear();
     d->forcedSelectionPosition = 0;
 
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         return;
@@ -689,10 +689,10 @@ void KListView::resizeEvent(QResizeEvent *event)
     d->updateScrollbars();
 }
 
-void KListView::setSelection(const QRect &rect,
+void KCategorizedView::setSelection(const QRect &rect,
                              QItemSelectionModel::SelectionFlags flags)
 {
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         QListView::setSelection(rect, flags);
@@ -762,11 +762,11 @@ void KListView::setSelection(const QRect &rect,
     selectionModel()->select(selection, flags);
 }
 
-void KListView::mouseMoveEvent(QMouseEvent *event)
+void KCategorizedView::mouseMoveEvent(QMouseEvent *event)
 {
     QListView::mouseMoveEvent(event);
 
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         return;
@@ -822,7 +822,7 @@ void KListView::mouseMoveEvent(QMouseEvent *event)
     }
 }
 
-void KListView::mousePressEvent(QMouseEvent *event)
+void KCategorizedView::mousePressEvent(QMouseEvent *event)
 {
     d->dragLeftViewport = false;
 
@@ -840,13 +840,13 @@ void KListView::mousePressEvent(QMouseEvent *event)
     QListView::mousePressEvent(event);
 }
 
-void KListView::mouseReleaseEvent(QMouseEvent *event)
+void KCategorizedView::mouseReleaseEvent(QMouseEvent *event)
 {
     d->mouseButtonPressed = false;
 
     QListView::mouseReleaseEvent(event);
 
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         return;
@@ -884,7 +884,7 @@ void KListView::mouseReleaseEvent(QMouseEvent *event)
         viewport()->update(d->categoryVisualRect(d->hoveredCategory));
 }
 
-void KListView::leaveEvent(QEvent *event)
+void KCategorizedView::leaveEvent(QEvent *event)
 {
     d->hovered = QModelIndex();
     d->hoveredCategory = QString();
@@ -892,7 +892,7 @@ void KListView::leaveEvent(QEvent *event)
     QListView::leaveEvent(event);
 }
 
-void KListView::startDrag(Qt::DropActions supportedActions)
+void KCategorizedView::startDrag(Qt::DropActions supportedActions)
 {
     QListView::startDrag(supportedActions);
 
@@ -902,7 +902,7 @@ void KListView::startDrag(Qt::DropActions supportedActions)
     viewport()->update(d->lastDraggedItemsRect);
 }
 
-void KListView::dragMoveEvent(QDragMoveEvent *event)
+void KCategorizedView::dragMoveEvent(QDragMoveEvent *event)
 {
     d->mousePosition = event->pos();
 
@@ -917,7 +917,7 @@ void KListView::dragMoveEvent(QDragMoveEvent *event)
 
     d->dragLeftViewport = false;
 
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         QListView::dragMoveEvent(event);
@@ -927,17 +927,17 @@ void KListView::dragMoveEvent(QDragMoveEvent *event)
     d->drawDraggedItems();
 }
 
-void KListView::dragLeaveEvent(QDragLeaveEvent *event)
+void KCategorizedView::dragLeaveEvent(QDragLeaveEvent *event)
 {
     d->dragLeftViewport = true;
 
     QListView::dragLeaveEvent(event);
 }
 
-QModelIndex KListView::moveCursor(CursorAction cursorAction,
+QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction,
                                   Qt::KeyboardModifiers modifiers)
 {
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         return QListView::moveCursor(cursorAction, modifiers);
@@ -1059,13 +1059,13 @@ QModelIndex KListView::moveCursor(CursorAction cursorAction,
     return QListView::moveCursor(cursorAction, modifiers);
 }
 
-void KListView::rowsInserted(const QModelIndex &parent,
+void KCategorizedView::rowsInserted(const QModelIndex &parent,
                              int start,
                              int end)
 {
     QListView::rowsInserted(parent, start, end);
 
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         d->lastSelection = QItemSelection();
@@ -1089,7 +1089,7 @@ void KListView::rowsInserted(const QModelIndex &parent,
     rowsInsertedArtifficial(parent, start, end);
 }
 
-void KListView::rowsInsertedArtifficial(const QModelIndex &parent,
+void KCategorizedView::rowsInsertedArtifficial(const QModelIndex &parent,
                                         int start,
                                         int end)
 {
@@ -1201,11 +1201,11 @@ void KListView::rowsInsertedArtifficial(const QModelIndex &parent,
     d->updateScrollbars();
 }
 
-void KListView::rowsRemoved(const QModelIndex &parent,
+void KCategorizedView::rowsRemoved(const QModelIndex &parent,
                             int start,
                             int end)
 {
-    if ((viewMode() == KListView::IconMode) && d->proxyModel &&
+    if ((viewMode() == KCategorizedView::IconMode) && d->proxyModel &&
         d->itemCategorizer)
     {
         // Force the view to update all elements
@@ -1213,9 +1213,9 @@ void KListView::rowsRemoved(const QModelIndex &parent,
     }
 }
 
-void KListView::updateGeometries()
+void KCategorizedView::updateGeometries()
 {
-    if ((viewMode() != KListView::IconMode) || !d->proxyModel ||
+    if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel ||
         !d->itemCategorizer)
     {
         QListView::updateGeometries();
@@ -1227,9 +1227,9 @@ void KListView::updateGeometries()
     QAbstractItemView::updateGeometries();
 }
 
-void KListView::slotSortingRoleChanged()
+void KCategorizedView::slotSortingRoleChanged()
 {
-    if ((viewMode() == KListView::IconMode) && d->proxyModel &&
+    if ((viewMode() == KCategorizedView::IconMode) && d->proxyModel &&
         d->itemCategorizer)
     {
         // Force the view to update all elements
@@ -1237,4 +1237,4 @@ void KListView::slotSortingRoleChanged()
     }
 }
 
-#include "klistview.moc"
+#include "kcategorizedview.moc"
similarity index 92%
rename from src/klistview.h
rename to src/kcategorizedview.h
index 57a414c2f7986b1fa984d8e439066b680fd91609..8741a665491e8739c35ce8b2c78ecde9c64098e7 100644 (file)
@@ -18,8 +18,8 @@
   * Boston, MA 02110-1301, USA.
   */
 
-#ifndef KLISTVIEW_H
-#define KLISTVIEW_H
+#ifndef KCATEGORIZEDVIEW_H
+#define KCATEGORIZEDVIEW_H
 
 #include <QtGui/QListView>
 
@@ -30,7 +30,7 @@ class KItemCategorizer;
 /**
   * @short Item view for listing items
   *
-  * KListView allows you to use it as it were a QListView. You can add an
+  * KCategorizedView allows you to use it as it were a QListView. You can add an
   * itemCategorizer to it, so your items became categorized depending on the
   * KItemCategorizer inherited class rules.
   *
@@ -38,15 +38,15 @@ class KItemCategorizer;
   *
   * @author Rafael Fernández López <ereslibre@gmail.com>
   */
-class LIBDOLPHINPRIVATE_EXPORT KListView
+class LIBDOLPHINPRIVATE_EXPORT KCategorizedView
     : public QListView
 {
     Q_OBJECT
 
 public:
-    KListView(QWidget *parent = 0);
+    KCategorizedView(QWidget *parent = 0);
 
-    ~KListView();
+    ~KCategorizedView();
 
     virtual void setModel(QAbstractItemModel *model);
 
@@ -116,4 +116,4 @@ private:
     Private *d;
 };
 
-#endif // KLISTVIEW_H
+#endif // KCATEGORIZEDVIEW_H
similarity index 96%
rename from src/klistview_p.h
rename to src/kcategorizedview_p.h
index 4d0cec138aebba9a2d4a45cc09d0cbf0a130b0f2..8ce50441bca7cd5c6d318119021e45e35fffadac 100644 (file)
   * Boston, MA 02110-1301, USA.
   */
 
-#ifndef KLISTVIEW_P_H
-#define KLISTVIEW_P_H
+#ifndef KCATEGORIZEDVIEW_P_H
+#define KCATEGORIZEDVIEW_P_H
 
 class KSortFilterProxyModel;
 
 /**
   * @internal
   */
-class KListView::Private
+class KCategorizedView::Private
 {
 public:
-    Private(KListView *listView);
+    Private(KCategorizedView *listView);
     ~Private();
 
 
@@ -121,7 +121,7 @@ public:
     };
 
     // Basic data
-    KListView *listView;
+    KCategorizedView *listView;
     KItemCategorizer *itemCategorizer;
 
     // Behavior data
@@ -156,4 +156,4 @@ public:
     QModelIndex lastIndex;
 };
 
-#endif // KLISTVIEW_P_H
+#endif // KCATEGORIZEDVIEW_P_H