libkonq Library API Documentation

konq_dirpart.h

00001 /* This file is part of the KDE projects
00002    Copyright (C) 2000 David Faure <faure@kde.org>
00003 
00004    This program is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __konqdirpart_h
00021 #define __konqdirpart_h
00022 
00023 #include <qstring.h>
00024 #include <kparts/part.h>
00025 #include <kparts/browserextension.h>
00026 #include <kfileitem.h>
00027 #include <kdatastream.h>
00028 
00029 namespace KParts { class BrowserExtension; }
00030 class KonqPropsView;
00031 class QScrollView;
00032 class KAction;
00033 class KToggleAction;
00034 class KonqDirPartBrowserExtension;
00035 
00036 class KonqDirPart: public KParts::ReadOnlyPart
00037 {
00038     Q_OBJECT
00039 
00040     friend class KonqDirPartBrowserExtension;
00041 
00042 public:
00043     KonqDirPart( QObject *parent, const char *name );
00044 
00045     virtual ~KonqDirPart();
00046 
00050     void setBrowserExtension( KonqDirPartBrowserExtension * extension )
00051       { m_extension = extension; }
00052 
00053     KonqDirPartBrowserExtension * extension()
00054       { return m_extension; }
00055 
00056     QScrollView * scrollWidget();
00057 
00058     virtual void saveState( QDataStream &stream );
00059     virtual void restoreState( QDataStream &stream );
00060 
00064     void lmbClicked( KFileItem * fileItem );
00065 
00068     void mmbClicked( KFileItem * fileItem );
00069 
00070     void setNameFilter( const QString & nameFilter ) { m_nameFilter = nameFilter; }
00071 
00072     QString nameFilter() const { return m_nameFilter; }
00073 
00088     void setMimeFilter (const QStringList& filters);
00089 
00094     QStringList mimeFilter() const;
00095 
00096 
00097     KonqPropsView * props() const { return m_pProps; }
00098 
00102     virtual void disableIcons( const KURL::List & lst ) = 0;
00103 
00108     void resetCount()
00109     {
00110         m_lDirSize = 0;
00111         m_lFileCount = 0;
00112         m_lDirCount = 0;
00113     }
00114 
00118     void newItems( const KFileItemList & entries );
00119 
00123     void deleteItem( KFileItem * fileItem );
00124 
00128     void emitTotalCount();
00129 
00135     void emitCounts( const KFileItemList & lst, bool selectionChanged );
00136 
00137     void emitMouseOver( const KFileItem * item );
00138 
00144     void updatePasteAction();
00145 
00151     virtual void newIconSize( int size );
00152 
00157     void setIconSize( int size );
00158 
00162     void setFindPart( KParts::ReadOnlyPart * part );
00163 
00164     KParts::ReadOnlyPart * findPart() const { return m_findPart; }
00165 
00166     virtual const KFileItem * currentItem() = 0; // { return 0L; }
00167 
00168     virtual KFileItemList selectedFileItems() { return KFileItemList(); }
00169 
00174     bool closeURL ();
00175 
00176 signals:
00177 
00181     void aboutToOpenURL();
00182 
00187     void findOpen( KonqDirPart * );
00188 
00193     void findOpened( KonqDirPart * );
00194 
00198     void findClosed( KonqDirPart * );
00199 
00204     void itemsAdded( const KFileItemList& );
00205 
00210     void itemRemoved( const KFileItem* );
00211 
00216     void itemsFilteredByMime( const KFileItemList& );
00217 
00218 public slots:
00219 
00224      bool openURL (const KURL&);
00225 
00231     void slotFindClosed();
00232 
00236     void slotStartAnimationSearching();
00237 
00241     void slotStopAnimationSearching();
00242 
00243     void slotBackgroundColor();
00244 
00245     void slotBackgroundImage();
00246 
00251     void slotClipboardDataChanged();
00252 
00253     void slotIncIconSize();
00254     void slotDecIconSize();
00255 
00256     void slotIconSizeToggled( bool );
00257 
00258     // slots connected to the directory lister - or to the kfind interface
00259     virtual void slotStarted() = 0;
00260     virtual void slotCanceled() = 0;
00261     virtual void slotCompleted() = 0;
00262     virtual void slotNewItems( const KFileItemList& ) = 0;
00263     virtual void slotDeleteItem( KFileItem * ) = 0;
00264     virtual void slotRefreshItems( const KFileItemList& ) = 0;
00265     virtual void slotClear() = 0;
00266     virtual void slotRedirection( const KURL & ) = 0;
00267 
00268 protected:
00273     virtual bool doOpenURL( const KURL& ) = 0;
00274     virtual bool doCloseURL () = 0;
00275 
00276 protected:
00277 
00278     QString m_nameFilter;
00279 
00280     KonqPropsView * m_pProps;
00281 
00282     KAction *m_paIncIconSize;
00283     KAction *m_paDecIconSize;
00284     KToggleAction *m_paDefaultIcons;
00285     KToggleAction *m_paHugeIcons;
00286     KToggleAction *m_paLargeIcons;
00287     KToggleAction *m_paMediumIcons;
00288     KToggleAction *m_paSmallIcons;
00289 
00290     KParts::ReadOnlyPart * m_findPart;
00291     KonqDirPartBrowserExtension * m_extension;
00292 
00293     int m_iIconSize[5];
00294 
00295     long long m_lDirSize;
00296     uint m_lFileCount;
00297     uint m_lDirCount;
00298     //bool m_bMultipleItemsSelected;
00299 
00300 private:
00301     void saveFindState( QDataStream& );
00302     void restoreFindState( QDataStream& );
00303 
00304     class KonqDirPartPrivate;
00305     KonqDirPartPrivate* d;
00306 };
00307 
00308 class KonqDirPartBrowserExtension : public KParts::BrowserExtension
00309 {
00310 public:
00311     KonqDirPartBrowserExtension( KonqDirPart* dirPart )
00312         : KParts::BrowserExtension( dirPart )
00313         , m_dirPart( dirPart )
00314     {}
00315 
00323     virtual void saveState( QDataStream &stream );
00324     virtual void restoreState( QDataStream &stream );
00325 
00326 private:
00327     KonqDirPart* m_dirPart;
00328 };
00329 
00330 #endif
KDE Logo
This file is part of the documentation for libkonq Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 29 21:20:28 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003