author | zautrix <zautrix> | 2005-06-07 08:53:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-07 08:53:18 (UTC) |
commit | aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4 (patch) (side-by-side diff) | |
tree | 69bcfb2ea1e74fa38bf8c648ecba4501dfbe5690 | |
parent | ff8af7ccdd6346bba1cb871c33931352bbafe40e (diff) | |
download | kdepimpi-aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4.zip kdepimpi-aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4.tar.gz kdepimpi-aa9a9368a7b38e34118b65a4e8efa7ea7ec0e8e4.tar.bz2 |
color dialog fix
-rw-r--r-- | kaddressbook/views/colorlistbox.cpp | 10 | ||||
-rw-r--r-- | microkde/kcolorbutton.cpp | 13 |
2 files changed, 22 insertions, 1 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 @@ -18,24 +18,27 @@ * */ #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 ) { @@ -88,31 +91,38 @@ void ColorListBox::newColor( int index ) 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(); diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp index 433f909..c7c6088 100644 --- a/microkde/kcolorbutton.cpp +++ b/microkde/kcolorbutton.cpp @@ -1,31 +1,42 @@ #include "kcolorbutton.h" #include "kcolordialog.h" #include "qapplication.h" #include "qlayout.h" - +#ifdef DESKTOP_VERSION +#include <qcolordialog.h> +#endif void KColorButton:: edit() { +#ifdef DESKTOP_VERSION + QColor col = QColorDialog::getColor ( mColor ); + if ( col.isValid () ) { + mColor = col; + setColor ( mColor ); + emit changed ( mColor ); + } +#else KColorDialog* k = new KColorDialog( this ); k->setColor( mColor ); int res = k->exec(); if ( res ) { mColor = k->getColor(); setColor ( mColor ); emit changed ( mColor ); } delete k; +#endif } KColorButton::KColorButton( QWidget *p ):QPushButton( p ) { int size = 24; if( QApplication::desktop()->width() < 480 ) size = 18; setFixedSize( size,size ); connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); } void KColorButton::setColor ( const QColor & c) { |