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 #include <kio/global.h>
00029 #include <libkonq_export.h>
00030 
00031 class KDirLister;
00032 namespace KParts { class BrowserExtension; }
00033 class KonqPropsView;
00034 class QScrollView;
00035 class KAction;
00036 class KToggleAction;
00037 class KonqDirPartBrowserExtension;
00038 
00039 class LIBKONQ_EXPORT KonqDirPart: public KParts::ReadOnlyPart
00040 {
00041     Q_OBJECT
00042 
00043     friend class KonqDirPartBrowserExtension;
00044 
00045 public:
00046     KonqDirPart( QObject *parent, const char *name );
00047 
00048     virtual ~KonqDirPart();
00049 
00053     void setBrowserExtension( KonqDirPartBrowserExtension * extension )
00054       { m_extension = extension; }
00055 
00056     KonqDirPartBrowserExtension * extension()
00057       { return m_extension; }
00058 
00062     void setDirLister( KDirLister* lister );
00063     // TODO KDE4 create the KDirLister here and simplify the parts?
00064 
00065     QScrollView * scrollWidget();
00066 
00067     virtual void saveState( QDataStream &stream );
00068     virtual void restoreState( QDataStream &stream );
00069 
00073     void lmbClicked( KFileItem * fileItem );
00074 
00077     void mmbClicked( KFileItem * fileItem );
00078 
00079     void setNameFilter( const QString & nameFilter ) { m_nameFilter = nameFilter; }
00080 
00081     QString nameFilter() const { return m_nameFilter; }
00082 
00083     void setFilesToSelect( const QStringList & filesToSelect ) { m_filesToSelect = filesToSelect; }
00084 
00099     void setMimeFilter (const QStringList& filters);
00100 
00105     QStringList mimeFilter() const;
00106 
00107 
00108     KonqPropsView * props() const { return m_pProps; }
00109 
00113     virtual void disableIcons( const KURL::List & lst ) = 0;
00114 
00119     void resetCount();
00120 
00124     void newItems( const KFileItemList & entries );
00125 
00129     void deleteItem( KFileItem * fileItem );
00130 
00134     void emitTotalCount();
00135 
00141     void emitCounts( const KFileItemList & lst, bool selectionChanged );
00142 
00143     void emitMouseOver( const KFileItem * item );
00144 
00150     void updatePasteAction();
00151 
00157     virtual void newIconSize( int size );
00158 
00163     void setIconSize( int size );
00164 
00168     void setFindPart( KParts::ReadOnlyPart * part );
00169 
00170     KParts::ReadOnlyPart * findPart() const { return m_findPart; }
00171 
00172     virtual const KFileItem * currentItem() = 0; // { return 0L; }
00173 
00174     virtual KFileItemList selectedFileItems() { return KFileItemList(); }
00175 
00180     bool closeURL ();
00181 
00182 signals:
00183 
00187     void aboutToOpenURL();
00188 
00193     void findOpen( KonqDirPart * );
00194 
00199     void findOpened( KonqDirPart * );
00200 
00204     void findClosed( KonqDirPart * );
00205 
00210     void itemsAdded( const KFileItemList& );
00211 
00216     void itemRemoved( const KFileItem* );
00217 
00222     void itemsFilteredByMime( const KFileItemList& );
00223 
00224 public slots:
00225 
00230      bool openURL (const KURL&);
00231 
00237     void slotFindClosed();
00238 
00242     void slotStartAnimationSearching();
00243 
00247     void slotStopAnimationSearching();
00248 
00249     void slotBackgroundSettings();
00250 
00255     void slotClipboardDataChanged();
00256 
00257     void slotIncIconSize();
00258     void slotDecIconSize();
00259 
00260     void slotIconSizeToggled( bool );
00261 
00262     // slots connected to the directory lister - or to the kfind interface
00263     virtual void slotStarted() = 0;
00264     virtual void slotCanceled() = 0;
00265     virtual void slotCompleted() = 0;
00266     virtual void slotNewItems( const KFileItemList& ) = 0;
00267     virtual void slotDeleteItem( KFileItem * ) = 0;
00268     virtual void slotRefreshItems( const KFileItemList& ) = 0;
00269     virtual void slotClear() = 0;
00270     virtual void slotRedirection( const KURL & ) = 0;
00271 
00272 private slots:
00273     void slotIconChanged(int group);
00274 protected:
00279     virtual bool doOpenURL( const KURL& ) = 0;
00280     virtual bool doCloseURL () = 0;
00281 
00282 protected:
00283 
00284     QString m_nameFilter;
00285     QStringList m_filesToSelect;
00286 
00287     KonqPropsView * m_pProps;
00288 
00289     KAction *m_paIncIconSize;
00290     KAction *m_paDecIconSize;
00291     KToggleAction *m_paDefaultIcons;
00292     KToggleAction *m_paHugeIcons;
00293     KToggleAction *m_paLargeIcons;
00294     KToggleAction *m_paMediumIcons;
00295     KToggleAction *m_paSmallIcons;
00296 
00297     KParts::ReadOnlyPart * m_findPart;
00298     KonqDirPartBrowserExtension * m_extension;
00299 
00300     // Remove all those in KDE4
00301     int m_iIconSize[5];
00302     KIO::filesize_t m_lDirSize;
00303     uint m_lFileCount;
00304     uint m_lDirCount;
00305 
00306 private:
00307     void saveFindState( QDataStream& );
00308     void restoreFindState( QDataStream& );
00309 
00310     void adjustIconSizes();
00311 
00312     class KonqDirPartPrivate;
00313     KonqDirPartPrivate* d;
00314 };
00315 
00316 class LIBKONQ_EXPORT KonqDirPartBrowserExtension : public KParts::BrowserExtension
00317 {
00318 public:
00319     KonqDirPartBrowserExtension( KonqDirPart* dirPart )
00320         : KParts::BrowserExtension( dirPart )
00321         , m_dirPart( dirPart )
00322     {}
00323 
00331     virtual void saveState( QDataStream &stream );
00332     virtual void restoreState( QDataStream &stream );
00333 
00334 private:
00335     KonqDirPart* m_dirPart;
00336 };
00337 
00338 #endif
KDE Logo
This file is part of the documentation for libkonq Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 5 03:59:19 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003