summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-06-14 13:15:05 (UTC)
committer mickeyl <mickeyl>2005-06-14 13:15:05 (UTC)
commit7d8d317205a74bc2e23291ab4909472db6694091 (patch) (unidiff)
tree7fdf8d039a30f26316fb57edbe53462d1b38b654
parentc1194d42d8456417452b125bd6c2c5048d7bbe02 (diff)
downloadopie-7d8d317205a74bc2e23291ab4909472db6694091.zip
opie-7d8d317205a74bc2e23291ab4909472db6694091.tar.gz
opie-7d8d317205a74bc2e23291ab4909472db6694091.tar.bz2
more work on configuring unsupported cards
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pcmcia/configdialog.cpp32
-rw-r--r--noncore/applets/pcmcia/configdialog.h4
-rw-r--r--noncore/applets/pcmcia/configdialogbase.ui19
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp12
-rw-r--r--noncore/applets/pcmcia/pcmcia.h3
5 files changed, 53 insertions, 17 deletions
diff --git a/noncore/applets/pcmcia/configdialog.cpp b/noncore/applets/pcmcia/configdialog.cpp
index e161d18..9fcf58c 100644
--- a/noncore/applets/pcmcia/configdialog.cpp
+++ b/noncore/applets/pcmcia/configdialog.cpp
@@ -33,4 +33,5 @@
33#include <opie2/oconfig.h> 33#include <opie2/oconfig.h>
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <opie2/opcmciasystem.h>
35using namespace Opie::Core; 36using namespace Opie::Core;
36 37
@@ -39,12 +40,15 @@ using namespace Opie::Core;
39#include <qdir.h> 40#include <qdir.h>
40#include <qfile.h> 41#include <qfile.h>
42#include <qgroupbox.h>
41#include <qlabel.h> 43#include <qlabel.h>
42#include <qtextstream.h> 44#include <qtextstream.h>
43 45
44ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) 46ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent )
45 :ConfigDialogBase( parent, "pcmcia config dialog", true ) 47 :ConfigDialogBase( parent, "pcmcia config dialog", true )
46{ 48{
47 //setCaption( tr( "Configure %1" ).arg( cardname ) ); 49 gbDetails->setTitle( QString( "Details for '%1'" ).arg( card->identity() ) );
48 txtCardName->setText( cardname ); 50 txtCardName->setText( card->productIdentity().join( " " ) );
51 txtManfid->setText( card->manufacturerIdentity() );
52 txtFunction->setText( card->function() );
49 53
50 OConfig cfg( "PCMCIA" ); 54 OConfig cfg( "PCMCIA" );
@@ -58,6 +62,6 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
58 cfg.setGroup( cardSection ); 62 cfg.setGroup( cardSection );
59 QString name = cfg.readEntry( "name" ); 63 QString name = cfg.readEntry( "name" );
60 odebug << "comparing card '" << cardname << "' with known card '" << name << "'" << oendl; 64 odebug << "comparing card '" << card->name() << "' with known card '" << name << "'" << oendl;
61 if ( cardname == name ) 65 if ( card->name() == name )
62 { 66 {
63 insert = cfg.readEntry( "insert" ); 67 insert = cfg.readEntry( "insert" );
@@ -65,5 +69,5 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
65 } 69 }
66 } 70 }
67 odebug << "preferred action for card '" << cardname << "' seems to be '" << insert << "'" << oendl; 71 odebug << "preferred action for card '" << card->name() << "' seems to be '" << insert << "'" << oendl;
68 72
69 if ( !insert.isEmpty() ) 73 if ( !insert.isEmpty() )
@@ -73,4 +77,18 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
73 } 77 }
74 78
79 if ( !card->isUnsupported() )
80 {
81 odebug << "card is recognized - hiding bindings" << oendl;
82 textBindTo->hide();
83 cbBindTo->hide();
84 return;
85 }
86 else
87 {
88 odebug << "card is unsupported yet - showing possible bindings" << oendl;
89 textBindTo->show();
90 cbBindTo->show();
91 }
92
75 // parse possible bind entries out of /etc/pcmcia/*.conf 93 // parse possible bind entries out of /etc/pcmcia/*.conf
76 typedef QMap<QString,QString> StringMap; 94 typedef QMap<QString,QString> StringMap;
@@ -109,5 +127,5 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent )
109 for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it ) 127 for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it )
110 { 128 {
111 odebug << "found device '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; 129 odebug << "found binding '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl;
112 cbBindTo->insertItem( it.key() ); 130 cbBindTo->insertItem( it.key() );
113 } 131 }
diff --git a/noncore/applets/pcmcia/configdialog.h b/noncore/applets/pcmcia/configdialog.h
index f79d7a6..3c7fe85 100644
--- a/noncore/applets/pcmcia/configdialog.h
+++ b/noncore/applets/pcmcia/configdialog.h
@@ -33,4 +33,6 @@
33#include "configdialogbase.h" 33#include "configdialogbase.h"
34 34
35namespace Opie { namespace Core { class OPcmciaSocket; }; };
36
35class ConfigDialog : public ConfigDialogBase 37class ConfigDialog : public ConfigDialogBase
36{ 38{
@@ -38,5 +40,5 @@ class ConfigDialog : public ConfigDialogBase
38 public: 40 public:
39 41
40 ConfigDialog( const QString& cardname, QWidget* parent ); 42 ConfigDialog( const Opie::Core::OPcmciaSocket* card, QWidget* parent );
41 ~ConfigDialog(); 43 ~ConfigDialog();
42}; 44};
diff --git a/noncore/applets/pcmcia/configdialogbase.ui b/noncore/applets/pcmcia/configdialogbase.ui
index a0760d6..7ec3a75 100644
--- a/noncore/applets/pcmcia/configdialogbase.ui
+++ b/noncore/applets/pcmcia/configdialogbase.ui
@@ -12,6 +12,6 @@
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>232</width> 14 <width>197</width>
15 <height>206</height> 15 <height>154</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -54,5 +54,5 @@
54 <property stdset="1"> 54 <property stdset="1">
55 <name>text</name> 55 <name>text</name>
56 <string>Upon insertion,</string> 56 <string>On insertion,</string>
57 </property> 57 </property>
58 </widget> 58 </widget>
@@ -95,7 +95,18 @@
95 </property> 95 </property>
96 <property stdset="1"> 96 <property stdset="1">
97 <name>sizePolicy</name>
98 <sizepolicy>
99 <hsizetype>5</hsizetype>
100 <vsizetype>0</vsizetype>
101 </sizepolicy>
102 </property>
103 <property stdset="1">
97 <name>editable</name> 104 <name>editable</name>
98 <bool>true</bool> 105 <bool>true</bool>
99 </property> 106 </property>
107 <property stdset="1">
108 <name>autoResize</name>
109 <bool>false</bool>
110 </property>
100 </widget> 111 </widget>
101 <widget row="3" column="0" > 112 <widget row="3" column="0" >
@@ -114,5 +125,5 @@
114 <property stdset="1"> 125 <property stdset="1">
115 <name>name</name> 126 <name>name</name>
116 <cstring>GroupBox1</cstring> 127 <cstring>gbDetails</cstring>
117 </property> 128 </property>
118 <property stdset="1"> 129 <property stdset="1">
diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp
index 6c18e86..fac7065 100644
--- a/noncore/applets/pcmcia/pcmcia.cpp
+++ b/noncore/applets/pcmcia/pcmcia.cpp
@@ -75,4 +75,5 @@ PcmciaManager::PcmciaManager( QWidget * parent ) : QWidget( parent )
75 setFixedHeight ( AppLnk::smallIconSize() ); 75 setFixedHeight ( AppLnk::smallIconSize() );
76 pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ); 76 pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon );
77 configuring = false;
77} 78}
78 79
@@ -111,5 +112,5 @@ void PcmciaManager::popupTimeout()
111} 112}
112 113
113enum { EJECT, INSERT, SUSPEND, RESUME, CONFIGURE }; 114enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE };
114 115
115void PcmciaManager::mousePressEvent( QMouseEvent* ) 116void PcmciaManager::mousePressEvent( QMouseEvent* )
@@ -131,4 +132,5 @@ void PcmciaManager::mousePressEvent( QMouseEvent* )
131 submenu->insertItem( "&Suspend", SUSPEND+i*100 ); 132 submenu->insertItem( "&Suspend", SUSPEND+i*100 );
132 submenu->insertItem( "&Resume", RESUME+i*100 ); 133 submenu->insertItem( "&Resume", RESUME+i*100 );
134 submenu->insertItem( "Rese&t", RESET+i*100 );
133 submenu->insertItem( "&Configure", CONFIGURE+i*100 ); 135 submenu->insertItem( "&Configure", CONFIGURE+i*100 );
134 136
@@ -137,5 +139,5 @@ void PcmciaManager::mousePressEvent( QMouseEvent* )
137 submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); 139 submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() );
138 submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); 140 submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && it.current()->isSuspended() );
139 submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() ); 141 submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() && !configuring );
140 142
141 connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); 143 connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) );
@@ -272,6 +274,8 @@ void PcmciaManager::userCardAction( int action )
272void PcmciaManager::configure( OPcmciaSocket* card ) 274void PcmciaManager::configure( OPcmciaSocket* card )
273{ 275{
274 ConfigDialog dialog( card->identity(), qApp->desktop() ); 276 configuring = true;
275 int configresult = dialog.exec(); 277 ConfigDialog dialog( card, qApp->desktop() );
278 int configresult = QPEApplication::execDialog( &dialog, false );
279 configuring = false;
276 odebug << "pcmcia: configresult = " << configresult << oendl; 280 odebug << "pcmcia: configresult = " << configresult << oendl;
277} 281}
diff --git a/noncore/applets/pcmcia/pcmcia.h b/noncore/applets/pcmcia/pcmcia.h
index ed86579..a453c1b 100644
--- a/noncore/applets/pcmcia/pcmcia.h
+++ b/noncore/applets/pcmcia/pcmcia.h
@@ -60,5 +60,6 @@ class PcmciaManager : public QWidget
60 60
61 private: 61 private:
62 int m_commandOrig; 62 bool configuring;
63 int commandOrig;
63 QPixmap pm; 64 QPixmap pm;
64 QPopupMenu *popupMenu; 65 QPopupMenu *popupMenu;