[uim-commit] r2587 - branches/1.0/qt

ekato at freedesktop.org ekato at freedesktop.org
Thu Dec 15 03:01:19 PST 2005


Author: ekato
Date: 2005-12-15 03:01:14 -0800 (Thu, 15 Dec 2005)
New Revision: 2587

Modified:
   branches/1.0/qt/pref-customwidgets.cpp
   branches/1.0/qt/pref-customwidgets.h
Log:
* qt/pref-customwidgets.cpp
* qt/pref-customwidgets.h
  - Port r2586 from trunk.


Modified: branches/1.0/qt/pref-customwidgets.cpp
===================================================================
--- branches/1.0/qt/pref-customwidgets.cpp	2005-12-15 10:58:40 UTC (rev 2586)
+++ branches/1.0/qt/pref-customwidgets.cpp	2005-12-15 11:01:14 UTC (rev 2587)
@@ -198,14 +198,20 @@
 
 void CustomPathnameEdit::slotPathnameButtonClicked()
 {
-    QFileDialog* fd = new QFileDialog( this, "file dialog" );
-    fd->setMode( QFileDialog::Directory );
-    if ( fd->exec() == QDialog::Accepted )
+    m_fileDialog = new QFileDialog( this, "file dialog" );
+    QObject::connect( m_fileDialog, SIGNAL(filterSelected(const QString&)),
+                      this, SLOT(slotFileDialogFilterSelected(const QString&)) );
+
+
+    m_fileDialog->setMode( QFileDialog::ExistingFile );
+    m_fileDialog->addFilter( "Directories" );
+    m_fileDialog->setSelectedFilter( "All Files (*)" );
+    if ( m_fileDialog->exec() == QDialog::Accepted )
     {
-        QString fileName = fd->selectedFile();
+        QString fileName = m_fileDialog->selectedFile();
         m_lineEdit->setText( fileName );
     }
-    delete fd;
+    delete m_fileDialog;
 }
 
 void CustomPathnameEdit::slotCustomTextChanged( const QString & text )
@@ -218,6 +224,14 @@
     setCustom( m_custom );
 }
 
+void CustomPathnameEdit::slotFileDialogFilterSelected( const QString & text )
+{
+    if (text == "Directories")
+        m_fileDialog->setMode( QFileDialog::Directory );
+    else
+        m_fileDialog->setMode( QFileDialog::ExistingFile );
+}
+
 //----------------------------------------------------------------------------------------
 CustomChoiceCombo::CustomChoiceCombo( struct uim_custom *c, QWidget *parent, const char *name)
     : QComboBox( parent, name ),

Modified: branches/1.0/qt/pref-customwidgets.h
===================================================================
--- branches/1.0/qt/pref-customwidgets.h	2005-12-15 10:58:40 UTC (rev 2586)
+++ branches/1.0/qt/pref-customwidgets.h	2005-12-15 11:01:14 UTC (rev 2587)
@@ -176,9 +176,11 @@
 protected slots:
     void slotPathnameButtonClicked();
     void slotCustomTextChanged( const QString & text );
+    void slotFileDialogFilterSelected( const QString & text );
 private:
     QLineEdit *m_lineEdit;
     QPushButton *m_fileButton;
+    QFileDialog *m_fileDialog;
 protected:
     void currentCustomValueChanged(){ emit customValueChanged(); }
 signals:



More information about the uim-commit mailing list