[uim-commit] r2958 - trunk/qt

ekato at freedesktop.org ekato at freedesktop.org
Fri Jan 20 19:43:28 PST 2006


Author: ekato
Date: 2006-01-20 19:43:10 -0800 (Fri, 20 Jan 2006)
New Revision: 2958

Modified:
   trunk/qt/pref-customwidgets.cpp
Log:
* qt/pref-customwidgets.cpp
(CustomPathnameEdit::CustomPathnameEdit) : Set button label as
  intended.
(CustomPathnameEdit::slotPathnameButtonClicked) : Use appropriate
  dialog corresponding to the type of pathname.


Modified: trunk/qt/pref-customwidgets.cpp
===================================================================
--- trunk/qt/pref-customwidgets.cpp	2006-01-21 03:12:37 UTC (rev 2957)
+++ trunk/qt/pref-customwidgets.cpp	2006-01-21 03:43:10 UTC (rev 2958)
@@ -163,13 +163,24 @@
     : QHBox( parent, name ),
       UimCustomItemIface( c )
 {
+    const char *button;
+
     setSpacing( 3 );
     m_lineEdit = new QLineEdit( this );
     QObject::connect( m_lineEdit, SIGNAL(textChanged(const QString &)),
                       this, SLOT(slotCustomTextChanged(const QString &)) );
 
     m_fileButton = new QPushButton( this );
-    m_fileButton->setText( _("File") );
+    switch (m_custom->value->as_pathname->type) {
+    case UCustomPathnameType_Directory:
+        button = "Directory";
+        break;
+    case UCustomPathnameType_RegularFile:
+    default:
+        button = "File";
+        break;
+    }
+    m_fileButton->setText( _(button) );
     QObject::connect( m_fileButton, SIGNAL(clicked()),
                       this, SLOT(slotPathnameButtonClicked()) );
 
@@ -203,10 +214,15 @@
     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 (*)" );
+    switch (m_custom->value->as_pathname->type) {
+    case UCustomPathnameType_Directory:
+        m_fileDialog->setMode( QFileDialog::Directory );
+        break;
+    case UCustomPathnameType_RegularFile:
+    default:
+         m_fileDialog->setMode( QFileDialog::ExistingFile );
+         break;
+    }
     if ( m_fileDialog->exec() == QDialog::Accepted )
     {
         QString fileName = m_fileDialog->selectedFile();



More information about the uim-commit mailing list