1/*
2 * Copyright (C) 2001, 2006 Holger Freyther <freyther@kde.org>
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef KIO_RENAMEDIALOGPLUGIN_H
27#define KIO_RENAMEDIALOGPLUGIN_H
28
29#include <kio/renamedialog.h>
30#include <QtGui/QDialog>
31#include <sys/types.h>
32#include <QtCore/QString>
33#include <QtCore/QStringList>
34
35
36namespace KIO {
37
38/**
39 * @short Base class for RenameDialog plugins.
40 *
41 * Creating your own RenameDialog Plugin allows you to
42 * have a different representation of data depending
43 * on the to be copied files.
44 */
45class KIO_EXPORT RenameDialogPlugin : public QWidget {
46 Q_OBJECT
47public:
48
49 /**
50 * File Representation consisting of the KUrl, MimeType and filesize and
51 * the times of the last changes.
52 */
53 class KIO_EXPORT FileItem {
54 public:
55 FileItem( const KUrl& url, const QString& mimeSrc, KIO::filesize_t, time_t ctime, time_t mtime);
56 ~FileItem();
57
58 KUrl url() const;
59 QString mimeType() const;
60 KIO::filesize_t fileSize() const;
61 time_t cTime() const;
62 time_t mTime() const;
63
64 private:
65 class FileItemPrivate;
66 FileItemPrivate * const d;
67 };
68
69 /**
70 * The Rename Dialog will be embedded into a QDialog.
71 */
72 RenameDialogPlugin(QDialog *dialog);
73
74 /**
75 * This function will be invoked by the KIO::RenameDialog to check if you to handle
76 * the src and destination file.
77 *
78 * @param mode The actual mode of the Rename Dialog
79 * @param srcFile The FileItem representation of the source file
80 * @param dstFile The FileItem representation of the destination file
81 *
82 * @return Return TRUE if you want to handle/display a resolution
83 * @see handle
84 */
85 virtual bool wantToHandle( RenameDialog_Mode mode, const FileItem& srcFile, const FileItem& dstFile) const = 0;
86
87 /**
88 * Present the data of @param srcFile and @param dstFile the way you want to.
89 * You will be embedded into the parentWidget().
90 *
91 * @param mode The actual mode of the Rename Dialog
92 * @param srcFile The FileItem of the source
93 * @param dstFile The FileItem of the destination
94 */
95 virtual void handle( KIO::RenameDialog_Mode mode, const FileItem& srcFile, const FileItem& dstFile ) = 0;
96};
97
98}
99
100#endif
101
102