summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/settingsimpl.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg/settingsimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp243
1 files changed, 122 insertions, 121 deletions
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 4887ceb..9fdf31e 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -26,9 +26,17 @@
Boston, MA 02111-1307, USA.
-
+
*/
-#include <fstream>
-#include <algorithm>
-using namespace std;
+#include "settingsimpl.h"
+#include "global.h"
+/* OPIE */
+#include <opie/otabwidget.h>
+#ifdef QWS
+#include <qpe/config.h>
+#include <qpe/resource.h>
+#endif
+#include <qpe/qpeapplication.h>
+
+/* QT */
#include <qcheckbox.h>
@@ -41,18 +49,12 @@ using namespace std;
-#include <opie/otabwidget.h>
-
-#ifdef QWS
-#include <qpe/config.h>
-#include <qpe/resource.h>
-#endif
-
-#include "settingsimpl.h"
-
-#include "global.h"
+/* STD */
+#include <fstream>
+#include <algorithm>
+using namespace std;
SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl )
+ : QDialog( parent, name, modal, fl )
{
setCaption( tr( "Configuration" ) );
-
+
// Setup layout to make everything pretty
@@ -70,3 +72,3 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
tabwidget->setCurrentTab( tr( "Servers" ) );
-
+
dataMgr = dataManager;
@@ -80,3 +82,2 @@ SettingsImpl :: ~SettingsImpl()
{
-
}
@@ -85,9 +86,7 @@ bool SettingsImpl :: showDlg()
{
- showMaximized();
- exec();
-
- if ( changed )
- dataMgr->writeOutIpkgConf();
+ QPEApplication::execDialog( this );
+ if ( changed )
+ dataMgr->writeOutIpkgConf();
- return changed;
+ return changed;
}
@@ -120,3 +119,3 @@ QWidget *SettingsImpl :: initServerTab()
layout->addWidget( btn, 1, 0 );
-
+
btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
@@ -124,3 +123,3 @@ QWidget *SettingsImpl :: initServerTab()
layout->addWidget( btn, 1, 1 );
-
+
QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
@@ -131,3 +130,3 @@ QWidget *SettingsImpl :: initServerTab()
QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
-
+
QLabel *label = new QLabel( tr( "Name:" ), grpbox );
@@ -144,3 +143,3 @@ QWidget *SettingsImpl :: initServerTab()
grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
-
+
btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
@@ -148,3 +147,3 @@ QWidget *SettingsImpl :: initServerTab()
grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
-
+
return control;
@@ -178,3 +177,3 @@ QWidget *SettingsImpl :: initDestinationTab()
layout->addWidget( btn, 1, 0 );
-
+
btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
@@ -182,3 +181,3 @@ QWidget *SettingsImpl :: initDestinationTab()
layout->addWidget( btn, 1, 1 );
-
+
QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
@@ -189,3 +188,3 @@ QWidget *SettingsImpl :: initDestinationTab()
QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
-
+
QLabel *label = new QLabel( tr( "Name:" ), grpbox );
@@ -202,3 +201,3 @@ QWidget *SettingsImpl :: initDestinationTab()
grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
-
+
btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
@@ -206,3 +205,3 @@ QWidget *SettingsImpl :: initDestinationTab()
grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
-
+
return control;
@@ -237,3 +236,3 @@ QWidget *SettingsImpl :: initProxyTab()
grplayout->addWidget( chkHttpProxyEnabled );
-
+
grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
@@ -247,3 +246,3 @@ QWidget *SettingsImpl :: initProxyTab()
grplayout->addWidget( chkFtpProxyEnabled );
-
+
QLabel *label = new QLabel( tr( "Username:" ), container );
@@ -261,3 +260,3 @@ QWidget *SettingsImpl :: initProxyTab()
layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
-
+
return control;
@@ -271,3 +270,3 @@ void SettingsImpl :: setupData()
for ( ; it.current(); ++it )
- {
+ {
serverName = it.current()->getServerName();
@@ -277,3 +276,3 @@ void SettingsImpl :: setupData()
servers->insertItem( serverName );
- }
+ }
@@ -284,3 +283,3 @@ void SettingsImpl :: setupData()
destinations->insertItem( it2.current()->getDestinationName() );
-
+
// setup proxy tab
@@ -338,42 +337,42 @@ void SettingsImpl :: changeServerDetails()
{
- changed = true;
-
- QString newName = servername->text();
-
- // Convert any spaces to underscores
- char *tmpStr = new char[newName.length() + 1];
- for ( unsigned int i = 0 ; i < newName.length() ; ++i )
- {
- if ( newName[i] == ' ' )
- tmpStr[i] = '_';
- else
- tmpStr[i] = newName[i].latin1();
- }
- tmpStr[newName.length()] = '\0';
-
- newName = tmpStr;
- delete tmpStr;
-
- if ( !newserver )
- {
- Server *s = dataMgr->getServer( servers->currentText() );
- if ( s )
- {
- // Update url
- s->setServerUrl( serverurl->text() );
- s->setActive( active->isChecked() );
-
- // Check if server name has changed, if it has then we need to replace the key in the map
- if ( serverName != newName )
- {
- // Update server name
- s->setServerName( newName );
- }
-
- // Update list box
- servers->changeItem( newName, currentSelectedServer );
- }
- }
- else
- {
+ changed = true;
+
+ QString newName = servername->text();
+
+ // Convert any spaces to underscores
+ char *tmpStr = new char[newName.length() + 1];
+ for ( unsigned int i = 0 ; i < newName.length() ; ++i )
+ {
+ if ( newName[i] == ' ' )
+ tmpStr[i] = '_';
+ else
+ tmpStr[i] = newName[i].latin1();
+ }
+ tmpStr[newName.length()] = '\0';
+
+ newName = tmpStr;
+ delete tmpStr;
+
+ if ( !newserver )
+ {
+ Server *s = dataMgr->getServer( servers->currentText() );
+ if ( s )
+ {
+ // Update url
+ s->setServerUrl( serverurl->text() );
+ s->setActive( active->isChecked() );
+
+ // Check if server name has changed, if it has then we need to replace the key in the map
+ if ( serverName != newName )
+ {
+ // Update server name
+ s->setServerName( newName );
+ }
+
+ // Update list box
+ servers->changeItem( newName, currentSelectedServer );
+ }
+ }
+ else
+ {
Server s( newName, serverurl->text() );
@@ -381,6 +380,6 @@ void SettingsImpl :: changeServerDetails()
dataMgr->getServerList().last()->setActive( active->isChecked() );
- servers->insertItem( newName );
- servers->setCurrentItem( servers->count() );
- newserver = false;
- }
+ servers->insertItem( newName );
+ servers->setCurrentItem( servers->count() );
+ newserver = false;
+ }
}
@@ -411,6 +410,6 @@ void SettingsImpl :: newDestination()
{
- newdestination = true;
- destinationname->setText( "" );
- destinationurl->setText( "" );
- destinationname->setFocus();
+ newdestination = true;
+ destinationname->setText( "" );
+ destinationurl->setText( "" );
+ destinationname->setFocus();
linkToRoot->setChecked( true );
@@ -431,3 +430,3 @@ void SettingsImpl :: changeDestinationDetails()
{
- changed = true;
+ changed = true;
@@ -439,35 +438,36 @@ void SettingsImpl :: changeDestinationDetails()
QString newName = destinationname->text();
- if ( !newdestination )
- {
- Destination *d = dataMgr->getDestination( destinations->currentText() );
- if ( d )
- {
- // Update url
- d->setDestinationPath( destinationurl->text() );
- d->linkToRoot( linkToRoot->isChecked() );
-
- // Check if server name has changed, if it has then we need to replace the key in the map
- if ( destinationName != newName )
- {
- // Update server name
- d->setDestinationName( newName );
-
- // Update list box
- destinations->changeItem( newName, currentSelectedDestination );
- }
+ if ( !newdestination )
+ {
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
+ if ( d )
+ {
+ // Update url
+ d->setDestinationPath( destinationurl->text() );
+ d->linkToRoot( linkToRoot->isChecked() );
+
+ // Check if server name has changed, if it has then we need to replace the key in the map
+ if ( destinationName != newName )
+ {
+ // Update server name
+ d->setDestinationName( newName );
+
+ // Update list box
+ destinations->changeItem( newName, currentSelectedDestination );
+ }
#ifdef QWS
- QString key = newName;
- key += "_linkToRoot";
- int val = d->linkToRoot();
- cfg.writeEntry( key, val );
-#endif
- }
- }
- else
- {
- dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
- destinations->insertItem( newName );
- destinations->setCurrentItem( destinations->count() );
- newdestination = false;
+ QString key = newName;
+ key += "_linkToRoot";
+ int val = d->linkToRoot();
+ cfg.writeEntry( key, val );
+#endif
+
+ }
+ }
+ else
+ {
+ dataMgr->getDestinationList().append( new Destination( newName, destinationurl->text() ) );
+ destinations->insertItem( newName );
+ destinations->setCurrentItem( destinations->count() );
+ newdestination = false;
@@ -478,3 +478,4 @@ void SettingsImpl :: changeDestinationDetails()
#endif
- }
+
+ }
}