-rw-r--r-- | noncore/applets/pcmcia/configdialog.cpp | 21 | ||||
-rw-r--r-- | noncore/applets/pcmcia/configdialog.h | 2 | ||||
-rw-r--r-- | noncore/applets/pcmcia/configdialogbase.ui | 76 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 12 |
4 files changed, 91 insertions, 20 deletions
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp index c08926e..e7c97c1 100644 --- a/noncore/applets/pcmcia/configdialog.cpp +++ b/noncore/applets/pcmcia/configdialog.cpp | |||
@@ -35,19 +35,22 @@ | |||
35 | using namespace Opie::Core; | 35 | using namespace Opie::Core; |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qdir.h> | ||
40 | #include <qlabel.h> | ||
39 | 41 | ||
40 | ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) | 42 | ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) |
41 | :ConfigDialogBase( parent, "pcmcia config dialog", true ) | 43 | :ConfigDialogBase( parent, "pcmcia config dialog", true ) |
42 | { | 44 | { |
43 | setCaption( tr( "Configure %1" ).arg( cardname ) ); | 45 | //setCaption( tr( "Configure %1" ).arg( cardname ) ); |
44 | 46 | textCardName->setText( cardname ); | |
47 | |||
45 | OConfig cfg( "PCMCIA" ); | 48 | OConfig cfg( "PCMCIA" ); |
46 | cfg.setGroup( "Global" ); | 49 | cfg.setGroup( "Global" ); |
47 | int nCards = cfg.readNumEntry( "nCards", 0 ); | 50 | int nCards = cfg.readNumEntry( "nCards", 0 ); |
48 | QString insert; | 51 | QString insert; |
49 | 52 | ||
50 | for ( int i = 0; i < nCards; ++i ) | 53 | for ( int i = 0; i < nCards; ++i ) |
51 | { | 54 | { |
52 | QString cardSection = QString( "Card_%1" ).arg( i ); | 55 | QString cardSection = QString( "Card_%1" ).arg( i ); |
53 | cfg.setGroup( cardSection ); | 56 | cfg.setGroup( cardSection ); |
@@ -59,14 +62,24 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) | |||
59 | break; | 62 | break; |
60 | } | 63 | } |
61 | } | 64 | } |
62 | odebug << "preferred action for card '" << cardname << "' seems to be '" << insert << "'" << oendl; | 65 | odebug << "preferred action for card '" << cardname << "' seems to be '" << insert << "'" << oendl; |
63 | 66 | ||
64 | if ( !insert.isEmpty() ) | 67 | if ( !insert.isEmpty() ) |
65 | { | 68 | { |
66 | for ( int i; i < cbAction->count(); ++i ) | 69 | for ( int i; i < cbAction->count(); ++i ) |
67 | if ( cbAction->text( i ) == insert ) cbAction->setCurrentItem( i ); | 70 | if ( cbAction->text( i ) == insert ) cbAction->setCurrentItem( i ); |
68 | } | 71 | } |
72 | |||
73 | // parse possible device and class names out of /etc/pcmcia/*.conf | ||
74 | QStringList deviceNames; | ||
75 | QStringList classNames; | ||
76 | |||
77 | QDir pcmciaconfdir( "/etc/pcmcia", "*.conf" ); | ||
78 | |||
79 | for ( int i = 0; i < pcmciaconfdir.count(); ++i ) | ||
80 | odebug << "found conf file '" << pcmciaconfdir[i] << "'" << oendl; | ||
81 | |||
69 | } | 82 | } |
70 | 83 | ||
71 | ConfigDialog::~ConfigDialog() | 84 | ConfigDialog::~ConfigDialog() |
72 | { | 85 | { |
diff --git a/noncore/applets/pcmcia/configdialog.h b/noncore/applets/pcmcia/configdialog.h index 12500c4..f79d7a6 100644 --- a/noncore/applets/pcmcia/configdialog.h +++ b/noncore/applets/pcmcia/configdialog.h | |||
@@ -35,9 +35,9 @@ | |||
35 | class ConfigDialog : public ConfigDialogBase | 35 | class ConfigDialog : public ConfigDialogBase |
36 | { | 36 | { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | public: | 38 | public: |
39 | 39 | ||
40 | ConfigDialog( const QString& cardname, QWidget* parent ); | 40 | ConfigDialog( const QString& cardname, QWidget* parent ); |
41 | ~ConfigDialog(); | 41 | ~ConfigDialog(); |
42 | }; | 42 | }; |
43 | 43 | ||
diff --git a/noncore/applets/pcmcia/configdialogbase.ui b/noncore/applets/pcmcia/configdialogbase.ui index d8dd983..a9682c5 100644 --- a/noncore/applets/pcmcia/configdialogbase.ui +++ b/noncore/applets/pcmcia/configdialogbase.ui | |||
@@ -10,10 +10,10 @@ | |||
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>214</width> | 14 | <width>234</width> |
15 | <height>44</height> | 15 | <height>130</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
@@ -27,15 +27,15 @@ | |||
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <grid> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>11</number> | 31 | <number>7</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>6</number> | 35 | <number>4</number> |
36 | </property> | 36 | </property> |
37 | <widget row="0" column="2" > | 37 | <widget row="2" column="2" > |
38 | <class>QLabel</class> | 38 | <class>QLabel</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TextLabel3</cstring> | 41 | <cstring>TextLabel3</cstring> |
@@ -44,9 +44,20 @@ | |||
44 | <name>text</name> | 44 | <name>text</name> |
45 | <string>card</string> | 45 | <string>card</string> |
46 | </property> | 46 | </property> |
47 | </widget> | 47 | </widget> |
48 | <widget row="0" column="1" > | 48 | <widget row="2" column="0" > |
49 | <class>QLabel</class> | ||
50 | <property stdset="1"> | ||
51 | <name>name</name> | ||
52 | <cstring>TextLabel2</cstring> | ||
53 | </property> | ||
54 | <property stdset="1"> | ||
55 | <name>text</name> | ||
56 | <string>Upon insertion,</string> | ||
57 | </property> | ||
58 | </widget> | ||
59 | <widget row="2" column="1" > | ||
49 | <class>QComboBox</class> | 60 | <class>QComboBox</class> |
50 | <item> | 61 | <item> |
51 | <property> | 62 | <property> |
52 | <name>text</name> | 63 | <name>text</name> |
@@ -75,17 +86,64 @@ | |||
75 | <name>name</name> | 86 | <name>name</name> |
76 | <cstring>cbAction</cstring> | 87 | <cstring>cbAction</cstring> |
77 | </property> | 88 | </property> |
78 | </widget> | 89 | </widget> |
79 | <widget row="0" column="0" > | 90 | <widget row="3" column="1" rowspan="1" colspan="2" > |
91 | <class>QComboBox</class> | ||
92 | <property stdset="1"> | ||
93 | <name>name</name> | ||
94 | <cstring>cbBindTo</cstring> | ||
95 | </property> | ||
96 | </widget> | ||
97 | <widget row="1" column="0" rowspan="1" colspan="3" > | ||
98 | <class>Line</class> | ||
99 | <property stdset="1"> | ||
100 | <name>name</name> | ||
101 | <cstring>Line1</cstring> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>orientation</name> | ||
105 | <enum>Horizontal</enum> | ||
106 | </property> | ||
107 | </widget> | ||
108 | <widget row="3" column="0" > | ||
80 | <class>QLabel</class> | 109 | <class>QLabel</class> |
81 | <property stdset="1"> | 110 | <property stdset="1"> |
82 | <name>name</name> | 111 | <name>name</name> |
83 | <cstring>TextLabel2</cstring> | 112 | <cstring>textBindTo</cstring> |
84 | </property> | 113 | </property> |
85 | <property stdset="1"> | 114 | <property stdset="1"> |
86 | <name>text</name> | 115 | <name>text</name> |
87 | <string>Upon insertion,</string> | 116 | <string>Bind to:</string> |
117 | </property> | ||
118 | </widget> | ||
119 | <widget row="4" column="0" > | ||
120 | <class>QLabel</class> | ||
121 | <property stdset="1"> | ||
122 | <name>name</name> | ||
123 | <cstring>textClassName</cstring> | ||
124 | </property> | ||
125 | <property stdset="1"> | ||
126 | <name>text</name> | ||
127 | <string>Classname:</string> | ||
128 | </property> | ||
129 | </widget> | ||
130 | <widget row="4" column="1" rowspan="1" colspan="2" > | ||
131 | <class>QComboBox</class> | ||
132 | <property stdset="1"> | ||
133 | <name>name</name> | ||
134 | <cstring>cbClassName</cstring> | ||
135 | </property> | ||
136 | </widget> | ||
137 | <widget row="0" column="0" rowspan="1" colspan="3" > | ||
138 | <class>QLabel</class> | ||
139 | <property stdset="1"> | ||
140 | <name>name</name> | ||
141 | <cstring>textCardName</cstring> | ||
142 | </property> | ||
143 | <property stdset="1"> | ||
144 | <name>text</name> | ||
145 | <string>CardName</string> | ||
88 | </property> | 146 | </property> |
89 | </widget> | 147 | </widget> |
90 | </grid> | 148 | </grid> |
91 | </widget> | 149 | </widget> |
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index 4fcc189..6c18e86 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp | |||
@@ -130,15 +130,15 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) | |||
130 | submenu->insertItem( "&Insert", INSERT+i*100 ); | 130 | submenu->insertItem( "&Insert", INSERT+i*100 ); |
131 | submenu->insertItem( "&Suspend", SUSPEND+i*100 ); | 131 | submenu->insertItem( "&Suspend", SUSPEND+i*100 ); |
132 | submenu->insertItem( "&Resume", RESUME+i*100 ); | 132 | submenu->insertItem( "&Resume", RESUME+i*100 ); |
133 | submenu->insertItem( "&Configure", CONFIGURE+i*100 ); | 133 | submenu->insertItem( "&Configure", CONFIGURE+i*100 ); |
134 | 134 | ||
135 | submenu->setItemEnabled( EJECT+i*100, !it.current()->isEmpty() ); | 135 | submenu->setItemEnabled( EJECT+i*100, !it.current()->isEmpty() ); |
136 | submenu->setItemEnabled( INSERT+i*100, it.current()->isEmpty() ); | 136 | submenu->setItemEnabled( INSERT+i*100, it.current()->isEmpty() ); |
137 | submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); | 137 | submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); |
138 | submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); | 138 | submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); |
139 | submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() ); | 139 | submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() ); |
140 | 140 | ||
141 | connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); | 141 | connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); |
142 | menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 ); | 142 | menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 ); |
143 | ++it; | 143 | ++it; |
144 | } | 144 | } |
@@ -169,9 +169,9 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | |||
169 | OPcmciaSystem::CardIterator it = sys->iterator(); | 169 | OPcmciaSystem::CardIterator it = sys->iterator(); |
170 | 170 | ||
171 | bool newCard = true; | 171 | bool newCard = true; |
172 | OPcmciaSocket* theCard = 0; | 172 | OPcmciaSocket* theCard = 0; |
173 | 173 | ||
174 | while ( it.current() && newCard ) | 174 | while ( it.current() && newCard ) |
175 | { | 175 | { |
176 | if ( it.current()->isEmpty() ) | 176 | if ( it.current()->isEmpty() ) |
177 | { | 177 | { |
@@ -233,9 +233,9 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | |||
233 | void PcmciaManager::paintEvent( QPaintEvent * ) | 233 | void PcmciaManager::paintEvent( QPaintEvent * ) |
234 | { | 234 | { |
235 | QPainter p( this ); | 235 | QPainter p( this ); |
236 | odebug << "sockets = " << OPcmciaSystem::instance()->count() << ", cards = " << OPcmciaSystem::instance()->cardCount() << oendl; | 236 | odebug << "sockets = " << OPcmciaSystem::instance()->count() << ", cards = " << OPcmciaSystem::instance()->cardCount() << oendl; |
237 | 237 | ||
238 | if ( OPcmciaSystem::instance()->cardCount() ) | 238 | if ( OPcmciaSystem::instance()->cardCount() ) |
239 | { | 239 | { |
240 | p.drawPixmap( 0, 0, pm ); | 240 | p.drawPixmap( 0, 0, pm ); |
241 | show(); | 241 | show(); |
@@ -257,12 +257,12 @@ void PcmciaManager::execCommand( const QStringList &strList ) | |||
257 | 257 | ||
258 | void PcmciaManager::userCardAction( int action ) | 258 | void PcmciaManager::userCardAction( int action ) |
259 | { | 259 | { |
260 | odebug << "user action requested. action = " << action << oendl; | 260 | odebug << "user action requested. action = " << action << oendl; |
261 | 261 | ||
262 | int socket = action / 100; | 262 | int socket = action / 100; |
263 | int what = action % 100; | 263 | int what = action % 100; |
264 | 264 | ||
265 | switch ( what ) | 265 | switch ( what ) |
266 | { | 266 | { |
267 | case CONFIGURE: configure( OPcmciaSystem::instance()->socket( socket ) ); break; | 267 | case CONFIGURE: configure( OPcmciaSystem::instance()->socket( socket ) ); break; |
268 | default: odebug << "not yet implemented"; | 268 | default: odebug << "not yet implemented"; |