Modified more dialogs to use the path picker widgets.

Sun, 29 Nov 2015 14:33:38 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Nov 2015 14:33:38 +0100
changeset 4589
b648ccbdbef9
parent 4586
9221c0c5c66f
child 4590
9fdd473c68fb

Modified more dialogs to use the path picker widgets.

Debugger/StartDialog.py file | annotate | diff | comparison | revisions
E5Gui/E5PathPicker.py file | annotate | diff | comparison | revisions
PyUnit/UnittestDialog.py file | annotate | diff | comparison | revisions
SqlBrowser/SqlConnectionDialog.py file | annotate | diff | comparison | revisions
SqlBrowser/SqlConnectionDialog.ui file | annotate | diff | comparison | revisions
UI/CompareDialog.py file | annotate | diff | comparison | revisions
UI/CompareDialog.ui file | annotate | diff | comparison | revisions
UI/DiffDialog.py file | annotate | diff | comparison | revisions
UI/DiffDialog.ui file | annotate | diff | comparison | revisions
UI/FindFileDialog.py file | annotate | diff | comparison | revisions
UI/FindFileDialog.ui file | annotate | diff | comparison | revisions
UI/FindFileNameDialog.py file | annotate | diff | comparison | revisions
UI/FindFileNameDialog.ui file | annotate | diff | comparison | revisions
ViewManager/BookmarkedFilesDialog.py file | annotate | diff | comparison | revisions
ViewManager/BookmarkedFilesDialog.ui file | annotate | diff | comparison | revisions
--- a/Debugger/StartDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/Debugger/StartDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -9,7 +9,7 @@
 
 from __future__ import unicode_literals
 
-from PyQt5.QtWidgets import QDialog, QDialogButtonBox
+from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QComboBox
 
 from E5Gui.E5PathPicker import E5PathPickerModes
 
@@ -77,6 +77,9 @@
         self.ui.workdirPicker.setMode(E5PathPickerModes.DirectoryMode)
         self.ui.workdirPicker.setDefaultDirectory(
             Preferences.getMultiProject("Workspace"))
+        self.ui.workdirPicker.setInsertPolicy(QComboBox.InsertAtTop)
+        self.ui.workdirPicker.setSizeAdjustPolicy(
+            QComboBox.AdjustToMinimumContentsLength)
         
         self.clearButton = self.ui.buttonBox.addButton(
             self.tr("Clear Histories"), QDialogButtonBox.ActionRole)
--- a/E5Gui/E5PathPicker.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/E5Gui/E5PathPicker.py	Sun Nov 29 14:33:38 2015 +0100
@@ -37,6 +37,7 @@
     SaveFileMode = 2
     DirectoryMode = 3
 
+# TODO: Refactor the classes using a base class with common functions
 
 class E5PathPicker(QWidget):
     """
@@ -87,6 +88,8 @@
         
         self.__button.clicked.connect(self.__showPathPickerDialog)
         self.__editor.textChanged.connect(self.textChanged)
+        
+        self.setFocusProxy(self.__editor)
     
     def setMode(self, mode):
         """
@@ -128,6 +131,24 @@
         """
         return self.__mode
     
+    def setPickerEnabled(self, enable):
+        """
+        Public method to set the enabled state of the file dialog button.
+        
+        @param enable flag indicating the enabled state
+        @type bool
+        """
+        self.__button.setEnabled(enable)
+    
+    def isPickerEnabled(self):
+        """
+        Public method to get the file dialog button enabled state.
+        
+        @return flag indicating the enabled state
+        @rtype bool
+        """
+        return self.__button.isEnabled()
+    
     def clear(self):
         """
         Public method to clear the current path.
@@ -442,6 +463,8 @@
         
         self.__button.clicked.connect(self.__showPathPickerDialog)
         self.__editor.editTextChanged.connect(self.editTextChanged)
+        
+        self.setFocusProxy(self.__editor)
     
     def setMode(self, mode):
         """
@@ -483,6 +506,24 @@
         """
         return self.__mode
     
+    def setPickerEnabled(self, enable):
+        """
+        Public method to set the enabled state of the file dialog button.
+        
+        @param enable flag indicating the enabled state
+        @type bool
+        """
+        self.__button.setEnabled(enable)
+    
+    def isPickerEnabled(self):
+        """
+        Public method to get the file dialog button enabled state.
+        
+        @return flag indicating the enabled state
+        @rtype bool
+        """
+        return self.__button.isEnabled()
+    
     def clear(self):
         """
         Public method to clear the list of paths.
@@ -725,6 +766,24 @@
         """
         return self.__editor.toolTip()
     
+    def setInsertPolicy(self, policy):
+        """
+        Public method to set the insertion policy of the combo box.
+        
+        @param policy insertion policy
+        @type QComboBox.InsertPolicy
+        """
+        self.__editor.setInsertPolicy(policy)
+    
+    def setSizeAdjustPolicy(self, policy):
+        """
+        Public method to set the size adjust policy of the combo box.
+        
+        @param policy size adjust policy
+        @type QComboBox.SizeAdjustPolicy
+        """
+        self.__editor.setSizeAdjustPolicy(policy)
+    
     def __showPathPickerDialog(self):
         """
         Private slot to show the path picker dialog.
--- a/PyUnit/UnittestDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/PyUnit/UnittestDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -18,7 +18,7 @@
 from PyQt5.QtCore import pyqtSignal, QEvent, Qt, pyqtSlot
 from PyQt5.QtGui import QColor
 from PyQt5.QtWidgets import QWidget, QDialog, QApplication, QDialogButtonBox, \
-    QListWidgetItem
+    QListWidgetItem, QComboBox
 
 from E5Gui.E5Application import e5App
 from E5Gui import E5MessageBox
@@ -64,6 +64,9 @@
         self.setupUi(self)
         
         self.testsuitePicker.setMode(E5PathPickerModes.OpenFileMode)
+        self.testsuitePicker.setInsertPolicy(QComboBox.InsertAtTop)
+        self.testsuitePicker.setSizeAdjustPolicy(
+            QComboBox.AdjustToMinimumContentsLength)
         
         self.startButton = self.buttonBox.addButton(
             self.tr("Start"), QDialogButtonBox.ActionRole)
--- a/SqlBrowser/SqlConnectionDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/SqlBrowser/SqlConnectionDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -13,14 +13,10 @@
 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
 from PyQt5.QtSql import QSqlDatabase
 
-from E5Gui.E5Completers import E5FileCompleter
-from E5Gui import E5FileDialog
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_SqlConnectionDialog import Ui_SqlConnectionDialog
 
-import Utilities
-import UI.PixmapCache
-
 
 class SqlConnectionDialog(QDialog, Ui_SqlConnectionDialog):
     """
