- if (event->spontaneous()) {
- Panel::showEvent(event);
- return;
- }
-
- if (!m_controller) {
- // Postpone the creating of the controller to the first show event.
- // This assures that no performance and memory overhead is given when the folders panel is not
- // used at all and stays invisible.
- m_model = new PlacesItemModel(this);
- m_model->setGroupedSorting(true);
- connect(m_model, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
-
- m_view = new PlacesView();
- m_view->setWidgetCreator(new KItemListWidgetCreator<PlacesItemListWidget>());
- m_view->setGroupHeaderCreator(new KItemListGroupHeaderCreator<PlacesItemListGroupHeader>());
-
- m_controller = new KItemListController(m_model, m_view, this);
- m_controller->setSelectionBehavior(KItemListController::SingleSelection);
- m_controller->setSingleClickActivationEnforced(true);
-
- readSettings();
-
- connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
- connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
- connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
- connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
- connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
- connect(m_controller, SIGNAL(aboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotAboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
-
- KItemListContainer* container = new KItemListContainer(m_controller, this);
- container->setEnabledFrame(false);
-
- QVBoxLayout* layout = new QVBoxLayout(this);
- layout->setMargin(0);
- layout->addWidget(container);
-
- selectClosestItem();
- }
-
- Panel::showEvent(event);