author | mickeyl <mickeyl> | 2003-06-15 12:45:31 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-06-15 12:45:31 (UTC) |
commit | 6b682070b6d83f3537dd9fa5aee715ab142a04e6 (patch) (unidiff) | |
tree | b152def34a4fe52ef6195af9c1c324b23a3d7981 /noncore/net/wellenreiter/gui/scanlist.cpp | |
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
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 39 |
1 files changed, 39 insertions, 0 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 @@ | |||
22 | #include <qtextstream.h> | 22 | #include <qtextstream.h> |
23 | #include <qpopupmenu.h> | ||
23 | 24 | ||
24 | #ifdef QWS | 25 | #ifdef QWS |
26 | #include <qpe/qpeapplication.h> | ||
25 | #include <opie/odevice.h> | 27 | #include <opie/odevice.h> |
@@ -76,2 +78,10 @@ MScanListView::MScanListView( QWidget* parent, const char* name ) | |||
76 | setAllColumnsShowFocus( true ); | 78 | setAllColumnsShowFocus( true ); |
79 | |||
80 | connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), | ||
81 | this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); | ||
82 | |||
83 | #ifdef QWS | ||
84 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | ||
85 | #endif | ||
86 | |||
77 | }; | 87 | }; |
@@ -319,2 +329,23 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | |||
319 | 329 | ||
330 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | ||
331 | { | ||
332 | if ( !item ) return; | ||
333 | |||
334 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | ||
335 | |||
336 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | ||
337 | (const char*) itm->text(0), (const char*) itm->type, col ); | ||
338 | |||
339 | if ( itm->type == "adhoc" || itm->type == "managed" ) | ||
340 | { | ||
341 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | ||
342 | |||
343 | QPopupMenu m( this ); | ||
344 | m.insertItem( entry, 37773, 0 ); | ||
345 | int result = m.exec( QCursor::pos() ); | ||
346 | if ( result == 37773 ) | ||
347 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | ||
348 | } | ||
349 | } | ||
350 | |||
320 | //============================================================ | 351 | //============================================================ |
@@ -347,2 +378,10 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid | |||
347 | 378 | ||
379 | const QString& MScanListItem::essid() const | ||
380 | { | ||
381 | if ( type == "network" ) | ||
382 | return _essid; | ||
383 | else | ||
384 | return ( (MScanListItem*) parent() )->essid(); | ||
385 | } | ||
386 | |||
348 | OListViewItem* MScanListItem::childFactory() | 387 | OListViewItem* MScanListItem::childFactory() |