From d76b113ad10fe207ef23d5dd44c63ee076c71521 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 1 May 2012 23:11:06 +0200 Subject: Places Panel: Allow hiding of items Related changes: - Animate changed items for the details-view in case it is not expandable - Remove the hardcoded "isHidden"-code in KStandardItemListWidget and allow derived widgets to define themselves what means "hidden" within their context. The current code needs a lot of bugfixing, but lets make this in smaller steps during the next days... --- src/panels/places/placespanel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/panels/places/placespanel.cpp') diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index ea2ec3072..dc0f2b8ba 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -40,6 +40,7 @@ #include #include "placesitemeditdialog.h" #include "placesitemlistgroupheader.h" +#include "placesitemlistwidget.h" #include "placesitemmodel.h" #include #include @@ -77,6 +78,7 @@ void PlacesPanel::showEvent(QShowEvent* event) m_model->setSortRole("group"); KStandardItemListView* view = new KStandardItemListView(); + view->setWidgetCreator(new KItemListWidgetCreator()); view->setGroupHeaderCreator(new KItemListGroupHeaderCreator()); m_controller = new KItemListController(m_model, view, this); @@ -167,7 +169,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) QAction* hideAction = menu.addAction(i18nc("@item:inmenu", "Hide Entry '%1'", label)); hideAction->setCheckable(true); - //hideEntry->setChecked(data.value("hidden").toBool()); + hideAction->setChecked(data.value("isHidden").toBool()); QAction* showAllAction = 0; if (m_model->hiddenCount() > 0) { @@ -176,7 +178,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) } showAllAction = menu.addAction(i18nc("@item:inmenu", "Show All Entries")); showAllAction->setCheckable(true); - //showAllEntries->setChecked(showAll) + showAllAction->setChecked(m_model->hiddenItemsShown()); } QAction* removeAction = 0; @@ -200,7 +202,9 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) } else if (action == removeAction) { m_model->removeItem(index); } else if (action == hideAction) { + m_model->setItemHidden(index, hideAction->isChecked()); } else if (action == showAllAction) { + m_model->setHiddenItemsShown(showAllAction->isChecked()); } else if (action == tearDownAction) { } else if (action == ejectAction) { } -- cgit v1.3