respond when sycoca changes. sorting goes all to hell at this point, but i don't have time right now to figure out why. at least we respond to new entries =)
BUG:152530 svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=821611
This commit is contained in:
parent
2fd0d567cc
commit
bc20a02b4a
@ -45,15 +45,15 @@ KCategorizedItemsView::KCategorizedItemsView(QWidget * parent, Qt::WindowFlags f
|
||||
this, SLOT(filterChanged(int)));
|
||||
|
||||
// we filter "activated" signals to re-emit them only when wanted
|
||||
connect (itemsView, SIGNAL(activated(const QModelIndex &)),
|
||||
this, SLOT(itemActivated(const QModelIndex &)));
|
||||
connect(itemsView, SIGNAL(activated(const QModelIndex &)),
|
||||
this, SLOT(itemActivated(const QModelIndex &)));
|
||||
|
||||
connect (itemsView, SIGNAL(clicked(const QModelIndex &)),
|
||||
this, SIGNAL(clicked(const QModelIndex &)));
|
||||
this, SIGNAL(clicked(const QModelIndex &)));
|
||||
connect (itemsView, SIGNAL(entered(const QModelIndex &)),
|
||||
this, SIGNAL(entered(const QModelIndex &)));
|
||||
this, SIGNAL(entered(const QModelIndex &)));
|
||||
connect (itemsView, SIGNAL(pressed(const QModelIndex &)),
|
||||
this, SIGNAL(pressed(const QModelIndex &)));
|
||||
this, SIGNAL(pressed(const QModelIndex &)));
|
||||
|
||||
itemsView->header()->setVisible(false);
|
||||
|
||||
@ -61,7 +61,7 @@ KCategorizedItemsView::KCategorizedItemsView(QWidget * parent, Qt::WindowFlags f
|
||||
//itemsView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
|
||||
connect (m_delegate, SIGNAL(destroyApplets(const QString)),
|
||||
parent, SLOT(destroyApplets(const QString)));
|
||||
parent, SLOT(destroyApplets(const QString)));
|
||||
|
||||
comboFilters->setItemDelegate(new KCategorizedItemsViewFilterDelegate(this));
|
||||
|
||||
@ -112,8 +112,9 @@ void KCategorizedItemsView::setItemModel(QStandardItemModel * model)
|
||||
}
|
||||
|
||||
m_modelItems = model;
|
||||
m_modelFilterItems->setSourceModel(m_modelItems);
|
||||
m_modelFilterItems->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
m_modelFilterItems->setDynamicSortFilter(true);
|
||||
m_modelFilterItems->setSourceModel(m_modelItems);
|
||||
m_modelFilterItems->sort(0);
|
||||
|
||||
itemsView->setModel(m_modelFilterItems);
|
||||
|
@ -19,9 +19,11 @@
|
||||
|
||||
#include "plasmaappletitemmodel_p.h"
|
||||
|
||||
#include <KSycoca>
|
||||
|
||||
PlasmaAppletItem::PlasmaAppletItem(PlasmaAppletItemModel * model, const QMap<QString, QVariant>& info,
|
||||
FilterFlags flags, QMap<QString, QVariant> * extraAttrs) :
|
||||
QObject(model), m_model(model)
|
||||
FilterFlags flags, QMap<QString, QVariant> * extraAttrs)
|
||||
: QObject(model), m_model(model)
|
||||
{
|
||||
QMap<QString, QVariant> attrs(info);
|
||||
|
||||
@ -89,6 +91,7 @@ PlasmaAppletItemModel::PlasmaAppletItemModel(KConfigGroup configGroup, QObject *
|
||||
{
|
||||
m_used = m_configGroup.readEntry("used").split(",");
|
||||
m_favorites = m_configGroup.readEntry("favorites").split(",");
|
||||
connect(KSycoca::self(), SIGNAL(databaseChanged()), this, SLOT(populateModel()));
|
||||
}
|
||||
|
||||
void PlasmaAppletItemModel::populateModel()
|
||||
@ -224,3 +227,6 @@ QString& PlasmaAppletItemModel::Application()
|
||||
{
|
||||
return m_application;
|
||||
}
|
||||
|
||||
#include <plasmaappletitemmodel_p.moc>
|
||||
|
||||
|
@ -31,9 +31,10 @@ class PlasmaAppletItemModel;
|
||||
/**
|
||||
* Implementation of the KCategorizedItemsViewModels::AbstractItem
|
||||
*/
|
||||
class PlasmaAppletItem : public KCategorizedItemsViewModels::AbstractItem,
|
||||
QObject
|
||||
class PlasmaAppletItem : public QObject, public KCategorizedItemsViewModels::AbstractItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum FilterFlag {NoFilter = 0,
|
||||
Favorite = 1,
|
||||
@ -62,6 +63,8 @@ private:
|
||||
class PlasmaAppletItemModel :
|
||||
public KCategorizedItemsViewModels::DefaultItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PlasmaAppletItemModel(KConfigGroup configGroup, QObject * parent = 0);
|
||||
|
||||
@ -81,6 +84,7 @@ private:
|
||||
QStringList m_used;
|
||||
KConfigGroup m_configGroup;
|
||||
|
||||
private slots:
|
||||
void populateModel();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user