kurlcombobox.h
/* This file is part of the KDE libraries
Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KURLCOMBOBOX_H
#define KURLCOMBOBOX_H
#include <qevent.h>
#include <qptrlist.h>
#include <qmap.h>
#include <qpixmap.h>
#include <qstringlist.h>
#include <kcombobox.h>
#include <kurl.h>
class KIO_EXPORT KURLComboBox : public KComboBox
{
Q_OBJECT
Q_PROPERTY(QStringList urls READ urls WRITE setURLs DESIGNABLE true)
Q_PROPERTY(int maxItems READ maxItems WRITE setMaxItems DESIGNABLE true)
public:
enum Mode { Files = -1, Directories = 1, Both = 0 };
enum OverLoadResolving { RemoveTop, RemoveBottom };
KURLComboBox( Mode mode, QWidget *parent=0, const char *name=0 );
KURLComboBox( Mode mode, bool rw, QWidget *parent=0, const char *name=0 );
~KURLComboBox();
void setURL( const KURL& url );
void setURLs( QStringList urls );
void setURLs( QStringList urls, OverLoadResolving remove );
QStringList urls() const;
void setMaxItems( int );
int maxItems() const { return myMaximum; }
void addDefaultURL( const KURL& url, const QString& text = QString::null );
void addDefaultURL( const KURL& url, const QPixmap& pix,
const QString& text = QString::null );
void setDefaults();
void removeURL( const KURL& url, bool checkDefaultURLs = true );
signals:
void urlActivated( const KURL& url );
protected slots:
void slotActivated( int );
protected:
struct _KURLComboItem {
QString text;
KURL url;
QPixmap pixmap;
};
typedef _KURLComboItem KURLComboItem;
QPtrList<KURLComboItem> itemList;
QPtrList<KURLComboItem> defaultList;
QMap<int,const KURLComboItem*> itemMapper;
void init( Mode mode );
void insertURLItem( const KURLComboItem * );
QPixmap getPixmap( const KURL& url ) const;
void updateItem( const KURLComboItem *item, int index, const QPixmap& pix);
QPixmap opendirPix;
int firstItemIndex;
private:
bool urlAdded;
int myMaximum;
Mode myMode; // can be used as parameter to KUR::path( int ) or url( int )
// to specify if we want a trailing slash or not
private:
class KURLComboBoxPrivate;
KURLComboBoxPrivate *d;
};
#endif // KURLCOMBOBOX_H
KURLComboBox
This combobox shows a number of recent URLs/directories, as well as some default directories.
Definition: kurlcombobox.h:41
KURLComboBox::maxItems
int maxItems() const
Definition: kurlcombobox.h:137
KURLComboBox::OverLoadResolving
OverLoadResolving
This Enumeration is used in setURL() to determine which items will be removed when the given list is ...
Definition: kurlcombobox.h:59
KURLComboBox::Mode
Mode
This enum describes which kind of items is shown in the combo box.
Definition: kurlcombobox.h:51

KDE Home | KDE Accessibility Home | Description of Access Keys