summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings.cpp52
1 files changed, 23 insertions, 29 deletions
diff --git a/noncore/settings/networksettings2/networksettings.cpp b/noncore/settings/networksettings2/networksettings.cpp
index 6ee4106..ce0eabc 100644
--- a/noncore/settings/networksettings2/networksettings.cpp
+++ b/noncore/settings/networksettings2/networksettings.cpp
@@ -1,20 +1,22 @@
#include <stdio.h>
#include <unistd.h>
+#include <errno.h>
#include <qpe/qpeapplication.h>
#include <qlistbox.h>
#include <qgroupbox.h>
#include <qtimer.h>
#include <qlistbox.h>
#include <qmessagebox.h>
#include <qlabel.h>
#include <qiconview.h>
#include <qtimer.h>
#include <qpe/qpeapplication.h>
#include <qtoolbutton.h>
+#include <qevent.h>
#include <asdevice.h>
#include "networksettings.h"
#include "netnode.h"
#include "editconnection.h"
@@ -38,12 +40,19 @@ NetworkSettings::NetworkSettings( QWidget *parent,
On_TB->setPixmap( NSResources->getPixmap( "off" ) );
SLOT_ToProfile();
// populate main Listbox
Profiles_LB->clear();
+ QPEApplication::setStylusOperation(
+ Profiles_LB->viewport(), QPEApplication::RightOnHold );
+
+ connect( Profiles_LB,
+ SIGNAL(rightButtonPressed(QListBoxItem*,const QPoint&)),
+ this, SLOT(SLOT_EditNode(QListBoxItem*)) );
+
{ Name2Connection_t & M = NSResources->connections();
NodeCollection * NC;
// for all connections
for( QDictIterator<NodeCollection> it(M);
it.current();
++it ) {
@@ -75,28 +84,24 @@ NetworkSettings::NetworkSettings( QWidget *parent,
this, SLOT(SLOT_QCopMessage(const QCString&,const QByteArray&)) );
}
NetworkSettings::~NetworkSettings() {
QString S;
- S = NSD.generateSettings();
- if( ! S.isEmpty() ) {
- QMessageBox::warning(
- 0,
- tr( "In System Config" ),
- S
- );
- }
+ if( isModified() ) {
+ S = NSD.saveSettings();
+ if( ! S.isEmpty() ) {
+ // problem saving
+ QMessageBox::warning(
+ 0,
+ tr( "Saving setup" ), S );
+ }
- S = NSD.saveSettings();
- if( ! S.isEmpty() ) {
- // problem saving
- QMessageBox::warning(
- 0,
- tr( "Saving setup" ), S );
+ SLOT_GenerateConfig();
}
+
}
void NetworkSettings::SLOT_CmdMessage( const QString & S ) {
Messages_LB->insertItem( S );
Messages_LB->setCurrentItem( Messages_LB->count()-1 );
Messages_LB->ensureCurrentVisible();
@@ -142,15 +147,12 @@ void NetworkSettings::SLOT_RefreshStates( void ) {
}
if( ci >= 0 )
Profiles_LB->setCurrentItem( ci );
*/
}
-void NetworkSettings::SLOT_NoLongerBusy( void ) {
- NSResources->busy( FALSE );
-}
void NetworkSettings::SLOT_AddNode( void ) {
SLOT_EditNode( 0 );
}
void NetworkSettings::SLOT_DeleteNode( void ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
@@ -163,18 +165,19 @@ void NetworkSettings::SLOT_DeleteNode( void ) {
tr( "Removing profile" ),
tr( "Remove selected profile ?" ),
1, 0 ) == 1 ) {
NSResources->removeConnection( LBI->text() );
delete LBI;
setModified( 1 );
- NSD.forceGeneration(1);
}
}
void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
QString OldName = "";
+
+ printf( "------------------ Edit NOde\n" );
EditConnection EC( this );
if( LBI ) {
NodeCollection * NC = NSResources->findConnection( LBI->text() );
if( ! NC ) {
return;
@@ -183,14 +186,13 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) {
EC.setConnection( NC );
}
EC.showMaximized();
// disable refresh timer
UpdateTimer->stop();
- NSResources->busy( TRUE );
- QTimer::singleShot( 1000, this, SLOT( SLOT_NoLongerBusy() ));
+
// we need to retry
while( 1 ) {
if( EC.exec() == QDialog::Accepted ) {
// toplevel item -> store
NodeCollection * NC = EC.connection();
if( NC->isModified() ) {
@@ -316,21 +318,13 @@ void NetworkSettings::updateProfileState( QListBoxItem * LBI ) {
if( LBI == Profiles_LB->item( Profiles_LB->currentItem() ) ) {
SLOT_ShowNode( LBI );
}
}
void NetworkSettings::SLOT_GenerateConfig( void ) {
- QString S = NSD.generateSettings( TRUE );
-
- if( ! S.isEmpty() ) {
- QMessageBox::warning(
- 0,
- tr( "Generating system configuration" ),
- S
- );
- }
+ NSD.regenerate();
}
void NetworkSettings::SLOT_Enable( void ) {
QListBoxItem * LBI = Profiles_LB->item( Profiles_LB->currentItem() );
QString Msg;
if ( ! LBI )