]> cloud.milkyroute.net Git - dolphin.git/commitdiff
KItemViews: Internal directory restructuration
authorPeter Penz <peter.penz19@gmail.com>
Wed, 11 Apr 2012 14:06:18 +0000 (16:06 +0200)
committerPeter Penz <peter.penz19@gmail.com>
Wed, 11 Apr 2012 14:08:32 +0000 (16:08 +0200)
- Move all private headers from the kitemviews-directory into
the 'private' subdirectory.

- Get rid of DolphinDirLister and just use a directory-lister
  internally in KFileItemModel.

- Minor interface-cleanups for signals

58 files changed:
src/CMakeLists.txt
src/dolphinmainwindow.cpp
src/dolphinpart.cpp
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h
src/kitemviews/kfileitemlistview.cpp
src/kitemviews/kfileitemlistwidget.cpp
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodel.h
src/kitemviews/kfileitemmodelrolesupdater.cpp
src/kitemviews/kfileitemmodelrolesupdater.h
src/kitemviews/kitemlistcontainer.cpp
src/kitemviews/kitemlistcontroller.cpp
src/kitemviews/kitemlistheader.cpp
src/kitemviews/kitemlistkeyboardsearchmanager_p.h [deleted file]
src/kitemviews/kitemlistrubberband_p.h [deleted file]
src/kitemviews/kitemlistview.cpp
src/kitemviews/kitemlistview.h
src/kitemviews/kitemlistwidget.cpp
src/kitemviews/private/kfileitemclipboard.cpp [moved from src/kitemviews/kfileitemclipboard.cpp with 97% similarity]
src/kitemviews/private/kfileitemclipboard.h [moved from src/kitemviews/kfileitemclipboard_p.h with 100% similarity]
src/kitemviews/private/kfileitemmodeldirlister.cpp [moved from src/views/dolphindirlister.cpp with 71% similarity]
src/kitemviews/private/kfileitemmodeldirlister.h [moved from src/views/dolphindirlister.h with 81% similarity]
src/kitemviews/private/kfileitemmodelfilter.cpp [moved from src/kitemviews/kfileitemmodelfilter.cpp with 98% similarity]
src/kitemviews/private/kfileitemmodelfilter.h [moved from src/kitemviews/kfileitemmodelfilter_p.h with 100% similarity]
src/kitemviews/private/kfileitemmodelsortalgorithm.cpp [moved from src/kitemviews/kfileitemmodelsortalgorithm.cpp with 99% similarity]
src/kitemviews/private/kfileitemmodelsortalgorithm.h [moved from src/kitemviews/kfileitemmodelsortalgorithm_p.h with 100% similarity]
src/kitemviews/private/kitemlistheaderwidget.cpp [moved from src/kitemviews/kitemlistheaderwidget.cpp with 99% similarity]
src/kitemviews/private/kitemlistheaderwidget.h [moved from src/kitemviews/kitemlistheaderwidget_p.h with 100% similarity]
src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp [moved from src/kitemviews/kitemlistkeyboardsearchmanager.cpp with 98% similarity]
src/kitemviews/private/kitemlistrubberband.cpp [moved from src/kitemviews/kitemlistrubberband.cpp with 97% similarity]
src/kitemviews/private/kitemlistselectiontoggle.cpp [moved from src/kitemviews/kitemlistselectiontoggle.cpp with 97% similarity]
src/kitemviews/private/kitemlistselectiontoggle.h [moved from src/kitemviews/kitemlistselectiontoggle_p.h with 100% similarity]
src/kitemviews/private/kitemlistsizehintresolver.cpp [moved from src/kitemviews/kitemlistsizehintresolver.cpp with 98% similarity]
src/kitemviews/private/kitemlistsizehintresolver.h [moved from src/kitemviews/kitemlistsizehintresolver_p.h with 100% similarity]
src/kitemviews/private/kitemlistsmoothscroller.cpp [moved from src/kitemviews/kitemlistsmoothscroller.cpp with 98% similarity]
src/kitemviews/private/kitemlistsmoothscroller.h [moved from src/kitemviews/kitemlistsmoothscroller_p.h with 100% similarity]
src/kitemviews/private/kitemlistviewanimation.cpp [moved from src/kitemviews/kitemlistviewanimation.cpp with 98% similarity]
src/kitemviews/private/kitemlistviewanimation.h [moved from src/kitemviews/kitemlistviewanimation_p.h with 100% similarity]
src/kitemviews/private/kitemlistviewlayouter.cpp [moved from src/kitemviews/kitemlistviewlayouter.cpp with 99% similarity]
src/kitemviews/private/kitemlistviewlayouter.h [moved from src/kitemviews/kitemlistviewlayouter_p.h with 100% similarity]
src/kitemviews/private/knepomukdatamanagement_export.h [moved from src/kitemviews/knepomukdatamanagement_export_p.h with 100% similarity]
src/kitemviews/private/knepomukresourcewatcher.h [moved from src/kitemviews/knepomukresourcewatcher_p.h with 99% similarity]
src/kitemviews/private/knepomukrolesprovider.cpp [moved from src/kitemviews/knepomukrolesprovider.cpp with 99% similarity]
src/kitemviews/private/knepomukrolesprovider.h [moved from src/kitemviews/knepomukrolesprovider_p.h with 100% similarity]
src/kitemviews/private/kpixmapmodifier.cpp [moved from src/kitemviews/kpixmapmodifier.cpp with 99% similarity]
src/kitemviews/private/kpixmapmodifier.h [moved from src/kitemviews/kpixmapmodifier_p.h with 100% similarity]
src/panels/folders/folderspanel.cpp
src/panels/folders/folderspanel.h
src/tests/CMakeLists.txt
src/tests/kfileitemmodeltest.cpp
src/tests/kitemlistcontrollertest.cpp
src/tests/kitemlistkeyboardsearchmanagertest.cpp
src/views/dolphinitemlistcontainer.cpp
src/views/dolphinitemlistcontainer.h
src/views/dolphinview.cpp
src/views/dolphinview.h
src/views/versioncontrol/versioncontrolobserver.cpp

index 6ac4464e869dfa173c68ffa004fc09bcfa675ec7..e9079569a589d88058a29f09c7a00dc4eab12c49 100644 (file)
@@ -18,38 +18,38 @@ add_subdirectory(tests)
 ########### next target ###############
 
 set(dolphinprivate_LIB_SRCS
-    kitemviews/kfileitemclipboard.cpp
     kitemviews/kfileitemlistgroupheader.cpp
     kitemviews/kfileitemlistview.cpp
     kitemviews/kfileitemlistwidget.cpp
     kitemviews/kfileitemmodel.cpp
-    kitemviews/kfileitemmodelsortalgorithm.cpp
-    kitemviews/kfileitemmodelfilter.cpp
     kitemviews/kfileitemmodelrolesupdater.cpp
     kitemviews/kitemlistcontainer.cpp
     kitemviews/kitemlistcontroller.cpp
     kitemviews/kitemlistgroupheader.cpp
     kitemviews/kitemlistheader.cpp
-    kitemviews/kitemlistheaderwidget.cpp
-    kitemviews/kitemlistkeyboardsearchmanager.cpp
-    kitemviews/kitemlistrubberband.cpp
     kitemviews/kitemlistselectionmanager.cpp
-    kitemviews/kitemlistselectiontoggle.cpp
-    kitemviews/kitemlistsizehintresolver.cpp
-    kitemviews/kitemlistsmoothscroller.cpp
     kitemviews/kitemliststyleoption.cpp
     kitemviews/kitemlistview.cpp
-    kitemviews/kitemlistviewanimation.cpp
-    kitemviews/kitemlistviewlayouter.cpp
     kitemviews/kitemlistwidget.cpp
     kitemviews/kitemmodelbase.cpp
-    kitemviews/kpixmapmodifier.cpp
+    kitemviews/private/kfileitemclipboard.cpp
+    kitemviews/private/kfileitemmodeldirlister.cpp
+    kitemviews/private/kfileitemmodelsortalgorithm.cpp
+    kitemviews/private/kfileitemmodelfilter.cpp
+    kitemviews/private/kitemlistheaderwidget.cpp
+    kitemviews/private/kitemlistkeyboardsearchmanager.cpp
+    kitemviews/private/kitemlistrubberband.cpp
+    kitemviews/private/kitemlistselectiontoggle.cpp
+    kitemviews/private/kitemlistsizehintresolver.cpp
+    kitemviews/private/kitemlistsmoothscroller.cpp
+    kitemviews/private/kitemlistviewanimation.cpp
+    kitemviews/private/kitemlistviewlayouter.cpp
+    kitemviews/private/kpixmapmodifier.cpp
     settings/additionalinfodialog.cpp
     settings/applyviewpropsjob.cpp
     settings/viewmodes/viewmodesettings.cpp
     settings/viewpropertiesdialog.cpp
     settings/viewpropsprogressinfo.cpp
-    views/dolphindirlister.cpp
     views/dolphinfileitemlistwidget.cpp
     views/dolphinitemlistcontainer.cpp
     views/dolphinnewfilemenuobserver.cpp
@@ -71,7 +71,7 @@ set(dolphinprivate_LIB_SRCS
 if (Nepomuk_FOUND)
     set(dolphinprivate_LIB_SRCS
         ${dolphinprivate_LIB_SRCS}
-        kitemviews/knepomukrolesprovider.cpp
+        kitemviews/private/knepomukrolesprovider.cpp
     )
 endif (Nepomuk_FOUND)
 
index 3aff015c50584d04b6822438ac8657f560d4a351..22d8af3c3b286953936ea5bd5d1ac6588c6950df 100644 (file)
@@ -2088,9 +2088,9 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, SLOT(openNewTab(KUrl)));
     connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
             this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
-    connect(view, SIGNAL(startedPathLoading(KUrl)),
+    connect(view, SIGNAL(startedDirLoading(KUrl)),
             this, SLOT(enableStopAction()));
-    connect(view, SIGNAL(finishedPathLoading(KUrl)),
+    connect(view, SIGNAL(finishedDirLoading(KUrl)),
             this, SLOT(disableStopAction()));
     connect(view, SIGNAL(goBackRequested()),
             this, SLOT(goBack()));
index 8720e0ce2202ae035b43ad2f4b3e86e3c2b3cab8..bb944bad0bd77047faf395bf422b152cea8ee2bd 100644 (file)
 #include "views/dolphinviewactionhandler.h"
 #include "views/dolphinnewfilemenuobserver.h"
 #include "views/dolphinremoteencoding.h"
-#include "views/dolphindirlister.h"
 
 #include <QActionGroup>
 #include <QApplication>
 #include <QClipboard>
+#include <QDir>
 
 K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
 K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
@@ -69,8 +69,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
     m_view->setTabsForFilesEnabled(true);
     setWidget(m_view);
 
-    connect(m_view, SIGNAL(finishedPathLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
-    connect(m_view, SIGNAL(pathLoadingProgress(int)), this, SLOT(updateProgress(int)));
+    connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
+    connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateProgress(int)));
     connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
 
     setXMLFile("dolphinpart.rc");
index 1c15c88a99c6d8699d5d053a1c42b86b974ca7bf..a6049992f7868c61f8f89991e2eebf53b6cfb5a3 100644 (file)
@@ -92,21 +92,20 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
     connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus()));
 
     m_view = new DolphinView(url, this);
-    connect(m_view, SIGNAL(urlChanged(KUrl)),             m_urlNavigator, SLOT(setUrl(KUrl)));
-    connect(m_view, SIGNAL(writeStateChanged(bool)),      this, SIGNAL(writeStateChanged(bool)));
-    connect(m_view, SIGNAL(requestItemInfo(KFileItem)),   this, SLOT(showItemInfo(KFileItem)));
-    connect(m_view, SIGNAL(errorMessage(QString)),        this, SLOT(showErrorMessage(QString)));
-    connect(m_view, SIGNAL(infoMessage(QString)),         this, SLOT(showInfoMessage(QString)));
-    connect(m_view, SIGNAL(itemActivated(KFileItem)),     this, SLOT(slotItemActivated(KFileItem)));
-    connect(m_view, SIGNAL(redirection(KUrl,KUrl)),       this, SLOT(redirect(KUrl,KUrl)));
-    connect(m_view, SIGNAL(startedPathLoading(KUrl)),     this, SLOT(slotStartedPathLoading()));
-    connect(m_view, SIGNAL(finishedPathLoading(KUrl)),    this, SLOT(slotFinishedPathLoading()));
-    connect(m_view, SIGNAL(itemCountChanged()),           this, SLOT(delayedStatusBarUpdate()));
-    connect(m_view, SIGNAL(pathLoadingProgress(int)),     this, SLOT(updateLoadingProgress(int)));
-    connect(m_view, SIGNAL(sortProgress(int)),            this, SLOT(updateSortProgress(int)));
-    connect(m_view, SIGNAL(infoMessage(QString)),         this, SLOT(showInfoMessage(QString)));
-    connect(m_view, SIGNAL(errorMessage(QString)),        this, SLOT(showErrorMessage(QString)));
-    connect(m_view, SIGNAL(urlIsFileError(KUrl)),         this, SLOT(openFile(KUrl)));
+    connect(m_view, SIGNAL(urlChanged(KUrl)),                   m_urlNavigator, SLOT(setUrl(KUrl)));
+    connect(m_view, SIGNAL(writeStateChanged(bool)),            this, SIGNAL(writeStateChanged(bool)));
+    connect(m_view, SIGNAL(requestItemInfo(KFileItem)),         this, SLOT(showItemInfo(KFileItem)));
+    connect(m_view, SIGNAL(errorMessage(QString)),              this, SLOT(showErrorMessage(QString)));
+    connect(m_view, SIGNAL(infoMessage(QString)),               this, SLOT(showInfoMessage(QString)));
+    connect(m_view, SIGNAL(itemActivated(KFileItem)),           this, SLOT(slotItemActivated(KFileItem)));
+    connect(m_view, SIGNAL(redirection(KUrl,KUrl)),             this, SLOT(redirect(KUrl,KUrl)));
+    connect(m_view, SIGNAL(startedDirLoading(KUrl)),            this, SLOT(slotStartedDirLoading()));
+    connect(m_view, SIGNAL(finishedDirLoading(KUrl)),           this, SLOT(slotFinishedDirLoading()));
+    connect(m_view, SIGNAL(itemCountChanged()),                 this, SLOT(delayedStatusBarUpdate()));
+    connect(m_view, SIGNAL(dirLoadingProgress(int)),            this, SLOT(updateDirLoadingProgress(int)));
+    connect(m_view, SIGNAL(dirSortingProgress(int)),            this, SLOT(updateSortingProgress(int)));
+    connect(m_view, SIGNAL(infoMessage(QString)),               this, SLOT(showInfoMessage(QString)));
+    connect(m_view, SIGNAL(errorMessage(QString)),              this, SLOT(showErrorMessage(QString)));
     connect(m_view, SIGNAL(selectionChanged(KFileItemList)),    this, SLOT(delayedStatusBarUpdate()));
     connect(m_view, SIGNAL(operationCompletedMessage(QString)), this, SLOT(showOperationCompletedMessage(QString)));
     connect(m_view, SIGNAL(urlAboutToBeChanged(KUrl)),          this, SLOT(slotViewUrlAboutToBeChanged(KUrl)));
@@ -333,7 +332,7 @@ void DolphinViewContainer::updateStatusBar()
     }
 }
 
