summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp13
-rw-r--r--noncore/settings/appearance2/colorlistitem.h7
-rw-r--r--noncore/settings/appearance2/decolistitem.h3
-rw-r--r--noncore/settings/backup/backuprestore.cpp9
-rw-r--r--noncore/settings/language/language.cpp2
-rw-r--r--noncore/settings/mediummount/mainwindow.cc1
-rw-r--r--noncore/settings/mediummount/mediumglobal.cc2
-rw-r--r--noncore/settings/mediummount/mediumwidget.cc2
-rw-r--r--noncore/settings/networksettings/interfaces/interface.cpp68
-rw-r--r--noncore/settings/networksettings/interfaces/interface.h12
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceadvanced.ui2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformation.ui267
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp24
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.h2
-rw-r--r--noncore/settings/networksettings/interfaces/interfaces.cpp60
-rw-r--r--noncore/settings/networksettings/interfaces/interfacesetupimp.cpp4
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp23
-rw-r--r--noncore/settings/networksettings/mainwindowimp.h15
-rw-r--r--noncore/settings/networksettings/module.h39
-rw-r--r--noncore/settings/networksettings/ppp/TODO10
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp158
-rw-r--r--noncore/settings/networksettings/ppp/accounts.h40
-rw-r--r--noncore/settings/networksettings/ppp/chooserwidget.cpp85
-rw-r--r--noncore/settings/networksettings/ppp/chooserwidget.h73
-rw-r--r--noncore/settings/networksettings/ppp/connect.cpp166
-rw-r--r--noncore/settings/networksettings/ppp/connect.h2
-rw-r--r--noncore/settings/networksettings/ppp/conwindow.cpp27
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp212
-rw-r--r--noncore/settings/networksettings/ppp/devices.h95
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp293
-rw-r--r--noncore/settings/networksettings/ppp/general.h34
-rw-r--r--noncore/settings/networksettings/ppp/interfaceinformationppp.cpp20
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.cpp70
-rw-r--r--noncore/settings/networksettings/ppp/interfaceppp.h16
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp89
-rw-r--r--noncore/settings/networksettings/ppp/modem.cpp85
-rw-r--r--noncore/settings/networksettings/ppp/modem.h23
-rw-r--r--noncore/settings/networksettings/ppp/modemcmds.cpp129
-rw-r--r--noncore/settings/networksettings/ppp/modemcmds.h3
-rw-r--r--noncore/settings/networksettings/ppp/modeminfo.cpp24
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro5
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.cpp19
-rw-r--r--noncore/settings/networksettings/ppp/pppconfig.h6
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp397
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.h47
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp117
-rw-r--r--noncore/settings/networksettings/ppp/runtests.cpp12
-rw-r--r--noncore/settings/networksettings/wlan/keyedit.cpp1
-rw-r--r--noncore/settings/networksettings/wlan/wlan.ui96
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp35
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp2
-rw-r--r--noncore/settings/usermanager/userdialog.cpp2
-rw-r--r--noncore/settings/usermanager/userdialog.h1
-rw-r--r--noncore/settings/usermanager/usermanager.cpp2
-rw-r--r--noncore/settings/usermanager/usermanager.pro2
-rw-r--r--noncore/styles/flat/flat.cpp128
-rw-r--r--noncore/styles/flat/flat.h6
-rw-r--r--noncore/todayplugins/stockticker/stockticker/inputDialog.cpp1
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp622
-rw-r--r--noncore/todayplugins/weather/weatherconfig.h1
-rw-r--r--noncore/tools/clock/clock.cpp7
-rw-r--r--noncore/tools/euroconv/main.cpp2
-rw-r--r--noncore/tools/formatter/formatter.cpp3
66 files changed, 2410 insertions, 1321 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index c376ec7..00128d3 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -84,7 +84,7 @@ public:
QString name() const {
return "Default";
}
- QPixmap icon() const {
+QPixmap icon() const {
return QPixmap();
}
QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
@@ -175,7 +175,7 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg )
vertLayout->addWidget( m_deco_list );
QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) );
- QString s = cfg. readEntry ( "Decoration" );
+ QString s = cfg. readEntry ( "Decoration", "libflat.so" );
m_deco_list-> insertItem ( new DecoListItem ( "QPE" ));
@@ -402,7 +402,7 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
vertLayout-> addSpacing ( 3 );
QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 );
-
+
QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab );
m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" );
QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( );
@@ -421,8 +421,8 @@ QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg )
ccw1. convertFromImage( ccwImage );
m_rotdir_cw-> setPixmap( cw1 );
- m_rotdir_ccw-> setPixmap( ccw1 );
- m_rotdir_flip-> setPixmap( flip1 );
+ m_rotdir_ccw-> setPixmap( ccw1 );
+ m_rotdir_flip-> setPixmap( flip1 );
rotLay-> addWidget ( rotlabel, 0 );
rotLay-> addWidget ( m_rotdir_cw, 0 );
@@ -457,7 +457,8 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags )
QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 );
m_sample = new SampleWindow ( this );
- m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
+
+ m_sample-> setDecoration ( new DefaultWindowDecoration ( ) );
QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) );
OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom );
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h
index 10e4468..f8d5c45 100644
--- a/noncore/settings/appearance2/colorlistitem.h
+++ b/noncore/settings/appearance2/colorlistitem.h
@@ -124,12 +124,13 @@ private:
}
};
+// from etc/colors/Liquid.scheme
const ColorListItem::colorlut ColorListItem::s_colorlut [] = {
{ QColorGroup::Base, "Base", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Base" ) },
- { QColorGroup::Background, "Background", "#E5E1D5", QT_TRANSLATE_NOOP( "Appearance", "Background" ) },
- { QColorGroup::Button, "Button", "#D6CDBB", QT_TRANSLATE_NOOP( "Appearance", "Button" ) },
+ { QColorGroup::Background, "Background", "#E0E0E0", QT_TRANSLATE_NOOP( "Appearance", "Background" ) },
+ { QColorGroup::Button, "Button", "#96c8fa", QT_TRANSLATE_NOOP( "Appearance", "Button" ) },
{ QColorGroup::ButtonText, "ButtonText", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Button Text" ) },
- { QColorGroup::Highlight, "Highlight", "#800000", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) },
+ { QColorGroup::Highlight, "Highlight", "#73adef", QT_TRANSLATE_NOOP( "Appearance", "Highlight" ) },
{ QColorGroup::HighlightedText, "HighlightedText", "#FFFFFF", QT_TRANSLATE_NOOP( "Appearance", "Highlighted Text" ) },
{ QColorGroup::Text, "Text", "#000000", QT_TRANSLATE_NOOP( "Appearance", "Text" ) }
};
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h
index d190ceb..da7924c 100644
--- a/noncore/settings/appearance2/decolistitem.h
+++ b/noncore/settings/appearance2/decolistitem.h
@@ -103,4 +103,5 @@ private:
};
-#endif \ No newline at end of file
+#endif
+
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 4ff6be1..922523b 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -71,18 +71,9 @@ BackupAndRestore::BackupAndRestore( QWidget* parent, const char* name)
//todo make less static here and use Storage class to get infos
if(totalLocations == 0){
-
-/* Ramses has a CF-Slot, but that one is internal and you have to dismount the
- * the case. There's also almost always a WLAN card inserted there
-*/
-
backupLocations.insert("Documents", "/root/Documents");
-#if defined(QT_QWS_RAMSES)
- backupLocations.insert("MMC", "/mnt/card");
-#else
backupLocations.insert("CF", "/mnt/cf");
backupLocations.insert("SD", "/mnt/card");
-#endif
}
else{
for(int i = 0; i < totalLocations; i++){
diff --git a/noncore/settings/language/language.cpp b/noncore/settings/language/language.cpp
index 8985fd5..d30a041 100644
--- a/noncore/settings/language/language.cpp
+++ b/noncore/settings/language/language.cpp
@@ -115,9 +115,9 @@ void LanguageSettings::reset()
Config config("locale");
config.setGroup("Language");
l = config.readEntry( "Language", l );
+ actualLanguage = l;
if (l.isEmpty())
l = "en";
- actualLanguage = l;
int n = langAvail.find( l );
languages->setCurrentItem( n );
diff --git a/noncore/settings/mediummount/mainwindow.cc b/noncore/settings/mediummount/mainwindow.cc
index 6b37cff..eec786c 100644
--- a/noncore/settings/mediummount/mainwindow.cc
+++ b/noncore/settings/mediummount/mainwindow.cc
@@ -14,6 +14,7 @@
using namespace MediumMountSetting;
+/* TRANSLATOR MediumMountSetting::MainWindow */
MainWindow::MainWindow( QWidget *parent, const char *name, bool modal, WFlags )
: QDialog( parent, name, modal, WStyle_ContextHelp )
diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc
index 75e3839..ab0b3af 100644
--- a/noncore/settings/mediummount/mediumglobal.cc
+++ b/noncore/settings/mediummount/mediumglobal.cc
@@ -15,6 +15,8 @@
using namespace MediumMountSetting;
+/* TRANSLATOR MediumMountSetting::MediumGlobalWidget */
+
MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name )
: QWidget( wid, name, WStyle_ContextHelp )
{
diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc
index eadf502..981e1dd 100644
--- a/noncore/settings/mediummount/mediumwidget.cc
+++ b/noncore/settings/mediummount/mediumwidget.cc
@@ -22,6 +22,8 @@
using namespace MediumMountSetting;
+/* TRANSLATOR MediumMountSetting::MediumMountWidget */
+
MediumMountWidget::MediumMountWidget(const QString &path,
const QPixmap &pix,
QWidget *parent,
diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp
index cc45525..69b55d1 100644
--- a/noncore/settings/networksettings/interfaces/interface.cpp
+++ b/noncore/settings/networksettings/interfaces/interface.cpp
@@ -1,7 +1,7 @@
/**
* $Author$
* $Date$
- */
+ */
#include "interface.h"
#include <qdatetime.h>
@@ -24,7 +24,7 @@ Interface::Interface(QObject * parent, const char * name, bool newSatus): QObjec
* Set status
* @param newStatus - the new status
* emit updateInterface
- */
+ */
void Interface::setStatus(bool newStatus){
if(status != newStatus){
status = newStatus;
@@ -36,27 +36,27 @@ void Interface::setStatus(bool newStatus){
* Set if attached or not (802.11 card pulled out for example)
* @param isAttached - if attached
* emit updateInterface
- */
+ */
void Interface::setAttached(bool isAttached){
attached = isAttached;
emit(updateInterface(this));
};
-
+
/**
* Set Hardware name
* @param name - the new name
* emit updateInterface
- */
+ */
void Interface::setHardwareName(const QString &name){
hardwareName = name;
emit(updateInterface(this));
};
-
+
/**
* Set Module owner
* @param owner - the new owner
* emit updateInterface
- */
+ */
void Interface::setModuleOwner(Module *owner){
moduleOwner = owner;
emit(updateInterface(this));
@@ -65,14 +65,14 @@ void Interface::setModuleOwner(Module *owner){
/**
* Try to start the interface.
- */
+ */
void Interface::start(){
- // check to see if we are already running.
+ // check to see if we are already running.
if(true == status){
emit (updateMessage("Unable to start interface,\n already started"));
return;
}
-
+
int ret = system(QString("%1 %2 up").arg(IFCONFIG).arg(this->name()).latin1());
// See if it was successfull...
if(ret != 0){
@@ -89,12 +89,12 @@ void Interface::start(){
* Try to stop the interface.
*/
void Interface::stop(){
- // check to see if we are already stopped.
+ // check to see if we are already stopped.
if(false == status){
emit (updateMessage("Unable to stop interface,\n already stopped"));
return;
}
-
+
int ret = system(QString("%1 %2 down").arg(IFCONFIG).arg(this->name()).latin1());
if(ret != 0){
emit (updateMessage("Stopping interface failed"));
@@ -108,7 +108,7 @@ void Interface::stop(){
/**
* Try to restart the interface.
- */
+ */
void Interface::restart(){
stop();
start();
@@ -133,14 +133,14 @@ bool Interface::refresh(){
emit(updateInterface(this));
return true;
}
-
+
QString fileName = QString("/tmp/%1_ifconfig_info").arg(this->name());
- int ret = system(QString("%1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
+ int ret = system(QString("LANG=C %1 %2 > %3").arg(IFCONFIG).arg(this->name()).arg(fileName).latin1());
if(ret != 0){
qDebug(QString("Interface: Ifconfig return value: %1, is not 0").arg(ret).latin1());
return false;
}
-
+
QFile file(fileName);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(fileName).latin1());
@@ -152,7 +152,7 @@ bool Interface::refresh(){
ip = "0.0.0.0";
subnetMask = "0.0.0.0";
broadcast = "";
-
+
QTextStream stream( &file );
QString line;
while ( !stream.eof() ) {
@@ -185,30 +185,30 @@ bool Interface::refresh(){
leaseObtained = "";
leaseExpires = "";
dhcp = false;
-
+
QString dhcpDirectory(DHCP_INFO_DIR);
QDir d(dhcpDirectory);
if(!d.exists(dhcpDirectory))
dhcpDirectory = "/var/run";
-
- // See if we have
+
+ // See if we have
QString dhcpFile(QString(dhcpDirectory+"/dhcpcd-%1.info").arg(this->name()));
// If there is no DHCP information then exit now with no errors.
if(!QFile::exists(dhcpFile)){
emit(updateInterface(this));
return true;
}
-
+
file.setName(dhcpFile);
if (!file.open(IO_ReadOnly)){
qDebug(QString("Interface: Can't open file: %1").arg(dhcpFile).latin1());
return false;
}
-
+
// leaseTime and renewalTime and used if pid and deamon exe can be accessed.
int leaseTime = 0;
int renewalTime = 0;
-
+
stream.setDevice( &file );
while ( !stream.eof() ) {
line = stream.readLine();
@@ -222,7 +222,7 @@ bool Interface::refresh(){
file.close();
//qDebug(QString("Interface: leaseTime: %1").arg(leaseTime).latin1());
//qDebug(QString("Interface: renewalTime: %1").arg(renewalTime).latin1());
-
+
// Get the pid of the deamond
dhcpFile = (QString(dhcpDirectory+"/dhcpcd-%1.pid").arg(this->name()));
file.setName(dhcpFile);
@@ -244,7 +244,7 @@ bool Interface::refresh(){
return false;
}
- // Get the start running time of the deamon
+ // Get the start running time of the deamon
fileName = (QString("/proc/%1/stat").arg(pid));
file.setName(fileName);
stream.setDevice( &file );
@@ -257,7 +257,7 @@ bool Interface::refresh(){
}
file.close();
long time = 0;
- // Grab the start time
+ // Grab the start time
// pid com state ppid pgrp session tty_nr tpgid flags
sscanf(line.latin1(), "%*d %*s %*c %*d %*d %*d %*d %*d %*u "
// minflt cminflt majflt cmajflt utime stime cutime cstime priority
@@ -265,7 +265,7 @@ bool Interface::refresh(){
// nice 0 itrealvalue starttime
"%*d %*d %*d %lu", (long*) &time);
time = time/100;
-
+
QDateTime datetime(QDateTime::currentDateTime());
// Get the uptime of the computer.
@@ -281,19 +281,19 @@ bool Interface::refresh(){
qDebug("Interface: Can't open /proc/uptime to retrive uptime.");
return false;
}
-
+
datetime = datetime.addSecs(time);
//qDebug(QString("Interface: %1 %2").arg(datetime.toString()).arg(pid).latin1());
-
- // Calculate the start and renew times
+
+ // Calculate the start and renew times
leaseObtained = datetime.toString();
-
- // Calculate the start and renew times
+
+ // Calculate the start and renew times
datetime = datetime.addSecs(leaseTime);
leaseExpires = datetime.toString();
-
+
dhcp = true;
-
+
emit(updateInterface(this));
return true;
}
diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h
index 7e98deb..ec82851 100644
--- a/noncore/settings/networksettings/interfaces/interface.h
+++ b/noncore/settings/networksettings/interfaces/interface.h
@@ -12,22 +12,22 @@ class Interface : public QObject{
signals:
void updateInterface(Interface *i);
void updateMessage(const QString &message);
-
+
public:
Interface(QObject * parent=0, const char * name= "unknown", bool status = false);
-
+
QString getInterfaceName() const { QString n(this->name()); return n; };
void setInterfaceName( const QString &n ) { this->setName(n); };
-
+
bool getStatus() const { return status; };
void setStatus(bool newStatus);
bool isAttached() const { return attached; };
void setAttached(bool isAttached=false);
-
+
QString getHardwareName() const { return hardwareName; };
void setHardwareName(const QString &name="Unknown");
-
+
Module* getModuleOwner() const { return moduleOwner; };
void setModuleOwner(Module *owner=NULL);
@@ -47,7 +47,7 @@ public:
virtual void stop();
virtual void restart();
-private:
+protected:
// Interface information
QString hardwareName;
Module *moduleOwner;
diff --git a/noncore/settings/networksettings/interfaces/interfaceadvanced.ui b/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
index 2e106cb..12dbb1d 100644
--- a/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
+++ b/noncore/settings/networksettings/interfaces/interfaceadvanced.ui
@@ -18,7 +18,7 @@
<property stdset="1">
<name>maximumSize</name>
<size>
- <width>240</width>
+ <width>32767</width>
<height>32767</height>
</size>
</property>
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformation.ui b/noncore/settings/networksettings/interfaces/interfaceinformation.ui
index 763ad90..207200e 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformation.ui
+++ b/noncore/settings/networksettings/interfaces/interfaceinformation.ui
@@ -12,95 +12,29 @@
<x>0</x>
<y>0</y>
<width>219</width>
- <height>255</height>
+ <height>323</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Interface Information</string>
</property>
- <grid>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <vbox>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>4</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>6</number>
+ <number>3</number>
</property>
- <widget row="4" column="0" rowspan="1" colspan="2" >
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout1</cstring>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="1" column="0" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>refreshButton</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&amp;Refresh</string>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>stopButton</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>S&amp;top</string>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>restartButton</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>R&amp;estart</string>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>startButton</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&amp;Start</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget row="0" column="0" >
- <class>Line</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Line1</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- </widget>
- <widget row="0" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -111,48 +45,48 @@
<string>IP Address</string>
</property>
</widget>
- <widget row="1" column="0" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel23</cstring>
+ <cstring>ipAddressLabel</cstring>
</property>
<property stdset="1">
- <name>text</name>
- <string>Subnet Mask</string>
+ <name>frameShape</name>
+ <enum>Panel</enum>
</property>
- </widget>
- <widget row="2" column="0" >
- <class>QLabel</class>
<property stdset="1">
- <name>name</name>
- <cstring>TextLabel21</cstring>
+ <name>frameShadow</name>
+ <enum>Sunken</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>MAC Address</string>
+ <string>0.0.0.0</string>
</property>
</widget>
- <widget row="3" column="0" >
- <class>QLabel</class>
+ <widget>
+ <class>Line</class>
<property stdset="1">
<name>name</name>
- <cstring>TextLabel24</cstring>
+ <cstring>Line1</cstring>
</property>
<property stdset="1">
- <name>frameShape</name>
- <enum>MShape</enum>
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
- <name>frameShadow</name>
- <enum>MShadow</enum>
+ <name>name</name>
+ <cstring>TextLabel23</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Broadcast</string>
+ <string>Subnet Mask</string>
</property>
</widget>
- <widget row="1" column="1" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -171,7 +105,7 @@
<string>0.0.0.0</string>
</property>
</widget>
- <widget row="2" column="1" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -190,7 +124,18 @@
<string>00:00:00:00:00:00</string>
</property>
</widget>
- <widget row="3" column="1" >
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel21</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>MAC Address</string>
+ </property>
+ </widget>
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
@@ -209,47 +154,98 @@
<string></string>
</property>
</widget>
- <widget row="0" column="1" >
+ <widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>ipAddressLabel</cstring>
+ <cstring>TextLabel24</cstring>
</property>
<property stdset="1">
<name>frameShape</name>
- <enum>Panel</enum>
+ <enum>MShape</enum>
</property>
<property stdset="1">
<name>frameShadow</name>
- <enum>Sunken</enum>
+ <enum>MShadow</enum>
</property>
<property stdset="1">
<name>text</name>
- <string>0.0.0.0</string>
+ <string>Broadcast</string>
</property>
</widget>
- <spacer row="7" column="1" >
- <property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer18</cstring>
+ <cstring>Layout1</cstring>
</property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>refreshButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Refresh</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>stopButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>S&amp;top</string>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>restartButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>R&amp;estart</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>startButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Start</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>Line</class>
<property stdset="1">
- <name>orientation</name>
- <enum>Vertical</enum>
+ <name>name</name>
+ <cstring>Line5</cstring>
</property>
<property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
- </spacer>
- <widget row="6" column="0" rowspan="1" colspan="2" >
+ </widget>
+ <widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
@@ -298,18 +294,39 @@
</widget>
</hbox>
</widget>
- <widget row="5" column="0" rowspan="1" colspan="2" >
- <class>Line</class>
- <property stdset="1">
+ <spacer>
+ <property>
<name>name</name>
- <cstring>Line5</cstring>
+ <cstring>Spacer18</cstring>
</property>
<property stdset="1">
<name>orientation</name>
- <enum>Horizontal</enum>
+ <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>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CheckBoxSilent</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>be &amp;silent</string>
</property>
</widget>
- </grid>
+ </vbox>
</widget>
<tabstops>
<tabstop>startButton</tabstop>
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index e00dcce..37c3a91 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,12 +1,15 @@
#include "interfaceinformationimp.h"
#include "interfaceadvanced.h"
+#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <qmessagebox.h>
-#ifdef QWS
+#include <qpe/config.h>
+
+#ifdef QWS
#else
#define showMaximized show
#endif
@@ -14,7 +17,7 @@
/**
* Constructor for the InterfaceInformationImp class. This class pretty much
* just display's information about the interface that is passed to it.
- */
+ */
InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){
connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
@@ -24,13 +27,23 @@ InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *na
connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
+ Config cfg("networksettings", Config::User);
+ cfg.setGroup("interface");
+ CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
+}
+
+InterfaceInformationImp::~InterfaceInformationImp()
+{
+ Config cfg("networksettings", Config::User);
+ cfg.setGroup("interface");
+ cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
}
/**
* Update the interface information and buttons.
* @param Intarface *i the interface to update (should be the one we already
* know about).
- */
+ */
void InterfaceInformationImp::updateInterface(Interface *){
if(interface->getStatus()){
startButton->setEnabled(false);
@@ -51,7 +64,7 @@ void InterfaceInformationImp::updateInterface(Interface *){
/**
* Create the advanced widget. Fill it with the current interface's information.
* Display it.
- */
+ */
void InterfaceInformationImp::advanced(){
InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
a->interfaceName->setText(interface->getInterfaceName());
@@ -70,8 +83,9 @@ void InterfaceInformationImp::advanced(){
* Messages from the interface if start/stop went as planned.
* Purly for user feedback.
* @param message the message to display.
- */
+ */
void InterfaceInformationImp::showMessage(const QString &message){
+ if (CheckBoxSilent->isChecked()) return;
QMessageBox::information(this, "Message", message, QMessageBox::Ok);
}
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
index 65cdfe0..9c93d1d 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.h
@@ -10,7 +10,7 @@ Q_OBJECT
public:
InterfaceInformationImp(QWidget *parent=0, const char *name=0, Interface *i=0, WFlags f=0);
- ~InterfaceInformationImp(){};
+ ~InterfaceInformationImp();
private slots:
void advanced();
diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp
index 71d0cf5..436e449 100644
--- a/noncore/settings/networksettings/interfaces/interfaces.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaces.cpp
@@ -1,5 +1,6 @@
#include "interfaces.h"
+#include <qcheckbox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qregexp.h>
@@ -151,6 +152,7 @@ bool Interfaces::isInterfaceSet() const {
* @return true if successfull.
*/
bool Interfaces::addInterface(const QString &interface, const QString &family, const QString &method){
+ qDebug("Interfaces::addInterface(%s)",interface.latin1());
if(0 == acceptedFamily.contains(family))
return false;
QString newInterface = interface.simplifyWhiteSpace();
@@ -166,6 +168,7 @@ bool Interfaces::addInterface(const QString &interface, const QString &family, c
* @return bool true if successfull
*/
bool Interfaces::copyInterface(const QString &interface, const QString &newInterface){
+ qDebug("copy interface %s to %s", interface.latin1(), newInterface.latin1());
if(!setInterface(interface))
return false;
@@ -272,12 +275,16 @@ QString Interfaces::getInterfaceMethod(bool &error){
* @return bool true if successfull.
*/
bool Interfaces::setInterfaceName(const QString &newName){
+ qDebug("setInterfaceName %s", newName.latin1());
if(currentIface == interfaces.end())
return false;
QString name = newName.simplifyWhiteSpace();
name = name.replace(QRegExp(" "), "");
bool returnValue = false;
- (*currentIface) = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
+ QString tmp = QString("iface %1 %2 %3").arg(name).arg(getInterfaceFamily(returnValue)).arg(getInterfaceMethod(returnValue));
+ qDebug("setting %s",tmp.latin1());
+
+ (*currentIface) = tmp;
return !returnValue;
}
@@ -327,13 +334,19 @@ QString Interfaces::getInterfaceOption(const QString &option, bool &error){
/**
* Set a value for an option in the currently selected interface. If option
* doesn't exist then it is added along with the value.
+ * If value isEmpty() then we will remove the option
+ *
* @param option the options to set the value.
* @param value the value that option should be set to.
* @param error set to true if any error occurs, false otherwise.
* @return QString the options value. QString::null if error == true
*/
bool Interfaces::setInterfaceOption(const QString &option, const QString &value){
- return setOption(currentIface, option, value);
+ if( value.stripWhiteSpace().isEmpty() )
+ return removeInterfaceOption( option );
+
+ qDebug("iface >%s< option >%s< value >%s<", (*currentIface).latin1(), option.latin1(),value.latin1());
+ return setOption(currentIface, option, value);
}
/**
@@ -492,30 +505,49 @@ bool Interfaces::setStanza(const QString &stanza, const QString &option, QString
bool Interfaces::setOption(const QStringList::Iterator &start, const QString &option, const QString &value){
if(start == interfaces.end())
return false;
-
+ qDebug("setting option");
bool found = false;
+ bool replaced = false;
+ QStringList::Iterator insertAt = NULL;
for ( QStringList::Iterator it = start; it != interfaces.end(); ++it ) {
- if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) && it != start){
- if(!found && value != ""){
- // Got to the end of the stanza without finding it, so append it.
- interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
- }
- found = true;
- break;
- }
+ qDebug(" Interfaces::setOption got line >%s<",(*it).latin1());
+ // FIXME: was not completly stupid just wrong sice all options got inserted bevore the iface line
+ // but since it works with an empty interfaces file I (tille) will not do anything more
+ if(((*it).contains(IFACE) || (*it).contains(MAPPING) || (*it).contains(AUTO)) ){
+ if (found) break;
+// && it != start){
+// if(!found && value != ""){
+// // Got to the end of the stanza without finding it, so append it.
+// qDebug(" Got to the end of the stanza without finding it, so append it.");
+// interfaces.insert(--it, QString("\t%1 %2").arg(option).arg(value));
+// }
+ qDebug("found 1");
+// interfaces.insert(++it, QString("\t%1 %2").arg(option).arg(value));
+ found = true;
+ insertAt = it;
+
+ }
if((*it).contains(option) && it != start && (*it).at(0) != '#'){
// Found it in stanza so replace it.
+ qDebug("found 2");
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
+ replaced = true;
(*it) = QString("\t%1 %2").arg(option).arg(value);
}
}
if(!found){
+ qDebug("! found insert anyway");
QStringList::Iterator p = start;
interfaces.insert(++p, QString("\t%1 %2").arg(option).arg(value));
found = true;
}
+
+ if(found && !replaced){
+ qDebug("found iface but not the option so insert it here...");
+ interfaces.insert(++insertAt, QString("\t%1 %2").arg(option).arg(value));
+ }
return found;
}
@@ -552,7 +584,8 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
- (*it) = "";
+ it = interfaces.remove( it ); // we really want to remove the line
+ --it; // we do ++it later in the head of the for loop
}
}
return found;
@@ -579,7 +612,8 @@ bool Interfaces::removeOption(const QStringList::Iterator &start, const QString
if(found)
qDebug(QString("Interfaces: Set Options found more then one value for option: %1 in stanza: %1").arg(option).arg((*start)).latin1());
found = true;
- (*it) = "";
+ it = interfaces.remove( it ); // we really want to remove the line
+ --it; // we do ++it later in the head of the for loop
}
}
return found;
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
index b40d101..e844d8a 100644
--- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp
@@ -44,6 +44,7 @@ InterfaceSetupImp::~InterfaceSetupImp(){
bool InterfaceSetupImp::saveChanges(){
bool error;
QString iface = interfaces->getInterfaceName(error);
+ qDebug("InterfaceSetupImp::saveChanges saves interface %s", iface.latin1() );
if(!saveSettings())
return false;
@@ -117,6 +118,9 @@ bool InterfaceSetupImp::saveSettings(){
QString dns = firstDNSLineEdit->text() + " " + secondDNSLineEdit->text();
interfaces->setInterfaceOption("up "DNSSCRIPT" -a ", dns);
interfaces->setInterfaceOption("down "DNSSCRIPT" -r ", dns);
+ }else{
+ interfaces->removeInterfaceOption("up "DNSSCRIPT" -a ");
+ interfaces->removeInterfaceOption("down "DNSSCRIPT" -r");
}
}
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index 2d714ca..f74cf87 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -13,6 +13,7 @@
#include <qlabel.h>
#include <qpe/qcopenvelope_qws.h>
#include <qtabwidget.h> // in order to disable the profiles tab
+#include <qpe/qpeapplication.h>
#include <qmessagebox.h>
@@ -49,7 +50,7 @@
#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
#define _PROCNETDEV "/proc/net/dev"
-MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name), advancedUserMode(true), scheme(DEFAULT_SCHEME){
+MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME){
connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
@@ -62,7 +63,7 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
//FIXME: disable profiles for the moment:
-// tabWidget->setTabEnabled( tab, false );
+ tabWidget->setTabEnabled( tab, false );
// Load connections.
// /usr/local/kde/lib/libinterfaces.la
@@ -78,6 +79,14 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name) : MainWindow(par
QStringList list = i.getInterfaceList();
QMap<QString, Interface*>::Iterator it;
for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) {
+ /*
+ * we skipped it in getAllInterfaces now
+ * we need to ignore it as well
+ */
+ if (m_handledIfaces.contains( *ni) ) {
+ qDebug("Not up iface handled by module");
+ continue;
+ }
bool found = false;
for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){
if(it.key() == (*ni))
@@ -196,6 +205,10 @@ void MainWindowImp::getAllInterfaces(){
for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) {
int flags = 0;
+ if ( m_handledIfaces.contains( (*it) ) ) {
+ qDebug(" %s is handled by a module", (*it).latin1() );
+ continue;
+ }
// int family;
i = NULL;
@@ -307,6 +320,7 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &
return NULL;
}
+ m_handledIfaces += object->handledInterfaceNames();
// Store for deletion later
libraries.insert(object, lib);
return object;
@@ -426,7 +440,7 @@ void MainWindowImp::configureClicked(){
}
}
- InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose );
+ InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose | Qt::WStyle_ContextHelp );
configure->setProfile(currentProfileText);
configure->showMaximized();
}
@@ -459,7 +473,7 @@ void MainWindowImp::informationClicked(){
return;
}
}
- InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
+ InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp);
information->showMaximized();
}
@@ -639,7 +653,6 @@ void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
{
bool found = false;
qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
-
if (msg == "raise") {
raise();
return;
diff --git a/noncore/settings/networksettings/mainwindowimp.h b/noncore/settings/networksettings/mainwindowimp.h
index a553f75..451835b 100644
--- a/noncore/settings/networksettings/mainwindowimp.h
+++ b/noncore/settings/networksettings/mainwindowimp.h
@@ -10,7 +10,7 @@ class Interface;
class QLibrary;
class KProcess;
class QCopChannel;
-#ifdef QWS
+#ifdef QWS
class QLibrary;
#else
class KLibrary;
@@ -25,21 +25,21 @@ class MainWindowImp : public MainWindow {
public:
MainWindowImp(QWidget *parent=0, const char *name=0);
~MainWindowImp();
-
+
QCopChannel *channel;
private slots:
void getAllInterfaces();
-
+
void addClicked();
void removeClicked();
void configureClicked();
void informationClicked();
-
+
void addProfile();
void removeProfile();
void changeProfile();
-
+
void updateInterface(Interface *i);
void newProfileChanged(const QString& newText);
@@ -48,7 +48,7 @@ private slots:
private:
void makeChannel();
void loadModules(const QString &path);
-
+
Module* loadPlugin(const QString &pluginFileName,
const QString &resolveString = "create_plugin");
@@ -58,7 +58,8 @@ private:
QMap<Module*, QLibrary*> libraries;
QMap<Interface*, QListViewItem*> items;
QMap<QListViewItem*, Interface*> interfaceItems;
-
+ QStringList m_handledIfaces;
+
QMap<KProcess*, QString> threads;
QStringList profiles;
diff --git a/noncore/settings/networksettings/module.h b/noncore/settings/networksettings/module.h
index db74394..f7d8046 100644
--- a/noncore/settings/networksettings/module.h
+++ b/noncore/settings/networksettings/module.h
@@ -18,7 +18,7 @@ class Module : QObject{
signals:
void updateInterface(Interface *i);
-
+
public:
Module(){};
@@ -32,14 +32,14 @@ public:
* The current profile has been changed and the module should do any
* neccesary changes also.
* @param newProfile what the profile should be changed to.
- */
+ */
virtual void setProfile(const QString &newProfile) = 0;
-
+
/**
* get the icon name for this device.
* @param Interface* can be used in determining the icon.
- * @return QString the icon name (minus .png, .gif etc)
- */
+ * @return QString the icon name (minus .png, .gif etc)
+ */
virtual QString getPixmapName(Interface *) = 0;
/**
@@ -48,41 +48,41 @@ public:
* @return bool true if i is owned by this module, false otherwise.
*/
virtual bool isOwner(Interface *){ return false; };
-
+
/**
* Create and return the WLANConfigure Module
* @param Interface *i the interface to configure.
* @return QWidget* pointer to this modules configure.
*/
virtual QWidget *configure(Interface *){ return NULL; } ;
-
+
/**
* Create, and return the Information Module
* @param Interface *i the interface to get info on.
* @return QWidget* pointer to this modules info.
*/
virtual QWidget *information(Interface *){ return NULL; };
-
+
/**
* Get all active (up or down) interfaces
* @return QList<Interface> A list of interfaces that exsist that havn't
* been called by isOwner()
- */
+ */
virtual QList<Interface> getInterfaces() = 0;
-
+
/**
* Adds possible new interfaces to the list (Example: usb(ppp), ir(ppp),
* modem ppp)
*/
virtual void possibleNewInterfaces(QMap<QString, QString> &list) = 0;
-
+
/**
* Attempts to create a new interface from name
* @return Interface* NULL if it was unable to be created.
* @param name the type of interface to create
- */
+ */
virtual Interface *addNewInterface(const QString &name) = 0;
-
+
/**
* Attempts to remove the interface, doesn't delete i
* @return bool true if successfull, false otherwise.
@@ -90,10 +90,21 @@ public:
virtual bool remove(Interface* i) = 0;
/**
- * get dcop calls
+ * get dcop calls
*/
virtual void receive(const QCString &msg, const QByteArray &arg) = 0;
+ QStringList handledInterfaceNames()const { return m_inter; }
+protected:
+ /**
+ * set which interfaceNames should not be shown cause they're handled
+ * internally of this module.. An already running ppp link or
+ * a tunnel...
+ */
+ void setHandledInterfaceNames( const QStringList& in) { m_inter = in; }
+
+private:
+ QStringList m_inter;
};
#endif
diff --git a/noncore/settings/networksettings/ppp/TODO b/noncore/settings/networksettings/ppp/TODO
index 80fc5a6..14a1b3f 100644
--- a/noncore/settings/networksettings/ppp/TODO
+++ b/noncore/settings/networksettings/ppp/TODO
@@ -1,9 +1,3 @@
-- ask for password is non is set
-
-- stop pppd, i.e. fix interfaceinformationppp
-
-- update modem attribute inputs when modem has changed
-- impl. PPPData::copyaccount & PPPData::deleteAccount
-
+- impl. PPPData::copyaccount
- check if the same interface device combination allready exists
-- fix layout of edit account, i.e. get it shown maximised
+- check if a deleted account or device exists in a config and ask the user
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index fa1c43b..28d8732 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -44,102 +44,66 @@
void parseargs(char* buf, char** args);
-AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name )
- : QWidget( parent, name )//, _pppdata(pd)
+
+AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f )
+ : ChooserWidget( pd, parent, name, f )
{
- _pppdata = pd;
- QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
- accountlist_l = new QListBox(this);
-
- connect(accountlist_l, SIGNAL(highlighted(int)),
- this, SLOT(slotListBoxSelect(int)));
- connect(accountlist_l, SIGNAL(selected(int)),
- this, SLOT(editaccount()));
- l1->addWidget(accountlist_l, 10);
-
- edit_b = new QPushButton(tr("&Edit..."), this);
- connect(edit_b, SIGNAL(clicked()), SLOT(editaccount()));
- QWhatsThis::add(edit_b, tr("Allows you to modify the selected account"));
- l1->addWidget(edit_b);
- new_b = new QPushButton(tr("&New..."), this);
- connect(new_b, SIGNAL(clicked()), SLOT(newaccount()));
- l1->addWidget(new_b);
+ QWhatsThis::add(edit_b, tr("Allows you to modify the selected account"));
QWhatsThis::add(new_b, tr("Create a new dialup connection\n"
"to the Internet"));
-
- copy_b = new QPushButton(tr("Co&py"), this);
- connect(copy_b, SIGNAL(clicked()), SLOT(copyaccount()));
- l1->addWidget(copy_b);
QWhatsThis::add(copy_b,
tr("Makes a copy of the selected account. All\n"
"settings of the selected account are copied\n"
"to a new account, that you can modify to fit your\n"
"needs"));
-
- delete_b = new QPushButton(tr("De&lete"), this);
- connect(delete_b, SIGNAL(clicked()), SLOT(deleteaccount()));
- l1->addWidget(delete_b);
QWhatsThis::add(delete_b,
tr("<p>Deletes the selected account\n\n"
"<font color=\"red\"><b>Use with care!</b></font>"));
- QHBoxLayout *l12 = new QHBoxLayout;
- l1->addStretch(1);
- l1->addLayout(l12);
- int currAccId = _pppdata->currentAccountID();
- qDebug("currentAccountID %i", currAccId);
- //load up account list from gppdata to the list box
- if(_pppdata->count() > 0) {
- for(int i=0; i <= _pppdata->count()-1; i++) {
- _pppdata->setAccountbyIndex(i);
- accountlist_l->insertItem(_pppdata->accname());
- }
- }
- _pppdata->setAccountbyIndex( currAccId );
+ copy_b->setEnabled( false ); //FIXME
+ // delete_b->setEnabled( false ); //FIXME
- qDebug("setting listview index to %i",_pppdata->currentAccountID() );
- accountlist_l->setCurrentItem( _pppdata->currentAccountID() );
- slotListBoxSelect( _pppdata->currentAccountID() );
+ listListbox->insertStringList(_pppdata->getAccountList());
- l1->activate();
+ for (uint i = 0; i < listListbox->count(); i++){
+ if ( listListbox->text(i) == _pppdata->accname() )
+ listListbox->setCurrentItem( i );
+ }
}
void AccountWidget::slotListBoxSelect(int idx) {
- delete_b->setEnabled((bool)(idx != -1));
- edit_b->setEnabled((bool)(idx != -1));
- copy_b->setEnabled((bool)(idx != -1));
- if(idx!=-1) {
- qDebug("setting account to %i", idx);
- QString account = _pppdata->accname();
- _pppdata->setAccountbyIndex(accountlist_l->currentItem());
- }
+ bool ok = _pppdata->setAccount( listListbox->text(idx) );
+ ok = (bool)(idx != -1);
+ delete_b->setEnabled(ok);
+ edit_b->setEnabled(ok);
+//FIXME copy_b->setEnabled(ok);
}
-void AccountWidget::editaccount() {
- _pppdata->setAccount(accountlist_l->text(accountlist_l->currentItem()));
+void AccountWidget::edit() {
+ _pppdata->setAccount(listListbox->text(listListbox->currentItem()));
int result = doTab();
if(result == QDialog::Accepted) {
- accountlist_l->changeItem(_pppdata->accname(),accountlist_l->currentItem());
+ listListbox->changeItem(_pppdata->accname(),listListbox->currentItem());
// emit resetaccounts();
_pppdata->save();
}
}
-void AccountWidget::newaccount() {
+void AccountWidget::create() {
- if(accountlist_l->count() == MAX_ACCOUNTS) {
- QMessageBox::information(this, "sorry",
- tr("Maximum number of accounts reached."));
- return;
- }
+// if(listListbox->count() == MAX_ACCOUNTS) {
+// QMessageBox::information(this, "sorry",
+// tr("Maximum number of accounts reached."));
+// return;
+// }
int result;
if (_pppdata->newaccount() == -1){
@@ -149,8 +113,8 @@ void AccountWidget::newaccount() {
result = doTab();
if(result == QDialog::Accepted) {
- accountlist_l->insertItem(_pppdata->accname());
- accountlist_l->setSelected(accountlist_l->findItem(_pppdata->accname()),true);
+ listListbox->insertItem(_pppdata->accname());
+ listListbox->setSelected(listListbox->findItem(_pppdata->accname()),true);
_pppdata->save();
} else
@@ -158,53 +122,55 @@ void AccountWidget::newaccount() {
}
-void AccountWidget::copyaccount() {
- if(accountlist_l->count() == MAX_ACCOUNTS) {
- QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
- return;
- }
+void AccountWidget::copy() {
+// if(listListbox->count() == MAX_ACCOUNTS) {
+// QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
+// return;
+// }
- if(accountlist_l->currentItem()<0) {
+ if(listListbox->currentItem()<0) {
QMessageBox::information(this, "sorry", tr("No account selected."));
return;
}
- _pppdata->copyaccount(accountlist_l->currentItem());
+ _pppdata->copyaccount(listListbox->currentText());
- accountlist_l->insertItem(_pppdata->accname());
+ listListbox->insertItem(_pppdata->accname());
// emit resetaccounts();
_pppdata->save();
}
-void AccountWidget::deleteaccount() {
+void AccountWidget::remove() {
QString s = tr("Are you sure you want to delete\nthe account \"%1\"?")
- .arg(accountlist_l->text(accountlist_l->currentItem()));
+ .arg(listListbox->text(listListbox->currentItem()));
if(QMessageBox::warning(this,tr("Confirm"),s,
QMessageBox::Yes,QMessageBox::No
) != QMessageBox::Yes)
return;
- if(_pppdata->deleteAccount(accountlist_l->text(accountlist_l->currentItem())))
- accountlist_l->removeItem(accountlist_l->currentItem());
+ if(_pppdata->deleteAccount(listListbox->text(listListbox->currentItem())))
+ listListbox->removeItem(listListbox->currentItem());
- emit resetaccounts();
- _pppdata->save();
- slotListBoxSelect(accountlist_l->currentItem());
+// emit resetaccounts();
+// _pppdata->save();
+
+
+ slotListBoxSelect(listListbox->currentItem());
}
int AccountWidget::doTab(){
- QDialog *dlg = new QDialog( 0, "newAccount", true );
+ QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp );
QVBoxLayout *layout = new QVBoxLayout( dlg );
layout->setSpacing( 0 );
layout->setMargin( 1 );
- tabWindow = new QTabWidget( dlg, "tabWindow" );
+ QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" );
layout->addWidget( tabWindow );
bool isnewaccount;
@@ -273,25 +239,25 @@ int AccountWidget::doTab(){
}
-QString AccountWidget::prettyPrintVolume(unsigned int n) {
- int idx = 0;
- const QString quant[] = {tr("Byte"), tr("KB"),
- tr("MB"), tr("GB"), QString::null};
+// QString AccountWidget::prettyPrintVolume(unsigned int n) {
+// int idx = 0;
+// const QString quant[] = {tr("Byte"), tr("KB"),
+// tr("MB"), tr("GB"), QString::null};
- float n1 = n;
- while(n >= 1024 && quant[idx] != QString::null) {
- idx++;
- n /= 1024;
- }
+// float n1 = n;
+// while(n >= 1024 && quant[idx] != QString::null) {
+// idx++;
+// n /= 1024;
+// }
- int i = idx;
- while(i--)
- n1 = n1 / 1024.0;
+// int i = idx;
+// while(i--)
+// n1 = n1 / 1024.0;
- QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 );
- s += " " + quant[idx];
- return s;
-}
+// QString s = QString::number( n1, 'f', idx==0 ? 0 : 1 );
+// s += " " + quant[idx];
+// return s;
+// }
/////////////////////////////////////////////////////////////////////////////
diff --git a/noncore/settings/networksettings/ppp/accounts.h b/noncore/settings/networksettings/ppp/accounts.h
index 8c16a7c..7f31513 100644
--- a/noncore/settings/networksettings/ppp/accounts.h
+++ b/noncore/settings/networksettings/ppp/accounts.h
@@ -27,16 +27,18 @@
#ifndef _ACCOUNTS_H_
#define _ACCOUNTS_H_
-#include <qwidget.h>
#include <qdialog.h>
#include <qpushbutton.h>
#include <qlistbox.h>
-//#include "acctselect.h"
+#include "chooserwidget.h"
-class QDialog;
class QCheckBox;
class QLineEdit;
class QTabWidget;
+class ModemWidget;
+class ModemWidget2;
+
+
class DialWidget;
class AuthWidget;
class IPWidget;
@@ -44,41 +46,33 @@ class DNSWidget;
class GatewayWidget;
class PPPData;
-class AccountWidget : public QWidget {
+
+class AccountWidget : public ChooserWidget {
+
Q_OBJECT
public:
- AccountWidget( PPPData *pd, QWidget *parent=0, const char *name=0 );
+ AccountWidget( PPPData *pd, QWidget *parent=0, const char *name=0, WFlags f=0 );
~AccountWidget() {}
-private slots:
- void editaccount();
- void copyaccount();
- void newaccount();
- void deleteaccount();
- void slotListBoxSelect(int);
-private:
+private slots:
+ virtual void edit();
+ virtual void copy();
+ virtual void remove();
+ virtual void create();
+ virtual void slotListBoxSelect(int);
int doTab();
-signals:
- void resetaccounts();
+ signals:
+ void resetaccounts();
private:
- QString prettyPrintVolume(unsigned int);
-
- PPPData *_pppdata;
- QTabWidget *tabWindow;
DialWidget *dial_w;
IPWidget *ip_w;
DNSWidget *dns_w;
GatewayWidget *gateway_w;
AuthWidget *auth_w;
- QListBox *accountlist_l;
- QPushButton *edit_b;
- QPushButton *copy_b;
- QPushButton *new_b;
- QPushButton *delete_b;
};
diff --git a/noncore/settings/networksettings/ppp/chooserwidget.cpp b/noncore/settings/networksettings/ppp/chooserwidget.cpp
new file mode 100644
index 0000000..a32b2b8
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/chooserwidget.cpp
@@ -0,0 +1,85 @@
+/*
+ * kPPP: A pppd front end for the KDE project
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997 Bernd Johannes Wuebben
+ * wuebben@math.cornell.edu
+ *
+ * based on EzPPP:
+ * Copyright (C) 1997 Jay Painter
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <qdir.h>
+#include <stdlib.h>
+#include <qlayout.h>
+#include <qtabwidget.h>
+#include <qtabdialog.h>
+#include <qwhatsthis.h>
+#include <qmessagebox.h>
+
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qmessagebox.h>
+#include <qvgroupbox.h>
+#include <qwidget.h>
+
+#include "accounts.h"
+#include "authwidget.h"
+#include "pppdata.h"
+#include "edit.h"
+
+void parseargs(char* buf, char** args);
+
+ChooserWidget::ChooserWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f )
+ : QWidget( parent, name, f )
+{
+ _pppdata = pd;
+ QVBoxLayout *l1 = new QVBoxLayout(this, 10, 10);
+ listListbox = new QListBox(this);
+
+ connect(listListbox, SIGNAL(highlighted(int)),
+ this, SLOT(slotListBoxSelect(int)));
+ connect(listListbox, SIGNAL(selected(int)),this, SLOT(edit()));
+ l1->addWidget(listListbox, 10);
+
+ edit_b = new QPushButton(tr("&Edit..."), this);
+ connect(edit_b, SIGNAL(clicked()), SLOT(edit()));
+ l1->addWidget(edit_b);
+
+ new_b = new QPushButton(tr("&New..."), this);
+ connect(new_b, SIGNAL(clicked()), SLOT(create()));
+ l1->addWidget(new_b);
+
+
+ copy_b = new QPushButton(tr("Co&py"), this);
+ connect(copy_b, SIGNAL(clicked()), SLOT(copy()));
+ l1->addWidget(copy_b);
+
+ delete_b = new QPushButton(tr("De&lete"), this);
+ connect(delete_b, SIGNAL(clicked()), SLOT(remove()));
+ l1->addWidget(delete_b);
+
+
+ QHBoxLayout *l12 = new QHBoxLayout;
+ l1->addStretch(1);
+ l1->addLayout(l12);
+
+ l1->activate();
+
+}
+
diff --git a/noncore/settings/networksettings/ppp/chooserwidget.h b/noncore/settings/networksettings/ppp/chooserwidget.h
new file mode 100644
index 0000000..ac3f4cb
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/chooserwidget.h
@@ -0,0 +1,73 @@
+/* -*- C++ -*-
+ * kPPP: A pppd front end for the KDE project
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997 Bernd Johannes Wuebben
+ * wuebben@math.cornell.edu
+ *
+ * based on EzPPP:
+ * Copyright (C) 1997 Jay Painter
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _CHOOSERWIDGET_H_
+#define _CHOOSERWIDGET_H_
+
+#include <qwidget.h>
+#include <qdialog.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+//#include "acctselect.h"
+
+class QDialog;
+class QCheckBox;
+class QLineEdit;
+class QTabWidget;
+class DialWidget;
+class AuthWidget;
+class IPWidget;
+class DNSWidget;
+class GatewayWidget;
+class PPPData;
+
+class ChooserWidget : public QWidget {
+ Q_OBJECT
+public:
+ ChooserWidget( PPPData *pd, QWidget *parent=0, const char *name=0, WFlags f=0 );
+ ~ChooserWidget() {}
+
+private slots:
+ virtual void edit() = 0;
+ virtual void copy() = 0;
+ virtual void create()= 0;
+ virtual void remove()= 0;
+ virtual void slotListBoxSelect(int) = 0;
+
+
+protected:
+ PPPData *_pppdata;
+
+ QListBox *listListbox;
+ QPushButton *edit_b;
+ QPushButton *copy_b;
+ QPushButton *new_b;
+ QPushButton *delete_b;
+};
+
+
+#endif
+
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp
index 2400d7b..e3fab24 100644
--- a/noncore/settings/networksettings/ppp/connect.cpp
+++ b/noncore/settings/networksettings/ppp/connect.cpp
@@ -32,7 +32,6 @@
#include <qapplication.h>
//#include <kdebug.h>
//#include <klocale.h>
-#define i18n QObject::tr
#include <qmessagebox.h>
#include <qpushbutton.h>
@@ -99,7 +98,7 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
modified_hostname = false;
QVBoxLayout *tl = new QVBoxLayout(this, 8, 10);
- QString tit = i18n("Connecting to: ");
+ QString tit = QObject::tr("Connecting to: ");
setCaption(tit);
QHBoxLayout *l0 = new QHBoxLayout(10);
@@ -108,15 +107,15 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
messg = new QLabel(this, "messg");
messg->setFrameStyle(QFrame::Panel|QFrame::Sunken);
messg->setAlignment(AlignCenter);
- messg->setText(i18n("Unable to create modem lock file."));
+ messg->setText(QObject::tr("Unable to create modem lock file."));
messg->setMinimumHeight(messg->sizeHint().height() + 5);
// int messw = (messg->sizeHint().width() * 12) / 10;
// messw = QMAX(messw,280);
// messg->setMinimumWidth(messw);
if (_ifaceppp->getStatus())
- messg->setText(i18n("Online"));
+ messg->setText(QObject::tr("Online"));
else
- messg->setText(i18n("Offline"));
+ messg->setText(QObject::tr("Offline"));
l0->addSpacing(10);
l0->addWidget(messg);
l0->addSpacing(10);
@@ -125,12 +124,12 @@ ConnectWidget::ConnectWidget(InterfacePPP *ifp, QWidget *parent, const char *nam
tl->addLayout(l1);
l1->addStretch(1);
- debug = new QPushButton(i18n("Log"), this);
+ debug = new QPushButton(QObject::tr("Log"), this);
debug->setToggleButton(true);
debug->setEnabled( false ); // FIXME: disable the log button
connect(debug, SIGNAL(clicked()), SIGNAL(toggleDebugWindow()));
- cancel = new QPushButton(i18n("Cancel"), this);
+ cancel = new QPushButton(QObject::tr("Cancel"), this);
cancel->setFocus();
connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton()));
@@ -173,7 +172,7 @@ ConnectWidget::~ConnectWidget() {
void ConnectWidget::preinit() {
// this is all just to keep the GUI nice and snappy ....
// you have to see to believe ...
- messg->setText(i18n("Looking for modem..."));
+ messg->setText(QObject::tr("Looking for modem..."));
inittimer->start(100);
}
@@ -201,15 +200,15 @@ void ConnectWidget::init() {
comlist = &_ifaceppp->data()->scriptType();
arglist = &_ifaceppp->data()->script();
- QString tit = i18n("Connecting to: %1").arg(_ifaceppp->data()->accname());
+ QString tit = QObject::tr("Connecting to: %1").arg(_ifaceppp->data()->accname());
setCaption(tit);
qApp->processEvents();
// run the "before-connect" command
if (!_ifaceppp->data()->command_before_connect().isEmpty()) {
- messg->setText(i18n("Running pre-startup command..."));
- emit debugMessage(i18n("Running pre-startup command..."));
+ messg->setText(QObject::tr("Running pre-startup command..."));
+ emit debugMessage(QObject::tr("Running pre-startup command..."));
qApp->processEvents();
QApplication::flushX();
@@ -226,13 +225,13 @@ void ConnectWidget::init() {
int lock = _ifaceppp->modem()->lockdevice();
if (lock == 1) {
- messg->setText(i18n("Modem device is locked."));
+ messg->setText(QObject::tr("Modem device is locked."));
vmain = 20; // wait until cancel is pressed
return;
}
if (lock == -1) {
- messg->setText(i18n("Unable to create modem lock file."));
+ messg->setText(QObject::tr("Unable to create modem lock file."));
vmain = 20; // wait until cancel is pressed
return;
}
@@ -279,8 +278,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
assert(PPPData::NumInitStrings > 0);
// first init string ?
if(substate == -1) {
- messg->setText(i18n("Initializing modem..."));
- emit debugMessage(i18n("Initializing modem..."));
+ messg->setText(QObject::tr("Initializing modem..."));
+ emit debugMessage(QObject::tr("Initializing modem..."));
substate = 0;
}
@@ -317,7 +316,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (vmain == 5) {
if(!expecting) {
QString sToneDuration = "ATS11=" + QString::number(_ifaceppp->data()->modemToneDuration());
- QString msg = i18n("Setting ") + sToneDuration;
+ QString msg = QObject::tr("Setting ") + sToneDuration;
messg->setText(msg);
emit debugMessage(msg);
setExpect(_ifaceppp->data()->modemInitResp());
@@ -340,8 +339,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
vmain = 4;
return;
}
- messg->setText(i18n("Setting speaker volume..."));
- emit debugMessage(i18n("Setting speaker volume..."));
+ messg->setText(QObject::tr("Setting speaker volume..."));
+ emit debugMessage(QObject::tr("Setting speaker volume..."));
setExpect(_ifaceppp->data()->modemInitResp());
QString vol("AT");
@@ -356,7 +355,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(vmain == 4) {
if(!expecting) {
if(!_ifaceppp->data()->waitForDialTone()) {
- QString msg = i18n("Turning off dial tone waiting...");
+ QString msg = QObject::tr("Turning off dial tone waiting...");
messg->setText(msg);
emit debugMessage(msg);
setExpect(_ifaceppp->data()->modemInitResp());
@@ -377,7 +376,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
QStringList &plist = _ifaceppp->data()->phonenumbers();
QString bmarg= _ifaceppp->data()->dialPrefix();
bmarg += *plist.at(dialnumber);
- QString bm = i18n("Dialing %1").arg(bmarg);
+ QString bm = QObject::tr("Dialing %1").arg(bmarg);
messg->setText(bm);
emit debugMessage(bm);
@@ -408,12 +407,12 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
timeout_timer->start(_ifaceppp->data()->modemTimeout()*1000);
- messg->setText(i18n("Line busy. Hanging up..."));
+ messg->setText(QObject::tr("Line busy. Hanging up..."));
emit debugPutChar('\n');
_ifaceppp->modem()->hangup();
if(_ifaceppp->data()->busyWait() > 0) {
- QString bm = i18n("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait());
+ QString bm = QObject::tr("Line busy. Waiting: %1 seconds").arg(_ifaceppp->data()->busyWait());
messg->setText(bm);
emit debugMessage(bm);
@@ -432,7 +431,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(readbuffer.contains(_ifaceppp->data()->modemNoDialtoneResp())) {
timeout_timer->stop();
- messg->setText(i18n("No Dialtone"));
+ messg->setText(QObject::tr("No Dialtone"));
vmain = 20;
_ifaceppp->modem()->unlockdevice();
return;
@@ -441,7 +440,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if(readbuffer.contains(_ifaceppp->data()->modemNoCarrierResp())) {
timeout_timer->stop();
- messg->setText(i18n("No Carrier"));
+ messg->setText(QObject::tr("No Carrier"));
vmain = 20;
_ifaceppp->modem()->unlockdevice();
return;
@@ -479,7 +478,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "Scan") {
- QString bm = i18n("Scanning %1").arg(scriptArgument);
+ QString bm = QObject::tr("Scanning %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -489,7 +488,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "Save") {
- QString bm = i18n("Saving %1").arg(scriptArgument);
+ QString bm = QObject::tr("Saving %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -507,7 +506,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Send" || scriptCommand == "SendNoEcho") {
- QString bm = i18n("Sending %1");
+ QString bm = QObject::tr("Sending %1");
// replace %USERNAME% and %PASSWORD%
QString arg = scriptArgument;
@@ -532,7 +531,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "Expect") {
- QString bm = i18n("Expecting %1").arg(scriptArgument);
+ QString bm = QObject::tr("Expecting %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -546,7 +545,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "Pause") {
- QString bm = i18n("Pause %1 seconds").arg(scriptArgument);
+ QString bm = QObject::tr("Pause %1 seconds").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -563,7 +562,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- QString bm = i18n("Timeout %1 seconds").arg(scriptArgument);
+ QString bm = QObject::tr("Timeout %1 seconds").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -575,8 +574,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "Hangup") {
- messg->setText(i18n("Hangup"));
- emit debugMessage(i18n("Hangup"));
+ messg->setText(QObject::tr("Hangup"));
+ emit debugMessage(QObject::tr("Hangup"));
writeline(_ifaceppp->data()->modemHangupStr());
setExpect(_ifaceppp->data()->modemHangupResp());
@@ -589,8 +588,8 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
timeout_timer->stop();
- messg->setText(i18n("Answer"));
- emit debugMessage(i18n("Answer"));
+ messg->setText(QObject::tr("Answer"));
+ emit debugMessage(QObject::tr("Answer"));
setExpect(_ifaceppp->data()->modemRingResp());
vmain = 150;
@@ -598,7 +597,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "ID") {
- QString bm = i18n("ID %1").arg(scriptArgument);
+ QString bm = QObject::tr("ID %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -634,7 +633,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "Password") {
- QString bm = i18n("Password %1").arg(scriptArgument);
+ QString bm = QObject::tr("Password %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -671,7 +670,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "Prompt") {
- QString bm = i18n("Prompting %1");
+ QString bm = QObject::tr("Prompting %1");
// if the scriptindex (aka the prompt text) includes a ## marker
// this marker should get substituted with the contents of our stored
@@ -708,7 +707,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "PWPrompt") {
- QString bm = i18n("PW Prompt %1").arg(scriptArgument);
+ QString bm = QObject::tr("PW Prompt %1").arg(scriptArgument);
messg->setText(bm);
emit debugMessage(bm);
@@ -733,7 +732,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
if (scriptCommand == "LoopStart") {
- QString bm = i18n("Loop Start %1").arg(scriptArgument);
+ QString bm = QObject::tr("Loop Start %1").arg(scriptArgument);
// The incrementing of the scriptindex MUST be before the
// call to setExpect otherwise the expect will miss a string that is
@@ -741,10 +740,10 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
scriptindex++;
if ( loopnest > (MAXLOOPNEST-2) ) {
- bm += i18n("ERROR: Nested too deep, ignored.");
+ bm += QObject::tr("ERROR: Nested too deep, ignored.");
vmain=20;
cancelbutton();
- QMessageBox::critical(0, "error", i18n("Loops nested too deeply!"));
+ QMessageBox::critical(0, "error", QObject::tr("Loops nested too deeply!"));
} else {
setExpect(scriptArgument);
loopstartindex[loopnest] = scriptindex;
@@ -758,9 +757,9 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
}
if (scriptCommand == "LoopEnd") {
- QString bm = i18n("Loop End %1").arg(scriptArgument);
+ QString bm = QObject::tr("Loop End %1").arg(scriptArgument);
if ( loopnest <= 0 ) {
- bm = i18n("LoopEnd without matching Start! Line: %1").arg(bm);
+ bm = QObject::tr("LoopEnd without matching Start! Line: %1").arg(bm);
vmain=20;
cancelbutton();
QMessageBox::critical(0, "error", bm);
@@ -848,7 +847,7 @@ void ConnectWidget::timerEvent(QTimerEvent *) {
semaphore = true;
result = execppp();
- emit debugMessage(i18n("Starting pppd..."));
+ emit debugMessage(QObject::tr("Starting pppd..."));
qDebug("execppp() returned with return-code %i", result );
if(result) {
@@ -930,7 +929,7 @@ void ConnectWidget::checkBuffers() {
scanvar = scanvar.stripWhiteSpace();
// Show the Variabel content in the debug window
- QString sv = i18n("Scan Var: %1").arg(scanvar);
+ QString sv = QObject::tr("Scan Var: %1").arg(scanvar);
emit debugMessage(sv);
}
@@ -940,7 +939,7 @@ void ConnectWidget::checkBuffers() {
// keep everything after the expected string
readbuffer.remove(0, readbuffer.find(expectstr) + expectstr.length());
- QString ts = i18n("Found: %1").arg(expectstr);
+ QString ts = QObject::tr("Found: %1").arg(expectstr);
emit debugMessage(ts);
if (loopend) {
@@ -951,7 +950,7 @@ void ConnectWidget::checkBuffers() {
if (loopend && readbuffer.contains(loopstr[loopnest])) {
expecting = false;
readbuffer = "";
- QString ts = i18n("Looping: %1").arg(loopstr[loopnest]);
+ QString ts = QObject::tr("Looping: %1").arg(loopstr[loopnest]);
emit debugMessage(ts);
scriptindex = loopstartindex[loopnest];
loopend = false;
@@ -984,7 +983,7 @@ void ConnectWidget::cancelbutton() {
// this->show();
// }
- messg->setText(i18n("One moment please..."));
+ messg->setText(QObject::tr("One moment please..."));
// just to be sure
_ifaceppp->modem()->removeSecret(AUTH_PAP);
@@ -1006,11 +1005,14 @@ void ConnectWidget::cancelbutton() {
//abort prompt window...
if (prompt->isVisible()) {
- prompt->hide();
+ prompt->hide();
}
prompt->setConsumed();
- messg->setText(tr("offline"));
+ _ifaceppp->setStatus( false );
+ _ifaceppp->refresh();
+// messg->setText(tr("offline"));
+ refresh();
}
@@ -1026,7 +1028,7 @@ void ConnectWidget::script_timed_out() {
prompt->hide();
prompt->setConsumed();
- messg->setText(i18n("Script timed out!"));
+ messg->setText(QObject::tr("Script timed out!"));
_ifaceppp->modem()->hangup();
emit stopAccounting();
// p_kppp->con_win->stopClock();
@@ -1041,7 +1043,7 @@ void ConnectWidget::setScan(const QString &n) {
scanstr = n;
scanbuffer = "";
- QString ts = i18n("Scanning: %1").arg(n);
+ QString ts = QObject::tr("Scanning: %1").arg(n);
emit debugMessage(ts);
}
@@ -1050,7 +1052,7 @@ void ConnectWidget::setExpect(const QString &n) {
expecting = true;
expectstr = n;
- QString ts = i18n("Expecting: %1").arg(n);
+ QString ts = QObject::tr("Expecting: %1").arg(n);
ts.replace(QRegExp("\n"), "<LF>");
emit debugMessage(ts);
@@ -1085,7 +1087,7 @@ void ConnectWidget::pppdDied()
}
void ConnectWidget::if_waiting_slot() {
- messg->setText(i18n("Logging on to network..."));
+ messg->setText(QObject::tr("Logging on to network..."));
// if(!stats->ifIsUp()) {
@@ -1116,26 +1118,31 @@ void ConnectWidget::if_waiting_slot() {
auto_hostname(_ifaceppp);
if(!_ifaceppp->data()->command_on_connect().isEmpty()) {
- messg->setText(i18n("Running startup command..."));
+ messg->setText(QObject::tr("Running startup command..."));
// make sure that we don't get any async errors
qApp->flushX();
execute_command(_ifaceppp->data()->command_on_connect());
- messg->setText(i18n("Done"));
+ messg->setText(QObject::tr("Done"));
}
// remove the authentication file
_ifaceppp->modem()->removeSecret(AUTH_PAP);
_ifaceppp->modem()->removeSecret(AUTH_CHAP);
- emit debugMessage(i18n("Done"));
+ emit debugMessage(QObject::tr("Done"));
set_con_speed_string();
// p_kppp->con_win->setConnectionSpeed(p_kppp->con_speed);
- this->hide();
- messg->setText("");
+// this->hide();
+// messg->setText("");
_ifaceppp->setStatus( true );
+
+ m_refreshTimer = new QTimer( this );
+ connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
+ m_refreshTimer->start( 3000 );
+ //_ifaceppp->refresh();
// emit _ifaceppp->updateInterface(_ifaceppp);
// prepare the con_win so as to have the right size for
@@ -1161,6 +1168,15 @@ void ConnectWidget::if_waiting_slot() {
_ifaceppp->modem()->closetty();
}
+void ConnectWidget::refresh() {
+ _ifaceppp->refresh();
+ if ( _ifaceppp->getStatus() ) {
+ messg->setText(QObject::tr("Online"));
+ } else {
+ messg->setText(QObject::tr("Offline"));
+ }
+}
+
bool ConnectWidget::execppp() {
QString command;
@@ -1210,38 +1226,44 @@ bool ConnectWidget::execppp() {
if(_ifaceppp->data()->autoDNS())
command += " usepeerdns";
- QStringList &arglist = _ifaceppp->data()->pppdArgument();
- for ( QStringList::Iterator it = arglist.begin();
- it != arglist.end();
- ++it )
- {
- command += " " + *it;
- }
// PAP settings
if(_ifaceppp->data()->authMethod() == AUTH_PAP) {
command += " -chap user ";
- command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
+ command = command + _ifaceppp->data()->storedUsername();
}
// CHAP settings
if(_ifaceppp->data()->authMethod() == AUTH_CHAP) {
command += " -pap user ";
- command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
+ command = command + _ifaceppp->data()->storedUsername();
}
// PAP/CHAP settings
if(_ifaceppp->data()->authMethod() == AUTH_PAPCHAP) {
- command += " user ";
- command = command + "\"" + _ifaceppp->data()->storedUsername() + "\"";
+ QString tmpName = _ifaceppp->data()->storedUsername();
+ if ( !tmpName.isEmpty() ) {
+ command += " user ";
+ command = command + tmpName;
+ }
}
// check for debug
if(_ifaceppp->data()->getPPPDebug())
command += " debug";
+ QStringList &arglist = _ifaceppp->data()->pppdArgument();
+ for ( QStringList::Iterator it = arglist.begin();
+ it != arglist.end();
+ ++it )
+ {
+ command += " " + *it;
+ }
+
+ command += " call opie-kppp logfd 11";
+
if (command.length() > MAX_CMDLEN) {
- QMessageBox::critical(this, "error", i18n(
+ QMessageBox::critical(this, "error", QObject::tr(
"pppd command + command-line arguments exceed "
"2024 characters in length."
));
@@ -1249,6 +1271,8 @@ bool ConnectWidget::execppp() {
return false; // nonsensically long command which would bust my buffer buf.
}
+ qWarning("Command IS: %s",command.latin1() );
+
qApp->flushX();
return _ifaceppp->modem()->execPPPDaemon(command);
diff --git a/noncore/settings/networksettings/ppp/connect.h b/noncore/settings/networksettings/ppp/connect.h
index e7ae5e0..b225ff5 100644
--- a/noncore/settings/networksettings/ppp/connect.h
+++ b/noncore/settings/networksettings/ppp/connect.h
@@ -62,6 +62,7 @@ private slots:
void readChar(unsigned char);
void pause();
void if_waiting_slot();
+ void refresh();
public slots:
void init();
@@ -127,6 +128,7 @@ private:
QTimer *pausetimer;
QTimer *if_timer;
QTimer *if_timeout_timer;
+ QTimer *m_refreshTimer;
QLabel *messg;
QPushButton *cancel;
diff --git a/noncore/settings/networksettings/ppp/conwindow.cpp b/noncore/settings/networksettings/ppp/conwindow.cpp
index 9136ca0..7641bbe 100644
--- a/noncore/settings/networksettings/ppp/conwindow.cpp
+++ b/noncore/settings/networksettings/ppp/conwindow.cpp
@@ -24,12 +24,7 @@
#include <qtooltip.h>
#include <qdialog.h>
#include "conwindow.h"
-//#include "docking.h"
#include "pppdata.h"
-// #include "pppstats.h"
-// #include <klocale.h>
-#define i18n QObject::tr
-// #include <kglobal.h>
ConWindow::ConWindow(PPPData *pd, QWidget *parent, const char *name,
@@ -42,29 +37,29 @@ ConWindow::ConWindow(PPPData *pd, QWidget *parent, const char *name,
tl1(0),
_pppdata(pd)
{
- info1 = new QLabel(i18n("Connected at:"), this);
+ info1 = new QLabel(QObject::tr("Connected at:"), this);
info2 = new QLabel("", this);
- timelabel1 = new QLabel(i18n("Time connected:"), this);
+ timelabel1 = new QLabel(QObject::tr("Time connected:"), this);
timelabel2 = new QLabel("000:00:00", this);
- vollabel = new QLabel(i18n("Volume:"), this);
+ vollabel = new QLabel(QObject::tr("Volume:"), this);
volinfo = new QLabel("", this);
// now the stuff for accounting
- session_bill_l = new QLabel(i18n("Session Bill:"), this);
+ session_bill_l = new QLabel(QObject::tr("Session Bill:"), this);
session_bill = new QLabel("", this);
- total_bill_l = new QLabel(i18n("Total Bill:"), this);
+ total_bill_l = new QLabel(QObject::tr("Total Bill:"), this);
total_bill = new QLabel("", this);
this->setCaption("kppp");
cancelbutton = new QPushButton(this);
- cancelbutton->setText(i18n("Disconnect"));
+ cancelbutton->setText(QObject::tr("Disconnect"));
connect(cancelbutton, SIGNAL(clicked()), mainwidget, SLOT(disconnect()));
// statsbutton = new QPushButton(this);
-// statsbutton->setText(i18n("Details"));
+// statsbutton->setText(QObject::tr("Details"));
// statsbutton->setFocus();
// connect(statsbutton, SIGNAL(clicked()), mainwidget, SLOT(showStats()));
@@ -94,8 +89,8 @@ bool ConWindow::event(QEvent *e) {
QString ConWindow::prettyPrintVolume(unsigned int n) {
int idx = 0;
- const QString quant[] = {i18n("Byte"), i18n("KB"),
- i18n("MB"), i18n("GB"), QString::null};
+ const QString quant[] = {QObject::tr("Byte"), QObject::tr("KB"),
+ QObject::tr("MB"), QObject::tr("GB"), QString::null};
float n1 = n;
while(n >= 1024 && quant[idx] != QString::null) {
@@ -259,14 +254,14 @@ void ConWindow::stopClock() {
void ConWindow::timeclick() {
-// QString tooltip = i18n("Connection: %1\n"
+// QString tooltip = QObject::tr("Connection: %1\n"
// "Connected at: %2\n"
// "Time connected: %3")
// .arg(_pppdata->accname()).arg(info2->text())
// .arg(time_string2);
// if(accountingEnabled)
-// tooltip += i18n("\nSession Bill: %1\nTotal Bill: %2")
+// tooltip += QObject::tr("\nSession Bill: %1\nTotal Bill: %2")
// .arg(session_bill->text()).arg(total_bill->text());
// // volume accounting
// if(volumeAccountingEnabled) {
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp
new file mode 100644
index 0000000..e94904b
--- a/dev/null
+++ b/noncore/settings/networksettings/ppp/devices.cpp
@@ -0,0 +1,212 @@
+/*
+ * kPPP: A pppd front end for the KDE project
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997 Bernd Johannes Wuebben
+ * wuebben@math.cornell.edu
+ *
+ * based on EzPPP:
+ * Copyright (C) 1997 Jay Painter
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <qdir.h>
+#include <stdlib.h>
+#include <qlayout.h>
+#include <qtabwidget.h>
+#include <qtabdialog.h>
+#include <qwhatsthis.h>
+#include <qmessagebox.h>
+
+#include <qapplication.h>
+#include <qbuttongroup.h>
+#include <qmessagebox.h>
+#include <qvgroupbox.h>
+
+#include "interfaceppp.h"
+#include "devices.h"
+#include "authwidget.h"
+#include "pppdata.h"
+#include "edit.h"
+#include "general.h"
+
+void parseargs(char* buf, char** args);
+
+DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f )
+ : ChooserWidget(ip->data(), parent, name, f)
+{
+ _ifaceppp = ip;
+ QWhatsThis::add(edit_b, tr("Allows you to modify the selected device"));
+ QWhatsThis::add(new_b, tr("Create a new device") );
+
+ QWhatsThis::add(copy_b,
+ tr("Makes a copy of the selected device. All\n"
+ "settings of the selected device are copied\n"
+ "to a new device, that you can modify to fit your\n"
+ "needs"));
+ QWhatsThis::add(delete_b,
+ tr("<p>Deletes the selected device\n\n"
+ "<font color=\"red\"><b>Use with care!</b></font>"));
+
+ copy_b->setEnabled( false ); //FIXME
+// delete_b->setEnabled( false ); //FIXME
+
+ QStringList tmp = _pppdata->getDevicesNamesList();
+ qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1());
+ listListbox->insertStringList(tmp);
+
+ for (uint i = 0; i < listListbox->count(); i++){
+ qDebug("listListbox->text(i) %s == _pppdata->devname() %s",listListbox->text(i).latin1(), _pppdata->devname().latin1());
+ if ( listListbox->text(i) == _pppdata->devname() )
+ listListbox->setCurrentItem( i );
+ }
+}
+
+
+
+void DevicesWidget::slotListBoxSelect(int idx) {
+ bool ok = _pppdata->setDevice( listListbox->text(idx) );
+ delete_b->setEnabled((bool)(idx != -1));
+ edit_b->setEnabled((bool)(idx != -1));
+//FIXME copy_b->setEnabled((bool)(idx != -1));
+}
+
+void DevicesWidget::edit() {
+ _pppdata->setDevice(listListbox->text(listListbox->currentItem()));
+
+ int result = doTab();
+
+ if(result == QDialog::Accepted) {
+ listListbox->changeItem(_pppdata->devname(),listListbox->currentItem());
+ _pppdata->save();
+ }
+}
+
+
+void DevicesWidget::create() {
+
+// if(listListbox->count() == MAX_ACCOUNTS) {
+// QMessageBox::information(this, "sorry",
+// tr("Maximum number of accounts reached."));
+// return;
+// }
+
+ int result;
+ if (_pppdata->newdevice() == -1){
+ return;
+ }
+ result = doTab();
+
+ if(result == QDialog::Accepted) {
+ listListbox->insertItem(_pppdata->devname());
+ listListbox->setSelected(listListbox->findItem(_pppdata->devname()),true );
+
+ _pppdata->save();
+ } else
+ _pppdata->deleteDevice();
+}
+
+
+void DevicesWidget::copy() {
+// if(listListbox->count() == MAX_ACCOUNTS) {
+// QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
+// return;
+// }
+
+ if(listListbox->currentItem()<0) {
+ QMessageBox::information(this, "sorry", tr("No devices selected."));
+ return;
+ }
+
+ _pppdata->copydevice(listListbox->currentText());
+
+ listListbox->insertItem(_pppdata->devname());
+ _pppdata->save();
+}
+
+
+void DevicesWidget::remove() {
+
+ QString s = tr("Are you sure you want to delete\nthe device \"%1\"?")
+ .arg(listListbox->text(listListbox->currentItem()));
+
+ if(QMessageBox::warning(this,tr("Confirm"),s,
+ QMessageBox::Yes,QMessageBox::No
+ ) != QMessageBox::Yes)
+ return;
+
+ if(_pppdata->deleteDevice(listListbox->text(listListbox->currentItem())))
+ listListbox->removeItem(listListbox->currentItem());
+
+
+// _pppdata->save();
+
+
+ slotListBoxSelect(listListbox->currentItem());
+
+}
+
+
+int DevicesWidget::doTab(){
+ QDialog *dlg = new QDialog( 0, "newDevice", true, Qt::WStyle_ContextHelp );
+ QVBoxLayout *layout = new QVBoxLayout( dlg );
+ layout->setSpacing( 0 );
+ layout->setMargin( 1 );
+
+ QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" );
+ layout->addWidget( tabWindow );
+
+ bool isnew;
+
+ if(_pppdata->devname().isEmpty()) {
+ dlg->setCaption(tr("New Device"));
+ isnew = true;
+ } else {
+ QString tit = tr("Edit Device: ");
+ tit += _pppdata->devname();
+ dlg->setCaption(tit);
+ isnew = false;
+ }
+
+ modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" );
+ tabWindow->addTab( modem1, tr("&Device") );
+ modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" );
+ tabWindow->addTab( modem2, tr("&Modem") );
+
+ int result = 0;
+ bool ok = false;
+
+ while (!ok){
+ dlg->showMaximized();
+ result = dlg->exec();
+ ok = true;
+
+ if(result == QDialog::Accepted) {
+ if (!modem1->save()){
+ QMessageBox::critical(this, "error", tr( "You must enter a unique device name"));
+ ok = false;
+ }else{
+ modem2->save();
+ }
+ }
+ }
+
+ delete dlg;
+
+ return result;
+}
+
diff --git a/noncore/settings/networksettings/ppp/devices.h b/noncore/settings/networksettings/ppp/devices.h
index d46d5b4..c2679c8 100644
--- a/noncore/settings/networksettings/ppp/devices.h
+++ b/noncore/settings/networksettings/ppp/devices.h
@@ -3,58 +3,49 @@
#include "kpppconfig.h"
-static const char *devices[] = {
-#ifdef __FreeBSD__
- "/dev/cuaa0",
- "/dev/cuaa1",
- "/dev/cuaa2",
- "/dev/cuaa3",
- "/dev/cuaa4",
-#elif defined(__NetBSD__)
- "/dev/tty00", /* "normal" modem lines */
- "/dev/tty01",
- "/dev/tty02",
- "/dev/tty03",
- "/dev/dty00", /* Dial out devices */
- "/dev/dty01",
- "/dev/dty02",
- "/dev/dty03",
- "/dev/ttyU0", /* USB stuff modems */
- "/dev/ttyU1",
- "/dev/ttyU2",
- "/dev/ttyU3",
- "/dev/dtyU0", /* USB stuff, too (dial out device) */
- "/dev/dtyU1",
- "/dev/dtyU2",
- "/dev/dtyU3",
-#elif defined (__linux__)
- "/dev/modem",
- "/dev/ttyS0",
- "/dev/ttyS1",
- "/dev/ttyS2",
- "/dev/ttyS3",
-#ifdef ISDNSUPPORT
- "/dev/ttyI0",
- "/dev/ttyI1",
- "/dev/ttyI2",
- "/dev/ttyI3",
-#endif
- "/dev/usb/ttyACM0", /* USB stuff modems */
- "/dev/usb/ttyACM1",
- "/dev/usb/ttyACM2",
- "/dev/usb/ttyACM3",
- "/dev/ircomm0",
- "/dev/rfcomm0",
- "/dev/rfcomm1",
-#elif defined(__svr4__)
- "/dev/cua/a",
- "/dev/cua/b",
- "/dev/ttya",
- "/dev/ttyb",
-#endif
- 0};
+#include <qwidget.h>
+#include <qdialog.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include "chooserwidget.h"
+
+class QCheckBox;
+class QLineEdit;
+class QTabWidget;
+class DialWidget;
+class AuthWidget;
+class IPWidget;
+class DNSWidget;
+class GatewayWidget;
+class InterfacePPP;
+class PPPData;
+class ModemWidget;
+class ModemWidget2;
+
+class DevicesWidget : public ChooserWidget {
+ Q_OBJECT
+public:
+ DevicesWidget( InterfacePPP* ip, QWidget *parent=0, const char *name=0, WFlags f=0 );
+ ~DevicesWidget() {}
+
+
+private slots:
+ virtual void edit();
+ virtual void copy();
+ virtual void remove();
+ virtual void create();
+ virtual void slotListBoxSelect(int);
+ int doTab();
+
+// signals:
+// void resetaccounts();
+
+private:
+ ModemWidget *modem1;
+ ModemWidget2 *modem2;
+ InterfacePPP *_ifaceppp;
+
+};
-// default device number from the list above
-const int DEV_DEFAULT = 0;
#endif
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 0c96253..ceac90c 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -76,9 +76,9 @@ DialWidget::DialWidget( PPPData *pd, QWidget *parent, bool isnewaccount
del = new QPushButton(tr("&Remove"), this);
up = new QPushButton(this);
- up->setPixmap( Resource::loadPixmap("inline/up") );
+ up->setPixmap( Resource::loadPixmap("up") );
down = new QPushButton(this);
- down->setPixmap( Resource::loadPixmap("inline/down") );
+ down->setPixmap( Resource::loadPixmap("down") );
lpn1->addWidget(add);
lpn1->addWidget(del);
lpn1->addStretch(1);
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index f735e49..5540946 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -35,42 +35,61 @@
#include <qslider.h>
#include <qspinbox.h>
#include <qwhatsthis.h>
-
+#include <qpe/config.h>
// #include <qgroupbox.h>
+
#include "general.h"
#include "interfaceppp.h"
//#include "miniterm.h"
#include "modeminfo.h"
#include "modemcmds.h"
-#include "devices.h"
+//#include "devices.h"
#include "pppdata.h"
//#include <klocale.h>
-#define i18n QObject::tr
-ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name )
- : QWidget(parent, name), _ifaceppp(ifppp)
+
+ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
+ : QWidget(parent, name), _pppdata(pd)
{
int k;
QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint());
QLabel *label1;
- label1 = new QLabel(i18n("Modem de&vice:"), this);
+
+ label1 = new QLabel(tr("Modem &name:"), this);
tl->addWidget(label1, 0, 0);
+ modemname = new QLineEdit(this, "modemName");
+ modemname->setText( _pppdata->devname() );
+ label1->setBuddy(modemname);
+ tl->addWidget(modemname, 0, 1);
+
+ label1 = new QLabel(tr("Modem de&vice:"), this);
+ tl->addWidget(label1, 1, 0);
+
modemdevice = new QComboBox(false, this);
+ modemdevice->setEditable( true );
+ modemdevice->setDuplicatesEnabled ( false );
+ modemdevice->setInsertionPolicy( QComboBox::AtTop );
label1->setBuddy(modemdevice);
- for(k = 0; devices[k]; k++)
- modemdevice->insertItem(devices[k]);
+ Config cfg("NetworkSetupPPP");
+ cfg.setGroup("Devices_General");
+ QStringList devs = cfg.readListEntry("devices",',');
+ if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0";
+ modemdevice->insertStringList( devs );
+ tl->addWidget(modemdevice, 1, 1);
+
+// connect(modemdevice, SIGNAL(activated(int)),
+// SLOT(setmodemdc(int)));
+// connect(modemdevice, SIGNAL(textChanged( const QString & ) ),
+// SLOT( setmodemdc( const QString &) ) );
- tl->addWidget(modemdevice, 0, 1);
- connect(modemdevice, SIGNAL(activated(int)),
- SLOT(setmodemdc(int)));
- QString tmp = i18n("This specifies the serial port your modem is attached \n"
+ QString tmp = tr("This specifies the serial port your modem is attached \n"
"to. On Linux/x86, typically this is either /dev/ttyS0 \n"
"(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
"\n"
@@ -82,19 +101,19 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
QWhatsThis::add(modemdevice,tmp);
- label1 = new QLabel(i18n("&Flow control:"), this);
- tl->addWidget(label1, 1, 0);
+ label1 = new QLabel(tr("&Flow control:"), this);
+ tl->addWidget(label1, 2, 0);
flowcontrol = new QComboBox(false, this);
label1->setBuddy(flowcontrol);
- flowcontrol->insertItem(i18n("Hardware [CRTSCTS]"));
- flowcontrol->insertItem(i18n("Software [XON/XOFF]"));
- flowcontrol->insertItem(i18n("None"));
- tl->addWidget(flowcontrol, 1, 1);
- connect(flowcontrol, SIGNAL(activated(int)),
- SLOT(setflowcontrol(int)));
-
- tmp = i18n("<p>Specifies how the serial port and modem\n"
+ flowcontrol->insertItem(tr("Hardware [CRTSCTS]"));
+ flowcontrol->insertItem(tr("Software [XON/XOFF]"));
+ flowcontrol->insertItem(tr("None"));
+ tl->addWidget(flowcontrol, 2, 1);
+// connect(flowcontrol, SIGNAL(activated(int)),
+// SLOT(setflowcontrol(int)));
+
+ tmp = tr("<p>Specifies how the serial port and modem\n"
"communicate. You should not change this unless\n"
"you know what you are doing.\n"
"\n"
@@ -103,17 +122,17 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
QWhatsThis::add(label1,tmp);
QWhatsThis::add(flowcontrol,tmp);
- QLabel *labelenter = new QLabel(i18n("&Line termination:"), this);
- tl->addWidget(labelenter, 2, 0);
+ QLabel *labelenter = new QLabel(tr("&Line termination:"), this);
+ tl->addWidget(labelenter, 3, 0);
enter = new QComboBox(false, this);
labelenter->setBuddy(enter);
enter->insertItem("CR");
enter->insertItem("LF");
enter->insertItem("CR/LF");
- tl->addWidget(enter, 2, 1);
- connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
- tmp = i18n("<p>Specifies how AT commands are sent to your\n"
+ tl->addWidget(enter, 3, 1);
+// connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
+ tmp = tr("<p>Specifies how AT commands are sent to your\n"
"modem. Most modems will work fine with the\n"
"default <i>CR/LF</i>. If your modem does not react\n"
"to the init string, you should try different\n"
@@ -124,8 +143,8 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
QWhatsThis::add(labelenter,tmp);
QWhatsThis::add(enter, tmp);
- QLabel *baud_label = new QLabel(i18n("Co&nnection speed:"), this);
- tl->addWidget(baud_label, 3, 0);
+ QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
+ tl->addWidget(baud_label, 4, 0);
baud_c = new QComboBox(this);
baud_label->setBuddy(baud_c);
@@ -157,11 +176,11 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
baud_c->insertItem(baudrates[k]);
baud_c->setCurrentItem(3);
- connect(baud_c, SIGNAL(activated(int)),
- this, SLOT(speed_selection(int)));
- tl->addWidget(baud_c, 3, 1);
+// connect(baud_c, SIGNAL(activated(int)),
+// this, SLOT(speed_selection(int)));
+ tl->addWidget(baud_c, 4, 1);
- tmp = i18n("Specifies the speed your modem and the serial\n"
+ tmp = tr("Specifies the speed your modem and the serial\n"
"port talk to each other. You should begin with\n"
"the default of 38400 bits/sec. If everything\n"
"works you can try to increase this value, but to\n"
@@ -172,22 +191,22 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
QWhatsThis::add(baud_c,tmp);
for(int i=0; i <= enter->count()-1; i++) {
- if(_ifaceppp->data()->enter() == enter->text(i))
+ if(_pppdata->enter() == enter->text(i))
enter->setCurrentItem(i);
}
- tl->addRowSpacing(4, 10);
+ tl->addRowSpacing(5, 10);
//Modem Lock File
- modemlockfile = new QCheckBox(i18n("&Use lock file"), this);
+ modemlockfile = new QCheckBox(tr("&Use lock file"), this);
- modemlockfile->setChecked(_ifaceppp->data()->modemLockFile());
- connect(modemlockfile, SIGNAL(toggled(bool)),
- SLOT(modemlockfilechanged(bool)));
- tl->addMultiCellWidget(modemlockfile, 5, 5, 0, 1);
+ modemlockfile->setChecked(_pppdata->modemLockFile());
+// connect(modemlockfile, SIGNAL(toggled(bool)),
+// SLOT(modemlockfilechanged(bool)));
+ tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1);
// l12->addStretch(1);
QWhatsThis::add(modemlockfile,
- i18n("<p>To prevent other programs from accessing the\n"
+ tr("<p>To prevent other programs from accessing the\n"
"modem while a connection is established, a\n"
"file can be created to indicate that the modem\n"
"is in use. On Linux an example file would be\n"
@@ -202,89 +221,139 @@ ModemWidget::ModemWidget( InterfacePPP *ifppp, QWidget *parent, const char *name
QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" );
modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" );
// modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this);
-// modemtimeout->setLabel(i18n("Modem &timeout:"));
+// modemtimeout->setLabel(tr("Modem &timeout:"));
// modemtimeout->setRange(1, 120, 1);
- modemtimeout->setSuffix(i18n(" sec"));
- modemtimeout->setValue( _ifaceppp->data()->modemTimeout() );
- connect(modemtimeout, SIGNAL(valueChanged(int)),
- SLOT(modemtimeoutchanged(int)));
+ modemtimeout->setSuffix(tr(" sec"));
+ modemtimeout->setValue( _pppdata->modemTimeout() );
+// connect(modemtimeout, SIGNAL(valueChanged(int)),
+// SLOT(modemtimeoutchanged(int)));
timeoutLayout->addWidget(timeoutlabel);
timeoutLayout->addWidget(modemtimeout);
- tl->addMultiCellLayout(timeoutLayout, 6, 6, 0, 1);
+ tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1);
QWhatsThis::add(modemtimeout,
- i18n("This specifies how long <i>kppp</i> waits for a\n"
+ tr("This specifies how long <i>kppp</i> waits for a\n"
"<i>CONNECT</i> response from your modem. The\n"
"recommended value is 30 seconds."));
//set stuff from gpppdata
for(int i=0; i <= enter->count()-1; i++) {
- if(_ifaceppp->data()->enter() == enter->text(i))
+ if(_pppdata->enter() == enter->text(i))
enter->setCurrentItem(i);
}
for(int i=0; i <= modemdevice->count()-1; i++) {
- if(_ifaceppp->data()->modemDevice() == modemdevice->text(i))
+ if(_pppdata->modemDevice() == modemdevice->text(i))
modemdevice->setCurrentItem(i);
}
for(int i=0; i <= flowcontrol->count()-1; i++) {
- if(_ifaceppp->data()->flowcontrol() == flowcontrol->text(i))
+ if(_pppdata->flowcontrol() == flowcontrol->text(i))
flowcontrol->setCurrentItem(i);
}
//set the modem speed
for(int i=0; i < baud_c->count(); i++)
- if(baud_c->text(i) == _ifaceppp->data()->speed())
+ if(baud_c->text(i) == _pppdata->speed())
baud_c->setCurrentItem(i);
- tl->setRowStretch(7, 1);
+ tl->setRowStretch(1, 1);
}
+ModemWidget::~ModemWidget()
+{
+ QStringList devs;
-void ModemWidget::speed_selection(int) {
- _ifaceppp->data()->setSpeed(baud_c->text(baud_c->currentItem()));
-}
+ for (int i=0;i<modemdevice->count();i++)
+ {
+ QString s = modemdevice->text(i);
+ s.simplifyWhiteSpace();
+ if (! s.isEmpty() ) devs << s;
+ }
-void ModemWidget::setenter(int ) {
- _ifaceppp->data()->setEnter(enter->text(enter->currentItem()));
-}
+ QString edited = modemdevice->currentText();
+ if ( !( edited ).isEmpty() ) {
+ edited.simplifyWhiteSpace();
+ if ( devs.contains( edited ) == 0 ) {
+ devs << edited;
+ }
+ _pppdata->setModemDevice( edited );
+ }
+
+ Config cfg("NetworkSetupPPP");
+ cfg.setGroup("Devices_General");
+ cfg.writeEntry("devices",devs,',');
-void ModemWidget::setmodemdc(int i) {
- _ifaceppp->data()->setModemDevice(modemdevice->text(i));
}
+// void ModemWidget::speed_selection(int) {
+// _pppdata->setSpeed(baud_c->text(baud_c->currentItem()));
+// }
-void ModemWidget::setflowcontrol(int i) {
- _ifaceppp->data()->setFlowcontrol(flowcontrol->text(i));
-}
+// void ModemWidget::setenter(int ) {
+// _pppdata->setEnter(enter->text(enter->currentItem()));
+// }
-void ModemWidget::modemlockfilechanged(bool set) {
- _ifaceppp->data()->setModemLockFile(set);
-}
+// void ModemWidget::setmodemdc(int i) {
+// _pppdata->setModemDevice(modemdevice->text(i));
+// }
-void ModemWidget::modemtimeoutchanged(int n) {
- _ifaceppp->data()->setModemTimeout(n);
-}
+// void ModemWidget::setmodemdc( const QString &string ) {
+// _pppdata->setModemDevice( string );
+// }
+
+// void ModemWidget::setflowcontrol(int i) {
+// _pppdata->setFlowcontrol(flowcontrol->text(i));
+// }
-ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
+// void ModemWidget::modemlockfilechanged(bool set) {
+// _pppdata->setModemLockFile(set);
+// }
+
+
+// void ModemWidget::modemtimeoutchanged(int n) {
+// _pppdata->setModemTimeout(n);
+// }
+
+
+
+bool ModemWidget::save()
+{
+ //first check to make sure that the device name is unique!
+ if(modemname->text().isEmpty() ||
+ !_pppdata->isUniqueDevname(modemname->text()))
+ return false;
+
+ qDebug("ModemWidget::save saving modem1 data");
+ _pppdata->setDevname( modemname->text() );
+ _pppdata->setModemDevice( modemdevice->currentText() );
+ _pppdata->setFlowcontrol(flowcontrol->currentText());
+ _pppdata->setFlowcontrol(flowcontrol->currentText());
+ _pppdata->setSpeed(baud_c->currentText());
+ _pppdata->setModemLockFile( modemlockfile->isChecked());
+ _pppdata->setModemTimeout( modemtimeout->value() );
+ return true;
+
+}
+
+ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
const char *name)
- : QWidget(parent, name), _ifaceppp(ifp)
+ : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip)
{
QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
- waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
- waitfordt->setChecked(_ifaceppp->data()->waitForDialTone());
- connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
+ waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this);
+ waitfordt->setChecked(_pppdata->waitForDialTone());
+// connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
l1->addWidget(waitfordt);
QWhatsThis::add(waitfordt,
- i18n("<p>Normally the modem waits for a dial tone\n"
+ tr("<p>Normally the modem waits for a dial tone\n"
"from your phone line, indicating that it can\n"
"start to dial a number. If your modem does not\n"
"recognize this sound, or your local phone system\n"
@@ -296,16 +365,16 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" );
busywait = new QSpinBox( 0, 300, 5, this, "busyWait" );
// busywait = new KIntNumInput(_pppdata->busyWait(), this);
-// busywait->setLabel(i18n("B&usy wait:"));
+// busywait->setLabel(tr("B&usy wait:"));
// busywait->setRange(0, 300, 5, true);
- busywait->setSuffix(i18n(" sec"));
- connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
+ busywait->setSuffix(tr(" sec"));
+// connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
waitLayout->addWidget(waitLabel);
waitLayout->addWidget(busywait);
l1->addLayout( waitLayout );
QWhatsThis::add(busywait,
- i18n("Specifies the number of seconds to wait before\n"
+ tr("Specifies the number of seconds to wait before\n"
"redial if all dialed numbers are busy. This is\n"
"necessary because some modems get stuck if the\n"
"same number is busy too often.\n"
@@ -318,9 +387,9 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
QHBoxLayout *hbl = new QHBoxLayout;
hbl->setSpacing(2);//KDialog::spacingHint());
- QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);
+ QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this);
hbl->addWidget(volumeLabel);
- volume = new QSlider(0, 2, 1, _ifaceppp->data()->volume(),
+ volume = new QSlider(0, 2, 1, _pppdata->volume(),
QSlider::Horizontal, this);
volumeLabel->setBuddy(volume);
volume->setTickmarks(QSlider::Below);
@@ -328,9 +397,9 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
l1->addLayout(hbl);
- connect(volume, SIGNAL(valueChanged(int)),
- this, SLOT(volumeChanged(int)));
- QString tmp = i18n("Most modems have a speaker which makes\n"
+// connect(volume, SIGNAL(valueChanged(int)),
+// this, SLOT(volumeChanged(int)));
+ QString tmp = tr("Most modems have a speaker which makes\n"
"a lot of noise when dialing. Here you can\n"
"either turn this completely off or select a\n"
"lower volume.\n"
@@ -344,38 +413,38 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
l1->addSpacing(20);
#if 0
- chkbox1 = new QCheckBox(i18n("Modem asserts CD line"), this);
- chkbox1->setChecked(_ifaceppp->data()->UseCDLine());
+ chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this);
+ chkbox1->setChecked(_pppdata->UseCDLine());
connect(chkbox1,SIGNAL(toggled(bool)),
this,SLOT(use_cdline_toggled(bool)));
l12->addWidget(chkbox1);
l12->addStretch(1);
l1->addStretch(1);
QWhatsThis::add(chkbox1,
- i18n("This controls how <i>kppp</i> detects that the modem\n"
+ tr("This controls how <i>kppp</i> detects that the modem\n"
"is not responding. Unless you are having\n"
"problems with this, do not modify this setting.\n"
"\n"
"<b>Default</b>: Off"));
#endif
- modemcmds = new QPushButton(i18n("Mod&em Commands..."), this);
+ modemcmds = new QPushButton(tr("Mod&em Commands..."), this);
QWhatsThis::add(modemcmds,
- i18n("Allows you to change the AT command for\n"
+ tr("Allows you to change the AT command for\n"
"your modem."));
- modeminfo_button = new QPushButton(i18n("&Query Modem..."), this);
+ modeminfo_button = new QPushButton(tr("&Query Modem..."), this);
QWhatsThis::add(modeminfo_button,
- i18n("Most modems support the ATI command set to\n"
+ tr("Most modems support the ATI command set to\n"
"find out vendor and revision of your modem.\n"
"\n"
"Press this button to query your modem for\n"
"this information. It can be useful to help\n"
"you setup the modem"));
-// terminal_button = new QPushButton(i18n("&Terminal..."), this);
+// terminal_button = new QPushButton(tr("&Terminal..."), this);
// QWhatsThis::add(terminal_button,
-// i18n("Opens the built-in terminal program. You\n"
+// tr("Opens the built-in terminal program. You\n"
// "can use this if you want to play around\n"
// "with your modem's AT command set"));
@@ -402,7 +471,7 @@ ModemWidget2::ModemWidget2( InterfacePPP* ifp, QWidget *parent,
void ModemWidget2::modemcmdsbutton() {
- ModemCommands mc(_ifaceppp->data(), this);
+ ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp);
mc.showMaximized();
mc.exec();
}
@@ -420,22 +489,30 @@ void ModemWidget2::query_modem() {
// }
-#if 0
-void ModemWidget2::use_cdline_toggled(bool on) {
- _ifaceppp->data()->setUseCDLine(on);
-}
-#endif
+// #if 0
+// void ModemWidget2::use_cdline_toggled(bool on) {
+// _pppdata->setUseCDLine(on);
+// }
+// #endif
-void ModemWidget2::waitfordtchanged(bool b) {
- _ifaceppp->data()->setWaitForDialTone((int)b);
-}
+// void ModemWidget2::waitfordtchanged(bool b) {
+// _pppdata->setWaitForDialTone((int)b);
+// }
-void ModemWidget2::busywaitchanged(int n) {
- _ifaceppp->data()->setbusyWait(n);
-}
+// void ModemWidget2::busywaitchanged(int n) {
+// _pppdata->setbusyWait(n);
+// }
-void ModemWidget2::volumeChanged(int v) {
- _ifaceppp->data()->setVolume(v);
+// void ModemWidget2::volumeChanged(int v) {
+// _pppdata->setVolume(v);
+// }
+
+bool ModemWidget2::save()
+{
+ _pppdata->setWaitForDialTone(waitfordt->isChecked());
+ _pppdata->setbusyWait(busywait->value());
+ _pppdata->setVolume(volume->value());
+ return true;
}
diff --git a/noncore/settings/networksettings/ppp/general.h b/noncore/settings/networksettings/ppp/general.h
index 3e59b46..f43f241 100644
--- a/noncore/settings/networksettings/ppp/general.h
+++ b/noncore/settings/networksettings/ppp/general.h
@@ -36,19 +36,24 @@ class QCheckBox;
class QComboBox;
class PPPData;
class InterfacePPP;
+class QLineEdit;
class ModemWidget : public QWidget {
Q_OBJECT
public:
- ModemWidget( InterfacePPP*, QWidget *parent=0, const char *name=0 );
+ ModemWidget(PPPData*, QWidget *parent=0, const char *name=0 );
+ ~ModemWidget();
-private slots:
- void setmodemdc(int);
- void setflowcontrol(int);
- void modemtimeoutchanged(int);
- void modemlockfilechanged(bool);
- void setenter(int);
- void speed_selection(int);
+ bool save();
+
+/* private slots: */
+/* void setmodemdc(int); */
+/* void setmodemdc(const QString &); */
+/* void setflowcontrol(int); */
+/* void modemtimeoutchanged(int); */
+/* void modemlockfilechanged(bool); */
+/* void setenter(int); */
+/* void speed_selection(int); */
private:
QComboBox *enter;
@@ -56,6 +61,7 @@ private:
/* QLabel *label2; */
/* QLabel *labeltmp; */
/* QLabel *labelenter; */
+ QLineEdit *modemname;
QComboBox *modemdevice;
QComboBox *flowcontrol;
@@ -64,23 +70,24 @@ private:
QSpinBox *modemtimeout;
QCheckBox *modemlockfile;
- InterfacePPP *_ifaceppp;
+ PPPData *_pppdata;
};
class ModemWidget2 : public QWidget {
Q_OBJECT
public:
- ModemWidget2( InterfacePPP*, QWidget *parent=0, const char *name=0 );
+ ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 );
+ bool save();
private slots:
- void waitfordtchanged(bool);
- void busywaitchanged(int);
+/* void waitfordtchanged(bool); */
+/* void busywaitchanged(int); */
// void use_cdline_toggled(bool);
void modemcmdsbutton();
// void terminal();
void query_modem();
- void volumeChanged(int);
+ // void volumeChanged(int);
private:
QLabel *labeltmp;
@@ -92,6 +99,7 @@ private:
QSpinBox *busywait;
QCheckBox *chkbox1;
QSlider *volume;
+ PPPData *_pppdata;
InterfacePPP *_ifaceppp;
};
diff --git a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
index 553daa2..6b158b9 100644
--- a/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceinformationppp.cpp
@@ -1,9 +1,7 @@
#include "interfaceinformationppp.h"
-
#include <qpushbutton.h>
#include <qlabel.h>
-//#include <qgroupbox.h>
#include <qmessagebox.h>
#include <qabstractlayout.h>
@@ -20,17 +18,23 @@
* just display's information about the interface that is passed to it.
*/
InterfaceInformationPPP::InterfaceInformationPPP(QWidget *parent, const char *name, Interface *i, WFlags f)
- :InterfaceInformationImp(parent, name, i, f)
+ :InterfaceInformationImp(parent, name, i, Qt::WStyle_ContextHelp)
{
- qDebug("InterfaceInformationPPP::InterfaceInformationPPP");
+ qDebug("InterfaceInformationPPP::InterfaceInformationPPP %s", name);
con = new ConnectWidget( (InterfacePPP*)i, this, "con" );
con->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Fixed) );
- QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
- InterfaceInformationLayout->addItem( spacer, 7, 0 );
- InterfaceInformationLayout->addMultiCellWidget( con, 8, 8, 0, 1 );
- // InterfaceInformationLayout->addWidget( con, 7, 0 );
+
+ macAddressLabel->hide();
+ subnetMaskLabel->hide();
+ broadcastLabel->hide();
+ TextLabel23->hide();
+ TextLabel21->hide();
+ TextLabel24->hide();
+
+ InterfaceInformationLayout->addWidget( con, 1, 0 );
connect(i, SIGNAL(begin_connect()),con, SLOT(preinit()));
+ connect(i, SIGNAL(hangup_now() ), con, SLOT(cancelbutton() ) );
}
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.cpp b/noncore/settings/networksettings/ppp/interfaceppp.cpp
index 9ec30bc..f443f3c 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.cpp
+++ b/noncore/settings/networksettings/ppp/interfaceppp.cpp
@@ -1,6 +1,8 @@
#include <qmessagebox.h>
-#define i18n QObject::tr
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qlabel.h>
#include "auth.h"
#include "interfaceppp.h"
@@ -15,18 +17,18 @@ InterfacePPP::InterfacePPP(QObject *parent, const char *name, bool status)
qDebug("InterfacePPP::InterfacePPP(");
}
-PPPData* InterfacePPP::data()
+PPPData* InterfacePPP::data()const
{
if (!_dataPtr){
qDebug("creating new Data obj");
_dataPtr = new PPPData();
- _dataPtr->setModemDevice( getInterfaceName() );
+ _dataPtr->setDevice( getInterfaceName() );
_dataPtr->setAccount( getHardwareName() );
}
return _dataPtr;
}
-Modem* InterfacePPP::modem()
+Modem* InterfacePPP::modem()const
{
if (!_modemPtr){
qDebug("creating new modem obj");
@@ -38,27 +40,42 @@ Modem* InterfacePPP::modem()
bool InterfacePPP::refresh()
{
qDebug("InterfacePPP::refresh()");
- updateInterface(this);
- QMessageBox::information(0,"Not Implemented","This feature is not yet implemneted... ;-(");
- return false;
+ QString old = getInterfaceName();
+ setInterfaceName( modem()->pppDevice() );
+
+ (void)Interface::refresh();
+
+ setInterfaceName( old );
+ emit updateInterface(this);
+
+ return true;
}
void InterfacePPP::start()
{
qDebug("InterfacePPP::start");
-// should work...
-// if (data()->password().isEmpty() ){
-// //FIXME: ask for password
-// qDebug("using dummy password");
-// QMessageBox::critical( 0, "no password", "you should be prompted for a password, but you are not! ;-)");
-// }
+ if (data()->password().isEmpty() && !data()->storedUsername().isEmpty() ) {
+
+ QDialog mb( 0, "Dialog", true );
+ mb.setCaption( tr( "No password" ) );
+ QVBoxLayout layout( &mb );
+ QLabel text ( &mb );
+ text.setText( tr("Username defined but no password\n Please enter a password") );
+ QLineEdit lineedit( &mb );
+ lineedit.setEchoMode( QLineEdit::Password );
+ layout.addWidget( &text );
+ layout.addWidget( &lineedit );
+ if ( mb.exec() == QDialog::Accepted ) {
+ data()->setPassword( lineedit.text() );
+ }
+ }
QFileInfo info(pppdPath());
if(!info.exists()){
QMessageBox::warning(0, tr("Error"),
- i18n("<qt>Cannot find the PPP daemon!<br>"
+ QObject::tr("<qt>Cannot find the PPP daemon!<br>"
"Make sure that pppd is installed and "
"that you have entered the correct path.</qt>"));
return;
@@ -67,7 +84,7 @@ void InterfacePPP::start()
if(!info.isExecutable()){
QString string;
- string = i18n( "<qt>Cannot execute:<br> %1<br>"
+ string = QObject::tr( "<qt>Cannot execute:<br> %1<br>"
"Please make sure that you have given "
"setuid permission and that "
"pppd is executable.<br>").arg(pppdPath());
@@ -81,7 +98,7 @@ void InterfacePPP::start()
if(!info2.exists()){
QString string;
- string = i18n( "<qt>Cannot find:<br> %1<br>"
+ string = QObject::tr( "<qt>Cannot find:<br> %1<br>"
"Please make sure you have setup "
"your modem device properly "
"and/or adjust the location of the modem device on "
@@ -98,7 +115,7 @@ void InterfacePPP::start()
data()->authMethod() == AUTH_PAPCHAP ) {
if(false){ //FIXME: ID_Edit->text().isEmpty()) {
QMessageBox::warning(0,tr("Error"),
- i18n("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>"));
+ QObject::tr("<qt>You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!</qt>"));
// FIXME: return;
} else {
if(!modem()->setSecret(data()->authMethod(),
@@ -106,7 +123,7 @@ void InterfacePPP::start()
PPPData::encodeWord(data()->password()))
) {
QString s;
- s = i18n("<qt>Cannot create PAP/CHAP authentication<br>"
+ s = QObject::tr("<qt>Cannot create PAP/CHAP authentication<br>"
"file \"%1\"</qt>").arg(PAP_AUTH_FILE);
QMessageBox::warning(0, tr("Error"), s);
return;
@@ -115,7 +132,7 @@ void InterfacePPP::start()
}
if (data()->phonenumber().isEmpty()) {
- QString s = i18n("You must specify a telephone number!");
+ QString s = QObject::tr("You must specify a telephone number!");
QMessageBox::warning(0, tr("Error"), s);
return;
}
@@ -132,6 +149,11 @@ void InterfacePPP::start()
void InterfacePPP::stop()
{
qDebug("InterfacePPP::stop");
+ // emit hangup_now();
+ status = false; // not connected
+ setStatus( false );
+ emit hangup_now();
+ refresh();
}
@@ -140,3 +162,13 @@ void InterfacePPP::save()
data()->save();
emit updateInterface((Interface*) this);
}
+QString InterfacePPP::pppDev()const {
+ return modem()->pppDevice();
+}
+pid_t InterfacePPP::pppPID()const{
+ return modem()->pppPID();
+}
+void InterfacePPP::setPPPDpid( pid_t pid) {
+ setStatus( true );
+ modem()->setPPPDPid( pid );
+}
diff --git a/noncore/settings/networksettings/ppp/interfaceppp.h b/noncore/settings/networksettings/ppp/interfaceppp.h
index 6eb6a69..39495c2 100644
--- a/noncore/settings/networksettings/ppp/interfaceppp.h
+++ b/noncore/settings/networksettings/ppp/interfaceppp.h
@@ -1,6 +1,8 @@
-#ifndef INTERFACEPPP_H
+#ifndef INTERFACEPPP_H
#define INTERFACEPPP_H
+#include <sys/types.h>
+
#include "interface.h"
class PPPData;
@@ -13,21 +15,25 @@ class InterfacePPP : public Interface
public:
InterfacePPP(QObject *parent=0, const char *name="PPP", bool status=false);
- PPPData* data();
- Modem* modem();
+ PPPData* data()const;
+ Modem* modem()const;
+ QString pppDev()const; // returns the ppp device.... /dev/ppp0...
+ pid_t pppPID()const;
signals:
void begin_connect();
+ void hangup_now();
public slots:
virtual bool refresh();
virtual void start();
virtual void stop();
void save();
+ void setPPPDpid( pid_t ); // sets the pppd pid for modem...
private:
- Modem *_modemPtr;
- PPPData *_dataPtr;
+ mutable Modem *_modemPtr;
+ mutable PPPData *_dataPtr;
};
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index 7b5c74d..e466358 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -42,19 +42,8 @@
// #include <kaboutdata.h>
// #include <kapplication.h>
#include <qbuttongroup.h>
-//#include <kcmdlineargs.h>
-//#include <kconfig.h>
-//#include <kdebug.h>
-#define i18n QObject::tr
-//#include <kiconloader.h> // For BarIcon
-//#include <klocale.h>
#include <qmessagebox.h>
-// #include <kseparator.h>
-// #include <kstandarddirs.h>
-// #include <kwin.h>
-// #include <khelpmenu.h>
#include <qpushbutton.h>
-//#include <kguiitem.h>
#include <stdlib.h>
#include <errno.h>
@@ -78,7 +67,7 @@
KPPPWidget *p_kppp = 0;
KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *name, bool modal, WFlags fl )
- : QDialog(parent, name, modal, fl), _pppdata(pd)
+ : QDialog(parent, name, modal, Qt::WStyle_ContextHelp ), _pppdata(pd)
{
// tabWindow = 0;
p_kppp = this;
@@ -108,7 +97,7 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
l1->setColStretch(1, 3);
l1->setColStretch(2, 4);
- label1 = new QLabel(i18n("C&onnect to: "), this);
+ label1 = new QLabel(QObject::tr("C&onnect to: "), this);
l1->addWidget(label1, 0, 1);
connectto_c = new QComboBox(false, this);
@@ -118,7 +107,7 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
SLOT(newdefaultaccount(int)));
l1->addWidget(connectto_c, 0, 2);
- ID_Label = new QLabel(i18n("&Login ID:"), this);
+ ID_Label = new QLabel(QObject::tr("&Login ID:"), this);
l1->addWidget(ID_Label, 1, 1);
// the entry line for usernames
@@ -127,7 +116,7 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
l1->addWidget(ID_Edit, 1, 2);
connect(ID_Edit, SIGNAL(returnPressed()),
this, SLOT(enterPressedInID()));
- QString tmp = i18n("<p>Type in the username that you got from your\n"
+ QString tmp = QObject::tr("<p>Type in the username that you got from your\n"
"ISP. This is especially important for PAP\n"
"and CHAP. You may omit this when you use\n"
"terminal-based or script-based authentication.\n"
@@ -138,7 +127,7 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
QWhatsThis::add(ID_Label,tmp);
QWhatsThis::add(ID_Edit,tmp);
- PW_Label = new QLabel(i18n("&Password:"), this);
+ PW_Label = new QLabel(QObject::tr("&Password:"), this);
l1->addWidget(PW_Label, 2, 1);
PW_Edit= new QLineEdit(this);
@@ -148,7 +137,7 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
connect(PW_Edit, SIGNAL(returnPressed()),
this, SLOT(enterPressedInPW()));
- tmp = i18n("<p>Type in the password that you got from your\n"
+ tmp = QObject::tr("<p>Type in the password that you got from your\n"
"ISP. This is especially important for PAP\n"
"and CHAP. You may omit this when you use\n"
"terminal-based or script-based authentication.\n"
@@ -164,14 +153,14 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
tl->addLayout(l3);
tl->addSpacing(5);
l3->addSpacing(10);
- log = new QCheckBox(i18n("Show lo&g window"), this);
+ log = new QCheckBox(QObject::tr("Show lo&g window"), this);
connect(log, SIGNAL(toggled(bool)),
this, SLOT(log_window_toggled(bool)));
log->setChecked(_pppdata->get_show_log_window());
l3->addWidget(log);
QWhatsThis::add(log,
- i18n("<p>This controls whether a log window is shown.\n"
+ QObject::tr("<p>This controls whether a log window is shown.\n"
"A log window shows the communication between\n"
"<i>kppp</i> and your modem. This will help you\n"
"in tracking down problems.\n"
@@ -186,14 +175,14 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
tl->addLayout(l2);
int minw = 0;
- quit_b = new QPushButton(i18n("&Quit"), this);
- // quit_b-> setGuiItem (KGuiItem(i18n("&Quit"), "exit" ) );
+ quit_b = new QPushButton(QObject::tr("&Quit"), this);
+ // quit_b-> setGuiItem (KGuiItem(QObject::tr("&Quit"), "exit" ) );
connect( quit_b, SIGNAL(clicked()), SLOT(quitbutton()));
if(quit_b->sizeHint().width() > minw)
minw = quit_b->sizeHint().width();
- setup_b = new QPushButton(i18n("&Setup..."), this);
-// setup_b->setGuiItem (KGuiItem(i18n("&Setup...")) );
+ setup_b = new QPushButton(QObject::tr("&Setup..."), this);
+// setup_b->setGuiItem (KGuiItem(QObject::tr("&Setup...")) );
connect( setup_b, SIGNAL(clicked()), SLOT(expandbutton()));
if(setup_b->sizeHint().width() > minw)
minw = setup_b->sizeHint().width();
@@ -203,17 +192,17 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
// if(_pppdata->access() != KConfig::ReadWrite)
// setup_b->setEnabled(false);
-// help_b = new QPushButton(i18n("&Help"), this);
+// help_b = new QPushButton(QObject::tr("&Help"), this);
// connect( help_b, SIGNAL(clicked()), SLOT(helpbutton()));
// KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true);
// help_b->setPopup((QPopupMenu*)helpMenu->menu());
-// help_b->setGuiItem (KGuiItem(i18n("&Help"), "help" ) );
+// help_b->setGuiItem (KGuiItem(QObject::tr("&Help"), "help" ) );
// if(help_b->sizeHint().width() > minw)
// minw = help_b->sizeHint().width();
- connect_b = new QPushButton(i18n("&Connect"), this);
+ connect_b = new QPushButton(QObject::tr("&Connect"), this);
connect_b->setDefault(true);
connect_b->setFocus();
connect(connect_b, SIGNAL(clicked()), SLOT(beginConnect()));
@@ -286,7 +275,7 @@ KPPPWidget::KPPPWidget(PPPData*pd, Interface *i, QWidget *parent, const char *na
// bool result = _pppdata->setAccount(m_strCmdlAccount);
// if (!result){
// QString string;
-// string = i18n("No such Account:\n%1").arg(m_strCmdlAccount);
+// string = QObject::tr("No such Account:\n%1").arg(m_strCmdlAccount);
// KMessageBox::error(this, string);
// m_bCmdlAccount = false;
// this->show();
@@ -482,21 +471,21 @@ void KPPPWidget::sigPPPDDied() {
// // not in a signal handler !!! KNotifyClient::beep();
QString msg;
if (_pppdata->pppdError() == E_IF_TIMEOUT)
- msg = i18n("Timeout expired while waiting for the PPP interface "
+ msg = QObject::tr("Timeout expired while waiting for the PPP interface "
"to come up!");
else {
- msg = i18n("<p>The pppd daemon died unexpectedly!</p>");
+ msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>");
Modem::modem->pppdExitStatus();
if (Modem::modem->lastStatus != 99) { // more recent pppds only
- msg += i18n("<p>Exit status: %1").arg(Modem::modem->lastStatus);
- msg += i18n("</p><p>See 'man pppd' for an explanation of the error "
+ msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
+ msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
"codes or take a look at the kppp FAQ on "
" <a href=http://devel-home.kde.org/~kppp/index.html>"
"http://devel-home.kde.org/~kppp/index.html</a></p>");
}
}
-// if(QMessageBox::warning(0, msg, i18n("Error"), i18n("&OK"), i18n("&Details...")) == QMessageBox::No)
+// if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
// // PPPL_ShowLog();
// } else { /* reconnect on disconnect */
if (false){
@@ -527,7 +516,7 @@ void KPPPWidget::sigPPPDDied() {
// // if(id == helperPid && helperPid != -1) {
// // kdDebug(5002) << "It was the setuid child that died" << endl;
// // helperPid = -1;
-// QString msg = i18n("kppp's helper process just died.\n"
+// QString msg = QObject::tr("kppp's helper process just died.\n"
// "Since a further execution would be pointless, "
// "kppp will shut down now.");
// QMessageBox::warning(0L,"error", msg);
@@ -560,7 +549,7 @@ void KPPPWidget::beginConnect() {
QFileInfo info(pppdPath());
if(!info.exists()){
- QMessageBox::warning(this, "error", i18n("Cannot find the PPP daemon!\n"
+ QMessageBox::warning(this, "error", QObject::tr("Cannot find the PPP daemon!\n"
"Make sure that pppd is installed and "
"that you have entered the correct path."));
return;
@@ -569,7 +558,7 @@ void KPPPWidget::beginConnect() {
if(!info.isExecutable()){
QString string;
- string = i18n("kppp cannot execute:\n %1\n"
+ string = QObject::tr("kppp cannot execute:\n %1\n"
"Please make sure that you have given kppp "
"setuid permission and that "
"pppd is executable.").arg(_pppdata->pppdPath());
@@ -583,7 +572,7 @@ void KPPPWidget::beginConnect() {
if(!info2.exists()){
QString string;
- string = i18n("kppp can not find:\n %1\nPlease make sure you have setup "
+ string = QObject::tr("kppp can not find:\n %1\nPlease make sure you have setup "
"your modem device properly "
"and/or adjust the location of the modem device on "
"the modem tab of "
@@ -599,14 +588,14 @@ void KPPPWidget::beginConnect() {
_pppdata->authMethod() == AUTH_PAPCHAP ) {
if(ID_Edit->text().isEmpty()) {
QMessageBox::warning(this,"error",
- i18n("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
+ QObject::tr("You have selected the authentication method PAP or CHAP. This requires that you supply a username and a password!"));
return;
} else {
if(!Modem::modem->setSecret(_pppdata->authMethod(),
encodeWord(_pppdata->storedUsername()),
encodeWord(_pppdata->password()))) {
QString s;
- s = i18n("Cannot create PAP/CHAP authentication\n"
+ s = QObject::tr("Cannot create PAP/CHAP authentication\n"
"file \"%1\"").arg(PAP_AUTH_FILE);
QMessageBox::warning(this, "error", s);
return;
@@ -615,14 +604,14 @@ void KPPPWidget::beginConnect() {
}
if (_pppdata->phonenumber().isEmpty()) {
- QString s = i18n("You must specify a telephone number!");
+ QString s = QObject::tr("You must specify a telephone number!");
QMessageBox::warning(this, "error", s);
return;
}
this->hide();
- QString tit = i18n("Connecting to: %1").arg(_pppdata->accname());
+ QString tit = QObject::tr("Connecting to: %1").arg(_pppdata->accname());
// con->setCaption(tit);
// con->show();
@@ -636,8 +625,8 @@ void KPPPWidget::disconnect() {
if (!_pppdata->command_before_disconnect().isEmpty()) {
con_win->hide();
con->show();
- con->setCaption(i18n("Disconnecting..."));
- con->setMsg(i18n("Executing command before disconnection."));
+ con->setCaption(QObject::tr("Disconnecting..."));
+ con->setMsg(QObject::tr("Executing command before disconnection."));
qApp->processEvents();
QApplication::flushX();
@@ -692,8 +681,8 @@ void KPPPWidget::disconnect() {
void KPPPWidget::quitbutton() {
if(_pppdata->pppdRunning()) {
int ok = QMessageBox::warning(this,
- i18n("Exiting kPPP will close your PPP Session."),
- i18n("Quit kPPP?"));
+ QObject::tr("Exiting kPPP will close your PPP Session."),
+ QObject::tr("Quit kPPP?"));
if(ok == QMessageBox::Yes) {
Modem::modem->killPPPDaemon();
QApplication::flushX();
@@ -736,7 +725,7 @@ void KPPPWidget::quitbutton() {
// con_win, SLOT(slotAccounting(QString, QString)));
// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
-// // QString s= i18n("Can not load the accounting "
+// // QString s= QObject::tr("Can not load the accounting "
// // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
// // starting the messagebox with a timer will prevent us
@@ -826,7 +815,7 @@ void KPPPWidget::showNews() {
#define QUICKHELP_HINT "Hint_QuickHelp"
if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
QDialog dlg(0, 0, true);
- dlg.setCaption(i18n("Recent Changes in KPPP"));
+ dlg.setCaption(QObject::tr("Recent Changes in KPPP"));
QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
QHBoxLayout *l1 = new QHBoxLayout(10);
@@ -839,7 +828,7 @@ void KPPPWidget::showNews() {
l1->addWidget(icon);
l1->addLayout(l2);
- QLabel *l = new QLabel(i18n("From version 1.4.8 on, kppp has a new feature\n"
+ QLabel *l = new QLabel(QObject::tr("From version 1.4.8 on, kppp has a new feature\n"
"called \"Quickhelp\". It's similar to a tooltip,\n"
"but you can activate it whenever you want.\n"
"\n"
@@ -851,12 +840,12 @@ void KPPPWidget::showNews() {
"To test it, right-click somewhere in this text."),
&dlg);
- QCheckBox *cb = new QCheckBox(i18n("Don't show this hint again"), &dlg);
+ QCheckBox *cb = new QCheckBox(QObject::tr("Don't show this hint again"), &dlg);
cb->setFixedSize(cb->sizeHint());
KButtonBox *bbox = new KButtonBox(&dlg);
bbox->addStretch(1);
- QPushButton *ok = bbox->addButton(i18n("OK"));
+ QPushButton *ok = bbox->addButton(QObject::tr("OK"));
ok->setDefault(true);
dlg.connect(ok, SIGNAL(clicked()),
&dlg, SLOT(accept()));
@@ -867,7 +856,7 @@ void KPPPWidget::showNews() {
l2->addWidget(cb);
tl->addWidget(bbox);
- QString tmp = i18n("This is an example of <b>QuickHelp</b>.\n"
+ QString tmp = QObject::tr("This is an example of <b>QuickHelp</b>.\n"
"This window will stay open until you\n"
"click a mouse button or a press a key.\n");
diff --git a/noncore/settings/networksettings/ppp/modem.cpp b/noncore/settings/networksettings/ppp/modem.cpp
index d23fee4..3dbc8c3 100644
--- a/noncore/settings/networksettings/ppp/modem.cpp
+++ b/noncore/settings/networksettings/ppp/modem.cpp
@@ -51,11 +51,8 @@
#include "auth.h"
#include "modem.h"
#include "pppdata.h"
-//#include <klocale.h>
-#define i18n QObject::tr
#define qError qDebug
-//#include <kdebug.h>
-//#include <config.h>
+
#define MY_ASSERT(x) if (!(x)) { \
qFatal( "ASSERT: \"%s\" in %s (%d)\n",#x,__FILE__,__LINE__); \
@@ -99,7 +96,7 @@ Modem::Modem( PPPData* pd )
modemfd = -1;
_pppdExitStatus = -1;
pppdPid = -1;
- sn = 0L;
+ sn = m_modemDebug = 0L;
data_mode = false;
modem_is_locked = false;
lockfile[0] = '\0';
@@ -169,7 +166,7 @@ bool Modem::opentty() {
device = _pppdata->modemDevice();
if ((modemfd = open(device, O_RDWR|O_NDELAY|O_NOCTTY)) == -1) {
qDebug("error opening modem device !");
- errmsg = i18n("Unable to open modem.");
+ errmsg = QObject::tr("Unable to open modem.");
return false;
}
//bend if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
@@ -178,13 +175,13 @@ bool Modem::opentty() {
#if 0
if(_pppdata->UseCDLine()) {
if(ioctl(modemfd, TIOCMGET, &flags) == -1) {
- errmsg = i18n("Unable to detect state of CD line.");
+ errmsg = QObject::tr("Unable to detect state of CD line.");
::close(modemfd);
modemfd = -1;
return false;
}
if ((flags&TIOCM_CD) == 0) {
- errmsg = i18n("The modem is not ready.");
+ errmsg = QObject::tr("The modem is not ready.");
::close(modemfd);
modemfd = -1;
return false;
@@ -200,7 +197,7 @@ bool Modem::opentty() {
tcsendbreak(modemfd, 0);
sleep(1);
if(tcgetattr(modemfd, &tty) < 0){
- errmsg = i18n("The modem is busy.");
+ errmsg = QObject::tr("The modem is busy.");
::close(modemfd);
modemfd = -1;
return false;
@@ -245,13 +242,13 @@ bool Modem::opentty() {
tcdrain(modemfd);
if(tcsetattr(modemfd, TCSANOW, &tty) < 0){
- errmsg = i18n("The modem is busy.");
+ errmsg = QObject::tr("The modem is busy.");
::close(modemfd);
modemfd=-1;
return false;
}
- errmsg = i18n("Modem Ready.");
+ errmsg = QObject::tr("Modem Ready.");
return true;
}
@@ -263,7 +260,7 @@ bool Modem::closetty() {
tcflush(modemfd, TCIOFLUSH);
if(tcsetattr(modemfd, TCSANOW, &initial_tty) < 0){
- errmsg = i18n("Can't restore tty settings: tcsetattr()\n");
+ errmsg = QObject::tr("Can't restore tty settings: tcsetattr()\n");
::close(modemfd);
modemfd = -1;
return false;
@@ -413,7 +410,7 @@ bool Modem::hangup() {
closetty();
close(modemfd);
modemfd = -1;
- errmsg = i18n("The modem does not respond.");
+ errmsg = QObject::tr("The modem does not respond.");
return false;
}
@@ -555,7 +552,7 @@ QString Modem::parseModemSpeed(const QString &s) {
}
if(rx == -1 && tx == -1)
- result = i18n("Unknown speed");
+ result = QObject::tr("Unknown speed");
else if(tx == -1)
result.setNum(rx);
else if(rx == -1) // should not happen
@@ -877,10 +874,14 @@ bool Modem::execpppd(const char *arguments) {
_pppdExitStatus = -1;
+ (void)::pipe( m_pppdLOG );
+
switch(pppdPid = fork())
{
case -1:
fprintf(stderr,"In parent: fork() failed\n");
+ ::close( m_pppdLOG[0] );
+ ::close( m_pppdLOG[1] );
return false;
break;
@@ -902,9 +903,13 @@ bool Modem::execpppd(const char *arguments) {
if(tcsetpgrp(modemfd, pgrpid)<0)
fprintf(stderr, "tcsetpgrp() failed.\n");
+ ::close( m_pppdLOG[0] );
+ ::setenv( "LANG", "C", 1 ); // overwrite
+ dup2(m_pppdLOG[1], 11 ); // for logfd 11
dup2(modemfd, 0);
dup2(modemfd, 1);
+
switch (checkForInterface()) {
case 1:
fprintf(stderr, "Cannot determine if kernel supports ppp.\n");
@@ -924,7 +929,24 @@ bool Modem::execpppd(const char *arguments) {
default:
qDebug("In parent: pppd pid %d\n",pppdPid);
close(modemfd);
+
+ ::close( m_pppdLOG[1] );
+ // set it to nonblocking io
+ int flag = ::fcntl( m_pppdLOG[0], F_GETFL );
+
+ if ( !(flag & O_NONBLOCK) ) {
+ qDebug("Setting nonblocking io");
+ flag |= O_NONBLOCK;
+ ::fcntl(m_pppdLOG[0], F_SETFL, flag );
+ }
+
+ delete m_modemDebug;
+ m_modemDebug = new QSocketNotifier(m_pppdLOG[0], QSocketNotifier::Read, this );
+ connect(m_modemDebug, SIGNAL(activated(int) ),
+ this, SLOT(slotModemDebug(int) ) );
+
modemfd = -1;
+ m_pppdDev = QString::fromLatin1("ppp0");
return true;
break;
}
@@ -932,7 +954,10 @@ bool Modem::execpppd(const char *arguments) {
bool Modem::killpppd() {
+ qDebug("In killpppd and pid is %d", pppdPid );
if(pppdPid > 0) {
+ delete m_modemDebug;
+ m_modemDebug = 0;
qDebug("In killpppd(): Sending SIGTERM to %d\n", pppdPid);
if(kill(pppdPid, SIGTERM) < 0) {
qDebug("Error terminating %d. Sending SIGKILL\n", pppdPid);
@@ -1021,3 +1046,35 @@ bool Modem::setHostname(const QString & name)
return sethostname(name, name.length()) == 0;
}
+QString Modem::pppDevice()const {
+ return m_pppdDev;
+}
+void Modem::setPPPDevice( const QString& dev ) {
+ m_pppdDev = dev;
+}
+pid_t Modem::pppPID()const {
+ return pppdPid;
+}
+void Modem::setPPPDPid( pid_t pid ) {
+ qDebug("Modem setting pid");
+ _pppdExitStatus = -1;
+ pppdPid = pid;
+ modemfd = -1;
+}
+void Modem::slotModemDebug(int fd) {
+ char buf[2049];
+ int len;
+
+ // read in pppd data look for Using interface
+ // then read the interface
+ // we limit to 10 device now 0-9
+ if((len = ::read(fd, buf, 2048)) > 0) {
+ buf[len+1] = '\0';
+ char *found;
+ if ( (found = ::strstr(buf, "Using interface ") ) ) {
+ found += 16;
+ m_pppdDev = QString::fromLatin1(found, 5 );
+ m_pppdDev = m_pppdDev.simplifyWhiteSpace();
+ }
+ }
+}
diff --git a/noncore/settings/networksettings/ppp/modem.h b/noncore/settings/networksettings/ppp/modem.h
index 103cbeb..8ecc354 100644
--- a/noncore/settings/networksettings/ppp/modem.h
+++ b/noncore/settings/networksettings/ppp/modem.h
@@ -5,7 +5,7 @@
*
* Copyright (C) 1997 Bernd Johannes Wuebben
* wuebben@math.cornell.edu
- *
+ *
* This file was added by Harri Porten <porten@tu-harburg.de>
*
*
@@ -47,7 +47,9 @@ public:
~Modem();
const QString getDevice() {return device;};
- void setDevice(const QString dev) {device = dev;};
+ void setDevice(const QString dev) {device = dev;};
+
+ void save();
bool opentty();
bool closetty();
@@ -56,7 +58,7 @@ public:
bool writeLine(const char *);
bool dataMode() const { return data_mode; }
void setDataMode(bool set) { data_mode = set; }
- const QString modemMessage();
+ const QString modemMessage();
speed_t modemspeed();
static QString parseModemSpeed(const QString &);
void notify(const QObject *, const char *);
@@ -73,7 +75,12 @@ public:
bool execPPPDaemon(const QString & arguments);
int openResolv(int flags);
bool setHostname(const QString & name);
-
+
+ QString pppDevice()const;
+ void setPPPDevice( const QString& );
+ pid_t pppPID()const;
+ void setPPPDPid( pid_t );
+
public:
enum Auth { PAP = 1, CHAP };
// static Modem *modem;
@@ -85,7 +92,8 @@ signals:
private slots:
void startNotifier();
void stopNotifier();
- void readtty(int);
+ void readtty(int);
+ void slotModemDebug(int);
private:
enum { MaxPathLen = 30, MaxStrLen = 40, MaxArgs = 100 };
@@ -102,17 +110,20 @@ private:
private:
QString device;
- QString lockfile;
+ QString lockfile;
int modemfd;
int pppdPid;
int _pppdExitStatus;
QSocketNotifier *sn;
+ QSocketNotifier *m_modemDebug;
bool data_mode;
QString errmsg;
struct termios initial_tty;
struct termios tty;
bool modem_is_locked;
PPPData *_pppdata;
+ int m_pppdLOG[2];
+ QString m_pppdDev;
};
#endif
diff --git a/noncore/settings/networksettings/ppp/modemcmds.cpp b/noncore/settings/networksettings/ppp/modemcmds.cpp
index 1d9db6e..e797795 100644
--- a/noncore/settings/networksettings/ppp/modemcmds.cpp
+++ b/noncore/settings/networksettings/ppp/modemcmds.cpp
@@ -27,57 +27,67 @@
#include <qlayout.h>
#include <qslider.h>
#include <qbuttongroup.h>
+#include <qscrollview.h>
+#include <qapplication.h>
#include <stdlib.h>
-//#include <kapplication.h> // for getMiniIcon()
-//#include <klocale.h>
-#define i18n QObject::tr
#include "modemcmds.h"
#include "pppdata.h"
-//#include <kwin.h>
#define ADJUSTEDIT(e) //e->setText("XXXXXXXXqy"); e->setMinimumSize(e->sizeHint()); /*e->setFixedHeight(e->sizeHint().height());*/ e->setText(""); e->setMaxLength(MODEMSTR_SIZE);
// a little trick to make the label look like a disabled lineedit
#define FORMATSLIDERLABEL(l) //l->setFixedWidth(l->sizeHint().width()); l->setFixedHeight(QLineEdit(dummyWidget).sizeHint().height()); l->setAlignment(AlignCenter); l->setFrameStyle(QFrame::WinPanel|QFrame::Sunken); l->setLineWidth(2);
-ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name)
- : QDialog(parent, name, true ), _pppdata(pd)
+ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name , bool modal, WFlags f)
+ : QDialog( parent, name, modal, f ), _pppdata(pd)
{
- setCaption(i18n("Edit Modem Commands"));
+ setCaption(QObject::tr("Edit Modem Commands"));
const int GRIDROWS = 22;
int row = 0;
+ QVBoxLayout *main = new QVBoxLayout( this );
+ QScrollView *sv = new QScrollView( this );
+ QWidget *mainW = new QWidget( sv->viewport() );
+ sv->setResizePolicy( QScrollView::AutoOneFit );
+ sv->setHScrollBarMode( QScrollView::AlwaysOff );
+ sv->setFrameShape( QFrame::NoFrame );
+ sv->addChild( mainW );
+ main->addWidget( sv );
+ // evil hack
+ mainW->setMaximumWidth( QApplication::desktop()->width() - 10 );
+
// toplevel layout
- QVBoxLayout *tl = new QVBoxLayout(this, 10, 4);
+ QVBoxLayout *tl = new QVBoxLayout( mainW, 10, 4);
// add grid + frame
QGridLayout *l1 = new QGridLayout(GRIDROWS, 4);
tl->addLayout(l1);
- box = new QGroupBox(this, "box");
+ box = new QGroupBox(mainW, "box");
+ box->setMargin( 0 );
l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3);
// put slider and label into a separate H-Box
QHBoxLayout *l2 = new QHBoxLayout;
l1->addLayout(l2, row, 2);
- lpreinitslider = new QLabel("MMMM", this);
+ lpreinitslider = new QLabel("MMMM", mainW);
FORMATSLIDERLABEL(lpreinitslider);
QSlider *preinitslider = new QSlider(0, 300, 1, 0,
- QSlider::Horizontal, this);
+ QSlider::Horizontal, mainW);
// preinitslider->setFixedHeight(preinitslider->sizeHint().height());
connect(preinitslider, SIGNAL(valueChanged(int)),
lpreinitslider, SLOT(setNum(int)));
l2->addWidget(lpreinitslider, 0);
l2->addWidget(preinitslider, 1);
- lpreinit = new QLabel(i18n("Pre-init delay (sec/100):"), this);
+ lpreinit = new QLabel(QObject::tr("Pre-init delay (sec/100):"), mainW);
l1->addWidget(lpreinit, row++, 1);
for(int i = 0; i < PPPData::NumInitStrings; i++) {
- initstr[i] = new QLineEdit(this);
- QLabel *initLabel = new QLabel(i18n("Initialization string %1:").arg(i + 1),
- this);
+ initstr[i] = new QLineEdit(mainW);
+ QLabel *initLabel = new QLabel(QObject::tr("Initialization string %1:").arg(i + 1),
+ mainW);
ADJUSTEDIT(initstr[i]);
l1->addWidget(initLabel, row, 1);
l1->addWidget(initstr[i], row++, 2);
@@ -85,147 +95,147 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name)
QHBoxLayout *l3 = new QHBoxLayout;
l1->addLayout(l3, row, 2);
- linitslider = new QLabel("MMMM", this);
+ linitslider = new QLabel("MMMM", mainW);
FORMATSLIDERLABEL(linitslider);
QSlider *initslider = new QSlider(1, 300, 1, 0,
- QSlider::Horizontal, this);
+ QSlider::Horizontal, mainW);
// initslider->setFixedHeight(initslider->sizeHint().height());
connect(initslider, SIGNAL(valueChanged(int)),
linitslider, SLOT(setNum(int)));
l3->addWidget(linitslider, 0);
l3->addWidget(initslider, 1);
- label3 = new QLabel(i18n("Post-init delay (sec/100):"), this);
+ label3 = new QLabel(QObject::tr("Post-init delay (sec/100):"), mainW);
l1->addWidget(label3, row++, 1);
/* Set ATS11 (Dial tone duration) between 0-255 (Default ~ 70) */
QHBoxLayout *l4 = new QHBoxLayout;
l1->addLayout(l4, row, 2);
- ldurationslider = new QLabel("MMMM", this);
+ ldurationslider = new QLabel("MMMM", mainW);
FORMATSLIDERLABEL(ldurationslider);
QSlider *durationslider = new QSlider(1, 255, 1, 0,
- QSlider::Horizontal, this);
+ QSlider::Horizontal, mainW);
// durationslider->setFixedHeight(durationslider->sizeHint().height());
connect(durationslider, SIGNAL(valueChanged(int)),
ldurationslider, SLOT(setNum(int)));
l4->addWidget(ldurationslider, 0);
l4->addWidget(durationslider, 1);
- lduration = new QLabel(i18n("Dialing speed (sec/100):"), this);
+ lduration = new QLabel(QObject::tr("Dialing speed (sec/100):"), mainW);
l1->addWidget(lduration, row++, 1);
- initresp = new QLineEdit(this);
- label2 = new QLabel(i18n("Init response:"), this);
+ initresp = new QLineEdit(mainW);
+ label2 = new QLabel(QObject::tr("Init response:"), mainW);
ADJUSTEDIT(initresp);
l1->addWidget(label2, row, 1);
l1->addWidget(initresp, row++, 2);
- nodetectdialtone = new QLineEdit(this);
- lnodetectdialtone = new QLabel(i18n("No dial tone detection:"), this);
+ nodetectdialtone = new QLineEdit(mainW);
+ lnodetectdialtone = new QLabel(QObject::tr("No dial tone detection:"), mainW);
ADJUSTEDIT(nodetectdialtone);
l1->addWidget(lnodetectdialtone, row, 1);
l1->addWidget(nodetectdialtone, row++, 2);
- dialstr = new QLineEdit(this);
- label4 = new QLabel(i18n("Dial string:"),this);
+ dialstr = new QLineEdit(mainW);
+ label4 = new QLabel(QObject::tr("Dial string:"),mainW);
ADJUSTEDIT(dialstr);
l1->addWidget(label4, row, 1);
l1->addWidget(dialstr, row++, 2);
- connectresp = new QLineEdit(this);
- label5 = new QLabel(i18n("Connect response:"), this);
+ connectresp = new QLineEdit(mainW);
+ label5 = new QLabel(QObject::tr("Connect response:"), mainW);
ADJUSTEDIT(connectresp);
l1->addWidget(label5, row, 1);
l1->addWidget(connectresp, row++, 2);
- busyresp = new QLineEdit(this);
- label6 = new QLabel(i18n("Busy response:"), this);
+ busyresp = new QLineEdit(mainW);
+ label6 = new QLabel(QObject::tr("Busy response:"), mainW);
ADJUSTEDIT(busyresp);
l1->addWidget(label6, row, 1);
l1->addWidget(busyresp, row++, 2);
- nocarrierresp = new QLineEdit(this);
- label7 = new QLabel(i18n("No carrier response:"), this);
+ nocarrierresp = new QLineEdit(mainW);
+ label7 = new QLabel(QObject::tr("No carrier response:"), mainW);
ADJUSTEDIT(nocarrierresp);
l1->addWidget(label7, row, 1);
l1->addWidget(nocarrierresp, row++, 2);
- nodialtoneresp = new QLineEdit(this);
- label8 = new QLabel(i18n("No dial tone response:"), this);
+ nodialtoneresp = new QLineEdit(mainW);
+ label8 = new QLabel(QObject::tr("No dial tone response:"), mainW);
ADJUSTEDIT(nodialtoneresp);
l1->addWidget(label8, row, 1);
l1->addWidget(nodialtoneresp, row++, 2);
- hangupstr = new QLineEdit(this);
- label9 = new QLabel(i18n("Hangup string:"), this);
+ hangupstr = new QLineEdit(mainW);
+ label9 = new QLabel(QObject::tr("Hangup string:"), mainW);
ADJUSTEDIT(hangupstr);
l1->addWidget(label9, row, 1);
l1->addWidget(hangupstr, row++, 2);
- hangupresp = new QLineEdit(this);
- label10 = new QLabel(i18n("Hangup response:"), this);
+ hangupresp = new QLineEdit(mainW);
+ label10 = new QLabel(QObject::tr("Hangup response:"), mainW);
ADJUSTEDIT(hangupresp);
l1->addWidget(label10, row, 1);
l1->addWidget(hangupresp, row++, 2);
- answerstr = new QLineEdit(this);
- label11 = new QLabel(i18n("Answer string:"), this);
+ answerstr = new QLineEdit(mainW);
+ label11 = new QLabel(QObject::tr("Answer string:"), mainW);
ADJUSTEDIT(answerstr);
l1->addWidget(label11, row, 1);
l1->addWidget(answerstr, row++, 2);
- ringresp = new QLineEdit(this);
- label12 = new QLabel(i18n("Ring response:"), this);
+ ringresp = new QLineEdit(mainW);
+ label12 = new QLabel(QObject::tr("Ring response:"), mainW);
ADJUSTEDIT(ringresp);
l1->addWidget(label12, row, 1);
l1->addWidget(ringresp, row++, 2);
- answerresp = new QLineEdit(this);
- label13 = new QLabel(i18n("Answer response:"), this);
+ answerresp = new QLineEdit(mainW);
+ label13 = new QLabel(QObject::tr("Answer response:"), mainW);
ADJUSTEDIT(answerresp);
l1->addWidget(label13, row, 1);
l1->addWidget(answerresp, row++, 2);
- escapestr = new QLineEdit(this);
- label14 = new QLabel(i18n("Escape string:"), this);
+ escapestr = new QLineEdit(mainW);
+ label14 = new QLabel(QObject::tr("Escape string:"), mainW);
ADJUSTEDIT(escapestr);
l1->addWidget(label14, row, 1);
l1->addWidget(escapestr, row++, 2);
- escaperesp = new QLineEdit(this);
- label15 = new QLabel(i18n("Escape response:"), this);
+ escaperesp = new QLineEdit(mainW);
+ label15 = new QLabel(QObject::tr("Escape response:"), mainW);
ADJUSTEDIT(escaperesp);
l1->addWidget(label15, row, 1);
l1->addWidget(escaperesp, row++, 2);
QHBoxLayout *l5 = new QHBoxLayout;
l1->addLayout(l5, row, 2);
- lslider = new QLabel("MMMM", this);
+ lslider = new QLabel("MMMM", mainW);
FORMATSLIDERLABEL(lslider);
QSlider *slider = new QSlider(0, 255, 1, 0,
- QSlider::Horizontal, this);
+ QSlider::Horizontal, mainW);
// slider->setFixedHeight(slider->sizeHint().height());
connect(slider, SIGNAL(valueChanged(int)),
lslider, SLOT(setNum(int)));
l5->addWidget(lslider, 0);
l5->addWidget(slider, 1);
- label16 = new QLabel(i18n("Guard time (sec/50):"), this);
+ label16 = new QLabel(QObject::tr("Guard time (sec/50):"), mainW);
l1->addWidget(label16, row++, 1);
- QLabel *l = new QLabel(i18n("Volume off/low/high:"), this);
+ QLabel *l = new QLabel(QObject::tr("Volume off/low/high:"), mainW);
l1->addWidget(l, row, 1);
QHBoxLayout *l6 = new QHBoxLayout;
l1->addLayout(l6, row++, 2);
- volume_off = new QLineEdit(this);
+ volume_off = new QLineEdit(mainW);
// volume_off->setFixedHeight(volume_off->sizeHint().height());
// volume_off->setMinimumWidth((int)(volume_off->sizeHint().width() / 2));
- volume_medium = new QLineEdit(this);
+ volume_medium = new QLineEdit(mainW);
// volume_medium->setFixedHeight(volume_medium->sizeHint().height());
// volume_medium->setMinimumWidth((int)(volume_medium->sizeHint().width() / 2));
- volume_high = new QLineEdit(this);
+ volume_high = new QLineEdit(mainW);
// volume_high->setFixedHeight(volume_high->sizeHint().height());
// volume_high->setMinimumWidth((int)(volume_high->sizeHint().width() / 2));
l6->addWidget(volume_off);
@@ -307,7 +317,12 @@ void ModemCommands::slotOk() {
_pppdata->setVolumeOff(volume_off->text());
_pppdata->save();
- accept();
+ QDialog::accept();
+}
+
+void ModemCommands::accept()
+{
+ slotOk();
}
diff --git a/noncore/settings/networksettings/ppp/modemcmds.h b/noncore/settings/networksettings/ppp/modemcmds.h
index ef69fec..81d67f4 100644
--- a/noncore/settings/networksettings/ppp/modemcmds.h
+++ b/noncore/settings/networksettings/ppp/modemcmds.h
@@ -44,10 +44,11 @@ Q_OBJECT
public:
- ModemCommands(PPPData*, QWidget *parent=0, const char *name=0);
+ ModemCommands(PPPData*, QWidget *parent=0, const char *name=0, bool modal=0, WFlags f = 0);
~ModemCommands() {}
private slots:
+ virtual void accept();
void slotCancel();
void slotOk();
diff --git a/noncore/settings/networksettings/ppp/modeminfo.cpp b/noncore/settings/networksettings/ppp/modeminfo.cpp
index 0bec186..dbb26db 100644
--- a/noncore/settings/networksettings/ppp/modeminfo.cpp
+++ b/noncore/settings/networksettings/ppp/modeminfo.cpp
@@ -34,14 +34,12 @@
#include <qapplication.h>
#include "modeminfo.h"
#include "modem.h"
-//#include <klocale.h>
-#define i18n QObject::tr
ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
: QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder),
_modem(mo)
{
- setCaption(i18n("ATI Query"));
+ setCaption(QObject::tr("ATI Query"));
// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
@@ -58,17 +56,17 @@ ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
// search all these messages. This is a little overkill, so I take
// the longest english message, translate it and give it additional
// 20 percent space. Hope this is enough.
- statusBar->setText(i18n("Unable to create modem lock file."));
+ statusBar->setText(QObject::tr("Unable to create modem lock file."));
statusBar->setFixedWidth((statusBar->sizeHint().width() * 12) / 10);
statusBar->setFixedHeight(statusBar->sizeHint().height() + 4);
// set original text
- statusBar->setText(i18n("Looking for modem..."));
+ statusBar->setText(QObject::tr("Looking for modem..."));
progressBar->setFixedHeight(statusBar->minimumSize().height());
tl->addWidget(progressBar);
tl->addWidget(statusBar);
- cancel = new QPushButton(i18n("Cancel"), this);
+ cancel = new QPushButton(QObject::tr("Cancel"), this);
cancel->setFocus();
connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton()));
@@ -118,7 +116,7 @@ void ModemTransfer::time_out_slot() {
timeout_timer->stop();
scripttimer->stop();
- QMessageBox::warning(this, tr("Error"), i18n("Modem Query timed out."));
+ QMessageBox::warning(this, tr("Error"), QObject::tr("Modem Query timed out."));
reject();
}
@@ -130,13 +128,13 @@ void ModemTransfer::init() {
int lock = _modem->lockdevice();
if (lock == 1) {
- statusBar->setText(i18n("Modem device is locked."));
+ statusBar->setText(QObject::tr("Modem device is locked."));
return;
}
if (lock == -1) {
- statusBar->setText(i18n("Unable to create modem lock file."));
+ statusBar->setText(QObject::tr("Unable to create modem lock file."));
return;
}
@@ -146,7 +144,7 @@ void ModemTransfer::init() {
usleep(100000); // wait 0.1 secs
_modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ...
- statusBar->setText(i18n("Modem Ready"));
+ statusBar->setText(QObject::tr("Modem Ready"));
qApp->processEvents();
usleep(100000); // wait 0.1 secs
qApp->processEvents();
@@ -227,7 +225,7 @@ void ModemTransfer::cancelbutton() {
_modem->stop();
timeout_timer->stop();
- statusBar->setText(i18n("One moment please..."));
+ statusBar->setText(QObject::tr("One moment please..."));
qApp->processEvents();
_modem->hangup();
@@ -249,7 +247,7 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name)
{
QString label_text;
- setCaption(i18n("Modem Query Results"));
+ setCaption(QObject::tr("Modem Query Results"));
// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
@@ -274,7 +272,7 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name)
//tl->addSpacing(1);
QHBoxLayout *l2 = new QHBoxLayout;
- QPushButton *ok = new QPushButton(i18n("Close"), this);
+ QPushButton *ok = new QPushButton(QObject::tr("Close"), this);
ok->setDefault(TRUE);
ok->setFocus();
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index fc89f35..84acd0e 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -4,12 +4,11 @@ TEMPLATE = lib
#CONFIG += qt warn_on release
CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/plugins/networksettings
-HEADERS = pppmodule.h devices.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h
-SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp
+HEADERS = pppmodule.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h chooserwidget.h devices.h
+SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp chooserwidget.cpp devices.cpp
INCLUDEPATH += $(OPIEDIR)/include ../ ../interfaces/
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -L../interfaces/ -linterfaces
-INTERFACES =
TARGET = kppp
VERSION = 1.0.0
diff --git a/noncore/settings/networksettings/ppp/pppconfig.cpp b/noncore/settings/networksettings/ppp/pppconfig.cpp
index 5fa7d3f..97baf31 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.cpp
+++ b/noncore/settings/networksettings/ppp/pppconfig.cpp
@@ -4,6 +4,7 @@
#include <qtabwidget.h>
#include "accounts.h"
+#include "devices.h"
#include "general.h"
#include "interfaceppp.h"
#include "modem.h"
@@ -28,7 +29,7 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
- qDebug(" _pppdata->currentAccountID() >%i<",interface->data()->currentAccountID());
+
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setSpacing( 0 );
@@ -36,12 +37,16 @@ PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
tabWindow = new QTabWidget( this, "tabWidget" );
layout->addWidget( tabWindow );
- accounts = new AccountWidget( interface->data(), tabWindow, "accounts" );
+ accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp );
tabWindow->addTab( accounts, tr("&Accounts") );
- modem1 = new ModemWidget( interface, tabWindow, "modem1" );
- tabWindow->addTab( modem1, tr("&Device") );
- modem2 = new ModemWidget2( interface, tabWindow, "modem2" );
- tabWindow->addTab( modem2, tr("&Modem") );
+ devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp );
+ tabWindow->addTab( devices, tr("&Devices") );
+
+//OLD:
+// modem1 = new ModemWidget( interface, tabWindow, "modem1" );
+// tabWindow->addTab( modem1, tr("&Device") );
+// modem2 = new ModemWidget2( interface, tabWindow, "modem2" );
+// tabWindow->addTab( modem2, tr("&Modem") );
}
@@ -56,7 +61,7 @@ void PPPConfigWidget::accept()
qDebug("PPPConfigWidget::accept");
qDebug(" _pppdata->accname >%s<",interface->data()->accname().latin1());
qDebug(" interface->getHardwareName >%s<", interface->getHardwareName().latin1());
- interface->setInterfaceName( interface->data()->modemDevice() );
+ interface->setInterfaceName( interface->data()->devname() );
interface->setHardwareName( interface->data()->accname() );
interface->save();
QDialog::accept();
diff --git a/noncore/settings/networksettings/ppp/pppconfig.h b/noncore/settings/networksettings/ppp/pppconfig.h
index 9bab6fe..4d7912f 100644
--- a/noncore/settings/networksettings/ppp/pppconfig.h
+++ b/noncore/settings/networksettings/ppp/pppconfig.h
@@ -8,6 +8,9 @@ class QTabWidget;
class InterfacePPP;
class AccountWidget;
class GeneralWidget;
+class DevicesWidget;
+
+//OLD:
class ModemWidget;
class ModemWidget2;
@@ -29,6 +32,9 @@ protected slots:
QTabWidget *tabWindow;
AccountWidget *accounts;
GeneralWidget *general;
+ DevicesWidget* devices;
+
+ //OLD:
ModemWidget *modem1;
ModemWidget2 *modem2;
};
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 8f45e54..f4727c1 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -26,9 +26,8 @@
#include "pppdata.h"
#include "runtests.h"
-#include "devices.h"
+//#include "devices.h"
//#include <klocale.h>
-#define i18n QObject::tr
#include <qpe/config.h>
#include <qmessagebox.h>
#include <qapplication.h>
@@ -42,24 +41,32 @@
#define SEP QString("%1SEPARATOR%1")
PPPData::PPPData()
- : modemDeviceGroup(-1),
- passwd(""),
+ : passwd(""),
+ _modemName(""),
highcount(-1), // start out with no entries
- caccount(-1), // set the current account index also
+ highcountdev(-1), // start out with no entries
+// caccount(-1), // set the current account index also
suidprocessid(-1), // process ID of setuid child
pppdisrunning(false),
pppderror(0)
{
- highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
+ highcount = readNumConfig(GENERAL_GRP, NUMACCOUNTS_KEY, 0) - 1;
+ highcountdev = readNumConfig(GENERAL_GRP, NUMDEVICES_KEY, 0) - 1;
+ Config cfg = config();
+ cfg.setGroup(GENERAL_GRP);
+ accountList = cfg.readListEntry(ACCOUNT_LIST, ',' );
+ deviceList = cfg.readListEntry(DEVICESNAMES_LIST, ',' );
+ qDebug("PPPData::PPPData has a accountList %s", accountList.join("---").latin1());
+ qDebug("PPPData::PPPData has a deviceList %s", deviceList.join("---").latin1());
- if (highcount > MAX_ACCOUNTS)
- highcount = MAX_ACCOUNTS;
+// if (highcount > MAX_ACCOUNTS)
+// highcount = MAX_ACCOUNTS;
- if(highcount >= 0 && defaultAccount().isEmpty()) {
- setAccountbyIndex(0);
- setDefaultAccount(accname());
- } else if(!setAccount(defaultAccount()))
- setDefaultAccount(accname());
+ // if(highcount >= 0 && defaultAccount().isEmpty()) {
+// setAccountbyIndex(0);
+// setDefaultAccount(accname());
+// } else if(!setAccount(defaultAccount()))
+ setDefaultAccount(accname());
// start out with internal debugging disabled
// the user is still free to specify `debug' on his own
@@ -81,29 +88,34 @@ void PPPData::save()
{
qDebug("PPPData saving data");
writeConfig(GENERAL_GRP, NUMACCOUNTS_KEY, count());
+ writeConfig(GENERAL_GRP, NUMDEVICES_KEY, highcountdev + 1);
QString key;
QStringList keys;
Config cfg = config();
+ cfg.setGroup(GENERAL_GRP);
+ cfg.writeEntry(ACCOUNT_LIST, accountList, ',' );
+ cfg.writeEntry(DEVICESNAMES_LIST, deviceList, ',' );
+
for( QMap<QString,QString>::Iterator it = stringEntries.begin();
it != stringEntries.end(); ++it ){
QString val = it.data();
key = it.key();
// qDebug("saving %s -> %s", key.latin1(), val.latin1() );
keys = QStringList::split( "SEPARATOR", key );
- qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
+ //qDebug("group >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val);
- }
+ }
for( QMap<QString,int>::Iterator it = intEntries.begin();
it != intEntries.end(); ++it ){
int val = it.data();
key = it.key();
// qDebug("saving %s -> %i", key.latin1(), val );
keys = QStringList::split( "SEPARATOR", key );
- qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
+ //qDebug("group >%s< key >%s< val %i", keys[0].latin1(), keys[1].latin1(), val );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val);
- }
+ }
for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
it != listEntries.end(); ++it ){
QStringList val = it.data();
@@ -111,10 +123,9 @@ void PPPData::save()
QChar sep = sepEntries[key];
// qDebug("saving %s -> %s", key.latin1(), val.join(sep).latin1() );
keys = QStringList::split( "SEPARATOR", key );
- qDebug("group >%s< key >%s<values >%s<", keys[0].latin1(), keys[1].latin1(), val.join(sep).latin1() );
cfg.setGroup(keys[0]);
cfg.writeEntry(keys[1], val, sep);
- }
+ }
}
@@ -344,21 +355,33 @@ void PPPData::setpppdTimeout(int n) {
const QString PPPData::modemDevice() {
- return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]);
+ return readConfig (modemGroup(), MODEMDEV_KEY, "/dev/modem" );
}
+// const QString PPPData::modemName()
+// {
+// return readConfig(modemGroup(), MODEMNAME_KEY);
+// }
+
+// bool PPPData::setModemName(const QString &n) {
+// qDebug("Setting modem name to >%s<", n.latin1());
+// _modemName = n;
+// writeConfig(cgroup, MODEMNAME_KEY, n);
+// return true; //FIXME
+// }
+
+// bool PPPData::changeModemName(const QString &n) {
+// qDebug("Setting modem name to >%s<", n.latin1());
+// _modemName = n;
+// writeConfig(modemGroup(), MODEMNAME_KEY, n);
+// return true; //FIXME
+// }
+
bool PPPData::setModemDevice(const QString &n) {
qDebug("Setting modem dev to >%s<", n.latin1());
- bool ret = false;
- for (int i = 0; devices[i]; i++)
- if (devices[i] == n){
- modemDeviceGroup = i;
- writeConfig(modemGroup(), MODEMDEV_KEY, n);
- ret = true;
- }
- qDebug(ret?"SUCCESS":"FAILURE");
- return ret;
+ writeConfig(modemGroup(), MODEMDEV_KEY, n);
+ return true; //FIXME
}
@@ -717,89 +740,111 @@ int PPPData::count() const {
bool PPPData::setAccount(const QString &aname) {
qDebug("setting account to >%s<", aname.latin1());
- for(int i = 0; i <= highcount; i++) {
- setAccountbyIndex(i);
- if(accname() == aname) {
- caccount = i;
- qDebug("SUCCESS");
- return true;
+ for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
+ cgroup = *it;
+ qDebug("PPPData::setAccount %s", cgroup.latin1());
+ qDebug( "iterator %s", (*it).latin1() );
+ if(accname() == aname) {
+ qDebug("SUCCESS");
+ return true;
+ }
+
}
- }
- qDebug("FAILURE");
- return false;
+ qDebug("FAILURE");
+ return false;
}
-
+/*
bool PPPData::setAccountbyIndex(int i) {
if(i >= 0 && i <= highcount) {
+ QString tmp;
+ tmp.sprintf("%s%i", ACCOUNT_GRP, i);
+ if (_deleted.find(tmp)!=_deleted.end()) return false;
caccount = i;
- cgroup.sprintf("%s%i", ACCOUNT_GRP, i);
+ cgroup = tmp;
return true;
}
return false;
}
-
+*/
bool PPPData::isUniqueAccname(const QString &n) {
- int current = caccount;
- for(int i=0; i <= highcount; i++) {
- setAccountbyIndex(i);
- if(accname() == n && i != current) {
- setAccountbyIndex(current);
- return false;
- }
+ QString save_cgroup = cgroup;
+ for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
+ cgroup = *it;
+ qDebug("PPPData::setAccount %s", cgroup.latin1());
+ qDebug( "%s \n", (*it).latin1() );
+ if(accname() == n && cgroup != save_cgroup) {
+ cgroup = save_cgroup;
+ qDebug("SUCCESS");
+ return false;
+ }
+
}
- setAccountbyIndex(current);
+ cgroup = save_cgroup;
return true;
}
-bool PPPData::deleteAccount() {
- //FIXME: PPPData::deleteAccount
-// if(caccount < 0)
- return false;
-
-// QMap <QString, QString> map;
-// QMap <QString, QString>::Iterator it;
-
-// // set all entries of the current account to ""
-// map = config->entryMap(cgroup);
-// it = map.begin();
-// while (it != map.end()) {
-// config->writeEntry(it.key(), "");
-// it++;
-// }
+bool PPPData::isUniqueDevname(const QString &n) {
+ QString save_mName = _modemName;
+ qDebug("PPPData::isUniqueDevname checking if %s is unique", n.latin1());
+ for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
+ _modemName = *it;
+ qDebug("PPPData::isUniqueDevname %s == %s", n.latin1() , devname().latin1());
+ if(devname() == n && _modemName != save_mName) {
+ _modemName = save_mName;
+ qDebug("NOT UNIQUE");
+ return false;
+ }
-// // shift the succeeding accounts
-// for(int i = caccount+1; i <= highcount; i++) {
-// setAccountbyIndex(i);
-// map = config->entryMap(cgroup);
-// it = map.begin();
-// setAccountbyIndex(i-1);
-// config->setGroup(cgroup);
-// while (it != map.end()) {
-// config->writeEntry(it.key(), *it);
-// it++;
-// }
-// }
+ }
+ _modemName = save_mName;
+ return true;
+}
-// // make sure the top account is cleared
-// setAccountbyIndex(highcount);
-// map = config->entryMap(cgroup);
-// it = map.begin();
-// config->setGroup(cgroup);
-// while (it.key() != QString::null) {
-// config->writeEntry(it.key(), "");
-// it++;
-// }
-// highcount--;
-// if(caccount > highcount)
-// caccount = highcount;
+bool PPPData::deleteAccount() {
+ // FIXME: check if this account exists in a config...
+ Config cfg = PPPData::config();
+ cfg.setGroup(cgroup);
+ cfg.clearGroup();
+ accountList.remove(cgroup);
-// setAccountbyIndex(caccount);
+ QString key;
+ QStringList keys;
+ for( QMap<QString,QString>::Iterator it = stringEntries.begin();
+ it != stringEntries.end(); ++it ){
+ QString val = it.data();
+ key = it.key();
+ keys = QStringList::split( "SEPARATOR", key );
+ if(keys[0]==cgroup){
+ stringEntries.remove( it );
+ qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
+ }
+ }
+ for( QMap<QString,int>::Iterator it = intEntries.begin();
+ it != intEntries.end(); ++it ){
+ int val = it.data();
+ key = it.key();
+ keys = QStringList::split( "SEPARATOR", key );
+ if(keys[0]==cgroup){
+ intEntries.remove( it );
+ qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val );
+ }
+ }
+ for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
+ it != listEntries.end(); ++it ){
+ QStringList val = it.data();
+ key = it.key();
+ if(keys[0]==cgroup){
+ listEntries.remove( it );
+ sepEntries.remove( key );
+ qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() );
+ }
+ }
-// return true;
+ return true;
}
@@ -817,17 +862,19 @@ int PPPData::newaccount() {
qDebug("PPPData::newaccount highcount %i/%i",highcount,MAX_ACCOUNTS);
// if(!config) open();
- if (highcount >= MAX_ACCOUNTS) return -1;
+// if (highcount >= MAX_ACCOUNTS) return -1;
- highcount++;
- setAccountbyIndex(highcount);
+ QString tmp;
+ tmp.sprintf("%s%i", ACCOUNT_GRP, ++highcount);
+ cgroup = QString(tmp);
+ accountList << tmp;
+ qDebug("PPPData::newaccount() Group: >%s<",cgroup.latin1());
setpppdArgumentDefaults();
- qDebug("PPPData::newaccount -> %i",caccount);
- return caccount;
+ return highcount;
}
-int PPPData::copyaccount(int i) {
+int PPPData::copyaccount(const QString&) {
// FIXME: PPPData::copyaccount
// if(highcount >= MAX_ACCOUNTS)
return -1;
@@ -837,7 +884,7 @@ int PPPData::copyaccount(int i) {
// QMap <QString, QString> map = config->entryMap(cgroup);
// QMap <QString, QString>::ConstIterator it = map.begin();
-// QString newname = i18n("%1_copy").arg(accname());
+// QString newname = QObject::tr("%1_copy").arg(accname());
// newaccount();
@@ -864,6 +911,7 @@ void PPPData::setAccname(const QString &n) {
if (def)
setDefaultAccount(n);
}
+ writeConfig(cgroup, NAME_KEY, n);
}
@@ -1176,6 +1224,7 @@ void PPPData::setpppdArgument(QStringList &args) {
void PPPData::setpppdArgumentDefaults() {
QStringList arg;
+ arg << "lcp-echo-failure 0";
setpppdArgument(arg);
}
@@ -1247,11 +1296,9 @@ void PPPData::setpppdError(int err) {
QString PPPData::modemGroup()
{
- if (modemDeviceGroup<0){
- qDebug("wrong modem %i\n using 0",modemDeviceGroup);
- modemDeviceGroup = 0; //FIXME!
- }
- return QString("%1_%1").arg(MODEM_GRP).arg(modemDeviceGroup);
+ if (_modemName.isEmpty())
+ _modemName = deviceList[0];
+ return _modemName;
}
@@ -1300,3 +1347,149 @@ QString PPPData::encodeWord(const QString &s) {
r.replace(QRegExp("\\"), "\\\\");
return r;
}
+
+QStringList PPPData::getDevicesList()
+{
+ Config cfg("NetworkSetupPPP");
+ cfg.setGroup("Devices_General");
+ return cfg.readListEntry(DEVICES_LIST,DEVICES_LIST_SEP);
+}
+
+QStringList PPPData::getAccountList()
+{
+ QStringList list;
+ QString save_cgroup;
+ save_cgroup = cgroup;
+ for ( QStringList::Iterator it = accountList.begin(); it != accountList.end(); ++it ) {
+ cgroup = *it;
+ list << accname();
+ }
+ cgroup = save_cgroup;
+ return list;
+};
+
+
+const QString PPPData::devname()
+{
+ QString tmp = readConfig(modemGroup(), MODEMNAME_KEY );
+ qDebug("PPPData::devname() of %s is %s", modemGroup().latin1(), tmp.latin1());
+ return tmp;
+}
+
+void PPPData::setDevname(const QString &n) {
+ // if(!cgroup.isNull()) {
+// // are we manipulating the default account's name ? then change it, too.
+// bool def = accname() == defaultAccount();
+// writeConfig(cgroup, NAME_KEY, n);
+// if (def)
+// setDefaultAccount(n);
+// }
+ writeConfig(modemGroup(), MODEMNAME_KEY, n );
+}
+
+
+bool PPPData::setDevice(const QString &dev )
+{
+ qDebug("setting device to >%s<", dev.latin1());
+ QString save_mName = _modemName;
+ for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
+ _modemName = *it;
+ qDebug("PPPData::setDevice %s is named %s", _modemName.latin1(), devname().latin1() );
+ qDebug( "iterator %s", (*it).latin1() );
+ if(devname() == dev) {
+ qDebug("SUCCESS");
+ return true;
+ }
+
+ }
+ _modemName = save_mName;
+ qDebug("FAILURE");
+ return false;
+}
+
+bool PPPData::deleteDevice()
+{
+ // FIXME: check if this account exists in a config...
+ Config cfg = PPPData::config();
+ cfg.setGroup(modemGroup());
+ cfg.clearGroup();
+ deviceList.remove(modemGroup());
+
+ QString key;
+ QStringList keys;
+ for( QMap<QString,QString>::Iterator it = stringEntries.begin();
+ it != stringEntries.end(); ++it ){
+ QString val = it.data();
+ key = it.key();
+ keys = QStringList::split( "SEPARATOR", key );
+ if(keys[0]==modemGroup()){
+ stringEntries.remove( it );
+ qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.latin1() );
+ }
+ }
+ for( QMap<QString,int>::Iterator it = intEntries.begin();
+ it != intEntries.end(); ++it ){
+ int val = it.data();
+ key = it.key();
+ keys = QStringList::split( "SEPARATOR", key );
+ if(keys[0]==modemGroup()){
+ intEntries.remove( it );
+ qDebug("deleting >%s< key >%s< value >%i<", keys[0].latin1(), keys[1].latin1(), val );
+ }
+ }
+ for( QMap<QString,QStringList>::Iterator it = listEntries.begin();
+ it != listEntries.end(); ++it ){
+ QStringList val = it.data();
+ key = it.key();
+ if(keys[0]==modemGroup()){
+ listEntries.remove( it );
+ sepEntries.remove( key );
+ qDebug("deleting >%s< key >%s< value >%s<", keys[0].latin1(), keys[1].latin1(), val.join("").latin1() );
+ }
+ }
+
+ return true;
+
+}
+
+bool PPPData::deleteDevice(const QString &dev)
+{
+ if(!setDevice(dev))
+ return false;
+
+ return deleteDevice();
+}
+
+int PPPData::newdevice()
+{
+
+ qDebug("PPPData::newdevice highcount %i",highcountdev);
+
+
+ QString tmp;
+ tmp.sprintf("%s%i", MODEM_GRP, ++highcountdev);
+ _modemName = QString(tmp);
+ deviceList << tmp;
+ qDebug("PPPData::newdevice() Group: >%s<",cgroup.latin1());
+ return highcountdev;
+}
+
+int PPPData::copydevice(const QString&)
+{
+ return false;
+}
+
+
+QStringList PPPData::getDevicesNamesList()
+{
+ QStringList list;
+ QString save_mName = _modemName;
+ qDebug("PPPData::getDevicesNamesList has %s", deviceList.join("---").latin1());
+ for ( QStringList::Iterator it = deviceList.begin(); it != deviceList.end(); ++it ) {
+ _modemName = *it;
+ qDebug("PPPData::getDevicesNamesList adding %s as %s",_modemName.latin1(), devname().latin1());
+ list << devname();
+ }
+ _modemName = save_mName;
+ return list;
+};
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h
index 6e1379d..d1cbeb5 100644
--- a/noncore/settings/networksettings/ppp/pppdata.h
+++ b/noncore/settings/networksettings/ppp/pppdata.h
@@ -64,6 +64,8 @@ class Config;
//#define WINPOS_GRP "WindowPosition"
// general
+#define ACCOUNT_LIST "AccountList"
+#define DEVICE_LIST "DeviceList"
#define DEFAULTACCOUNT_KEY "DefaultAccount"
#define PPPDVERSION_KEY "pppdVersion"
#define PPPDTIMEOUT_KEY "pppdTimeout"
@@ -72,10 +74,12 @@ class Config;
#define AUTOREDIAL_KEY "AutomaticRedial"
#define DISCONNECT_KEY "DisconnectOnXServerExit"
#define QUITONDISCONNECT_KEY "QuitOnDisconnect"
-#define NUMACCOUNTS_KEY "NumberOfAccounts"
+#define NUMACCOUNTS_KEY "HighcountAccounts"
+#define NUMDEVICES_KEY "HighcountDevices"
#define ID_KEY "ID"
// modem
+#define MODEMNAME_KEY "Modem_Name"
#define MODEMDEV_KEY "Device"
#define LOCKFILE_KEY "UseLockFile"
#define FLOWCONTROL_KEY "FlowControl"
@@ -151,6 +155,10 @@ class Config;
#define ACOUNTS_DEV "Accounts_Modem"
#define ACOUNTS_ACC "Accounts_Account"
+#define DEVICESNAMES_LIST "DevicesNames_List"
+#define DEVICES_LIST "Devices_List"
+#define DEVICES_LIST_SEP ','
+
class PPPData {
public:
PPPData();
@@ -162,6 +170,8 @@ public:
void save();
void cancel();
+ QStringList getAccountList();
+
static QMap<QString,QString> getConfiguredInterfaces();
static void setConfiguredInterfaces( QMap<QString,QString> );
@@ -184,7 +194,7 @@ public:
QString password();
void setPassword(const QString &);
- int currentAccountID() { return caccount; };
+// int currentAccountID() { return caccount; };
const QString defaultAccount();
void setDefaultAccount(const QString &);
@@ -236,8 +246,12 @@ public:
void setModemEscapeResp(const QString &);
const QString modemEscapeResp();
- const QString modemDevice();
- bool setModemDevice(const QString &);
+// const QString modemName();
+// bool setModemName(const QString &);
+// bool changeModemName(const QString &);
+
+ const QString modemDevice();
+ bool setModemDevice(const QString &);
const QString flowcontrol();
void setFlowcontrol(const QString &);
@@ -313,14 +327,15 @@ public:
// functions to set/get account information
int count() const;
bool setAccount(const QString &);
- bool setAccountbyIndex(int);
+// bool setAccountbyIndex(int);
bool isUniqueAccname(const QString &);
+ bool isUniqueDevname(const QString &);
bool deleteAccount();
bool deleteAccount(const QString &);
int newaccount();
- int copyaccount(int i);
+ int copyaccount(const QString&);
const QString accname();
void setAccname(const QString &);
@@ -409,17 +424,28 @@ public:
int pppdError() const;
void setpppdError(int err);
+ QStringList getDevicesList();
static QString encodeWord(const QString &s);
+ const QString devname();
+ void setDevname(const QString &);
+ bool setDevice(const QString& );
+ bool deleteDevice();
+ bool deleteDevice(const QString &);
+ int newdevice();
+ int copydevice(const QString&);
+ QStringList getDevicesNamesList();
+
private:
//static PPPData *_data;
- int modemDeviceGroup;
+// int modemDeviceGroup;
QString passwd;
- // static Config* config; // configuration object
+ QString _modemName;
int highcount; // index of highest account
- int caccount; // index of the current account
+ int highcountdev; // index of highest device
+// int caccount; // index of the current account
QString cgroup; // name of current config group
pid_t suidprocessid; // process ID of setuid child
bool pppdisrunning; // pppd process
@@ -427,7 +453,10 @@ private:
int pppderror; // error encounterd running pppd
int pppdVer, pppdMod, pppdPatch; // pppd version
+
QStringList phonelist;
+ QStringList accountList;
+ QStringList deviceList;
QMap<QString,QString> stringEntries;
QMap<QString,int> intEntries;
QMap<QString,QStringList> listEntries;
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index d4c137b..af05eb7 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,35 +1,93 @@
+#include <errno.h>
+#include <signal.h>
+
+#include <qpe/config.h>
+
+#include "modem.h"
#include "pppconfig.h"
#include "pppmodule.h"
#include "pppdata.h"
#include "interfaceinformationppp.h"
#include "interfaceppp.h"
+// don't polute global namespace
+namespace {
+ /*
+ * If network settings is qutting and we've ppp
+ * devices open we need to save the pid_t the PPData
+ * and the interface number
+ */
+ struct Connection {
+ pid_t pid;
+ QString device;
+ QString name;
+ };
+ class InterfaceKeeper {
+ public:
+ InterfaceKeeper();
+ ~InterfaceKeeper();
+
+ void addInterface( pid_t, const QString& pppDev, const QString& name );
+ QMap<QString, Connection> interfaces()const; // will check if still available
+ private:
+ bool isAvailable( pid_t )const;
+ QMap<QString, Connection> m_interfaces;
+ };
+}
+
/**
* Constructor, find all of the possible interfaces
+ * We also need to restore the state.. it could be that
+ * an interface was up while closing the application
+ * we need to be able to shut it down...
*/
PPPModule::PPPModule() : Module()
{
+ InterfaceKeeper inFace;
+ QMap<QString,Connection> running = inFace.interfaces();
+ QStringList handledInterfaceNames;
+
QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
QMap<QString,QString>::Iterator it;
InterfacePPP *iface;
qDebug("getting interfaces");
for( it = ifaces.begin(); it != ifaces.end(); ++it ){
- qDebug("ifaces %s", it.key().latin1());
+ qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() );
iface = new InterfacePPP( 0, it.key() );
iface->setHardwareName( it.data() );
list.append( (Interface*)iface );
+
+ // check if (*it) is one of the running ifaces
+ if ( running.contains( it.data() ) ) {
+ qDebug("iface is running %s", it.key().latin1() );
+ handledInterfaceNames << running[it.data()].device;
+ iface->setStatus( true );
+ iface->setPPPDpid( running[it.data()].pid );
+ iface->modem()->setPPPDevice( running[it.data()].device );
+ iface->refresh();
+ }
}
+
+ setHandledInterfaceNames( handledInterfaceNames );
}
/**
* Delete any interfaces that we own.
*/
PPPModule::~PPPModule(){
+ qDebug("PPPModule::~PPPModule() " );
QMap<QString,QString> ifaces;
+ InterfaceKeeper keeper;
Interface *i;
for ( i=list.first(); i != 0; i=list.next() ){
+ /* if online save the state */
+ if ( i->getStatus() ) {
+ qDebug("Iface %s is still up", i->getHardwareName().latin1() );
+ InterfacePPP* ppp = static_cast<InterfacePPP*>(i);
+ keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() );
+ }
ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
delete i;
}
@@ -69,7 +127,7 @@ QWidget *PPPModule::configure(Interface *i){
qDebug("return ModemWidget");
PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
0, "PPPConfig", false,
- Qt::WDestructiveClose );
+ Qt::WDestructiveClose | Qt::WStyle_ContextHelp);
return pppconfig;
}
@@ -135,3 +193,58 @@ void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces)
}
+
+namespace {
+ InterfaceKeeper::InterfaceKeeper( ) {
+ }
+ InterfaceKeeper::~InterfaceKeeper() {
+ Config cfg("ppp_plugin_keeper");
+ QStringList lst = cfg.groupList();
+ for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
+ Connection con;
+ cfg.setGroup( (*it) );
+ cfg.clearGroup();
+ }
+
+ for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) {
+ Connection con = it.data();
+ cfg.setGroup( con.name );
+ cfg.writeEntry( "pid", con.pid );
+ cfg.writeEntry( "device", con.device );
+ }
+ }
+ void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) {
+ Connection con;
+ con.pid = pid;
+ con.device = dev;
+ con.name = name;
+ m_interfaces.insert( name, con );
+ }
+ QMap<QString, Connection> InterfaceKeeper::interfaces()const {
+ Config cfg("ppp_plugin_keeper");
+ QMap<QString, Connection> ifaces;
+ QStringList lst = cfg.groupList();
+ for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
+ Connection con;
+ cfg.setGroup( (*it) );
+ con.name = (*it);
+ con.pid = cfg.readNumEntry("pid");
+ con.device = cfg.readEntry("device");
+ qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid );
+
+ if ( con.pid != -1 && isAvailable( con.pid ) )
+ ifaces.insert( con.name, con );
+ }
+ return ifaces;
+ }
+ bool InterfaceKeeper::isAvailable( pid_t p)const {
+ if (::kill(p, 0 ) == 0 || errno != ESRCH ) {
+ qDebug("isAvailable %d", p);
+ return true;
+ }
+
+ qDebug("notAvailable %d", p);
+ return false;
+ }
+
+}
diff --git a/noncore/settings/networksettings/ppp/runtests.cpp b/noncore/settings/networksettings/ppp/runtests.cpp
index 83ef2ea..5548601 100644
--- a/noncore/settings/networksettings/ppp/runtests.cpp
+++ b/noncore/settings/networksettings/ppp/runtests.cpp
@@ -44,8 +44,6 @@
#define _PATH_RESCONF "/etc/resolv.conf"
#endif
-//#include <klocale.h>
-#define i18n QObject::tr
#include "pppdata.h"
// initial effective uid (main.cpp)
@@ -217,7 +215,7 @@ int runTests() {
if(!access) {
QMessageBox::warning(0,"error",
- i18n("You're not allowed to dial out with "
+ QObject::tr("You're not allowed to dial out with "
"kppp.\nContact your system administrator."));
return TEST_CRITICAL;
}
@@ -228,7 +226,7 @@ int runTests() {
if(!f) {
QMessageBox::warning(0,"error",
- i18n("Cannot find the PPP daemon!\n"
+ QObject::tr("Cannot find the PPP daemon!\n"
"Make sure that pppd is installed."));
warning++;
}
@@ -238,7 +236,7 @@ int runTests() {
#if 0
if(access(f, X_OK) != 0 /* && geteuid() != 0 */) {
KMessageBox::warning(0,
- i18n("You do not have the permission "
+ QObject::tr("You do not have the permission "
"to start pppd!\n"
"Contact your system administrator "
"and ask to get access to pppd."));
@@ -251,7 +249,7 @@ int runTests() {
stat(f, &st);
if(st.st_uid != 0 || (st.st_mode & S_ISUID) == 0) {
QMessageBox::warning(0,"error",
- i18n("You don't have sufficient permission to run\n"
+ QObject::tr("You don't have sufficient permission to run\n"
"%1\n"
"Please make sure that kppp is owned by root "
"and has the SUID bit set.").arg(f));
@@ -263,7 +261,7 @@ int runTests() {
// Test 5: check for existence of /etc/resolv.conf
if (access(_PATH_RESCONF, R_OK) != 0) {
QString file = _PATH_RESCONF" ";
- QString msgstr = i18n("%1 is missing or can't be read!\n"
+ QString msgstr = QObject::tr("%1 is missing or can't be read!\n"
"Ask your system administrator to create "
"this file (can be empty) with appropriate "
"read and write permissions.").arg(file);
diff --git a/noncore/settings/networksettings/wlan/keyedit.cpp b/noncore/settings/networksettings/wlan/keyedit.cpp
index ad9ecae..13a1c3b 100644
--- a/noncore/settings/networksettings/wlan/keyedit.cpp
+++ b/noncore/settings/networksettings/wlan/keyedit.cpp
@@ -4,6 +4,7 @@
KeyEdit::KeyEdit(QWidget* parent, const char* name) :
QLineEdit(parent, name)
{
+ setEchoMode(Password);
}
KeyEdit::~KeyEdit()
diff --git a/noncore/settings/networksettings/wlan/wlan.ui b/noncore/settings/networksettings/wlan/wlan.ui
index 7932445..7e39e23 100644
--- a/noncore/settings/networksettings/wlan/wlan.ui
+++ b/noncore/settings/networksettings/wlan/wlan.ui
@@ -11,7 +11,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>251</width>
+ <width>247</width>
<height>299</height>
</rect>
</property>
@@ -287,34 +287,18 @@
<item>
<property>
<name>text</name>
- <string>Auto</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Managed</string>
- </property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Ad-Hoc</string>
+ <string>any</string>
</property>
</item>
<property stdset="1">
<name>name</name>
- <cstring>mode</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <cstring>essid</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>101</x>
- <y>11</y>
+ <y>46</y>
<width>103</width>
<height>29</height>
</rect>
@@ -322,28 +306,70 @@
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
- <hsizetype>1</hsizetype>
+ <hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>currentItem</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>sizeLimit</name>
+ <number>5</number>
+ </property>
+ <property stdset="1">
+ <name>autoCompletion</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
</widget>
<widget>
<class>QComboBox</class>
<item>
<property>
<name>text</name>
- <string>any</string>
+ <string>Infrastructure</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Auto</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Managed</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Ad-Hoc</string>
</property>
</item>
<property stdset="1">
<name>name</name>
- <cstring>essid</cstring>
+ <cstring>mode</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>101</x>
- <y>46</y>
+ <y>11</y>
<width>103</width>
<height>29</height>
</rect>
@@ -351,30 +377,10 @@
<property stdset="1">
<name>sizePolicy</name>
<sizepolicy>
- <hsizetype>7</hsizetype>
+ <hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
</sizepolicy>
</property>
- <property stdset="1">
- <name>editable</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>currentItem</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>sizeLimit</name>
- <number>5</number>
- </property>
- <property stdset="1">
- <name>autoCompletion</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>duplicatesEnabled</name>
- <bool>false</bool>
- </property>
</widget>
</widget>
<widget>
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index cdafb4d..26e3aa9 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -27,7 +27,7 @@
/**
* Constructor, read in the wireless.opts file for parsing later.
*/
-WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), currentProfile("*"), interface(i) {
+WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
interfaces = new Interfaces();
interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
tabWidget->insertTab(interfaceSetup, "TCP/IP");
@@ -67,14 +67,9 @@ void WLANImp::parseOpts() {
}
opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
- if (opt == "Auto") {
- mode->setCurrentItem(0);
- } else if (opt == "Ad-Hoc") {
- mode->setCurrentItem(2);
- } else {
- // Managed/Infrastructure mode
- mode->setCurrentItem(1);
- }
+
+ for ( int i = 0; i < mode->count(); i++)
+ if ( mode->text( i ) == opt ) mode->setCurrentItem( i );
opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
if (! opt.isNull()) {
@@ -203,11 +198,20 @@ void WLANImp::accept() {
writeOpts();
// Close out the dialog
- QDialog::accept();
+// FIXME: QDialog::accept();
}
void WLANImp::writeOpts() {
- bool error = false;
+ // eh can't really do anything about it other then return. :-D
+ if(!interfaces->isInterfaceSet()){
+ QMessageBox::warning(0,"Inface not set","should not happen!!!");
+ return;
+ }
+ bool error = false;
+
+ qDebug("setting wlan interface %s", interfaces->getInterfaceName( error ).latin1() );
+
+ if (error) QMessageBox::warning(0,"Inface not set","should not happen!!!");
interfaces->setInterfaceOption(QString("wireless_mode"), mode->currentText());
interfaces->setInterfaceOption(QString("wireless_essid"), essid->currentText());
@@ -230,13 +234,16 @@ void WLANImp::writeOpts() {
if (! keyLineEdit0->text().isNull()) {
keyList += keyLineEdit0->text();
keyList += "[1]";
- } else if (! keyLineEdit1->text().isNull()) {
+ } //else
+ if (! keyLineEdit1->text().isNull()) {
keyList += keyLineEdit1->text();
keyList += "[2]";
- } else if (! keyLineEdit2->text().isNull()) {
+ } //else
+ if (! keyLineEdit2->text().isNull()) {
keyList += keyLineEdit2->text();
keyList += "[3]";
- } else if (! keyLineEdit3->text().isNull()) {
+ } //else
+ if (! keyLineEdit3->text().isNull()) {
keyList += keyLineEdit3->text();
keyList += "[4]";
}
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index a4488f9..b4c3509 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -1,5 +1,5 @@
#include "wlanmodule.h"
-#include "wlanimp.h"
+#include "wlanimp2.h"
#include "infoimp.h"
#include "wextensions.h"
#include "interfaceinformationimp.h"
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index c06f639..19b0e84 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -425,7 +425,7 @@ void UserDialog::accept() {
*
*/
void UserDialog::clickedPicture() {
- QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED,"/opt/QtPalmtop/pics");
+ QString filename=OFileDialog::getOpenFileName(OFileSelector::EXTENDED, QString::null);
if(!(filename.isEmpty())) {
userImage.reset();
if(!(userImage.load(filename))) {
diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h
index b7b925d..3272afc 100644
--- a/noncore/settings/usermanager/userdialog.h
+++ b/noncore/settings/usermanager/userdialog.h
@@ -16,6 +16,7 @@
#include <qtabwidget.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
+#include <qlabel.h>
#include <qpe/resource.h>
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index 1946013..65bbd8b 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -27,7 +27,7 @@
*
*/
UserConfig::UserConfig(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) {
- setCaption(tr("OPIE User Manager"));
+ setCaption(tr("Opie User Manager"));
// Create an instance of the global object 'accounts'. This holds all user/group info, and functions to modify them.
accounts=new Passwd();
diff --git a/noncore/settings/usermanager/usermanager.pro b/noncore/settings/usermanager/usermanager.pro
index 576a233..1baccb6 100644
--- a/noncore/settings/usermanager/usermanager.pro
+++ b/noncore/settings/usermanager/usermanager.pro
@@ -2,7 +2,7 @@ TEMPLATE = app
#CONFIG = qt warn_on debug
CONFIG = qt warn_on release
HEADERS = usermanager.h userdialog.h groupdialog.h passwd.h
-SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.cpp main.cpp
+SOURCES = usermanager.cpp userdialog.cpp groupdialog.cpp passwd.h main.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie -lcrypt
diff --git a/noncore/styles/flat/flat.cpp b/noncore/styles/flat/flat.cpp
index b6635c5..24366f6 100644
--- a/noncore/styles/flat/flat.cpp
+++ b/noncore/styles/flat/flat.cpp
@@ -18,8 +18,7 @@
**
**********************************************************************/
-#include "flat.h"
-#include <qpe/qpeapplication.h>
+#include <qtopia/qpeapplication.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qpainter.h>
@@ -32,9 +31,13 @@
#include <qtabbar.h>
#include <qspinbox.h>
#include <qlineedit.h>
+#include <qmap.h>
#define INCLUDE_MENUITEM_DEF
#include <qmenudata.h>
+#include <qpopupmenu.h>
+
+#include "flat.h"
#define QCOORDARRLEN(x) sizeof(x)/(sizeof(QCOORD)*2)
@@ -54,23 +57,37 @@ public:
FlatStylePrivate() : QObject() {}
bool eventFilter( QObject *o, QEvent *e ) {
- if ( e->type() == QEvent::ParentPaletteChange && o->inherits( "QMenuBar" ) ) {
- QWidget *w = (QWidget *)o;
- if ( w->parentWidget() ) {
- QPalette p = w->parentWidget()->palette();
- QColorGroup a = p.active();
- a.setColor( QColorGroup::Light, a.foreground() );
- a.setColor( QColorGroup::Dark, a.foreground() );
- p.setActive( a );
- p.setInactive( a );
- w->setPalette( p );
+ if ( e->type() == QEvent::ParentPaletteChange ) {
+ if ( o->inherits( "QMenuBar" ) ) {
+ QWidget *w = (QWidget *)o;
+ if ( w->parentWidget() ) {
+ QPalette p = w->parentWidget()->palette();
+ QColorGroup a = p.active();
+ a.setColor( QColorGroup::Light, a.foreground() );
+ a.setColor( QColorGroup::Dark, a.foreground() );
+ p.setActive( a );
+ p.setInactive( a );
+ w->setPalette( p );
+ }
+ } else if ( o->inherits( "QHeader" ) ) {
+ QWidget *w = (QWidget *)o;
+ if ( w->parentWidget() ) {
+ QPalette p = w->parentWidget()->palette();
+ QColorGroup a = p.active();
+ a.setColor( QColorGroup::Light, a.button() );
+ p.setActive( a );
+ p.setInactive( a );
+ w->setPalette( p );
+ }
}
}
return FALSE;
}
+
+ QMap<QFrame *,int> frameStyles;
};
-FlatStyle::FlatStyle() : revItem(FALSE)
+FlatStyle::FlatStyle() : revItem(FALSE), fillBtnBorder(FALSE)
{
setButtonMargin(3);
setScrollBarExtent(13,13);
@@ -101,7 +118,9 @@ void FlatStyle::polish( QWidget *w )
{
if ( w->inherits( "QFrame" ) ) {
QFrame *f = (QFrame *)w;
- if ( f->frameShape() != QFrame::NoFrame )
+ if ( f->frameShape() == QFrame::HLine || f->frameShape() == QFrame::VLine )
+ f->setFrameShadow( QFrame::Plain );
+ else if ( f->frameShape() != QFrame::NoFrame )
f->setFrameShape( QFrame::StyledPanel );
f->setLineWidth( 1 );
}
@@ -117,20 +136,32 @@ void FlatStyle::polish( QWidget *w )
p.setInactive( a );
w->setPalette( p );
w->installEventFilter( d );
+ } else if ( w->inherits( "QHeader" ) ) {
+ // make headers look flat
+ QPalette p = w->palette();
+ QColorGroup a = p.active();
+ a.setColor( QColorGroup::Light, a.button() );
+ p.setActive( a );
+ p.setInactive( a );
+ w->setPalette( p );
+ w->installEventFilter( d );
}
}
void FlatStyle::unPolish( QWidget *w )
{
- if ( w->inherits( "QFrame" ) ) {
+ if ( w->inherits("QFrame") ) {
QFrame *f = (QFrame *)w;
- if ( f->frameShape() != QFrame::NoFrame )
+ if ( f->frameShape() == QFrame::HLine || f->frameShape() == QFrame::VLine ) {
+ f->setFrameShadow( QFrame::Sunken );
+ } else if ( f->frameShape() != QFrame::NoFrame ) {
f->setFrameShape( QFrame::StyledPanel );
- f->setLineWidth( 2 );
+ f->setLineWidth( 2 );
+ }
}
- if ( w->inherits( "QSpinBox" ) )
+ if ( w->inherits("QSpinBox") )
((SpinBoxHack*)w)->setFlatButtons( FALSE );
- if ( w->inherits( "QMenuBar" ) ) {
+ if ( w->inherits("QMenuBar") || w->inherits("QHeader") ) {
w->unsetPalette();
w->removeEventFilter( d );
}
@@ -138,7 +169,7 @@ void FlatStyle::unPolish( QWidget *w )
int FlatStyle::defaultFrameWidth() const
{
- return 1;
+ return 2;
}
void FlatStyle::drawItem( QPainter *p, int x, int y, int w, int h,
@@ -171,16 +202,30 @@ void FlatStyle::drawButton( QPainter *p, int x, int y, int w, int h,
{
QPen oldPen = p->pen();
+ int x2 = x+w-1;
+ int y2 = y+h-1;
+
+ if ( fillBtnBorder && btnBg != cg.color(QColorGroup::Button) ) {
+ p->setPen( btnBg );
+ p->drawLine( x, y, x2, y );
+ p->drawLine( x, y2, x2, y2 );
+ p->drawLine( x, y+1, x, y2-1 );
+ p->drawLine( x2, y+1, x2, y2-1 );
+ p->fillRect( x+1, y+1, 3, 3, btnBg );
+ p->fillRect( x+1, y2-3, 3, 3, btnBg );
+ p->fillRect( x2-3, y2-3, 3, 3, btnBg );
+ p->fillRect( x2-3, y+1, 3, 3, btnBg );
+ p->fillRect( x+2, y+2, w-4, h-4, fill?(*fill):cg.brush(QColorGroup::Button) );
+ } else {
+ p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):cg.brush(QColorGroup::Button) );
+ }
+
if ( h >= 10 ) {
x++; y++;
+ x2--; y2--;
w -= 2; h -= 2;
}
- p->fillRect( x+1, y+1, w-2, h-2, fill?(*fill):cg.brush(QColorGroup::Button) );
-
- int x2 = x+w-1;
- int y2 = y+h-1;
-
p->setPen( cg.foreground() );
if ( h < 10 ) {
@@ -225,12 +270,23 @@ void FlatStyle::drawBevelButton( QPainter *p, int x, int y, int w, int h,
void FlatStyle::drawToolButton( QPainter *p, int x, int y, int w, int h,
const QColorGroup &g, bool sunken, const QBrush* fill )
{
+ if ( p->device()->devType() == QInternal::Widget ) {
+ QWidget *w = (QWidget *)p->device();
+ if ( w->isA("QToolButton") ) {
+ QToolButton *btn = (QToolButton *)w;
+ if ( btn->parentWidget() ) {
+ btnBg = btn->parentWidget()->backgroundColor();
+ fillBtnBorder = TRUE;
+ }
+ }
+ }
QBrush fb( fill ? *fill : g.button() );
if ( sunken && fb == g.brush( QColorGroup::Button ) ) {
fb = g.buttonText();
revItem = TRUE; // ugh
}
drawButton( p, x, y, w, h, g, sunken, &fb );
+ fillBtnBorder = FALSE;
}
void FlatStyle::drawPushButton( QPushButton *btn, QPainter *p )
@@ -257,6 +313,11 @@ void FlatStyle::drawPushButton( QPushButton *btn, QPainter *p )
}
*/
+ if ( btn->parentWidget() ) {
+ btnBg = btn->parentWidget()->backgroundColor();
+ fillBtnBorder = TRUE;
+ }
+
bool clearButton = TRUE;
if ( btn->isDown() ) {
drawButton( p, x1, y1, x2-x1+1, y2-y1+1, g, TRUE,
@@ -283,6 +344,7 @@ void FlatStyle::drawPushButton( QPushButton *btn, QPainter *p )
}
*/
+ fillBtnBorder = FALSE;
if ( p->brush().style() != NoBrush )
p->setBrush( NoBrush );
}
@@ -589,7 +651,8 @@ void FlatStyle::drawScrollBarControls( QPainter* p, const QScrollBar* sb, int sl
p->setBrush( g.brush( QColorGroup::Mid ) );
if ( controls & SubPage )
p->drawRect( subPageR.x(), subPageR.y(), subPageR.width(), subPageR.height() );
- if ( controls & AddPage && addPageR.y() < addPageR.bottom() )
+ if ( controls & AddPage && addPageR.y() < addPageR.bottom() &&
+ addPageR.x() < addPageR.right() )
p->drawRect( addPageR.x(), addPageR.y(), addPageR.width(), addPageR.height() );
if ( controls & Slider ) {
QPoint bo = p->brushOrigin();
@@ -784,6 +847,12 @@ static const int motifCheckMarkHMargin = 1; // horiz. margins of check mark
static const int windowsRightBorder = 8; // right border on windows
static const int windowsCheckMarkWidth = 2; // checkmarks width on windows
+void FlatStyle::polishPopupMenu ( QPopupMenu *m )
+{
+ QWindowsStyle::polishPopupMenu( m );
+ m->setLineWidth( 1 );
+}
+
/*! \reimp
*/
int FlatStyle::extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem* mi, const QFontMetrics& /*fm*/ )
@@ -1008,7 +1077,7 @@ QStyle *FlatStyleImpl::style()
QString FlatStyleImpl::name() const
{
- return QString("Flat");
+ return qApp->translate("FlatStyle", "Flat", "Name of the style Flat");
}
QRESULT FlatStyleImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface )
@@ -1018,9 +1087,10 @@ QRESULT FlatStyleImpl::queryInterface( const QUuid &uuid, QUnknownInterface **if
*iface = this;
else if ( uuid == IID_Style )
*iface = this;
+ else
+ return QS_FALSE;
- if ( *iface )
- (*iface)->addRef();
+ (*iface)->addRef();
return QS_OK;
}
diff --git a/noncore/styles/flat/flat.h b/noncore/styles/flat/flat.h
index e446800..ebea95b 100644
--- a/noncore/styles/flat/flat.h
+++ b/noncore/styles/flat/flat.h
@@ -21,12 +21,13 @@
#ifndef FLATSTYLE_H
#define FLATSTYLE_H
+#include <qcolor.h>
#include <qwindowsstyle.h>
#include <qpe/styleinterface.h>
class FlatStylePrivate;
-class Q_EXPORT FlatStyle : public QWindowsStyle
+class FlatStyle : public QWindowsStyle
{
public:
FlatStyle();
@@ -73,6 +74,7 @@ public:
const QColorGroup& , QCOORD c, Orientation orient );
void drawSliderGroove ( QPainter * p, int x, int y, int w, int h, const QColorGroup & g, QCOORD c, Orientation );
void drawTab( QPainter *, const QTabBar *, QTab *, bool selected );
+ void polishPopupMenu ( QPopupMenu * );
int extraPopupMenuItemWidth( bool checkable, int maxpmw, QMenuItem*, const QFontMetrics& );
int popupMenuItemHeight( bool checkable, QMenuItem*, const QFontMetrics& );
void drawPopupMenuItem( QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
@@ -86,6 +88,8 @@ public:
private:
FlatStylePrivate *d;
bool revItem;
+ bool fillBtnBorder;
+ QColor btnBg;
// Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
FlatStyle( const FlatStyle & );
diff --git a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
index 71dd7eb..73f8bb3 100644
--- a/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
+++ b/noncore/todayplugins/stockticker/stockticker/inputDialog.cpp
@@ -9,6 +9,7 @@
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include <qlabel.h>
+#include <qlayout.h>
#include <qpe/config.h>
#include <qstringlist.h>
#include <qmainwindow.h>
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
index d740b6f..915233a 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.cpp
@@ -121,7 +121,7 @@ StocktickerPluginConfig::StocktickerPluginConfig( QWidget *parent, const char*
timerDelaySpin->setMaxValue( 60);
cfg.setGroup("Timer");
- timerDelaySpin->setValue( cfg.readNumEntry("Delay",0));
+ timerDelaySpin->setValue( cfg.readNumEntry("Delay",15));
layout->addMultiCellWidget( timerDelaySpin , 6, 6, 0, 0);
QLabel *label2;
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h
index 2b67a8b..10f9678 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerconfig.h
@@ -28,7 +28,7 @@ class QCheckBox;
class QSpinBox;
class StocktickerPluginConfig : public TodayConfigWidget {
-//Q_OBJECT
+ Q_OBJECT
public:
StocktickerPluginConfig( QWidget *parent, const char *name );
~StocktickerPluginConfig();
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
index c3ca52d..fedc79c 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerpluginwidget.cpp
@@ -1,301 +1,327 @@
-/*
- * stocktickerpluginwidget.cpp
- *
- * copyright : (c) 2002 by L.J. Potter
- * email : llornkcor@handhelds.org
- *
- */
-/***************************************************************************
- * *
- * 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 <qlayout.h>
-
-#include <qpe/config.h>
-
-#include <opie/oticker.h>
-
-extern "C" {
-#include "libstocks/stocks.h"
-}
-
-#include <pthread.h>
-
-#include "stocktickerpluginwidget.h"
-
-QString output;
-OTicker *stocktickerTicker;
+ /*
+ * stocktickerpluginwidget.cpp
+ *
+ * copyright : (c) 2002 by L.J. Potter
+ * email : llornkcor@handhelds.org
+ *
+ */
+ /***************************************************************************
+ * *
+ * 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 <qlayout.h>
+
+ #include <qpe/config.h>
+
+ #include <opie/oticker.h>
+
+ extern "C" {
+ #include "libstocks/stocks.h"
+ }
+
+ #include <pthread.h>
+
+ #include "stocktickerpluginwidget.h"
+
+ QString output;
+ OTicker *stocktickerTicker;
+ QCString stock_liste;
+ bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck;
+ bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck;
+ bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck;
void getStocks(char *blah) {
-// stocktickerTicker->setText( "Downloading stock data.");
- stock *stocks_quotes=NULL;
- stock *stocks_tmp;
- QCString stock_liste = blah;
- ::free ( blah );
- // char *stock_liste = (char *)blah->latin1();
- qDebug("%s", stock_liste.data() );
- QString tempString;
- output = "";
-
- libstocks_return_code error;
-
- Config cfg( "stockticker");
- cfg.setGroup( "Fields" );
- bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck;
- bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck;
- bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck;
-
- dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false;
-
- dotimeCheck=cfg.readBoolEntry("timeCheck",1);
- dodateCheck=cfg.readBoolEntry("dateCheck",1);
- dosymbolCheck=cfg.readBoolEntry("symbolCheck",1);
- donameCheck=cfg.readBoolEntry("nameCheck",1);
- docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1);
- dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1);
- doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1);
- dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1);
- domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1);
- dovariationCheck=cfg.readBoolEntry("variationCheck",1);
- dovolumeCheck=cfg.readBoolEntry("volumeCheck",1);
-
-// DefProxy();
- {
- char *proxy;
- libstocks_return_code error;
-
- /* Proxy support */
- /* Checks for "http_proxy" environment variable */
- proxy = getenv("http_proxy");
- if(proxy) {
- /* printf("proxy set\n"); */
- error = set_proxy(proxy);
- if (error) {
- printf("Proxy error (%d)\n", error);
- QString tempString;
- tempString.sprintf("Proxy error (%d)\n", error);
- output = tempString;
- return;
-// exit(1);
- }
- }
- }
-// char *stock_liste = (char *)blah;
- /* Get the stocks and process errors */
- error = get_stocks( stock_liste.data(), &stocks_quotes);
-
- if (error) {
- printf("Error in getting stocks (%d)\n", error);
- tempString.sprintf("Error in getting stocks (%d)\n", error);
- output =tempString;
- return;
-// exit(1);
- }
-
- stocks_tmp = stocks_quotes;
-
- /* Displays the stocks */
- while(stocks_tmp!=0){
-
- if (stocks_tmp->Time) {
-// printf("%s ", stocks_tmp->Time);
- tempString.sprintf("| %s ", stocks_tmp->Time);
- tempString.replace(QRegExp("\""),"");
- if( dotimeCheck)
- output +=tempString;
- }
- if (stocks_tmp->Date) {
-// printf("%s ", stocks_tmp->Date);
- tempString.sprintf("| %s ", stocks_tmp->Date);
- tempString.replace(QRegExp("\""),"");
- if(dodateCheck)
- output +=tempString;
- }
-// printf("\n");
-
-// printf("----------------------------------------\n");
-
- if ( strlen(stocks_tmp->Symbol) > 20 ) {
-// printf("| Symbol | %.20s |\n",stocks_tmp->Symbol);
- tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol);
- if(dosymbolCheck)
- output +=tempString;
- }
- else {
-// printf("| Symbol | %-20s |\n",stocks_tmp->Symbol);
- tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol);
- if(dosymbolCheck)
- output +=tempString;
- }
-
- if (stocks_tmp->Name) {
- if ( strlen(stocks_tmp->Name) > 20 ) {
-// printf("| Name %.20s |\n",stocks_tmp->Name);
- tempString.sprintf("| Name %s ",stocks_tmp->Name);
- tempString.stripWhiteSpace();
- if(donameCheck)
- output +=tempString;
- } else {
-// printf("| Name | %-20s |\n",stocks_tmp->Name);
- tempString.sprintf("| Name %s ",stocks_tmp->Name);
- tempString.stripWhiteSpace();
- if(donameCheck)
- output +=tempString;
- }
- }
- else {
-// printf("| Name | |\n");
- tempString.sprintf("| Name | |");
- if(donameCheck)
- output +=tempString;
- }
-
-// printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice);
- tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice);
- if(docurrentPriceCheck)
- output +=tempString;
-
-// printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice);
- tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice);
- if(dolastPriceCheck)
- output +=tempString;
-
-// printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice);
- tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice);
- if(doopenPriceCheck)
- output +=tempString;
-
-// printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice);
- tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice);
- if(dominPriceCheck)
- output +=tempString;
-
-// printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice);
- tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice);
- if(domaxPriceCheck)
- output +=tempString;
-
-// printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage);
- tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage);
- if(dovariationCheck)
- output +=tempString;
-
-// printf("| Volume | %-9d |\n", stocks_tmp->Volume);
- tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume);
- if(dovolumeCheck)
- output +=tempString;
-
-// printf("----------------------------------------\n\n");
- tempString.sprintf("||==++==|");
- output +=tempString;
-
- /* Simple function which help to browse in the stocks list */
- stocks_tmp = next_stock(stocks_tmp);
- }
-
- /* frees stocks */
- free_stocks(stocks_quotes);
- stocktickerTicker->setText( output.latin1() );
-
-}
-
-StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name)
- : QWidget(parent, name ) {
- init();
- startTimer(1000);
-
- stocktickerTicker->setTextFormat(Qt::RichText);
-// checkConnection();
-}
-
-StockTickerPluginWidget::~StockTickerPluginWidget() {
-}
-
-void StockTickerPluginWidget::init() {
-
- QHBoxLayout* layout = new QHBoxLayout( this );
- stocktickerTicker = new OTicker(this);
-// stocktickerTicker->setMinimumHeight(15);
- connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() ));
- layout->addWidget( stocktickerTicker);
- wasError = true;
-}
-
-void StockTickerPluginWidget::doStocks() {
- Config cfg( "stockticker");
- cfg.setGroup( "Symbols" );
- symbollist="";
- symbollist = cfg.readEntry("Symbols", "");
- symbollist.replace(QRegExp(" "),"+");//seperated by +
-
- cfg.setGroup("Timer");
- stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50));
- stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10));
-
- if (!symbollist.isEmpty()) {
- pthread_t thread1;
- char *blah = ::strdup(symbollist.latin1());
- pthread_create(&thread1,NULL, (void * (*)(void *))getStocks, (void *) blah);
- }
-}
-
-void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
- killTimer(e->timerId());
- checkConnection();
-}
-
-void StockTickerPluginWidget::checkConnection() {
-// qDebug("checking connection");
-// Sock = new QSocket( this );
-
-// if( wasError)
-// stocktickerTicker->setText("Checking connection");
-
-// if(Sock->state() == QSocket::Idle) {
-// Sock->connectToHost("finance.yahoo.com", 80);
-// connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) );
-// connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) );
-// } else {
-// qDebug("State is not Idle");
- isConnected();
-// }
-}
-
-void StockTickerPluginWidget::isConnected() {
-// qDebug("We connect, so ok to grab stocks");
- doStocks();
-
- Config cfg( "stockticker");
- cfg.setGroup("Timer");
- timerDelay= cfg.readNumEntry("Delay",0);
- if(timerDelay > 0)
- startTimer(timerDelay*60000);
- qDebug("timer set for %d",(timerDelay*60000)/60000);
- wasError = false;
-
-// Sock->close();
-}
-
-void StockTickerPluginWidget::socketError(int errcode) {
- switch(errcode) {
- case QSocket::ErrConnectionRefused:
- output = tr("Connection refused.");
- break;
- case QSocket::ErrHostNotFound:
- output = tr("Could not find server.");
- break;
- case QSocket::ErrSocketRead :
- output = tr("Socket read error.");
- break;
- };
- stocktickerTicker->setText( output );
- wasError = true;
-// Sock->close();
-
-}
+ // stocktickerTicker->setText( "Downloading stock data.");
+ stock *stocks_quotes=NULL;
+ stock *stocks_tmp;
+ stock_liste = blah;
+ ::free ( blah );
+ // char *stock_liste = (char *)blah->latin1();
+ // qDebug("%s", stock_liste.data() );
+ output = "";
+ QString tempString;
+ libstocks_return_code error;
+
+// Config cfg( "stockticker");
+// cfg.setGroup( "Fields" );
+// bool dotimeCheck, dodateCheck, dosymbolCheck, donameCheck;
+// bool docurrentPriceCheck, dolastPriceCheck, doopenPriceCheck;
+// bool dominPriceCheck, domaxPriceCheck, dovariationCheck, dovolumeCheck;
+
+ dotimeCheck=dodateCheck=dosymbolCheck=donameCheck= docurrentPriceCheck=dolastPriceCheck=doopenPriceCheck=dominPriceCheck=domaxPriceCheck=dovariationCheck=dovolumeCheck=false;
+
+ dotimeCheck=1;
+ dodateCheck=1;
+ dosymbolCheck=1;
+ donameCheck=1;
+ docurrentPriceCheck=1;
+ dolastPriceCheck=1;
+ doopenPriceCheck=1;
+ dominPriceCheck=1;
+ domaxPriceCheck=1;
+ dovariationCheck=1;
+ dovolumeCheck=1;
+
+// dotimeCheck=cfg.readBoolEntry("timeCheck",1);
+// dodateCheck=cfg.readBoolEntry("dateCheck",1);
+// dosymbolCheck=cfg.readBoolEntry("symbolCheck",1);
+// donameCheck=cfg.readBoolEntry("nameCheck",1);
+// docurrentPriceCheck=cfg.readBoolEntry("currentPriceCheck",1);
+// dolastPriceCheck=cfg.readBoolEntry("lastPriceCheck",1);
+// doopenPriceCheck=cfg.readBoolEntry("openPriceCheck",1);
+// dominPriceCheck=cfg.readBoolEntry("minPriceCheck",1);
+// domaxPriceCheck=cfg.readBoolEntry("maxPriceCheck",1);
+// dovariationCheck=cfg.readBoolEntry("variationCheck",1);
+// dovolumeCheck=cfg.readBoolEntry("volumeCheck",1);
+
+ // DefProxy();
+ // {
+ char *proxy;
+ // libstocks_return_code error;
+
+ /* Proxy support */
+ /* Checks for "http_proxy" environment variable */
+ proxy = getenv("http_proxy");
+ if(proxy) {
+ /* printf("proxy set\n"); */
+ error = set_proxy(proxy);
+ if (error) {
+// printf("Proxy error (%d)\n", error);
+// QString tempString2;
+// tempString2.sprintf("Proxy error (%d)\n", error);
+// output = tempString2;
+ // delete tempString2;
+ return;
+ // exit(1);
+ }
+ }
+ ::free(proxy);
+ // }
+ /* Get the stocks and process errors */
+ error = get_stocks( stock_liste.data(), &stocks_quotes);
+
+ if (error) {
+ printf("Error in getting stocks (%d)\n", error);
+ tempString.sprintf("Error in getting stocks (%d)\n", error);
+ output =tempString;
+ return;
+ }
+
+ stocks_tmp = stocks_quotes;
+
+ /* Displays the stocks */
+ while(stocks_tmp!=0){
+
+ if (stocks_tmp->Time) {
+ // printf("%s ", stocks_tmp->Time);
+ tempString.sprintf("| %s ", stocks_tmp->Time);
+ tempString.replace(QRegExp("\""),"");
+ if( dotimeCheck)
+ output +=tempString;
+ }
+ if (stocks_tmp->Date) {
+ // printf("%s ", stocks_tmp->Date);
+ tempString.sprintf("| %s ", stocks_tmp->Date);
+ tempString.replace(QRegExp("\""),"");
+ if(dodateCheck)
+ output +=tempString;
+ }
+ // printf("\n");
+
+ // printf("----------------------------------------\n");
+
+ if ( strlen(stocks_tmp->Symbol) > 20 ) {
+ // printf("| Symbol | %.20s |\n",stocks_tmp->Symbol);
+ tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol);
+ if(dosymbolCheck)
+ output +=tempString;
+ }
+ else {
+ // printf("| Symbol | %-20s |\n",stocks_tmp->Symbol);
+ tempString.sprintf("| Symbol %s ",stocks_tmp->Symbol);
+ if(dosymbolCheck)
+ output +=tempString;
+ }
+
+ if (stocks_tmp->Name) {
+ if ( strlen(stocks_tmp->Name) > 20 ) {
+ // printf("| Name %.20s |\n",stocks_tmp->Name);
+ tempString.sprintf("| Name %s ",stocks_tmp->Name);
+ tempString.stripWhiteSpace();
+ if(donameCheck)
+ output +=tempString;
+ } else {
+ // printf("| Name | %-20s |\n",stocks_tmp->Name);
+ tempString.sprintf("| Name %s ",stocks_tmp->Name);
+ tempString.stripWhiteSpace();
+ if(donameCheck)
+ output +=tempString;
+ }
+ }
+ else {
+ // printf("| Name | |\n");
+ tempString.sprintf("| Name | |");
+ if(donameCheck)
+ output +=tempString;
+ }
+
+ // printf("| Price | %-7.2f |\n", stocks_tmp->CurrentPrice);
+ tempString.sprintf("| Price %-7.2f ", stocks_tmp->CurrentPrice);
+ if(docurrentPriceCheck)
+ output +=tempString;
+
+ // printf("| Yesterday | %-7.2f |\n",stocks_tmp->LastPrice);
+ tempString.sprintf("| Yesterday %-7.2f ",stocks_tmp->LastPrice);
+ if(dolastPriceCheck)
+ output +=tempString;
+
+ // printf("| Open | %-7.2f |\n",stocks_tmp->OpenPrice);
+ tempString.sprintf("| Open %-7.2f ",stocks_tmp->OpenPrice);
+ if(doopenPriceCheck)
+ output +=tempString;
+
+ // printf("| Min | %-7.2f |\n", stocks_tmp->MinPrice);
+ tempString.sprintf("| Min %-7.2f ", stocks_tmp->MinPrice);
+ if(dominPriceCheck)
+ output +=tempString;
+
+ // printf("| Max | %-7.2f |\n",stocks_tmp->MaxPrice);
+ tempString.sprintf("| Max %-7.2f ",stocks_tmp->MaxPrice);
+ if(domaxPriceCheck)
+ output +=tempString;
+
+ // printf("| Var | %-6.2f (%5.2f %%) |\n", stocks_tmp->Variation, stocks_tmp->Pourcentage);
+ tempString.sprintf("| Var %-6.2f (%5.2f %%) ", stocks_tmp->Variation, stocks_tmp->Pourcentage);
+ if(dovariationCheck)
+ output +=tempString;
+
+ // printf("| Volume | %-9d |\n", stocks_tmp->Volume);
+ tempString.sprintf("| Volume %-9d ", stocks_tmp->Volume);
+ if(dovolumeCheck)
+ output +=tempString;
+
+ // printf("----------------------------------------\n\n");
+ tempString.sprintf("||==++==|");
+ output +=tempString;
+
+ /* Simple function which help to browse in the stocks list */
+ stocks_tmp = next_stock(stocks_tmp);
+ }
+
+ stocktickerTicker->setText( output.latin1() );
+
+ /* frees stocks */
+ free_stocks(stocks_quotes);
+ free_stocks(stocks_tmp);
+
+ stock_liste="";
+ //delete stock_liste;
+ tempString="";
+ output="";
+ }
+
+ StockTickerPluginWidget::StockTickerPluginWidget( QWidget *parent, const char* name)
+ : QWidget(parent, name ) {
+ init();
+ startTimer(1000);
+
+ stocktickerTicker->setTextFormat(Qt::RichText);
+ // checkConnection();
+ }
+
+ StockTickerPluginWidget::~StockTickerPluginWidget() {
+ }
+
+ void StockTickerPluginWidget::init() {
+
+ QHBoxLayout* layout = new QHBoxLayout( this );
+ stocktickerTicker = new OTicker(this);
+ // stocktickerTicker->setMinimumHeight(15);
+ connect( stocktickerTicker, SIGNAL( mousePressed()), this, SLOT( checkConnection() ));
+ layout->addWidget( stocktickerTicker);
+ wasError = true;
+ }
+
+ void StockTickerPluginWidget::doStocks() {
+ Config cfg( "stockticker");
+ cfg.setGroup( "Symbols" );
+ symbollist="";
+ symbollist = cfg.readEntry("Symbols", "");
+ symbollist.replace(QRegExp(" "),"+");//seperated by +
+
+ cfg.setGroup("Timer");
+ stocktickerTicker->setUpdateTime( cfg.readNumEntry("ScrollSpeed",50));
+ stocktickerTicker->setScrollLength( cfg.readNumEntry("ScrollLength",10));
+
+ if (!symbollist.isEmpty()) {
+ pthread_t thread1;
+ char *blah = ::strdup(symbollist.latin1());
+ pthread_create( &thread1, NULL, (void * (*)(void *))getStocks, (void *) blah);
+ pthread_detach( thread1);
+
+ //::free((void*)thread1);
+ //getStocks(blah);
+ }
+ }
+
+ void StockTickerPluginWidget::timerEvent( QTimerEvent *e ) {
+ killTimer(e->timerId());
+ checkConnection();
+ }
+
+ void StockTickerPluginWidget::checkConnection() {
+ // qDebug("checking connection");
+ // Sock = new QSocket( this );
+
+ // if( wasError)
+ // stocktickerTicker->setText("Checking connection");
+
+ // if(Sock->state() == QSocket::Idle) {
+ // Sock->connectToHost("finance.yahoo.com", 80);
+ // connect( Sock, SIGNAL( error(int) ), SLOT(socketError(int)) );
+ // connect( Sock, SIGNAL( hostFound() ), SLOT(isConnected()) );
+ // } else {
+ // qDebug("State is not Idle");
+ isConnected();
+ // }
+ }
+
+ void StockTickerPluginWidget::isConnected() {
+ // qDebug("We connect, so ok to grab stocks");
+ if(this->isVisible())
+ doStocks();
+
+ Config cfg( "stockticker");
+ cfg.setGroup("Timer");
+ timerDelay= cfg.readNumEntry("Delay",0);
+ if(timerDelay > 0)
+ startTimer(timerDelay*60000);
+ // qDebug("timer set for %d",(timerDelay*60000)/60000);
+ wasError = false;
+
+ // Sock->close();
+ }
+
+ void StockTickerPluginWidget::socketError(int errcode) {
+ switch(errcode) {
+ case QSocket::ErrConnectionRefused:
+ output = tr("Connection refused.");
+ break;
+ case QSocket::ErrHostNotFound:
+ output = tr("Could not find server.");
+ break;
+ case QSocket::ErrSocketRead :
+ output = tr("Socket read error.");
+ break;
+ };
+ stocktickerTicker->setText( output );
+ wasError = true;
+ // Sock->close();
+
+ }
diff --git a/noncore/todayplugins/weather/weatherconfig.h b/noncore/todayplugins/weather/weatherconfig.h
index 3877818..d9ffec2 100644
--- a/noncore/todayplugins/weather/weatherconfig.h
+++ b/noncore/todayplugins/weather/weatherconfig.h
@@ -41,6 +41,7 @@ class QSpinBox;
class WeatherPluginConfig : public TodayConfigWidget
{
+ Q_OBJECT
public:
WeatherPluginConfig( QWidget *parent, const char *name );
~WeatherPluginConfig();
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 41c99a8..ecbf12f 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -433,7 +433,8 @@ void Clock::alarmOn()
AlarmServer::addAlarm( when,
"QPE/Application/clock",
"alarm(QDateTime,int)", warn );
- setCaption( "Alarm set: " + whenl.toString() );
+// setCaption( "Alarm set: " + whenl.toString() );
+ setCaption( tr("Alarm set: %1" ).arg(whenl.toString()) );
}
void Clock::alarmOff()
@@ -444,7 +445,7 @@ void Clock::alarmOff()
"QPE/Application/clock",
"alarm(QDateTime,int)", warn );
qDebug( "Alarm Off " + when.toString() );
- setCaption( "Clock" );
+ setCaption( tr("Clock") );
}
void Clock::clearTimer()
@@ -452,7 +453,7 @@ void Clock::clearTimer()
alarmOffBtn->setText( tr( "Alarm Is Off" ) );
alarmBool = FALSE;
snoozeBtn->hide();
- setCaption( "Clock" );
+ setCaption( tr("Clock") );
}
void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ )
diff --git a/noncore/tools/euroconv/main.cpp b/noncore/tools/euroconv/main.cpp
index 2d97f4e..7d69535 100644
--- a/noncore/tools/euroconv/main.cpp
+++ b/noncore/tools/euroconv/main.cpp
@@ -31,7 +31,7 @@ int main( int argc, char **argv ) {
LCDDisplay lcd (layout, "lcd");
KeyPad num(&lcd, layout, "keypad");
app.setMainWidget(layout);
- layout->setCaption("Euroconv");
+ layout->setCaption( QObject::tr("Euroconv") );
layout->showMaximized ();
layout->show();
return app.exec();
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 21de4d2..49f6355 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -400,7 +400,8 @@ void FormatterApp::deviceComboSelected(int index) {
}
fsType = getFileSystemType((const QString &)selectedText);
- TextLabel5->setText(tr("Type: %1\nFormatted with %1\n%1, %1, %1").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS ));
+ TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS ));
+ TextLabel5->setTextFormat( Qt::RichText );
// storageComboSelected(0);
}