summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/blue-pin/pindlg.cc
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/blue-pin/pindlg.cc') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc61
1 files changed, 61 insertions, 0 deletions
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index f0b2309..96be1e5 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -25,2 +25,3 @@ PinDlg::PinDlg( const QString& status,
txtStatus->setText(status);
+ if(!m_mac.isEmpty())
QPEApplication::showDialog( this );
@@ -28,4 +29,26 @@ PinDlg::PinDlg( const QString& status,
+PinDlg::PinDlg(QWidget* parent,
+ const char* name,
+ Qt::WFlags f )
+ : PinDlgBase( parent, name, f )
+{
+ m_mac = makeMacFromArgs();
+
+ if(m_mac.isEmpty())
+ {
+ // can't obtain MAC
+ printf("ERR\n");
+ qApp->quit();
+ }
+ else
+ {
+ test( m_mac );
+ txtStatus->setText(makeTextFromArgs());
+ QPEApplication::showDialog( this ) ;
+ }
+}
+
PinDlg::~PinDlg()
{}
+
void PinDlg::setMac( const QString& mac )
@@ -34,2 +57,3 @@ void PinDlg::setMac( const QString& mac )
}
+
QString PinDlg::pin() const
@@ -50,2 +74,3 @@ void PinDlg::test( const QString& mac )
}
+ }
@@ -53,3 +78,37 @@ void PinDlg::test( const QString& mac )
+QString PinDlg::makeTextFromArgs()
+{
+ if(qApp->argc() > 2)
+ {
+ QCString dir(qApp->argv()[1]) ;
+ QCString bdaddr(qApp->argv()[2]) ;
+
+ QCString name;
+ if ( qApp->argc() > 3 ) {
+ name = qApp->argv()[3];
+ }
+ QString status;
+ if (dir == "out" ) {
+ status = QObject::tr("Outgoing connection to ");
+ } else
+ status = QObject::tr("Incoming connection from ");
+
+ status += name;
+ status += "<br>";
+ status += "[" + bdaddr + "]";
+
+ return status ;
}
+ else
+ return QString();
+}
+
+QString PinDlg::makeMacFromArgs()
+{
+ if(qApp->argc() < 3)
+ return QString();
+ else
+ return qApp->argv()[2] ;
+}
+
void PinDlg::accept()
@@ -62,3 +121,5 @@ void PinDlg::accept()
}
+ printf("PIN:%s\n", lnePin->text().latin1());
QDialog::accept();
+ qApp->quit();
}