-void DolphinViewContainer::updateLoadingProgress(int percent)
+void DolphinViewContainer::updateDirLoadingProgress(int percent)
 {
     if (m_statusBar->progressText().isEmpty()) {
         m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
@@ -341,7 +340,7 @@ void DolphinViewContainer::updateLoadingProgress(int percent)
     m_statusBar->setProgress(percent);
 }
 
-void DolphinViewContainer::updateSortProgress(int percent)
+void DolphinViewContainer::updateSortingProgress(int percent)
 {
     if (m_statusBar->progressText().isEmpty()) {
         m_statusBar->setProgressText(i18nc("@info:progress", "Sorting..."));
@@ -349,7 +348,7 @@ void DolphinViewContainer::updateSortProgress(int percent)
     m_statusBar->setProgress(percent);
 }
 
-void DolphinViewContainer::slotStartedPathLoading()
+void DolphinViewContainer::slotStartedDirLoading()
 {
     if (isSearchUrl(url())) {
         // Search KIO-slaves usually don't provide any progress information. Give
@@ -361,18 +360,18 @@ void DolphinViewContainer::slotStartedPathLoading()
         // Trigger an undetermined progress indication. The progress
         // information in percent will be triggered by the percent() signal
         // of the directory lister later.
-        updateLoadingProgress(-1);
+        updateDirLoadingProgress(-1);
     }
 }
 
-void DolphinViewContainer::slotFinishedPathLoading()
+void DolphinViewContainer::slotFinishedDirLoading()
 {
     if (!m_statusBar->progressText().isEmpty()) {
         m_statusBar->setProgressText(QString());
         m_statusBar->setProgress(100);
     }
 
-    if (isSearchUrl(url()) && m_view->items().isEmpty()) {
+    if (isSearchUrl(url()) && m_view->itemsCount() == 0) {
         // The dir lister has been completed on a Nepomuk-URI and no items have been found. Instead
         // of showing the default status bar information ("0 items") a more helpful information is given:
         m_statusBar->setMessage(i18nc("@info:status", "No items found."), DolphinStatusBar::Information);
@@ -422,12 +421,6 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item)
     item.run();
 }
 
-void DolphinViewContainer::openFile(const KUrl& url)
-{
-    const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
-    slotItemActivated(item);
-}
-
 void DolphinViewContainer::showItemInfo(const KFileItem& item)
 {
     if (item.isNull()) {
index 734021aa9927731ae2ec889f4c779a5e8eacda9a..de3bd60a64e756341a24f14dae16ec3d0fd8259d 100644 (file)
@@ -154,21 +154,21 @@ private slots:
      */
     void updateStatusBar();
 
-    void updateLoadingProgress(int percent);
+    void updateDirLoadingProgress(int percent);
 
-    void updateSortProgress(int percent);
+    void updateSortingProgress(int percent);
 
     /**
      * Updates the statusbar to show an undetermined progress with the correct
      * context information whether a searching or a directory loading is done.
      */
-    void slotStartedPathLoading();
+    void slotStartedDirLoading();
 
     /**
      * Assures that the viewport position is restored and updates the
      * statusbar to reflect the current content.
      */
-    void slotFinishedPathLoading();
+    void slotFinishedDirLoading();
 
     /**
      * Handles clicking on an item. If the item is a directory, the
@@ -177,13 +177,6 @@ private slots:
      */
     void slotItemActivated(const KFileItem& item);
 
-    /**
-     * Opens a the file \a url by opening the corresponding application.
-     * Is connected with the signal urlIsFile() from DolphinDirLister and will
-     * get invoked if the user manually has entered a file into the URL navigator.
-     */
-    void openFile(const KUrl& url);
-
     /**
      * Shows the information for the item \a item inside the statusbar. If the
      * item is null, the default statusbar information is shown.
index 11760fed1cc9f285d1652f9493f817ee9c9df664..6464ec38acd0497c5f814b5bf49b5e935ab6000c 100644 (file)
@@ -23,9 +23,9 @@
 #include "kfileitemmodelrolesupdater.h"
 #include "kfileitemlistwidget.h"
 #include "kfileitemmodel.h"
-#include "kpixmapmodifier_p.h"
 #include <KLocale>
 #include <KStringHandler>
+#include "private/kpixmapmodifier.h"
 
 #include <KDebug>
 #include <KIcon>
index 14ec1ec22f15b379722fa69b39b3a90dbf7815fc..f3b4da892f6ecd633f8a84ecf4d5cb3e07ca25b8 100644 (file)
 
 #include "kfileitemlistwidget.h"
 
-#include "kfileitemclipboard_p.h"
 #include "kfileitemlistview.h"
 #include "kfileitemmodel.h"
-#include "kpixmapmodifier_p.h"
 
 #include <KIcon>
 #include <KIconEffect>
@@ -32,6 +30,9 @@
 #include <KStringHandler>
 #include <KDebug>
 
+#include "private/kfileitemclipboard.h"
+#include "private/kpixmapmodifier.h"
+
 #include <QFontMetricsF>
 #include <QGraphicsSceneResizeEvent>
 #include <QPainter>
@@ -193,12 +194,15 @@ QRectF KFileItemListWidget::textRect() const
 
 QRectF KFileItemListWidget::textFocusRect() const
 {
+    // In the compact- and details-layout a larger textRect() is returned to be aligned
+    // with the iconRect(). This is useful to have a larger selection/hover-area
+    // when having a quite large icon size but only one line of text. Still the
+    // focus rectangle should be shown as narrow as possible around the text.
+
     const_cast<KFileItemListWidget*>(this)->triggerCacheRefreshing();
-    if (m_layout == CompactLayout) {
-        // In the compact layout a larger textRect() is returned to be aligned
-        // with the iconRect(). This is useful to have a larger selection/hover-area
-        // when having a quite large icon size but only one line of text. Still the
-        // focus rectangle should be shown as narrow as possible around the text.
+
+    switch (m_layout) {
+    case CompactLayout: {
         QRectF rect = m_textRect;
         const TextInfo* topText    = m_textInfo.value(m_sortedVisibleRoles.first());
         const TextInfo* bottomText = m_textInfo.value(m_sortedVisibleRoles.last());
@@ -206,6 +210,19 @@ QRectF KFileItemListWidget::textFocusRect() const
         rect.setBottom(bottomText->pos.y() + bottomText->staticText.size().height());
         return rect;
     }
+
+    case DetailsLayout: {
+        QRectF rect = m_textRect;
+        const TextInfo* textInfo    = m_textInfo.value(m_sortedVisibleRoles.first());
+        rect.setTop(textInfo->pos.y());
+        rect.setBottom(textInfo->pos.y() + textInfo->staticText.size().height());
+        return rect;
+    }
+
+    default:
+        break;
+    }
+
     return m_textRect;
 }
 
index 685af8972901421934178b5d59877a476c187e06..409b5cd5293b83f26bb29185c03d8d8ca0fbebcf 100644 (file)
 
 #include "kfileitemmodel.h"
 
-#include <KDirLister>
 #include <KDirModel>
-#include "kfileitemmodelsortalgorithm_p.h"
 #include <KGlobalSettings>
 #include <KLocale>
 #include <KStringHandler>
 #include <KDebug>
 
+#include "private/kfileitemmodelsortalgorithm.h"
+#include "private/kfileitemmodeldirlister.h"
+
 #include <QMimeData>
 #include <QTimer>
 
 // #define KFILEITEMMODEL_DEBUG
 
-KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
+KFileItemModel::KFileItemModel(QObject* parent) :
     KItemModelBase("name", parent),
-    m_dirLister(dirLister),
+    m_dirLister(0),
     m_naturalSorting(KGlobalSettings::naturalSorting()),
     m_sortFoldersFirst(true),
     m_sortRole(NameRole),
-    m_sortProgressPercent(-1),
+    m_sortingProgressPercent(-1),
     m_roles(),
     m_caseSensitivity(Qt::CaseInsensitive),
     m_itemData(),
@@ -54,6 +55,22 @@ KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
     m_expandedUrls(),
     m_urlsToExpand()
 {
+    m_dirLister = new KFileItemModelDirLister(this);
+    m_dirLister->setAutoUpdate(true);
+    m_dirLister->setDelayedMimeTypes(true);
+
+    connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(dirLoadingStarted()));
+    connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
+    connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
+    connect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(slotNewItems(KFileItemList)));
+    connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList)));
+    connect(m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)), this, SLOT(slotRefreshItems(QList<QPair<KFileItem,KFileItem> >)));
+    connect(m_dirLister, SIGNAL(clear()), this, SLOT(slotClear()));
+    connect(m_dirLister, SIGNAL(clear(KUrl)), this, SLOT(slotClear(KUrl)));
+    connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
+    connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
+    connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(redirection(KUrl,KUrl)));
+
     // Apply default roles that should be determined
     resetRoles();
     m_requestRole[NameRole] = true;
@@ -61,16 +78,6 @@ KFileItemModel::KFileItemModel(KDirLister* dirLister, QObject* parent) :
     m_roles.insert("name");
     m_roles.insert("isDir");
 
-    Q_ASSERT(dirLister);
-
-    connect(dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
-    connect(dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
-    connect(dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(slotNewItems(KFileItemList)));
-    connect(dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(slotItemsDeleted(KFileItemList)));
-    connect(dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)), this, SLOT(slotRefreshItems(QList<QPair<KFileItem,KFileItem> >)));
-    connect(dirLister, SIGNAL(clear()), this, SLOT(slotClear()));
-    connect(dirLister, SIGNAL(clear(KUrl)), this, SLOT(slotClear(KUrl)));
-
     // For slow KIO-slaves like used for searching it makes sense to show results periodically even
     // before the completed() or canceled() signal has been emitted.
     m_maximumUpdateIntervalTimer = new QTimer(this);
@@ -96,6 +103,21 @@ KFileItemModel::~KFileItemModel()
     m_itemData.clear();
 }
 
+void KFileItemModel::loadDir(const KUrl& url)
+{
+    m_dirLister->openUrl(url);
+}
+
+void KFileItemModel::refreshDir(const KUrl& url)
+{
+    m_dirLister->openUrl(url, KDirLister::Reload);
+}
+
+KUrl KFileItemModel::dir() const
+{
+    return m_dirLister->url();
+}
+
 int KFileItemModel::count() const
 {
     return m_itemData.count();
@@ -160,34 +182,26 @@ bool KFileItemModel::sortFoldersFirst() const
 
 void KFileItemModel::setShowHiddenFiles(bool show)
 {
-    KDirLister* dirLister = m_dirLister.data();
-    if (dirLister) {
-        dirLister->setShowingDotFiles(show);
-        dirLister->emitChanges();
-        if (show) {
-            slotCompleted();
-        }
+    m_dirLister->setShowingDotFiles(show);
+    m_dirLister->emitChanges();
+    if (show) {
+        slotCompleted();
     }
 }
 
 bool KFileItemModel::showHiddenFiles() const
 {
-    const KDirLister* dirLister = m_dirLister.data();
-    return dirLister ? dirLister->showingDotFiles() : false;
+    return m_dirLister->showingDotFiles();
 }
 
 void KFileItemModel::setShowFoldersOnly(bool enabled)
 {
-    KDirLister* dirLister = m_dirLister.data();
-    if (dirLister) {
-        dirLister->setDirOnlyMode(enabled);
-    }
+    m_dirLister->setDirOnlyMode(enabled);
 }
 
 bool KFileItemModel::showFoldersOnly() const
 {
-    KDirLister* dirLister = m_dirLister.data();
-    return dirLister ? dirLister->dirOnlyMode() : false;
+    return m_dirLister->dirOnlyMode();
 }
 
 QMimeData* KFileItemModel::createMimeData(const QSet<int>& indexes) const
@@ -324,11 +338,7 @@ int KFileItemModel::index(const KUrl& url) const
 
 KFileItem KFileItemModel::rootItem() const
 {
-    const KDirLister* dirLister = m_dirLister.data();
-    if (dirLister) {
-        return dirLister->rootItem();
-    }
-    return KFileItem();
+    return m_dirLister->rootItem();
 }
 
 void KFileItemModel::clear()
@@ -391,21 +401,14 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
         return false;
     }
 
-    KDirLister* dirLister = m_dirLister.data();
     const KUrl url = m_itemData.at(index)->item.url();
     if (expanded) {
         m_expandedUrls.insert(url);
-
-        if (dirLister) {
-            dirLister->openUrl(url, KDirLister::Keep);
-            return true;
-        }
+        m_dirLister->openUrl(url, KDirLister::Keep);
     } else {
         m_expandedUrls.remove(url);
+        m_dirLister->stop(url);
 
-        if (dirLister) {
-            dirLister->stop(url);
-        }
 
         KFileItemList itemsToRemove;
         const int expandedParentsCount = data(index)["expandedParentsCount"].toInt();
@@ -415,10 +418,9 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
             ++index;
         }
         removeItems(itemsToRemove);
-        return true;
     }
 
-    return false;
+    return true;
 }
 
 bool KFileItemModel::isExpanded(int index) const
@@ -460,18 +462,13 @@ void KFileItemModel::restoreExpandedUrls(const QSet<KUrl>& urls)
 
 void KFileItemModel::expandParentItems(const KUrl& url)
 {
-    const KDirLister* dirLister = m_dirLister.data();
-    if (!dirLister) {
-        return;
-    }
-
-    const int pos = dirLister->url().path().length();
+    const int pos = m_dirLister->url().path().length();
 
     // Assure that each sub-path of the URL that should be
     // expanded is added to m_urlsToExpand. KDirLister
     // does not care whether the parent-URL has already been
     // expanded.
-    KUrl urlToExpand = dirLister->url();
+    KUrl urlToExpand = m_dirLister->url();
     const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
     for (int i = 0; i < subDirs.count() - 1; ++i) {
         urlToExpand.addPath(subDirs.at(i));
@@ -537,6 +534,11 @@ QString KFileItemModel::nameFilter() const
     return m_filter.pattern();
 }
 
+void KFileItemModel::cancelDirLoading()
+{
+    m_dirLister->stop();
+}
+
 QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
 {
     static QList<RoleInfo> rolesInfo;
@@ -666,7 +668,7 @@ void KFileItemModel::slotCompleted()
         m_urlsToExpand.clear();
     }
 
-    emit loadingCompleted();
+    emit dirLoadingCompleted();
 }
 
 void KFileItemModel::slotCanceled()
@@ -1222,8 +1224,8 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item)
     }
 
     if (m_requestRole[ExpandedParentsCountRole]) {
-        if (m_expandedParentsCountRoot == UninitializedExpandedParentsCountRoot && m_dirLister.data()) {
-            const KUrl rootUrl = m_dirLister.data()->url();
+        if (m_expandedParentsCountRoot == UninitializedExpandedParentsCountRoot) {
+            const KUrl rootUrl = m_dirLister->url();
             const QString protocol = rootUrl.protocol();
             const bool forceExpandedParentsCountRoot = (protocol == QLatin1String("trash") ||
                                                         protocol == QLatin1String("nepomuk") ||
@@ -1501,8 +1503,7 @@ QString KFileItemModel::subPath(const KFileItem& item,
 
 bool KFileItemModel::useMaximumUpdateInterval() const
 {
-    const KDirLister* dirLister = m_dirLister.data();
-    return dirLister && !dirLister->url().isLocalFile();
+    return !m_dirLister->url().isLocalFile();
 }
 
 QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
@@ -1847,20 +1848,20 @@ void KFileItemModel::emitSortProgress(int resolvedCount)
 
     const int itemCount = count();
     if (resolvedCount >= itemCount) {
-        m_sortProgressPercent = -1;
+        m_sortingProgressPercent = -1;
         if (m_resortAllItemsTimer->isActive()) {
             m_resortAllItemsTimer->stop();
             resortAllItems();
         }
 
-        emit sortProgress(100);
+        emit dirSortingProgress(100);
     } else if (itemCount > 0) {
         resolvedCount = qBound(0, resolvedCount, itemCount);
 
         const int progress = resolvedCount * 100 / itemCount;
-        if (m_sortProgressPercent != progress) {
-            m_sortProgressPercent = progress;
-            emit sortProgress(progress);
+        if (m_sortingProgressPercent != progress) {
+            m_sortingProgressPercent = progress;
+            emit dirSortingProgress(progress);
         }
     }
 }
index eaf35fecd92b641d60767c7bc79a7f0854d3e511..05834cd31befd03f7113c67c00fa5d60ccf57256 100644 (file)
 #include <libdolphin_export.h>
 #include <KFileItemList>
 #include <KUrl>
-#include <kitemviews/kfileitemmodelfilter_p.h>
 #include <kitemviews/kitemmodelbase.h>
+#include <kitemviews/private/kfileitemmodelfilter.h>
 
 #include <QHash>
 
-class KDirLister;
+class KFileItemModelDirLister;
 class QTimer;
 
 /**
@@ -42,24 +42,37 @@ class QTimer;
  *
  * Also the recursive expansion of sub-directories is supported by
  * KFileItemModel::setExpanded().
- *
- * TODO: In the longterm instead of passing a KDirLister just an URL should
- * be passed and a KDirLister used internally. This solves the following issues:
- * - The user of the API does not need to decide whether he listens to KDirLister
- *   or KFileItemModel.
- * - It resolves minor conceptual differences between KDirLister and KFileItemModel.
- *   E.g. there is no way for KFileItemModel to check whether a completed() signal
- *   will be emitted after newItems() will be send by KDirLister or not (in the case
- *   of setShowingDotFiles() no completed() signal will get emitted).
  */
 class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase
 {
     Q_OBJECT
 
 public:
-    explicit KFileItemModel(KDirLister* dirLister, QObject* parent = 0);
+    explicit KFileItemModel(QObject* parent = 0);
     virtual ~KFileItemModel();
 
+    /**
+     * Loads the directory specified by \a url. The signals
+     * dirLoadingStarted(), dirLoadingProgress() and dirLoadingCompleted()
+     * indicate the current state of the loading process. The items
+     * of the directory are added after the loading has been completed.
+     */
+    void loadDir(const KUrl& url);
+
+    /**
+     * Throws away all currently loaded items and refreshes the directory
+     * by reloading all items again.
+     */
+    void refreshDir(const KUrl& url);
+
+    /**
+     * @return Parent directory of the items that are shown. In case
+     *         if a directory tree is shown, KFileItemModel::dir() returns
+     *         the root-parent of all items.
+     * @see rootItem()
+     */
+    KUrl dir() const;
+
     virtual int count() const;
     virtual QHash<QByteArray, QVariant> data(int index) const;
     virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
@@ -123,7 +136,8 @@ public:
     int index(const KUrl& url) const;
 
     /**
-     * @return Root item of all items.
+     * @return Root item of all items representing the item
+     *         for KFileItemModel::dir().
      */
     KFileItem rootItem() const;
 
@@ -158,6 +172,8 @@ public:
     void setNameFilter(const QString& nameFilter);
     QString nameFilter() const;
 
+    void cancelDirLoading();
+
     struct RoleInfo
     {   QByteArray role;
         QString translation;
@@ -175,6 +191,14 @@ public:
     static QList<RoleInfo> rolesInformation();
 
 signals:
+    /**
+     * Is emitted if the loading of a directory has been started. It is
+     * assured that a signal dirLoadingCompleted() will be send after
+     * the loading has been finished. For tracking the loading progress
+     * the signal dirLoadingProgress() gets emitted in between.
+     */
+    void dirLoadingStarted();
+
     /**
      * Is emitted after the loading of a directory has been completed or new
      * items have been inserted to an already loaded directory. Usually
@@ -182,14 +206,38 @@ signals:
      * (the only exception is loading an empty directory, where only a
      * loadingCompleted() signal gets emitted).
      */
-    void loadingCompleted();
+    void dirLoadingCompleted();
+
+    /**
+     * Informs about the progress in percent when loading a directory. It is assured
+     * that the signal dirLoadingStarted() has been emitted before.
+     */
+    void dirLoadingProgress(int percent);
 
     /**
      * Is emitted if the sort-role gets resolved asynchronously and provides
      * the progress-information of the sorting in percent. It is assured
      * that the last sortProgress-signal contains 100 as value.
      */
-    void sortProgress(int percent);
+    void dirSortingProgress(int percent);
+
+    /**
+     * Is emitted if an information message (e.g. "Connecting to host...")
+     * should be shown.
+     */
+    void infoMessage(const QString& message);
+
+    /**
+     * Is emitted if an error message (e.g. "Unknown location")
+     * should be shown.
+     */
+    void errorMessage(const QString& message);
+
+    /**
+     * Is emitted if a redirection from the current URL \a oldUrl
+     * to the new URL \a newUrl has been done.
+     */
+    void redirection(const KUrl& oldUrl, const KUrl& newUrl);
 
 protected:
     virtual void onGroupedSortingChanged(bool current);
@@ -357,13 +405,13 @@ private:
     static void determineMimeTypes(const KFileItemList& items, int timeout);
 
 private:
-    QWeakPointer<KDirLister> m_dirLister;
+    KFileItemModelDirLister* m_dirLister;
 
     bool m_naturalSorting;
     bool m_sortFoldersFirst;
 
     RoleType m_sortRole;
-    int m_sortProgressPercent; // Value of sortProgress() signal
+    int m_sortingProgressPercent; // Value of dirSortingProgress() signal
     QSet<QByteArray> m_roles;
     Qt::CaseSensitivity m_caseSensitivity;
 
index 632df676d427ee1fd7a34e643e0bfe2121421aea..927407a69d6642e88355750ccc7efd9b368c9a9e 100644 (file)
@@ -20,7 +20,6 @@
 #include "kfileitemmodelrolesupdater.h"
 
 #include "kfileitemmodel.h"
-#include "kpixmapmodifier_p.h"
 
 #include <KConfig>
 #include <KConfigGroup>
 #include <KFileItem>
 #include <KGlobal>
 #include <KIO/PreviewJob>
+
+#include "private/kpixmapmodifier.h"
+
 #include <QPainter>
 #include <QPixmap>
 #include <QElapsedTimer>
 #include <QTimer>
 
 #ifdef HAVE_NEPOMUK
-    #include "knepomukrolesprovider_p.h"
-    #include "knepomukresourcewatcher_p.h"
+    #include "private/knepomukrolesprovider.h"
+    #include "private/knepomukresourcewatcher.h"
 #endif
 
 // Required includes for subItemsCount():
@@ -69,7 +71,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
     m_previewShown(false),
     m_enlargeSmallPreviews(true),
     m_clearPreviews(false),
-    m_sortProgress(-1),
+    m_sortingProgress(-1),
     m_model(model),
     m_iconSize(),
     m_firstVisibleIndex(0),
@@ -849,7 +851,7 @@ void KFileItemModelRolesUpdater::sortAndResolvePendingRoles()
 
 void KFileItemModelRolesUpdater::applySortProgressToModel()
 {
-    if (m_sortProgress < 0) {
+    if (m_sortingProgress < 0) {
         return;
     }
 
@@ -861,7 +863,7 @@ void KFileItemModelRolesUpdater::applySortProgressToModel()
     if (resolvedCount > 0) {
         m_model->emitSortProgress(resolvedCount);
         if (resolvedCount == m_model->count()) {
-            m_sortProgress = -1;
+            m_sortingProgress = -1;
         }
     }
 }
@@ -877,11 +879,11 @@ void KFileItemModelRolesUpdater::updateSortProgress()
                               ? hasUnknownMimeTypes()
                               : m_resolvableRoles.contains(sortRole);
 
-    if (m_sortProgress >= 0) {
+    if (m_sortingProgress >= 0) {
         // Mark the current sorting as finished
         m_model->emitSortProgress(m_model->count());
     }
-    m_sortProgress = showProgress ? 0 : -1;
+    m_sortingProgress = showProgress ? 0 : -1;
 }
 
 bool KFileItemModelRolesUpdater::hasUnknownMimeTypes() const
index ce8cf1c73e2ea309b5b3017ccb1ba0f5b968538d..c520a23e889c2fd11897d2731985f6a6ca54ffc7 100644 (file)
@@ -240,7 +240,7 @@ private:
     // during the roles-updater has been paused by setPaused().
     bool m_clearPreviews;
 
-    int m_sortProgress;
+    int m_sortingProgress;
 
     KFileItemModel* m_model;
     QSize m_iconSize;
index b480b449488eb7b40411cf88be27cd7ae31f6109..5a485b62c3338c89fa1934a42cb7eee6a1a610ec 100644 (file)
 #include "kitemlistcontainer.h"
 
 #include "kitemlistcontroller.h"
-#include "kitemlistsmoothscroller_p.h"
 #include "kitemlistview.h"
 #include "kitemmodelbase.h"
 
+#include "private/kitemlistsmoothscroller.h"
+
 #include <QApplication>
 #include <QGraphicsScene>
 #include <QGraphicsView>
index ad08223a40bc9ae514859c8ae86ea140c7491eb1..c0f565b4dd94ec34a703f8b926b563dd77a9c4b6 100644 (file)
 
 #include "kitemlistcontroller.h"
 
+#include <KGlobalSettings>
+#include <KDebug>
+
 #include "kitemlistview.h"
-#include "kitemlistrubberband_p.h"
 #include "kitemlistselectionmanager.h"
-#include "kitemlistkeyboardsearchmanager_p.h"
+
+#include "private/kitemlistrubberband.h"
+#include "private/kitemlistkeyboardsearchmanager.h"
 
 #include <QApplication>
 #include <QDrag>
@@ -37,9 +41,6 @@
 #include <QMimeData>
 #include <QTimer>
 
-#include <KGlobalSettings>
-#include <KDebug>
-
 KItemListController::KItemListController(QObject* parent) :
     QObject(parent),
     m_singleClickActivation(KGlobalSettings::singleClick()),
index be7a09c8f0ac12a1a36b9c0393ed7ec0d2c6c087..e89ece0a19d03433c58f1a4272587d5863b41fcf 100644 (file)
  ***************************************************************************/
 
 #include "kitemlistheader.h"
-#include "kitemlistheaderwidget_p.h"
 #include "kitemlistview.h"
 
+#include "private/kitemlistheaderwidget.h"
+
 KItemListHeader::~KItemListHeader()
 {
 }
diff --git a/src/kitemviews/kitemlistkeyboardsearchmanager_p.h b/src/kitemviews/kitemlistkeyboardsearchmanager_p.h
deleted file mode 100644 (file)
index d6a6686..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2011 by Tirtha Chatterjee <tirtha.p.chatterjee@gmail.com> *
- *                                                                         *
- *   Based on the Itemviews NG project from Trolltech Labs:                *
- *   http://qt.gitorious.org/qt-labs/itemviews-ng                          *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
-
-#ifndef KITEMLISTKEYBOARDMANAGER_H
-#define KITEMLISTKEYBOARDMANAGER_H
-
-#include <libdolphin_export.h>
-
-#include <QObject>
-#include <QString>
-#include <QElapsedTimer>
-
-/**
- * @brief Controls the keyboard searching ability for a KItemListController.
- *
- * @see KItemListController
- * @see KItemModelBase
- */
-class LIBDOLPHINPRIVATE_EXPORT KItemListKeyboardSearchManager : public QObject
-{
-    Q_OBJECT
-
-public:
-
-    KItemListKeyboardSearchManager(QObject* parent = 0);
-    virtual ~KItemListKeyboardSearchManager();
-
-    /**
-     * Add \a keys to the text buffer used for searching.
-     */
-    void addKeys(const QString& keys);
-
-    /**
-     * Sets the delay after which the search is cancelled to \a milliseconds.
-     * If the time interval between two calls of addKeys(const QString&) is
-     * larger than this, the second call will start a new search, rather than
-     * combining the keys received from both calls to a single search string.
-     */
-    void setTimeout(qint64 milliseconds);
-    qint64 timeout() const;
-
-signals:
-    /**
-     * Is emitted if the current item should be changed corresponding
-     * to \a text.
-     * @param searchFromNextItem If true start searching from item next to the
-     *                           current item. Otherwise, search from the
-     *                           current item.
-     */
-    // TODO: Think about getting rid of the bool parameter
-    // (see http://doc.qt.nokia.com/qq/qq13-apis.html#thebooleanparametertrap)
-    void changeCurrentItem(const QString& string, bool searchFromNextItem);
-
-private:
-    QString m_searchedString;
-    QElapsedTimer m_keyboardInputTime;
-    qint64 m_timeout;
-};
-
-#endif
-
-
diff --git a/src/kitemviews/kitemlistrubberband_p.h b/src/kitemviews/kitemlistrubberband_p.h
deleted file mode 100644 (file)
index aea58af..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com>             *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program 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 General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
-
-#ifndef KITEMLISTRUBBERBAND_H
-#define KITEMLISTRUBBERBAND_H
-
-#include <libdolphin_export.h>
-#include <QObject>
-#include <QPointF>
-
-/**
- * @brief Manages the rubberband when selecting items.
- */
-class LIBDOLPHINPRIVATE_EXPORT KItemListRubberBand : public QObject
-{
-    Q_OBJECT
-
-public:
-    explicit KItemListRubberBand(QObject* parent = 0);
-    virtual ~KItemListRubberBand();
-
-    void setStartPosition(const QPointF& pos);
-    QPointF startPosition() const;
-
-    void setEndPosition(const QPointF& pos);
-    QPointF endPosition() const;
-
-    void setActive(bool active);
-    bool isActive() const;
-
-signals:
-    void activationChanged(bool active);
-    void startPositionChanged(const QPointF& current, const QPointF& previous);
-    void endPositionChanged(const QPointF& current, const QPointF& previous);
-
-private:
-    bool m_active;
-    QPointF m_startPos;
-    QPointF m_endPos;
-};
-
-#endif
-
-
index 1e68c2bd2509cebb664ceebeb5f2cd968ce5c085..732ed24e48fe3ae5de05edf611aafd24f7166350 100644 (file)
 
 #include "kitemlistcontroller.h"
 #include "kitemlistheader.h"
-#include "kitemlistheaderwidget_p.h"
-#include "kitemlistrubberband_p.h"
 #include "kitemlistselectionmanager.h"
-#include "kitemlistsizehintresolver_p.h"
-#include "kitemlistviewlayouter_p.h"
-#include "kitemlistviewanimation_p.h"
 #include "kitemlistwidget.h"
 
+#include "private/kitemlistheaderwidget.h"
+#include "private/kitemlistrubberband.h"
+#include "private/kitemlistsizehintresolver.h"
+#include "private/kitemlistviewlayouter.h"
+#include "private/kitemlistviewanimation.h"
+
 #include <KDebug>
 
 #include <QCursor>
index d65ece8e29ed3817c272482e01d7e51e1902604d..a3c11a6bf142a6584d0789a5e2e5c9ff73d0f025 100644 (file)
@@ -27,9 +27,9 @@
 
 #include <kitemviews/kitemlistgroupheader.h>
 #include <kitemviews/kitemliststyleoption.h>
-#include <kitemviews/kitemlistviewanimation_p.h>
 #include <kitemviews/kitemlistwidget.h>
 #include <kitemviews/kitemmodelbase.h>
+#include <kitemviews/private/kitemlistviewanimation.h>
 #include <QGraphicsWidget>
 #include <QSet>
 
index b703fbfe233f5ad184df35ddb7d520f20c130ac9..74b96ca1f572dd3500e6bf3bc948148729a63c22 100644 (file)
 
 #include "kitemlistwidget.h"
 
-#include "kitemlistselectiontoggle_p.h"
 #include "kitemlistview.h"
 #include "kitemmodelbase.h"
 
+#include "private/kitemlistselectiontoggle.h"
+
 #include <KDebug>
 
 #include <KGlobalSettings>
similarity index 97%
rename from src/kitemviews/kfileitemclipboard.cpp
rename to src/kitemviews/private/kfileitemclipboard.cpp
index fb63f953032bbb556dac9b0f79b11667328ce514..6d608564152270eaa00ca06f12730111ac6abcf8 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kfileitemclipboard_p.h"
+#include "kfileitemclipboard.h"
 
 #include <KGlobal>
 #include <QApplication>
@@ -73,4 +73,4 @@ KFileItemClipboard::KFileItemClipboard() :
             this, SLOT(updateCutItems()));
 }
 
-#include "kfileitemclipboard_p.moc"
+#include "kfileitemclipboard.moc"
similarity index 71%
rename from src/views/dolphindirlister.cpp
rename to src/kitemviews/private/kfileitemmodeldirlister.cpp
index b62abe167bd6977e3df43ec46f72bc1ef81734d2..be0f9f77b8b8db8dca0540d8b91aa66942bce602 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2006-2010 by Peter Penz <peter.penz19@gmail.com>        *
+ *   Copyright (C) 2006-2012 by Peter Penz <peter.penz19@gmail.com>        *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "dolphindirlister.h"
+#include "kfileitemmodeldirlister.h"
 #include <KLocale>
 #include <KIO/JobClasses>
 
-DolphinDirLister::DolphinDirLister(QObject* parent) :
+KFileItemModelDirLister::KFileItemModelDirLister(QObject* parent) :
     KDirLister(parent)
 {
     setAutoErrorHandlingEnabled(false, 0);
 }
 
-DolphinDirLister::~DolphinDirLister()
+KFileItemModelDirLister::~KFileItemModelDirLister()
 {
 }
 
-void DolphinDirLister::handleError(KIO::Job* job)
+void KFileItemModelDirLister::handleError(KIO::Job* job)
 {
-    if (job->error() == KIO::ERR_IS_FILE) {
-        emit urlIsFileError(url());
+    const QString errorString = job->errorString();
+    if (errorString.isEmpty()) {
+        emit errorMessage(i18nc("@info:status", "Unknown error."));
     } else {
-        const QString errorString = job->errorString();
-        if (errorString.isEmpty()) {
-            emit errorMessage(i18nc("@info:status", "Unknown error."));
-        } else {
-            emit errorMessage(errorString);
-        }
+        emit errorMessage(errorString);
     }
 }
 
-#include "dolphindirlister.moc"
+#include "kfileitemmodeldirlister.moc"
similarity index 81%
rename from src/views/dolphindirlister.h
rename to src/kitemviews/private/kfileitemmodeldirlister.h
index 0955df2321deba8c3c6928a138a216fae3f2f2fe..1d58347f479647573c4c9a5a56bd054cbc4ea13b 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2006-2009 by Peter Penz <peter.penz19@gmail.com>        *
+ *   Copyright (C) 2006-2012 by Peter Penz <peter.penz19@gmail.com>        *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -17,8 +17,8 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#ifndef DOLPHINDIRLISTER_H
-#define DOLPHINDIRLISTER_H
+#ifndef KFILEITEMMODELDIRLISTER_H
+#define KFILEITEMMODELDIRLISTER_H
 
 #include <libdolphin_export.h>
 #include <KDirLister>
 /**
  * @brief Extends the class KDirLister by emitting a signal when an
  *        error occurred instead of showing an error dialog.
+ *        KDirLister::autoErrorHandlingEnabled() is set to false.
  */
-class LIBDOLPHINPRIVATE_EXPORT DolphinDirLister : public KDirLister
+class LIBDOLPHINPRIVATE_EXPORT KFileItemModelDirLister : public KDirLister
 {
     Q_OBJECT
 
 public:
-    DolphinDirLister(QObject* parent = 0);
-    virtual ~DolphinDirLister();
+    KFileItemModelDirLister(QObject* parent = 0);
+    virtual ~KFileItemModelDirLister();
 
 signals:
     /** Is emitted whenever an error has occurred. */
     void errorMessage(const QString& msg);
 
-    /** Is emitted when the URL of the directory lister represents a file. */
-    void urlIsFileError(const KUrl& url);
-
 protected:
     virtual void handleError(KIO::Job* job);
 };
similarity index 98%
rename from src/kitemviews/kfileitemmodelfilter.cpp
rename to src/kitemviews/private/kfileitemmodelfilter.cpp
index f3f47ba5672f5cd13f04c0577d79dd00ec8d08ce..816d35634f95e6fed457427fefab115f15a78600 100644 (file)
@@ -18,7 +18,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kfileitemmodelfilter_p.h"
+#include "kfileitemmodelfilter.h"
 
 #include <KFileItem>
 #include <QRegExp>
similarity index 99%
rename from src/kitemviews/kfileitemmodelsortalgorithm.cpp
rename to src/kitemviews/private/kfileitemmodelsortalgorithm.cpp
index 4c2f29dee5456a17ae5c924b63690ce1fc9ca81d..e0aac13de3e1f7848280ae26d8b5e9a92c081ff2 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kfileitemmodelsortalgorithm_p.h"
+#include "kfileitemmodelsortalgorithm.h"
 
 void KFileItemModelSortAlgorithm::sort(KFileItemModel* model,
                                        QList<KFileItemModel::ItemData*>::iterator begin,
similarity index 99%
rename from src/kitemviews/kitemlistheaderwidget.cpp
rename to src/kitemviews/private/kitemlistheaderwidget.cpp
index 2105b674c132a17f2da7a6e64a9a074dc3353fd7..576516f25227419f1b6bd9aee66d73cb22aa3161 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistheaderwidget_p.h"
+#include "kitemlistheaderwidget.h"
 
 #include <KAction>
 #include <KMenu>
-#include "kitemmodelbase.h"
+#include <kitemviews/kitemmodelbase.h>
 
 #include <QApplication>
 #include <QGraphicsSceneHoverEvent>
@@ -532,4 +532,4 @@ qreal KItemListHeaderWidget::roleXPosition(const QByteArray& role) const
     return -1;
 }
 
-#include "kitemlistheaderwidget_p.moc"
+#include "kitemlistheaderwidget.moc"
similarity index 98%
rename from src/kitemviews/kitemlistkeyboardsearchmanager.cpp
rename to src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp
index f4dc1a54745b444de7638621177e18cbc98fffcb..2f4e93b1d8151d501ffc0ab52f0a406dce94c5f4 100644 (file)
@@ -20,7 +20,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistkeyboardsearchmanager_p.h"
+#include "kitemlistkeyboardsearchmanager.h"
 
 #include <QApplication>
 #include <QElapsedTimer>
similarity index 97%
rename from src/kitemviews/kitemlistrubberband.cpp
rename to src/kitemviews/private/kitemlistrubberband.cpp
index c1f276cdfe3a037fc17b1ec7e9e7aa6e19f95dba..ae023d2aac59500c293c76fd30a4203a1bc92d82 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistrubberband_p.h"
+#include "kitemlistrubberband.h"
 
 KItemListRubberBand::KItemListRubberBand(QObject* parent) :
     QObject(parent),
@@ -72,4 +72,4 @@ bool KItemListRubberBand::isActive() const
     return m_active;
 }
 
-#include "kitemlistrubberband_p.moc"
+#include "kitemlistrubberband.moc"
similarity index 97%
rename from src/kitemviews/kitemlistselectiontoggle.cpp
rename to src/kitemviews/private/kitemlistselectiontoggle.cpp
index 014f65b40d6636d2f022eee9387586fe4f9278cc..66da6a727bccd2eac4a9af831cbbf7e33df9f23b 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistselectiontoggle_p.h"
+#include "kitemlistselectiontoggle.h"
 
 #include <KIconEffect>
 #include <KIconLoader>
@@ -103,4 +103,4 @@ void KItemListSelectionToggle::updatePixmap()
     }
 }
 
-#include "kitemlistselectiontoggle_p.moc"
+#include "kitemlistselectiontoggle.moc"
similarity index 98%
rename from src/kitemviews/kitemlistsizehintresolver.cpp
rename to src/kitemviews/private/kitemlistsizehintresolver.cpp
index 0520fac0408257067ba9bd35cca283a34120f04a..c76ff0f5503c7b01d8b7eb6285fade6c9b14755f 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistsizehintresolver_p.h"
+#include "kitemlistsizehintresolver.h"
 
 #include <kitemviews/kitemlistview.h>
 #include <KDebug>
similarity index 98%
rename from src/kitemviews/kitemlistsmoothscroller.cpp
rename to src/kitemviews/private/kitemlistsmoothscroller.cpp
index 80f7f28837a11b0a6e4ce3e690c920d9260193ea..6987e1ce13303ab1a72fb7444376f7ba03c1adaf 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistsmoothscroller_p.h"
+#include "kitemlistsmoothscroller.h"
 
 #include <KGlobalSettings>
 #include <QEvent>
@@ -204,4 +204,4 @@ void KItemListSmoothScroller::handleWheelEvent(QWheelEvent* event)
     event->accept();
 }
 
-#include "kitemlistsmoothscroller_p.moc"
+#include "kitemlistsmoothscroller.moc"
similarity index 98%
rename from src/kitemviews/kitemlistviewanimation.cpp
rename to src/kitemviews/private/kitemlistviewanimation.cpp
index 9184b7144f01a7dca1d4b2a24b232bf19b72ec6f..e347c5bb113a97c7fa4eb2ec4c1f308d2dcffdb9 100644 (file)
@@ -17,9 +17,9 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistviewanimation_p.h"
+#include "kitemlistviewanimation.h"
 
-#include "kitemlistview.h"
+#include <kitemviews/kitemlistview.h>
 
 #include <KDebug>
 #include <KGlobalSettings>
@@ -242,4 +242,4 @@ void KItemListViewAnimation::slotFinished()
     Q_ASSERT(false);
 }
 
-#include "kitemlistviewanimation_p.moc"
+#include "kitemlistviewanimation.moc"
similarity index 99%
rename from src/kitemviews/kitemlistviewlayouter.cpp
rename to src/kitemviews/private/kitemlistviewlayouter.cpp
index 405837d23882f0e7fd5fd95fb81dbd80f035eba4..c15b44e13b1593b77cbd9360272ce1812751e679 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "kitemlistviewlayouter_p.h"
+#include "kitemlistviewlayouter.h"
 
-#include "kitemmodelbase.h"
-#include "kitemlistsizehintresolver_p.h"
+#include <kitemviews/kitemmodelbase.h>
+#include "kitemlistsizehintresolver.h"
 
 #include <KDebug>
 
@@ -627,4 +627,4 @@ qreal KItemListViewLayouter::minimumGroupHeaderWidth() const
     return 100;
 }
 
-#include "kitemlistviewlayouter_p.moc"
+#include "kitemlistviewlayouter.moc"
similarity index 99%
rename from src/kitemviews/knepomukresourcewatcher_p.h
rename to src/kitemviews/private/knepomukresourcewatcher.h
index 9b4b8b71d28224b4a19785706e1247321cd0cfbc..3f6643fc8ecb6eb7094fd25eebf33336833d3a41 100644 (file)
@@ -29,7 +29,7 @@
 #include <QtDBus/QDBusVariant>
 #include <QtCore/QVariant>
 
-#include "knepomukdatamanagement_export_p.h"
+#include "knepomukdatamanagement_export.h"
 
 namespace Nepomuk {
 
similarity index 99%
rename from src/kitemviews/knepomukrolesprovider.cpp
rename to src/kitemviews/private/knepomukrolesprovider.cpp
index 25fb161212a3e0537f9f91f1fa7632ea7cb27789..7af887cbfbfbe8f8f017d73c5746717ee1e9590e 100644 (file)
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "knepomukrolesprovider_p.h"
+#include "knepomukrolesprovider.h"
 
 #include <KDebug>
 #include <KGlobal>
similarity index 99%
rename from src/kitemviews/kpixmapmodifier.cpp
rename to src/kitemviews/private/kpixmapmodifier.cpp
index 475f36a64fb1c506f6f10d05e44f1255cd7f0b1f..29aceb66b65a9521ec986ec6fc506684f4efc2aa 100644 (file)
@@ -32,7 +32,7 @@
     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "kpixmapmodifier_p.h"
+#include "kpixmapmodifier.h"
 
 #include <QImage>
 #include <QPainter>
index 87b0297c2711c10974007bea5c144a59fa1d89f1..2f9e1d323c9dac57279275735f155ada3cc63a24 100644 (file)
@@ -30,7 +30,6 @@
 #include <kitemviews/kitemlistcontroller.h>
 #include <kitemviews/kfileitemmodel.h>
 
-#include <KDirLister>
 #include <KFileItem>
 #include <konq_operations.h>
 
@@ -50,7 +49,6 @@
 FoldersPanel::FoldersPanel(QWidget* parent) :
     Panel(parent),
     m_updateCurrentItem(false),
-    m_dirLister(0),
     m_controller(0)
 {
     setLayoutDirection(Qt::LeftToRight);
@@ -65,9 +63,6 @@ FoldersPanel::~FoldersPanel()
         m_controller->setView(0);
         delete view;
     }
-
-    delete m_dirLister;
-    m_dirLister = 0;
 }
 
 void FoldersPanel::setShowHiddenFiles(bool show)
@@ -116,7 +111,7 @@ bool FoldersPanel::urlChanged()
         return false;
     }
 
