TDE core libraries
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.

paste.h 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* This file is part of the KDE libraries
  2. Copyright (C) 2000-2005 David Faure <faure@kde.org>
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public
  5. License version 2 as published by the Free Software Foundation.
  6. This library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Library General Public License for more details.
  10. You should have received a copy of the GNU Library General Public License
  11. along with this library; see the file COPYING.LIB. If not, write to
  12. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  13. Boston, MA 02110-1301, USA.
  14. */
  15. #ifndef __tdeio_paste_h__
  16. #define __tdeio_paste_h__
  17. #include <tqstring.h>
  18. #include <tqmemarray.h>
  19. #include <kurl.h>
  20. class TQWidget;
  21. class TQMimeSource;
  22. // KDE4 TODO pass a parent widget to all methods that will display a message box
  23. namespace TDEIO {
  24. class Job;
  25. class CopyJob;
  26. /**
  27. * Pastes the content of the clipboard to the given destination URL.
  28. * URLs are treated separately (performing a file copy)
  29. * from other data (which is saved into a file after asking the user
  30. * to choose a filename and the preferred data format)
  31. *
  32. * @param destURL the URL to receive the data
  33. * @param move true to move the data, false to copy
  34. * @return the job that handles the operation
  35. * @see pasteData()
  36. */
  37. TDEIO_EXPORT Job *pasteClipboard( const KURL& destURL, bool move = false );
  38. /**
  39. * Pastes the given @p data to the given destination URL.
  40. * NOTE: This method is blocking (uses NetAccess for saving the data).
  41. * Please consider using pasteDataAsync instead.
  42. *
  43. * @param destURL the URL of the directory where the data will be pasted.
  44. * The filename to use in that directory is prompted by this method.
  45. * @param data the data to copy
  46. * @see pasteClipboard()
  47. */
  48. TDEIO_EXPORT void pasteData( const KURL& destURL, const TQByteArray& data );
  49. /**
  50. * Pastes the given @p data to the given destination URL.
  51. * Note that this method requires the caller to have chosen the QByteArray
  52. * to paste before hand, unlike pasteClipboard and pasteMimeSource.
  53. *
  54. * @param destURL the URL of the directory where the data will be pasted.
  55. * The filename to use in that directory is prompted by this method.
  56. * @param data the data to copy
  57. * @see pasteClipboard()
  58. */
  59. TDEIO_EXPORT CopyJob *pasteDataAsync( const KURL& destURL, const TQByteArray& data );
  60. /**
  61. * Pastes the given @p data to the given destination URL.
  62. * Note that this method requires the caller to have chosen the QByteArray
  63. * to paste before hand, unlike pasteClipboard and pasteMimeSource.
  64. *
  65. * @param destURL the URL of the directory where the data will be pasted.
  66. * The filename to use in that directory is prompted by this method.
  67. * @param data the data to copy
  68. * @param dialogText the text to show in the dialog
  69. * @see pasteClipboard()
  70. */
  71. TDEIO_EXPORT CopyJob *pasteDataAsync( const KURL& destURL, const TQByteArray& data, const TQString& dialogText ); // KDE4: merge with above
  72. /**
  73. * Save the given mimesource @p data to the given destination URL
  74. * after offering the user to choose a data format.
  75. * This is the method used when handling drops (of anything else than URLs)
  76. * onto kdesktop and konqueror.
  77. *
  78. * @param data the TQMimeSource (e.g. a TQDropEvent)
  79. * @param destURL the URL of the directory where the data will be pasted.
  80. * The filename to use in that directory is prompted by this method.
  81. * @param dialogText the text to show in the dialog
  82. * @param widget parent widget to use for dialogs
  83. * @param clipboard whether the TQMimeSource comes from TQClipboard. If you
  84. * use pasteClipboard for that case, you never have to worry about this parameter.
  85. *
  86. * @see pasteClipboard()
  87. *
  88. * @since 3.5
  89. */
  90. TDEIO_EXPORT CopyJob* pasteMimeSource( TQMimeSource* data, const KURL& destURL,
  91. const TQString& dialogText, TQWidget* widget,
  92. bool clipboard = false );
  93. /**
  94. * Checks whether the clipboard contains any URLs.
  95. * @return true if not
  96. * Not used anymore, wrong method name, so it will disappear in KDE4.
  97. */
  98. TDEIO_EXPORT_DEPRECATED bool isClipboardEmpty();
  99. /**
  100. * Returns the text to use for the Paste action, when the application supports
  101. * pasting files, urls, and clipboard data, using pasteClipboard().
  102. * @return a string suitable for KAction::setText, or an empty string if pasting
  103. * isn't possible right now.
  104. *
  105. * @since 3.5
  106. */
  107. TDEIO_EXPORT TQString pasteActionText();
  108. }
  109. #endif