┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Fuchs <[email protected]>2010-09-20 21:04:48 +0000
committerMatthias Fuchs <[email protected]>2010-09-20 21:04:48 +0000
commitb51083c12b6459ca6c33f022881ece4e83fcedc2 (patch)
tree365f31f7ef777c603f23f087200665c663648653
parentc7e8c4af3dbcec9973a161c319fcd63fd1086f23 (diff)
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
-rw-r--r--src/views/renamedialog.cpp9
-rw-r--r--src/views/renamedialog.h3
2 files changed, 12 insertions, 0 deletions
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;