-    if (m_dirLister) {
+    if (m_controller) {
         loadTree(url());
     }
 
@@ -130,16 +125,10 @@ void FoldersPanel::showEvent(QShowEvent* event)
         return;
     }
 
-    if (!m_dirLister) {
+    if (!m_controller) {
         // Postpone the creating of the dir lister to the first show event.
         // This assures that no performance and memory overhead is given when the TreeView is not
         // used at all (see FoldersPanel::setUrl()).
-        m_dirLister = new KDirLister();
-        m_dirLister->setAutoUpdate(true);
-        m_dirLister->setMainWindow(window());
-        m_dirLister->setDelayedMimeTypes(true);
-        m_dirLister->setAutoErrorHandlingEnabled(false, this);
-
         KFileItemListView* view  = new KFileItemListView();
         view->setWidgetCreator(new KItemListWidgetCreator<KFileItemListWidget>());
 
@@ -158,12 +147,12 @@ void FoldersPanel::showEvent(QShowEvent* event)
         // opening the folders panel.
         view->setOpacity(0);
 
-        KFileItemModel* model = new KFileItemModel(m_dirLister, this);
+        KFileItemModel* model = new KFileItemModel(this);
         model->setShowFoldersOnly(true);
         model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
         // Use a QueuedConnection to give the view the possibility to react first on the
         // finished loading.
-        connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
+        connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
 
         KItemListContainer* container = new KItemListContainer(this);
         m_controller = container->controller();
@@ -305,7 +294,7 @@ void FoldersPanel::startFadeInAnimation()
 
 void FoldersPanel::loadTree(const KUrl& url)
 {
-    Q_ASSERT(m_dirLister);
+    Q_ASSERT(m_controller);
 
     m_updateCurrentItem = false;
 
@@ -319,13 +308,12 @@ void FoldersPanel::loadTree(const KUrl& url)
         baseUrl.setPath(QString('/'));
     }
 
-    if (m_dirLister->url() != baseUrl) {
+    KFileItemModel* model = fileItemModel();
+    if (model->dir() != baseUrl) {
         m_updateCurrentItem = true;
-        m_dirLister->stop();
-        m_dirLister->openUrl(baseUrl, KDirLister::Reload);
+        model->refreshDir(baseUrl);
     }
 
-    KFileItemModel* model = fileItemModel();
     const int index = model->index(url);
     if (index >= 0) {
         updateCurrentItem(index);
index 44acfb88f23839259e56d8f546b8246977378050..babcde64a4690af357a0ac7af6f8ee4ad3dae9fa 100644 (file)
@@ -23,7 +23,6 @@
 #include <KUrl>
 #include <panels/panel.h>
 
-class KDirLister;
 class KFileItemModel;
 class KItemListController;
 class QGraphicsSceneDragDropEvent;
@@ -100,7 +99,6 @@ private:
 
 private:
     bool m_updateCurrentItem;
-    KDirLister* m_dirLister;
     KItemListController* m_controller;
 };
 
index 43d1c9bf7274c53fab1b76897b9e198ea6896dc1..de254f6da9b86ff16d47e990d6417096b440d494 100644 (file)
@@ -49,7 +49,7 @@ target_link_libraries(kfileitemmodeltest dolphinprivate ${KDE4_KIO_LIBS} ${QT_QT
 # KItemListKeyboardSearchManagerTest
 set(kitemlistkeyboardsearchmanagertest_SRCS
     kitemlistkeyboardsearchmanagertest.cpp
-    ../kitemviews/kitemlistkeyboardsearchmanager.cpp
+    ../kitemviews/private/kitemlistkeyboardsearchmanager.cpp
 )
 kde4_add_unit_test(kitemlistkeyboardsearchmanagertest TEST ${kitemlistkeyboardsearchmanagertest_SRCS})
 target_link_libraries(kitemlistkeyboardsearchmanagertest ${KDE4_KIO_LIBS} ${QT_QTTEST_LIBRARY})
index cce92626dd7f6fa428494a45812d894945b1340e..e96aee6d74ae213467af0016b1fe1196ce4f452d 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <KDirLister>
 #include "kitemviews/kfileitemmodel.h"
+#include "kitemviews/private/kfileitemmodeldirlister.h"
 #include "testdir.h"
 
 void myMessageOutput(QtMsgType type, const char* msg)
@@ -62,7 +63,7 @@ private slots:
     void testDefaultGroupedSorting();
     void testNewItems();
     void testRemoveItems();
-    void testLoadingCompleted();
+    void testDirLoadingCompleted();
     void testSetData();
     void testSetDataWithModifiedSortRole_data();
     void testSetDataWithModifiedSortRole();
@@ -82,7 +83,6 @@ private:
 
 private:
     KFileItemModel* m_model;
-    KDirLister* m_dirLister;
     TestDir* m_testDir;
 };
 
@@ -97,9 +97,8 @@ void KFileItemModelTest::init()
     qRegisterMetaType<KFileItemList>("KFileItemList");
 
     m_testDir = new TestDir();
-    m_dirLister = new KDirLister();
-    m_dirLister->setAutoUpdate(false);
-    m_model = new KFileItemModel(m_dirLister);
+    m_model = new KFileItemModel();
+    m_model->m_dirLister->setAutoUpdate(false);
 }
 
 void KFileItemModelTest::cleanup()
@@ -107,9 +106,6 @@ void KFileItemModelTest::cleanup()
     delete m_model;
     m_model = 0;
 
-    delete m_dirLister;
-    m_dirLister = 0;
-
     delete m_testDir;
     m_testDir = 0;
 }
@@ -131,7 +127,7 @@ void KFileItemModelTest::testDefaultSortRole()
 
     m_testDir->createFiles(files);
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     QCOMPARE(m_model->count(), 3);
@@ -151,7 +147,7 @@ void KFileItemModelTest::testNewItems()
     files << "a.txt" << "b.txt" << "c.txt";
     m_testDir->createFiles(files);
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     QCOMPARE(m_model->count(), 3);
@@ -163,36 +159,36 @@ void KFileItemModelTest::testRemoveItems()
 {
     m_testDir->createFile("a.txt");
     m_testDir->createFile("b.txt");
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
     QCOMPARE(m_model->count(), 2);
     QVERIFY(isModelConsistent());
 
     m_testDir->removeFile("a.txt");
-    m_dirLister->updateDirectory(m_testDir->url());
+    m_model->m_dirLister->updateDirectory(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsRemoved(KItemRangeList)), DefaultTimeout));
     QCOMPARE(m_model->count(), 1);
     QVERIFY(isModelConsistent());
 }
 
