Diffstat (limited to 'noncore/applets/pcmcia/configdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/pcmcia/configdialog.cpp | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp index 9fcf58c..f961069 100644 --- a/noncore/applets/pcmcia/configdialog.cpp +++ b/noncore/applets/pcmcia/configdialog.cpp | |||
@@ -48,3 +48,3 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) | |||
48 | { | 48 | { |
49 | gbDetails->setTitle( QString( "Details for '%1'" ).arg( card->identity() ) ); | 49 | gbDetails->setTitle( QString( "Details for card in socket #%1" ).arg( card->number() ) ); |
50 | txtCardName->setText( card->productIdentity().join( " " ) ); | 50 | txtCardName->setText( card->productIdentity().join( " " ) ); |
@@ -53,25 +53,10 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) | |||
53 | 53 | ||
54 | OConfig cfg( "PCMCIA" ); | 54 | QString action = preferredAction( card ); |
55 | cfg.setGroup( "Global" ); | ||
56 | int nCards = cfg.readNumEntry( "nCards", 0 ); | ||
57 | QString insert; | ||
58 | 55 | ||
59 | for ( int i = 0; i < nCards; ++i ) | 56 | odebug << "preferred action for card '" << card->name() << "' seems to be '" << action << "'" << oendl; |
60 | { | ||
61 | QString cardSection = QString( "Card_%1" ).arg( i ); | ||
62 | cfg.setGroup( cardSection ); | ||
63 | QString name = cfg.readEntry( "name" ); | ||
64 | odebug << "comparing card '" << card->name() << "' with known card '" << name << "'" << oendl; | ||
65 | if ( card->name() == name ) | ||
66 | { | ||
67 | insert = cfg.readEntry( "insert" ); | ||
68 | break; | ||
69 | } | ||
70 | } | ||
71 | odebug << "preferred action for card '" << card->name() << "' seems to be '" << insert << "'" << oendl; | ||
72 | 57 | ||
73 | if ( !insert.isEmpty() ) | 58 | if ( !action.isEmpty() ) |
74 | { | 59 | { |
75 | for ( int i; i < cbAction->count(); ++i ) | 60 | for ( int i; i < cbAction->count(); ++i ) |
76 | if ( cbAction->text( i ) == insert ) cbAction->setCurrentItem( i ); | 61 | if ( cbAction->text( i ) == action ) cbAction->setCurrentItem( i ); |
77 | } | 62 | } |
@@ -81,2 +66,3 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) | |||
81 | odebug << "card is recognized - hiding bindings" << oendl; | 66 | odebug << "card is recognized - hiding bindings" << oendl; |
67 | textInfo->hide(); | ||
82 | textBindTo->hide(); | 68 | textBindTo->hide(); |
@@ -88,2 +74,3 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) | |||
88 | odebug << "card is unsupported yet - showing possible bindings" << oendl; | 74 | odebug << "card is unsupported yet - showing possible bindings" << oendl; |
75 | textInfo->show(); | ||
89 | textBindTo->show(); | 76 | textBindTo->show(); |
@@ -98,3 +85,3 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) | |||
98 | 85 | ||
99 | for ( int i = 0; i < pcmciaconfdir.count(); ++i ) | 86 | for ( unsigned int i = 0; i < pcmciaconfdir.count(); ++i ) |
100 | { | 87 | { |
@@ -136 +123,24 @@ ConfigDialog::~ConfigDialog() | |||
136 | } | 123 | } |
124 | |||
125 | QString ConfigDialog::preferredAction( const OPcmciaSocket* card ) | ||
126 | { | ||
127 | OConfig cfg( "PCMCIA" ); | ||
128 | cfg.setGroup( "Global" ); | ||
129 | int nCards = cfg.readNumEntry( "nCards", 0 ); | ||
130 | QString action; | ||
131 | |||
132 | for ( int i = 0; i < nCards; ++i ) | ||
133 | { | ||
134 | QString cardSection = QString( "Card_%1" ).arg( i ); | ||
135 | cfg.setGroup( cardSection ); | ||
136 | QString name = cfg.readEntry( "name" ); | ||
137 | odebug << "comparing card '" << card->name() << "' with known card '" << name << "'" << oendl; | ||
138 | if ( card->name() == name ) | ||
139 | { | ||
140 | action = cfg.readEntry( "action" ); | ||
141 | break; | ||
142 | } | ||
143 | } | ||
144 | |||
145 | return action; | ||
146 | } | ||