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., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef __konqdirpart_h 00021 #define __konqdirpart_h 00022 00023 #include <tqstring.h> 00024 #include <tdeparts/part.h> 00025 #include <tdeparts/browserextension.h> 00026 #include <tdefileitem.h> 00027 #include <kdatastream.h> 00028 #include <tdeio/global.h> 00029 #include <libkonq_export.h> 00030 00031 class KDirLister; 00032 namespace KParts { class BrowserExtension; } 00033 class KonqPropsView; 00034 class TQScrollView; 00035 class TDEAction; 00036 class TDEToggleAction; 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( TQObject *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 TQScrollView * scrollWidget(); 00066 00067 virtual void saveState( TQDataStream &stream ); 00068 virtual void restoreState( TQDataStream &stream ); 00069 00073 void lmbClicked( KFileItem * fileItem ); 00074 00077 void mmbClicked( KFileItem * fileItem ); 00078 00079 void setNameFilter( const TQString & nameFilter ) { m_nameFilter = nameFilter; } 00080 00081 TQString nameFilter() const { return m_nameFilter; } 00082 00083 void setFilesToSelect( const TQStringList & filesToSelect ) { m_filesToSelect = filesToSelect; } 00084 00099 void setMimeFilter (const TQStringList& filters); 00100 00105 TQStringList 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 refreshItems(const KFileItemList &entries); 00135 00139 void emitTotalCount(); 00140 00141 // ##### TODO KDE 4: remove! 00150 void emitCounts( const KFileItemList & lst, bool selectionChanged ); 00151 00159 void emitCounts( const KFileItemList & lst ); 00160 00161 void emitMouseOver( const KFileItem * item ); 00162 00168 void updatePasteAction(); 00169 00175 virtual void newIconSize( int size ); 00176 00181 void setIconSize( int size ); 00182 00186 void setFindPart( KParts::ReadOnlyPart * part ); 00187 00188 KParts::ReadOnlyPart * findPart() const { return m_findPart; } 00189 00190 virtual const KFileItem * currentItem() = 0; // { return 0L; } 00191 00192 virtual KFileItemList selectedFileItems() { return KFileItemList(); } 00193 00198 bool closeURL (); 00199 00200 signals: 00201 00205 void aboutToOpenURL(); 00206 00211 void findOpen( KonqDirPart * ); 00212 00217 void findOpened( KonqDirPart * ); 00218 00222 void findClosed( KonqDirPart * ); 00223 00228 void itemsAdded(const KFileItemList &); 00229 00234 void itemRemoved(const KFileItem *); 00235 00240 void itemsRefresh(const KFileItemList &); 00241 00246 void itemsFilteredByMime( const KFileItemList& ); 00247 00248 public slots: 00249 00254 bool openURL (const KURL&); 00255 00261 void slotFindClosed(); 00262 00266 void slotStartAnimationSearching(); 00267 00271 void slotStopAnimationSearching(); 00272 00273 void slotBackgroundSettings(); 00274 00279 void slotClipboardDataChanged(); 00280 00281 void slotIncIconSize(); 00282 void slotDecIconSize(); 00283 00284 void slotIconSizeToggled( bool ); 00285 00286 // slots connected to the directory lister - or to the kfind interface 00287 virtual void slotStarted() = 0; 00288 virtual void slotCanceled() = 0; 00289 virtual void slotCompleted() = 0; 00290 virtual void slotNewItems( const KFileItemList& ) = 0; 00291 virtual void slotDeleteItem( KFileItem * ) = 0; 00292 virtual void slotRefreshItems( const KFileItemList& ) = 0; 00293 virtual void slotClear() = 0; 00294 virtual void slotRedirection( const KURL & ) = 0; 00295 00296 private slots: 00297 void slotIconChanged(int group); 00298 protected: 00303 virtual bool doOpenURL( const KURL& ) = 0; 00304 virtual bool doCloseURL () = 0; 00305 00306 protected: 00307 00308 TQString m_nameFilter; 00309 TQStringList m_filesToSelect; 00310 00311 KonqPropsView * m_pProps; 00312 00313 TDEAction *m_paIncIconSize; 00314 TDEAction *m_paDecIconSize; 00315 TDEToggleAction *m_paDefaultIcons; 00316 TDEToggleAction *m_paHugeIcons; 00317 TDEToggleAction *m_paLargeIcons; 00318 TDEToggleAction *m_paMediumIcons; 00319 TDEToggleAction *m_paSmallIcons; 00320 00321 KParts::ReadOnlyPart * m_findPart; 00322 KonqDirPartBrowserExtension * m_extension; 00323 00324 // Remove all those in KDE4 00325 int m_iIconSize[5]; 00326 TDEIO::filesize_t m_lDirSize; 00327 uint m_lFileCount; 00328 uint m_lDirCount; 00329 00330 private: 00331 void saveFindState( TQDataStream& ); 00332 void restoreFindState( TQDataStream& ); 00333 00334 void adjustIconSizes(); 00335 00336 class KonqDirPartPrivate; 00337 KonqDirPartPrivate* d; 00338 }; 00339 00340 class LIBKONQ_EXPORT KonqDirPartBrowserExtension : public KParts::BrowserExtension 00341 { 00342 public: 00343 KonqDirPartBrowserExtension( KonqDirPart* dirPart ) 00344 : KParts::BrowserExtension( dirPart ) 00345 , m_dirPart( dirPart ) 00346 {} 00347 00355 virtual void saveState( TQDataStream &stream ); 00356 virtual void restoreState( TQDataStream &stream ); 00357 00358 private: 00359 KonqDirPart* m_dirPart; 00360 }; 00361 00362 #endif