┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinpart.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-01-09 13:58:35 +0000
committerPeter Penz <[email protected]>2011-01-09 13:58:35 +0000
commitfae8ba471b0adb917f4edd1a99bca47fdaea0169 (patch)
treef7aaa90e0d4414867adb82781088b48242a0b969 /src/dolphinpart.cpp
parent58ea012256a752fb803a462c0ff025a4de4b5dbf (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/dolphinpart.cpp')
-rw-r--r--src/dolphinpart.cpp43
1 files changed, 10 insertions, 33 deletions
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 3d0748f84..a039beb1f 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -67,28 +67,14 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
// make sure that other apps using this part find Dolphin's view-file-columns icons
KIconLoader::global()->addAppDir("dolphin");
- m_dirLister = new DolphinDirLister;
- m_dirLister->setAutoUpdate(true);
- if (parentWidget) {
- m_dirLister->setMainWindow(parentWidget->window());
- }
- m_dirLister->setDelayedMimeTypes(true);
-
- connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted(KUrl)));
- connect(m_dirLister, SIGNAL(canceled(KUrl)), this, SLOT(slotCanceled(KUrl)));
- connect(m_dirLister, SIGNAL(percent(int)), this, SLOT(updateProgress(int)));
- connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
-
- m_dolphinModel = new DolphinModel(this);
- m_dolphinModel->setDirLister(m_dirLister); // m_dolphinModel takes ownership of m_dirLister
-
- m_proxyModel = new DolphinSortFilterProxyModel(this);
- m_proxyModel->setSourceModel(m_dolphinModel);
-
- m_view = new DolphinView(parentWidget, KUrl(), m_proxyModel);
+ m_view = new DolphinView(KUrl(), parentWidget);
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(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
+
setXMLFile("dolphinpart.rc");
connect(m_view, SIGNAL(infoMessage(QString)),
@@ -116,12 +102,8 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
// Watch for changes that should result in updates to the
// status bar text.
- connect(m_dirLister, SIGNAL(itemsDeleted(const KFileItemList&)),
- this, SLOT(updateStatusBar()));
- connect(m_dirLister, SIGNAL(clear()),
- this, SLOT(updateStatusBar()));
- connect(m_view, SIGNAL(selectionChanged(const KFileItemList)),
- this, SLOT(updateStatusBar()));
+ connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(updateStatusBar()));
+ connect(m_view, SIGNAL(selectionChanged(const KFileItemList)), this, SLOT(updateStatusBar()));
m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
m_actionHandler->setCurrentView(m_view);
@@ -292,7 +274,7 @@ bool DolphinPart::openUrl(const KUrl& url)
bool reload = arguments().reload();
// A bit of a workaround so that changing the namefilter works: force reload.
// Otherwise DolphinView wouldn't relist the URL, so nothing would happen.
- if (m_nameFilter != m_dirLister->nameFilter())
+ if (m_nameFilter != m_view->nameFilter())
reload = true;
if (m_view->url() == url && !reload) { // DolphinView won't do anything in that case, so don't emit started
return true;
@@ -306,7 +288,7 @@ bool DolphinPart::openUrl(const KUrl& url)
emit setWindowCaption(prettyUrl);
emit m_extension->setLocationBarUrl(prettyUrl);
emit started(0); // get the wheel to spin
- m_dirLister->setNameFilter(m_nameFilter);
+ m_view->setNameFilter(m_nameFilter);
m_view->setUrl(url);
updatePasteAction();
emit aboutToOpenURL();
@@ -321,11 +303,6 @@ void DolphinPart::slotCompleted(const KUrl& url)
emit completed();
}
-void DolphinPart::slotCanceled(const KUrl& url)
-{
- slotCompleted(url);
-}
-
void DolphinPart::slotMessage(const QString& msg)
{
emit setStatusBarText(msg);
@@ -383,7 +360,7 @@ void DolphinPart::slotOpenContextMenu(const KFileItem& _item,
if (item.isNull()) { // viewport context menu
popupFlags |= KParts::BrowserExtension::ShowNavigationItems | KParts::BrowserExtension::ShowUp;
- item = m_dirLister->rootItem();
+ item = m_view->rootItem();
if (item.isNull())
item = KFileItem( S_IFDIR, (mode_t)-1, url() );
else