X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a5cf21ff06aff44cde563eaceae3c6cef452ee48..681d8bb6c:/src/views/renamedialog.h diff --git a/src/views/renamedialog.h b/src/views/renamedialog.h index eca5f4d06..08571cd9d 100644 --- a/src/views/renamedialog.h +++ b/src/views/renamedialog.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) * + * Copyright (C) 2006-2010 by Peter Penz (peter.penz@gmx.at) * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -16,83 +16,55 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ + #ifndef RENAMEDIALOG_H #define RENAMEDIALOG_H -#include "libdolphin_export.h" - -#include -#include +#include "dolphin_export.h" -class KFileItem; -class KFileItemList; -class KLineEdit; +#include +#include #include +class QLineEdit; +class QSpinBox; +class QPushButton; +class KJob; /** * @brief Dialog for renaming a variable number of files. * - * The renaming is not done by the dialog, the invoker - * must do this itself: - * \code - * RenameDialog dialog(...); - * if (dialog.exec() == QDialog::Accepted) { - * const QString& newName = dialog.newName(); - * if (newName.isEmpty()) { - * // an invalid name has been chosen, use - * // dialog.errorString() to tell the user about this - * } - * else { - * // rename items corresponding to the new name - * } - * } - * \endcode + * 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(); + explicit RenameDialog(QWidget* parent, const KFileItemList& items); + ~RenameDialog() override; - /** - * Returns the new name of the items. If more than one - * item should be renamed, then it is assured that the # character - * is part of the returned string. If the returned string is empty, - * then RenameDialog::errorString() should be used to show the reason - * of having an empty string (e. g. if the # character has - * been deleted by the user, although more than one item should be - * renamed). - */ - QString newName() const; +signals: + void renamingFinished(const QList& urls); - /** - * Returns the error string, if Dialog::newName() returned an empty string. - */ - QString errorString() const; +private slots: + void slotAccepted(); + void slotTextChanged(const QString& newName); + void slotFileRenamed(const QUrl& oldUrl, const QUrl& newUrl); + void slotResult(KJob* job); -protected slots: - virtual void slotButtonClicked(int button); +protected: + void showEvent(QShowEvent* event) override; private: bool m_renameOneItem; - KLineEdit* m_lineEdit; + QList m_renamedItems; QString m_newName; - QString m_errorString; - - friend class RenameDialogTest; // allow access for unit testing + QLineEdit* m_lineEdit; + KFileItemList m_items; + bool m_allExtensionsDifferent; + QSpinBox* m_spinBox; + QPushButton* m_okButton; }; -inline QString RenameDialog::newName() const -{ - return m_newName; -} - -inline QString RenameDialog::errorString() const -{ - return m_errorString; -} - #endif