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
This commit is contained in:
Matthias Fuchs 2010-09-20 21:04:48 +00:00
parent c7e8c4af3d
commit b51083c12b
2 changed files with 12 additions and 0 deletions

View file

@ -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"

View file

@ -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;