From 9e210f138184f9cc93e28dd894243fc7bfea1b0f Mon Sep 17 00:00:00 2001 From: mickeyl Date: Mon, 13 Jun 2005 20:46:02 +0000 Subject: parse possible bindings out of /etc/pcmcia/* and list them in combobox --- (limited to 'noncore/applets') diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp index e7c97c1..e161d18 100644 --- a/noncore/applets/pcmcia/configdialog.cpp +++ b/noncore/applets/pcmcia/configdialog.cpp @@ -37,13 +37,15 @@ using namespace Opie::Core; /* QT */ #include #include +#include #include +#include ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) :ConfigDialogBase( parent, "pcmcia config dialog", true ) { //setCaption( tr( "Configure %1" ).arg( cardname ) ); - textCardName->setText( cardname ); + txtCardName->setText( cardname ); OConfig cfg( "PCMCIA" ); cfg.setGroup( "Global" ); @@ -70,15 +72,45 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) if ( cbAction->text( i ) == insert ) cbAction->setCurrentItem( i ); } - // parse possible device and class names out of /etc/pcmcia/*.conf - QStringList deviceNames; - QStringList classNames; + // parse possible bind entries out of /etc/pcmcia/*.conf + typedef QMap StringMap; + StringMap bindEntries; QDir pcmciaconfdir( "/etc/pcmcia", "*.conf" ); for ( int i = 0; i < pcmciaconfdir.count(); ++i ) - odebug << "found conf file '" << pcmciaconfdir[i] << "'" << oendl; + { + odebug << "processing conf file '" << pcmciaconfdir[i] << "'" << oendl; + QString conffilename = QString( "%1/%2" ).arg( pcmciaconfdir.absPath() ).arg( pcmciaconfdir[i] ); + QFile conffile( conffilename ); + if ( conffile.open( IO_ReadOnly ) ) + { + QTextStream ts( &conffile ); + while ( !ts.atEnd() ) + { + QString word; + ts >> word; + if ( word == "bind" ) + { + word = ts.readLine(); + bindEntries[ word.stripWhiteSpace() ] = conffilename; + continue; + } + ts.readLine(); + } + } + else + { + owarn << "couldn't open '" << conffile.name() << "' for reading" << oendl; + continue; + } + } + for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it ) + { + odebug << "found device '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; + cbBindTo->insertItem( it.key() ); + } } ConfigDialog::~ConfigDialog() diff --git a/noncore/applets/pcmcia/configdialogbase.ui b/noncore/applets/pcmcia/configdialogbase.ui index a9682c5..a0760d6 100644 --- a/noncore/applets/pcmcia/configdialogbase.ui +++ b/noncore/applets/pcmcia/configdialogbase.ui @@ -11,8 +11,8 @@ 0 0 - 234 - 130 + 232 + 206 @@ -28,11 +28,11 @@ margin - 7 + 5 spacing - 4 + 2 QLabel @@ -93,16 +93,9 @@ name cbBindTo - - - Line - - name - Line1 - - orientation - Horizontal + editable + true @@ -116,35 +109,141 @@ Bind to: - - QLabel + + QGroupBox name - textClassName + GroupBox1 - text - Classname: + title + Details + + + layoutMargin + + layoutSpacing + + + + margin + 6 + + + spacing + 4 + + + QLabel + + name + labelCardName + + + text + CardName: + + + + QLabel + + name + labelFunction + + + text + Function: + + + + QLabel + + name + labelManufacturer + + + text + Manufacturer: + + + + QLabel + + name + txtManfid + + + sizePolicy + + 7 + 1 + + + + text + TextLabel6 + + + + QLabel + + name + txtFunction + + + sizePolicy + + 7 + 1 + + + + text + TextLabel7 + + + + QLabel + + name + txtCardName + + + sizePolicy + + 7 + 1 + + + + text + TextLabel3 + + + - - QComboBox - + + name - cbClassName + Spacer1 - - - QLabel - name - textCardName + orientation + Vertical - text - CardName + sizeType + Expanding - + + sizeHint + + 20 + 20 + + + -- cgit v0.9.0.2