@@ -35,9 +31,7 @@
         super(SqlConnectionDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.databaseFileButton.setIcon(UI.PixmapCache.getIcon("open.png"))
-        
-        self.databaseFileCompleter = E5FileCompleter()
+        self.databasePicker.setMode(E5PathPickerModes.OpenFileMode)
         
         self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
         
@@ -68,13 +62,11 @@
         """
         driver = self.driverCombo.currentText()
         if driver.startswith("QSQLITE"):
-            self.databaseEdit.setCompleter(self.databaseFileCompleter)
-            self.databaseFileButton.setEnabled(True)
+            self.databasePicker.setPickerEnabled(True)
         else:
-            self.databaseEdit.setCompleter(None)
-            self.databaseFileButton.setEnabled(False)
+            self.databasePicker.setPickerEnabled(False)
         
-        if self.databaseEdit.text() == "" or driver == "":
+        if self.databasePicker.text() == "" or driver == "":
             self.okButton.setEnabled(False)
         else:
             self.okButton.setEnabled(True)
@@ -89,7 +81,7 @@
         self.__updateDialog()
     
     @pyqtSlot(str)
-    def on_databaseEdit_textChanged(self, txt):
+    def on_databasePicker_textChanged(self, txt):
         """
         Private slot handling the change of the database name.
         
@@ -97,21 +89,6 @@
         """
         self.__updateDialog()
     
-    @pyqtSlot()
-    def on_databaseFileButton_clicked(self):
-        """
-        Private slot to open a database file via a file selection dialog.
-        """
-        startdir = self.databaseEdit.text()
-        dbFile = E5FileDialog.getOpenFileName(
-            self,
-            self.tr("Select Database File"),
-            startdir,
-            self.tr("All Files (*)"))
-        
-        if dbFile:
-            self.databaseEdit.setText(Utilities.toNativeSeparators(dbFile))
-    
     def getData(self):
         """
         Public method to retrieve the connection data.
@@ -122,7 +99,7 @@
         """
         return (
             self.driverCombo.currentText(),
-            self.databaseEdit.text(),
+            self.databasePicker.text(),
             self.usernameEdit.text(),
             self.passwordEdit.text(),
             self.hostnameEdit.text(),
--- a/SqlBrowser/SqlConnectionDialog.ui	Sun Nov 29 13:21:15 2015 +0100
+++ b/SqlBrowser/SqlConnectionDialog.ui	Sun Nov 29 14:33:38 2015 +0100
@@ -6,159 +6,138 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
-    <height>265</height>
+    <width>500</width>
+    <height>210</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Connect...</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout">
-   <item>
-    <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="0">
-      <widget class="QLabel" name="textLabel2">
-       <property name="text">
-        <string>D&amp;river:</string>
-       </property>
-       <property name="buddy">
-        <cstring>driverCombo</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="0" column="1" colspan="2">
-      <widget class="QComboBox" name="driverCombo">
-       <property name="toolTip">
-        <string>Select the database driver</string>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="0">
-      <widget class="QLabel" name="textLabel3">
-       <property name="text">
-        <string>&amp;Database Name:</string>
-       </property>
-       <property name="buddy">
-        <cstring>databaseEdit</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="1" colspan="2">
-      <widget class="QLineEdit" name="databaseEdit">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
-       <property name="toolTip">
-        <string>Enter the database name</string>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="1">
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item row="3" column="0">
-      <widget class="QLabel" name="textLabel4">
-       <property name="text">
-        <string>&amp;Username:</string>
-       </property>
-       <property name="buddy">
-        <cstring>usernameEdit</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="3" column="1" colspan="2">
-      <widget class="QLineEdit" name="usernameEdit">
-       <property name="toolTip">
-        <string>Enter the user name</string>
-       </property>
-      </widget>
-     </item>
-     <item row="4" column="0">
-      <widget class="QLabel" name="textLabel4_2">
-       <property name="text">
-        <string>&amp;Password:</string>
-       </property>
-       <property name="buddy">
-        <cstring>passwordEdit</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="4" column="1" colspan="2">
-      <widget class="QLineEdit" name="passwordEdit">
-       <property name="echoMode">
-        <enum>QLineEdit::Password</enum>
-       </property>
-      </widget>
-     </item>
-     <item row="5" column="0">
-      <widget class="QLabel" name="textLabel5">
-       <property name="text">
-        <string>&amp;Hostname:</string>
-       </property>
-       <property name="buddy">
-        <cstring>hostnameEdit</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="5" column="1" colspan="2">
-      <widget class="QLineEdit" name="hostnameEdit">
-       <property name="toolTip">
-        <string>Enter the hostname</string>
-       </property>
-      </widget>
-     </item>
-     <item row="6" column="0">
-      <widget class="QLabel" name="textLabel5_2">
-       <property name="text">
-        <string>P&amp;ort:</string>
-       </property>
-       <property name="buddy">
-        <cstring>portSpinBox</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="6" column="1" colspan="2">
-      <widget class="QSpinBox" name="portSpinBox">
-       <property name="toolTip">
-        <string>Enter the port number</string>
-       </property>
-       <property name="specialValueText">
-        <string>Default</string>
-       </property>
-       <property name="minimum">
-        <number>-1</number>
-       </property>
-       <property name="maximum">
-        <number>65535</number>
-       </property>
-       <property name="value">
-        <number>-1</number>
-       </property>
-      </widget>
-     </item>
-     <item row="2" column="2">
-      <widget class="QToolButton" name="databaseFileButton">
-       <property name="toolTip">
-        <string>Press to select a database file</string>
-       </property>
-      </widget>
-     </item>
-    </layout>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="textLabel2">
+     <property name="text">
+      <string>D&amp;river:</string>
+     </property>
+     <property name="buddy">
+      <cstring>driverCombo</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QComboBox" name="driverCombo">
+     <property name="toolTip">
+      <string>Select the database driver</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="textLabel3">
+     <property name="text">
+      <string>&amp;Database Name:</string>
+     </property>
+     <property name="buddy">
+      <cstring>databasePicker</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="E5PathPicker" name="databasePicker" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="focusPolicy">
+      <enum>Qt::StrongFocus</enum>
+     </property>
+     <property name="toolTip">
+      <string>Enter the database name</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="textLabel4">
+     <property name="text">
+      <string>&amp;Username:</string>
+     </property>
+     <property name="buddy">
+      <cstring>usernameEdit</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QLineEdit" name="usernameEdit">
+     <property name="toolTip">
+      <string>Enter the user name</string>
+     </property>
+    </widget>
    </item>
-   <item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="textLabel4_2">
+     <property name="text">
+      <string>&amp;Password:</string>
+     </property>
+     <property name="buddy">
+      <cstring>passwordEdit</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="QLineEdit" name="passwordEdit">
+     <property name="echoMode">
+      <enum>QLineEdit::Password</enum>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="0">
+    <widget class="QLabel" name="textLabel5">
+     <property name="text">
+      <string>&amp;Hostname:</string>
+     </property>
+     <property name="buddy">
+      <cstring>hostnameEdit</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <widget class="QLineEdit" name="hostnameEdit">
+     <property name="toolTip">
+      <string>Enter the hostname</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="0">
+    <widget class="QLabel" name="textLabel5_2">
+     <property name="text">
+      <string>P&amp;ort:</string>
+     </property>
+     <property name="buddy">
+      <cstring>portSpinBox</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="1">
+    <widget class="QSpinBox" name="portSpinBox">
+     <property name="toolTip">
+      <string>Enter the port number</string>
+     </property>
+     <property name="specialValueText">
+      <string>Default</string>
+     </property>
+     <property name="minimum">
+      <number>-1</number>
+     </property>
+     <property name="maximum">
+      <number>65535</number>
+     </property>
+     <property name="value">
+      <number>-1</number>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="0" colspan="2">
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
@@ -170,15 +149,21 @@
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>E5PathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <tabstops>
   <tabstop>driverCombo</tabstop>
-  <tabstop>databaseEdit</tabstop>
-  <tabstop>databaseFileButton</tabstop>
+  <tabstop>databasePicker</tabstop>
   <tabstop>usernameEdit</tabstop>
   <tabstop>passwordEdit</tabstop>
   <tabstop>hostnameEdit</tabstop>
   <tabstop>portSpinBox</tabstop>
-  <tabstop>buttonBox</tabstop>
  </tabstops>
  <resources/>
  <connections>
--- a/UI/CompareDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/CompareDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -21,15 +21,14 @@
 from PyQt5.QtGui import QColor, QFontMetrics, QBrush, QTextCursor
 from PyQt5.QtWidgets import QWidget, QApplication, QDialogButtonBox
 
-from E5Gui.E5Completers import E5FileCompleter
-from E5Gui import E5MessageBox, E5FileDialog
+from E5Gui import E5MessageBox
 from E5Gui.E5MainWindow import E5MainWindow
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 import UI.PixmapCache
 
 from .Ui_CompareDialog import Ui_CompareDialog
 
-import Utilities
 import Preferences
 
 
@@ -102,11 +101,8 @@
         super(CompareDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.file1Button.setIcon(UI.PixmapCache.getIcon("open.png"))
-        self.file2Button.setIcon(UI.PixmapCache.getIcon("open.png"))
-        
-        self.file1Completer = E5FileCompleter(self.file1Edit)
-        self.file2Completer = E5FileCompleter(self.file2Edit)
+        self.file1Picker.setMode(E5PathPickerModes.OpenFileMode)
+        self.file2Picker.setMode(E5PathPickerModes.OpenFileMode)
         
         self.diffButton = self.buttonBox.addButton(
             self.tr("Compare"), QDialogButtonBox.ActionRole)
@@ -150,8 +146,8 @@
         self.cReplacedFormat.setBackground(QBrush(QColor(190, 190, 237)))
         
         # connect some of our widgets explicitly
-        self.file1Edit.textChanged.connect(self.__fileChanged)
-        self.file2Edit.textChanged.connect(self.__fileChanged)
+        self.file1Picker.textChanged.connect(self.__fileChanged)
+        self.file2Picker.textChanged.connect(self.__fileChanged)
         self.vsb1.valueChanged.connect(self.__scrollBarMoved)
         self.vsb1.valueChanged.connect(self.vsb2.setValue)
         self.vsb2.valueChanged.connect(self.vsb1.setValue)
@@ -163,8 +159,8 @@
         
         if len(files) == 2:
             self.filesGroup.hide()
-            self.file1Edit.setText(files[0][1])
-            self.file2Edit.setText(files[1][1])
+            self.file1Picker.setText(files[0][1])
+            self.file2Picker.setText(files[1][1])
             self.file1Label.setText(files[0][0])
             self.file2Label.setText(files[1][0])
             self.diffButton.hide()
@@ -180,7 +176,7 @@
         @param filename name of a file to use as the first file (string)
         """
         if filename:
-            self.file1Edit.setText(filename)
+            self.file1Picker.setText(filename)
         super(CompareDialog, self).show()
         
     def __appendText(self, pane, linenumber, line, format, interLine=False):
@@ -230,7 +226,7 @@
         """
         Private slot to handle the Compare button press.
         """
-        filename1 = Utilities.toNativeSeparators(self.file1Edit.text())
+        filename1 = self.file1Picker.text()
         try:
             f1 = open(filename1, "r", encoding="utf-8")
             lines1 = f1.readlines()
@@ -244,7 +240,7 @@
                 .format(filename1))
             return
 
