kurlcombobox.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
#ifndef KDIRCOMBOBOX_H
00020
#define KDIRCOMBOBOX_H
00021
00022
#include <qevent.h>
00023
#include <qptrlist.h>
00024
#include <qmap.h>
00025
#include <qpixmap.h>
00026
#include <qstringlist.h>
00027
00028
#include <kcombobox.h>
00029
#include <kurl.h>
00030
00041 class KURLComboBox :
public KComboBox
00042 {
00043 Q_OBJECT
00044 Q_PROPERTY(
QStringList urls READ urls WRITE
setURLs DESIGNABLE
true)
00045 Q_PROPERTY(
int maxItems READ maxItems WRITE
setMaxItems DESIGNABLE
true)
00046
00047
public:
00051 enum Mode { Files = -1, Directories = 1, Both = 0 };
00059 enum OverLoadResolving { RemoveTop, RemoveBottom };
00060
00074
KURLComboBox( Mode mode,
QWidget *parent=0,
const char *name=0 );
00075
KURLComboBox( Mode mode,
bool rw,
QWidget *parent=0,
const char *name=0 );
00079
~KURLComboBox();
00080
00093
void setURL(
const KURL& url );
00094
00102
void setURLs(
QStringList urls );
00103
00111
void setURLs(
QStringList urls, OverLoadResolving remove );
00112
00123
QStringList urls() const;
00124
00129
void setMaxItems(
int );
00130
00135 int maxItems()
const {
return myMaximum; }
00136
00145
void addDefaultURL(
const KURL& url,
const QString& text = QString::null );
00146
00155
void addDefaultURL(
const KURL& url,
const QPixmap& pix,
00156
const QString& text = QString::null );
00157
00163
void setDefaults();
00164
00169
void removeURL(
const KURL& url,
bool checkDefaultURLs =
true );
00170
00171 signals:
00177
void urlActivated(
const KURL& url );
00178
00179
00180
protected slots:
00181
void slotActivated(
int );
00182
00183
00184
protected:
00185
struct _KURLComboItem {
00186
QString text;
00187
KURL url;
00188
QPixmap pixmap;
00189 };
00190
typedef _KURLComboItem KURLComboItem;
00191
QPtrList<KURLComboItem> itemList;
00192
QPtrList<KURLComboItem> defaultList;
00193
QMap<int,const KURLComboItem*> itemMapper;
00194
00195
void init( Mode mode );
00196
void insertURLItem(
const KURLComboItem * );
00197
00202
QPixmap getPixmap(
const KURL& url )
const;
00203
00209
void updateItem(
const KURLComboItem *item,
int index,
const QPixmap& pix);
00210
00211
QPixmap opendirPix;
00212
int firstItemIndex;
00213
00214
00215
private:
00216
bool urlAdded;
00217
int myMaximum;
00218
Mode myMode;
00219
00220
00221
private:
00222
class KURLComboBoxPrivate;
00223 KURLComboBoxPrivate *d;
00224 };
00225
00226
00227
#endif // KDIRCOMBOBOX_H
This file is part of the documentation for kio Library Version 3.3.1.