summaryrefslogtreecommitdiff
path: root/noncore
authorkorovkin <korovkin>2006-04-04 12:15:10 (UTC)
committer korovkin <korovkin>2006-04-04 12:15:10 (UTC)
commit57f97a65fc7ce932231585895f358f1089900879 (patch) (side-by-side diff)
tree026f02a04d8f78da60fef452f07ee1a0282d113e /noncore
parent70c7420d074505c75a5482e3e71be2e403df7b62 (diff)
downloadopie-57f97a65fc7ce932231585895f358f1089900879.zip
opie-57f97a65fc7ce932231585895f358f1089900879.tar.gz
opie-57f97a65fc7ce932231585895f358f1089900879.tar.bz2
Added headers.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/dundialog.cpp11
-rw-r--r--noncore/net/opietooth/manager/dundialog.h10
-rw-r--r--noncore/net/opietooth/manager/dunpopup.cpp10
-rw-r--r--noncore/net/opietooth/manager/dunpopup.h10
-rw-r--r--noncore/net/opietooth/manager/pandialog.cpp11
-rw-r--r--noncore/net/opietooth/manager/pandialog.h10
-rw-r--r--noncore/net/opietooth/manager/panpopup.cpp10
-rw-r--r--noncore/net/opietooth/manager/panpopup.h10
8 files changed, 80 insertions, 2 deletions
diff --git a/noncore/net/opietooth/manager/dundialog.cpp b/noncore/net/opietooth/manager/dundialog.cpp
index 033534c..7aac271 100644
--- a/noncore/net/opietooth/manager/dundialog.cpp
+++ b/noncore/net/opietooth/manager/dundialog.cpp
@@ -1,97 +1,106 @@
-
+/* $Id$ */
+/* DUN connection dialog */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#include "dundialog.h"
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qstring.h>
#include <opie2/oprocess.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
using namespace OpieTooth;
using namespace Opie::Core;
DunDialog::DunDialog( const QString& device, int port, QWidget* parent,
const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
if ( !name )
setName( "DUNDialog" );
setCaption( tr( "DUN connection " ) ) ;
m_device = device;
m_port = port;
m_dunConnect = NULL;
layout = new QVBoxLayout( this );
QLabel* info = new QLabel( this );
info->setText( tr("Enter an ppp script name:") );
cmdLine = new QLineEdit( this );
outPut = new QMultiLineEdit( this );
QFont outPut_font( outPut->font() );
outPut_font.setPointSize( 8 );
outPut->setFont( outPut_font );
outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
connectButton = new QPushButton( this );
connectButton->setText( tr( "Connect" ) );
doEncryption = new QCheckBox(this, "encrypt");
doEncryption->setText( tr( "encrypt" ) );
layout->addWidget(info);
layout->addWidget(cmdLine);
layout->addWidget(doEncryption);
layout->addWidget(outPut);
layout->addWidget(connectButton);
connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
}
DunDialog::~DunDialog() {
}
void DunDialog::connectToDevice() {
bool doEnc = doEncryption->isChecked();
if (cmdLine->text() == "")
return;
if (m_dunConnect) {
outPut->append(tr("Work in progress"));
return;
}
m_dunConnect = new OProcess();
outPut->clear();
// Fill process command line
*m_dunConnect << tr("dund")
<< tr("--connect") << m_device
<< tr("--channel") << QString::number(m_port)
<< tr("--nodetach");
if (doEnc)
*m_dunConnect << tr("--encrypt");
*m_dunConnect << tr("call")
<< cmdLine->text();
if (!m_dunConnect->start(OProcess::NotifyOnExit,
OProcess::All)) {
outPut->append(tr("Couldn't start"));
delete m_dunConnect;
m_dunConnect = NULL;
}
else
{
m_dunConnect->resume();
outPut->append(tr("Started"));
connect(m_dunConnect,
SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
connect(m_dunConnect,
SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
connect(m_dunConnect,
SIGNAL(processExited(Opie::Core::OProcess*)),
diff --git a/noncore/net/opietooth/manager/dundialog.h b/noncore/net/opietooth/manager/dundialog.h
index 746c8a3..9e219cd 100644
--- a/noncore/net/opietooth/manager/dundialog.h
+++ b/noncore/net/opietooth/manager/dundialog.h
@@ -1,42 +1,52 @@
+/* $Id$ */
+/* DUN connection dialog */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#ifndef DUNDIALOG_H
#define DUNDIALOG_H
#include <qdialog.h>
#include <opie2/oprocess.h>
class QVBoxLayout;
class QPushButton;
class QMultiLineEdit;
class QLineEdit;
class QCheckBox;
namespace OpieTooth {
class DunDialog : public QDialog {
Q_OBJECT
public:
DunDialog(const QString& device = 0, int port = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
~DunDialog();
private slots:
void connectToDevice();
void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
void fillErr(Opie::Core::OProcess*, char*, int);
void slotProcessExited(Opie::Core::OProcess* proc);
void closeEvent(QCloseEvent* e);
protected:
QVBoxLayout* layout;
QLineEdit* cmdLine;
QPushButton* connectButton;
QMultiLineEdit* outPut;
QCheckBox* doEncryption;
private:
QString m_device; //device BT address
int m_port; //device process
Opie::Core::OProcess* m_dunConnect; //DUN process
};
}
#endif
diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp
index 3017d63..c304b2d 100644
--- a/noncore/net/opietooth/manager/dunpopup.cpp
+++ b/noncore/net/opietooth/manager/dunpopup.cpp
@@ -1,70 +1,80 @@
+/* $Id$ */
+/* DUN context menu */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#include <qpe/qcopenvelope_qws.h>
#include <qmessagebox.h>
#include <opie2/odebug.h>
#include <opie2/oprocess.h>
#include <qpe/qpeapplication.h>
using namespace Opie::Core;
#include "dunpopup.h"
#include "dundialog.h"
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
DunPopup::DunPopup( const Services& service,
BTDeviceItem* item ) : QPopupMenu(), m_service(service) {
owarn << "DunPopup c'tor" << oendl;
m_item = item;
QAction *a, *b, *c;
a = new QAction(); // so it's get deleted
a->setText( tr("connect") );
a->addTo( this );
connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
b = new QAction();
b->setText( tr( "connect+conf" ) );
b->addTo( this );
connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
c = new QAction();
c->setText( tr( "disconnect" ) );
c->addTo( this );
connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
};
DunPopup::~DunPopup() {
}
void DunPopup::slotConnect() {
odebug << "connect" << oendl;
DunDialog dundlg(m_item->mac(),
m_service.protocolDescriptorList().last().port());
QPEApplication::execDialog( &dundlg );
}
void DunPopup::slotDisconnect() {
OProcess dunDis;
OProcess pppDis;
dunDis << tr("dund") << tr("--kill") << m_item->mac();
dunDis.start(OProcess::DontCare, OProcess::NoCommunication);
pppDis << tr("killall") << tr("-q") << tr("pppd");
pppDis.start(OProcess::DontCare, OProcess::NoCommunication);
sleep(1);
QMessageBox::information(this, tr("DUN Disconnect"), tr("DUN Disconnected"));
}
void DunPopup::slotConnectAndConfig() {
slotConnect();
// more intelligence here later like passing the device ( bnepX )
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( "networksettings" );
}
diff --git a/noncore/net/opietooth/manager/dunpopup.h b/noncore/net/opietooth/manager/dunpopup.h
index 6058b20..9fecf06 100644
--- a/noncore/net/opietooth/manager/dunpopup.h
+++ b/noncore/net/opietooth/manager/dunpopup.h
@@ -1,32 +1,42 @@
+/* $Id$ */
+/* DUN context menu */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#ifndef DUNPOPUP_H
#define DUNPOPUP_H
#include <qpopupmenu.h>
#include <qaction.h>
#include <services.h>
#include "btdeviceitem.h"
namespace OpieTooth {
class DunPopup : public QPopupMenu {
Q_OBJECT
public:
DunPopup(const OpieTooth::Services&, OpieTooth::BTDeviceItem* );
~DunPopup();
private:
QAction* m_push;
OpieTooth::BTDeviceItem *m_item; //device item
Services m_service; //device service (port)
private slots:
void slotConnect();
void slotDisconnect();
void slotConnectAndConfig();
};
};
#endif
diff --git a/noncore/net/opietooth/manager/pandialog.cpp b/noncore/net/opietooth/manager/pandialog.cpp
index ca6f491..10ca7a8 100644
--- a/noncore/net/opietooth/manager/pandialog.cpp
+++ b/noncore/net/opietooth/manager/pandialog.cpp
@@ -1,97 +1,106 @@
-
+/* $Id$ */
+/* PAN connection dialog */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#include "pandialog.h"
#include <qpushbutton.h>
#include <qlayout.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qstring.h>
#include <qmultilineedit.h>
#include <opie2/oprocess.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
using namespace OpieTooth;
using namespace Opie::Core;
PanDialog::PanDialog( const QString& device, QWidget* parent,
const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
m_panConnect = NULL;
if ( !name )
setName( "PANDialog" );
setCaption( tr( "PAN connection " ) ) ;
m_device = device;
layout = new QVBoxLayout( this );
outPut = new QMultiLineEdit( this );
QFont outPut_font( outPut->font() );
outPut_font.setPointSize( 8 );
outPut->setFont( outPut_font );
outPut->setWordWrap( QMultiLineEdit::WidgetWidth );
connectButton = new QPushButton( this );
connectButton->setText( tr( "Connect" ) );
doEncryption = new QCheckBox(this, "encrypt");
doEncryption->setText( tr( "encrypt" ) );
doSecure = new QCheckBox(this, "secure connection");
doSecure->setText( tr( "secure connection" ) );
layout->addWidget(doEncryption);
layout->addWidget(doSecure);
layout->addWidget(outPut);
layout->addWidget(connectButton);
connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) );
}
PanDialog::~PanDialog() {
}
void PanDialog::connectToDevice() {
bool doEnc = doEncryption->isChecked();
bool doSec = doSecure->isChecked();
if (m_panConnect) {
outPut->append(tr("Work in progress"));
return;
}
m_panConnect = new OProcess();
outPut->clear();
// Fill process command line
*m_panConnect << tr("pand")
<< tr("--connect") << m_device
<< tr("--nodetach");
if (doEnc)
*m_panConnect << tr("--encrypt");
if (doSec)
*m_panConnect << tr("--secure");
if (!m_panConnect->start(OProcess::NotifyOnExit,
OProcess::All)) {
outPut->append(tr("Couldn't start"));
delete m_panConnect;
m_panConnect = NULL;
}
else
{
m_panConnect->resume();
outPut->append(tr("Started"));
connect(m_panConnect,
SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int)),
this, SLOT(fillOutPut(Opie::Core::OProcess*, char*, int)));
connect(m_panConnect,
SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int)),
this, SLOT(fillErr(Opie::Core::OProcess*, char*, int)));
connect(m_panConnect,
SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT(slotProcessExited(Opie::Core::OProcess*)));
}
}
void PanDialog::fillOutPut( OProcess*, char* cha, int len ) {
QCString str(cha, len);
diff --git a/noncore/net/opietooth/manager/pandialog.h b/noncore/net/opietooth/manager/pandialog.h
index 02363d2..b11a026 100644
--- a/noncore/net/opietooth/manager/pandialog.h
+++ b/noncore/net/opietooth/manager/pandialog.h
@@ -1,40 +1,50 @@
+/* $Id$ */
+/* PAN connection dialog */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#ifndef PANDIALOG_H
#define DUNDIALOG_H
#include <qdialog.h>
#include <opie2/oprocess.h>
class QVBoxLayout;
class QMultiLineEdit;
class QPushButton;
class QCheckBox;
namespace OpieTooth {
class PanDialog : public QDialog {
Q_OBJECT
public:
PanDialog(const QString& device = 0, QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0);
~PanDialog();
private slots:
void connectToDevice();
void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len );
void fillErr(Opie::Core::OProcess*, char*, int);
void slotProcessExited(Opie::Core::OProcess* proc);
void closeEvent(QCloseEvent* e);
protected:
QVBoxLayout* layout;
QPushButton* connectButton;
QMultiLineEdit* outPut;
QCheckBox* doEncryption;
QCheckBox* doSecure;
Opie::Core::OProcess* m_panConnect;
private:
QString m_device; //device BT address
};
}
#endif
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp
index 2fd9eaf..d16bf0c 100644
--- a/noncore/net/opietooth/manager/panpopup.cpp
+++ b/noncore/net/opietooth/manager/panpopup.cpp
@@ -1,72 +1,82 @@
+/* $Id$ */
+/* PAN context menu */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#include <qpe/qcopenvelope_qws.h>
#include <qmessagebox.h>
#include <opie2/odebug.h>
#include <opie2/oprocess.h>
#include <qpe/qpeapplication.h>
#include "pandialog.h"
using namespace Opie::Core;
#include <qtimer.h>
#include "panpopup.h"
using namespace OpieTooth;
/*
* c'tor init the QAction
*/
PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() {
owarn << "PanPopup c'tor" << oendl;
m_item = item;
QAction *a, *b, *c;
m_panconnection = 0l;
/* connect action */
a = new QAction(); // so it's get deleted
a->setText( tr("connect") );
a->addTo( this );
connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) );
b = new QAction();
b->setText( tr( "connect+conf" ) );
b->addTo( this );
connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) );
c = new QAction();
c->setText( tr( "disconnect" ) );
c->addTo( this );
connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) );
};
PanPopup::~PanPopup() {
}
void PanPopup::slotConnect() {
odebug << "connect" << oendl;
PanDialog pandlg(m_item->mac());
QPEApplication::execDialog(&pandlg);
}
void PanPopup::slotDisconnect() {
if (!m_panconnection)
m_panconnection = new StartPanConnection( m_item->mac() );
m_panconnection->stop();
QMessageBox::information(this, tr("Pan Disconnect"), tr("PAN Disconnected"));
}
void PanPopup::slotConnectAndConfig() {
slotConnect();
// more intelligence here later like passing the device ( bnepX )
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( "networksettings" );
}
diff --git a/noncore/net/opietooth/manager/panpopup.h b/noncore/net/opietooth/manager/panpopup.h
index 3e535e3..7d41dfa 100644
--- a/noncore/net/opietooth/manager/panpopup.h
+++ b/noncore/net/opietooth/manager/panpopup.h
@@ -1,33 +1,43 @@
+/* $Id$ */
+/* PAN context menu */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
#ifndef PANPOPUP_H
#define PANPOPUP_H
#include <qpopupmenu.h>
#include <qaction.h>
#include <startpanconnection.h>
#include "btdeviceitem.h"
namespace OpieTooth {
class PanPopup : public QPopupMenu {
Q_OBJECT
public:
PanPopup( OpieTooth::BTDeviceItem* );
~PanPopup();
private:
QAction* m_push;
OpieTooth::StartPanConnection* m_panconnection;
OpieTooth::BTDeviceItem *m_item;
private slots:
void slotConnect();
void slotDisconnect();
void slotConnectAndConfig();
};
};
#endif