-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 @@ -34,2 +34,3 @@ #include <opie2/odebug.h> +#include <opie2/opcmciasystem.h> using namespace Opie::Core; @@ -40,2 +41,3 @@ using namespace Opie::Core; #include <qfile.h> +#include <qgroupbox.h> #include <qlabel.h> @@ -43,7 +45,9 @@ using namespace Opie::Core; -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() ); @@ -59,4 +63,4 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) 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 ) { @@ -66,3 +70,3 @@ 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; @@ -74,2 +78,16 @@ 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 @@ -110,3 +128,3 @@ ConfigDialog::ConfigDialog( const QString& cardname, QWidget* parent ) { - 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 @@ -34,2 +34,4 @@ +namespace Opie { namespace Core { class OPcmciaSocket; }; }; + class ConfigDialog : public ConfigDialogBase @@ -39,3 +41,3 @@ class ConfigDialog : public ConfigDialogBase - 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 @@ -13,4 +13,4 @@ <y>0</y> - <width>232</width> - <height>206</height> + <width>197</width> + <height>154</height> </rect> @@ -55,3 +55,3 @@ <name>text</name> - <string>Upon insertion,</string> + <string>On insertion,</string> </property> @@ -96,2 +96,9 @@ <property stdset="1"> + <name>sizePolicy</name> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + </sizepolicy> + </property> + <property stdset="1"> <name>editable</name> @@ -99,2 +106,6 @@ </property> + <property stdset="1"> + <name>autoResize</name> + <bool>false</bool> + </property> </widget> @@ -115,3 +126,3 @@ <name>name</name> - <cstring>GroupBox1</cstring> + <cstring>gbDetails</cstring> </property> 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 @@ -76,2 +76,3 @@ PcmciaManager::PcmciaManager( QWidget * parent ) : QWidget( parent ) pm = Opie::Core::OResource::loadPixmap( "cardmon/pcmcia", Opie::Core::OResource::SmallIcon ); + configuring = false; } @@ -112,3 +113,3 @@ void PcmciaManager::popupTimeout() -enum { EJECT, INSERT, SUSPEND, RESUME, CONFIGURE }; +enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE }; @@ -132,2 +133,3 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) submenu->insertItem( "&Resume", RESUME+i*100 ); + submenu->insertItem( "Rese&t", RESET+i*100 ); submenu->insertItem( "&Configure", CONFIGURE+i*100 ); @@ -138,3 +140,3 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) 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 ); @@ -273,4 +275,6 @@ 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 @@ -61,3 +61,4 @@ class PcmciaManager : public QWidget private: - int m_commandOrig; + bool configuring; + int commandOrig; QPixmap pm; |