-void KFileItemModelTest::testLoadingCompleted()
+void KFileItemModelTest::testDirLoadingCompleted()
 {
-    QSignalSpy loadingCompletedSpy(m_model, SIGNAL(loadingCompleted()));
+    QSignalSpy loadingCompletedSpy(m_model, SIGNAL(dirLoadingCompleted()));
     QSignalSpy itemsInsertedSpy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
     QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
 
     m_testDir->createFiles(QStringList() << "a.txt" << "b.txt" << "c.txt");
 
-    m_dirLister->openUrl(m_testDir->url());
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    m_model->loadDir(m_testDir->url());
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
     QCOMPARE(loadingCompletedSpy.count(), 1);
     QCOMPARE(itemsInsertedSpy.count(), 1);
     QCOMPARE(itemsRemovedSpy.count(), 0);
     QCOMPARE(m_model->count(), 3);
 
     m_testDir->createFiles(QStringList() << "d.txt" << "e.txt");
-    m_dirLister->updateDirectory(m_testDir->url());
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    m_model->m_dirLister->updateDirectory(m_testDir->url());
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
     QCOMPARE(loadingCompletedSpy.count(), 2);
     QCOMPARE(itemsInsertedSpy.count(), 2);
     QCOMPARE(itemsRemovedSpy.count(), 0);
@@ -200,15 +196,15 @@ void KFileItemModelTest::testLoadingCompleted()
 
     m_testDir->removeFile("a.txt");
     m_testDir->createFile("f.txt");
-    m_dirLister->updateDirectory(m_testDir->url());
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    m_model->m_dirLister->updateDirectory(m_testDir->url());
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
     QCOMPARE(loadingCompletedSpy.count(), 3);
     QCOMPARE(itemsInsertedSpy.count(), 3);
     QCOMPARE(itemsRemovedSpy.count(), 1);
     QCOMPARE(m_model->count(), 5);
 
     m_testDir->removeFile("b.txt");
-    m_dirLister->updateDirectory(m_testDir->url());
+    m_model->m_dirLister->updateDirectory(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsRemoved(KItemRangeList)), DefaultTimeout));
     QCOMPARE(loadingCompletedSpy.count(), 4);
     QCOMPARE(itemsInsertedSpy.count(), 3);
