summaryrefslogtreecommitdiff
authorzecke <zecke>2005-02-20 13:06:59 (UTC)
committer zecke <zecke>2005-02-20 13:06:59 (UTC)
commitcc00ea4b5def00b6664bd5d9c5e5d59f5ce62732 (patch) (side-by-side diff)
tree23c51eb79b9d81519b6cd50221b0bbb051415634
parentbdbe220d0096667f26c8c25c1e1011c32fc54524 (diff)
downloadopie-cc00ea4b5def00b6664bd5d9c5e5d59f5ce62732.zip
opie-cc00ea4b5def00b6664bd5d9c5e5d59f5ce62732.tar.gz
opie-cc00ea4b5def00b6664bd5d9c5e5d59f5ce62732.tar.bz2
-Use own main method
-Remove default c'tor and use the remaining one as default -QString() -> QString::null (for Qt4 we will do the opposite) -use qApp->quit() and exit to be sure to really exit Still open: do not use the depcreated latin1 c'tor of QString, it is safe to use it here though (we only get IN/OUT and a mac address)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/main.cc9
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc26
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.h9
-rw-r--r--noncore/net/opietooth/blue-pin/pindlgbase.ui56
4 files changed, 20 insertions, 80 deletions
diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc
index dbe5b41..90d42e0 100644
--- a/noncore/net/opietooth/blue-pin/main.cc
+++ b/noncore/net/opietooth/blue-pin/main.cc
@@ -1,11 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <qpe/qpeapplication.h>
#include <opie2/oapplicationfactory.h>
#include "pindlg.h"
-using namespace Opie::Core;
-OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> )
+int main(int argc, char *argv[]) {
+ QPEApplication oapp(argc, argv);
+
+ OpieTooth::PinDlg dlg;
+ return oapp.exec();
+}
+
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index 96be1e5..e40fe33 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -1,125 +1,109 @@
#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);
- if(!m_mac.isEmpty())
- QPEApplication::showDialog( this );
-}
-
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();
+ ::exit(0);
}
else
{
test( m_mac );
txtStatus->setText(makeTextFromArgs());
- QPEApplication::showDialog( this ) ;
+ QPEApplication::showDialog( this , true) ;
}
}
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() ) );
- }
}
-
}
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();
+ return QString::null;
}
QString PinDlg::makeMacFromArgs()
{
if(qApp->argc() < 3)
- return QString();
+ return QString::null;
else
return qApp->argv()[2] ;
}
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 5f7dc55..8623274 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.h
+++ b/noncore/net/opietooth/blue-pin/pindlg.h
@@ -1,40 +1,33 @@
#include <qdialog.h>
#include "pindlgbase.h"
namespace OpieTooth {
class PinDlg : public PinDlgBase {
Q_OBJECT
public:
- PinDlg(const QString& text="",
- const QString& mac="",
- QWidget* parent = 0,
- const char* name= 0 );
-
- PinDlg(QWidget* parent,
- const char* name,
- Qt::WFlags f );
+ 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();
};
};
diff --git a/noncore/net/opietooth/blue-pin/pindlgbase.ui b/noncore/net/opietooth/blue-pin/pindlgbase.ui
index 6784de7..a79bb49 100644
--- a/noncore/net/opietooth/blue-pin/pindlgbase.ui
+++ b/noncore/net/opietooth/blue-pin/pindlgbase.ui
@@ -1,274 +1,232 @@
<!DOCTYPE UI><UI>
<class>PinDlgBase</class>
<author>zecke</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>254</width>
- <height>245</height>
+ <width>267</width>
+ <height>161</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Please enter pin</string>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer4_2</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Vertical</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>
+ <widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>txtStatus</cstring>
</property>
<property stdset="1">
<name>text</name>
<string></string>
</property>
<property stdset="1">
<name>textFormat</name>
<enum>RichText</enum>
</property>
</widget>
- <widget>
+ <widget row="1" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
</property>
<vbox>
<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>TextLabel3</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Please enter PIN:</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>
</widget>
<widget>
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>ckbPin</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Save pin</string>
</property>
</widget>
</vbox>
</widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer5</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Vertical</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>
+ <widget row="2" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout7</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>Spacer1</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>30</width>
<height>20</height>
</size>
</property>
</spacer>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>PushButton1</cstring>
</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>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Cancel</string>
</property>
</widget>
<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>Fixed</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
- </vbox>
+ </grid>
</widget>
<connections>
<connection>
<sender>PushButton1</sender>
<signal>clicked()</signal>
<receiver>Form1</receiver>
<slot>accept()</slot>
</connection>
<connection>
<sender>PushButton2</sender>
<signal>clicked()</signal>
<receiver>Form1</receiver>
<slot>reject()</slot>
</connection>
</connections>
</UI>