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