@@ -222,7 +218,7 @@ void KFileItemModelTest::testSetData()
 {
     m_testDir->createFile("a.txt");
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     QHash<QByteArray, QVariant> values;
@@ -279,7 +275,7 @@ void KFileItemModelTest::testSetDataWithModifiedSortRole()
     files << "a.txt" << "b.txt" << "c.txt";
     m_testDir->createFiles(files);
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     // Fill the "rating" role of each file:
@@ -331,7 +327,7 @@ void KFileItemModelTest::testModelConsistencyWhenInsertingItems()
     // KFileItemModel to do a lot of insert operation and hence decrease
     // the timeout to 1 millisecond.
     m_testDir->createFile("1");
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
     QCOMPARE(m_model->count(), 1);
 
@@ -351,7 +347,7 @@ void KFileItemModelTest::testModelConsistencyWhenInsertingItems()
             m_testDir->createFile(QString::number(itemName));
         }
 
-        m_dirLister->updateDirectory(m_testDir->url());
+        m_model->m_dirLister->updateDirectory(m_testDir->url());
         if (spy.count() == 0) {
             QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
         }
@@ -371,7 +367,7 @@ void KFileItemModelTest::testItemRangeConsistencyWhenInsertingItems()
     // Due to inserting the 3 items one item-range with index == 0 and
     // count == 3 must be given
     QSignalSpy spy1(m_model, SIGNAL(itemsInserted(KItemRangeList)));
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     QCOMPARE(spy1.count(), 1);
@@ -396,7 +392,7 @@ void KFileItemModelTest::testItemRangeConsistencyWhenInsertingItems()
     m_testDir->createFiles(files);
 
     QSignalSpy spy2(m_model, SIGNAL(itemsInserted(KItemRangeList)));
