author | harlekin <harlekin> | 2003-03-21 15:56:58 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-21 15:56:58 (UTC) |
commit | d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c (patch) (unidiff) | |
tree | 922b36110df58bdc00a3e2508313609c0f00c45f /noncore/net/opietooth/manager/panpopup.cpp | |
parent | 69086f42072e7fc1ea5256cb9275a27bf5b41f87 (diff) | |
download | opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.zip opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.tar.gz opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.tar.bz2 |
move connection work to the lib
Diffstat (limited to 'noncore/net/opietooth/manager/panpopup.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/panpopup.cpp | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index d3d1347..61e632b 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp | |||
@@ -14,51 +14,43 @@ PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | |||
14 | qWarning("PanPopup c'tor"); | 14 | qWarning("PanPopup c'tor"); |
15 | 15 | ||
16 | m_item = item; | 16 | m_item = item; |
17 | m_panconnect = 0l; | 17 | QAction *a, *b, *c; |
18 | QAction *a, *b; | ||
19 | 18 | ||
19 | m_panconnection = 0l; | ||
20 | /* connect action */ | 20 | /* connect action */ |
21 | a = new QAction( ); // so it's get deleted | 21 | |
22 | a->setText( "connect" ); | 22 | |
23 | a = new QAction(); // so it's get deleted | ||
24 | a->setText( tr("connect") ); | ||
23 | a->addTo( this ); | 25 | a->addTo( this ); |
24 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); |
25 | 27 | ||
28 | |||
26 | b = new QAction(); | 29 | b = new QAction(); |
27 | b->setText( "connect+conf" ); | 30 | b->setText( tr( "connect+conf" ) ); |
28 | b->addTo( this ); | 31 | b->addTo( this ); |
29 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); | 32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); |
33 | |||
34 | c = new QAction(); | ||
35 | c->setText( tr( "disconnect" ) ); | ||
36 | c->addTo( this ); | ||
37 | connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); | ||
38 | |||
30 | }; | 39 | }; |
31 | 40 | ||
32 | PanPopup::~PanPopup() { | 41 | PanPopup::~PanPopup() { |
33 | delete m_panconnect; | 42 | |
34 | } | 43 | } |
35 | 44 | ||
36 | void PanPopup::slotConnect() { | 45 | void PanPopup::slotConnect() { |
37 | 46 | m_panconnection = new StartPanConnection( m_item->mac() ); | |
38 | 47 | m_panconnection->start(); | |
39 | // SHOULD move to lib | ||
40 | // before pand must be in "pand --listen --role panu" mode ( client ) | ||
41 | |||
42 | m_panconnect = new OProcess(); | ||
43 | *m_panconnect << "pand" << "--connect" << m_item->mac(); | ||
44 | |||
45 | connect( m_panconnect, SIGNAL( processExited( OProcess* ) ) , | ||
46 | this, SLOT( slotConnectExited( OProcess* ) ) ); | ||
47 | connect( m_panconnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | ||
48 | this, SLOT( slotConnectOut( OProcess*, char*, int ) ) ); | ||
49 | if (!m_panconnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | ||
50 | qWarning( "could not start" ); | ||
51 | delete m_panconnect; | ||
52 | } | ||
53 | } | 48 | } |
54 | 49 | ||
55 | void PanPopup::slotExited( OProcess* proc ) { | 50 | void PanPopup::slotDisconnect() { |
56 | delete m_panconnect; | 51 | m_panconnection->stop(); |
57 | } | 52 | } |
58 | 53 | ||
59 | void PanPopup::slotStdOut(OProcess* proc, char* chars, int len) | ||
60 | {} | ||
61 | |||
62 | 54 | ||
63 | void PanPopup::slotConnectAndConfig() { | 55 | void PanPopup::slotConnectAndConfig() { |
64 | slotConnect(); | 56 | slotConnect(); |