author | mickeyl <mickeyl> | 2005-06-14 13:15:05 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-14 13:15:05 (UTC) |
commit | 7d8d317205a74bc2e23291ab4909472db6694091 (patch) (side-by-side diff) | |
tree | 7fdf8d039a30f26316fb57edbe53462d1b38b654 | |
parent | c1194d42d8456417452b125bd6c2c5048d7bbe02 (diff) | |
download | opie-7d8d317205a74bc2e23291ab4909472db6694091.zip opie-7d8d317205a74bc2e23291ab4909472db6694091.tar.gz opie-7d8d317205a74bc2e23291ab4909472db6694091.tar.bz2 |
more work on configuring unsupported cards
-rw-r--r-- | noncore/applets/pcmcia/configdialog.cpp | 32 | ||||
-rw-r--r-- | noncore/applets/pcmcia/configdialog.h | 4 | ||||
-rw-r--r-- | noncore/applets/pcmcia/configdialogbase.ui | 19 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 12 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.h | 3 |
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 @@ #include <opie2/oconfig.h> #include <opie2/odebug.h> +#include <opie2/opcmciasystem.h> using namespace Opie::Core; @@ -39,12 +40,15 @@ using namespace Opie::Core; #include <qdir.h> #include <qfile.h> +#include <qgroupbox.h> #include <qlabel.h> #include <qtextstream.h> -ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) +ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent ) :ConfigDialogBase( parent, "pcmcia config dialog", true ) { - //setCaption( tr( "Configure %1" ).arg( cardname ) ); - txtCardName->setText( cardname ); + gbDetails->setTitle( QString( "Details for '%1'" ).arg( card->identity() ) ); + txtCardName->setText( card->productIdentity().join( " " ) ); + txtManfid->setText( card->manufacturerIdentity() ); + txtFunction->setText( card->function() ); OConfig cfg( "PCMCIA" ); @@ -58,6 +62,6 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) cfg.setGroup( cardSection ); QString name = cfg.readEntry( "name" ); - odebug << "comparing card '" << cardname << "' with known card '" << name << "'" << oendl; - if ( cardname == name ) + odebug << "comparing card '" << card->name() << "' with known card '" << name << "'" << oendl; + if ( card->name() == name ) { insert = cfg.readEntry( "insert" ); @@ -65,5 +69,5 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) } } - odebug << "preferred action for card '" << cardname << "' seems to be '" << insert << "'" << oendl; + odebug << "preferred action for card '" << card->name() << "' seems to be '" << insert << "'" << oendl; if ( !insert.isEmpty() ) @@ -73,4 +77,18 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) } + if ( !card->isUnsupported() ) + { + odebug << "card is recognized - hiding bindings" << oendl; + textBindTo->hide(); + cbBindTo->hide(); + return; + } + else + { + odebug << "card is unsupported yet - showing possible bindings" << oendl; + textBindTo->show(); + cbBindTo->show(); + } + // parse possible bind entries out of /etc/pcmcia/*.conf typedef QMap<QString,QString> StringMap; @@ -109,5 +127,5 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it ) { - odebug << "found device '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; + odebug << "found binding '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl; cbBindTo->insertItem( it.key() ); } 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 @@ #include "configdialogbase.h" +namespace Opie { namespace Core { class OPcmciaSocket; }; }; + class ConfigDialog : public ConfigDialogBase { @@ -38,5 +40,5 @@ class ConfigDialog : public ConfigDialogBase public: - ConfigDialog( const QString& cardname, QWidget* parent ); + ConfigDialog( const Opie::Core::OPcmciaSocket* card, QWidget* parent ); ~ConfigDialog(); }; 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 @@ <x>0</x> <y>0</y> - <width>232</width> - <height>206</height> + <width>197</width> + <height>154</height> </rect> </property> @@ -54,5 +54,5 @@ <property stdset="1"> <name>text</name> - <string>Upon insertion,</string> + <string>On insertion,</string> </property> </widget> @@ -95,7 +95,18 @@ </property> <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> <name>editable</name> <bool>true</bool> </property> + <property stdset="1"> + <name>autoResize</name> + <bool>false</bool> + </property> </widget> <widget row="3" column="0" > @@ -114,5 +125,5 @@ <property stdset="1"> <name>name</name> - <cstring>GroupBox1</cstring> + <cstring>gbDetails</cstring> </property> <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 ) setFixedHeight ( AppLnk::smallIconSize() ); pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ); + configuring = false; } @@ -111,5 +112,5 @@ void PcmciaManager::popupTimeout() } -enum { EJECT, INSERT, SUSPEND, RESUME, CONFIGURE }; +enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE }; void PcmciaManager::mousePressEvent( QMouseEvent* ) @@ -131,4 +132,5 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) submenu->insertItem( "&Suspend", SUSPEND+i*100 ); submenu->insertItem( "&Resume", RESUME+i*100 ); + submenu->insertItem( "Rese&t", RESET+i*100 ); submenu->insertItem( "&Configure", CONFIGURE+i*100 ); @@ -137,5 +139,5 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); - submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() ); + submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() && !configuring ); connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); @@ -272,6 +274,8 @@ void PcmciaManager::userCardAction( int action ) void PcmciaManager::configure( OPcmciaSocket* card ) { - ConfigDialog dialog( card->identity(), qApp->desktop() ); - int configresult = dialog.exec(); + configuring = true; + ConfigDialog dialog( card, qApp->desktop() ); + int configresult = QPEApplication::execDialog( &dialog, false ); + configuring = false; odebug << "pcmcia: configresult = " << configresult << oendl; } 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 private: - int m_commandOrig; + bool configuring; + int commandOrig; QPixmap pm; QPopupMenu *popupMenu; |