]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Disables the rename button if no name or an identical name has been specified.
authorMatthias Fuchs <mat69@gmx.net>
Mon, 20 Sep 2010 21:04:48 +0000 (21:04 +0000)
committerMatthias Fuchs <mat69@gmx.net>
Mon, 20 Sep 2010 21:04:48 +0000 (21:04 +0000)
Checks for '#' in the case of renaming multiple files.

svn path=/trunk/KDE/kdebase/apps/; revision=1177675

src/views/renamedialog.cpp
src/views/renamedialog.h

index 39e61c4640f8fc3d4a26059d2f16c4ac5ce3732e..f35528074e475b0aedc18d5a9cdc21bab42816f7 100644 (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"
index eca5f4d06883f727a386373d9b37fe39136c34aa..5015b51bd2bae8d82434ca2e53f83d9a8b162433 100644 (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;