┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphindetailsview.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2007-10-26 17:36:16 +0000
committerPeter Penz <[email protected]>2007-10-26 17:36:16 +0000
commitf11c699fa203dd2cde0e85c63a6d186e3fa6a3de (patch)
tree1ef300c9ed2f6406dd4b1a893162a4e34fc8428a /src/dolphindetailsview.cpp
parent6c1153092ee766c2668ce125a72090da162ed4ab (diff)
due to the recent tagging freeze this commit contains several fixes in one:
* the filterbar now also filters directories (works also in the column-view :-)) * The "Additional Information" menu entry now also works for showing/hiding the columns of the details view. This also implies that the columns for the details view can now be adjusted per directory -> we have now a consistent behavior between the icons view and details view. Still open: the view properties dialog must be fixed * Don't show a "Nepomuk not available" error message when starting Dolphin and Nepomuk is not available. * Fix issue that the information panel blocked the application because of parsing the full meta data of a huge file. svn path=/trunk/KDE/kdebase/apps/; revision=729704
Diffstat (limited to 'src/dolphindetailsview.cpp')
-rw-r--r--src/dolphindetailsview.cpp86
1 files changed, 47 insertions, 39 deletions
diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp
index 57d5eb81c..4eef882b3 100644
--- a/src/dolphindetailsview.cpp
+++ b/src/dolphindetailsview.cpp
@@ -97,6 +97,8 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
this, SLOT(zoomIn()));
connect(controller, SIGNAL(zoomOut()),
this, SLOT(zoomOut()));
+ connect(controller->dolphinView(), SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList&)),
+ this, SLOT(updateColumnVisibility()));
// apply the details mode settings to the widget
const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
@@ -140,28 +142,7 @@ bool DolphinDetailsView::event(QEvent* event)
headerView->setResizeMode(0, QHeaderView::Stretch);
headerView->setMovable(false);
- // hide columns if this is indicated by the settings
- const DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
- Q_ASSERT(settings != 0);
- if (!settings->showDate()) {
- hideColumn(DolphinModel::ModifiedTime);
- }
-
- if (!settings->showPermissions()) {
- hideColumn(DolphinModel::Permissions);
- }
-
- if (!settings->showOwner()) {
- hideColumn(DolphinModel::Owner);
- }
-
- if (!settings->showGroup()) {
- hideColumn(DolphinModel::Group);
- }
-
- if (!settings->showType()) {
- hideColumn(DolphinModel::Type);
- }
+ updateColumnVisibility();
hideColumn(DolphinModel::Rating);
hideColumn(DolphinModel::Tags);
@@ -278,10 +259,14 @@ void DolphinDetailsView::dropEvent(QDropEvent* event)
const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
if (!urls.isEmpty()) {
event->acceptProposedAction();
- m_controller->indicateDroppedUrls(urls,
- m_controller->url(),
- indexAt(event->pos()),
- event->source());
+ const QModelIndex index = indexAt(event->pos());
+ if (index.isValid() && (index.column() == DolphinModel::Name)) {
+ const KFileItem item = itemForIndex(index);
+ m_controller->indicateDroppedUrls(urls,
+ m_controller->url(),
+ item,
+ event->source());
+ }
}
QTreeView::dropEvent(event);
m_dragging = false;
@@ -453,7 +438,7 @@ void DolphinDetailsView::configureColumns(const QPoint& pos)
popup.addTitle(i18nc("@title:menu", "Columns"));
QHeaderView* headerView = header();
- for (int i = DolphinModel::ModifiedTime; i <= DolphinModel::Type; ++i) {
+ for (int i = DolphinModel::Size; i <= DolphinModel::Type; ++i) {
const int logicalIndex = headerView->logicalIndex(i);
const QString text = model()->headerData(i, Qt::Horizontal).toString();
QAction* action = popup.addAction(text);
@@ -465,29 +450,52 @@ void DolphinDetailsView::configureColumns(const QPoint& pos)
QAction* activatedAction = popup.exec(header()->mapToGlobal(pos));
if (activatedAction != 0) {
const bool show = activatedAction->isChecked();
- DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
- Q_ASSERT(settings != 0);
-
- // remember the changed column visibility in the settings
const int columnIndex = activatedAction->data().toInt();
+
+ KFileItemDelegate::InformationList list = m_controller->dolphinView()->additionalInfo();
+ KFileItemDelegate::Information info = KFileItemDelegate::NoInformation;
switch (columnIndex) {
- case DolphinModel::ModifiedTime: settings->setShowDate(show); break;
- case DolphinModel::Permissions: settings->setShowPermissions(show); break;
- case DolphinModel::Owner: settings->setShowOwner(show); break;
- case DolphinModel::Group: settings->setShowGroup(show); break;
- case DolphinModel::Type: settings->setShowType(show); break;
+ case DolphinModel::Size: info = KFileItemDelegate::Size; break;
+ case DolphinModel::ModifiedTime: info = KFileItemDelegate::ModificationTime; break;
+ case DolphinModel::Permissions: info = KFileItemDelegate::Permissions; break;
+ case DolphinModel::Owner: info = KFileItemDelegate::Owner; break;
+ case DolphinModel::Group: info = KFileItemDelegate::OwnerAndGroup; break;
+ case DolphinModel::Type: info = KFileItemDelegate::FriendlyMimeType; break;
default: break;
}
- // apply the changed column visibility
if (show) {
- showColumn(columnIndex);
+ Q_ASSERT(!list.contains(info));
+ list.append(info);
} else {
- hideColumn(columnIndex);
+ Q_ASSERT(list.contains(info));
+ const int index = list.indexOf(info);
+ list.removeAt(index);
}
+
+ m_controller->indicateAdditionalInfoChange(list);
+ setColumnHidden(columnIndex, !show);
}
}
+void DolphinDetailsView::updateColumnVisibility()
+{
+ KFileItemDelegate::InformationList list = m_controller->dolphinView()->additionalInfo();
+ if (list.isEmpty() || list.contains(KFileItemDelegate::NoInformation)) {
+ list.clear();
+ list.append(KFileItemDelegate::Size);
+ list.append(KFileItemDelegate::ModificationTime);
+ m_controller->indicateAdditionalInfoChange(list);
+ }
+
+ setColumnHidden(DolphinModel::Size, !list.contains(KFileItemDelegate::Size));
+ setColumnHidden(DolphinModel::ModifiedTime, !list.contains(KFileItemDelegate::ModificationTime));
+ setColumnHidden(DolphinModel::Permissions, !list.contains(KFileItemDelegate::Permissions));
+ setColumnHidden(DolphinModel::Owner, !list.contains(KFileItemDelegate::Owner));
+ setColumnHidden(DolphinModel::Group, !list.contains(KFileItemDelegate::OwnerAndGroup));
+ setColumnHidden(DolphinModel::Type, !list.contains(KFileItemDelegate::FriendlyMimeType));
+}
+
bool DolphinDetailsView::isZoomInPossible() const
{
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();