-    m_dirLister->updateDirectory(m_testDir->url());
+    m_model->m_dirLister->updateDirectory(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     QCOMPARE(spy2.count(), 1);
@@ -424,7 +420,7 @@ void KFileItemModelTest::testExpandItems()
     QSet<KUrl> allFolders;
     allFolders << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1");
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     // So far, the model contains only "a/"
@@ -496,9 +492,9 @@ void KFileItemModelTest::testExpandItems()
     QCOMPARE(m_model->count(), 0);
     QVERIFY(m_model->expandedUrls().empty());
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     m_model->restoreExpandedUrls(allFolders);
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
     QCOMPARE(m_model->count(), 5);  // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
     QVERIFY(m_model->isExpanded(0));
     QVERIFY(m_model->isExpanded(1));
@@ -509,12 +505,12 @@ void KFileItemModelTest::testExpandItems()
 
     // Move to a sub folder, then call restoreExpandedFolders() *before* going back.
     // This is how DolphinView restores the expanded folders when navigating in history.
-    m_dirLister->openUrl(KUrl(m_testDir->name() + "a/a/"));
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    m_model->loadDir(KUrl(m_testDir->name() + "a/a/"));
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
     QCOMPARE(m_model->count(), 1);  // 1 item: "1"
     m_model->restoreExpandedUrls(allFolders);
-    m_dirLister->openUrl(m_testDir->url());
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    m_model->loadDir(m_testDir->url());
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
     QCOMPARE(m_model->count(), 5);  // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
     QCOMPARE(m_model->expandedUrls(), allFolders);
 }
