diff options
| author | Peter Penz <[email protected]> | 2011-01-09 13:58:35 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-01-09 13:58:35 +0000 |
| commit | fae8ba471b0adb917f4edd1a99bca47fdaea0169 (patch) | |
| tree | f7aaa90e0d4414867adb82781088b48242a0b969 /src/dolphinviewcontainer.cpp | |
| parent | 58ea012256a752fb803a462c0ff025a4de4b5dbf (diff) | |
Encapsulate the creation and handling of the directory lister, the model and proxy model to DolphinView. By this it will be easier later to replace the traditional QAbstractItemViews by any kind of other implementation (e.g. based on QGraphicsView/QML).
svn path=/trunk/KDE/kdebase/apps/; revision=1213189
Diffstat (limited to 'src/dolphinviewcontainer.cpp')
| -rw-r--r-- | src/dolphinviewcontainer.cpp | 72 |
1 files changed, 17 insertions, 55 deletions
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 508c0360d..282230ab9 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -53,8 +53,6 @@ #include "statusbar/dolphinstatusbar.h" #include "views/dolphincolumnview.h" #include "views/dolphindetailsview.h" -#include "views/dolphindirlister.h" -#include "views/dolphinsortfilterproxymodel.h" #include "views/draganddrophelper.h" #include "views/dolphiniconsview.h" #include "views/dolphinmodel.h" @@ -100,59 +98,23 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(startSearching(QString))); connect(m_searchBox, SIGNAL(returnPressed(QString)), this, SLOT(requestFocus())); - DolphinDirLister* dirLister = new DolphinDirLister(); - dirLister->setAutoUpdate(true); - dirLister->setMainWindow(window()); - dirLister->setDelayedMimeTypes(true); - - DolphinModel* dolphinModel = new DolphinModel(this); - dolphinModel->setDirLister(dirLister); // dolphinModel takes ownership of dirLister - dolphinModel->setDropsAllowed(DolphinModel::DropOnDirectory); - - DolphinSortFilterProxyModel* proxyModel = new DolphinSortFilterProxyModel(this); - proxyModel->setSourceModel(dolphinModel); - proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); - - // TODO: In the case of the column view the directory lister changes. Let the DolphinView - // inform the container about this information for KDE SC 4.7 - connect(dirLister, SIGNAL(clear()), - this, SLOT(delayedStatusBarUpdate())); - connect(dirLister, SIGNAL(percent(int)), - this, SLOT(updateProgress(int))); - connect(dirLister, SIGNAL(itemsDeleted(const KFileItemList&)), - this, SLOT(delayedStatusBarUpdate())); - connect(dirLister, SIGNAL(newItems(KFileItemList)), - this, SLOT(delayedStatusBarUpdate())); - connect(dirLister, SIGNAL(infoMessage(const QString&)), - this, SLOT(showInfoMessage(const QString&))); - connect(dirLister, SIGNAL(errorMessage(const QString&)), - this, SLOT(showErrorMessage(const QString&))); - connect(dirLister, SIGNAL(urlIsFileError(const KUrl&)), - this, SLOT(openFile(const KUrl&))); - - m_view = new DolphinView(this, url, proxyModel); - connect(m_view, SIGNAL(urlChanged(const KUrl&)), - m_urlNavigator, SLOT(setUrl(const KUrl&))); - connect(m_view, SIGNAL(requestItemInfo(KFileItem)), - this, SLOT(showItemInfo(KFileItem))); - connect(m_view, SIGNAL(errorMessage(const QString&)), - this, SLOT(showErrorMessage(const QString&))); - connect(m_view, SIGNAL(infoMessage(const QString&)), - this, SLOT(showInfoMessage(const QString&))); - connect(m_view, SIGNAL(operationCompletedMessage(const QString&)), - this, SLOT(showOperationCompletedMessage(const QString&))); - connect(m_view, SIGNAL(itemTriggered(KFileItem)), - this, SLOT(slotItemTriggered(KFileItem))); - connect(m_view, SIGNAL(redirection(KUrl, KUrl)), - this, SLOT(redirect(KUrl, KUrl))); - connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)), - this, SLOT(delayedStatusBarUpdate())); - connect(m_view, SIGNAL(startedPathLoading(KUrl)), - this, SLOT(slotStartedPathLoading())); - connect(m_view, SIGNAL(finishedPathLoading(KUrl)), - this, SLOT(slotFinishedPathLoading())); - connect(m_view, SIGNAL(writeStateChanged(bool)), - this, SIGNAL(writeStateChanged(bool))); + m_view = new DolphinView(url, this); + connect(m_view, SIGNAL(urlChanged(const KUrl&)), m_urlNavigator, SLOT(setUrl(const 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(const QString&)), this, SLOT(showErrorMessage(const QString&))); + connect(m_view, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); + connect(m_view, SIGNAL(itemTriggered(KFileItem)), this, SLOT(slotItemTriggered(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(updateProgress(int))); + connect(m_view, SIGNAL(infoMessage(const QString&)), this, SLOT(showInfoMessage(const QString&))); + connect(m_view, SIGNAL(errorMessage(const QString&)), this, SLOT(showErrorMessage(const QString&))); + connect(m_view, SIGNAL(urlIsFileError(const KUrl&)), this, SLOT(openFile(const KUrl&))); + connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)), this, SLOT(delayedStatusBarUpdate())); + connect(m_view, SIGNAL(operationCompletedMessage(const QString&)), this, SLOT(showOperationCompletedMessage(const QString&))); connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)), this, SLOT(slotUrlNavigatorLocationChanged(const KUrl&))); |
