summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/main.cpp12
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp2
-rw-r--r--noncore/settings/networksettings2/opie-networksettings2.control2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDevice.h4
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTDriver.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTIcons.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTInquiry.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTPeer.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPService.h2
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTUUID.h2
-rw-r--r--noncore/settings/networksettings2/usb/usbrun.cpp14
13 files changed, 25 insertions, 25 deletions
diff --git a/noncore/settings/networksettings2/main.cpp b/noncore/settings/networksettings2/main.cpp
index 8487e3e..973b4b7 100644
--- a/noncore/settings/networksettings2/main.cpp
+++ b/noncore/settings/networksettings2/main.cpp
@@ -22,101 +22,93 @@ OPIE_EXPORT_APP( OApplicationFactory<NetworkSettings> )
// regenerate config files
#define ACT_REGEN 2
// used by interfaces to request user prompt
#define ACT_PROMPT 3
// used by interfaces to trigger VPN
#define ACT_VPN 4
// activate opietooth
#define ACT_OT 5
// include Opietooth GUI
#include <opietooth2/Opietooth.h>
using namespace Opietooth2;
#include <qpushbutton.h>
#include <qlayout.h>
#include <qframe.h>
#include <qlabel.h>
int main( int argc, char * argv[] ) {
int rv = 0;
int Action = ACT_GUI;
// could be overruled by -qws
QApplication::Type GuiType = QApplication::GuiClient;
-#ifdef _WS_QWS_
QPEApplication * TheApp;
-#else
- QApplication * TheApp;
-#endif
for ( int i = 1; i < argc; i ++ ) {
int rmv;
rmv = 0;
if( strcmp( argv[i], "--regen" ) == 0 ) {
Action = ACT_REGEN;
GuiType = QApplication::Tty;
rmv = 1;
} else if( strcmp( argv[i], "--prompt" ) == 0 ) {
Action = ACT_PROMPT;
rmv = 1;
} else if( strcmp( argv[i], "--triggervpn" ) == 0 ) {
Action = ACT_VPN;
rmv = 1;
} else if( strcmp( argv[i], "--opietooth" ) == 0 ) {
Action = ACT_OT;
rmv = 1;
}
if( rmv ) {
memmove( argv+i, argv+i+rmv,
sizeof( char * ) * (argc-i-rmv) );
i --;
argc -= rmv;
}
}
if( strstr( argv[0], "-request" ) ) {
// called from system to request something
GuiType = QApplication::Tty;
Action = ACT_REQUEST;
Log(("Request : %s\n", argv[1] ));
} else if( strstr( argv[0], "-opietooth" ) ) {
Action = ACT_OT;
}
// Start Qt
-#ifdef _WS_QWS_
// because QPEApplication does not handle GuiType well
if( GuiType == QApplication::Tty ) {
// this cast is NOT correct but we do not use
// TheApp anymore ...
TheApp = (QPEApplication *)new QApplication( argc, argv, GuiType );
} else {
TheApp = new QPEApplication( argc, argv, GuiType );
}
-#else
- TheApp = new QApplication( argc, argv, GuiType );
-#endif
// init qt with app widget
switch( Action ) {
case ACT_REQUEST :
{ NetworkSettingsData NS;
if( NS.canStart( argv[1] ) ) {
QStringList S;
S << QPEApplication::qpeDir() + "/bin/networksettings2";
S << "networksettings2";
S << "--prompt";
S << argv[1];
NSResources->system().execAsUser( S );
Log(("FAILED %s-cNN-allowed\n", argv[1] ));
// if we come here , failed
printf( "%s-cNN-disallowed", argv[1] );
}
}
break;
case ACT_REGEN :
{ NetworkSettingsData NS;
QString S= NS.generateSettings();
// regen returns 0 if OK
rv = ( S.isEmpty() ) ? 0 : 1;
@@ -130,46 +122,42 @@ int main( int argc, char * argv[] ) {
printf( "%s-c%ld-allowed", argv[1], AP.selectedProfile() );
} else {
Log(("%s-c%NN-disallowed\n", argv[1] ));
printf( "%s-cNN-disallowed", argv[1] );
}
}
break;
case ACT_VPN :
{ ActivateVPN AVPN;
AVPN.exec();
}
break;
case ACT_GUI :
case ACT_OT :
{ QWidget * W;
if( Action == ACT_OT ) {
W = new OTMain( 0 );
} else {
W = new NetworkSettings(0);
}
TheApp->setMainWidget( W );
W->show();
-#ifdef _WS_QWS_
W->showMaximized();
-#else
- W->resize( W->sizeHint() );
-#endif
rv = TheApp->exec();
delete W;
}
break;
}
LogClose();
return rv;
}
#endif
// main.cpp
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
index 82fd43a..8deef94 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -1,35 +1,35 @@
#include <stdio.h>
#include <qpe/qpeapplication.h>
#include <qfileinfo.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qtextstream.h>
#include "resources.h"
#include "systemfile.h"
-#define TEMPLATEDIR "networktemplates/"
+#define TEMPLATEDIR "NS2templates/"
QString TemplDir;
SystemFile::SystemFile( const QString & N,
const QString & P,
bool KDI ){
Name = N;
Path = P;
InAppend = 0;
F = 0;
// get template info
{ QString S;
QFileInfo FI;
// find location of templates
TemplDir = QPEApplication::qpeDir() + "etc/" + TEMPLATEDIR;
FI.setFile( TemplDir );
if( ! FI.isDir() ) {
// try current dir
TemplDir = "./" TEMPLATEDIR;
FI.setFile( TemplDir );
if( ! FI.isDir() ) {
hasPreSection =
hasPostSection =
hasPreNodeSection =
diff --git a/noncore/settings/networksettings2/opie-networksettings2.control b/noncore/settings/networksettings2/opie-networksettings2.control
index 874833c..a79a740 100644
--- a/noncore/settings/networksettings2/opie-networksettings2.control
+++ b/noncore/settings/networksettings2/opie-networksettings2.control
@@ -1,10 +1,10 @@
Package: opie-networksettings2
-Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png etc/NS2templates/* etc/NS2templates/*/*
+Files: bin/networksettings2 apps/Settings/networksettings2.desktop pics/networksettings2/*.png lib/libnetworksettings2.so* pics/networksettings2/Devices/*.png etc/NS2templates/* etc/NS2templates/*/* bin/NS2SetMac.sh
Priority: optional
Section: opie/settings
Maintainer: wim delvaux <wimpie@handhelds.org>
Architecture: arm
Depends: task-opie-minimal, libopietooth2
Description: Network settings.
Replaces: opie-networksetup
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/settings/networksettings2/opietooth2/OTDevice.h b/noncore/settings/networksettings2/opietooth2/OTDevice.h
index c2abb09..cf1c4b6 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDevice.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDevice.h
@@ -1,44 +1,44 @@
#ifndef OTDEVICE_H
#define OTDEVICE_H
#include <qobject.h>
#include <qstring.h>
#include <bluezlib.h>
#include <OTGateway.h>
// define if you want to use the process hciattach for detection
// #define USEHCIPROC
class QTimerEvent;
namespace Opie {
namespace Core {
class OProcess;
- }
-}
+ };
+};
namespace Opietooth2 {
/**
* Device takes care of attaching serial
* devices to the blueZ stack.
* After attaching it hciconfig ups it
*/
class OTDevice : public QObject {
Q_OBJECT
public:
/**
* Brings up the device.
* will detech which device is needed
* Usage example: new Device(/dev/ttySB0, csr)
*
*/
OTDevice( OTGateway * _OT );
/**
* unloads the device
diff --git a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
index 8395f37..50f28fc 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDeviceAddress.h
@@ -82,27 +82,27 @@ public:
@return true if this and b have the same address or
if both are invalid, false otherwise
*/
bool operator==(const OTDeviceAddress& b) const;
inline bool operator!=(const OTDeviceAddress& b) const
{ return ! ( *this == b ); }
/** The address 00:00:00:FF:FF:FF */
static const OTDeviceAddress local;
/** The address 00:00:00:00:00:00 */
static const OTDeviceAddress any;
/** An address tagged as invalid */
static const OTDeviceAddress invalid;
protected:
bdaddr_t BDaddr;
bool IsValid;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTDriver.h b/noncore/settings/networksettings2/opietooth2/OTDriver.h
index b54ffdf..f249cf7 100644
--- a/noncore/settings/networksettings2/opietooth2/OTDriver.h
+++ b/noncore/settings/networksettings2/opietooth2/OTDriver.h
@@ -207,26 +207,26 @@ private slots :
private:
QString getRevEricsson();
QString getRevCsr(unsigned short rev);
QString Name;
QString Dev;
QString Revision;
QString Manufacturer;
OTDeviceAddress Address;
QString Features;
QTimer * AutoClose;
int Dev_id,Fd,Type;
bool IsUp;
int Iscan,Pscan,Auth,Encrypt;
// socket bound to this device
OTHCISocket * Socket;
// backpointer to opietooth system
OTGateway * OT;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTIcons.h b/noncore/settings/networksettings2/opietooth2/OTIcons.h
index ee10831..966ed24 100644
--- a/noncore/settings/networksettings2/opietooth2/OTIcons.h
+++ b/noncore/settings/networksettings2/opietooth2/OTIcons.h
@@ -28,27 +28,27 @@ public:
* @return true if found
*/
QPixmap serviceIcon( int, bool & );
// returns all UUID that represent channels with modem function
const UUIDVector & modems()
{ return Modems; }
// returns all UUID that represent channels with network
const UUIDVector & network()
{ return Networks; }
// set Sub to find icons in .../Icons dir
QPixmap loadPixmap( const QString &, bool Sub = 0 );
private:
// first ist id, second is icon name
QMap<QString,QString> deviceIcons;
QMap<int,QString> serviceIcons;
UUIDVector Modems;
UUIDVector Networks;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTInquiry.h b/noncore/settings/networksettings2/opietooth2/OTInquiry.h
index f7bdeec..2682499 100644
--- a/noncore/settings/networksettings2/opietooth2/OTInquiry.h
+++ b/noncore/settings/networksettings2/opietooth2/OTInquiry.h
@@ -153,26 +153,26 @@ signals :
private:
// std::set<DeviceAddress> addrCache;
// double currentTimeout;
// QByteArray* buf;
// QSocket* hciSocket;
QGuardedPtr<OTHCISocket> Socket;
OTDriver * Driver;
//QDateTime *startTime;
QTimer *InquiryTimeoutTimer;
// std::deque<InquiryInfo> infoQueue;
bool SuccessfullyStarted;
bool SuccessfullyEnded;
private slots:
void slotInquiryTimeout();
void slotHCIEvent(unsigned char eventCode, QByteArray buf);
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTPeer.h b/noncore/settings/networksettings2/opietooth2/OTPeer.h
index c09af15..9cd0dc7 100644
--- a/noncore/settings/networksettings2/opietooth2/OTPeer.h
+++ b/noncore/settings/networksettings2/opietooth2/OTPeer.h
@@ -109,27 +109,27 @@ signals :
protected :
// while polling for result of ping
void timerEvent( QTimerEvent * ev );
private:
void updateServices();
OTGateway * OT;
OTDeviceAddress Addr;
QString Name;
int Class;
ServiceVector serviceList;
// -1 : don't know, 0 no, 1 yes
PeerState_t State;
OTDriver * ConnectedTo;
int ProbeFD;
int ProbePhase; // see OTDriver
long ProbeTimeout;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
index e79e33d..86b5623 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.h
@@ -114,27 +114,27 @@ public:
UUIDVector getAllUUIDs();
inline AttrType getType()
{ return type; }
//QString getValString();
const char * getTypeString();
private:
AttrType type;
union {
OTSDPAttribute::int128_t * intVal;
OTSDPAttribute::uint128_t * uintVal;
OTUUID * uuidVal;
bool boolVal;
QString * stringVal; // strings and urls
AttributeVector * sequenceVal; // sequences and alternatives
} Value;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPService.h b/noncore/settings/networksettings2/opietooth2/OTSDPService.h
index 4831df0..21d7344 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPService.h
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPService.h
@@ -49,27 +49,27 @@ public:
UUIDVector allUUIDs();
// return list of classes this service belongs to
UUIDVector classIDList();
/** Retrieves the Rfcomm channel.
This function is provided just for conveniance.
@param n The Rfcomm channel.
@ret true if an rfcomm channel was found, false otherwise. */
bool rfcommChannel(unsigned int &n);
bool hasClassID(const OTUUID & uuid);
private:
struct AttributeEntry {
int id;
OTSDPAttribute * attr;
};
QArray<AttributeEntry> attributeList;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/opietooth2/OTUUID.h b/noncore/settings/networksettings2/opietooth2/OTUUID.h
index aebd9b9..97df114 100644
--- a/noncore/settings/networksettings2/opietooth2/OTUUID.h
+++ b/noncore/settings/networksettings2/opietooth2/OTUUID.h
@@ -33,26 +33,26 @@ public :
bool fromString(QString s);
void setUUID128(uint64_t hi, uint64_t lo);
void setUUID32(uint32_t v);
uint16_t toShort()
{ return ((hi>>32) & 0xffff); }
uint32_t toLong()
{ return ((hi>>32) & 0xffffffff); }
uint64_t toLongLong()
{ return hi; }
QString toString() const ;
operator QString() const;
operator ::uuid_t() const;
OTUUID & operator=( const OTUUID & other ) ;
bool operator<( const OTUUID & other ) const;
bool operator==(const OTUUID & uuid) const;
uint64_t hi;
uint64_t lo;
};
-}
+};
#endif
diff --git a/noncore/settings/networksettings2/usb/usbrun.cpp b/noncore/settings/networksettings2/usb/usbrun.cpp
index f8824e0..0a46642 100644
--- a/noncore/settings/networksettings2/usb/usbrun.cpp
+++ b/noncore/settings/networksettings2/usb/usbrun.cpp
@@ -50,49 +50,61 @@ State_t USBRun::detectState( void ) {
// find possible interface
for( QDictIterator<InterfaceInfo> It(Sys.interfaces());
It.current();
++It ) {
Run = It.current();
Log(("%s %d %d=%d %d\n",
Run->Name.latin1(),
handlesInterface( Run->Name ),
Run->CardType, ARPHRD_ETHER,
! Run->IsUp ));
if( handlesInterface( Run->Name ) &&
Run->CardType == ARPHRD_ETHER &&
! Run->IsUp
) {
// proper type, and Not UP -> free
return Off;
}
}
return Unavailable;
}
-QString USBRun::setMyState( NodeCollection *, Action_t , bool ) {
+QString USBRun::setMyState( NodeCollection * NC, Action_t A, bool ) {
+
+ // nothing needs to be done to 'activate' or 'deactivate'
+ // a cable
+
+ // perhaps (later) we can figure out if the device is IN the
+ // cradle
+ if( A == Activate ) {
+ NC->setCurrentState( Available );
+ } else if ( A == Deactivate ) {
+ NC->setCurrentState( Unavailable );
+ }
+
return QString();
}
// get interface that is free or assigned to us
InterfaceInfo * USBRun::getInterface( void ) {
System & S = NSResources->system();
InterfaceInfo * best = 0, * Run;
QRegExp R( "usb[0-9abcdef]" );
for( QDictIterator<InterfaceInfo> It(S.interfaces());
It.current();
++It ) {
Run = It.current();
if( handlesInterface( Run->Name ) &&
Run->CardType == ARPHRD_ETHER
) {
// this is a USB card
if( Run->assignedConnection() == netNode()->connection() ) {
// assigned to us
return Run;
} else if( Run->assignedConnection() == 0 ) {
// free
best = Run;