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
This commit is contained in:
Peter Penz 2008-02-16 13:16:59 +00:00
parent 0706655eab
commit 67f36d71e7
6 changed files with 45 additions and 15 deletions

View file

@ -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"

View file

@ -58,6 +58,7 @@ private:
QRadioButton* m_mediumIconSize;
QRadioButton* m_largeIconSize;
DolphinFontRequester* m_fontRequester;
QCheckBox* m_expandableFolders;
};
#endif

View file

@ -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>

View file

@ -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

View file

@ -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);
}
}

View file

@ -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);