KIO

renamedialog.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2000 Stephan Kulow <[email protected]>
4  SPDX-FileCopyrightText: 1999-2008 David Faure <[email protected]>
5  SPDX-FileCopyrightText: 2001 Holger Freyther <[email protected]>
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 
23 class QScrollArea;
24 class QLabel;
25 class QPixmap;
26 class KFileItem;
27 class KSqueezedTextLabel;
28 
29 namespace 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  */
39 class KIOWIDGETS_EXPORT RenameDialog : public QDialog
40 {
41  Q_OBJECT
42 public:
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,
62  RenameDialog_Options options,
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  * @since 4.5
80  * valid always
81  */
82  QUrl autoDestUrl() const;
83 
84 public Q_SLOTS:
85  void cancelPressed();
86  void renamePressed();
87  void skipPressed();
88  void overwritePressed();
89  void overwriteAllPressed();
90  void overwriteWhenOlderPressed();
91  void resumePressed();
92  void resumeAllPressed();
93  void suggestNewNamePressed();
94 
95 protected Q_SLOTS:
96  void enableRenameButton(const QString &);
97 private Q_SLOTS:
98  KIOWIDGETS_NO_EXPORT void applyAllPressed();
99  KIOWIDGETS_NO_EXPORT void showSrcIcon(const KFileItem &);
100  KIOWIDGETS_NO_EXPORT void showDestIcon(const KFileItem &);
101  KIOWIDGETS_NO_EXPORT void showSrcPreview(const KFileItem &, const QPixmap &);
102  KIOWIDGETS_NO_EXPORT void showDestPreview(const KFileItem &, const QPixmap &);
103  KIOWIDGETS_NO_EXPORT void resizePanels();
104 
105 private:
106  KIOWIDGETS_NO_EXPORT QScrollArea *createContainerLayout(QWidget *parent, const KFileItem &item, QLabel *preview);
107 
108  class RenameDialogPrivate;
109  std::unique_ptr<RenameDialogPrivate> const d;
110 };
111 
112 }
113 
114 #endif
qulonglong filesize_t
64-bit file size
Definition: global.h:39
A namespace for KIO globals.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Jun 9 2023 03:52:44 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.