@@ -537,7 +533,7 @@ void KFileItemModelTest::testExpandParentItems()
     files << "a 1/b1/c1/file.txt" << "a2/b2/c2/d2/file.txt"; // missing folders are created automatically
     m_testDir->createFiles(files);
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     // So far, the model contains only "a 1/" and "a2/".
@@ -546,7 +542,7 @@ void KFileItemModelTest::testExpandParentItems()
 
     // Expand the parents of "a2/b2/c2".
     m_model->expandParentItems(KUrl(m_testDir->name() + "a2/b2/c2"));
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
 
     // The model should now contain "a 1/", "a2/", "a2/b2/", and "a2/b2/c2/".
     // It's important that only the parents of "a1/b1/c1" are expanded.
@@ -558,7 +554,7 @@ void KFileItemModelTest::testExpandParentItems()
 
     // Expand the parents of "a 1/b1".
     m_model->expandParentItems(KUrl(m_testDir->name() + "a 1/b1"));
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
 
     // The model should now contain "a 1/", "a 1/b1/", "a2/", "a2/b2", and "a2/b2/c2/".
     // It's important that only the parents of "a 1/b1/" and "a2/b2/c2/" are expanded.
@@ -593,7 +589,7 @@ void KFileItemModelTest::testSorting()
     m_testDir->createFile("e", "An even larger file", now.addDays(-4));
     m_testDir->createFile(".f");
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     int index = m_model->index(KUrl(m_testDir->url().url() + "c"));
@@ -705,7 +701,7 @@ void KFileItemModelTest::testIndexForKeyboardSearch()
     files << "a" << "aa" << "Image.jpg" << "Image.png" << "Text" << "Text1" << "Text2" << "Text11";
     m_testDir->createFiles(files);
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     // Search from index 0
@@ -755,7 +751,7 @@ void KFileItemModelTest::testNameFilter()
     files << "A1" << "A2" << "Abc" << "Bcd" << "Cde";
     m_testDir->createFiles(files);
 
-    m_dirLister->openUrl(m_testDir->url());
+    m_model->loadDir(m_testDir->url());
     QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
 
     m_model->setNameFilter("A"); // Shows A1, A2 and Abc
index b446e84776428af37a61ae6b3dcddd5a4ce1e2e2..486ccd46a32a192ef21f5884f6743d479feb6112 100644 (file)
 #include <qtestmouse.h>
 #include <qtestkeyboard.h>
 
-#include <KDirLister>
 #include "kitemviews/kitemlistcontainer.h"
 #include "kitemviews/kfileitemlistview.h"
 #include "kitemviews/kfileitemmodel.h"
 #include "kitemviews/kitemlistcontroller.h"
 #include "kitemviews/kitemlistselectionmanager.h"
-#include "kitemviews/kitemlistviewlayouter_p.h"
+#include "kitemviews/private/kitemlistviewlayouter.h"
 #include "testdir.h"
 
 namespace {
@@ -65,7 +64,6 @@ private:
     KItemListController* m_controller;
     KItemListSelectionManager* m_selectionManager;
     KFileItemModel* m_model;
-    KDirLister* m_dirLister;
     TestDir* m_testDir;
     KItemListContainer* m_container;
 };
@@ -80,8 +78,7 @@ void KItemListControllerTest::initTestCase()
     qRegisterMetaType<QSet<int> >("QSet<int>");
 
     m_testDir = new TestDir();
-    m_dirLister = new KDirLister();
-    m_model = new KFileItemModel(m_dirLister);
+    m_model = new KFileItemModel();
     m_container = new KItemListContainer();
     m_controller = m_container->controller();
     m_controller->setSelectionBehavior(KItemListController::MultiSelection);
@@ -100,8 +97,8 @@ void KItemListControllerTest::initTestCase()
         << "e1" << "e2" << "e3" << "e4" << "e5" << "e6" << "e7";
 
     m_testDir->createFiles(files);
-    m_dirLister->openUrl(m_testDir->url());
-    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(loadingCompleted()), DefaultTimeout));
+    m_model->loadDir(m_testDir->url());
+    QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
 
     m_container->show();
     QTest::qWaitForWindowShown(m_container);
@@ -119,9 +116,6 @@ void KItemListControllerTest::cleanupTestCase()
     delete m_model;
     m_model = 0;
 
-    delete m_dirLister;
-    m_dirLister = 0;
-
     delete m_testDir;
     m_testDir = 0;
 }
index aeca1f7798813bc998e98bb3e1b612c9225a67f6..cf15324e2789fa3e292c9c29a99aa46797c0158e 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <qtest_kde.h>
 
