┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/dolphinview.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/dolphinview.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/dolphinview.cpp')
-rw-r--r--src/dolphinview.cpp84
1 files changed, 40 insertions, 44 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index f4b533d61..085c791fd 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -102,12 +102,14 @@ DolphinView::DolphinView(QWidget* parent,
connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)),
this, SLOT(openContextMenu(const QPoint&)));
- connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&, const QModelIndex&, QWidget*)),
- this, SLOT(dropUrls(const KUrl::List&, const KUrl&, const QModelIndex&, QWidget*)));
+ 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(sortingChanged(DolphinView::Sorting)),
this, SLOT(updateSorting(DolphinView::Sorting)));
connect(m_controller, SIGNAL(sortOrderChanged(Qt::SortOrder)),
this, SLOT(updateSortOrder(Qt::SortOrder)));
+ connect(m_controller, SIGNAL(additionalInfoChanged(const KFileItemDelegate::InformationList&)),
+ this, SLOT(updateAdditionalInfo(const KFileItemDelegate::InformationList&)));
connect(m_controller, SIGNAL(itemTriggered(const KFileItem&)),
this, SLOT(triggerItem(const KFileItem&)));
connect(m_controller, SIGNAL(activated()),
@@ -197,6 +199,12 @@ void DolphinView::setMode(Mode mode)
createView();
+ // the file item delegate has been recreated, apply the current
+ // additional information manually
+ const KFileItemDelegate::InformationList infoList = props.additionalInfo();
+ m_fileItemDelegate->setShowInformation(infoList);
+ emit additionalInfoChanged(infoList);
+
// Not all view modes support categorized sorting. Adjust the sorting model
// if changing the view mode results in a change of the categorized sorting
// capabilities.
@@ -437,12 +445,15 @@ void DolphinView::setAdditionalInfo(KFileItemDelegate::InformationList info)
const KUrl viewPropsUrl = viewPropertiesUrl();
ViewProperties props(viewPropsUrl);
props.setAdditionalInfo(info);
-
- m_controller->setAdditionalInfoCount(info.count());
m_fileItemDelegate->setShowInformation(info);
emit additionalInfoChanged(info);
- loadDirectory(viewPropsUrl, true);
+
+ 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);
+ }
}
KFileItemDelegate::InformationList DolphinView::additionalInfo() const
@@ -493,17 +504,7 @@ void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
void DolphinView::setNameFilter(const QString& nameFilter)
{
- // The name filter of KDirLister does a 'hard' filtering, which
- // means that only the items are shown where the names match
- // exactly the filter. This is non-transparent for the user, which
- // just wants to have a 'soft' filtering: does the name contain
- // the filter string?
- QString adjustedFilter(nameFilter);
- adjustedFilter.insert(0, '*');
- adjustedFilter.append('*');
-
- m_dirLister->setNameFilter(adjustedFilter);
- m_dirLister->emitChanges();
+ m_proxyModel->setFilterRegExp(nameFilter);
if (isColumnViewActive()) {
// adjusting the directory lister is not enough in the case of the
@@ -679,7 +680,6 @@ void DolphinView::applyViewProperties(const KUrl& url)
KFileItemDelegate::InformationList info = props.additionalInfo();
if (info != m_fileItemDelegate->showInformation()) {
- m_controller->setAdditionalInfoCount(info.count());
m_fileItemDelegate->setShowInformation(info);
emit additionalInfoChanged(info);
}
@@ -717,7 +717,7 @@ void DolphinView::openContextMenu(const QPoint& pos)
KFileItem item;
const QModelIndex index = itemView()->indexAt(pos);
- if (isValidNameIndex(index)) {
+ if (index.isValid() && (index.column() == DolphinModel::Name)) {
item = fileItem(index);
}
@@ -726,27 +726,23 @@ void DolphinView::openContextMenu(const QPoint& pos)
void DolphinView::dropUrls(const KUrl::List& urls,
const KUrl& destPath,
- const QModelIndex& destIndex,
+ const KFileItem& destItem,
QWidget* source)
{
- KFileItem directory;
- if (isValidNameIndex(destIndex)) {
- KFileItem item = fileItem(destIndex);
- Q_ASSERT(!item.isNull());
- if (item.isDir()) {
- // the URLs are dropped above a directory
- directory = item;
+ bool dropAboveDir = false;
+ if (!destItem.isNull()) {
+ dropAboveDir = destItem.isDir();
+ if (!dropAboveDir) {
+ // the dropping is done above a file
+ return;
}
- }
-
- if ((directory.isNull()) && (source == itemView())) {
- // The dropping is done into the same viewport where
- // the dragging has been started. Just ignore this...
+ } else if (source == itemView()) {
+ // the dropping is done into the same viewport where the dragging
+ // has been started
return;
}
- const KUrl& destination = (directory.isNull()) ?
- destPath : directory.url();
+ const KUrl& destination = dropAboveDir ? destItem.url() : destPath;
dropUrls(urls, destination);
}
@@ -776,6 +772,17 @@ void DolphinView::updateSortOrder(Qt::SortOrder order)
emit sortOrderChanged(order);
}
+void DolphinView::updateAdditionalInfo(const KFileItemDelegate::InformationList& info)
+{
+ ViewProperties props(viewPropertiesUrl());
+ props.setAdditionalInfo(info);
+
+ m_fileItemDelegate->setShowInformation(info);
+
+ emit additionalInfoChanged(info);
+
+}
+
void DolphinView::emitContentsMoved()
{
// only emit the contents moved signal if:
@@ -825,11 +832,6 @@ void DolphinView::clearHoverInformation()
void DolphinView::createView()
{
- KFileItemDelegate::InformationList infoList;
- if (m_fileItemDelegate != 0) {
- infoList = m_fileItemDelegate->showInformation();
- }
-
// delete current view
QAbstractItemView* view = itemView();
if (view != 0) {
@@ -869,7 +871,6 @@ void DolphinView::createView()
Q_ASSERT(view != 0);
m_fileItemDelegate = new KFileItemDelegate(view);
- m_fileItemDelegate->setShowInformation(infoList);
view->setItemDelegate(m_fileItemDelegate);
view->setModel(m_proxyModel);
@@ -897,11 +898,6 @@ QAbstractItemView* DolphinView::itemView() const
return m_iconsView;
}
-bool DolphinView::isValidNameIndex(const QModelIndex& index) const
-{
- return index.isValid() && (index.column() == DolphinModel::Name);
-}
-
bool DolphinView::isCutItem(const KFileItem& item) const
{
const QMimeData* mimeData = QApplication::clipboard()->mimeData();