kfilepreview.h

00001 /*  -*- c++ -*-
00002     This file is part of the KDE libraries
00003     Copyright (C) 1998 Stephan Kulow <coolo@kde.org>
00004                   1998 Daniel Grana <grana@ie.iwi.unibe.ch>
00005                   2000 Werner Trobin <wtrobin@carinthia.com>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef _KFILEPREVIEW_H
00024 #define _KFILEPREVIEW_H
00025 
00026 #include <qsplitter.h>
00027 #include <qwidget.h>
00028 #include <qstring.h>
00029 
00030 #include <kurl.h>
00031 #include <kfileitem.h>
00032 #include <kfileiconview.h>
00033 #include <kfiledetailview.h>
00034 #include <kfile.h>
00035 
00039 class KIO_EXPORT KFilePreview : public QSplitter, public KFileView
00040 {
00041     Q_OBJECT
00042 
00043 public:
00044     KFilePreview(QWidget *parent, const char *name);
00045     KFilePreview(KFileView *view, QWidget *parent, const char *name);
00046     virtual ~KFilePreview();
00047 
00048     virtual QWidget *widget() { return this; }
00049     virtual void clearView();
00050 
00055     void setFileView(KFileView *view);
00056 
00060     KFileView* fileView() const { return left; }
00061 
00062     virtual void updateView( bool );
00063     virtual void updateView(const KFileItem*);
00064     virtual void removeItem(const KFileItem*);
00065     virtual void listingCompleted();
00066 
00067     virtual void setSelectionMode( KFile::SelectionMode sm );
00068 
00069     virtual void setSelected(const KFileItem *, bool);
00070     virtual bool isSelected( const KFileItem * ) const;
00071     virtual void clearSelection();
00072     virtual void selectAll();
00073     virtual void invertSelection();
00074 
00075     virtual void insertItem(KFileItem *);
00076     virtual void clear();
00077 
00078     virtual void setCurrentItem( const KFileItem * );
00079     virtual KFileItem * currentFileItem() const;
00080     virtual KFileItem * firstFileItem() const;
00081     virtual KFileItem * nextItem( const KFileItem * ) const;
00082     virtual KFileItem * prevItem( const KFileItem * ) const;
00083 
00084     virtual void setSorting( QDir::SortSpec sort );
00085 
00086     virtual void readConfig( KConfig *, const QString& group = QString::null );
00087     virtual void writeConfig( KConfig *, const QString& group = QString::null);
00088 
00095     virtual KActionCollection * actionCollection() const;
00096 
00097     void ensureItemVisible(const KFileItem *);
00098 
00099     void setPreviewWidget(const QWidget *w, const KURL &u);
00100 
00101 protected slots:
00102     virtual void slotHighlighted( const KFileItem * );
00103 
00104 signals:
00105     void showPreview(const KURL &);
00106     void clearPreview();
00107 
00108 private:
00109     void init( KFileView *view );
00110 
00111     KFileView *left;
00112     QWidget *preview;
00113     QString viewname;
00114 
00115 protected:
00117     virtual void virtual_hook( int id, void* data );
00118 private:
00119     class KFilePreviewPrivate;
00120     KFilePreviewPrivate *d;
00121 };
00122 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys