summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-06-26 12:02:40 (UTC)
committer mickeyl <mickeyl>2005-06-26 12:02:40 (UTC)
commitd5a2b0d5ca4daa11894c52f3599dab56205bef4c (patch) (side-by-side diff)
tree590d9ba11f3999e4c2b2ebd353ea49af552d9d12
parent790aeb8898d635468c2b9e24fd16a70aab64b1dd (diff)
downloadopie-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
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/applets/pcmcia/configdialog.cpp111
-rw-r--r--noncore/applets/pcmcia/configdialog.h4
-rw-r--r--noncore/applets/pcmcia/pcmcia.cpp88
-rw-r--r--noncore/applets/pcmcia/pcmcia.h2
-rw-r--r--noncore/applets/pcmcia/pcmcia.pro6
-rw-r--r--noncore/applets/pcmcia/promptactiondialog.ui58
7 files changed, 183 insertions, 87 deletions
diff --git a/ChangeLog b/ChangeLog
index a820c09..f47d948 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,39 +1,40 @@
2005-??-?? Opie 1.2.1
New Features
------------
* OpieStumbler: Scans WiFi networks using the wireless extension scanning (skyhusker)
* Opie-Reader: Support for document formats ArriereGo and Reb, add flite output (tim,pohly)
* Opie-Networksettings: Add support for wlan-ng devices and improve WEP handling (Dirk Opfer)
* Wellenreiter: Remove Joining networks - use OpieStumbler for that (mickeyl)
* Opie-Mobilemsg has gone unsupported - it never really worked and there will be a replacement (mickeyl)
* Opie-Tabmanager has gone unsupported - it barely works and there is not much of a use of it anyway (mickeyl)
* Checkbook - added configuration option to use smaller font for checkbook transaction tab (hrw)
* ZSafe - make UI conform to Opie standards (drw)
* Today Addressbook plugin - fix configuration to show/not show birthdays, use checkboxes for selection (hrw)
* Opie-Console: read initial fixed font configuration from qpe.conf (mickeyl)
+ * Opie-PcmciaApplet: card monitoring applet lets you configure insert/resume actions and bind unsupported cards (mickeyl)
Fixed Bugs
----------
* #1377 - Suspend Powermanagement when switched to another VT (mickeyl)
- We actually suspend the complete Opie now in that case.
* #1384 - Battery status updated improperly when charging (skyhusker)
* #1476 - Wrong order of application entries in the O-menu (skyhusker)
* #1514 - Remove usage of cardmon/pcmcia picture in applications. pcmcia is now an inline picture (mickeyl)
* #1535 - Missing line break and unnecessary location shown with Today-Calendar plugin (deller)
* #1546 - Battery applet popup is not always large enough to show jacket remaining info (skyhusker)
* #1557 - Light&Power-Settings don't store warning intervall and warning levels (skyhusker)
* #1565 - crash-fix in odevice.cpp while scanning the distribution table (deller)
* #1614 - Make Opie-console start in $HOME instead of / (skyhusker)
* #1635 - opie-today, datebook-plugin does not show notes (skyhusker)
* #1665 - Opie-IRC displays the host prepended to the message when peer is using and ipv6 address (skyhusker)
* #1666 - Opie-IRC does not allow to add !channels in config as autojoin ones (skyhusker)
* #1667 - Opie-IRC does not show messages from !channel (skyhusker)
* n.a. - always show volume and wireless applet popups inside visible screen (deller)
* n.a. - scale O-Menu-Applets appropriately (mickeyl)
* n.a. - libopienet: fix bugs in wireless scanning and setting SSID (skyhusker)
* n.a. - Wellenreiter: relax WE version matching test a bit (mickeyl)
* n.a. - scale BluezApplet appropriately and use larger icons (mickeyl)
* n.a. - memoryapplet: fix crash in memoryapplet on kernels without swap support (seneca cunningham)
* n.a. - networksettings: ignore hostap control interfaces wifi* (mickeyl)
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
@@ -12,81 +12,86 @@
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "configdialog.h"
/* OPIE */
#include <opie2/oconfig.h>
#include <opie2/odebug.h>
#include <opie2/opcmciasystem.h>
+#include <qpe/global.h>
using namespace Opie::Core;
/* QT */
#include <qcombobox.h>
#include <qdir.h>
#include <qfile.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qtextstream.h>
+/* STD */
+#include <errno.h>
+#include <string.h>
+
ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent )
:ConfigDialogBase( parent, "pcmcia config dialog", true )
{
gbDetails->setTitle( QString( "Details for card in socket #%1" ).arg( card->number() ) );
txtCardName->setText( card->productIdentity() );
txtManfid->setText( card->manufacturerIdentity() );
txtFunction->setText( card->function() );
QString insertAction = preferredAction( card, "insert" );
QString resumeAction = preferredAction( card, "resume" );
odebug << "pcmcia: preferred insertion action for card '" << card->productIdentity() << "' seems to be '" << insertAction << "'" << oendl;
odebug << "pcmcia: preferred resume action for card '" << card->productIdentity() << "' seems to be '" << resumeAction << "'" << oendl;
if ( !insertAction.isEmpty() )
{
- for ( int i; i < cbInsertAction->count(); ++i )
+ for ( unsigned int i = 0; i < cbInsertAction->count(); ++i )
if ( cbInsertAction->text( i ) == insertAction ) cbInsertAction->setCurrentItem( i );
}
if ( !resumeAction.isEmpty() )
{
- for ( int i; i < cbResumeAction->count(); ++i )
+ for ( unsigned int i = 0; i < cbResumeAction->count(); ++i )
if ( cbResumeAction->text( i ) == resumeAction ) cbResumeAction->setCurrentItem( i );
}
if ( !card->isUnsupported() )
{
odebug << "pcmcia: card is recognized - hiding bindings" << oendl;
textInfo->hide();
textBindTo->hide();
cbBindTo->hide();
return;
}
else
{
odebug << "card is unsupported yet - showing possible bindings" << oendl;
textInfo->show();
textBindTo->show();
cbBindTo->show();
}
// parse possible bind entries out of /etc/pcmcia/*.conf
QDir pcmciaconfdir( "/etc/pcmcia", "*.conf" );
for ( unsigned int i = 0; i < pcmciaconfdir.count(); ++i )
{
@@ -108,72 +113,126 @@ ConfigDialog::ConfigDialog( const OPcmciaSocket* card, QWidget* parent )
}
ts.readLine();
}
}
else
{
owarn << "couldn't open '" << conffile.name() << "' for reading" << oendl;
continue;
}
}
for ( StringMap::Iterator it = bindEntries.begin(); it != bindEntries.end(); ++it )
{
odebug << "found binding '" << it.key() << "' defined in '" << it.data().latin1() << "'" << oendl;
cbBindTo->insertItem( it.key() );
}
}
ConfigDialog::~ConfigDialog()
{
}
void ConfigDialog::writeConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& value )
{
- OConfig cfg( "PCMCIA" );
- cfg.setGroup( "Global" );
- int nCards = cfg.readNumEntry( "nCards", 0 );
- QString cardName = card->productIdentity();
- QString action;
+ OConfig* cfg = cardConfig( card );
+ if ( cfg )
+ {
+ cfg->writeEntry( key, value );
+ }
+ delete cfg; // deleting a 0 pointer is within spec.
+}
- for ( int i = 0; i < nCards; ++i )
+QString ConfigDialog::readConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& defaultValue )
{
- QString cardSection = QString( "Card_%1" ).arg( i );
- cfg.setGroup( cardSection );
- QString name = cfg.readEntry( "name" );
- odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl;
- if ( cardName == name )
+ QString value;
+ OConfig* cfg = cardConfig( card );
+ if ( cfg )
{
- cfg.writeEntry( key, value );
- break;
+ value = cfg->readEntry( key, defaultValue );
}
+ delete cfg; // deleting a 0 pointer is within spec.
+ return value;
}
+
+
+QString ConfigDialog::preferredAction( const OPcmciaSocket* card, const QString& type )
+{
+ return ConfigDialog::readConfigEntry( card, QString( "%1Action" ).arg( type ), "suspend" );
}
-QString ConfigDialog::readConfigEntry( const OPcmciaSocket* card, const QString& key, const QString& defaultValue )
+
+OConfig* ConfigDialog::cardConfig( const OPcmciaSocket* card )
{
- OConfig cfg( "PCMCIA" );
- cfg.setGroup( "Global" );
- int nCards = cfg.readNumEntry( "nCards", 0 );
+ OConfig* cardcfg = 0;
+ OConfig* cfg = new OConfig( "PCMCIA" );
+ cfg->setGroup( "Global" );
+ int nCards = cfg->readNumEntry( "nCards", 0 );
QString cardName = card->productIdentity();
- QString value;
for ( int i = 0; i < nCards; ++i )
{
QString cardSection = QString( "Card_%1" ).arg( i );
- cfg.setGroup( cardSection );
- QString name = cfg.readEntry( "name" );
+ cfg->setGroup( cardSection );
+ QString name = cfg->readEntry( "name" );
odebug << "comparing card '" << cardName << "' with known card '" << name << "'" << oendl;
if ( cardName == name )
{
- value = cfg.readEntry( key, defaultValue );
+ cardcfg = cfg;
break;
}
}
- return value;
+ return cardcfg;
}
-QString ConfigDialog::preferredAction( const OPcmciaSocket* card, const QString& type )
+void ConfigDialog::writeConfiguration( const OPcmciaSocket* card )
{
- return ConfigDialog::readConfigEntry( card, QString( "%1Action" ).arg( type ), "suspend" );
+ odebug << "pcmcia: ConfigDialog::writeConfiguration()" << oendl;
+ OConfig* cfg = cardConfig( card );
+ if ( !cfg )
+ {
+ cfg = new OConfig( "PCMCIA" );
+ cfg->setGroup( "Global" );
+ int nCards = cfg->readNumEntry( "nCards", 0 );
+ cfg->setGroup( QString( "Card_%1" ).arg( nCards ) );
+ cfg->writeEntry( "name", card->productIdentity() );
+ cfg->setGroup( "Global" );
+ cfg->writeEntry( "nCards", nCards+1 );
+ cfg->setGroup( QString( "Card_%1" ).arg( nCards ) );
+ }
+
+ cfg->writeEntry( "insertAction", cbInsertAction->currentText() );
+ cfg->writeEntry( "resumeAction", cbResumeAction->currentText() );
+ cfg->write();
+
+ if ( cbBindTo->isVisible() && cbBindTo->currentText() != "<None>" )
+ {
+ QString driver = cbBindTo->currentText();
+ QString conf = bindEntries[driver];
+
+ // write binding
+
+ QFile confFile( conf );
+ if ( confFile.open( IO_ReadWrite | IO_Append ) )
+ {
+ QString entryCard = QString( "card \"%1\"" ).arg( card->productIdentity() );
+ QString entryVersion( " version " );
+ for ( QStringList::Iterator it = card->productIdentityVector().begin(); it != card->productIdentityVector().end(); ++it )
+ {
+ entryVersion += QString( "\"%1\", " ).arg( *it );
+ }
+ QString entryBind = QString( " bind %1" ).arg( driver );
+ QString entry = QString( "\n%1\n%2\n%3\n" ).arg( entryCard ).arg( entryVersion ).arg( entryBind );
+ odebug << "pcmcia: writing entry...:" << entry << oendl;
+
+ confFile.writeBlock( (const char*) entry, entry.length() );
+ Global::statusMessage( "restarting pcmcia services..." );
+ OPcmciaSystem::instance()->restart();
+ }
+ else
+ {
+ owarn << "pcmcia: couldn't write binding to '" << conf << "' ( " << strerror( errno ) << " )." << oendl;
+ }
}
+}
+
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
@@ -11,41 +11,43 @@
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
#include "configdialogbase.h"
-namespace Opie { namespace Core { class OPcmciaSocket; }; };
+namespace Opie { namespace Core { class OPcmciaSocket; class OConfig; }; };
typedef QMap<QString,QString> StringMap;
class ConfigDialog : public ConfigDialogBase
{
Q_OBJECT
public:
ConfigDialog( const Opie::Core::OPcmciaSocket* card, QWidget* parent );
~ConfigDialog();
static QString preferredAction( const Opie::Core::OPcmciaSocket* card, const QString& type );
static QString readConfigEntry( const Opie::Core::OPcmciaSocket* card, const QString& key, const QString& defaultValue );
static void writeConfigEntry( const Opie::Core::OPcmciaSocket* card, const QString& key, const QString& value );
+ static Opie::Core::OConfig* cardConfig( const Opie::Core::OPcmciaSocket* card );
+ void writeConfiguration( const Opie::Core::OPcmciaSocket* card );
StringMap bindEntries;
};
#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
@@ -8,48 +8,49 @@
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "pcmcia.h"
#include "configdialog.h"
+#include "promptactiondialog.h"
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/odevice.h>
#include <opie2/oconfig.h>
#include <opie2/oprocess.h>
#include <opie2/opcmciasystem.h>
#include <opie2/oresource.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/applnk.h>
#include <qpe/global.h>
#include <qpe/resource.h>
using namespace Opie::Core;
using namespace Opie::Ui;
/* QT */
#include <qcombobox.h>
#include <qcopchannel_qws.h>
#include <qpainter.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qmessagebox.h>
#include <qsound.h>
#include <qtimer.h>
@@ -117,50 +118,50 @@ void PcmciaManager::popUp( QString message, QString icon )
}
popupMenu->clear();
if ( icon.isEmpty() ) {
popupMenu->insertItem( message, 0 );
} else {
popupMenu->insertItem( QIconSet( Opie::Core::OResource::loadPixmap( icon, Opie::Core::OResource::SmallIcon ) ),
message, 0 );
}
QPoint p = mapToGlobal( QPoint( 0, 0 ) );
QSize s = popupMenu->sizeHint();
popupMenu->popup( QPoint( p.x() + ( width() / 2 ) - ( s.width() / 2 ),
p.y() - s.height() ), 0 );
QTimer::singleShot( 2000, this, SLOT( popupTimeout() ) );
}
void PcmciaManager::popupTimeout()
{
popupMenu->hide();
}
-enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE };
-static const char* actionText[] = { "eject", "insert", "suspend", "resum", "resett", "configur" };
+enum { EJECT, INSERT, SUSPEND, RESUME, RESET, CONFIGURE, ACTIVATE };
+static const char* actionText[] = { "eject", "insert", "suspend", "resum", "resett", "configur", "activat" };
void PcmciaManager::mousePressEvent( QMouseEvent* )
{
QPopupMenu* menu = new QPopupMenu( this );
QStringList cmd;
bool execute = true;
OPcmciaSystem* sys = OPcmciaSystem::instance();
sys->synchronize();
OPcmciaSystem::CardIterator it = sys->iterator();
if ( !sys->count() ) return;
int i = 0;
while ( it.current() )
{
QPopupMenu* submenu = new QPopupMenu( menu );
submenu->insertItem( "&Eject", EJECT+i*100 );
submenu->insertItem( "&Insert", INSERT+i*100 );
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 );
bool isSuspended = it.current()->isSuspended();
@@ -225,170 +226,143 @@ void PcmciaManager::cardMessage( const QCString & msg, const QByteArray & )
QString name = cfg.readEntry( "name" );
odebug << "pcmcia: comparing card '" << cardName << "' with known card '" << name << "'" << oendl;
if ( cardName == name )
{
newCard = false;
odebug << "pcmcia: we have seen this card before" << oendl;
executeAction( theCard, "insert" );
break;
}
}
if ( !newCard ) ++it; else break;
}
}
if ( newCard )
{
odebug << "pcmcia: unconfigured card detected" << oendl;
QString newCardName = theCard->productIdentity();
int result = QMessageBox::information( qApp->desktop(),
tr( "PCMCIA/CF Subsystem" ),
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 ),
tr( "Yes" ), tr( "No" ), 0, 0, 1 );
odebug << "pcmcia: result = " << result << oendl;
if ( result == 0 )
{
- QString insertAction; QString resumeAction; QString driver; QString conf;
- bool configured = configure( theCard, insertAction, resumeAction, driver, conf );
-
- if ( configured )
- {
- odebug << "pcmcia: card has been configured. writing out to database" << oendl;
- cfg.setGroup( QString( "Card_%1" ).arg( nCards ) );
- cfg.writeEntry( "name", newCardName );
- cfg.writeEntry( "insertAction", insertAction );
- cfg.writeEntry( "resumeAction", resumeAction );
- cfg.setGroup( "Global" );
- cfg.writeEntry( "nCards", nCards+1 );
- cfg.write();
-
- QFile confFile( conf );
- if ( confFile.open( IO_ReadWrite | IO_Append ) )
- {
- QString entryCard = QString( "card \"%1\"" ).arg( newCardName );
- QString entryVersion( " version " );
- for ( QStringList::Iterator it = theCard->productIdentityVector().begin(); it != theCard->productIdentityVector().end(); ++it )
- {
- entryVersion += QString( "\"%1\", " ).arg( *it );
- }
- QString entryBind = QString( " bind %1" ).arg( driver );
- QString entry = QString( "\n%1\n%2\n%3\n" ).arg( entryCard ).arg( entryVersion ).arg( entryBind );
- odebug << "pcmcia: writing entry...:" << entry << oendl;
-
- confFile.writeBlock( (const char*) entry, entry.length() );
- Global::statusMessage( "restarting pcmcia services..." );
- ::system( "/etc/init.d/pcmcia restart" );
- }
- else
- {
- owarn << "pcmcia: couldn't write binding to '" << conf << "' ( " << strerror( errno ) << " )." << oendl;
- }
- }
- else
- {
- odebug << "pcmcia: card has not been configured this time. leaving as unknown card" << oendl;
- }
+ configure( theCard );
}
else
{
odebug << "pcmcia: user doesn't want to configure " << newCardName << " now." << oendl;
}
}
else // it's an already configured card
{
odebug << "pcmcia: doing nothing... why do we come here?" << oendl;
}
}
void PcmciaManager::paintEvent( QPaintEvent * )
{
QPainter p( this );
p.drawPixmap( 0, 0, pm );
}
int PcmciaManager::position()
{
return 7;
}
void PcmciaManager::execCommand( const QStringList &strList )
{
}
void PcmciaManager::userCardAction( int action )
{
odebug << "pcmcia: user action on socket " << action / 100 << " requested. action = " << action << oendl;
int socket = action / 100;
int what = action % 100;
bool success = false;
switch ( what )
{
case CONFIGURE:
{
QString insertAction; QString resumeAction; QString driver; QString conf;
- configure( OPcmciaSystem::instance()->socket( socket ), insertAction, resumeAction, driver, conf );
+ configure( OPcmciaSystem::instance()->socket( socket ) );
return;
}
case EJECT: success = OPcmciaSystem::instance()->socket( socket )->eject();
break;
case INSERT: success = OPcmciaSystem::instance()->socket( socket )->insert();
break;
case SUSPEND: success = OPcmciaSystem::instance()->socket( socket )->suspend();
break;
case RESUME: success = OPcmciaSystem::instance()->socket( socket )->resume();
break;
case RESET: success = OPcmciaSystem::instance()->socket( socket )->reset();
break;
+ case ACTIVATE: success = true;
+ break;
default: odebug << "pcmcia: not yet implemented" << oendl;
}
if ( success )
{
+ odebug << tr( "Successfully %1ed card in socket #%2" ).arg( actionText[action] ).arg( socket ) << oendl;
popUp( tr( "Successfully %1ed card in socket #%2" ).arg( actionText[action] ).arg( socket ) );
}
else
{
+ odebug << tr( "Error while %1ing card in socket #%2" ).arg( actionText[action] ).arg( socket ) << oendl;
popUp( tr( "Error while %1ing card in socket #%2" ).arg( actionText[action] ).arg( socket ) );
}
}
-bool PcmciaManager::configure( OPcmciaSocket* card, QString& insertAction, QString& resumeAction, QString& driver, QString& conf )
+void PcmciaManager::configure( OPcmciaSocket* card )
{
configuring = true;
ConfigDialog dialog( card, qApp->desktop() );
- int configresult = QPEApplication::execDialog( &dialog, false );
+ int result = QPEApplication::execDialog( &dialog, false );
configuring = false;
- odebug << "pcmcia: configresult = " << configresult << oendl;
- if ( configresult )
+ odebug << "pcmcia: configresult = " << result << oendl;
+ if ( result )
{
- insertAction = dialog.cbInsertAction->currentText();
- resumeAction = dialog.cbResumeAction->currentText();
- driver = dialog.cbBindTo->currentText();
- conf = dialog.bindEntries[driver];
+ dialog.writeConfiguration( card );
}
- return configresult;
}
void PcmciaManager::executeAction( Opie::Core::OPcmciaSocket* card, const QString& type )
{
odebug << "pcmcia: performing " << type << " action ..." << oendl;
QString theAction = ConfigDialog::preferredAction( card, type );
int intAction = card->number() * 100;
- if ( theAction == "activate" ) ;
- else if ( theAction == "eject" ) intAction += EJECT;
- else if ( theAction == "suspend" ) intAction += SUSPEND;
- else if ( theAction == "prompt for" )
+
+ if ( theAction == "prompt for" )
{
- odebug << "pcmcia: sorry, not 'prompt for' is not yet implemented!" << oendl;
+ PromptActionDialog dialog( qApp->desktop(), "promptfor", true );
+ dialog.setCaption( QString( "Choose action for card #%1" ).arg( card->number() ) );
+ int result = QPEApplication::execDialog( &dialog, true );
+ odebug << "pcmcia: configresult = " << result << oendl;
+ if ( result )
+ {
+ theAction = dialog.cbAction->currentText();
+ }
+ else
+ {
+ odebug << "pcmcia: prompted to do nothing" << oendl;
return;
}
+ }
+ if ( theAction == "activate" ) intAction += ACTIVATE;
+ else if ( theAction == "eject" ) intAction += EJECT;
+ else if ( theAction == "suspend" ) intAction += SUSPEND;
else
{
owarn << "pcmcia: action '" << theAction << "' not known. Huh?" << oendl;
return;
}
userCardAction( intAction );
}
EXPORT_OPIE_APPLET_v1( PcmciaManager )
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
@@ -34,39 +34,39 @@
#include <qpixmap.h>
#include <qpopupmenu.h>
namespace Opie { namespace Core { class OPcmciaSocket; } };
class PcmciaManager : public QWidget
{
Q_OBJECT
public:
PcmciaManager( QWidget *parent = 0 );
~PcmciaManager();
static int position();
private slots:
void handleSystemChannel( const QCString&, const QByteArray& );
void cardMessage( const QCString&, const QByteArray& );
void userCardAction( int action );
void popupTimeout();
protected:
void paintEvent( QPaintEvent* );
void mousePressEvent( QMouseEvent * );
private:
- bool configure( Opie::Core::OPcmciaSocket*, QString&, QString&, QString&, QString& );
+ void configure( Opie::Core::OPcmciaSocket* );
void execCommand( const QStringList &command );
void executeAction( Opie::Core::OPcmciaSocket*, const QString& );
void popUp( QString message, QString icon = QString::null );
private:
bool configuring;
int commandOrig;
QPixmap pm;
QPopupMenu *popupMenu;
};
#endif
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 @@
TEMPLATE = lib
CONFIG += qt plugin warn_on
-INTERFACES = configdialogbase.ui
+INTERFACES = configdialogbase.ui \
+ promptactiondialog.ui
HEADERS = pcmcia.h \
configdialog.h
SOURCES = pcmcia.cpp \
configdialog.cpp
TARGET = pcmciaapplet
DESTDIR = $(OPIEDIR)/plugins/applets
+
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2
-VERSION = 0.2.0
+VERSION = 0.9.0
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 @@
+<!DOCTYPE UI><UI>
+<class>PromptActionDialog</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>PromptActionDialog</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>273</width>
+ <height>55</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Choose Action for Card</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>activate</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>suspend</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>eject</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>cbAction</cstring>
+ </property>
+ </widget>
+ </grid>
+</widget>
+</UI>