Diffstat (limited to 'noncore/settings/networksettings2/networksettings.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings.cpp | 42 |
1 files changed, 18 insertions, 24 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,6 +1,7 @@ #include <stdio.h> #include <unistd.h> +#include <errno.h> #include <qpe/qpeapplication.h> #include <qlistbox.h> #include <qgroupbox.h> @@ -11,8 +12,9 @@ #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" @@ -40,8 +42,15 @@ NetworkSettings::NetworkSettings( QWidget *parent, 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); @@ -77,24 +86,20 @@ NetworkSettings::NetworkSettings( QWidget *parent, 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 ); } + + SLOT_GenerateConfig(); + } + } void NetworkSettings::SLOT_CmdMessage( const QString & S ) { Messages_LB->insertItem( S ); @@ -144,11 +149,8 @@ void NetworkSettings::SLOT_RefreshStates( void ) { Profiles_LB->setCurrentItem( ci ); */ } -void NetworkSettings::SLOT_NoLongerBusy( void ) { - NSResources->busy( FALSE ); -} void NetworkSettings::SLOT_AddNode( void ) { SLOT_EditNode( 0 ); } @@ -165,14 +167,15 @@ void NetworkSettings::SLOT_DeleteNode( void ) { 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() ); @@ -185,10 +188,9 @@ void NetworkSettings::SLOT_EditNode( QListBoxItem * LBI ) { 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 @@ -318,17 +320,9 @@ void NetworkSettings::updateProfileState( QListBoxItem * 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() ); |