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., 59 Temple Place - Suite 330, 00020 Boston, MA 02111-1307, USA. 00021 */ 00022 00023 #ifndef _KFILEPREVIEW_H 00024 #define _KFILEPREVIEW_H 00025 00026 #include <kfileview.h> 00027 #include <kfileitem.h> 00028 #include <kfilepreview.h> 00029 #include <kfileiconview.h> 00030 #include <kfiledetailview.h> 00031 #include <kfile.h> 00032 00033 #include <qsplitter.h> 00034 #include <qwidget.h> 00035 00036 #include <qstring.h> 00037 #include <qlabel.h> 00038 00039 #include <klocale.h> 00040 #include <kdebug.h> 00041 #include <kurl.h> 00042 00046 class KFilePreview : public QSplitter, public KFileView 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 KFilePreview(QWidget *parent, const char *name); 00052 KFilePreview(KFileView *view, QWidget *parent, const char *name); 00053 virtual ~KFilePreview(); 00054 00055 virtual QWidget *widget() { return this; } 00056 virtual void clearView(); 00057 00062 void setFileView(KFileView *view); 00063 00067 KFileView* fileView() const { return left; } 00068 00069 virtual void updateView( bool ); 00070 virtual void updateView(const KFileItem*); 00071 virtual void removeItem(const KFileItem*); 00072 virtual void listingCompleted(); 00073 00074 virtual void setSelectionMode( KFile::SelectionMode sm ); 00075 00076 virtual void setSelected(const KFileItem *, bool); 00077 virtual bool isSelected( const KFileItem * ) const; 00078 virtual void clearSelection(); 00079 virtual void selectAll(); 00080 virtual void invertSelection(); 00081 00082 virtual void insertItem(KFileItem *); 00083 virtual void clear(); 00084 00085 virtual void setCurrentItem( const KFileItem * ); 00086 virtual KFileItem * currentFileItem() const; 00087 virtual KFileItem * firstFileItem() const; 00088 virtual KFileItem * nextItem( const KFileItem * ) const; 00089 virtual KFileItem * prevItem( const KFileItem * ) const; 00090 00091 virtual void setSorting( QDir::SortSpec sort ); 00092 00093 virtual void readConfig( KConfig *, const QString& group = QString::null ); 00094 virtual void writeConfig( KConfig *, const QString& group = QString::null); 00095 00102 virtual KActionCollection * actionCollection() const; 00103 00104 void ensureItemVisible(const KFileItem *); 00105 00106 void setPreviewWidget(const QWidget *w, const KURL &u); 00107 00108 protected slots: 00109 virtual void slotHighlighted( const KFileItem * ); 00110 00111 signals: 00112 void showPreview(const KURL &); 00113 void clearPreview(); 00114 00115 private: 00116 void init( KFileView *view ); 00117 00118 KFileView *left; 00119 QWidget *preview; 00120 QString viewname; 00121 00122 protected: 00124 virtual void virtual_hook( int id, void* data ); 00125 private: 00126 class KFilePreviewPrivate; 00127 KFilePreviewPrivate *d; 00128 }; 00129 #endif