-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 | |||
@@ -15,59 +15,72 @@ | |||
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "configdialog.h" | 30 | #include "configdialog.h" |
31 | 31 | ||
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 | 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 ); |
54 | QString name = cfg.readEntry( "name" ); | 57 | QString name = cfg.readEntry( "name" ); |
55 | odebug << "comparing card '" << cardname << "' with known card '" << name << "'" << oendl; | 58 | odebug << "comparing card '" << cardname << "' with known card '" << name << "'" << oendl; |
56 | if ( cardname == name ) | 59 | if ( cardname == name ) |
57 | { | 60 | { |
58 | insert = cfg.readEntry( "insert" ); | 61 | insert = cfg.readEntry( "insert" ); |
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 | { |
73 | } | 86 | } |
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 | |||
@@ -15,30 +15,30 @@ | |||
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef CONFIGDIALOG_H | 30 | #ifndef CONFIGDIALOG_H |
31 | #define CONFIGDIALOG_H | 31 | #define CONFIGDIALOG_H |
32 | 32 | ||
33 | #include "configdialogbase.h" | 33 | #include "configdialogbase.h" |
34 | 34 | ||
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 | ||
44 | #endif | 44 | #endif |
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 | |||
@@ -1,92 +1,150 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>ConfigDialogBase</class> | 2 | <class>ConfigDialogBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>ConfigDialogBase</cstring> | 7 | <cstring>ConfigDialogBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
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> |
20 | <string>Configure PCMCIA/CF Card</string> | 20 | <string>Configure PCMCIA/CF Card</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
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> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
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> |
53 | <string>suspend</string> | 64 | <string>suspend</string> |
54 | </property> | 65 | </property> |
55 | </item> | 66 | </item> |
56 | <item> | 67 | <item> |
57 | <property> | 68 | <property> |
58 | <name>text</name> | 69 | <name>text</name> |
59 | <string>activate</string> | 70 | <string>activate</string> |
60 | </property> | 71 | </property> |
61 | </item> | 72 | </item> |
62 | <item> | 73 | <item> |
63 | <property> | 74 | <property> |
64 | <name>text</name> | 75 | <name>text</name> |
65 | <string>eject</string> | 76 | <string>eject</string> |
66 | </property> | 77 | </property> |
67 | </item> | 78 | </item> |
68 | <item> | 79 | <item> |
69 | <property> | 80 | <property> |
70 | <name>text</name> | 81 | <name>text</name> |
71 | <string>prompt for</string> | 82 | <string>prompt for</string> |
72 | </property> | 83 | </property> |
73 | </item> | 84 | </item> |
74 | <property stdset="1"> | 85 | <property stdset="1"> |
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> |
92 | </UI> | 150 | </UI> |
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 | |||
@@ -110,88 +110,88 @@ void PcmciaManager::popupTimeout() | |||
110 | popupMenu->hide(); | 110 | popupMenu->hide(); |
111 | } | 111 | } |
112 | 112 | ||
113 | enum { EJECT, INSERT, SUSPEND, RESUME, CONFIGURE }; | 113 | enum { EJECT, INSERT, SUSPEND, RESUME, CONFIGURE }; |
114 | 114 | ||
115 | void PcmciaManager::mousePressEvent( QMouseEvent* ) | 115 | void PcmciaManager::mousePressEvent( QMouseEvent* ) |
116 | { | 116 | { |
117 | QPopupMenu* menu = new QPopupMenu( this ); | 117 | QPopupMenu* menu = new QPopupMenu( this ); |
118 | QStringList cmd; | 118 | QStringList cmd; |
119 | bool execute = true; | 119 | bool execute = true; |
120 | 120 | ||
121 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 121 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
122 | OPcmciaSystem::CardIterator it = sys->iterator(); | 122 | OPcmciaSystem::CardIterator it = sys->iterator(); |
123 | if ( !sys->count() ) return; | 123 | if ( !sys->count() ) return; |
124 | 124 | ||
125 | int i = 0; | 125 | int i = 0; |
126 | while ( it.current() ) | 126 | while ( it.current() ) |
127 | { | 127 | { |
128 | QPopupMenu* submenu = new QPopupMenu( menu ); | 128 | QPopupMenu* submenu = new QPopupMenu( menu ); |
129 | submenu->insertItem( "&Eject", EJECT+i*100 ); | 129 | submenu->insertItem( "&Eject", EJECT+i*100 ); |
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 | } |
145 | 145 | ||
146 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 146 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
147 | QSize s = menu->sizeHint(); | 147 | QSize s = menu->sizeHint(); |
148 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); | 148 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); |
149 | qDebug( "pcmcia: menu result = %d", opt ); | 149 | qDebug( "pcmcia: menu result = %d", opt ); |
150 | delete menu; | 150 | delete menu; |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | 154 | void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) |
155 | { | 155 | { |
156 | odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; | 156 | odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; |
157 | if ( msg != "stabChanged()" ) return; | 157 | if ( msg != "stabChanged()" ) return; |
158 | 158 | ||
159 | /* check if a previously unknown card has been inserted */ | 159 | /* check if a previously unknown card has been inserted */ |
160 | OPcmciaSystem::instance()->synchronize(); | 160 | OPcmciaSystem::instance()->synchronize(); |
161 | 161 | ||
162 | if ( !OPcmciaSystem::instance()->cardCount() ) return; | 162 | if ( !OPcmciaSystem::instance()->cardCount() ) return; |
163 | 163 | ||
164 | OConfig cfg( "PCMCIA" ); | 164 | OConfig cfg( "PCMCIA" ); |
165 | cfg.setGroup( "Global" ); | 165 | cfg.setGroup( "Global" ); |
166 | int nCards = cfg.readNumEntry( "nCards", 0 ); | 166 | int nCards = cfg.readNumEntry( "nCards", 0 ); |
167 | 167 | ||
168 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 168 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
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 | { |
178 | odebug << "skipping empty card in socket " << it.current()->number() << oendl; | 178 | odebug << "skipping empty card in socket " << it.current()->number() << oendl; |
179 | ++it; | 179 | ++it; |
180 | continue; | 180 | continue; |
181 | } | 181 | } |
182 | else | 182 | else |
183 | { | 183 | { |
184 | OPcmciaSocket* theCard = it.current(); | 184 | OPcmciaSocket* theCard = it.current(); |
185 | QString cardName = theCard->identity(); | 185 | QString cardName = theCard->identity(); |
186 | for ( int i = 0; i < nCards; ++i ) | 186 | for ( int i = 0; i < nCards; ++i ) |
187 | { | 187 | { |
188 | QString cardSection = QString( "Card_%1" ).arg( i ); | 188 | QString cardSection = QString( "Card_%1" ).arg( i ); |
189 | cfg.setGroup( cardSection ); | 189 | cfg.setGroup( cardSection ); |
190 | QString name = cfg.readEntry( "name" ); | 190 | QString name = cfg.readEntry( "name" ); |
191 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; | 191 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; |
192 | if ( cardName == name ) | 192 | if ( cardName == name ) |
193 | { | 193 | { |
194 | newCard = false; | 194 | newCard = false; |
195 | break; | 195 | break; |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -213,69 +213,69 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | |||
213 | tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->identity() ), | 213 | tr( "You have inserted a new card:\n%1\nDo you want to configure?" ).arg( theCard->identity() ), |
214 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); | 214 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); |
215 | odebug << "result = " << result << oendl; | 215 | odebug << "result = " << result << oendl; |
216 | if ( result == 0 ) | 216 | if ( result == 0 ) |
217 | { | 217 | { |
218 | configure( theCard ); | 218 | configure( theCard ); |
219 | } | 219 | } |
220 | else | 220 | else |
221 | { | 221 | { |
222 | odebug << "pcmcia: user doesn't want to configure " << theCard->identity() << " now." << oendl; | 222 | odebug << "pcmcia: user doesn't want to configure " << theCard->identity() << " now." << oendl; |
223 | } | 223 | } |
224 | } | 224 | } |
225 | else | 225 | else |
226 | { | 226 | { |
227 | odebug << "pcmcia: card has been previously inserted" << oendl; | 227 | odebug << "pcmcia: card has been previously inserted" << oendl; |
228 | } | 228 | } |
229 | repaint( true ); | 229 | repaint( true ); |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
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(); |
242 | } | 242 | } |
243 | else | 243 | else |
244 | { | 244 | { |
245 | hide(); | 245 | hide(); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | int PcmciaManager::position() | 249 | int PcmciaManager::position() |
250 | { | 250 | { |
251 | return 7; | 251 | return 7; |
252 | } | 252 | } |
253 | 253 | ||
254 | void PcmciaManager::execCommand( const QStringList &strList ) | 254 | void PcmciaManager::execCommand( const QStringList &strList ) |
255 | { | 255 | { |
256 | } | 256 | } |
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"; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | void PcmciaManager::configure( OPcmciaSocket* card ) | 272 | void PcmciaManager::configure( OPcmciaSocket* card ) |
273 | { | 273 | { |
274 | ConfigDialog dialog( card->identity(), qApp->desktop() ); | 274 | ConfigDialog dialog( card->identity(), qApp->desktop() ); |
275 | int configresult = dialog.exec(); | 275 | int configresult = dialog.exec(); |
276 | odebug << "pcmcia: configresult = " << configresult << oendl; | 276 | odebug << "pcmcia: configresult = " << configresult << oendl; |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | EXPORT_OPIE_APPLET_v1( PcmciaManager ) | 280 | EXPORT_OPIE_APPLET_v1( PcmciaManager ) |
281 | 281 | ||