┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-02-16 13:16:59 +0000
committerPeter Penz <[email protected]>2008-02-16 13:16:59 +0000
commit67f36d71e78c2c64500229150d262b621f69fe54 (patch)
treebb62c026be3e51648347411be9aa03b2bf3e70f9
parent0706655eab026b9ab328e1b56292655281ad0596 (diff)
Provide an option for the details view to expand folders (= tree view), as this is required for Konqueror to get back this functionality from KDE 3. It is possible in Dolphin to enable this option too, but it is set to false per default.
BUG: 155571 svn path=/trunk/KDE/kdebase/apps/; revision=775621
-rw-r--r--src/detailsviewsettingspage.cpp10
-rw-r--r--src/detailsviewsettingspage.h1
-rw-r--r--src/dolphin_detailsmodesettings.kcfg4
-rw-r--r--src/dolphindetailsview.cpp10
-rw-r--r--src/dolphinview.cpp6
-rw-r--r--src/iconmanager.cpp29
6 files changed, 45 insertions, 15 deletions
diff --git a/src/detailsviewsettingspage.cpp b/src/detailsviewsettingspage.cpp
index 50f2bac8a..7ff25179d 100644
--- a/src/detailsviewsettingspage.cpp
+++ b/src/detailsviewsettingspage.cpp
@@ -42,7 +42,8 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
m_smallIconSize(0),
m_mediumIconSize(0),
m_largeIconSize(0),
- m_fontRequester(0)
+ m_fontRequester(0),
+ m_expandableFolders(0)
{
const int spacing = KDialog::spacingHint();
const int margin = KDialog::marginHint();
@@ -80,6 +81,9 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow,
textLayout->addWidget(fontLabel);
textLayout->addWidget(m_fontRequester);
+ // create "Expandable Folders" checkbox
+ m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable Folders"), this);
+
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
@@ -110,6 +114,8 @@ void DetailsViewSettingsPage::applySettings()
settings->setFontSize(font.pointSize());
settings->setItalicFont(font.italic());
settings->setBoldFont(font.bold());
+
+ settings->setExpandableFolders(m_expandableFolders->isChecked());
}
void DetailsViewSettingsPage::restoreDefaults()
@@ -147,6 +153,8 @@ void DetailsViewSettingsPage::loadSettings()
m_fontRequester->setMode(DolphinFontRequester::CustomFont);
m_fontRequester->setCustomFont(font);
}
+
+ m_expandableFolders->setChecked(settings->expandableFolders());
}
#include "detailsviewsettingspage.moc"
diff --git a/src/detailsviewsettingspage.h b/src/detailsviewsettingspage.h
index d06b814cf..b6622348c 100644
--- a/src/detailsviewsettingspage.h
+++ b/src/detailsviewsettingspage.h
@@ -58,6 +58,7 @@ private:
QRadioButton* m_mediumIconSize;
QRadioButton* m_largeIconSize;
DolphinFontRequester* m_fontRequester;
+ QCheckBox* m_expandableFolders;
};
#endif
diff --git a/src/dolphin_detailsmodesettings.kcfg b/src/dolphin_detailsmodesettings.kcfg
index ce16a551c..be62e797a 100644
--- a/src/dolphin_detailsmodesettings.kcfg
+++ b/src/dolphin_detailsmodesettings.kcfg
@@ -29,5 +29,9 @@
<label context="@label">Icon size</label>
<default code="true">KIconLoader::SizeSmall</default>
</entry>
+ <entry name="ExpandableFolders" type="Bool">
+ <label context="@label">Expandable folders</label>
+ <default>false</default>
+ </entry>
</group>
</kcfg>
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index df5246bed..63498ed9d 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -54,17 +54,19 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
m_elasticBandOrigin(),
m_elasticBandDestination()
{
+ const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
+ Q_ASSERT(settings != 0);
Q_ASSERT(controller != 0);
setAcceptDrops(true);
- setRootIsDecorated(false);
setSortingEnabled(true);
setUniformRowHeights(true);
setSelectionBehavior(SelectItems);
setDragDropMode(QAbstractItemView::DragDrop);
setDropIndicatorShown(false);
setAlternatingRowColors(true);
- setItemsExpandable(false);
+ setRootIsDecorated(settings->expandableFolders());
+ setItemsExpandable(settings->expandableFolders());
setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
@@ -118,10 +120,6 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
connect(controller->dolphinView(), SIGNAL(additionalInfoChanged()),
this, SLOT(updateColumnVisibility()));
- // apply the details mode settings to the widget
- const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
- Q_ASSERT(settings != 0);
-
m_font = QFont(settings->fontFamily(), settings->fontSize());
// TODO: Remove this check when 4.3.2 is released and KDE requires it... this
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index b531c6f55..5ce9cb6e1 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -227,7 +227,7 @@ void DolphinView::setShowPreview(bool show)
m_iconManager->setShowPreview(show);
emit showPreviewChanged();
- loadDirectory(viewPropsUrl, true);
+ loadDirectory(viewPropsUrl);
}
bool DolphinView::showPreview() const
@@ -248,7 +248,7 @@ void DolphinView::setShowHiddenFiles(bool show)
m_dirLister->setShowingDotFiles(show);
emit showHiddenFilesChanged();
- loadDirectory(viewPropsUrl, true);
+ loadDirectory(viewPropsUrl);
}
bool DolphinView::showHiddenFiles() const
@@ -452,7 +452,7 @@ void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info)
if (itemView() != m_detailsView) {
// the details view requires no reloading of the directory, as it maps
// the file item delegate info to its columns internally
- loadDirectory(viewPropsUrl, true);
+ loadDirectory(viewPropsUrl);
}
}
diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp
index 5940c909e..807b91a9e 100644
--- a/src/iconmanager.cpp
+++ b/src/iconmanager.cpp
@@ -116,11 +116,24 @@ void IconManager::updateIcons(const KFileItemList& items)
void IconManager::replaceIcon(const KFileItem& item, const QPixmap& pixmap)
{
Q_ASSERT(!item.isNull());
+ if (!m_showPreview) {
+ // the preview has been canceled in the meantime
+ return;
+ }
+
+ // check whether the item is part of the directory lister (it is possible
+ // that a preview from an old directory lister is received)
KDirLister* dirLister = m_dolphinModel->dirLister();
- if (!m_showPreview || (item.url().directory() != dirLister->url().path())) {
- // the preview has been canceled in the meanwhile or the preview
- // job is still working on items of an older URL, hence
- // the item is not part of the directory model anymore
+ bool isOldPreview = true;
+ const KUrl::List dirs = dirLister->directories();
+ const QString itemDir = item.url().directory();
+ foreach (KUrl url, dirs) {
+ if (url.path() == itemDir) {
+ isOldPreview = false;
+ break;
+ }
+ }
+ if (isOldPreview) {
return;
}
@@ -192,7 +205,13 @@ void IconManager::applyCutItemEffect()
return;
}
- const KFileItemList items(m_dolphinModel->dirLister()->items());
+ KFileItemList items;
+ KDirLister* dirLister = m_dolphinModel->dirLister();
+ const KUrl::List dirs = dirLister->directories();
+ foreach (KUrl url, dirs) {
+ items << dirLister->itemsForDir(url);
+ }
+
foreach (KFileItem item, items) {
if (isCutItem(item)) {
const QModelIndex index = m_dolphinModel->indexForItem(item);