KRename – powerful batch renamer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

krecursivelister.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /***************************************************************************
  2. krecursivelister.h - description
  3. -------------------
  4. begin : Fri Aug 31 2001
  5. copyright : (C) 2001 by Jonathon Sim
  6. email : jonathonsim@iname.com
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. #ifndef KRECURSIVELISTER_H
  17. #define KRECURSIVELISTER_H
  18. #include <tqwidget.h>
  19. #include <tqobject.h>
  20. #include <kdirlister.h>
  21. #include <tdefileitem.h>
  22. #include <tqguardedptr.h>
  23. /**A convienience class that recursively lists a directory
  24. *@author Jonathon Sim
  25. *
  26. * Modified by Dominik Seichter to support a name filter,
  27. * dir only mode, support for showing hidden files on demand
  28. * and support for listing directories along with files.
  29. */
  30. class KRecursiveLister : public TQObject {
  31. Q_OBJECT
  32. public:
  33. KRecursiveLister(TQObject *parent=0, const char *name=0);
  34. ~KRecursiveLister();
  35. /** Returns the list of fileitems found. */
  36. const KFileItemList & items();
  37. /** sets wether hidden files shall be listed */
  38. inline void setShowingDotFiles( bool dotfiles );
  39. /** filter to be used */
  40. inline void setNameFilter( const TQString & filter );
  41. /** list only directories */
  42. inline void setDirOnlyMode( bool dirsOnly );
  43. /** Starts listing the specified url */
  44. void openURL(const KURL& url);
  45. /** Stops the listing */
  46. void stop();
  47. /** Returns the subdirectories found by the listing */
  48. const KFileItemList& dirs();
  49. void cleanUp();
  50. signals: // Signals
  51. /** Listing is complete */
  52. void completed();
  53. protected slots: // Protected slots
  54. /** handles completion of a listing. */
  55. void slotListingComplete();
  56. void listNextDirectory();
  57. protected: // Protected methods
  58. /** Starts listing the specified url */
  59. void startListing(const KURL& url);
  60. //Protected variables
  61. KFileItemList filelist; //Files found at url
  62. KFileItemList dirlist; //Dirs remaining to list
  63. KFileItemList dirtree;
  64. KFileItemList allItems;
  65. TQGuardedPtr<KDirLister> lister; //The current KDirLister
  66. bool m_hidden;
  67. bool m_dirs;
  68. TQString m_filter;
  69. };
  70. void KRecursiveLister::setShowingDotFiles( bool dotfiles )
  71. {
  72. m_hidden = dotfiles;
  73. }
  74. void KRecursiveLister::setNameFilter( const TQString & filter )
  75. {
  76. m_filter = filter;
  77. }
  78. void KRecursiveLister::setDirOnlyMode( bool dirsOnly )
  79. {
  80. m_dirs = dirsOnly;
  81. }
  82. #endif