always use double click, regardless of single/double click activation in this list (necessary due to update in kstyle in kdelibs)

BUG:165135

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=825686
This commit is contained in:
Aaron J. Seigo 2008-06-29 00:06:04 +00:00
parent bd4c5669a8
commit caa6823d98
3 changed files with 18 additions and 4 deletions

View File

@ -150,7 +150,7 @@ void AppletBrowserWidget::Private::init()
QVBoxLayout *layout = new QVBoxLayout(q);
appletList = new KCategorizedItemsView(q);
connect(appletList, SIGNAL(activated(const QModelIndex &)), q, SLOT(addApplet()));
connect(appletList, SIGNAL(doubleClicked(const QModelIndex &)), q, SLOT(addApplet()));
layout->addWidget(appletList);
// Other Emblems
@ -210,7 +210,7 @@ void AppletBrowserWidget::setApplication(const QString& app)
// maze of models and views is screwing up
d->appletList->setItemModel(&d->itemModel);
kDebug() << d->runningApplets;
//kDebug() << d->runningApplets;
d->itemModel.setRunningApplets(d->runningApplets);
}
@ -234,14 +234,13 @@ Containment *AppletBrowserWidget::containment() const
void AppletBrowserWidget::addApplet()
{
kDebug() << "Button ADD clicked";
if (!d->containment) {
return;
}
foreach (AbstractItem *item, d->appletList->selectedItems()) {
PlasmaAppletItem *selectedItem = (PlasmaAppletItem *) item;
kDebug() << "Adding applet " << selectedItem->name() << "to containment";
//kDebug() << "Adding applet " << selectedItem->name() << "to containment";
d->containment->addApplet(selectedItem->pluginName(), selectedItem->arguments());
}
}

View File

@ -47,6 +47,8 @@ KCategorizedItemsView::KCategorizedItemsView(QWidget * parent, Qt::WindowFlags f
// 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(doubleClicked(const QModelIndex &)),
this, SLOT(itemDoubleClicked(const QModelIndex &)));
connect (itemsView, SIGNAL(clicked(const QModelIndex &)),
this, SIGNAL(clicked(const QModelIndex &)));
@ -152,6 +154,18 @@ void KCategorizedItemsView::itemActivated( const QModelIndex& index )
emit activated(index);
}
void KCategorizedItemsView::itemDoubleClicked(const QModelIndex& index)
{
// don't emit activated signal for "favicon" and "remove applet"
// columns so double clicking on these columns won't unexpectedly
// add an applet to the containment
if ( index.column() == 1 || index.column() == 2 ) {
return;
}
emit doubleClicked(index);
}
void KCategorizedItemsView::updateColumnsWidth(bool force)
{
m_viewWidth = itemsView->viewport()->width();

View File

@ -70,6 +70,7 @@ protected slots:
private slots:
void itemActivated( const QModelIndex& index );
void itemDoubleClicked( const QModelIndex& index );
Q_SIGNALS:
void activated ( const QModelIndex & index );