00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KURLBAR_H
00020 #define KURLBAR_H
00021
00022 #include <qevent.h>
00023 #include <qframe.h>
00024 #include <qtooltip.h>
00025
00026 #include <kdialogbase.h>
00027 #include <kicontheme.h>
00028 #include <klistbox.h>
00029 #include <kurl.h>
00030
00031 class KConfig;
00032 class KURLBar;
00033
00042 class KIO_EXPORT KURLBarItem : public QListBoxPixmap
00043 {
00044 public:
00058 KURLBarItem( KURLBar *parent, const KURL& url, bool persistent,
00059 const QString& description = QString::null,
00060 const QString& icon = QString::null,
00061 KIcon::Group group = KIcon::Panel );
00062
00075 KURLBarItem( KURLBar *parent, const KURL& url,
00076 const QString& description = QString::null,
00077 const QString& icon = QString::null,
00078 KIcon::Group group = KIcon::Panel );
00079
00083 ~KURLBarItem();
00084
00090 void setURL( const KURL& url );
00096 void setIcon( const QString& icon, KIcon::Group group = KIcon::Panel );
00101 void setDescription( const QString& desc );
00106 void setToolTip( const QString& tip );
00107
00112 QSize sizeHint() const;
00113
00117 virtual int width( const QListBox * ) const;
00121 virtual int height( const QListBox * ) const;
00122
00127 const KURL& url() const { return m_url; }
00132 const QString& description() const { return m_description; }
00137 const QString& icon() const { return m_icon; }
00142 QString toolTip() const;
00147 KIcon::Group iconGroup() const { return m_group; }
00151 virtual const QPixmap * pixmap() const { return &m_pixmap; }
00152
00159 void setApplicationLocal( bool local );
00160
00167 bool applicationLocal() const { return m_appLocal; }
00168
00174 bool isPersistent() const;
00175
00176 protected:
00177 virtual void paint( QPainter *p );
00178
00179 private:
00180 int iconSize() const;
00181 void init( const QString& icon, KIcon::Group group,
00182 const QString& description, bool persistent );
00183
00184 KURL m_url;
00185 QString m_description;
00186 QString m_icon;
00187 QString m_toolTip;
00188 QPixmap m_pixmap;
00189 KIcon::Group m_group;
00190 KURLBar *m_parent;
00191 bool m_appLocal :1;
00192
00193 protected:
00194 virtual void virtual_hook( int id, void* data );
00195 private:
00196 class KURLBarItemPrivate;
00197 KURLBarItemPrivate *d;
00198 };
00199
00200
00203
00204
00205 class KURLBarListBox;
00206
00230 class KIO_EXPORT KURLBar : public QFrame
00231 {
00232 Q_OBJECT
00233
00234 public:
00239 KURLBar( bool useGlobalItems,
00240 QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
00244 ~KURLBar();
00245
00256 virtual KURLBarItem * insertItem( const KURL& url,
00257 const QString& description,
00258 bool applicationLocal = true,
00259 const QString& icon = QString::null,
00260 KIcon::Group group = KIcon::Panel );
00271 virtual KURLBarItem * insertDynamicItem( const KURL& url,
00272 const QString& description,
00273 const QString& icon = QString::null,
00274 KIcon::Group group = KIcon::Panel );
00280 virtual void setOrientation( Qt::Orientation orient );
00285 Orientation orientation() const;
00286
00293 virtual void setListBox( KURLBarListBox * );
00298 KURLBarListBox *listBox() const { return m_listBox; }
00299
00305 virtual void setIconSize( int size );
00311 int iconSize() const { return m_iconSize; }
00312
00316 virtual void clear();
00317
00322 virtual QSize sizeHint() const;
00323
00327 virtual QSize minimumSizeHint() const;
00328
00334 virtual void readConfig( KConfig *config, const QString& itemGroup );
00340 virtual void writeConfig( KConfig *config, const QString& itemGroup );
00341
00347 virtual void readItem( int i, KConfig *config, bool applicationLocal );
00354 virtual void writeItem( KURLBarItem *item, int i, KConfig *, bool global );
00355
00361 KURLBarItem * currentItem() const;
00368 KURL currentURL() const;
00369
00375 bool isModified() const { return m_isModified; }
00376
00380 bool isImmutable() const { return m_isImmutable; }
00381
00385 bool isVertical() const { return orientation() == Vertical; }
00386
00387 public slots:
00394 virtual void setCurrentItem( const KURL& url );
00395
00396 signals:
00401 void activated( const KURL& url );
00402
00403 protected:
00409 virtual bool addNewItem();
00417 virtual bool editItem( KURLBarItem *item );
00418
00419 virtual void resizeEvent( QResizeEvent * );
00420
00421 virtual void paletteChange( const QPalette & );
00422
00426 KURLBarItem * m_activeItem;
00430 bool m_useGlobal :1;
00431
00436 bool m_isModified :1;
00437
00442 bool m_isImmutable :1;
00443
00444 protected slots:
00449 virtual void slotContextMenuRequested( QListBoxItem *, const QPoint& pos );
00454 virtual void slotSelected( QListBoxItem * );
00455
00460 virtual void slotDropped( QDropEvent * );
00461
00462 private slots:
00463 void slotSelected( int button, QListBoxItem * );
00464
00465 private:
00466 KURLBarListBox *m_listBox;
00467 int m_iconSize;
00468
00469
00470 protected:
00471 virtual void virtual_hook( int id, void* data );
00472 private:
00473 class KURLBarPrivate;
00474 KURLBarPrivate *d;
00475 };
00476
00477
00480
00481
00482 class QDragObject;
00483 class KURLBarToolTip;
00484
00493 class KIO_EXPORT KURLBarListBox : public KListBox
00494 {
00495 Q_OBJECT
00496
00497 public:
00501 KURLBarListBox( QWidget *parent = 0, const char *name = 0 );
00505 ~KURLBarListBox();
00506
00513 virtual void setOrientation( Qt::Orientation orient );
00518 Qt::Orientation orientation() const { return m_orientation; }
00519
00520 bool isVertical() const { return m_orientation == Qt::Vertical; }
00521
00522 signals:
00526 void dropped( QDropEvent *e );
00527
00528 protected:
00532 virtual QDragObject * dragObject();
00533
00534 virtual void contentsDragEnterEvent( QDragEnterEvent * );
00535 virtual void contentsDropEvent( QDropEvent * );
00536 virtual void contextMenuEvent( QContextMenuEvent * );
00537 virtual void paintEvent( QPaintEvent* );
00538
00539 private:
00540 Qt::Orientation m_orientation;
00541 KURLBarToolTip *m_toolTip;
00542
00543 protected:
00544 virtual void virtual_hook( int id, void* data );
00545 private:
00546 class KURLBarListBoxPrivate;
00547 KURLBarListBoxPrivate *d;
00548 };
00549
00550
00553
00554
00555 class QCheckBox;
00556 class KIconButton;
00557 class KLineEdit;
00558 class KURLRequester;
00559
00567 class KIO_EXPORT KURLBarItemDialog : public KDialogBase
00568 {
00569 Q_OBJECT
00570
00571 public:
00579 static bool getInformation( bool allowGlobal, KURL& url,
00580 QString& description, QString& icon,
00581 bool& appLocal, int iconSize,
00582 QWidget *parent = 0 );
00583
00601 KURLBarItemDialog( bool allowGlobal, const KURL& url,
00602 const QString& description, QString icon,
00603 bool appLocal = true,
00604 int iconSize = KIcon::SizeMedium,
00605 QWidget *parent = 0, const char *name = 0 );
00609 ~KURLBarItemDialog();
00610
00614 KURL url() const;
00615
00619 QString description() const;
00620
00624 QString icon() const;
00625
00631 bool applicationLocal() const;
00632
00633 protected:
00637 KURLRequester * m_urlEdit;
00641 KLineEdit * m_edit;
00645 KIconButton * m_iconButton;
00649 QCheckBox * m_appLocal;
00650
00651 public slots:
00652 void urlChanged(const QString & );
00653
00654 private:
00655 class KURLBarItemDialogPrivate;
00656 KURLBarItemDialogPrivate *d;
00657 };
00658
00659
00660 #endif // KURLBAR_H