-        filename2 = Utilities.toNativeSeparators(self.file2Edit.text())
+        filename2 = self.file2Picker.text()
         try:
             f2 = open(filename2, "r", encoding="utf-8")
             lines2 = f2.readlines()
@@ -274,10 +270,10 @@
         else:
             self.file1Button.hide()
             self.file2Button.hide()
-            self.file1Edit.setText(name1)
-            self.file1Edit.setReadOnly(True)
-            self.file2Edit.setText(name2)
-            self.file2Edit.setReadOnly(True)
+            self.file1Picker.setText(name1)
+            self.file1Picker.setReadOnly(True)
+            self.file2Picker.setText(name2)
+            self.file2Picker.setReadOnly(True)
         self.diffButton.setEnabled(False)
         self.diffButton.hide()
         
@@ -430,42 +426,12 @@
         """
         Private slot to enable/disable the Compare button.
         """
-        if not self.file1Edit.text() or \
-           not self.file2Edit.text():
+        if not self.file1Picker.text() or \
+           not self.file2Picker.text():
             self.diffButton.setEnabled(False)
         else:
             self.diffButton.setEnabled(True)
 
-    def __selectFile(self, lineEdit):
-        """
-        Private slot to display a file selection dialog.
-        
-        @param lineEdit field for the display of the selected filename
-                (QLineEdit)
-        """
-        filename = E5FileDialog.getOpenFileName(
-            self,
-            self.tr("Select file to compare"),
-            lineEdit.text(),
-            "")
-            
-        if filename:
-            lineEdit.setText(Utilities.toNativeSeparators(filename))
-
-    @pyqtSlot()
-    def on_file1Button_clicked(self):
-        """
-        Private slot to handle the file 1 file selection button press.
-        """
-        self.__selectFile(self.file1Edit)
-
-    @pyqtSlot()
-    def on_file2Button_clicked(self):
-        """
-        Private slot to handle the file 2 file selection button press.
-        """
-        self.__selectFile(self.file2Edit)
-
     @pyqtSlot(bool)
     def on_synchronizeCheckBox_toggled(self, sync):
         """
--- a/UI/CompareDialog.ui	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/CompareDialog.ui	Sun Nov 29 14:33:38 2015 +0100
@@ -17,72 +17,64 @@
    <item>
     <widget class="QGroupBox" name="filesGroup">
      <property name="title">
-      <string/>
+      <string>Files to be compared:</string>
      </property>
      <property name="flat">
       <bool>true</bool>
      </property>
-     <layout class="QHBoxLayout" name="horizontalLayout_3">
-      <property name="leftMargin">
-       <number>0</number>
-      </property>
-      <property name="topMargin">
-       <number>0</number>
-      </property>
-      <property name="rightMargin">
-       <number>0</number>
-      </property>
-      <property name="bottomMargin">
-       <number>0</number>
-      </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
       <item>
        <widget class="QLabel" name="textLabel1">
         <property name="text">
          <string>File &amp;1:</string>
         </property>
         <property name="buddy">
-         <cstring>file1Edit</cstring>
+         <cstring>file1Picker</cstring>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLineEdit" name="file1Edit">
+       <widget class="E5PathPicker" name="file1Picker" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="focusPolicy">
+         <enum>Qt::StrongFocus</enum>
+        </property>
         <property name="toolTip">
          <string>Enter the name of the first file</string>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QToolButton" name="file1Button">
-        <property name="toolTip">
-         <string>Press to select the file via a file selection dialog</string>
-        </property>
-       </widget>
-      </item>
-      <item>
        <widget class="QLabel" name="textLabel2">
         <property name="text">
          <string>File &amp;2:</string>
         </property>
         <property name="buddy">
-         <cstring>file1Edit</cstring>
+         <cstring>file2Picker</cstring>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="QLineEdit" name="file2Edit">
+       <widget class="E5PathPicker" name="file2Picker" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="focusPolicy">
+         <enum>Qt::StrongFocus</enum>
+        </property>
         <property name="toolTip">
          <string>Enter the name of the second file</string>
         </property>
        </widget>
       </item>
-      <item>
-       <widget class="QToolButton" name="file2Button">
-        <property name="toolTip">
-         <string>Press to select the file via a file selection dialog</string>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>
@@ -290,16 +282,22 @@
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>E5PathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <tabstops>
-  <tabstop>file1Edit</tabstop>
-  <tabstop>file1Button</tabstop>
-  <tabstop>file2Edit</tabstop>
-  <tabstop>file2Button</tabstop>
-  <tabstop>synchronizeCheckBox</tabstop>
+  <tabstop>file1Picker</tabstop>
+  <tabstop>file2Picker</tabstop>
   <tabstop>firstButton</tabstop>
   <tabstop>upButton</tabstop>
   <tabstop>downButton</tabstop>
   <tabstop>lastButton</tabstop>
+  <tabstop>synchronizeCheckBox</tabstop>
  </tabstops>
  <resources/>
  <connections>
--- a/UI/DiffDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/DiffDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -16,16 +16,15 @@
 from PyQt5.QtGui import QTextCursor
 from PyQt5.QtWidgets import QWidget, QApplication, QDialogButtonBox
 
-from E5Gui.E5Completers import E5FileCompleter
 from E5Gui import E5MessageBox, E5FileDialog
 from E5Gui.E5MainWindow import E5MainWindow
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_DiffDialog import Ui_DiffDialog
 from .DiffHighlighter import DiffHighlighter
 
 import Utilities
 import Preferences
-import UI.PixmapCache
 
 from difflib import SequenceMatcher
 
@@ -214,11 +213,8 @@
         super(DiffDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.file1Button.setIcon(UI.PixmapCache.getIcon("open.png"))
-        self.file2Button.setIcon(UI.PixmapCache.getIcon("open.png"))
-        
-        self.file1Completer = E5FileCompleter(self.file1Edit)
-        self.file2Completer = E5FileCompleter(self.file2Edit)
+        self.file1Picker.setMode(E5PathPickerModes.OpenFileMode)
+        self.file2Picker.setMode(E5PathPickerModes.OpenFileMode)
         
         self.diffButton = self.buttonBox.addButton(
             self.tr("Compare"), QDialogButtonBox.ActionRole)
@@ -246,8 +242,8 @@
         self.highlighter = DiffHighlighter(self.contents.document())
         
         # connect some of our widgets explicitly
-        self.file1Edit.textChanged.connect(self.__fileChanged)
-        self.file2Edit.textChanged.connect(self.__fileChanged)
+        self.file1Picker.textChanged.connect(self.__fileChanged)
+        self.file2Picker.textChanged.connect(self.__fileChanged)
         
     def show(self, filename=None):
         """
