# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kurlcombobox.h

    00001 /* This file is part of the KDE libraries
    00002     Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License version 2, as published by the Free Software Foundation.
    00007
    00008     This library is distributed in the hope that it will be useful,
    00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00011     Library General Public License for more details.
    00012
    00013     You should have received a copy of the GNU Library General Public License
    00014     along with this library; see the file COPYING.LIB.  If not, write to
    00015     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00016     Boston, MA 02111-1307, USA.
    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; // can be used as parameter to KUR::path( int ) or url( int )
    00219                  // to specify if we want a trailing slash or not
    00220
    00221 private:
    00222     class KURLComboBoxPrivate;
    00223     KURLComboBoxPrivate *d;
    00224 };
    00225
    00226
    00227 #endif // KDIRCOMBOBOX_H

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:33 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001