author | mickeyl <mickeyl> | 2005-06-26 12:02:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-26 12:02:40 (UTC) |
commit | d5a2b0d5ca4daa11894c52f3599dab56205bef4c (patch) (unidiff) | |
tree | 590d9ba11f3999e4c2b2ebd353ea49af552d9d12 | |
parent | 790aeb8898d635468c2b9e24fd16a70aab64b1dd (diff) | |
download | opie-d5a2b0d5ca4daa11894c52f3599dab56205bef4c.zip opie-d5a2b0d5ca4daa11894c52f3599dab56205bef4c.tar.gz opie-d5a2b0d5ca4daa11894c52f3599dab56205bef4c.tar.bz2 |
- refactor miscellaneous things to make configuring work all the time
- add 'prompt for' dialog
- applet completion state 100% for Version 1.2.1
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | noncore/applets/pcmcia/configdialog.cpp | 115 | ||||
-rw-r--r-- | noncore/applets/pcmcia/configdialog.h | 4 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 114 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.h | 2 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.pro | 6 | ||||
-rw-r--r-- | noncore/applets/pcmcia/promptactiondialog.ui | 58 |
7 files changed, 198 insertions, 102 deletions
@@ -1,111 +1,112 @@ | |||
1 | 2005-??-??Opie 1.2.1 | 1 | 2005-??-??Opie 1.2.1 |
2 | 2 | ||
3 | 3 | ||
4 | New Features | 4 | New Features |
5 | ------------ | 5 | ------------ |
6 | * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) | 6 | * OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker) |
7 | * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) | 7 | * Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly) |
8 | * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) | 8 | * Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer) |
9 | * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) | 9 | * Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl) |
10 | * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl) | 10 | * Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl) |
11 | * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl) | 11 | * Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl) |
12 | * Checkbook - added configuration option to use smaller font for checkbook transaction tab (hrw) | 12 | * Checkbook - added configuration option to use smaller font for checkbook transaction tab (hrw) |
13 | * ZSafe - make UI conform to Opie standards (drw) | 13 | * ZSafe - make UI conform to Opie standards (drw) |
14 | * Today Addressbook plugin - fix configuration to show/not show birthdays, use checkboxes for selection (hrw) | 14 | * Today Addressbook plugin - fix configuration to show/not show birthdays, use checkboxes for selection (hrw) |
15 | * Opie-Console: read initial fixed font configuration from qpe.conf (mickeyl) | 15 | * Opie-Console: read initial fixed font configuration from qpe.conf (mickeyl) |
16 | * Opie-PcmciaApplet: card monitoring applet lets you configure insert/resume actions and bind unsupported cards (mickeyl) | ||
16 | 17 | ||
17 | Fixed Bugs | 18 | Fixed Bugs |
18 | ---------- | 19 | ---------- |
19 | * #1377 - Suspend Powermanagement when switched to another VT (mickeyl) | 20 | * #1377 - Suspend Powermanagement when switched to another VT (mickeyl) |
20 | - We actually suspend the complete Opie now in that case. | 21 | - We actually suspend the complete Opie now in that case. |
21 | * #1384 - Battery status updated improperly when charging (skyhusker) | 22 | * #1384 - Battery status updated improperly when charging (skyhusker) |
22 | * #1476 - Wrong order of application entries in the O-menu (skyhusker) | 23 | * #1476 - Wrong order of application entries in the O-menu (skyhusker) |
23 | * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl) | 24 | * #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl) |
24 | * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) | 25 | * #1535- Missing line break and unnecessary location shown with Today-Calendar plugin (deller) |
25 | * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker) | 26 | * #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker) |
26 | * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker) | 27 | * #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker) |
27 | * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) | 28 | * #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller) |
28 | * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) | 29 | * #1614 - Make Opie-console start in $HOME instead of / (skyhusker) |
29 | * #1635 - opie-today, datebook-plugin does not show notes (skyhusker) | 30 | * #1635 - opie-today, datebook-plugin does not show notes (skyhusker) |
30 | * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker) | 31 | * #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker) |
31 | * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker) | 32 | * #1666 - Opie-IRC does not allow to add !channels in config asautojoin ones (skyhusker) |
32 | * #1667 - Opie-IRC does not show messages from !channel (skyhusker) | 33 | * #1667 - Opie-IRC does not show messages from !channel (skyhusker) |
33 | * n.a.- always show volume and wireless applet popups inside visible screen (deller) | 34 | * n.a.- always show volume and wireless applet popups inside visible screen (deller) |
34 | * n.a. - scale O-Menu-Applets appropriately (mickeyl) | 35 | * n.a. - scale O-Menu-Applets appropriately (mickeyl) |
35 | * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) | 36 | * n.a.- libopienet: fix bugs in wireless scanning and setting SSID (skyhusker) |
36 | * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) | 37 | * n.a.- Wellenreiter: relax WE version matching test a bit (mickeyl) |
37 | * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) | 38 | * n.a.- scale BluezApplet appropriately and use larger icons (mickeyl) |
38 | * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) | 39 | * n.a.- memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham) |
39 | * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) | 40 | * n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl) |
40 | * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw) | 41 | * n.a. - Today Addressbook plugin fix configuration to show/not show birthdays, use checkboxes for selection (hrw) |
41 | 42 | ||
42 | Internal | 43 | Internal |
43 | -------- | 44 | -------- |
44 | * Make BluezApplet use OTaskbarApplet (mickeyl) | 45 | * Make BluezApplet use OTaskbarApplet (mickeyl) |
45 | * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl) | 46 | * libopiecore: rewrite OFileNotification to use the Linux 2.6 inotify interface (mickeyl) |
46 | * libopiecore: add ODirNotification - recursive directory notifications (mickeyl) | 47 | * libopiecore: add ODirNotification - recursive directory notifications (mickeyl) |
47 | * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) | 48 | * libopienet: Skip hostap control interfaces 'wifi' and improve robustness in ONetworkInterface (mickeyl) |
48 | * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) | 49 | * libopieui: Remove OVersatileView and OVersatileViewItem (mickeyl) |
49 | * libopienet: Miscellaneous API cleanups (mickeyl) | 50 | * libopienet: Miscellaneous API cleanups (mickeyl) |
50 | * libopiecore: Add linux pcmcia system abstraction classes (mickeyl) | 51 | * libopiecore: Add linux pcmcia system abstraction classes (mickeyl) |
51 | 52 | ||
52 | 2005-03-25Opie 1.2.0 | 53 | 2005-03-25Opie 1.2.0 |
53 | 54 | ||
54 | Fixed Bugs | 55 | Fixed Bugs |
55 | ---------- | 56 | ---------- |
56 | * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) | 57 | * #1613 - AdvancedFM - scale toolbar icons appropriately (drw) |
57 | * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) | 58 | * #1620 - OFileSelector - show the button on press and not on press on hold (alwin) |
58 | * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) | 59 | * #1473 - Opie-Eye - Same as #1620 but we lack a common FileSystem Button class (zecke) |
59 | * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) | 60 | * n.a. - PackageManager - fix bug where messages show up multiple times in install dialog (drw) |
60 | * n.a.- make qpeglobal.h include qglobal.h (zecke) | 61 | * n.a.- make qpeglobal.h include qglobal.h (zecke) |
61 | 62 | ||
62 | 2005-03-20Opie 1.2.0-rc1 | 63 | 2005-03-20Opie 1.2.0-rc1 |
63 | 64 | ||
64 | 65 | ||
65 | New Features | 66 | New Features |
66 | ------------ | 67 | ------------ |
67 | * Launcher: Support a static background pixmap (mickeyl) | 68 | * Launcher: Support a static background pixmap (mickeyl) |
68 | * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) | 69 | * LauncherSettings: Choose whether to have a static background pixmap (mickeyl) |
69 | * PackageManager supports the 'lists_dir' ipkg configuration option (drw) | 70 | * PackageManager supports the 'lists_dir' ipkg configuration option (drw) |
70 | * Added hi-res inline images for large resolution devices (drw) | 71 | * Added hi-res inline images for large resolution devices (drw) |
71 | * Improved launcher icons for consistency (ar) | 72 | * Improved launcher icons for consistency (ar) |
72 | * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) | 73 | * Datebook: Added plugin system to datebook so holidays and birthdays from contacts may displayed in datebook (alwin) |
73 | 74 | ||
74 | Fixed Bugs | 75 | Fixed Bugs |
75 | ---------- | 76 | ---------- |
76 | * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) | 77 | * #1236 - VCards contained empty home and work address entries causing Palms to crash (eilers) |
77 | * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) | 78 | * #1412 - Launcher Settings - fixed default settings for background in Edit tab dialog (drw) |
78 | * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) | 79 | * #1472 - Opie textedit now check for unsaved changes on ESC key (ljp) |
79 | * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) | 80 | * #1474 - Implement GUI for Scrollbars on the Left in Appearance (zecke) |
80 | * #1482 - Fix double '/' in paths (zecke) | 81 | * #1482 - Fix double '/' in paths (zecke) |
81 | * #1536 - Autosave of custom locations in opie backup (ar) | 82 | * #1536 - Autosave of custom locations in opie backup (ar) |
82 | * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) | 83 | * #1539 - Fixed displaying too long path in the delete dialog in opie-eye (zecke) |
83 | * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) | 84 | * #1540 - Implemented deletion of DocLnks in opie-eye (zecke) |
84 | * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) | 85 | * #1542 - Fixed Todo crash when priority < 1 or > 5 (drw) |
85 | * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) | 86 | * #1550 - Browse for alarm sound start in QPEDIR/sounds/ (zecke) |
86 | * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) | 87 | * #1554 - Fixed Opie-Console name in .desktop file (mickeyl) |
87 | * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) | 88 | * #1556 - Start to look for sound files in /opt/QtPalmtop/sounds (zecke) |
88 | * #1558 - Fixed opie-login breaking opie startup (mickeyl) | 89 | * #1558 - Fixed opie-login breaking opie startup (mickeyl) |
89 | * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) | 90 | * #1560 - Fixed Opie-Console picking up the wrong shell (bluelightning) |
90 | * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) | 91 | * #1570 - Confirmation needed befor Restore a backup and overwrite local data (ar) |
91 | * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) | 92 | * #1591 - Addressbook sortorder changed by clicking on column 0 (eilers) |
92 | * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) | 93 | * #1599 - Security - change recommendation for opie-multiauth to opie-securityplugin (gints) |
93 | * #1604 - Checkbook crashed on startup (drw) | 94 | * #1604 - Checkbook crashed on startup (drw) |
94 | * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) | 95 | * #1608 - Addressbook crashed after search, which may caused by not initialzed member variable (eilers) |
95 | * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers) | 96 | * #1608 - QueryByExampe-Datediff on SQL database did not worked properly (eilers) |
96 | * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw) | 97 | * n.a. - Netsystemtime - fixed UI to prevent error dialog from displaying when it shouldn't, get rid of some compiler warnings (drw) |
97 | * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) | 98 | * n.a. - PackageManager - fixed where last package in status file was not shown as installed when it should be (drw) |
98 | * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw) | 99 | * n.a. - PackageManager - fixed bug where lists_dir was not being honored at startup (drw) |
99 | * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw) | 100 | * n.a. - PackageManager - provided default value for lists_dir when none is entered in configuration dialog (drw) |
100 | * n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw) | 101 | * n.a. - OTabWidget - fixed scroll buttons, fix display position of tabs (drw) |
101 | * n.a. - AddressBook - fixed sorting by 'File As' name (drw) | 102 | * n.a. - AddressBook - fixed sorting by 'File As' name (drw) |
102 | * n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers) | 103 | * n.a. - AddressBook - fixed category handling for 'All' and 'Unfiled' (eilers) |
103 | * n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw) | 104 | * n.a. - AddressBook - fixed letter picker record selection and sort records afterwards (drw) |
104 | 105 | ||
105 | Internal | 106 | Internal |
106 | -------- | 107 | -------- |
107 | * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) | 108 | * Worked around bug in Qt/Embedded 2.3.10: qt_version() returns 231 (mickeyl) |
108 | * Killed the need for weak symbols in QtE (zecke) | 109 | * Killed the need for weak symbols in QtE (zecke) |
109 | * Added optional building libqpe without inline images (mickeyl) | 110 | * Added optional building libqpe without inline images (mickeyl) |
110 | * OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw) | 111 | * OColorButton - fixed so does not emit a colorSelected signal inside of resizeEvent (drw) |
111 | 112 | ||
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp index 3b1b40c..010d691 100644 --- a/noncore/applets/pcmcia/configdialog.cpp +++ b/noncore/applets/pcmcia/configdialog.cpp | |||
@@ -1,179 +1,238 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
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 | #include <opie2/opcmciasystem.h> | 35 | #include <opie2/opcmciasystem.h> |
36 | #include <qpe/global.h> | ||
36 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
37 | 38 | ||
38 | /* QT */ | 39 | /* QT */ |
39 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
40 | #include <qdir.h> | 41 | #include <qdir.h> |
41 | #include <qfile.h> | 42 | #include <qfile.h> |
42 | #include <qgroupbox.h> | 43 | #include <qgroupbox.h> |
43 | #include <qlabel.h> | 44 | #include <qlabel.h> |
44 | #include <qtextstream.h> | 45 | #include <qtextstream.h> |
45 | 46 | ||
47 | /* STD */ | ||
48 | #include <errno.h> | ||
49 | #include <string.h> | ||
50 | |||
46 | ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) | 51 | ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) |
47 | :ConfigDialogBase( parent, "pcmcia config dialog", true ) | 52 | :ConfigDialogBase( parent, "pcmcia config dialog", true ) |
48 | { | 53 | { |
49 | gbDetails->setTitle( QString( "Details for card in socket #%1" ).arg( card->number() ) ); | 54 | gbDetails->setTitle( QString( "Details for card in socket #%1" ).arg( card->number() ) ); |
50 | txtCardName->setText( card->productIdentity() ); | 55 | txtCardName->setText( card->productIdentity() ); |
51 | txtManfid->setText( card->manufacturerIdentity() ); | 56 | txtManfid->setText( card->manufacturerIdentity() ); |
52 | txtFunction->setText( card->function() ); | 57 | txtFunction->setText( card->function() ); |
53 | 58 | ||
54 | QString insertAction = preferredAction( card, "insert" ); | 59 | QString insertAction = preferredAction( card, "insert" ); |
55 | QString resumeAction = preferredAction( card, "resume" ); | 60 | QString resumeAction = preferredAction( card, "resume" ); |
56 | 61 | ||
57 | odebug << "pcmcia: preferred insertion action for card '" << card->productIdentity() << "' seems to be '" << insertAction << "'" << oendl; | 62 | odebug << "pcmcia: preferred insertion action for card '" << card->productIdentity() << "' seems to be '" << insertAction << "'" << oendl; |
58 | odebug << "pcmcia: preferred resume action for card '" << card->productIdentity() << "' seems to be '" << resumeAction << "'" << oendl; | 63 | odebug << "pcmcia: preferred resume action for card '" << card->productIdentity() << "' seems to be '" << resumeAction << "'" << oendl; |
59 | 64 | ||
60 | if ( !insertAction.isEmpty() ) | 65 | if ( !insertAction.isEmpty() ) |
61 | { | 66 | { |
62 | for ( int i; i < cbInsertAction->count(); ++i ) | 67 | for ( unsigned int i = 0; i < cbInsertAction->count(); ++i ) |
63 | if ( cbInsertAction->text( i ) == insertAction ) cbInsertAction->setCurrentItem( i ); | 68 | if ( cbInsertAction->text( i ) == insertAction ) cbInsertAction->setCurrentItem( i ); |
64 | } | 69 | } |
65 | 70 | ||
66 | if ( !resumeAction.isEmpty() ) | 71 | if ( !resumeAction.isEmpty() ) |
67 | { | 72 | { |
68 | for ( int i; i < cbResumeAction->count(); ++i ) | 73 | for ( unsigned int i = 0; i < cbResumeAction->count(); ++i ) |
69 | if ( cbResumeAction->text( i ) == resumeAction ) cbResumeAction->setCurrentItem( i ); | 74 | if ( cbResumeAction->text( i ) == resumeAction ) cbResumeAction->setCurrentItem( i ); |
70 | } | 75 | } |
71 | 76 | ||
72 | if ( !card->isUnsupported() ) | 77 | if ( !card->isUnsupported() ) |
73 | { | 78 | { |
74 | odebug << "pcmcia: card is recognized - hiding bindings" << oendl; | 79 | odebug << "pcmcia: card is recognized - hiding bindings" << oendl; |
75 | textInfo->hide(); | 80 | textInfo->hide(); |
76 | textBindTo->hide(); | 81 | textBindTo->hide(); |
77 | cbBindTo->hide(); | 82 | cbBindTo->hide(); |
78 | return; | 83 | return; |
79 | } | 84 | } |
80 | else | 85 | else |
81 | { | 86 | { |
82 | odebug << "card is unsupported yet - showing possible bindings" << oendl; | 87 | odebug << "card is unsupported yet - showing possible bindings" << oendl; |
83 | textInfo->show(); | 88 | textInfo->show(); |
84 | textBindTo->show(); | 89 | textBindTo->show(); |
85 | cbBindTo->show(); | 90 | cbBindTo->show(); |
86 | } | 91 | } |
87 | 92 | ||
88 | // parse possible bind entries out of /etc/pcmcia/*.conf | 93 | // parse possible bind entries out of /etc/pcmcia/*.conf |
89 | QDir pcmciaconfdir( "/etc/pcmcia", "*.conf" ); | 94 | QDir pcmciaconfdir( "/etc/pcmcia", "*.conf" ); |
90 | 95 | ||
91 | for ( unsigned int i = 0; i < pcmciaconfdir.count(); ++i ) | 96 | for ( unsigned int i = 0; i < pcmciaconfdir.count(); ++i ) |
92 | { | 97 | { |
93 | odebug << "processing conf file '" << pcmciaconfdir[i] << "'" << oendl; | 98 | odebug << "processing conf file '" << pcmciaconfdir[i] << "'" << oendl; |
94 | QString conffilename = QString( "%1/%2" ).arg( pcmciaconfdir.absPath() ).arg( pcmciaconfdir[i] ); | 99 | QString conffilename = QString( "%1/%2" ).arg( pcmciaconfdir.absPath() ).arg( pcmciaconfdir[i] ); |
95 | QFile conffile( conffilename ); | 100 | QFile conffile( conffilename ); |
96 | if ( conffile.open( IO_ReadOnly ) ) | 101 | if ( conffile.open( IO_ReadOnly ) ) |
97 | { | 102 | { |
98 | QTextStream ts( &conffile ); | 103 | QTextStream ts( &conffile ); |
99 | while ( !ts.atEnd() ) | 104 | while ( !ts.atEnd() ) |
100 | { | 105 | { |
101 | QString word; | 106 | QString word; |
102 | ts >> word; | 107 | ts >> word; |
103 | if ( word == "bind" ) | 108 | if ( word == "bind" ) |
104 | { | 109 | { |
105 | word = ts.readLine(); | 110 | word = ts.readLine(); |
106 | bindEntries[ word.stripWhiteSpace() ] = conffilename; | 111 | bindEntries[ word.stripWhiteSpace() ] = conffilename; |
107 | continue; | 112 | continue; |
108 | } | 113 | } |
109 | ts.readLine(); | 114 | ts.readLine(); |
110 | } | 115 | } |
111 | } | 116 | } |
112 | else | 117 | else |
113 | { | 118 | { |
114 | owarn << "couldn't open '" << conffile.name() << "' for reading" << oendl; | 119 | owarn << "couldn't open '" << conffile.name() << "' for reading" << oendl; |
115 | continue; | 120 | continue; |
116 | } | 121 | } |
117 | } | 122 | } |
118 | 123 | ||
119 | for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it ) | 124 | for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it ) |
120 | { | 125 | { |
121 | odebug << "found binding '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; | 126 | odebug << "found binding '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; |
122 | cbBindTo->insertItem( it.key() ); | 127 | cbBindTo->insertItem( it.key() ); |
123 | } | 128 | } |
124 | } | 129 | } |
125 | 130 | ||
126 | ConfigDialog::~ConfigDialog() | 131 | ConfigDialog::~ConfigDialog() |
127 | { | 132 | { |
128 | } | 133 | } |
129 | 134 | ||
130 | void ConfigDialog::writeConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& value ) | 135 | void ConfigDialog::writeConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& value ) |
131 | { | 136 | { |
132 | OConfig cfg( "PCMCIA" ); | 137 | OConfig* cfg = cardConfig( card ); |
133 | cfg.setGroup( "Global" ); | 138 | if ( cfg ) |
134 | int nCards = cfg.readNumEntry( "nCards", 0 ); | ||
135 | QString cardName = card->productIdentity(); | ||
136 | QString action; | ||
137 | |||
138 | for ( int i = 0; i < nCards; ++i ) | ||
139 | { | 139 | { |
140 | QString cardSection = QString( "Card_%1" ).arg( i ); | 140 | cfg->writeEntry( key, value ); |
141 | cfg.setGroup( cardSection ); | ||
142 | QString name = cfg.readEntry( "name" ); | ||
143 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; | ||
144 | if ( cardName == name ) | ||
145 | { | ||
146 | cfg.writeEntry( key, value ); | ||
147 | break; | ||
148 | } | ||
149 | } | 141 | } |
142 | delete cfg; // deleting a 0 pointer is within spec. | ||
150 | } | 143 | } |
151 | 144 | ||
152 | QString ConfigDialog::readConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& defaultValue ) | 145 | QString ConfigDialog::readConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& defaultValue ) |
153 | { | 146 | { |
154 | OConfig cfg( "PCMCIA" ); | ||
155 | cfg.setGroup( "Global" ); | ||
156 | int nCards = cfg.readNumEntry( "nCards", 0 ); | ||
157 | QString cardName = card->productIdentity(); | ||
158 | QString value; | 147 | QString value; |
148 | OConfig* cfg = cardConfig( card ); | ||
149 | if ( cfg ) | ||
150 | { | ||
151 | value = cfg->readEntry( key, defaultValue ); | ||
152 | } | ||
153 | delete cfg; // deleting a 0 pointer is within spec. | ||
154 | return value; | ||
155 | } | ||
156 | |||
157 | |||
158 | QString ConfigDialog::preferredAction( const OPcmciaSocket* card, const QString& type ) | ||
159 | { | ||
160 | return ConfigDialog::readConfigEntry( card, QString( "%1Action" ).arg( type ), "suspend" ); | ||
161 | } | ||
162 | |||
163 | |||
164 | OConfig* ConfigDialog::cardConfig( const OPcmciaSocket* card ) | ||
165 | { | ||
166 | OConfig* cardcfg = 0; | ||
167 | OConfig* cfg = new OConfig( "PCMCIA" ); | ||
168 | cfg->setGroup( "Global" ); | ||
169 | int nCards = cfg->readNumEntry( "nCards", 0 ); | ||
170 | QString cardName = card->productIdentity(); | ||
159 | 171 | ||
160 | for ( int i = 0; i < nCards; ++i ) | 172 | for ( int i = 0; i < nCards; ++i ) |
161 | { | 173 | { |
162 | QString cardSection = QString( "Card_%1" ).arg( i ); | 174 | QString cardSection = QString( "Card_%1" ).arg( i ); |
163 | cfg.setGroup( cardSection ); | 175 | cfg->setGroup( cardSection ); |
164 | QString name = cfg.readEntry( "name" ); | 176 | QString name = cfg->readEntry( "name" ); |
165 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; | 177 | odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl; |
166 | if ( cardName == name ) | 178 | if ( cardName == name ) |
167 | { | 179 | { |
168 | value = cfg.readEntry( key, defaultValue ); | 180 | cardcfg = cfg; |
169 | break; | 181 | break; |
170 | } | 182 | } |
171 | } | 183 | } |
172 | return value; | 184 | return cardcfg; |
173 | } | 185 | } |
174 | 186 | ||
175 | 187 | ||
176 | QString ConfigDialog::preferredAction( const OPcmciaSocket* card, const QString& type ) | 188 | void ConfigDialog::writeConfiguration( const OPcmciaSocket* card ) |
177 | { | 189 | { |
178 | return ConfigDialog::readConfigEntry( card, QString( "%1Action" ).arg( type ), "suspend" ); | 190 | odebug << "pcmcia: ConfigDialog::writeConfiguration()" << oendl; |
191 | OConfig* cfg = cardConfig( card ); | ||
192 | if ( !cfg ) | ||
193 | { | ||
194 | cfg = new OConfig( "PCMCIA" ); | ||
195 | cfg->setGroup( "Global" ); | ||
196 | int nCards = cfg->readNumEntry( "nCards", 0 ); | ||
197 | cfg->setGroup( QString( "Card_%1" ).arg( nCards ) ); | ||
198 | cfg->writeEntry( "name", card->productIdentity() ); | ||
199 | cfg->setGroup( "Global" ); | ||
200 | cfg->writeEntry( "nCards", nCards+1 ); | ||
201 | cfg->setGroup( QString( "Card_%1" ).arg( nCards ) ); | ||
202 | } | ||
203 | |||
204 | cfg->writeEntry( "insertAction", cbInsertAction->currentText() ); | ||
205 | cfg->writeEntry( "resumeAction", cbResumeAction->currentText() ); | ||
206 | cfg->write(); | ||
207 | |||
208 | if ( cbBindTo->isVisible() && cbBindTo->currentText() != "<None>" ) | ||
209 | { | ||
210 | QString driver = cbBindTo->currentText(); | ||
211 | QString conf = bindEntries[driver]; | ||
212 | |||
213 | // write binding | ||
214 | |||
215 | QFile confFile( conf ); | ||
216 | if ( confFile.open( IO_ReadWrite | IO_Append ) ) | ||
217 | { | ||
218 | QString entryCard = QString( "card \"%1\"" ).arg( card->productIdentity() ); | ||
219 | QString entryVersion( " version " ); | ||
220 | for ( QStringList::Iterator it = card->productIdentityVector().begin(); it != card->productIdentityVector().end(); ++it ) | ||
221 | { | ||
222 | entryVersion += QString( "\"%1\", " ).arg( *it ); | ||
223 | } | ||
224 | QString entryBind = QString( " bind %1" ).arg( driver ); | ||
225 | QString entry = QString( "\n%1\n%2\n%3\n" ).arg( entryCard ).arg( entryVersion ).arg( entryBind ); | ||
226 | odebug << "pcmcia: writing entry...:" << entry << oendl; | ||
227 | |||
228 | confFile.writeBlock( (const char*) entry, entry.length() ); | ||
229 | Global::statusMessage( "restarting pcmcia services..." ); | ||
230 | OPcmciaSystem::instance()->restart(); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | owarn << "pcmcia: couldn't write binding to '" << conf << "' ( " << strerror( errno ) << " )." << oendl; | ||
235 | } | ||
236 | } | ||
179 | } | 237 | } |
238 | |||
diff --git a/noncore/applets/pcmcia/configdialog.h b/noncore/applets/pcmcia/configdialog.h index 169dadb..eb081a1 100644 --- a/noncore/applets/pcmcia/configdialog.h +++ b/noncore/applets/pcmcia/configdialog.h | |||
@@ -1,51 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
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 | namespace Opie { namespace Core { class OPcmciaSocket; }; }; | 35 | namespace Opie { namespace Core { class OPcmciaSocket; class OConfig; }; }; |
36 | 36 | ||
37 | typedef QMap<QString,QString> StringMap; | 37 | typedef QMap<QString,QString> StringMap; |
38 | 38 | ||
39 | class ConfigDialog : public ConfigDialogBase | 39 | class ConfigDialog : public ConfigDialogBase |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | ConfigDialog( const Opie::Core::OPcmciaSocket* card, QWidget* parent ); | 43 | ConfigDialog( const Opie::Core::OPcmciaSocket* card, QWidget* parent ); |
44 | ~ConfigDialog(); | 44 | ~ConfigDialog(); |
45 | static QString preferredAction( const Opie::Core::OPcmciaSocket* card, const QString& type ); | 45 | static QString preferredAction( const Opie::Core::OPcmciaSocket* card, const QString& type ); |
46 | static QString readConfigEntry( const Opie::Core::OPcmciaSocket* card, const QString& key, const QString& defaultValue ); | 46 | static QString readConfigEntry( const Opie::Core::OPcmciaSocket* card, const QString& key, const QString& defaultValue ); |
47 | static void writeConfigEntry( const Opie::Core::OPcmciaSocket* card, const QString& key, const QString& value ); | 47 | static void writeConfigEntry( const Opie::Core::OPcmciaSocket* card, const QString& key, const QString& value ); |
48 | static Opie::Core::OConfig* cardConfig( const Opie::Core::OPcmciaSocket* card ); | ||
49 | void writeConfiguration( const Opie::Core::OPcmciaSocket* card ); | ||
48 | StringMap bindEntries; | 50 | StringMap bindEntries; |
49 | }; | 51 | }; |
50 | 52 | ||
51 | #endif | 53 | #endif |
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index c6386cb..187adc6 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp | |||
@@ -1,394 +1,368 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
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 "pcmcia.h" | 30 | #include "pcmcia.h" |
31 | #include "configdialog.h" | 31 | #include "configdialog.h" |
32 | #include "promptactiondialog.h" | ||
32 | 33 | ||
33 | /* OPIE */ | 34 | /* OPIE */ |
34 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
35 | #include <opie2/odevice.h> | 36 | #include <opie2/odevice.h> |
36 | #include <opie2/oconfig.h> | 37 | #include <opie2/oconfig.h> |
37 | #include <opie2/oprocess.h> | 38 | #include <opie2/oprocess.h> |
38 | #include <opie2/opcmciasystem.h> | 39 | #include <opie2/opcmciasystem.h> |
39 | #include <opie2/oresource.h> | 40 | #include <opie2/oresource.h> |
40 | #include <opie2/otaskbarapplet.h> | 41 | #include <opie2/otaskbarapplet.h> |
41 | #include <qpe/applnk.h> | 42 | #include <qpe/applnk.h> |
42 | #include <qpe/global.h> | 43 | #include <qpe/global.h> |
43 | #include <qpe/resource.h> | 44 | #include <qpe/resource.h> |
44 | using namespace Opie::Core; | 45 | using namespace Opie::Core; |
45 | using namespace Opie::Ui; | 46 | using namespace Opie::Ui; |
46 | 47 | ||
47 | /* QT */ | 48 | /* QT */ |
48 | #include <qcombobox.h> | 49 | #include <qcombobox.h> |
49 | #include <qcopchannel_qws.h> | 50 | #include <qcopchannel_qws.h> |
50 | #include <qpainter.h> | 51 | #include <qpainter.h> |
51 | #include <qfile.h> | 52 | #include <qfile.h> |
52 | #include <qtextstream.h> | 53 | #include <qtextstream.h> |
53 | #include <qmessagebox.h> | 54 | #include <qmessagebox.h> |
54 | #include <qsound.h> | 55 | #include <qsound.h> |
55 | #include <qtimer.h> | 56 | #include <qtimer.h> |
56 | 57 | ||
57 | /* STD */ | 58 | /* STD */ |
58 | #include <stdio.h> | 59 | #include <stdio.h> |
59 | #include <unistd.h> | 60 | #include <unistd.h> |
60 | #include <stdlib.h> | 61 | #include <stdlib.h> |
61 | #include <string.h> | 62 | #include <string.h> |
62 | #include <errno.h> | 63 | #include <errno.h> |
63 | #include <fcntl.h> | 64 | #include <fcntl.h> |
64 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 65 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
65 | #include <sys/vfs.h> | 66 | #include <sys/vfs.h> |
66 | #include <mntent.h> | 67 | #include <mntent.h> |
67 | #endif | 68 | #endif |
68 | 69 | ||
69 | PcmciaManager::PcmciaManager( QWidget * parent ) : QWidget( parent ), popupMenu( 0 ) | 70 | PcmciaManager::PcmciaManager( QWidget * parent ) : QWidget( parent ), popupMenu( 0 ) |
70 | { | 71 | { |
71 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); | 72 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); |
72 | connect( pcmciaChannel, | 73 | connect( pcmciaChannel, |
73 | SIGNAL( received(const QCString&,const QByteArray&) ), this, | 74 | SIGNAL( received(const QCString&,const QByteArray&) ), this, |
74 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); | 75 | SLOT( cardMessage(const QCString&,const QByteArray&) ) ); |
75 | 76 | ||
76 | setFocusPolicy( NoFocus ); | 77 | setFocusPolicy( NoFocus ); |
77 | setFixedWidth ( AppLnk::smallIconSize() ); | 78 | setFixedWidth ( AppLnk::smallIconSize() ); |
78 | setFixedHeight ( AppLnk::smallIconSize() ); | 79 | setFixedHeight ( AppLnk::smallIconSize() ); |
79 | pm = Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ); | 80 | pm = Opie::Core::OResource::loadPixmap( "pcmcia", Opie::Core::OResource::SmallIcon ); |
80 | configuring = false; | 81 | configuring = false; |
81 | 82 | ||
82 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 83 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
83 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), | 84 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
84 | this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) ); | 85 | this, SLOT(handleSystemChannel(const QCString&,const QByteArray&)) ); |
85 | } | 86 | } |
86 | 87 | ||
87 | 88 | ||
88 | PcmciaManager::~PcmciaManager() | 89 | PcmciaManager::~PcmciaManager() |
89 | { | 90 | { |
90 | } | 91 | } |
91 | 92 | ||
92 | void PcmciaManager::handleSystemChannel( const QCString&msg, const QByteArray& ) | 93 | void PcmciaManager::handleSystemChannel( const QCString&msg, const QByteArray& ) |
93 | { | 94 | { |
94 | if ( msg == "returnFromSuspend()" ) | 95 | if ( msg == "returnFromSuspend()" ) |
95 | { | 96 | { |
96 | if ( !OPcmciaSystem::instance()->cardCount() ) return; | 97 | if ( !OPcmciaSystem::instance()->cardCount() ) return; |
97 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 98 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
98 | OPcmciaSystem::CardIterator it = sys->iterator(); | 99 | OPcmciaSystem::CardIterator it = sys->iterator(); |
99 | 100 | ||
100 | while ( it.current() ) | 101 | while ( it.current() ) |
101 | { | 102 | { |
102 | if ( !it.current()->isEmpty() ) | 103 | if ( !it.current()->isEmpty() ) |
103 | { | 104 | { |
104 | executeAction( it.current(), "resume" ); | 105 | executeAction( it.current(), "resume" ); |
105 | } | 106 | } |
106 | ++it; | 107 | ++it; |
107 | } | 108 | } |
108 | } | 109 | } |
109 | } | 110 | } |
110 | 111 | ||
111 | void PcmciaManager::popUp( QString message, QString icon ) | 112 | void PcmciaManager::popUp( QString message, QString icon ) |
112 | { | 113 | { |
113 | if ( !popupMenu) | 114 | if ( !popupMenu) |
114 | { | 115 | { |
115 | popupMenu = new QPopupMenu( this ); | 116 | popupMenu = new QPopupMenu( this ); |
116 | popupMenu->setFocusPolicy( QWidget::NoFocus ); | 117 | popupMenu->setFocusPolicy( QWidget::NoFocus ); |
117 | } | 118 | } |
118 | popupMenu->clear(); | 119 | popupMenu->clear(); |
119 | 120 | ||
120 | if ( icon.isEmpty() ) { | 121 | if ( icon.isEmpty() ) { |
121 | popupMenu->insertItem( message, 0 ); | 122 | popupMenu->insertItem( message, 0 ); |
122 | } else { | 123 | } else { |
123 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), | 124 | popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ), |
124 | message, 0 ); | 125 | message, 0 ); |
125 | } | 126 | } |
126 | 127 | ||
127 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 128 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
128 | QSize s = popupMenu->sizeHint(); | 129 | QSize s = popupMenu->sizeHint(); |
129 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), | 130 | popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), |
130 | p.y() - s.height() ), 0 ); | 131 | p.y() - s.height() ), 0 ); |
131 | 132 | ||
132 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); | 133 | QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) ); |
133 | } | 134 | } |
134 | 135 | ||
135 | 136 | ||
136 | void PcmciaManager::popupTimeout() | 137 | void PcmciaManager::popupTimeout() |
137 | { | 138 | { |
138 | popupMenu->hide(); | 139 | popupMenu->hide(); |
139 | } | 140 | } |
140 | 141 | ||
141 | enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE }; | 142 | enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE, ACTIVATE }; |
142 | static const char* actionText[] = { "eject", "insert", "suspend", "resum", "resett", "configur" }; | 143 | static const char* actionText[] = { "eject", "insert", "suspend", "resum", "resett", "configur", "activat" }; |
143 | 144 | ||
144 | void PcmciaManager::mousePressEvent( QMouseEvent* ) | 145 | void PcmciaManager::mousePressEvent( QMouseEvent* ) |
145 | { | 146 | { |
146 | QPopupMenu* menu = new QPopupMenu( this ); | 147 | QPopupMenu* menu = new QPopupMenu( this ); |
147 | QStringList cmd; | 148 | QStringList cmd; |
148 | bool execute = true; | 149 | bool execute = true; |
149 | 150 | ||
150 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 151 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
151 | sys->synchronize(); | 152 | sys->synchronize(); |
152 | OPcmciaSystem::CardIterator it = sys->iterator(); | 153 | OPcmciaSystem::CardIterator it = sys->iterator(); |
153 | if ( !sys->count() ) return; | 154 | if ( !sys->count() ) return; |
154 | 155 | ||
155 | int i = 0; | 156 | int i = 0; |
156 | while ( it.current() ) | 157 | while ( it.current() ) |
157 | { | 158 | { |
158 | QPopupMenu* submenu = new QPopupMenu( menu ); | 159 | QPopupMenu* submenu = new QPopupMenu( menu ); |
159 | submenu->insertItem( "&Eject", EJECT+i*100 ); | 160 | submenu->insertItem( "&Eject", EJECT+i*100 ); |
160 | submenu->insertItem( "&Insert", INSERT+i*100 ); | 161 | submenu->insertItem( "&Insert", INSERT+i*100 ); |
161 | submenu->insertItem( "&Suspend", SUSPEND+i*100 ); | 162 | submenu->insertItem( "&Suspend", SUSPEND+i*100 ); |
162 | submenu->insertItem( "&Resume", RESUME+i*100 ); | 163 | submenu->insertItem( "&Resume", RESUME+i*100 ); |
163 | submenu->insertItem( "Rese&t", RESET+i*100 ); | 164 | submenu->insertItem( "Rese&t", RESET+i*100 ); |
164 | submenu->insertItem( "&Configure", CONFIGURE+i*100 ); | 165 | submenu->insertItem( "&Configure", CONFIGURE+i*100 ); |
165 | 166 | ||
166 | bool isSuspended = it.current()->isSuspended(); | 167 | bool isSuspended = it.current()->isSuspended(); |
167 | bool isEmpty = it.current()->isEmpty(); | 168 | bool isEmpty = it.current()->isEmpty(); |
168 | 169 | ||
169 | submenu->setItemEnabled( EJECT+i*100, !isEmpty ); | 170 | submenu->setItemEnabled( EJECT+i*100, !isEmpty ); |
170 | submenu->setItemEnabled( INSERT+i*100, isEmpty ); | 171 | submenu->setItemEnabled( INSERT+i*100, isEmpty ); |
171 | submenu->setItemEnabled( SUSPEND+i*100, !isEmpty && !isSuspended ); | 172 | submenu->setItemEnabled( SUSPEND+i*100, !isEmpty && !isSuspended ); |
172 | submenu->setItemEnabled( RESUME+i*100, !isEmpty && isSuspended ); | 173 | submenu->setItemEnabled( RESUME+i*100, !isEmpty && isSuspended ); |
173 | submenu->setItemEnabled( RESET+i*100, !isEmpty && !isSuspended ); | 174 | submenu->setItemEnabled( RESET+i*100, !isEmpty && !isSuspended ); |
174 | submenu->setItemEnabled( CONFIGURE+i*100, !isEmpty && !configuring ); | 175 | submenu->setItemEnabled( CONFIGURE+i*100, !isEmpty && !configuring ); |
175 | 176 | ||
176 | connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); | 177 | connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); |
177 | menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 ); | 178 | menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 ); |
178 | ++it; | 179 | ++it; |
179 | } | 180 | } |
180 | 181 | ||
181 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); | 182 | QPoint p = mapToGlobal( QPoint( 0, 0 ) ); |
182 | QSize s = menu->sizeHint(); | 183 | QSize s = menu->sizeHint(); |
183 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); | 184 | int opt = menu->exec( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ), p.y() - s.height() ), 0 ); |
184 | qDebug( "pcmcia: menu result = %d", opt ); | 185 | qDebug( "pcmcia: menu result = %d", opt ); |
185 | delete menu; | 186 | delete menu; |
186 | } | 187 | } |
187 | 188 | ||
188 | 189 | ||
189 | void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) | 190 | void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & ) |
190 | { | 191 | { |
191 | odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; | 192 | odebug << "PcmciaManager::cardMessage( '" << msg << "' )" << oendl; |
192 | if ( msg != "stabChanged()" ) return; | 193 | if ( msg != "stabChanged()" ) return; |
193 | 194 | ||
194 | /* check if a previously unknown card has been inserted */ | 195 | /* check if a previously unknown card has been inserted */ |
195 | OPcmciaSystem::instance()->synchronize(); | 196 | OPcmciaSystem::instance()->synchronize(); |
196 | 197 | ||
197 | if ( !OPcmciaSystem::instance()->cardCount() ) return; | 198 | if ( !OPcmciaSystem::instance()->cardCount() ) return; |
198 | 199 | ||
199 | OConfig cfg( "PCMCIA" ); | 200 | OConfig cfg( "PCMCIA" ); |
200 | cfg.setGroup( "Global" ); | 201 | cfg.setGroup( "Global" ); |
201 | int nCards = cfg.readNumEntry( "nCards", 0 ); | 202 | int nCards = cfg.readNumEntry( "nCards", 0 ); |
202 | 203 | ||
203 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 204 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
204 | OPcmciaSystem::CardIterator it = sys->iterator(); | 205 | OPcmciaSystem::CardIterator it = sys->iterator(); |
205 | 206 | ||
206 | bool newCard = true; | 207 | bool newCard = true; |
207 | OPcmciaSocket* theCard = 0; | 208 | OPcmciaSocket* theCard = 0; |
208 | 209 | ||
209 | while ( it.current() && newCard ) | 210 | while ( it.current() && newCard ) |
210 | { | 211 | { |
211 | if ( it.current()->isEmpty() ) | 212 | if ( it.current()->isEmpty() ) |
212 | { | 213 | { |
213 | odebug << "pcmcia: skipping empty card in socket " << it.current()->number() << oendl; | 214 | odebug << "pcmcia: skipping empty card in socket " << it.current()->number() << oendl; |
214 | ++it; | 215 | ++it; |
215 | continue; | 216 | continue; |
216 | } | 217 | } |
217 | else | 218 | else |
218 | { | 219 | { |
219 | theCard = it.current(); | 220 | theCard = it.current(); |
220 | QString cardName = theCard->productIdentity(); | 221 | QString cardName = theCard->productIdentity(); |
221 | for ( int i = 0; i < nCards; ++i ) | 222 | for ( int i = 0; i < nCards; ++i ) |
222 | { | 223 | { |
223 | QString cardSection = QString( "Card_%1" ).arg( i ); | 224 | QString cardSection = QString( "Card_%1" ).arg( i ); |
224 | cfg.setGroup( cardSection ); | 225 | cfg.setGroup( cardSection ); |
225 | QString name = cfg.readEntry( "name" ); | 226 | QString name = cfg.readEntry( "name" ); |
226 | odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl; | 227 | odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl; |
227 | if ( cardName == name ) | 228 | if ( cardName == name ) |
228 | { | 229 | { |
229 | newCard = false; | 230 | newCard = false; |
230 | odebug << "pcmcia: we have seen this card before" << oendl; | 231 | odebug << "pcmcia: we have seen this card before" << oendl; |
231 | executeAction( theCard, "insert" ); | 232 | executeAction( theCard, "insert" ); |
232 | break; | 233 | break; |
233 | } | 234 | } |
234 | } | 235 | } |
235 | if ( !newCard ) ++it; else break; | 236 | if ( !newCard ) ++it; else break; |
236 | } | 237 | } |
237 | } | 238 | } |
238 | if ( newCard ) | 239 | if ( newCard ) |
239 | { | 240 | { |
240 | odebug << "pcmcia: unconfigured card detected" << oendl; | 241 | odebug << "pcmcia: unconfigured card detected" << oendl; |
241 | QString newCardName = theCard->productIdentity(); | 242 | QString newCardName = theCard->productIdentity(); |
242 | int result = QMessageBox::information( qApp->desktop(), | 243 | int result = QMessageBox::information( qApp->desktop(), |
243 | tr( "PCMCIA/CF Subsystem" ), | 244 | tr( "PCMCIA/CF Subsystem" ), |
244 | tr( "<qt>You have inserted the card<br/><b>%1</b><br/>This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ), | 245 | tr( "<qt>You have inserted the card<br/><b>%1</b><br/>This card is not yet configured. Do you want to configure it now?</qt>" ).arg( newCardName ), |
245 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); | 246 | tr( "Yes" ), tr( "No" ), 0, 0, 1 ); |
246 | odebug << "pcmcia: result = " << result << oendl; | 247 | odebug << "pcmcia: result = " << result << oendl; |
247 | if ( result == 0 ) | 248 | if ( result == 0 ) |
248 | { | 249 | { |
249 | QString insertAction; QString resumeAction; QString driver; QString conf; | 250 | configure( theCard ); |
250 | bool configured = configure( theCard, insertAction, resumeAction, driver, conf ); | ||
251 | |||
252 | if ( configured ) | ||
253 | { | ||
254 | odebug << "pcmcia: card has been configured. writing out to database" << oendl; | ||
255 | cfg.setGroup( QString( "Card_%1" ).arg( nCards ) ); | ||
256 | cfg.writeEntry( "name", newCardName ); | ||
257 | cfg.writeEntry( "insertAction", insertAction ); | ||
258 | cfg.writeEntry( "resumeAction", resumeAction ); | ||
259 | cfg.setGroup( "Global" ); | ||
260 | cfg.writeEntry( "nCards", nCards+1 ); | ||
261 | cfg.write(); | ||
262 | |||
263 | QFile confFile( conf ); | ||
264 | if ( confFile.open( IO_ReadWrite | IO_Append ) ) | ||
265 | { | ||
266 | QString entryCard = QString( "card \"%1\"" ).arg( newCardName ); | ||
267 | QString entryVersion( " version " ); | ||
268 | for ( QStringList::Iterator it = theCard->productIdentityVector().begin(); it != theCard->productIdentityVector().end(); ++it ) | ||
269 | { | ||
270 | entryVersion += QString( "\"%1\", " ).arg( *it ); | ||
271 | } | ||
272 | QString entryBind = QString( " bind %1" ).arg( driver ); | ||
273 | QString entry = QString( "\n%1\n%2\n%3\n" ).arg( entryCard ).arg( entryVersion ).arg( entryBind ); | ||
274 | odebug << "pcmcia: writing entry...:" << entry << oendl; | ||
275 | |||
276 | confFile.writeBlock( (const char*) entry, entry.length() ); | ||
277 | Global::statusMessage( "restarting pcmcia services..." ); | ||
278 | ::system( "/etc/init.d/pcmcia restart" ); | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | owarn << "pcmcia: couldn't write binding to '" << conf << "' ( " << strerror( errno ) << " )." << oendl; | ||
283 | } | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | odebug << "pcmcia: card has not been configured this time. leaving as unknown card" << oendl; | ||
288 | } | ||
289 | } | 251 | } |
290 | else | 252 | else |
291 | { | 253 | { |
292 | odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl; | 254 | odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl; |
293 | } | 255 | } |
294 | } | 256 | } |
295 | else // it's an already configured card | 257 | else // it's an already configured card |
296 | { | 258 | { |
297 | odebug << "pcmcia: doing nothing... why do we come here?" << oendl; | 259 | odebug << "pcmcia: doing nothing... why do we come here?" << oendl; |
298 | } | 260 | } |
299 | } | 261 | } |
300 | 262 | ||
301 | void PcmciaManager::paintEvent( QPaintEvent * ) | 263 | void PcmciaManager::paintEvent( QPaintEvent * ) |
302 | { | 264 | { |
303 | QPainter p( this ); | 265 | QPainter p( this ); |
304 | p.drawPixmap( 0, 0, pm ); | 266 | p.drawPixmap( 0, 0, pm ); |
305 | } | 267 | } |
306 | 268 | ||
307 | int PcmciaManager::position() | 269 | int PcmciaManager::position() |
308 | { | 270 | { |
309 | return 7; | 271 | return 7; |
310 | } | 272 | } |
311 | 273 | ||
312 | void PcmciaManager::execCommand( const QStringList &strList ) | 274 | void PcmciaManager::execCommand( const QStringList &strList ) |
313 | { | 275 | { |
314 | } | 276 | } |
315 | 277 | ||
316 | void PcmciaManager::userCardAction( int action ) | 278 | void PcmciaManager::userCardAction( int action ) |
317 | { | 279 | { |
318 | odebug << "pcmcia: user action on socket " << action / 100 << " requested. action = " << action << oendl; | 280 | odebug << "pcmcia: user action on socket " << action / 100 << " requested. action = " << action << oendl; |
319 | 281 | ||
320 | int socket = action / 100; | 282 | int socket = action / 100; |
321 | int what = action % 100; | 283 | int what = action % 100; |
322 | bool success = false; | 284 | bool success = false; |
323 | 285 | ||
324 | switch ( what ) | 286 | switch ( what ) |
325 | { | 287 | { |
326 | case CONFIGURE: | 288 | case CONFIGURE: |
327 | { | 289 | { |
328 | QString insertAction; QString resumeAction; QString driver; QString conf; | 290 | QString insertAction; QString resumeAction; QString driver; QString conf; |
329 | configure( OPcmciaSystem::instance()->socket( socket ), insertAction, resumeAction, driver, conf ); | 291 | configure( OPcmciaSystem::instance()->socket( socket ) ); |
330 | return; | 292 | return; |
331 | } | 293 | } |
332 | case EJECT: success = OPcmciaSystem::instance()->socket( socket )->eject(); | 294 | case EJECT: success = OPcmciaSystem::instance()->socket( socket )->eject(); |
333 | break; | 295 | break; |
334 | case INSERT: success = OPcmciaSystem::instance()->socket( socket )->insert(); | 296 | case INSERT: success = OPcmciaSystem::instance()->socket( socket )->insert(); |
335 | break; | 297 | break; |
336 | case SUSPEND: success = OPcmciaSystem::instance()->socket( socket )->suspend(); | 298 | case SUSPEND: success = OPcmciaSystem::instance()->socket( socket )->suspend(); |
337 | break; | 299 | break; |
338 | case RESUME: success = OPcmciaSystem::instance()->socket( socket )->resume(); | 300 | case RESUME: success = OPcmciaSystem::instance()->socket( socket )->resume(); |
339 | break; | 301 | break; |
340 | case RESET: success = OPcmciaSystem::instance()->socket( socket )->reset(); | 302 | case RESET: success = OPcmciaSystem::instance()->socket( socket )->reset(); |
341 | break; | 303 | break; |
342 | default: odebug << "pcmcia: not yet implemented" << oendl; | 304 | case ACTIVATE: success = true; |
305 | break; | ||
306 | default: odebug << "pcmcia: not yet implemented" << oendl; | ||
343 | } | 307 | } |
344 | 308 | ||
345 | if ( success ) | 309 | if ( success ) |
346 | { | 310 | { |
311 | odebug << tr( "Successfully %1ed card in socket #%2" ).arg( actionText[action] ).arg( socket ) << oendl; | ||
347 | popUp( tr( "Successfully %1ed card in socket #%2" ).arg( actionText[action] ).arg( socket ) ); | 312 | popUp( tr( "Successfully %1ed card in socket #%2" ).arg( actionText[action] ).arg( socket ) ); |
348 | } | 313 | } |
349 | else | 314 | else |
350 | { | 315 | { |
316 | odebug << tr( "Error while %1ing card in socket #%2" ).arg( actionText[action] ).arg( socket ) << oendl; | ||
351 | popUp( tr( "Error while %1ing card in socket #%2" ).arg( actionText[action] ).arg( socket ) ); | 317 | popUp( tr( "Error while %1ing card in socket #%2" ).arg( actionText[action] ).arg( socket ) ); |
352 | } | 318 | } |
353 | } | 319 | } |
354 | 320 | ||
355 | bool PcmciaManager::configure( OPcmciaSocket* card, QString& insertAction, QString& resumeAction, QString& driver, QString& conf ) | 321 | void PcmciaManager::configure( OPcmciaSocket* card ) |
356 | { | 322 | { |
357 | configuring = true; | 323 | configuring = true; |
358 | ConfigDialog dialog( card, qApp->desktop() ); | 324 | ConfigDialog dialog( card, qApp->desktop() ); |
359 | int configresult = QPEApplication::execDialog( &dialog, false ); | 325 | int result = QPEApplication::execDialog( &dialog, false ); |
360 | configuring = false; | 326 | configuring = false; |
361 | odebug << "pcmcia: configresult = " << configresult << oendl; | 327 | odebug << "pcmcia: configresult = " << result << oendl; |
362 | if ( configresult ) | 328 | if ( result ) |
363 | { | 329 | { |
364 | insertAction = dialog.cbInsertAction->currentText(); | 330 | dialog.writeConfiguration( card ); |
365 | resumeAction = dialog.cbResumeAction->currentText(); | ||
366 | driver = dialog.cbBindTo->currentText(); | ||
367 | conf = dialog.bindEntries[driver]; | ||
368 | } | 331 | } |
369 | return configresult; | ||
370 | } | 332 | } |
371 | 333 | ||
372 | void PcmciaManager::executeAction( Opie::Core::OPcmciaSocket* card, const QString& type ) | 334 | void PcmciaManager::executeAction( Opie::Core::OPcmciaSocket* card, const QString& type ) |
373 | { | 335 | { |
374 | odebug << "pcmcia: performing " << type << " action ..." << oendl; | 336 | odebug << "pcmcia: performing " << type << " action ..." << oendl; |
375 | QString theAction = ConfigDialog::preferredAction( card, type ); | 337 | QString theAction = ConfigDialog::preferredAction( card, type ); |
376 | int intAction = card->number() * 100; | 338 | int intAction = card->number() * 100; |
377 | if ( theAction == "activate" ) ; | 339 | |
378 | else if ( theAction == "eject" ) intAction += EJECT; | 340 | if ( theAction == "prompt for" ) |
379 | else if ( theAction == "suspend" ) intAction += SUSPEND; | ||
380 | else if ( theAction == "prompt for" ) | ||
381 | { | 341 | { |
382 | odebug << "pcmcia: sorry, not 'prompt for' is not yet implemented!" << oendl; | 342 | PromptActionDialog dialog( qApp->desktop(), "promptfor", true ); |
383 | return; | 343 | dialog.setCaption( QString( "Choose action for card #%1" ).arg( card->number() ) ); |
344 | int result = QPEApplication::execDialog( &dialog, true ); | ||
345 | odebug << "pcmcia: configresult = " << result << oendl; | ||
346 | if ( result ) | ||
347 | { | ||
348 | theAction = dialog.cbAction->currentText(); | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | odebug << "pcmcia: prompted to do nothing" << oendl; | ||
353 | return; | ||
354 | } | ||
384 | } | 355 | } |
356 | if ( theAction == "activate" ) intAction += ACTIVATE; | ||
357 | else if ( theAction == "eject" ) intAction += EJECT; | ||
358 | else if ( theAction == "suspend" ) intAction += SUSPEND; | ||
385 | else | 359 | else |
386 | { | 360 | { |
387 | owarn << "pcmcia: action '" << theAction << "' not known. Huh?" << oendl; | 361 | owarn << "pcmcia: action '" << theAction << "' not known. Huh?" << oendl; |
388 | return; | 362 | return; |
389 | } | 363 | } |
390 | userCardAction( intAction ); | 364 | userCardAction( intAction ); |
391 | } | 365 | } |
392 | 366 | ||
393 | EXPORT_OPIE_APPLET_v1( PcmciaManager ) | 367 | EXPORT_OPIE_APPLET_v1( PcmciaManager ) |
394 | 368 | ||
diff --git a/noncore/applets/pcmcia/pcmcia.h b/noncore/applets/pcmcia/pcmcia.h index de7d6bf..0fe936c 100644 --- a/noncore/applets/pcmcia/pcmcia.h +++ b/noncore/applets/pcmcia/pcmcia.h | |||
@@ -1,72 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
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 PCMCIA_H | 30 | #ifndef PCMCIA_H |
31 | #define PCMCIA_H | 31 | #define PCMCIA_H |
32 | 32 | ||
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | 36 | ||
37 | namespace Opie { namespace Core { class OPcmciaSocket; } }; | 37 | namespace Opie { namespace Core { class OPcmciaSocket; } }; |
38 | 38 | ||
39 | class PcmciaManager : public QWidget | 39 | class PcmciaManager : public QWidget |
40 | { | 40 | { |
41 | Q_OBJECT | 41 | Q_OBJECT |
42 | public: | 42 | public: |
43 | PcmciaManager( QWidget *parent = 0 ); | 43 | PcmciaManager( QWidget *parent = 0 ); |
44 | ~PcmciaManager(); | 44 | ~PcmciaManager(); |
45 | static int position(); | 45 | static int position(); |
46 | 46 | ||
47 | private slots: | 47 | private slots: |
48 | void handleSystemChannel( const QCString&, const QByteArray& ); | 48 | void handleSystemChannel( const QCString&, const QByteArray& ); |
49 | void cardMessage( const QCString&, const QByteArray& ); | 49 | void cardMessage( const QCString&, const QByteArray& ); |
50 | void userCardAction( int action ); | 50 | void userCardAction( int action ); |
51 | void popupTimeout(); | 51 | void popupTimeout(); |
52 | 52 | ||
53 | protected: | 53 | protected: |
54 | void paintEvent( QPaintEvent* ); | 54 | void paintEvent( QPaintEvent* ); |
55 | void mousePressEvent( QMouseEvent * ); | 55 | void mousePressEvent( QMouseEvent * ); |
56 | 56 | ||
57 | private: | 57 | private: |
58 | bool configure( Opie::Core::OPcmciaSocket*, QString&, QString&, QString&, QString& ); | 58 | void configure( Opie::Core::OPcmciaSocket* ); |
59 | void execCommand( const QStringList &command ); | 59 | void execCommand( const QStringList &command ); |
60 | void executeAction( Opie::Core::OPcmciaSocket*, const QString& ); | 60 | void executeAction( Opie::Core::OPcmciaSocket*, const QString& ); |
61 | void popUp( QString message, QString icon = QString::null ); | 61 | void popUp( QString message, QString icon = QString::null ); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | bool configuring; | 64 | bool configuring; |
65 | int commandOrig; | 65 | int commandOrig; |
66 | QPixmap pm; | 66 | QPixmap pm; |
67 | QPopupMenu *popupMenu; | 67 | QPopupMenu *popupMenu; |
68 | 68 | ||
69 | }; | 69 | }; |
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | 72 | ||
diff --git a/noncore/applets/pcmcia/pcmcia.pro b/noncore/applets/pcmcia/pcmcia.pro index 4a893b5..b9af380 100644 --- a/noncore/applets/pcmcia/pcmcia.pro +++ b/noncore/applets/pcmcia/pcmcia.pro | |||
@@ -1,18 +1,20 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on | 2 | CONFIG += qt plugin warn_on |
3 | 3 | ||
4 | INTERFACES = configdialogbase.ui | 4 | INTERFACES = configdialogbase.ui \ |
5 | promptactiondialog.ui | ||
5 | HEADERS = pcmcia.h \ | 6 | HEADERS = pcmcia.h \ |
6 | configdialog.h | 7 | configdialog.h |
7 | SOURCES = pcmcia.cpp \ | 8 | SOURCES = pcmcia.cpp \ |
8 | configdialog.cpp | 9 | configdialog.cpp |
9 | TARGET = pcmciaapplet | 10 | TARGET = pcmciaapplet |
10 | 11 | ||
11 | DESTDIR = $(OPIEDIR)/plugins/applets | 12 | DESTDIR = $(OPIEDIR)/plugins/applets |
13 | |||
12 | INCLUDEPATH += $(OPIEDIR)/include | 14 | INCLUDEPATH += $(OPIEDIR)/include |
13 | DEPENDPATH += $(OPIEDIR)/include | 15 | DEPENDPATH += $(OPIEDIR)/include |
14 | 16 | ||
15 | LIBS += -lqpe -lopiecore2 | 17 | LIBS += -lqpe -lopiecore2 |
16 | VERSION = 0.2.0 | 18 | VERSION = 0.9.0 |
17 | 19 | ||
18 | include( $(OPIEDIR)/include.pro ) | 20 | include( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/applets/pcmcia/promptactiondialog.ui b/noncore/applets/pcmcia/promptactiondialog.ui new file mode 100644 index 0000000..c351b48 --- a/dev/null +++ b/noncore/applets/pcmcia/promptactiondialog.ui | |||
@@ -0,0 +1,58 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PromptActionDialog</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>PromptActionDialog</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>273</width> | ||
15 | <height>55</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Choose Action for Card</string> | ||
21 | </property> | ||
22 | <grid> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <widget row="0" column="0" > | ||
32 | <class>QComboBox</class> | ||
33 | <item> | ||
34 | <property> | ||
35 | <name>text</name> | ||
36 | <string>activate</string> | ||
37 | </property> | ||
38 | </item> | ||
39 | <item> | ||
40 | <property> | ||
41 | <name>text</name> | ||
42 | <string>suspend</string> | ||
43 | </property> | ||
44 | </item> | ||
45 | <item> | ||
46 | <property> | ||
47 | <name>text</name> | ||
48 | <string>eject</string> | ||
49 | </property> | ||
50 | </item> | ||
51 | <property stdset="1"> | ||
52 | <name>name</name> | ||
53 | <cstring>cbAction</cstring> | ||
54 | </property> | ||
55 | </widget> | ||
56 | </grid> | ||
57 | </widget> | ||
58 | </UI> | ||