@@ -256,7 +252,7 @@
         @param filename name of a file to use as the first file (string)
         """
         if filename:
-            self.file1Edit.setText(filename)
+            self.file1Picker.setText(filename)
         super(DiffDialog, self).show()
         
     def on_buttonBox_clicked(self, button):
@@ -331,7 +327,7 @@
         """
         Private slot to handle the Compare button press.
         """
-        self.filename1 = Utilities.toNativeSeparators(self.file1Edit.text())
+        self.filename1 = Utilities.toNativeSeparators(self.file1Picker.text())
         try:
             filemtime1 = time.ctime(os.stat(self.filename1).st_mtime)
         except IOError:
@@ -349,7 +345,7 @@
                 .format(self.filename1))
             return
 
-        self.filename2 = Utilities.toNativeSeparators(self.file2Edit.text())
+        self.filename2 = Utilities.toNativeSeparators(self.file2Picker.text())
         try:
             filemtime2 = time.ctime(os.stat(self.filename2).st_mtime)
         except IOError:
@@ -447,42 +443,12 @@
         """
         Private slot to enable/disable the Compare button.
         """
-        if not self.file1Edit.text() or \
-           not self.file2Edit.text():
+        if not self.file1Picker.text() or \
+           not self.file2Picker.text():
             self.diffButton.setEnabled(False)
         else:
             self.diffButton.setEnabled(True)
 
-    def __selectFile(self, lineEdit):
-        """
-        Private slot to display a file selection dialog.
-        
-        @param lineEdit field for the display of the selected filename
-                (QLineEdit)
-        """
-        filename = E5FileDialog.getOpenFileName(
-            self,
-            self.tr("Select file to compare"),
-            lineEdit.text(),
-            "")
-            
-        if filename:
-            lineEdit.setText(Utilities.toNativeSeparators(filename))
-
-    @pyqtSlot()
-    def on_file1Button_clicked(self):
-        """
-        Private slot to handle the file 1 file selection button press.
-        """
-        self.__selectFile(self.file1Edit)
-
-    @pyqtSlot()
-    def on_file2Button_clicked(self):
-        """
-        Private slot to handle the file 2 file selection button press.
-        """
-        self.__selectFile(self.file2Edit)
-
 
 class DiffWindow(E5MainWindow):
     """
