summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views/colorlistbox.cpp
Side-by-side diff
Diffstat (limited to 'kaddressbook/views/colorlistbox.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/views/colorlistbox.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp
index c243fa0..7386207 100644
--- a/kaddressbook/views/colorlistbox.cpp
+++ b/kaddressbook/views/colorlistbox.cpp
@@ -23,24 +23,25 @@
#include <kcolordialog.h>
#ifndef KAB_EMBEDDED
#include <kcolordrag.h>
#endif //KAB_EMBEDDED
#include "colorlistbox.h"
ColorListBox::ColorListBox( QWidget *parent, const char *name, WFlags f )
:KListBox( parent, name, f ), mCurrentOnDragEnter(-1)
{
connect( this, SIGNAL(selected(int)), this, SLOT(newColor(int)) );
+ connect( this, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotNewColor(QListBoxItem *)) );
setAcceptDrops( true);
}
void ColorListBox::setEnabled( bool state )
{
if( state == isEnabled() )
{
return;
}
QListBox::setEnabled( state );
@@ -65,25 +66,29 @@ void ColorListBox::setColor( uint index, const QColor &color )
QColor ColorListBox::color( uint index ) const
{
if( index < count() )
{
ColorListItem *colorItem = (ColorListItem*)item(index);
return( colorItem->color() );
}
else
{
return( black );
}
}
-
+void ColorListBox::slotNewColor(QListBoxItem * i)
+{
+ if ( i )
+ newColor( index( i ) );
+}
void ColorListBox::newColor( int index )
{
if( isEnabled() == false )
{
return;
}
if( (uint)index < count() )
{
QColor c = color( index );
#ifndef KAB_EMBEDDED