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.

88 lines
2.7KB

  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. TQ_OBJECT
  38. public:
  39. FilePlugin( KService* service );
  40. ~FilePlugin();
  41. inline bool isValid() const;
  42. virtual const TQString getName() const;
  43. virtual const TQString getAccelName() const;
  44. virtual const TQString getPattern() const;
  45. virtual const int type() const;
  46. virtual bool checkError();
  47. virtual void drawInterface( TQWidget* w, TQVBoxLayout* l );
  48. virtual TQString processFile( BatchRenamer* b, int i, TQString token, int mode );
  49. virtual void addHelp( HelpDialogData* data );
  50. virtual const TQPixmap getIcon() const;
  51. virtual bool alwaysUsed() const { return true; }
  52. virtual const TQStringList getKeys() const { return keys; }
  53. virtual void clearCache();
  54. private:
  55. void setPattern( KMimeType::Ptr mime );
  56. protected:
  57. bool supports( const TQString & token );
  58. void setupKeys();
  59. TQMap<TQString,TQString> cache;
  60. KFilePlugin* fileplugin;
  61. TQString m_name, m_comment, m_icon, m_mimetype, m_pattern;
  62. TQStringList keys;
  63. };
  64. bool FilePlugin::isValid() const
  65. {
  66. return keys.count() > 0 && fileplugin ? true : false;
  67. }
  68. #endif