00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef IMAGEWIDGET_H
00025
#define IMAGEWIDGET_H
00026
00027
#include <qlabel.h>
00028
00029
#include <kabc/picture.h>
00030
#include <kdialogbase.h>
00031
00032
class KURLRequester;
00033
class QCheckBox;
00034
00038 class ImageLabel :
public QLabel
00039 {
00040 Q_OBJECT
00041
00042
public:
00043
ImageLabel(
const QString &title, QWidget *parent );
00044
00045
void setReadOnly(
bool readOnly );
00046
00047 signals:
00048
void changed();
00049
00050
protected:
00051
virtual void dragEnterEvent( QDragEnterEvent *event );
00052
virtual void dropEvent( QDropEvent *event );
00053
virtual void mouseMoveEvent( QMouseEvent *event );
00054
virtual void mousePressEvent( QMouseEvent *event );
00055
00056
private:
00057
void startDrag();
00058
00059
bool mReadOnly;
00060 QPoint mDragStartPos;
00061 };
00062
00063
class ImageWidget :
public QWidget
00064 {
00065 Q_OBJECT
00066
00067
public:
00068 ImageWidget(
const QString &title, QWidget *parent,
const char *name = 0 );
00069 ~ImageWidget();
00070
00074
void setImage(
const KABC::Picture &photo );
00075
00079 KABC::Picture image() const;
00080
00081
void setReadOnly(
bool readOnly );
00082
00083 signals:
00084
void changed();
00085
00086 private slots:
00087
void loadImage();
00088
void updateGUI();
00089
void clear();
00090
void imageChanged();
00091
00092 private:
00093 QPixmap loadPixmap( const KURL &url );
00094
00095
ImageLabel *mImageLabel;
00096 KURLRequester *mImageUrl;
00097
00098 QCheckBox *mUseImageUrl;
00099 QPushButton *mClearButton;
00100
00101
bool mReadOnly;
00102 };
00103
00104 #endif