svn path=/trunk/KDE/kdebase/apps/; revision=
1194323
m_viewModeController(0),
m_viewAccessor(proxyModel),
m_selectionChangedTimer(0),
m_viewModeController(0),
m_viewAccessor(proxyModel),
m_selectionChangedTimer(0),
m_activeItemUrl(),
m_restoredContentsPosition(),
m_createdItemUrl(),
m_activeItemUrl(),
m_restoredContentsPosition(),
m_createdItemUrl(),
void DolphinView::restoreState(QDataStream& stream)
{
void DolphinView::restoreState(QDataStream& stream)
{
+ // Restore the URL of the current item that had the keyboard focus
stream >> m_activeItemUrl;
stream >> m_activeItemUrl;
+ // Restore the root URL
+ KUrl rootUrl;
+ stream >> rootUrl;
+ m_viewAccessor.setRootUrl(rootUrl);
+
+ // Restore the view position
stream >> m_restoredContentsPosition;
stream >> m_restoredContentsPosition;
- // expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
+ // Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
QSet<KUrl> urlsToExpand;
stream >> urlsToExpand;
const DolphinDetailsViewExpander* expander = m_viewAccessor.setExpandedUrls(urlsToExpand);
QSet<KUrl> urlsToExpand;
stream >> urlsToExpand;
const DolphinDetailsViewExpander* expander = m_viewAccessor.setExpandedUrls(urlsToExpand);
void DolphinView::saveState(QDataStream& stream)
{
void DolphinView::saveState(QDataStream& stream)
{
+ // Save the URL of the current item that has the keyboard focus
KFileItem currentItem;
const QAbstractItemView* view = m_viewAccessor.itemView();
KFileItem currentItem;
const QAbstractItemView* view = m_viewAccessor.itemView();
currentItem = m_viewAccessor.dirModel()->itemForIndex(dirModelIndex);
}
currentItem = m_viewAccessor.dirModel()->itemForIndex(dirModelIndex);
}
if (!currentItem.isNull()) {
if (!currentItem.isNull()) {
- currentUrl = currentItem.url();
+ currentItemUrl = currentItem.url();
+ stream << currentItemUrl;
+
+ // Save the root URL
+ stream << m_viewAccessor.rootUrl();
const int x = view->horizontalScrollBar()->value();
const int y = view->verticalScrollBar()->value();
stream << QPoint(x, y);
const int x = view->horizontalScrollBar()->value();
const int y = view->verticalScrollBar()->value();
stream << QPoint(x, y);
- // expanded folders (only relevant for the details view - the set will be empty in other view modes)
+ // Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
stream << m_viewAccessor.expandedUrls();
}
stream << m_viewAccessor.expandedUrls();
}
if (m_viewAccessor.itemView() == 0) {
createView();
}
if (m_viewAccessor.itemView() == 0) {
createView();
}
Q_ASSERT(m_viewAccessor.itemView() != 0);
Q_ASSERT(m_viewAccessor.itemDelegate() != 0);
Q_ASSERT(m_viewAccessor.itemView() != 0);
Q_ASSERT(m_viewAccessor.itemDelegate() != 0);
}
DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel* proxyModel) :
}
DolphinView::ViewAccessor::ViewAccessor(DolphinSortFilterProxyModel* proxyModel) :
m_iconsView(0),
m_detailsView(0),
m_columnsContainer(0),
m_iconsView(0),
m_detailsView(0),
m_columnsContainer(0),
m_columnsContainer = new DolphinColumnViewContainer(parent,
dolphinViewController,
viewModeController);
m_columnsContainer = new DolphinColumnViewContainer(parent,
dolphinViewController,
viewModeController);
+ if (!m_rootUrl.isEmpty() && m_rootUrl.isParentOf(viewModeController->url())) {
+ // The column-view must show several columns starting with m_rootUrl as
+ // first column and viewModeController->url() as last column.
+ m_columnsContainer->showColumn(m_rootUrl);
+ m_columnsContainer->showColumn(viewModeController->url());
+ }
void DolphinView::ViewAccessor::prepareUrlChange(const KUrl& url)
{
if (m_columnsContainer != 0) {
void DolphinView::ViewAccessor::prepareUrlChange(const KUrl& url)
{
if (m_columnsContainer != 0) {
+void DolphinView::ViewAccessor::setRootUrl(const KUrl& rootUrl)
+{
+ m_rootUrl = rootUrl;
+}
+
KUrl DolphinView::ViewAccessor::rootUrl() const
{
KUrl DolphinView::ViewAccessor::rootUrl() const
{
- return (m_columnsContainer != 0) ? m_columnsContainer->rootUrl() : KUrl();
+ return (m_columnsContainer != 0) ? m_columnsContainer->rootUrl() : m_rootUrl;
}
bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
}
bool DolphinView::ViewAccessor::supportsCategorizedSorting() const
return (m_detailsView != 0) && m_detailsView->itemsExpandable();
}
return (m_detailsView != 0) && m_detailsView->itemsExpandable();
}
QSet<KUrl> DolphinView::ViewAccessor::expandedUrls() const
{
if (m_detailsView != 0) {
QSet<KUrl> DolphinView::ViewAccessor::expandedUrls() const
{
if (m_detailsView != 0) {
*/
QWidget* layoutTarget() const;
*/
QWidget* layoutTarget() const;
+ void setRootUrl(const KUrl& rootUrl);
KUrl rootUrl() const;
bool supportsCategorizedSorting() const;
KUrl rootUrl() const;
bool supportsCategorizedSorting() const;
KDirLister* dirLister() const;
private:
KDirLister* dirLister() const;
private:
DolphinIconsView* m_iconsView;
DolphinDetailsView* m_detailsView;
DolphinColumnViewContainer* m_columnsContainer;
DolphinIconsView* m_iconsView;
DolphinDetailsView* m_detailsView;
DolphinColumnViewContainer* m_columnsContainer;
QTimer* m_selectionChangedTimer;
QTimer* m_selectionChangedTimer;
KUrl m_activeItemUrl;
QPoint m_restoredContentsPosition;
KUrl m_createdItemUrl; // URL for a new item that got created by the "Create New..." menu
KUrl m_activeItemUrl;
QPoint m_restoredContentsPosition;
KUrl m_createdItemUrl; // URL for a new item that got created by the "Create New..." menu
* Requests the view mode implementation to hide tooltips.
*/
void requestToolTipHiding();
* Requests the view mode implementation to hide tooltips.
*/
void requestToolTipHiding();
public slots:
/**
* Sets the URL to \a url and emits the signals cancelPreviews() and
public slots:
/**
* Sets the URL to \a url and emits the signals cancelPreviews() and