From: Matthias Fuchs Date: Mon, 20 Sep 2010 21:04:48 +0000 (+0000) Subject: Disables the rename button if no name or an identical name has been specified. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/b51083c12b6459ca6c33f022881ece4e83fcedc2 Disables the rename button if no name or an identical name has been specified. Checks for '#' in the case of renaming multiple files. svn path=/trunk/KDE/kdebase/apps/; revision=1177675 --- diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp index 39e61c464..f35528074 100644 --- a/src/views/renamedialog.cpp +++ b/src/views/renamedialog.cpp @@ -64,6 +64,7 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) : } m_lineEdit = new KLineEdit(page); + connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotTextChanged(QString))); QString fileName = items[0].url().prettyUrl(); QString extension = KMimeType::extractKnownExtension(fileName.toLower()); @@ -129,4 +130,12 @@ void RenameDialog::slotButtonClicked(int button) KDialog::slotButtonClicked(button); } +void RenameDialog::slotTextChanged(const QString &newName) +{ + bool enable = !newName.isEmpty(); + enable &= (m_renameOneItem ? (newName != m_newName) : newName.contains('#')); + enableButtonOk(enable); +} + + #include "renamedialog.moc" diff --git a/src/views/renamedialog.h b/src/views/renamedialog.h index eca5f4d06..5015b51bd 100644 --- a/src/views/renamedialog.h +++ b/src/views/renamedialog.h @@ -76,6 +76,9 @@ public: protected slots: virtual void slotButtonClicked(int button); +private slots: + void slotTextChanged(const QString &newName); + private: bool m_renameOneItem; KLineEdit* m_lineEdit;