summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-04-19 10:11:09 (UTC)
committer mickeyl <mickeyl>2005-04-19 10:11:09 (UTC)
commit9b8dd642c4b135070911c78bb5d31a7add7162ee (patch) (side-by-side diff)
tree1d0ac94b911609605403ef83ceda0f5052757e7a
parent16202ec32c1647b113fd7c06bc652bff32e6d6d2 (diff)
downloadopie-9b8dd642c4b135070911c78bb5d31a7add7162ee.zip
opie-9b8dd642c4b135070911c78bb5d31a7add7162ee.tar.gz
opie-9b8dd642c4b135070911c78bb5d31a7add7162ee.tar.bz2
This patch courtesy Gints Polis:
* gives possibility to enter numerical PIN with dialog buttons for keybordless PDA. * dialog run in full screen mode.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc12
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.h1
-rw-r--r--noncore/net/opietooth/blue-pin/pindlgbase.ui597
3 files changed, 505 insertions, 105 deletions
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index e40fe33..3db6095 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -1,109 +1,119 @@
#include "pindlg.h"
/* OPIE */
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlineedit.h>
+#include <qpushbutton.h>
/* STD */
#include <stdio.h>
using namespace OpieTooth;
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");
::exit(0);
}
else
{
test( m_mac );
txtStatus->setText(makeTextFromArgs());
- QPEApplication::showDialog( this , true) ;
+ QPEApplication::showDialog( this , false) ;
}
}
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 ) );
}
}
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::null;
}
QString PinDlg::makeMacFromArgs()
{
if(qApp->argc() < 3)
return QString::null;
else
return qApp->argv()[2] ;
}
+void PinDlg::addnum()
+{
+ if( sender()->inherits( "QPushButton") ) {
+ const QPushButton* btn = static_cast<const QPushButton*> (sender());
+ lnePin->setText(lnePin->text() + btn->text());
+ }
+}
+
void PinDlg::accept()
{
if ( ckbPin->isChecked() )
{
Config cfg("bluepin");
cfg.setGroup(m_mac );
cfg.writeEntryCrypt("pin", lnePin->text() );
}
printf("PIN:%s\n", lnePin->text().latin1());
QDialog::accept();
qApp->quit();
::exit(0);
}
+
diff --git a/noncore/net/opietooth/blue-pin/pindlg.h b/noncore/net/opietooth/blue-pin/pindlg.h
index 8623274..1817aa8 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.h
+++ b/noncore/net/opietooth/blue-pin/pindlg.h
@@ -1,33 +1,34 @@
#include <qdialog.h>
#include "pindlgbase.h"
namespace OpieTooth {
class PinDlg : public PinDlgBase {
Q_OBJECT
public:
PinDlg(QWidget* parent = 0,const char* name = 0, Qt::WFlags f = 0);
~PinDlg();
void setMac( const QString& );
QString pin() const;
static QString appName() { return QString::fromLatin1("bluepin") ; }
private:
void test( const QString& mac );
QString makeTextFromArgs();
QString makeMacFromArgs();
QString m_mac;
protected slots:
void accept();
+ void addnum();
};
};
diff --git a/noncore/net/opietooth/blue-pin/pindlgbase.ui b/noncore/net/opietooth/blue-pin/pindlgbase.ui
index a79bb49..6586014 100644
--- a/noncore/net/opietooth/blue-pin/pindlgbase.ui
+++ b/noncore/net/opietooth/blue-pin/pindlgbase.ui
@@ -1,232 +1,621 @@
<!DOCTYPE UI><UI>
<class>PinDlgBase</class>
-<author>zecke</author>
+<author>gints</author>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>Form1</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>267</width>
- <height>161</height>
+ <width>196</width>
+ <height>175</height>
</rect>
</property>
<property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>3</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
<name>caption</name>
<string>Please enter pin</string>
</property>
- <grid>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>5</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
- <widget row="0" column="0" >
- <class>QLabel</class>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>txtStatus</cstring>
+ <cstring>Layout9</cstring>
</property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtStatus</cstring>
+ </property>
+ <property stdset="1">
+ <name>font</name>
+ <font>
+ </font>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enter PIN:</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>text</name>
- <string></string>
+ <name>name</name>
+ <cstring>Layout8</cstring>
</property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lnePin</cstring>
+ </property>
+ <property stdset="1">
+ <name>frame</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ckbPin</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Save</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>textFormat</name>
- <enum>RichText</enum>
+ <name>name</name>
+ <cstring>Layout22</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>32767</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property>
+ <name>layoutMargin</name>
</property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>bt1</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>1</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>bt2</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>2</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>bt3</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>3</string>
+ </property>
+ </widget>
+ </hbox>
</widget>
- <widget row="1" column="0" >
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout6</cstring>
+ <cstring>Layout22_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>32767</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
</property>
- <vbox>
+ <hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
<widget>
- <class>QLabel</class>
+ <class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel3</cstring>
+ <cstring>bt4</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
</property>
<property stdset="1">
<name>text</name>
- <string>Please enter PIN:</string>
+ <string>4</string>
</property>
</widget>
<widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout5</cstring>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget>
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>lnePin</cstring>
- </property>
- <property stdset="1">
- <name>echoMode</name>
- <enum>Password</enum>
- </property>
- </widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer4</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Fixed</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>21</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </hbox>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>bt5</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>5</string>
+ </property>
</widget>
<widget>
- <class>QCheckBox</class>
+ <class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>ckbPin</cstring>
+ <cstring>bt6</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
</property>
<property stdset="1">
<name>text</name>
- <string>Save pin</string>
+ <string>6</string>
</property>
</widget>
- </vbox>
+ </hbox>
</widget>
- <widget row="2" column="0" >
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout7</cstring>
+ <cstring>Layout22_2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>32767</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>2</number>
</property>
- <spacer>
- <property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer1</cstring>
+ <cstring>bt7</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
</property>
<property stdset="1">
- <name>sizeType</name>
- <enum>Fixed</enum>
+ <name>text</name>
+ <string>7</string>
</property>
- <property>
- <name>sizeHint</name>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>bt8</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
<size>
- <width>30</width>
- <height>20</height>
+ <width>60</width>
+ <height>25</height>
</size>
</property>
- </spacer>
+ <property stdset="1">
+ <name>text</name>
+ <string>8</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>bt9</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>9</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout24</cstring>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>32767</width>
+ <height>35</height>
+ </size>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>2</number>
+ </property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>PushButton1</cstring>
</property>
<property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
+ </property>
+ <property stdset="1">
<name>text</name>
<string>&amp;Ok</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
- <cstring>PushButton2</cstring>
+ <cstring>bt0</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
+ </property>
+ <property stdset="1">
+ <name>maximumSize</name>
+ <size>
+ <width>60</width>
+ <height>25</height>
+ </size>
</property>
<property stdset="1">
<name>text</name>
- <string>&amp;Cancel</string>
+ <string>0</string>
</property>
</widget>
- <spacer>
- <property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer2</cstring>
+ <cstring>PushButton2</cstring>
</property>
<property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>1</vsizetype>
+ </sizepolicy>
</property>
<property stdset="1">
- <name>sizeType</name>
- <enum>Fixed</enum>
- </property>
- <property>
- <name>sizeHint</name>
+ <name>maximumSize</name>
<size>
- <width>16</width>
- <height>20</height>
+ <width>60</width>
+ <height>25</height>
</size>
</property>
- </spacer>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
</hbox>
</widget>
- </grid>
+ </vbox>
</widget>
<connections>
<connection>
+ <sender>PushButton2</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
<sender>PushButton1</sender>
<signal>clicked()</signal>
<receiver>Form1</receiver>
<slot>accept()</slot>
</connection>
<connection>
- <sender>PushButton2</sender>
+ <sender>bt0</sender>
<signal>clicked()</signal>
<receiver>Form1</receiver>
- <slot>reject()</slot>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt1</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt2</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt3</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt4</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt5</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt6</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt7</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt8</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
+ </connection>
+ <connection>
+ <sender>bt9</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>addnum()</slot>
</connection>
+ <slot access="protected">addnum()</slot>
</connections>
+<tabstops>
+ <tabstop>lnePin</tabstop>
+ <tabstop>PushButton1</tabstop>
+ <tabstop>PushButton2</tabstop>
+ <tabstop>bt1</tabstop>
+ <tabstop>bt2</tabstop>
+ <tabstop>bt3</tabstop>
+ <tabstop>bt4</tabstop>
+ <tabstop>bt5</tabstop>
+ <tabstop>bt6</tabstop>
+ <tabstop>bt7</tabstop>
+ <tabstop>bt8</tabstop>
+ <tabstop>bt9</tabstop>
+ <tabstop>bt0</tabstop>
+</tabstops>
</UI>