summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-07-13 19:34:46 (UTC)
committer mickeyl <mickeyl>2004-07-13 19:34:46 (UTC)
commita309681894af2632f9db2fcc252a058f218a82b2 (patch) (unidiff)
treeea4e36b019cdc25c1043e5e3d000fbaacca71596
parent03930fa4871365efb6438b74b3a68f8f06aa7e4f (diff)
downloadopie-a309681894af2632f9db2fcc252a058f218a82b2.zip
opie-a309681894af2632f9db2fcc252a058f218a82b2.tar.gz
opie-a309681894af2632f9db2fcc252a058f218a82b2.tar.bz2
convert blue-pin to be quicklaunchable. patch courtesy Thomas Themel.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/main.cc3
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc63
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.h15
3 files changed, 78 insertions, 3 deletions
diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc
index aa360aa..29e46ae 100644
--- a/noncore/net/opietooth/blue-pin/main.cc
+++ b/noncore/net/opietooth/blue-pin/main.cc
@@ -5,2 +5,3 @@
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <opie2/oapplicationfactory.h>
6 7
@@ -8,2 +9,4 @@
8 9
10using namespace Opie::Core;
11OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> )
9 12
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,3 +25,25 @@ PinDlg::PinDlg( const QString& status,
25 txtStatus->setText(status); 25 txtStatus->setText(status);
26 QPEApplication::showDialog( this ); 26 if(!m_mac.isEmpty())
27 QPEApplication::showDialog( this );
28}
29
30PinDlg::PinDlg(QWidget* parent,
31 const char* name,
32 Qt::WFlags f )
33 : PinDlgBase( parent, name, f )
34{
35 m_mac = makeMacFromArgs();
36
37 if(m_mac.isEmpty())
38 {
39 // can't obtain MAC
40 printf("ERR\n");
41 qApp->quit();
42 }
43 else
44 {
45 test( m_mac );
46 txtStatus->setText(makeTextFromArgs());
47 QPEApplication::showDialog( this ) ;
48 }
27} 49}
@@ -30,2 +52,3 @@ PinDlg::~PinDlg()
30{} 52{}
53
31void PinDlg::setMac( const QString& mac ) 54void PinDlg::setMac( const QString& mac )
@@ -34,2 +57,3 @@ void PinDlg::setMac( const QString& mac )
34} 57}
58
35QString PinDlg::pin() const 59QString PinDlg::pin() const
@@ -50,6 +74,41 @@ void PinDlg::test( const QString& mac )
50 } 74 }
75 }
76
77}
78
79QString PinDlg::makeTextFromArgs()
80{
81 if(qApp->argc() > 2)
82 {
83 QCString dir(qApp->argv()[1]) ;
84 QCString bdaddr(qApp->argv()[2]) ;
85
86 QCString name;
87 if ( qApp->argc() > 3 ) {
88 name = qApp->argv()[3];
89 }
90 QString status;
91 if (dir == "out" ) {
92 status = QObject::tr("Outgoing connection to ");
93 } else
94 status = QObject::tr("Incoming connection from ");
51 95
96 status += name;
97 status += "<br>";
98 status += "[" + bdaddr + "]";
99
100 return status ;
52 } 101 }
102 else
103 return QString();
104}
53 105
106QString PinDlg::makeMacFromArgs()
107{
108 if(qApp->argc() < 3)
109 return QString();
110 else
111 return qApp->argv()[2] ;
54} 112}
113
55void PinDlg::accept() 114void PinDlg::accept()
@@ -62,3 +121,5 @@ void PinDlg::accept()
62 } 121 }
122 printf("PIN:%s\n", lnePin->text().latin1());
63 QDialog::accept(); 123 QDialog::accept();
124 qApp->quit();
64} 125}
diff --git a/noncore/net/opietooth/blue-pin/pindlg.h b/noncore/net/opietooth/blue-pin/pindlg.h
index 5e5a763..5f7dc55 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.h
+++ b/noncore/net/opietooth/blue-pin/pindlg.h
@@ -12,6 +12,11 @@ namespace OpieTooth {
12 public: 12 public:
13 PinDlg(const QString& text, 13 PinDlg(const QString& text="",
14 const QString& mac, 14 const QString& mac="",
15 QWidget* parent = 0, 15 QWidget* parent = 0,
16 const char* name= 0 ); 16 const char* name= 0 );
17
18 PinDlg(QWidget* parent,
19 const char* name,
20 Qt::WFlags f );
21
17 ~PinDlg(); 22 ~PinDlg();
@@ -19,2 +24,4 @@ namespace OpieTooth {
19 QString pin() const; 24 QString pin() const;
25
26 static QString appName() { return QString::fromLatin1("bluepin") ; }
20 27
@@ -22,2 +29,6 @@ namespace OpieTooth {
22 void test( const QString& mac ); 29 void test( const QString& mac );
30
31 QString makeTextFromArgs();
32 QString makeMacFromArgs();
33
23 QString m_mac; 34 QString m_mac;