summaryrefslogtreecommitdiff
path: root/noncore/applets/pcmcia/configdialog.cpp
Unidiff
Diffstat (limited to 'noncore/applets/pcmcia/configdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pcmcia/configdialog.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp
index e161d18..9fcf58c 100644
--- a/noncore/applets/pcmcia/configdialog.cpp
+++ b/noncore/applets/pcmcia/configdialog.cpp
@@ -32,20 +32,24 @@
32/* OPIE */ 32/* OPIE */
33#include <opie2/oconfig.h> 33#include <opie2/oconfig.h>
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <opie2/opcmciasystem.h>
35using namespace Opie::Core; 36using namespace Opie::Core;
36 37
37/* QT */ 38/* QT */
38#include <qcombobox.h> 39#include <qcombobox.h>
39#include <qdir.h> 40#include <qdir.h>
40#include <qfile.h> 41#include <qfile.h>
42#include <qgroupbox.h>
41#include <qlabel.h> 43#include <qlabel.h>
42#include <qtextstream.h> 44#include <qtextstream.h>
43 45
44ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) 46ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent )
45 :ConfigDialogBase( parent, "pcmcia config dialog", true ) 47 :ConfigDialogBase( parent, "pcmcia config dialog", true )
46{ 48{
47 //setCaption( tr( "Configure %1" ).arg( cardname ) ); 49 gbDetails->setTitle( QString( "Details for '%1'" ).arg( card->identity() ) );
48 txtCardName->setText( cardname ); 50 txtCardName->setText( card->productIdentity().join( " " ) );
51 txtManfid->setText( card->manufacturerIdentity() );
52 txtFunction->setText( card->function() );
49 53
50 OConfig cfg( "PCMCIA" ); 54 OConfig cfg( "PCMCIA" );
51 cfg.setGroup( "Global" ); 55 cfg.setGroup( "Global" );
@@ -57,14 +61,14 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
57 QString cardSection = QString( "Card_%1" ).arg( i ); 61 QString cardSection = QString( "Card_%1" ).arg( i );
58 cfg.setGroup( cardSection ); 62 cfg.setGroup( cardSection );
59 QString name = cfg.readEntry( "name" ); 63 QString name = cfg.readEntry( "name" );
60 odebug << "comparing card '" << cardname << "' with known card '" << name << "'" << oendl; 64 odebug << "comparing card '" << card->name() << "' with known card '" << name << "'" << oendl;
61 if ( cardname == name ) 65 if ( card->name() == name )
62 { 66 {
63 insert = cfg.readEntry( "insert" ); 67 insert = cfg.readEntry( "insert" );
64 break; 68 break;
65 } 69 }
66 } 70 }
67 odebug << "preferred action for card '" << cardname << "' seems to be '" << insert << "'" << oendl; 71 odebug << "preferred action for card '" << card->name() << "' seems to be '" << insert << "'" << oendl;
68 72
69 if ( !insert.isEmpty() ) 73 if ( !insert.isEmpty() )
70 { 74 {
@@ -72,6 +76,20 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
72 if ( cbAction->text( i ) == insert ) cbAction->setCurrentItem( i ); 76 if ( cbAction->text( i ) == insert ) cbAction->setCurrentItem( i );
73 } 77 }
74 78
79 if ( !card->isUnsupported() )
80 {
81 odebug << "card is recognized - hiding bindings" << oendl;
82 textBindTo->hide();
83 cbBindTo->hide();
84 return;
85 }
86 else
87 {
88 odebug << "card is unsupported yet - showing possible bindings" << oendl;
89 textBindTo->show();
90 cbBindTo->show();
91 }
92
75 // parse possible bind entries out of /etc/pcmcia/*.conf 93 // parse possible bind entries out of /etc/pcmcia/*.conf
76 typedef QMap<QString,QString> StringMap; 94 typedef QMap<QString,QString> StringMap;
77 StringMap bindEntries; 95 StringMap bindEntries;
@@ -108,7 +126,7 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
108 126
109 for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it ) 127 for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it )
110 { 128 {
111 odebug << "found device '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; 129 odebug << "found binding '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl;
112 cbBindTo->insertItem( it.key() ); 130 cbBindTo->insertItem( it.key() );
113 } 131 }
114} 132}