kio
kcombiview.h
Go to the documentation of this file.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 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef _KCOMBIVIEW_H 00023 #define _KCOMBIVIEW_H 00024 00025 #include <qsplitter.h> 00026 #include <klocale.h> 00027 00028 #include <kfile.h> 00029 #include <kfileview.h> 00030 00031 class KFileIconView; 00032 class QEvent; 00033 class QIconViewItem; 00034 00054 class KIO_EXPORT KCombiView : public QSplitter, 00055 public KFileView 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 KCombiView( QWidget *parent, const char *name); 00061 virtual ~KCombiView(); 00062 00063 virtual QWidget *widget() { return this; } 00064 virtual void clearView(); 00065 00066 virtual void updateView( bool ); 00067 virtual void updateView(const KFileItem*); 00068 virtual void removeItem( const KFileItem * ); 00069 virtual void listingCompleted(); 00070 00075 void setRight(KFileView *view); 00076 00077 virtual void setSelectionMode( KFile::SelectionMode sm ); 00078 00079 virtual void setSelected(const KFileItem *, bool); 00080 virtual bool isSelected( const KFileItem * ) const; 00081 virtual void clearSelection(); 00082 virtual void selectAll(); 00083 virtual void invertSelection(); 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 insertItem( KFileItem *i ); 00092 virtual void clear(); 00093 00094 virtual void setSorting( QDir::SortSpec sort ); 00095 00096 virtual void readConfig( KConfig *, const QString& group = QString::null ); 00097 virtual void writeConfig( KConfig *, const QString& group = QString::null); 00098 00099 void ensureItemVisible( const KFileItem * ); 00100 00101 virtual KActionCollection * actionCollection() const; 00102 00103 virtual void setAcceptDrops(bool b); 00104 00105 protected: 00106 KFileIconView *left; 00107 KFileView *right; 00108 00109 protected slots: 00110 void slotSortingChanged( QDir::SortSpec ); 00111 00112 private: 00113 KFileView *focusView( KFileView *preferred ) const; 00114 00115 // in nextItem() and prevItem(), we have to switch views, when the first 00116 // view returns 0L. So we need to remember which view was used in the 00117 // previous call to next/prevItem(). Yes, it's a hack, but it works for 00118 // some cases at least. 00119 mutable KFileView *m_lastViewForNextItem; 00120 mutable KFileView *m_lastViewForPrevItem; 00121 00122 protected: 00123 virtual bool eventFilter( QObject *o, QEvent *e ); 00124 void setDropOptions_impl(int options); 00125 00126 virtual void virtual_hook( int id, void* data ); 00127 private: 00128 class KCombiViewPrivate; 00129 KCombiViewPrivate *d; 00130 00131 }; 00132 00133 #endif