--- plasma/applets/kickoff/simpleapplet/menuview.cpp~ 2009-04-02 05:54:57.000000000 +0200 +++ plasma/applets/kickoff/simpleapplet/menuview.cpp 2009-04-02 06:01:31.000000000 +0200 @@ -98,6 +98,7 @@ MenuView::FormatType formattype; QPoint mousePressPos; QList<QStandardItem*> items; + QHash<QAbstractItemModel*, QAction*> modelsHeader; }; MenuView::MenuView(QWidget *parent, const QString &title, const QIcon &icon) @@ -237,6 +238,11 @@ void MenuView::addModel(QAbstractItemModel *model, MenuView::ModelOptions options) { + QAction *header = new QAction(this); + header->setVisible(false); + addAction(header); + d->modelsHeader.insert(model, header); + if(options & MergeFirstLevel) { const int count = model->rowCount(); for(int row = 0; row < count; ++row) { @@ -338,6 +344,11 @@ break; } } + if (lastidx < 0 && d->modelsHeader.contains(model)) { + QAction *header = d->modelsHeader[model]; + lastidx = menu->actions().indexOf(header); + } + if (lastidx >= 0) { if (offset < start) lastidx++; // insert action the item right after the last valid index