summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp39
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
@@ -19,10 +19,12 @@
#include <assert.h>
#include <qdatetime.h>
#include <qtextstream.h>
+#include <qpopupmenu.h>
#ifdef QWS
+#include <qpe/qpeapplication.h>
#include <opie/odevice.h>
using namespace Opie;
#endif
@@ -73,8 +75,16 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
addColumn( tr( "Last Seen" ) );
setColumnAlignment( col_lastseen, AlignCenter );
setRootIsDecorated( true );
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
+
};
MScanListView::~MScanListView()
@@ -316,8 +326,29 @@ void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
(const char*) macaddr.toString(), (const char*) 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() );
+ }
+}
+
//============================================================
// MScanListItem
//============================================================
@@ -344,8 +375,16 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid
#endif
decorateItem( type, essid, macaddr, wep, channel, signal );
}
+const QString& MScanListItem::essid() const
+{
+ if ( type == "network" )
+ return _essid;
+ else
+ return ( (MScanListItem*) parent() )->essid();
+}
+
OListViewItem* MScanListItem::childFactory()
{
return new MScanListItem( this );
}