KIO

renamedialog.h
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
4 SPDX-FileCopyrightText: 1999-2008 David Faure <faure@kde.org>
5 SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#ifndef KIO_RENAMEDIALOG_H
11#define KIO_RENAMEDIALOG_H
12
13#include <QDateTime>
14#include <QDialog>
15#include <QString>
16#include <kio/jobuidelegateextension.h>
17
18#include "kiowidgets_export.h"
19#include <kio/global.h>
20
21#include <memory>
22
23class QScrollArea;
24class QLabel;
25class QPixmap;
26class KFileItem;
28
29namespace KIO
30{
31/**
32 * @class KIO::RenameDialog renamedialog.h <KIO/RenameDialog>
33 *
34 * The dialog shown when a CopyJob realizes that a destination file already exists,
35 * and wants to offer the user with the choice to either Rename, Overwrite, Skip;
36 * this dialog is also used when a .part file exists and the user can choose to
37 * Resume a previous download.
38 */
39class KIOWIDGETS_EXPORT RenameDialog : public QDialog
40{
41 Q_OBJECT
42public:
43 /**
44 * Construct a "rename" dialog to let the user know that @p src is about to overwrite @p dest.
45 *
46 * @param parent parent widget (often 0)
47 * @param title the title for the dialog box
48 * @param src the url to the file/dir we're trying to copy, as it's part of the text message
49 * @param dest the path to destination file/dir, i.e. the one that already exists
50 * @param options parameters for the dialog (which buttons to show...),
51 * @param sizeSrc size of source file
52 * @param sizeDest size of destination file
53 * @param ctimeSrc creation time of source file
54 * @param ctimeDest creation time of destination file
55 * @param mtimeSrc modification time of source file
56 * @param mtimeDest modification time of destination file
57 */
58 RenameDialog(QWidget *parent,
59 const QString &title,
60 const QUrl &src,
61 const QUrl &dest,
63 KIO::filesize_t sizeSrc = KIO::filesize_t(-1),
64 KIO::filesize_t sizeDest = KIO::filesize_t(-1),
65 const QDateTime &ctimeSrc = QDateTime(),
66 const QDateTime &ctimeDest = QDateTime(),
67 const QDateTime &mtimeSrc = QDateTime(),
68 const QDateTime &mtimeDest = QDateTime());
69 ~RenameDialog() override;
70
71 /**
72 * @return the new destination
73 * valid only if RENAME was chosen
74 */
75 QUrl newDestUrl();
76
77 /**
78 * @return an automatically renamed destination
79 * valid always
80 */
81 QUrl autoDestUrl() const;
82
83public Q_SLOTS:
84 void cancelPressed();
85 void renamePressed();
86 void skipPressed();
87 void overwritePressed();
88 void overwriteAllPressed();
89 void overwriteWhenOlderPressed();
90 void resumePressed();
91 void resumeAllPressed();
92 void suggestNewNamePressed();
93
94protected Q_SLOTS:
95 void enableRenameButton(const QString &);
96private Q_SLOTS:
97 KIOWIDGETS_NO_EXPORT void applyAllPressed();
98 KIOWIDGETS_NO_EXPORT void showSrcIcon(const KFileItem &);
99 KIOWIDGETS_NO_EXPORT void showDestIcon(const KFileItem &);
100 KIOWIDGETS_NO_EXPORT void showSrcPreview(const KFileItem &, const QPixmap &);
101 KIOWIDGETS_NO_EXPORT void showDestPreview(const KFileItem &, const QPixmap &);
102 KIOWIDGETS_NO_EXPORT void resizePanels();
103
104private:
105 KIOWIDGETS_NO_EXPORT QWidget *createContainerWidget(QLabel *preview, QLabel *SizeLabel, QLabel *DateLabel);
106
107 class RenameDialogPrivate;
108 std::unique_ptr<RenameDialogPrivate> const d;
109};
110
111}
112
113#endif
A KFileItem is a generic class to handle a file, local or remote.
Definition kfileitem.h:36
The dialog shown when a CopyJob realizes that a destination file already exists, and wants to offer t...
A namespace for KIO globals.
qulonglong filesize_t
64-bit file size
Definition global.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.