summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/manager/obexftpopup.cpp
blob: 38f3a43d887473b8f796b0837fb584f522289f6e (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
/* $Id$ */
/* OBEX file browser popup */
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#include "obexdialog.h"
#include "obexftpopup.h"
#include "obexftpdialog.h"

/* OPIE */
#include <qpe/qpeapplication.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
using namespace OpieTooth;

ObexFtpPopup::ObexFtpPopup(const OpieTooth::Services& service,  
    OpieTooth::BTDeviceItem* item)
    : QPopupMenu(), m_service(service)
{
    odebug << "ObexFtpPopup c'tor" << oendl; 

    m_item = item;
    /* connect action */
    m_push = new QAction( ); // so it's get deleted
    m_push->setText("Push file");
    m_push->addTo( this );
    connect(m_push, SIGNAL(activated()), SLOT(slotPush()));

    /* browse action */
    m_browse = new QAction(this);
    m_browse->setText("Browse device");
    m_browse->addTo(this);
    connect(m_browse, SIGNAL(activated()), SLOT(slotBrowse()));
}


ObexFtpPopup::~ObexFtpPopup()
{
    delete m_push;
    delete m_browse;
}

void ObexFtpPopup::slotBrowse()
{
    odebug << "browse" <<oendl;
    ObexFtpDialog ftpDlg(m_item->mac(), 
        m_service.protocolDescriptorList().last().port());
    QPEApplication::execDialog(&ftpDlg);
}

void ObexFtpPopup::slotPush()
{
    QString device = m_item->mac();
    int port = m_service.protocolDescriptorList().last().port();
    device += "@";
    device += QString::number(port);
    owarn << "push something to " << device << oendl; 
    ObexDialog obexDialog(device);
    QPEApplication::execDialog( &obexDialog );
}

//eof