--- a/UI/DiffDialog.ui	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/DiffDialog.ui	Sun Nov 29 14:33:38 2015 +0100
@@ -13,67 +13,71 @@
   <property name="windowTitle">
    <string>File Differences</string>
   </property>
-  <layout class="QVBoxLayout">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <layout class="QHBoxLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
      <item>
       <widget class="QLabel" name="textLabel1">
        <property name="text">
         <string>File &amp;1:</string>
        </property>
        <property name="buddy">
-        <cstring>file1Edit</cstring>
+        <cstring>file1Picker</cstring>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QLineEdit" name="file1Edit">
+      <widget class="E5PathPicker" name="file1Picker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::StrongFocus</enum>
+       </property>
        <property name="toolTip">
         <string>Enter the name of the first file</string>
        </property>
       </widget>
      </item>
-     <item>
-      <widget class="QToolButton" name="file1Button">
-       <property name="toolTip">
-        <string>Press to select the file via a file selection dialog</string>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
    <item>
-    <layout class="QHBoxLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QLabel" name="textLabel2">
        <property name="text">
         <string>File &amp;2:</string>
        </property>
        <property name="buddy">
-        <cstring>file1Edit</cstring>
+        <cstring>file2Picker</cstring>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QLineEdit" name="file2Edit">
+      <widget class="E5PathPicker" name="file2Picker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::StrongFocus</enum>
+       </property>
        <property name="toolTip">
         <string>Enter the name of the second file</string>
        </property>
       </widget>
      </item>
-     <item>
-      <widget class="QToolButton" name="file2Button">
-       <property name="toolTip">
-        <string>Press to select the file via a file selection dialog</string>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
    <item>
     <widget class="QGroupBox" name="diffFormatGroup">
      <property name="title">
-      <string/>
+      <string>Select Diff Kind</string>
      </property>
      <layout class="QHBoxLayout">
       <item>
@@ -161,6 +165,12 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>E5PathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
    <class>E5TextEditSearchWidget</class>
    <extends>QWidget</extends>
    <header>E5Gui/E5TextEditSearchWidget.h</header>
@@ -168,12 +178,12 @@
   </customwidget>
  </customwidgets>
  <tabstops>
-  <tabstop>file1Edit</tabstop>
-  <tabstop>file1Button</tabstop>
-  <tabstop>file2Edit</tabstop>
-  <tabstop>file2Button</tabstop>
+  <tabstop>file1Picker</tabstop>
+  <tabstop>file2Picker</tabstop>
   <tabstop>unifiedRadioButton</tabstop>
   <tabstop>contextRadioButton</tabstop>
+  <tabstop>searchWidget</tabstop>
+  <tabstop>contents</tabstop>
  </tabstops>
  <resources/>
  <connections>
--- a/UI/FindFileDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/FindFileDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -15,16 +15,16 @@
 from PyQt5.QtCore import pyqtSignal, Qt, pyqtSlot
 from PyQt5.QtGui import QCursor
 from PyQt5.QtWidgets import QDialog, QApplication, QMenu, QDialogButtonBox, \
-    QTreeWidgetItem
+    QTreeWidgetItem, QComboBox
 
 from E5Gui.E5Application import e5App
-from E5Gui import E5MessageBox, E5FileDialog
+from E5Gui import E5MessageBox
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_FindFileDialog import Ui_FindFileDialog
 
 import Utilities
 import Preferences
-import UI.PixmapCache
 
 
 class FindFileDialog(QDialog, Ui_FindFileDialog):
@@ -60,7 +60,10 @@
         self.setupUi(self)
         self.setWindowFlags(Qt.Window)
         
-        self.dirSelectButton.setIcon(UI.PixmapCache.getIcon("open.png"))
+        self.dirPicker.setMode(E5PathPickerModes.DirectoryMode)
+        self.dirPicker.setInsertPolicy(QComboBox.InsertAtTop)
+        self.dirPicker.setSizeAdjustPolicy(
+            QComboBox.AdjustToMinimumContentsLength)
         
         self.__replaceMode = replaceMode
         
@@ -99,7 +102,7 @@
                 "FindFileDialog/DirectoryHistory"))
         self.findtextCombo.addItems(self.searchHistory)
         self.replacetextCombo.addItems(self.replaceHistory)
-        self.dirCombo.addItems(self.dirHistory)
+        self.dirPicker.addItems(self.dirHistory)
         
         self.project = project
         
@@ -209,10 +212,10 @@
         """
         self.__enableFindButton()
         
-    def on_dirCombo_editTextChanged(self, text):
+    def on_dirPicker_editTextChanged(self, text):
         """
         Private slot to handle the textChanged signal of the directory