-#include "kitemviews/kitemlistkeyboardsearchmanager_p.h"
+#include "kitemviews/private/kitemlistkeyboardsearchmanager.h"
 
 class KItemListKeyboardSearchManagerTest : public QObject
 {
index 5b7522f00aed118b0ab5249ef4f91a076ea21aa3..e8c373492abc7bd4dd283ddf22daab124e6d27d8 100644 (file)
@@ -31,7 +31,6 @@
 #include <kitemviews/kitemlistcontroller.h>
 #include <kitemviews/kitemliststyleoption.h>
 
-#include <KDirLister>
 #include <KGlobalSettings>
 
 #include <views/viewmodecontroller.h>
 #include "zoomlevelinfo.h"
 
 
-DolphinItemListContainer::DolphinItemListContainer(KDirLister* dirLister,
-                                                   QWidget* parent) :
+DolphinItemListContainer::DolphinItemListContainer(QWidget* parent) :
     KItemListContainer(parent),
     m_zoomLevel(0),
     m_fileItemListView(0)
 {
-    controller()->setModel(new KFileItemModel(dirLister, this));
+    controller()->setModel(new KFileItemModel(this));
 
     m_fileItemListView = new KFileItemListView();
     controller()->setView(m_fileItemListView);
index c5a30ad74e76663af4e1f84f437ff105d286d305..f3505b663687e5fc21e148054c1fa596a669da44 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <libdolphin_export.h>
 
-class KDirLister;
 class KFileItemListView;
 
 /**
@@ -44,8 +43,7 @@ class LIBDOLPHINPRIVATE_EXPORT DolphinItemListContainer : public KItemListContai
     Q_OBJECT
 
 public:
-    explicit DolphinItemListContainer(KDirLister* dirLister,
-                                      QWidget* parent = 0);
+    explicit DolphinItemListContainer(QWidget* parent = 0);
 
     virtual ~DolphinItemListContainer();
 
index 2ffc33e08f0f82d80bae09d255c757769b46916f..137b73d0902e7b4a143fa12efd20b1caf234edc9 100644 (file)
@@ -35,7 +35,6 @@
 
 #include <KActionCollection>
 #include <KColorScheme>
-#include <KDirLister>
 #include <KDirModel>
 #include <KIconEffect>
 #include <KFileItem>
@@ -59,7 +58,6 @@
 #include <KToggleAction>
 #include <KUrl>
 
-#include "dolphindirlister.h"
 #include "dolphinnewfilemenuobserver.h"
 #include "dolphin_detailsmodesettings.h"
 #include "dolphin_generalsettings.h"
@@ -91,7 +89,6 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     m_mode(DolphinView::IconsView),
     m_visibleRoles(),
     m_topLayout(0),
-    m_dirLister(0),
     m_container(0),
     m_toolTipManager(0),
     m_selectionChangedTimer(0),
@@ -117,24 +114,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     connect(m_selectionChangedTimer, SIGNAL(timeout()),
             this, SLOT(emitSelectionChangedSignal()));
 
-    m_dirLister = new DolphinDirLister(this);
-    m_dirLister->setAutoUpdate(true);
-    m_dirLister->setDelayedMimeTypes(true);
-
-    connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(slotRedirection(KUrl,KUrl)));
-    connect(m_dirLister, SIGNAL(started(KUrl)),          this, SLOT(slotDirListerStarted(KUrl)));
-    connect(m_dirLister, SIGNAL(refreshItems(QList<QPair<KFileItem,KFileItem> >)),
-            this, SLOT(slotRefreshItems()));
-
-    connect(m_dirLister, SIGNAL(clear()),                     this, SIGNAL(itemCountChanged()));
-    connect(m_dirLister, SIGNAL(newItems(KFileItemList)),     this, SIGNAL(itemCountChanged()));
-    connect(m_dirLister, SIGNAL(infoMessage(QString)),        this, SIGNAL(infoMessage(QString)));
-    connect(m_dirLister, SIGNAL(errorMessage(QString)),       this, SIGNAL(infoMessage(QString)));
-    connect(m_dirLister, SIGNAL(percent(int)),                this, SIGNAL(pathLoadingProgress(int)));
-    connect(m_dirLister, SIGNAL(urlIsFileError(KUrl)),        this, SIGNAL(urlIsFileError(KUrl)));
-    connect(m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SIGNAL(itemCountChanged()));
-
-    m_container = new DolphinItemListContainer(m_dirLister, this);
+    m_container = new DolphinItemListContainer(this);
     m_container->setVisibleRoles(QList<QByteArray>() << "name");
     m_container->installEventFilter(this);
     setFocusProxy(m_container);
@@ -156,10 +136,17 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
     connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
 
     KFileItemModel* model = fileItemModel();
-    if (model) {
-        connect(model, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
-        connect(model, SIGNAL(sortProgress(int)), this, SIGNAL(sortProgress(int)));
-    }
+    connect(model, SIGNAL(dirLoadingStarted()),            this, SLOT(slotDirLoadingStarted()));
+    connect(model, SIGNAL(dirLoadingCompleted()),          this, SLOT(slotDirLoadingCompleted()));
+    connect(model, SIGNAL(dirLoadingProgress(int)),        this, SIGNAL(dirLoadingProgress(int)));
+    connect(model, SIGNAL(dirSortingProgress(int)),        this, SIGNAL(dirSortingProgress(int)));
+    connect(model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
+            this, SLOT(slotItemsChanged()));
+    connect(model, SIGNAL(itemsRemoved(KItemRangeList)),   this, SIGNAL(itemCountChanged()));
+    connect(model, SIGNAL(itemsInserted(KItemRangeList)),  this, SIGNAL(itemCountChanged()));
+    connect(model, SIGNAL(infoMessage(QString)),           this, SIGNAL(infoMessage(QString)));
+    connect(model, SIGNAL(errorMessage(QString)),          this, SIGNAL(errorMessage(QString)));
+    connect(model, SIGNAL(redirection(KUrl,KUrl)),         this, SLOT(slotRedirection(KUrl,KUrl)));
 
     KItemListView* view = controller->view();
     view->installEventFilter(this);
@@ -269,7 +256,8 @@ bool DolphinView::previewsShown() const
 
 void DolphinView::setHiddenFilesShown(bool show)
 {
-    if (m_dirLister->showingDotFiles() == show) {
+    KFileItemModel* model = fileItemModel();
+    if (model->showHiddenFiles() == show) {
         return;
     }
 
@@ -280,13 +268,13 @@ void DolphinView::setHiddenFilesShown(bool show)
     ViewProperties props(url());
     props.setHiddenFilesShown(show);
 
-    fileItemModel()->setShowHiddenFiles(show);
+    model->setShowHiddenFiles(show);
     emit hiddenFilesShownChanged(show);
 }
 
 bool DolphinView::hiddenFilesShown() const
 {
-    return m_dirLister->showingDotFiles();
+    return fileItemModel()->showHiddenFiles();
 }
 
 void DolphinView::setGroupedSorting(bool grouped)
@@ -311,7 +299,21 @@ bool DolphinView::groupedSorting() const
 
 KFileItemList DolphinView::items() const
 {
-    return m_dirLister->items();
+    KFileItemList list;
+    const KFileItemModel* model = fileItemModel();
+    const int itemCount = model->count();
+    list.reserve(itemCount);
+
+    for (int i = 0; i < itemCount; ++i) {
+        list.append(model->fileItem(i));
+    }
+
+    return list;
+}
+
+int DolphinView::itemsCount() const
+{
+    return fileItemModel()->count();
 }
 
 KFileItemList DolphinView::selectedItems() const
@@ -455,7 +457,7 @@ void DolphinView::reload()
 
 void DolphinView::stopLoading()
 {
-    m_dirLister->stop();
+    fileItemModel()->cancelDirLoading();
 }
 
 void DolphinView::readSettings()
@@ -492,7 +494,10 @@ void DolphinView::calculateItemCount(int& fileCount,
                                      int& folderCount,
                                      KIO::filesize_t& totalFileSize) const
 {
-    foreach (const KFileItem& item, m_dirLister->items()) {
+    const KFileItemModel* model = fileItemModel();
+    const int itemCount = model->count();
+    for (int i = 0; i < itemCount; ++i) {
+        const KFileItem item = model->fileItem(i);
         if (item.isDir()) {
             ++folderCount;
         } else {
@@ -628,8 +633,9 @@ void DolphinView::renameSelectedItems()
         dialog->activateWindow();
     //}
 
-    // assure that the current index remains visible when KDirLister
-    // will notify the view about changed items
+    // Assure that the current index remains visible when KFileItemModel
+    // will notify the view about changed items (which might result in
+    // a changed sorting).
     m_assureVisibleCurrentIndex = true;
 }
 
@@ -979,11 +985,11 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
 void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
 {
     if (previous != 0) {
-        disconnect(previous, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
+        disconnect(previous, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
     }
 
     Q_ASSERT(qobject_cast<KFileItemModel*>(current));
-    connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotLoadingCompleted()));
+    connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
 
     KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
     m_versionControlObserver->setModel(fileItemModel);
@@ -1121,7 +1127,7 @@ bool DolphinView::hasSelection() const
 
 KFileItem DolphinView::rootItem() const
 {
-    return m_dirLister->rootItem();
+    return fileItemModel()->rootItem();
 }
 
 void DolphinView::observeCreatedItem(const KUrl& url)
@@ -1222,7 +1228,7 @@ void DolphinView::slotDeleteFileFinished(KJob* job)
     }
 }
 
-void DolphinView::slotDirListerStarted(const KUrl& url)
+void DolphinView::slotDirLoadingStarted()
 {
     // Disable the writestate temporary until it can be determined in a fast way
     // in DolphinView::slotLoadingCompleted()
@@ -1231,29 +1237,23 @@ void DolphinView::slotDirListerStarted(const KUrl& url)
         emit writeStateChanged(m_isFolderWritable);
     }
 
-    emit startedPathLoading(url);
+    emit startedDirLoading(url());
 }
 
-void DolphinView::slotLoadingCompleted()
+void DolphinView::slotDirLoadingCompleted()
 {
     // Update the view-state. This has to be done using a Qt::QueuedConnection
     // because the view might not be in its final state yet.
     QTimer::singleShot(0, this, SLOT(updateViewState()));
 
-    emit finishedPathLoading(url());
+    emit finishedDirLoading(url());
 
     updateWritableState();
 }
 
-void DolphinView::slotRefreshItems()
+void DolphinView::slotItemsChanged()
 {
-    if (m_assureVisibleCurrentIndex) {
-        m_assureVisibleCurrentIndex = false;
-        //QAbstractItemView* view = m_viewAccessor.itemView();
-        //if (view) {
-        //    m_viewAccessor.itemView()->scrollTo(m_viewAccessor.itemView()->currentIndex());
-        //}
-    }
+    m_assureVisibleCurrentIndex = false;
 }
 
 void DolphinView::slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous)
@@ -1311,7 +1311,12 @@ void DolphinView::loadDirectory(const KUrl& url, bool reload)
         return;
     }
 
-    m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
+    KFileItemModel* model = fileItemModel();
+    if (reload) {
+        model->refreshDir(url);
+    } else {
+        model->loadDir(url);
+    }
 }
 
 void DolphinView::applyViewProperties()
@@ -1465,7 +1470,7 @@ void DolphinView::updateWritableState()
     const bool wasFolderWritable = m_isFolderWritable;
     m_isFolderWritable = true;
 
-    const KFileItem item = m_dirLister->rootItem();
+    const KFileItem item = fileItemModel()->rootItem();
     if (!item.isNull()) {
         KFileItemListProperties capabilities(KFileItemList() << item);
         m_isFolderWritable = capabilities.supportsWriting();
index b1d057e6f4de9976249fbeb00a219eee18a7a025..9c674d03a540038bfa6b2f310f6b74e43b7af40f 100644 (file)
@@ -39,7 +39,6 @@
 
 typedef KIO::FileUndoManager::CommandType CommandType;
 
-class DolphinDirLister;
 class DolphinItemListContainer;
 class KAction;
 class KActionCollection;
@@ -154,6 +153,12 @@ public:
      */
     KFileItemList items() const;
 
+    /**
+     * @return The number of items. itemsCount() is faster in comparison
+     *         to items().count().
+     */
+    int itemsCount() const;
+
     /**
      * Returns the selected items. The list is empty if no item has been
      * selected.
@@ -474,25 +479,29 @@ signals:
 
     /**
      * Is emitted after DolphinView::setUrl() has been invoked and
-     * the path \a url is currently loaded. If this signal is emitted,
+     * the directory \a url is currently loaded. If this signal is emitted,
      * it is assured that the view contains already the correct root
      * URL and property settings.
      */
-    void startedPathLoading(const KUrl& url);
+    void startedDirLoading(const KUrl& url);
 
     /**
-     * Is emitted after the path triggered by DolphinView::setUrl()
+     * Is emitted after the directory triggered by DolphinView::setUrl()
      * has been loaded.
      */
-    void finishedPathLoading(const KUrl& url);
+    void finishedDirLoading(const KUrl& url);
 
     /**
      * Is emitted after DolphinView::setUrl() has been invoked and provides
-     * the information how much percent of the current path have been loaded.
+     * the information how much percent of the current directory have been loaded.
      */
-    void pathLoadingProgress(int percent);
+    void dirLoadingProgress(int percent);
 
-    void sortProgress(int percent);
+    /**
+     * Is emitted if the sorting is done asynchronously and provides the
+     * progress information of the sorting.
+     */
+    void dirSortingProgress(int percent);
 
     /**
      * Is emitted if the DolphinView::setUrl() is invoked but the URL is not
@@ -501,7 +510,7 @@ signals:
     void urlIsFileError(const KUrl& file);
 
     /**
-     * Emitted when KDirLister emits redirection.
+     * Emitted when the file-item-model emits redirection.
      * Testcase: fish://localhost
      */
     void redirection(const KUrl& oldUrl, const KUrl& newUrl);
@@ -606,23 +615,21 @@ private slots:
     void slotDeleteFileFinished(KJob* job);
 
     /**
-     * Invoked when the directory lister has been started the
-     * loading of \a url.
+     * Invoked when the file item model has started the loading
+     * of the directory specified by DolphinView::url().
      */
-    void slotDirListerStarted(const KUrl& url);
+    void slotDirLoadingStarted();
 
     /**
-     * Invoked when the file item model indicates that the directory lister has completed the loading
-     * of items, and that expanded folders have been restored (if the view mode is 'Details', and the
-     * view state is restored after navigating back or forward in history). Assures that pasted items
-     * and renamed items get seleced.
+     * Invoked when the file item model indicates that the loading of a directory has
+     * been completed. Assures that pasted items and renamed items get seleced.
      */
-    void slotLoadingCompleted();
+    void slotDirLoadingCompleted();
 
     /**
-     * Is invoked when the KDirLister indicates refreshed items.
+     * Is invoked when items of KFileItemModel have been changed.
      */
-    void slotRefreshItems();
+    void slotItemsChanged();
 
     /**
      * Is invoked when the sort order has been changed by the user by clicking
@@ -730,7 +737,6 @@ private:
 
     QVBoxLayout* m_topLayout;
 
-    DolphinDirLister* m_dirLister;
     DolphinItemListContainer* m_container;
 
     ToolTipManager* m_toolTipManager;
index ac47090690b15cc489665746c296fca87914b10a..bbabd2e4e115fd1fa3606bf4e822f1b5024a642b 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "dolphin_versioncontrolsettings.h"
 
-#include <KDirLister>
 #include <KLocale>
 #include <KService>
 #include <KServiceTypeTrader>
@@ -30,6 +29,7 @@
 
 #include "updateitemstatesthread.h"
 
+#include <QFile>
 #include <QMutexLocker>
 #include <QTimer>
 
@@ -298,7 +298,6 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
     // Verify whether the current directory contains revision information
     // like .svn, .git, ...
     foreach (KVersionControlPlugin* plugin, plugins) {
-        // Use the KDirLister cache to check for .svn, .git, ... files
         const QString fileName = directory.path(KUrl::AddTrailingSlash) + plugin->fileName();
         if (QFile::exists(fileName)) {
             return plugin;