summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/colorlistbox.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/kaddressbook/views/colorlistbox.cpp b/kaddressbook/views/colorlistbox.cpp
index 7386207..2bddca6 100644
--- a/kaddressbook/views/colorlistbox.cpp
+++ b/kaddressbook/views/colorlistbox.cpp
@@ -14,32 +14,35 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <qpainter.h>
#include <kcolordialog.h>
#ifndef KAB_EMBEDDED
#include <kcolordrag.h>
#endif //KAB_EMBEDDED
#include "colorlistbox.h"
+#ifdef DESKTOP_VERSION
+#include <qcolordialog.h>
+#endif
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;
}
@@ -84,39 +87,46 @@ void ColorListBox::slotNewColor(QListBoxItem * i)
void ColorListBox::newColor( int index )
{
if( isEnabled() == false )
{
return;
}
if( (uint)index < count() )
{
QColor c = color( index );
#ifndef KAB_EMBEDDED
if( KColorDialog::getColor( c, this ) != QDialog::Rejected )
{
setColor( index, c );
}
#else //KAB_EMBEDDED
+#ifdef DESKTOP_VERSION
+ QColor col = QColorDialog::getColor ( c );
+ if ( col.isValid () ) {
+ setColor( index, col );
+ }
+#else
KColorDialog* k = new KColorDialog( this );
k->setColor( c );
int res = k->exec();
if ( res ) {
setColor( index, k->getColor() );
}
delete k;
+#endif
#endif //KAB_EMBEDDED
}
}
void ColorListBox::dragEnterEvent( QDragEnterEvent *e )
{
#ifndef KAB_EMBEDDED
if( KColorDrag::canDecode(e) && isEnabled() )
{
mCurrentOnDragEnter = currentItem();
e->accept( true );
}
else
{