• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kio

kurlcombobox.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef KURLCOMBOBOX_H
00020 #define KURLCOMBOBOX_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 KIO_EXPORT 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 
00076     KURLComboBox( Mode mode, QWidget *parent=0, const char *name=0 );
00077     KURLComboBox( Mode mode, bool rw, QWidget *parent=0, const char *name=0 );
00081     ~KURLComboBox();
00082 
00095     void setURL( const KURL& url );
00096 
00104     void setURLs( QStringList urls );
00105 
00113     void setURLs( QStringList urls, OverLoadResolving remove );
00114 
00125     QStringList urls() const;
00126 
00131     void setMaxItems( int );
00132 
00137     int maxItems() const { return myMaximum; }
00138 
00147     void addDefaultURL( const KURL& url, const QString& text = QString::null );
00148 
00157     void addDefaultURL( const KURL& url, const QPixmap& pix,
00158             const QString& text = QString::null );
00159 
00165     void setDefaults();
00166 
00171     void removeURL( const KURL& url, bool checkDefaultURLs = true );
00172 
00173 signals:
00179     void urlActivated( const KURL& url );
00180 
00181 
00182 protected slots:
00183     void slotActivated( int );
00184 
00185 
00186 protected:
00187     struct _KURLComboItem {
00188     QString text;
00189     KURL url;
00190     QPixmap pixmap;
00191     };
00192     typedef _KURLComboItem KURLComboItem;
00193     QPtrList<KURLComboItem> itemList;
00194     QPtrList<KURLComboItem> defaultList;
00195     QMap<int,const KURLComboItem*> itemMapper;
00196 
00197     void init( Mode mode );
00198     void insertURLItem( const KURLComboItem * );
00199 
00204     QPixmap getPixmap( const KURL& url ) const;
00205 
00211     void updateItem( const KURLComboItem *item, int index, const QPixmap& pix);
00212 
00213     QPixmap opendirPix;
00214     int firstItemIndex;
00215 
00216 
00217 private:
00218     bool urlAdded;
00219     int myMaximum;
00220     Mode myMode; // can be used as parameter to KUR::path( int ) or url( int )
00221                  // to specify if we want a trailing slash or not
00222 
00223 private:
00224     class KURLComboBoxPrivate;
00225     KURLComboBoxPrivate *d;
00226 };
00227 
00228 
00229 #endif // KURLCOMBOBOX_H

kio

Skip menu "kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal