Fix double-clicking behaviour of appletbrowser - don't emit double click event

if clicked on "favicon" or "remove" column

reviewed by aseigo

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=785253
This commit is contained in:
Dmitry Suzdalev 2008-03-13 16:10:11 +00:00
parent eb0bf064ab
commit a2919ba41f
2 changed files with 17 additions and 1 deletions

View File

@ -44,8 +44,9 @@ KCategorizedItemsView::KCategorizedItemsView(QWidget * parent, Qt::WindowFlags f
connect(comboFilters, SIGNAL(currentIndexChanged(int)),
this, SLOT(filterChanged(int)));
// we filter "activated" signals to re-emit them only when wanted
connect (itemsView, SIGNAL(activated(const QModelIndex &)),
this, SIGNAL(activated(const QModelIndex &)));
this, SLOT(itemActivated(const QModelIndex &)));
connect (itemsView, SIGNAL(clicked(const QModelIndex &)),
this, SIGNAL(clicked(const QModelIndex &)));
@ -138,6 +139,18 @@ void KCategorizedItemsView::filterChanged(int index)
}
}
void KCategorizedItemsView::itemActivated( 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 activated(index);
}
void KCategorizedItemsView::updateColumnsWidth(bool force)
{
m_viewWidth = itemsView->viewport()->width();

View File

@ -68,6 +68,9 @@ protected slots:
void searchTermChanged(const QString &text);
void filterChanged(int index);
private slots:
void itemActivated( const QModelIndex& index );
Q_SIGNALS:
void activated ( const QModelIndex & index );
void clicked ( const QModelIndex & index );