]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/renamedialog.h
Merge branch 'Applications/19.08'
[dolphin.git] / src / views / renamedialog.h
index 29ef8bdf131f7608bb87437679ac8811e5669c71..08571cd9d2ce57732dbbed626c7b952cacb521ad 100644 (file)
 #ifndef RENAMEDIALOG_H
 #define RENAMEDIALOG_H
 
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
 
-#include <KDialog>
 #include <KFileItem>
 
-class KLineEdit;
-class KIntSpinBox;
-
+#include <QDialog>
 #include <QString>
 
+class QLineEdit;
+class QSpinBox;
+class QPushButton;
+class KJob;
 /**
  * @brief Dialog for renaming a variable number of files.
+ *
+ * The dialog deletes itself when accepted or rejected.
  */
-class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public KDialog
+class DOLPHIN_EXPORT RenameDialog : public QDialog
 {
     Q_OBJECT
 
 public:
     explicit RenameDialog(QWidget* parent, const KFileItemList& items);
-    virtual ~RenameDialog();
+    ~RenameDialog() override;
 
-protected slots:
-    virtual void slotButtonClicked(int button);
+signals:
+    void renamingFinished(const QList<QUrl>& urls);
 
 private slots:
+    void slotAccepted();
     void slotTextChanged(const QString& newName);
+    void slotFileRenamed(const QUrl& oldUrl, const QUrl& newUrl);
+    void slotResult(KJob* job);
 
-private:
-    void renameItems();
-
-    /**
-     * @return Returns the string \p name, where the characters represented by
-     *         \p indexPlaceHolder get replaced by the index \p index.
-     *         E. g. Calling indexedName("Test #.jpg", 12, '#') returns "Test 12.jpg".
-     *         A connected sequence of placeholders results in leading zeros:
-     *         indexedName("Test ####.jpg", 12, '#') returns "Test 0012.jpg".
-     */
-    static QString indexedName(const QString& name, int index, const QChar& indexPlaceHolder);
+protected:
+    void showEvent(QShowEvent* event) override;
 
 private:
     bool m_renameOneItem;
+    QList<QUrl> m_renamedItems;
     QString m_newName;
-    KLineEdit* m_lineEdit;
+    QLineEdit* m_lineEdit;
     KFileItemList m_items;
     bool m_allExtensionsDifferent;
-    KIntSpinBox* m_spinBox;
+    QSpinBox* m_spinBox;
+    QPushButton* m_okButton;
 };
 
 #endif