summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/blue-pin/pindlg.cc
blob: f0b2309ee7e8fce35f2ae3a3bdceabf4015f0596 (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

#include "pindlg.h"

/* OPIE */
#include <qpe/config.h>
#include <qpe/qpeapplication.h>

/* QT */
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>

/* STD */
#include <stdio.h>

using namespace OpieTooth;

PinDlg::PinDlg( const QString& status,
                const QString& mac, QWidget* parent,
                const char* name )
        : PinDlgBase( parent, name, WType_Modal )
{
    m_mac = mac;
    test( mac );
    txtStatus->setText(status);
    QPEApplication::showDialog( this );
}

PinDlg::~PinDlg()
{}
void PinDlg::setMac( const QString& mac )
{
    txtStatus->setText( mac );
}
QString PinDlg::pin() const
{
    return lnePin->text();
}

void PinDlg::test( const QString& mac )
{
    if (!mac.isEmpty() )
    {
        Config cfg("bluepin");
        cfg.setGroup(mac);
        lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) );
        if ( !lnePin->text().isEmpty() )
        {
            //QTimer::singleShot(100,  this,  SLOT(accept() ) );
        }

    }

}
void PinDlg::accept()
{
    if ( ckbPin->isChecked() )
    {
        Config cfg("bluepin");
        cfg.setGroup(m_mac );
        cfg.writeEntryCrypt("pin", lnePin->text() );
    }
    QDialog::accept();
}