Commit c6ea152d authored by Peter Penz's avatar Peter Penz
Browse files

* fixed issue that some view properties like "show in groups" are ignored when...

* fixed issue that some view properties like "show in groups" are ignored when a new DolphinViewContainer has been created (happens on startup or when a view is split)
* get rid of redundant parameter in constructors of DolphinView and DolphinViewContainer

svn path=/trunk/KDE/kdebase/apps/; revision=677654
parent eef5c658
......@@ -769,9 +769,7 @@ void DolphinMainWindow::toggleSplitView()
const DolphinView* view = m_viewContainer[PrimaryView]->view();
m_viewContainer[SecondaryView] = new DolphinViewContainer(this,
0,
view->rootUrl(),
view->mode(),
view->showHiddenFiles());
view->rootUrl());
connectViewSignals(SecondaryView);
m_splitter->addWidget(m_viewContainer[SecondaryView]);
m_splitter->setSizes(QList<int>() << newWidth << newWidth);
......@@ -975,10 +973,8 @@ void DolphinMainWindow::init()
setCaption(homeUrl.fileName());
ViewProperties props(homeUrl);
m_viewContainer[PrimaryView] = new DolphinViewContainer(this,
m_splitter,
homeUrl,
props.viewMode(),
props.showHiddenFiles());
m_splitter,
homeUrl);
m_activeViewContainer = m_viewContainer[PrimaryView];
connectViewSignals(PrimaryView);
......
......@@ -57,13 +57,12 @@ DolphinView::DolphinView(QWidget* parent,
const KUrl& url,
KDirLister* dirLister,
KDirModel* dirModel,
DolphinSortFilterProxyModel* proxyModel,
Mode mode) :
DolphinSortFilterProxyModel* proxyModel) :
QWidget(parent),
m_active(true),
m_loadingDirectory(false),
m_initializeColumnView(false),
m_mode(mode),
m_mode(DolphinView::IconsView),
m_topLayout(0),
m_controller(0),
m_iconsView(0),
......@@ -107,7 +106,7 @@ DolphinView::DolphinView(QWidget* parent,
connect(m_controller, SIGNAL(viewportEntered()),
this, SLOT(clearHoverInformation()));
createView();
applyViewProperties(url);
m_topLayout->addWidget(itemView());
}
......@@ -419,6 +418,20 @@ void DolphinView::refresh()
reload();
}
void DolphinView::setUrl(const KUrl& url)
{
if (m_controller->url() == url) {
return;
}
m_controller->setUrl(url);
applyViewProperties(url);
startDirLister(url);
emit urlChanged(url);
}
void DolphinView::mouseReleaseEvent(QMouseEvent* event)
{
QWidget::mouseReleaseEvent(event);
......@@ -582,14 +595,8 @@ void DolphinView::startDirLister(const KUrl& url, bool reload)
}
}
void DolphinView::setUrl(const KUrl& url)
void DolphinView::applyViewProperties(const KUrl& url)
{
if (m_controller->url() == url) {
return;
}
m_controller->setUrl(url);
const ViewProperties props(url);
const Mode mode = props.viewMode();
......@@ -615,6 +622,11 @@ void DolphinView::setUrl(const KUrl& url)
m_initializeColumnView = true;
}
}
if (itemView() == 0) {
createView();
}
Q_ASSERT(itemView() != 0);
Q_ASSERT(m_fileItemDelegate != 0);
const bool showHiddenFiles = props.showHiddenFiles();
if (showHiddenFiles != m_dirLister->showingDotFiles()) {
......@@ -662,9 +674,6 @@ void DolphinView::setUrl(const KUrl& url)
m_controller->setShowPreview(showPreview);
emit showPreviewChanged();
}
startDirLister(url);
emit urlChanged(url);
}
void DolphinView::changeSelection(const KFileItemList& selection)
......
......@@ -115,15 +115,12 @@ public:
* @param proxyModel Used proxy model which specifies the sorting. The
* model is not owned by the view and won't get
* deleted.
* @param mode Used display mode (IconsView, DetailsView or ColumnsView).
* @param showHiddenFiles If true, hidden files will be shown in the view.
*/
DolphinView(QWidget* parent,
const KUrl& url,
KDirLister* dirLister,
KDirModel* dirModel,
DolphinSortFilterProxyModel* proxyModel,
Mode mode);
DolphinSortFilterProxyModel* proxyModel);
virtual ~DolphinView();
......@@ -472,6 +469,12 @@ private slots:
private:
void startDirLister(const KUrl& url, bool reload = false);
/**
* Applies the view properties which are defined by the current URL
* m_url to the DolphinView properties.
*/
void applyViewProperties(const KUrl& url);
/**
* Creates a new view representing the given view mode (DolphinView::mode()).
* The current view will get deleted.
......
......@@ -60,9 +60,7 @@
DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
QWidget* parent,
const KUrl& url,
DolphinView::Mode mode,
bool showHiddenFiles) :
const KUrl& url) :
QWidget(parent),
m_showProgress(false),
m_folderCount(0),
......@@ -100,7 +98,6 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
m_dirLister = new DolphinDirLister();
m_dirLister->setAutoUpdate(true);
m_dirLister->setMainWindow(this);
m_dirLister->setShowingDotFiles(showHiddenFiles);
m_dirLister->setDelayedMimeTypes(true);
m_dirModel = new KDirModel();
......@@ -127,8 +124,7 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
url,
m_dirLister,
m_dirModel,
m_proxyModel,
mode);
m_proxyModel);
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
m_urlNavigator, SLOT(setUrl(const KUrl&)));
connect(m_view, SIGNAL(requestContextMenu(KFileItem*, const KUrl&)),
......
......@@ -65,9 +65,7 @@ class DolphinViewContainer : public QWidget
public:
DolphinViewContainer(DolphinMainWindow* mainwindow,
QWidget *parent,
const KUrl& url,
DolphinView::Mode mode = DolphinView::IconsView,
bool showHiddenFiles = false);
const KUrl& url);
virtual ~DolphinViewContainer();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment