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.

fileplugin.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /***************************************************************************
  2. fileplugin.h - description
  3. -------------------
  4. begin : Mon Jul 1 2002
  5. copyright : (C) 2002 by Dominik Seichter
  6. email : domseichter@web.de
  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 FILEPLUGIN_H
  17. #define FILEPLUGIN_H
  18. #include "batchrenamer.h"
  19. #include "pluginloader.h"
  20. #include "plugin.h"
  21. #include "helpdialog.h"
  22. #include <kmimetype.h>
  23. /*
  24. * number of items we shall cache from file plugins
  25. */
  26. #define CACHE_MAX 2000
  27. class KFileMetaInfoProvider;
  28. class KFileMimeTypeInfo;
  29. class KPushButton;
  30. class KService;
  31. class TQLabel;
  32. class TQWidget;
  33. class TQVBoxLayout;
  34. class KFilePlugin;
  35. class FilePlugin : public Plugin {
  36. Q_OBJECT
  37. public:
  38. FilePlugin( KService* service );
  39. ~FilePlugin();
  40. inline bool isValid() const;
  41. virtual const TQString getName() const;
  42. virtual const TQString getAccelName() const;
  43. virtual const TQString getPattern() const;
  44. virtual const int type() const;
  45. virtual bool checkError();
  46. virtual void drawInterface( TQWidget* w, TQVBoxLayout* l );
  47. virtual TQString processFile( BatchRenamer* b, int i, TQString token, int mode );
  48. virtual void addHelp( HelpDialogData* data );
  49. virtual const TQPixmap getIcon() const;
  50. virtual bool alwaysUsed() const { return true; }
  51. virtual const TQStringList getKeys() const { return keys; }
  52. virtual void clearCache();
  53. private:
  54. void setPattern( KMimeType::Ptr mime );
  55. protected:
  56. bool supports( const TQString & token );
  57. void setupKeys();
  58. TQMap<TQString,TQString> cache;
  59. KFilePlugin* fileplugin;
  60. TQString m_name, m_comment, m_icon, m_mimetype, m_pattern;
  61. TQStringList keys;
  62. };
  63. bool FilePlugin::isValid() const
  64. {
  65. return keys.count() > 0 && fileplugin ? true : false;
  66. }
  67. #endif