-        combo box.
+        picker.
         
         @param text (ignored)
         """
@@ -256,9 +259,9 @@
            (self.__replaceMode and
             self.replacetextCombo.currentText() == "") or \
            (self.dirButton.isChecked() and
-            (self.dirCombo.currentText() == "" or
+            (self.dirPicker.currentText() == "" or
              not os.path.exists(os.path.abspath(
-                self.dirCombo.currentText())))) or \
+                self.dirPicker.currentText())))) or \
            (self.filterCheckBox.isChecked() and self.filterEdit.text() == ""):
             self.findButton.setEnabled(False)
             self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
@@ -344,7 +347,7 @@
                 filterString = "|".join(filters)
                 filterRe = re.compile(filterString)
             files = self.__getFileList(
-                os.path.abspath(self.dirCombo.currentText()),
+                os.path.abspath(self.dirPicker.currentText()),
                 filterRe)
         elif self.openFilesButton.isChecked():
             vm = e5App().getObject("ViewManager")
@@ -404,12 +407,12 @@
                 self.replaceHistory[:30])
         
         if self.dirButton.isChecked():
-            searchDir = self.dirCombo.currentText()
+            searchDir = self.dirPicker.currentText()
             if searchDir in self.dirHistory:
                 self.dirHistory.remove(searchDir)
             self.dirHistory.insert(0, searchDir)
-            self.dirCombo.clear()
-            self.dirCombo.addItems(self.dirHistory)
+            self.dirPicker.clear()
+            self.dirPicker.addItems(self.dirHistory)
             Preferences.Prefs.settings.setValue(
                 "FindFileDialog/DirectoryHistory",
                 self.dirHistory[:30])
@@ -544,20 +547,6 @@
         else:
             self.sourceFile.emit(fn, line, "", start, end)
         
-    @pyqtSlot()
-    def on_dirSelectButton_clicked(self):
-        """
-        Private slot to display a directory selection dialog.
-        """
-        directory = E5FileDialog.getExistingDirectory(
-            self,
-            self.tr("Select directory"),
-            self.dirCombo.currentText(),
-            E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
-            
-        if directory:
-            self.dirCombo.setEditText(Utilities.toNativeSeparators(directory))
-        
     def __getFileList(self, path, filterRe):
         """
         Private method to get a list of files to search.
@@ -583,7 +572,7 @@
         @param searchDir name of the directory to search in (string)
         """
         self.dirButton.setChecked(True)
-        self.dirCombo.setEditText(Utilities.toNativeSeparators(searchDir))
+        self.dirPicker.setEditText(Utilities.toNativeSeparators(searchDir))
         
     def setOpenFiles(self):
         """
--- a/UI/FindFileDialog.ui	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/FindFileDialog.ui	Sun Nov 29 14:33:38 2015 +0100
@@ -253,43 +253,23 @@
          </layout>
         </item>
         <item>
-         <layout class="QHBoxLayout" name="horizontalLayout_4">
-          <item>
-           <widget class="QComboBox" name="dirCombo">
-            <property name="enabled">
-             <bool>false</bool>
-            </property>
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-            <property name="toolTip">
-             <string>Enter the directory to search in</string>
-            </property>
-            <property name="editable">
-             <bool>true</bool>
-            </property>
-            <property name="insertPolicy">
-             <enum>QComboBox::InsertAtTop</enum>
-            </property>
-            <property name="sizeAdjustPolicy">
-             <enum>QComboBox::AdjustToMinimumContentsLength</enum>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QToolButton" name="dirSelectButton">
-            <property name="enabled">
-             <bool>false</bool>
-            </property>
-            <property name="toolTip">
-             <string>Select the directory via a directory selection dialog</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
+         <widget class="E5ComboPathPicker" name="dirPicker" native="true">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="focusPolicy">
+           <enum>Qt::WheelFocus</enum>
+          </property>
+          <property name="toolTip">
+           <string>Enter the directory to search in</string>
+          </property>
+         </widget>
         </item>
         <item>
          <layout class="QHBoxLayout" name="horizontalLayout_5">
@@ -396,6 +376,12 @@
    <extends>QLabel</extends>
    <header>E5Gui/E5SqueezeLabels.h</header>
   </customwidget>
+  <customwidget>
+   <class>E5ComboPathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
  </customwidgets>
  <tabstops>
   <tabstop>findtextCombo</tabstop>
@@ -412,12 +398,10 @@
   <tabstop>filterEdit</tabstop>
   <tabstop>projectButton</tabstop>
   <tabstop>dirButton</tabstop>
-  <tabstop>dirCombo</tabstop>
-  <tabstop>dirSelectButton</tabstop>
+  <tabstop>dirPicker</tabstop>
   <tabstop>openFilesButton</tabstop>
   <tabstop>findList</tabstop>
   <tabstop>replaceButton</tabstop>
-  <tabstop>buttonBox</tabstop>
  </tabstops>
  <resources/>
  <connections>
@@ -428,8 +412,8 @@
    <slot>close()</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>49</x>
-     <y>740</y>
+     <x>59</x>
+     <y>739</y>
     </hint>
     <hint type="destinationlabel">
      <x>34</x>
@@ -456,32 +440,16 @@
   <connection>
    <sender>dirButton</sender>
    <signal>toggled(bool)</signal>
-   <receiver>dirCombo</receiver>
+   <receiver>dirPicker</receiver>
    <slot>setEnabled(bool)</slot>
    <hints>
     <hint type="sourcelabel">
-     <x>577</x>
-     <y>151</y>
+     <x>409</x>
+     <y>144</y>
     </hint>
     <hint type="destinationlabel">
-     <x>545</x>
-     <y>183</y>
-    </hint>
-   </hints>
-  </connection>
-  <connection>
-   <sender>dirButton</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>dirSelectButton</receiver>
-   <slot>setEnabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel">
-     <x>515</x>
-     <y>146</y>
-    </hint>
-    <hint type="destinationlabel">
-     <x>563</x>
-     <y>175</y>
+     <x>408</x>
+     <y>176</y>
     </hint>
    </hints>
   </connection>
--- a/UI/FindFileNameDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/FindFileNameDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -16,14 +16,12 @@
 from PyQt5.QtWidgets import QWidget, QHeaderView, QApplication, \
     QDialogButtonBox, QTreeWidgetItem
 
-from E5Gui.E5Completers import E5DirCompleter
-from E5Gui import E5FileDialog
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_FindFileNameDialog import Ui_FindFileNameDialog
 
 from Utilities import direntries
 import Utilities
-import UI.PixmapCache
 
 
 class FindFileNameDialog(QWidget, Ui_FindFileNameDialog):
