connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)),
this, SLOT(openContextMenu(const QPoint&)));
- connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&, const KFileItem&, QWidget*)),
- this, SLOT(dropUrls(const KUrl::List&, const KUrl&, const KFileItem&, QWidget*)));
+ connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&, const KFileItem&)),
+ this, SLOT(dropUrls(const KUrl::List&, const KUrl&, const KFileItem&)));
connect(m_controller, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(updateSorting(DolphinView::Sorting)));
connect(m_controller, SIGNAL(sortOrderChanged(Qt::SortOrder)),
m_controller->setUrl(root);
}
+ deleteView();
+
+ // It is important to read the view properties _after_ deleting the view,
+ // as e. g. the detail view might adjust the additional information properties
+ // after getting closed:
const KUrl viewPropsUrl = viewPropertiesUrl();
ViewProperties props(viewPropsUrl);
props.setViewMode(m_mode);
void DolphinView::dropUrls(const KUrl::List& urls,
const KUrl& destPath,
- const KFileItem& destItem,
- QWidget* source)
-{
- bool dropAboveDir = false;
- if (!destItem.isNull()) {
- dropAboveDir = destItem.isDir();
- if (!dropAboveDir) {
- // the dropping is done above a file
- return;
- }
- } else if (source == itemView()) {
- // the dropping is done into the same viewport where the dragging
- // has been started
- return;
+ const KFileItem& destItem)
+{
+ const KUrl& destination = !destItem.isNull() && destItem.isDir() ?
+ destItem.url() : destPath;
+ const KUrl sourceDir = KUrl(urls.first().directory());
+ if (sourceDir != destination) {
+ dropUrls(urls, destination);
}
-
- const KUrl& destination = dropAboveDir ? destItem.url() : destPath;
- dropUrls(urls, destination);
}
void DolphinView::dropUrls(const KUrl::List& urls,
{
ViewProperties props(viewPropertiesUrl());
props.setAdditionalInfo(info);
+ props.save();
m_fileItemDelegate->setShowInformation(info);
void DolphinView::createView()
{
- // delete current view
- QAbstractItemView* view = itemView();
- if (view != 0) {
- m_topLayout->removeWidget(view);
- view->close();
- view->deleteLater();
- view = 0;
- m_iconsView = 0;
- m_detailsView = 0;
- m_columnView = 0;
- m_fileItemDelegate = 0;
- }
-
+ deleteView();
Q_ASSERT(m_iconsView == 0);
Q_ASSERT(m_detailsView == 0);
Q_ASSERT(m_columnView == 0);
- // ... and recreate it representing the current mode
+ QAbstractItemView* view = 0;
switch (m_mode) {
case IconsView: {
m_iconsView = new DolphinIconsView(this, m_controller);
this, SLOT(emitContentsMoved()));
}
+void DolphinView::deleteView()
+{
+ QAbstractItemView* view = itemView();
+ if (view != 0) {
+ m_topLayout->removeWidget(view);
+ view->close();
+ view->deleteLater();
+ view = 0;
+ m_iconsView = 0;
+ m_detailsView = 0;
+ m_columnView = 0;
+ m_fileItemDelegate = 0;
+ }
+}
+
QAbstractItemView* DolphinView::itemView() const
{
if (m_detailsView != 0) {