X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/18f34db9bd71a792b3a24c7fb1c830516731ed03..fbd7cb02a511ff869d74aa4e758203a1cd340962:/src/dolphinview.cpp
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 76211373f..0bd24ecb3 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -87,6 +87,7 @@ DolphinView::DolphinView(QWidget* parent,
m_storedCategorizedSorting(false),
m_tabsForFiles(false),
m_isContextMenuOpen(false),
+ m_ignoreViewProperties(false),
m_mode(DolphinView::IconsView),
m_topLayout(0),
m_controller(0),
@@ -233,7 +234,7 @@ void DolphinView::setMode(Mode mode)
}
emit modeChanged();
-
+
updateZoomLevel(oldZoomLevel);
if (m_showPreview) {
loadDirectory(viewPropsUrl);
@@ -389,7 +390,7 @@ void DolphinView::setZoomLevel(int level)
} else if (level > ZoomLevelInfo::maximumLevel()) {
level = ZoomLevelInfo::maximumLevel();
}
-
+
if (level != zoomLevel()) {
m_controller->setZoomLevel(level);
m_previewGenerator->updatePreviews();
@@ -455,6 +456,8 @@ void DolphinView::reload()
void DolphinView::refresh()
{
+ m_ignoreViewProperties = false;
+
const bool oldActivationState = m_active;
const int oldZoomLevel = m_controller->zoomLevel();
m_active = true;
@@ -522,7 +525,7 @@ QString DolphinView::statusBarText() const
int folderCount = 0;
int fileCount = 0;
KIO::filesize_t totalFileSize = 0;
-
+
if (hasSelection()) {
// give a summary of the status of the selected files
const KFileItemList list = selectedItems();
@@ -544,13 +547,13 @@ QString DolphinView::statusBarText() const
}
++it;
}
-
+
if (folderCount + fileCount == 1) {
// if only one item is selected, show the filename
const QString name = list.first().name();
text = (folderCount == 1) ? i18nc("@info:status", "%1 selected", name) :
i18nc("@info:status", "%1 selected (%2)",
- name, KIO::convertSize(totalFileSize));
+ name, KIO::convertSize(totalFileSize));
} else {
// at least 2 items are selected
const QString foldersText = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
@@ -610,7 +613,7 @@ void DolphinView::renameSelectedItems()
if (itemCount < 1) {
return;
}
-
+
if (itemCount > 1) {
// More than one item has been selected for renaming. Open
// a rename dialog and rename all items afterwards.
@@ -626,7 +629,7 @@ void DolphinView::renameSelectedItems()
// TODO: check how this can be integrated into KIO::FileUndoManager/KonqOperations
// as one operation instead of n rename operations like it is done now...
Q_ASSERT(newName.contains('#'));
-
+
// currently the items are sorted by the selection order, resort
// them by the file name
qSort(items.begin(), items.end(), lessThan);
@@ -650,7 +653,7 @@ void DolphinView::renameSelectedItems()
}
} else if (DolphinSettings::instance().generalSettings()->renameInline()) {
Q_ASSERT(itemCount == 1);
-
+
if (isColumnViewActive()) {
m_columnView->editItem(items.first());
} else {
@@ -660,7 +663,7 @@ void DolphinView::renameSelectedItems()
}
} else {
Q_ASSERT(itemCount == 1);
-
+
RenameDialog dialog(this, items);
if (dialog.exec() == QDialog::Rejected) {
return;
@@ -737,10 +740,10 @@ void DolphinView::setShowPreview(bool show)
m_showPreview = show;
m_previewGenerator->setPreviewShown(show);
-
+
const int oldZoomLevel = m_controller->zoomLevel();
emit showPreviewChanged();
-
+
// Enabling or disabling the preview might change the icon size of the view.
// As the view does not emit a signal when the icon size has been changed,
// the used zoom level of the controller must be adjusted manually:
@@ -842,7 +845,7 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
m_controller->requestActivation();
}
break;
-
+
case QEvent::MouseButtonPress:
if ((watched == itemView()->viewport()) && (m_expandedViews.count() > 0)) {
// Listening to a mousebutton press event to delete expanded views is a
@@ -853,13 +856,13 @@ bool DolphinView::eventFilter(QObject* watched, QEvent* event)
deleteExpandedViews();
}
break;
-
+
case QEvent::DragEnter:
if (watched == itemView()->viewport()) {
setActive(true);
}
break;
-
+
default:
break;
}
@@ -1153,6 +1156,10 @@ KUrl DolphinView::viewPropertiesUrl() const
void DolphinView::applyViewProperties(const KUrl& url)
{
+ if (m_ignoreViewProperties) {
+ return;
+ }
+
if (isColumnViewActive() && rootUrl().isParentOf(url)) {
// The column view is active, hence don't apply the view properties
// of sub directories (represented by columns) to the view. The
@@ -1165,11 +1172,11 @@ void DolphinView::applyViewProperties(const KUrl& url)
const Mode mode = props.viewMode();
if (m_mode != mode) {
const int oldZoomLevel = m_controller->zoomLevel();
-
+
m_mode = mode;
createView();
emit modeChanged();
-
+
updateZoomLevel(oldZoomLevel);
}
if (itemView() == 0) {
@@ -1213,15 +1220,22 @@ void DolphinView::applyViewProperties(const KUrl& url)
if (showPreview != m_showPreview) {
m_showPreview = showPreview;
m_previewGenerator->setPreviewShown(showPreview);
-
+
const int oldZoomLevel = m_controller->zoomLevel();
emit showPreviewChanged();
-
+
// Enabling or disabling the preview might change the icon size of the view.
// As the view does not emit a signal when the icon size has been changed,
// the used zoom level of the controller must be adjusted manually:
updateZoomLevel(oldZoomLevel);
}
+
+ if (DolphinSettings::instance().generalSettings()->globalViewProps()) {
+ // During the lifetime of a DolphinView instance the global view properties
+ // should not be changed. This allows e. g. to split a view and use different
+ // view properties for each view.
+ m_ignoreViewProperties = true;
+ }
}
void DolphinView::createView()
@@ -1253,6 +1267,7 @@ void DolphinView::createView()
Q_ASSERT(view != 0);
view->installEventFilter(this);
view->viewport()->installEventFilter(this);
+ setFocusProxy(view);
if (m_mode != ColumnView) {
// Give the view the ability to auto-expand its directories on hovering
@@ -1315,15 +1330,16 @@ void DolphinView::deleteView()
// before deleting the view: Otherwise when having a split
// view the other view will get the focus and will request
// an activation (see DolphinView::eventFilter()).
+ setFocusProxy(0);
setFocus();
m_topLayout->removeWidget(view);
view->close();
-
+
disconnect(view);
m_controller->disconnect(view);
view->disconnect();
-
+
bool deleteView = true;
foreach (const QAbstractItemView* expandedView, m_expandedViews) {
if (view == expandedView) {
@@ -1337,7 +1353,7 @@ void DolphinView::deleteView()
view->deleteLater();
}
view = 0;
-
+
m_iconsView = 0;
m_detailsView = 0;
m_columnView = 0;
@@ -1403,7 +1419,7 @@ KUrl::List DolphinView::simplifiedSelectedUrls() const
{
KUrl::List list = selectedUrls();
if (itemsExpandable() ) {
- list = KonqOperations::simplifiedUrlList(list);
+ list = KDirModel::simplifiedUrlList(list);
}
return list;
}