# kio Library API Documentation

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

# kfiledetailview.h

    00001 // -*- c++ -*-
    00002 /* This file is part of the KDE libraries
    00003     Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library is distributed in the hope that it will be useful,
    00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #ifndef KFILEDETAILVIEW_H
    00022 #define KFILEDETAILVIEW_H
    00023
    00024 class KFileItem;
    00025 class QWidget;
    00026 class QKeyEvent;
    00027
    00028 #include <klistview.h>
    00029 #include <kmimetyperesolver.h>
    00030
    00031 #include "kfileview.h"
    00032
    00037 class KFileListViewItem : public KListViewItem
    00038 {
    00039 public:
    00040     KFileListViewItem( QListView *parent, const QString &text,
    00041                        const QPixmap &icon, KFileItem *fi )
    00042         : KListViewItem( parent, text ), inf( fi ) {
    00043         setPixmap( 0, icon );
    00044         setText( 0, text );
    00045     }
    00046
    00050     KFileListViewItem( QListView *parent, KFileItem *fi )
    00051         : KListViewItem( parent ), inf( fi ) {
    00052         init();
    00053     }
    00054
    00055     KFileListViewItem( QListView *parent, const QString &text,
    00056                        const QPixmap &icon, KFileItem *fi,
    00057                        QListViewItem *after)
    00058         : KListViewItem( parent, after ), inf( fi ) {
    00059         setPixmap( 0, icon );
    00060         setText( 0, text );
    00061     }
    00062     ~KFileListViewItem() {
    00063         inf->removeExtraData( listView() );
    00064     }
    00065
    00069     KFileItem *fileInfo() const {
    00070         return inf;
    00071     }
    00072
    00073     virtual QString key( int /*column*/, bool /*ascending*/ ) const {
    00074         return m_key;
    00075     }
    00076
    00077     void setKey( const QString& key ) { m_key = key; }
    00078
    00079     QRect rect() const
    00080     {
    00081         QRect r = listView()->itemRect(this);
    00082         return QRect( listView()->viewportToContents( r.topLeft() ),
    00083                       QSize( r.width(), r.height() ) );
    00084     }
    00085
    00089     void init();
    00090
    00091 private:
    00092     KFileItem *inf;
    00093     QString m_key;
    00094
    00095 private:
    00096     class KFileListViewItemPrivate;
    00097     KFileListViewItemPrivate *d;
    00098
    00099 };
    00100
    00109 class KFileDetailView : public KListView, public KFileView
    00110 {
    00111     Q_OBJECT
    00112
    00113 public:
    00114     KFileDetailView(QWidget *parent, const char *name);
    00115     virtual ~KFileDetailView();
    00116
    00117     virtual QWidget *widget() { return this; }
    00118     virtual void clearView();
    00119     virtual void setAutoUpdate( bool ) {}
    00120
    00121     virtual void setSelectionMode( KFile::SelectionMode sm );
    00122
    00123     virtual void updateView( bool );
    00124     virtual void updateView(const KFileItem*);
    00125     virtual void removeItem( const KFileItem *);
    00126     virtual void listingCompleted();
    00127
    00128     virtual void setSelected(const KFileItem *, bool);
    00129     virtual bool isSelected(const KFileItem *i) const;
    00130     virtual void clearSelection();
    00131     virtual void selectAll();
    00132     virtual void invertSelection();
    00133
    00134     virtual void setCurrentItem( const KFileItem * );
    00135     virtual KFileItem * currentFileItem() const;
    00136     virtual KFileItem * firstFileItem() const;
    00137     virtual KFileItem * nextItem( const KFileItem * ) const;
    00138     virtual KFileItem * prevItem( const KFileItem * ) const;
    00139
    00140     virtual void insertItem( KFileItem *i );
    00141
    00142     // implemented to get noticed about sorting changes (for sortingIndicator)
    00143     virtual void setSorting( QDir::SortSpec );
    00144
    00145     void ensureItemVisible( const KFileItem * );
    00146
    00147     // for KMimeTypeResolver
    00148     void mimeTypeDeterminationFinished();
    00149     void determineIcon( KFileListViewItem *item );
    00150     QScrollView *scrollWidget() const { return (QScrollView*) this; }
    00151
    00152
    00153 protected:
    00154     virtual void keyPressEvent( QKeyEvent * );
    00155
    00156     int m_sortingCol;
    00157
    00158 protected slots:
    00159     void slotSelectionChanged();
    00160
    00161 private slots:
    00162     void slotSortingChanged( int );
    00163     void selected( QListViewItem *item );
    00164     void slotActivate( QListViewItem *item );
    00165     void highlighted( QListViewItem *item );
    00166     void slotActivateMenu ( QListViewItem *item, const QPoint& pos );
    00167
    00168 private:
    00169     virtual void insertItem(QListViewItem *i) { KListView::insertItem(i); }
    00170     virtual void setSorting(int i, bool b) { KListView::setSorting(i, b); }
    00171     virtual void setSelected(QListViewItem *i, bool b) { KListView::setSelected(i, b); }
    00172
    00173     inline KFileListViewItem * viewItem( const KFileItem *item ) const {
    00174         if ( item )
    00175             return (KFileListViewItem *) item->extraData( this );
    00176         return 0L;
    00177     }
    00178
    00179     void setSortingKey( KFileListViewItem *item, const KFileItem *i );
    00180
    00181
    00182     bool m_blockSortingSignal;
    00183     KMimeTypeResolver<KFileListViewItem,KFileDetailView> *m_resolver;
    00184
    00185 protected:
    00186     virtual void virtual_hook( int id, void* data );
    00187 private:
    00188     class KFileDetailViewPrivate;
    00189     KFileDetailViewPrivate *d;
    00190 };
    00191
    00192 #endif // KFILEDETAILVIEW_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:13:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001