File indexing completed on 2024-11-03 09:57:03

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2006-2010 Peter Penz <peter.penz@gmx.at>
0004     SPDX-FileCopyrightText: 2020 Méven Car <meven.car@kdemail.net>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef RENAMEFILEDIALOG_H
0010 #define RENAMEFILEDIALOG_H
0011 
0012 #include <KFileItem>
0013 
0014 #include "kiowidgets_export.h"
0015 
0016 #include <QDialog>
0017 #include <QString>
0018 
0019 class QLineEdit;
0020 class QSpinBox;
0021 class QPushButton;
0022 class KJob;
0023 
0024 namespace KIO
0025 {
0026 class RenameFileDialogPrivate;
0027 
0028 /**
0029  * @class KIO::RenameFileDialog renamefiledialog.h <KIO/RenameFileDialog>
0030  *
0031  * @brief Dialog for renaming a variable number of files.
0032  *
0033  * The dialog deletes itself when accepted or rejected.
0034  *
0035  * @since 5.67
0036  */
0037 // TODO KF6  : rename the class RenameFileDialog to RenameDialog and the class RenameDialog to RenameFileOverwrittenDialog or similar.
0038 class KIOWIDGETS_EXPORT RenameFileDialog : public QDialog
0039 {
0040     Q_OBJECT
0041 
0042 public:
0043     /**
0044      * Constructs the Dialog to rename file(s)
0045      *
0046      * @param parent the parent QWidget
0047      * @param items a non-empty list of items to rename
0048      */
0049     explicit RenameFileDialog(const KFileItemList &items, QWidget *parent);
0050     ~RenameFileDialog() override;
0051 
0052 Q_SIGNALS:
0053     void renamingFinished(const QList<QUrl> &urls);
0054     void error(KJob *error);
0055 
0056 private Q_SLOTS:
0057     KIOWIDGETS_NO_EXPORT void slotAccepted();
0058     KIOWIDGETS_NO_EXPORT void slotTextChanged(const QString &newName);
0059     KIOWIDGETS_NO_EXPORT void slotFileRenamed(const QUrl &oldUrl, const QUrl &newUrl);
0060     KIOWIDGETS_NO_EXPORT void slotResult(KJob *job);
0061 
0062 private:
0063     class RenameFileDialogPrivate;
0064     RenameFileDialogPrivate *const d;
0065 };
0066 } // namespace KIO
0067 
0068 #endif