author | mickeyl <mickeyl> | 2003-06-15 12:45:31 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-06-15 12:45:31 (UTC) |
commit | 6b682070b6d83f3537dd9fa5aee715ab142a04e6 (patch) (side-by-side diff) | |
tree | b152def34a4fe52ef6195af9c1c324b23a3d7981 | |
parent | 7feda6ad0e05602d0a939f9867f296f62ae758cd (diff) | |
download | opie-6b682070b6d83f3537dd9fa5aee715ab142a04e6.zip opie-6b682070b6d83f3537dd9fa5aee715ab142a04e6.tar.gz opie-6b682070b6d83f3537dd9fa5aee715ab142a04e6.tar.bz2 |
basic framework for context menu "join network" established
just need to send the proper qcop messages now
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 39 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 8 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 18 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 2 |
4 files changed, 66 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 809d0bd..085eec4 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp @@ -22,4 +22,6 @@ #include <qtextstream.h> +#include <qpopupmenu.h> #ifdef QWS +#include <qpe/qpeapplication.h> #include <opie/odevice.h> @@ -76,2 +78,10 @@ MScanListView::MScanListView( QWidget* parent, const char* name ) setAllColumnsShowFocus( true ); + + connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), + this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); + + #ifdef QWS + QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); + #endif + }; @@ -319,2 +329,23 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) +void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) +{ + if ( !item ) return; + + MScanListItem* itm = static_cast<MScanListItem*>( item ); + + qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", + (const char*) itm->text(0), (const char*) itm->type, col ); + + if ( itm->type == "adhoc" || itm->type == "managed" ) + { + QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); + + QPopupMenu m( this ); + m.insertItem( entry, 37773, 0 ); + int result = m.exec( QCursor::pos() ); + if ( result == 37773 ) + emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); + } +} + //============================================================ @@ -347,2 +378,10 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid +const QString& MScanListItem::essid() const +{ + if ( type == "network" ) + return _essid; + else + return ( (MScanListItem*) parent() )->essid(); +} + OListViewItem* MScanListItem::childFactory() diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index 253c166..5aba0d2 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h @@ -49,2 +49,8 @@ class MScanListView: public OListView + void contextMenuRequested( QListViewItem* item, const QPoint&, int ); + + signals: + void rightButtonClicked(QListViewItem*,const QPoint&,int); + void joinNetwork( const QString&, const QString&, int, const QString& ); + protected: @@ -84,3 +90,3 @@ class MScanListItem: public OListViewItem //const QString& type() { return _type; }; - const QString& essid() { return _essid; }; + const QString& essid() const; const QString& macaddr() { return _macaddr; }; diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 2f26702..8a9e55d 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp @@ -30,2 +30,3 @@ #include <opie/odevice.h> +#include <qpe/qcopenvelope_qws.h> using namespace Opie; @@ -83,2 +84,4 @@ Wellenreiter::Wellenreiter( QWidget* parent ) netview->setColumnWidthMode( 1, QListView::Manual ); + connect( netview, SIGNAL( joinNetwork(const QString&,const QString&,int,const QString&) ), + this, SLOT( joinNetwork(const QString&,const QString&,int,const QString&) ) ); pcap = new OPacketCapturer(); @@ -490 +493,16 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa +void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) +{ + qDebug( "joinNetwork() - %s, %s, %d, %s", + (const char*) type, + (const char*) essid, + channel, + (const char*) macaddr ); + + // TODO: Stop scanning here + + QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); + msg << "test" << "test" << "test"; + +} + diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h index f23ca4d..e1062df 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.h +++ b/noncore/net/wellenreiter/gui/wellenreiter.h @@ -61,2 +61,4 @@ class Wellenreiter : public WellenreiterBase { + void joinNetwork(const QString&,const QString&,int,const QString&); + signals: |