summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/dunpopup.cpp
blob: 10505a9e01b5c4a199ee13e9871a8a988d05ba2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <qpe/qcopenvelope_qws.h>

#include <qtimer.h>
#include <opie2/odebug.h>
using namespace Opie::Core;

#include "dunpopup.h"

using namespace OpieTooth;

/*
 * c'tor init the QAction
 */
DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu()  {

    owarn << "DunPopup c'tor" << oendl; 

    m_item = item;
    QAction *a, *b, *c;

    m_dunconnection = 0l;
    /* connect action */


    a = new QAction(); // so it's get deleted
    a->setText( tr("connect") );
    a->addTo( this );
    connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );


    b = new QAction();
    b->setText( tr( "connect+conf" ) );
    b->addTo( this );
    connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );

    c = new QAction();
    c->setText( tr( "disconnect" ) );
    c->addTo( this );
    connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );

};

DunPopup::~DunPopup() {

}

void DunPopup::slotConnect() {

    m_dunconnection = new StartDunConnection( m_item->mac() );
    m_dunconnection->start();
}

void DunPopup::slotDisconnect()  {
    m_dunconnection->stop();
}


void DunPopup::slotConnectAndConfig() {
    slotConnect();

    // more intelligence here later like passing the device ( bnepX )
    QCopEnvelope e( "QPE/System", "execute(QString)" );
    e << QString( "networksettings" );

}