summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp21
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 8c2015e..f24e09f 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -522,48 +522,69 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
setText( col_firstseen, QTime::currentTime().toString() );
//setText( col_lastseen, QTime::currentTime().toString() );
listView()->triggerUpdate();
this->type = type;
_type = type;
_essid = essid;
_macaddr = macaddr;
_channel = channel;
_beacons = 1;
_signal = 0;
if ( WellenreiterConfigWindow::instance()->openTree->isChecked() )
{
listView()->ensureItemVisible( this );
}
}
void MScanListItem::setManufacturer( const QString& manufacturer )
{
setText( col_manuf, manufacturer );
}
void MScanListItem::setLocation( const QString& location )
{
setText( col_location, location );
}
void MScanListItem::receivedBeacon()
{
_beacons++;
#ifdef DEBUG
odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl;
#endif
setText( col_sig, QString::number( _beacons ) );
setText( col_lastseen, QTime::currentTime().toString() );
MScanListItem* p = (MScanListItem*) parent();
if ( p ) p->receivedBeacon();
}
+QString MScanListItem::key( int id, bool b )const {
+ QString str;
+
+ /*
+ * Pad the amount of received packages, number
+ * of the channel.
+ */
+ switch( id ) {
+ case col_sig:
+ str = text(col_sig).rightJustify( 20, '0' );
+ break;
+ case col_channel:
+ str = text(col_channel).rightJustify( 2, '0' );
+ break;
+ default:
+ str = Opie::Ui::OListViewItem::key( id, b );
+ break;
+ }
+
+ return str;
+}
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 6a80f70..8b3814a 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -65,76 +65,78 @@ class MScanListView: public Opie::Ui::OListView
//****************************** MScanListItem ****************************************************************
class MScanListItem: public Opie::Ui::OListViewItem
{
public:
MScanListItem::MScanListItem( QListView* parent,
const QString& type = "unknown",
const QString& essid = "unknown",
const QString& macaddr = "unknown",
bool wep = false,
int channel = 0,
int signal = 0,
bool probed = false );
MScanListItem::MScanListItem( QListViewItem* parent,
const QString& type = "unknown",
const QString& essid = "unknown",
const QString& macaddr = "unknown",
bool wep = false,
int channel = 0,
int signal = 0 );
protected:
virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed );
public:
QString type;
public:
//const QString& type() { return _type; };
const QString& essid() const;
const QString& macaddr() { return _macaddr; };
bool wep() { return _wep; };
int channel() { return _channel; };
int signal() { return _signal; };
int beacons() { return _beacons; };
void setSignal( int signal ) { /* TODO */ };
void receivedBeacon();
void setManufacturer( const QString& manufacturer );
void setLocation( const QString& location );
virtual Opie::Ui::OListViewItem* childFactory();
virtual void serializeTo( QDataStream& s ) const;
virtual void serializeFrom( QDataStream& s );
+ virtual QString key( int id, bool )const;
+
private:
QString _type;
QString _essid;
QString _macaddr;
bool _wep;
int _channel;
int _signal;
int _beacons;
};
//****************************** MScanListViewFactory ****************************************************************
/*
class MScanListViewFactory : public Opie::Ui::OListViewFactory
{
public:
virtual QListView* listViewFactory();
virtual QListViewItem* listViewItemFactory( QListView* lv );
virtual QListViewItem* listViewItemFactory( QListViewItem* lvi );
virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text );
virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text );
}
*/
#endif