@@ -50,9 +48,7 @@
         super(FindFileNameDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.searchDirButton.setIcon(UI.PixmapCache.getIcon("open.png"))
-        
-        self.searchDirCompleter = E5DirCompleter(self.searchDirEdit)
+        self.searchDirPicker.setMode(E5PathPickerModes.DirectoryMode)
         
         self.fileList.headerItem().setText(self.fileList.columnCount(), "")
         
@@ -119,8 +115,8 @@
         
         searchPaths = []
         if self.searchDirCheckBox.isChecked() and \
-           self.searchDirEdit.text() != "":
-            searchPaths.append(self.searchDirEdit.text())
+           self.searchDirPicker.text() != "":
+            searchPaths.append(self.searchDirPicker.text())
         if self.projectCheckBox.isChecked():
             searchPaths.append(self.project.ppath)
         if self.syspathCheckBox.isChecked():
@@ -185,7 +181,7 @@
         """
         self.__searchFile()
         
-    def on_searchDirEdit_textChanged(self, text):
+    def on_searchDirPicker_textChanged(self, text):
         """
         Private slot to handle the textChanged signal of the search directory
         edit.
@@ -196,21 +192,6 @@
         if self.searchDirCheckBox.isChecked():
             self.__searchFile()
         
-    @pyqtSlot()
-    def on_searchDirButton_clicked(self):
-        """
-        Private slot to handle the clicked signal of the search directory
-        selection button.
-        """
-        searchDir = E5FileDialog.getExistingDirectory(
-            None,
-            self.tr("Select search directory"),
-            self.searchDirEdit.text(),
-            E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
-        
-        if searchDir:
-            self.searchDirEdit.setText(Utilities.toNativeSeparators(searchDir))
-        
     def on_searchDirCheckBox_toggled(self, checked):
         """
         Private slot to handle the toggled signal of the search directory
@@ -218,7 +199,7 @@
         
         @param checked flag indicating the state of the checkbox (boolean)
         """
-        if self.searchDirEdit.text():
+        if self.searchDirPicker.text():
             self.__searchFile()
         
     def on_projectCheckBox_toggled(self, checked):
--- a/UI/FindFileNameDialog.ui	Sun Nov 29 13:21:15 2015 +0100
+++ b/UI/FindFileNameDialog.ui	Sun Nov 29 14:33:38 2015 +0100
@@ -13,7 +13,7 @@
   <property name="windowTitle">
    <string>Find File</string>
   </property>
-  <layout class="QVBoxLayout">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
     <widget class="QLabel" name="textLabel1">
      <property name="text">
@@ -59,7 +59,7 @@
     </layout>
    </item>
    <item>
-    <layout class="QHBoxLayout">
+    <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QCheckBox" name="searchDirCheckBox">
        <property name="enabled">
@@ -74,19 +74,21 @@
       </widget>
      </item>
      <item>
-      <widget class="QLineEdit" name="searchDirEdit">
+      <widget class="E5PathPicker" name="searchDirPicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::StrongFocus</enum>
+       </property>
        <property name="toolTip">
         <string>Enter the directory, the file should be searched in</string>
        </property>
       </widget>
      </item>
-     <item>
-      <widget class="QToolButton" name="searchDirButton">
-       <property name="toolTip">
-        <string>Press to select the directory, the file should be searched in</string>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
    <item>
@@ -151,11 +153,18 @@
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>E5PathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <tabstops>
   <tabstop>fileNameEdit</tabstop>
   <tabstop>fileExtEdit</tabstop>
-  <tabstop>searchDirEdit</tabstop>
-  <tabstop>searchDirButton</tabstop>
+  <tabstop>searchDirPicker</tabstop>
   <tabstop>searchDirCheckBox</tabstop>
   <tabstop>projectCheckBox</tabstop>
   <tabstop>syspathCheckBox</tabstop>
--- a/ViewManager/BookmarkedFilesDialog.py	Sun Nov 29 13:21:15 2015 +0100
+++ b/ViewManager/BookmarkedFilesDialog.py	Sun Nov 29 14:33:38 2015 +0100
@@ -13,14 +13,10 @@
 from PyQt5.QtGui import QColor
 from PyQt5.QtWidgets import QListWidgetItem, QDialog
 
-from E5Gui.E5Completers import E5FileCompleter
-from E5Gui import E5FileDialog
+from E5Gui.E5PathPicker import E5PathPickerModes
 
 from .Ui_BookmarkedFilesDialog import Ui_BookmarkedFilesDialog
 
-import Utilities
-import UI.PixmapCache
-
 
 class BookmarkedFilesDialog(QDialog, Ui_BookmarkedFilesDialog):
     """
@@ -36,9 +32,7 @@
         super(BookmarkedFilesDialog, self).__init__(parent)
         self.setupUi(self)
         
-        self.fileButton.setIcon(UI.PixmapCache.getIcon("open.png"))
-        
-        self.fileCompleter = E5FileCompleter(self.fileEdit)
+        self.filePicker.setMode(E5PathPickerModes.OpenFileMode)
         
         self.bookmarks = bookmarks[:]
         for bookmark in self.bookmarks:
@@ -49,7 +43,7 @@
         if len(self.bookmarks):
             self.filesList.setCurrentRow(0)
         
-    def on_fileEdit_textChanged(self, txt):
+    def on_filePicker_textChanged(self, txt):
         """
         Private slot to handle the textChanged signal of the file edit.
         
@@ -67,7 +61,7 @@
         @param row the current row (integer)
         """
         if row == -1:
-            self.fileEdit.clear()
+            self.filePicker.clear()
             self.downButton.setEnabled(False)
             self.upButton.setEnabled(False)
             self.deleteButton.setEnabled(False)
@@ -80,20 +74,19 @@
             self.changeButton.setEnabled(True)
             
             bookmark = self.bookmarks[row]
-            self.fileEdit.setText(bookmark)
+            self.filePicker.setText(bookmark)
         
     @pyqtSlot()
     def on_addButton_clicked(self):
         """
         Private slot to add a new entry.
         """
-        bookmark = self.fileEdit.text()
+        bookmark = self.filePicker.text()
         if bookmark:
-            bookmark = Utilities.toNativeSeparators(bookmark)
             itm = QListWidgetItem(bookmark, self.filesList)
             if not QFileInfo(bookmark).exists():
                 itm.setBackground(QColor(Qt.red))
-            self.fileEdit.clear()
+            self.filePicker.clear()
             self.bookmarks.append(bookmark)
         row = self.filesList.currentRow()
         self.on_filesList_currentRowChanged(row)
@@ -104,8 +97,7 @@
         Private slot to change an entry.
         """
         row = self.filesList.currentRow()
-        bookmark = self.fileEdit.text()
-        bookmark = Utilities.toNativeSeparators(bookmark)
+        bookmark = self.filePicker.text()
         self.bookmarks[row] = bookmark
         itm = self.filesList.item(row)
         itm.setText(bookmark)
@@ -167,16 +159,6 @@
             self.upButton.setEnabled(True)
         self.downButton.setEnabled(True)
         
-    @pyqtSlot()
-    def on_fileButton_clicked(self):
-        """
-        Private slot to handle the file selection via a file selection dialog.
-        """
-        bookmark = E5FileDialog.getOpenFileName()
-        if bookmark:
-            bookmark = Utilities.toNativeSeparators(bookmark)
-            self.fileEdit.setText(bookmark)
-        
     def getBookmarkedFiles(self):
         """
         Public method to retrieve the tools list.
--- a/ViewManager/BookmarkedFilesDialog.ui	Sun Nov 29 13:21:15 2015 +0100
+++ b/ViewManager/BookmarkedFilesDialog.ui	Sun Nov 29 14:33:38 2015 +0100
@@ -16,17 +16,57 @@
   <property name="sizeGripEnabled">
    <bool>true</bool>
   </property>
-  <layout class="QVBoxLayout">
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <layout class="QGridLayout">
-     <item row="0" column="0" rowspan="6" colspan="3">
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="0" column="0" rowspan="6" colspan="2">
       <widget class="QListWidget" name="filesList">
        <property name="alternatingRowColors">
         <bool>true</bool>
        </property>
       </widget>
      </item>
-     <item row="2" column="3">
+     <item row="0" column="2">
+      <widget class="QPushButton" name="addButton">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="toolTip">
+        <string>Add a new bookmarked file</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Add&lt;/b&gt;
+&lt;p&gt;Add a new bookmarked file with the value entered below.&lt;/p&gt;</string>
+       </property>
+       <property name="text">
+        <string>&amp;Add</string>
+       </property>
+       <property name="shortcut">
+        <string>Alt+A</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="2">
+      <widget class="QPushButton" name="changeButton">
+       <property name="enabled">
+        <bool>false</bool>
+       </property>
+       <property name="toolTip">
+        <string>Change the value of the selected entry</string>
+       </property>
+       <property name="whatsThis">
+        <string>&lt;b&gt;Change&lt;/b&gt;
+&lt;p&gt;Change the value of the selected entry.&lt;/p&gt;</string>
+       </property>
+       <property name="text">
+        <string>C&amp;hange</string>
+       </property>
+       <property name="shortcut">
+        <string>Alt+H</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="2">
       <widget class="QPushButton" name="deleteButton">
        <property name="enabled">
         <bool>false</bool>
@@ -46,23 +86,7 @@
        </property>
       </widget>
      </item>
-     <item row="5" column="3">
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Vertical</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Expanding</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>87</width>
-         <height>130</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item row="3" column="3">
+     <item row="3" column="2">
       <widget class="QPushButton" name="upButton">
        <property name="enabled">
         <bool>false</bool>
@@ -82,7 +106,7 @@
        </property>
       </widget>
      </item>
-     <item row="4" column="3">
+     <item row="4" column="2">
       <widget class="QPushButton" name="downButton">
        <property name="enabled">
         <bool>false</bool>
@@ -102,25 +126,21 @@
        </property>
       </widget>
      </item>
-     <item row="0" column="3">
-      <widget class="QPushButton" name="addButton">
-       <property name="enabled">
-        <bool>false</bool>
+     <item row="5" column="2">
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
        </property>
-       <property name="toolTip">
-        <string>Add a new bookmarked file</string>
+       <property name="sizeType">
+        <enum>QSizePolicy::Expanding</enum>
        </property>
-       <property name="whatsThis">
-        <string>&lt;b&gt;Add&lt;/b&gt;
-&lt;p&gt;Add a new bookmarked file with the value entered below.&lt;/p&gt;</string>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>87</width>
+         <height>118</height>
+        </size>
        </property>
-       <property name="text">
-        <string>&amp;Add</string>
-       </property>
-       <property name="shortcut">
-        <string>Alt+A</string>
-       </property>
-      </widget>
+      </spacer>
      </item>
      <item row="6" column="0">
       <widget class="QLabel" name="TextLabel1">
@@ -128,32 +148,21 @@
         <string>&amp;File:</string>
        </property>
        <property name="buddy">
-        <cstring>fileEdit</cstring>
-       </property>
-      </widget>
-     </item>
-     <item row="1" column="3">
-      <widget class="QPushButton" name="changeButton">
-       <property name="enabled">
-        <bool>false</bool>
-       </property>
-       <property name="toolTip">
-        <string>Change the value of the selected entry</string>
-       </property>
-       <property name="whatsThis">
-        <string>&lt;b&gt;Change&lt;/b&gt;
-&lt;p&gt;Change the value of the selected entry.&lt;/p&gt;</string>
-       </property>
-       <property name="text">
-        <string>C&amp;hange</string>
-       </property>
-       <property name="shortcut">
-        <string>Alt+H</string>
+        <cstring>filePicker</cstring>
        </property>
       </widget>
      </item>
      <item row="6" column="1">
-      <widget class="QLineEdit" name="fileEdit">
+      <widget class="E5PathPicker" name="filePicker" native="true">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::StrongFocus</enum>
+       </property>
        <property name="toolTip">
         <string>Enter the filename of the file</string>
        </property>
@@ -163,17 +172,6 @@
        </property>
       </widget>
      </item>
-     <item row="6" column="2">
-      <widget class="QToolButton" name="fileButton">
-       <property name="toolTip">
-        <string>Select the file via a file selection dialog</string>
-       </property>
-       <property name="whatsThis">
-        <string>&lt;b&gt;File&lt;/b&gt;
-&lt;p&gt;Select the file to be bookmarked via a file selection dialog.&lt;/p&gt;</string>
-       </property>
-      </widget>
-     </item>
     </layout>
    </item>
    <item>
@@ -190,6 +188,14 @@
  </widget>
  <layoutdefault spacing="6" margin="6"/>
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <customwidgets>
+  <customwidget>
+   <class>E5PathPicker</class>
+   <extends>QWidget</extends>
+   <header>E5Gui/E5PathPicker.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
  <tabstops>
   <tabstop>filesList</tabstop>
   <tabstop>addButton</tabstop>
@@ -197,8 +203,6 @@
   <tabstop>deleteButton</tabstop>
   <tabstop>upButton</tabstop>
   <tabstop>downButton</tabstop>
-  <tabstop>fileEdit</tabstop>
-  <tabstop>fileButton</tabstop>
  </tabstops>
  <resources/>
  <connections>

eric ide

mercurial