summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/panpopup.cpp
blob: 2fd9eaf5bdc2f849db2643e3692f8b774641ec81 (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
66
67
68
69
70
71
72
#include <qpe/qcopenvelope_qws.h>
#include <qmessagebox.h>
#include <opie2/odebug.h>
#include <opie2/oprocess.h>
#include <qpe/qpeapplication.h>
#include "pandialog.h"
using namespace Opie::Core;

#include <qtimer.h>

#include "panpopup.h"

using namespace OpieTooth;

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

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

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

    m_panconnection = 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() ) );

};

PanPopup::~PanPopup() {

}

void PanPopup::slotConnect() {
    odebug << "connect" << oendl;
    PanDialog pandlg(m_item->mac());
    QPEApplication::execDialog(&pandlg);
}

void PanPopup::slotDisconnect()  {
    if (!m_panconnection) 
        m_panconnection = new StartPanConnection( m_item->mac() );
    m_panconnection->stop();
    QMessageBox::information(this, tr("Pan Disconnect"), tr("PAN Disconnected"));
}


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

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

}