]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Rename dialog: Set focus to input text box on dialog show event.
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Sun, 6 Sep 2015 14:34:41 +0000 (16:34 +0200)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Mon, 7 Sep 2015 20:58:38 +0000 (22:58 +0200)
BUG: 351708
FIXED-IN: 15.08.1
REVIEW: 125078

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

index be9e34c4a138ce2d8db31008f949b019df981bfb..60b7b16c1f2e8d18049fb3eb7f8691a4a9a05514 100644 (file)
@@ -108,7 +108,6 @@ RenameDialog::RenameDialog(QWidget *parent, const KFileItemList& items) :
 
     m_lineEdit->setText(m_newName);
     m_lineEdit->setSelection(0, selectionLength);
-    m_lineEdit->setFocus();
 
     topLayout->addWidget(editLabel);
     topLayout->addWidget(m_lineEdit);
@@ -197,6 +196,13 @@ void RenameDialog::slotTextChanged(const QString& newName)
     m_okButton->setEnabled(enable);
 }
 
+void RenameDialog::showEvent(QShowEvent* event)
+{
+    m_lineEdit->setFocus();
+
+    QDialog::showEvent(event);
+}
+
 void RenameDialog::renameItems()
 {
     // Iterate through all items and rename them...
index a1953e8b35e6afdb7379586493f76ea854b0a71a..3964c0a5c4fe05e14db941dedb22131f60189118 100644 (file)
@@ -45,6 +45,9 @@ private slots:
     void slotAccepted();
     void slotTextChanged(const QString& newName);
 
+protected:
+    void showEvent(QShowEvent* event) override;
+
 private:
     void renameItems();
     void renameItem(const KFileItem &item, const QString& newName);