author | ar <ar> | 2004-02-21 16:02:01 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 16:02:01 (UTC) |
commit | db2afda83e495bff9fc19fa14a30072f1cd4c67a (patch) (side-by-side diff) | |
tree | 0281ec10dad24d83179283370661ae9225016de0 /noncore/settings/aqpkg | |
parent | 460258f203be746ff79e14f32a823f381b8ea513 (diff) | |
download | opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.zip opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.tar.gz opie-db2afda83e495bff9fc19fa14a30072f1cd4c67a.tar.bz2 |
improve support for BigScreen
-rw-r--r-- | noncore/settings/aqpkg/categoryfilterimpl.cpp | 28 | ||||
-rw-r--r-- | noncore/settings/aqpkg/instoptionsimpl.cpp | 44 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 176 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 243 |
4 files changed, 252 insertions, 239 deletions
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp index 61e1f93..217d2c9 100644 --- a/noncore/settings/aqpkg/categoryfilterimpl.cpp +++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp @@ -28,16 +28,22 @@ */ -#include <iostream> -using namespace std; +#include "categoryfilterimpl.h" + +/* OPIE */ +#include <qpe/qpeapplication.h> +/* QT */ #include <qgroupbox.h> -#include <qlayout.h> +#include <qlayout.h> #include <qlistbox.h> #include <qstring.h> -#include "categoryfilterimpl.h" +/* STD */ +#include <iostream> +using namespace std; + CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name ) - : QDialog( parent, name, true ) + : QDialog( parent, name, true ) { setCaption( tr( "Category Filter" ) ); @@ -53,9 +59,9 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); - + lstCategories = new QListBox( grpbox ); lstCategories->setSelectionMode( QListBox::Multi ); grplayout->addWidget( lstCategories ); - + // Split up categories and add them to the listbox int start = 1; @@ -77,14 +83,14 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin start = end + 1; - } while ( start < (int)categories.length() ); + } + while ( start < (int)categories.length() ); lstCategories->sort( true ); - showMaximized(); + QPEApplication::showDialog( this ); } CategoryFilterImpl :: ~CategoryFilterImpl() -{ -} +{} QString CategoryFilterImpl :: getSelectedFilter() diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp index 9d52013..126e3b9 100644 --- a/noncore/settings/aqpkg/instoptionsimpl.cpp +++ b/noncore/settings/aqpkg/instoptionsimpl.cpp @@ -28,8 +28,15 @@ */ +#include "global.h" +#include "instoptionsimpl.h" +#include "ipkg.h" + +/* OPIE */ #ifdef QWS #include <qpe/config.h> #endif +#include <qpe/qpeapplication.h> +/* QT */ #include <qcheckbox.h> #include <qcombobox.h> @@ -38,13 +45,9 @@ #include <qlayout.h> -#include "global.h" -#include "instoptionsimpl.h" -#include "ipkg.h" - InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * parent, const char* name, bool modal, WFlags fl ) - : QDialog( parent, name, modal, fl ) + : QDialog( parent, name, modal, fl ) { setCaption( tr( "Options" ) ); - + QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 2 ); @@ -57,5 +60,5 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); - + forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); grplayout->addWidget( forceDepends ); @@ -72,5 +75,5 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par QLabel *l = new QLabel( tr( "Information Level" ), grpbox ); grplayout->addWidget( l ); - + verboseIpkg = new QComboBox( grpbox ); verboseIpkg->insertItem( tr( "Errors only" ) ); @@ -80,27 +83,26 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par verboseIpkg->setCurrentItem( verb ); grplayout->addWidget( verboseIpkg ); - + grplayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); - + if ( flags & FORCE_DEPENDS ) - forceDepends->setChecked( true ); + forceDepends->setChecked( true ); if ( flags & FORCE_REINSTALL ) - forceReinstall->setChecked( true ); + forceReinstall->setChecked( true ); if ( flags & FORCE_REMOVE ) - forceRemove->setChecked( true ); + forceRemove->setChecked( true ); if ( flags & FORCE_OVERWRITE ) - forceOverwrite->setChecked( true ); -// if ( flags & VERBOSE_WGET ) -// verboseWget->setChecked( true ); -// if ( flags & MAKE_LINKS ) -// makeLinks->setChecked( true ); + forceOverwrite->setChecked( true ); + // if ( flags & VERBOSE_WGET ) + // verboseWget->setChecked( true ); + // if ( flags & MAKE_LINKS ) + // makeLinks->setChecked( true ); - showMaximized(); + QPEApplication::showDialog( this ); } InstallOptionsDlgImpl::~InstallOptionsDlgImpl() -{ -} +{} diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index dbe694e..6f5c712 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -1,5 +1,5 @@ /* This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> .=l. Dan Williams <drw@handhelds.org> @@ -28,14 +28,25 @@ */ -#include <linux/limits.h> -#include <unistd.h> +#include "categoryfilterimpl.h" +#include "datamgr.h" +#include "global.h" +#include "inputdlg.h" +#include "ipkg.h" +#include "installdlgimpl.h" +#include "letterpushbutton.h" +#include "mainwin.h" +#include "packagewin.h" +#include "settingsimpl.h" +#include "utils.h" +/* OPIE */ #include <qpe/qcopenvelope_qws.h> -#include <qmenubar.h> #include <qpe/qpeapplication.h> -#include <qtoolbar.h> #include <qpe/config.h> #include <qpe/resource.h> +/* QT */ +#include <qmenubar.h> +#include <qtoolbar.h> #include <qaction.h> #include <qcombobox.h> @@ -53,20 +64,12 @@ #include <qwidgetstack.h> -#include "categoryfilterimpl.h" -#include "datamgr.h" -#include "global.h" -#include "inputdlg.h" -#include "ipkg.h" -#include "installdlgimpl.h" -#include "letterpushbutton.h" -#include "mainwin.h" -#include "packagewin.h" -#include "settingsimpl.h" -#include "utils.h" +/* STD */ +#include <linux/limits.h> +#include <unistd.h> extern int compareVersions( const char *v1, const char *v2 ); MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) - : QMainWindow( parent, name, fl || WStyle_ContextHelp ) + : QMainWindow( parent, name, fl || WStyle_ContextHelp ) { // Disable suspend mode @@ -240,5 +243,5 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) MainWindow :: ~MainWindow() { - delete mgr; + delete mgr; // Reenable suspend mode @@ -297,5 +300,5 @@ void MainWindow :: init() cfg.setGroup( "settings" ); currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); -// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); + // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); #endif @@ -338,6 +341,6 @@ void MainWindow :: setDocument( const QString &doc ) // Now set the check box of the selected package for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->text().startsWith( package ) ) @@ -355,5 +358,5 @@ void MainWindow :: displaySettings() { stack->raiseWidget( progressWindow ); - updateData(); + updateData(); stack->raiseWidget( networkPkgWindow ); } @@ -583,10 +586,10 @@ void MainWindow :: updateData() serversList->insertItem( serverName ); if ( serverName == currentlySelectedServer ) - activeItem = i; - } + activeItem = i; + } - // set selected server to be active server - if ( activeItem != -1 ) - serversList->setCurrentItem( activeItem ); + // set selected server to be active server + if ( activeItem != -1 ) + serversList->setCurrentItem( activeItem ); serverSelected( 0, FALSE ); } @@ -626,8 +629,8 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) #ifdef QWS - // read download directory from config file - Config cfg( "aqpkg" ); - cfg.setGroup( "settings" ); - cfg.writeEntry( "selectedServer", currentlySelectedServer ); + // read download directory from config file + Config cfg( "aqpkg" ); + cfg.setGroup( "settings" ); + cfg.writeEntry( "selectedServer", currentlySelectedServer ); #endif @@ -679,5 +682,5 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), - QCheckListItem::CheckBox ); + QCheckListItem::CheckBox ); if ( package->isInstalled() ) @@ -739,5 +742,5 @@ void MainWindow :: searchForPackage( const QString &text ) for ( QCheckListItem *item = start; item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item = (QCheckListItem *)item->nextSibling() ) { if ( item->text().lower().find( text ) != -1 ) @@ -767,11 +770,11 @@ void MainWindow :: updateServer() InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), - tr( "Update lists" ) ); + tr( "Update lists" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); - reloadDocuments = FALSE; + reloadDocuments = FALSE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); -// delete progDlg; + // delete progDlg; } @@ -783,7 +786,7 @@ void MainWindow :: upgradePackages() QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, - QMessageBox::Yes, - QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , - 0, this ); + QMessageBox::Yes, + QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , + 0, this ); warn.adjustSize(); @@ -798,7 +801,7 @@ void MainWindow :: upgradePackages() InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), - tr ( "Upgrade" ) ); + tr ( "Upgrade" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); - reloadDocuments = TRUE; + reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); @@ -816,6 +819,6 @@ void MainWindow :: downloadPackage() { for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 && !found; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 && !found; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) @@ -837,6 +840,6 @@ void MainWindow :: downloadPackage() doUpdate = false; for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) @@ -856,5 +859,5 @@ void MainWindow :: downloadPackage() msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); if ( QMessageBox::information( this, tr( "Are you sure?" ), - msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) + msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) { doUpdate = true; @@ -909,6 +912,6 @@ void MainWindow :: downloadSelectedPackages() ipkg.setRuntimeDirectory( dir ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) @@ -927,10 +930,10 @@ void MainWindow :: downloadRemotePackage() if ( !ok || package.isEmpty() ) return; -// DownloadRemoteDlgImpl dlg( this, "Install", true ); -// if ( dlg.exec() == QDialog::Rejected ) -// return; + // DownloadRemoteDlgImpl dlg( this, "Install", true ); + // if ( dlg.exec() == QDialog::Rejected ) + // return; // grab details from dialog -// QString package = dlg.getPackageLocation(); + // QString package = dlg.getPackageLocation(); InstallData *item = new InstallData(); @@ -943,5 +946,5 @@ void MainWindow :: downloadRemotePackage() InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); - reloadDocuments = TRUE; + reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); @@ -962,6 +965,6 @@ void MainWindow :: applyChanges() workingPackages.setAutoDelete( TRUE ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) @@ -972,5 +975,5 @@ void MainWindow :: applyChanges() else return; - } + } } @@ -979,5 +982,5 @@ void MainWindow :: applyChanges() // Nothing to do QMessageBox::information( this, tr( "Nothing to do" ), - tr( "No packages selected" ), tr( "OK" ) ); + tr( "No packages selected" ), tr( "OK" ) ); return; @@ -987,5 +990,5 @@ void MainWindow :: applyChanges() InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); - reloadDocuments = TRUE; + reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); @@ -1025,5 +1028,5 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) if ( p->isPackageStoredLocally() ) name = item->text(); - + if ( !p->isPackageStoredLocally() ) newitem->packageName = p->getInstalledPackageName(); @@ -1091,22 +1094,22 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) switch( dlg.exec() ) { - case 0: // Cancel - delete newitem; - return 0x0; - break; - case 1: // Remove - newitem->option = "D"; - // If local file, remove using package name, not filename - if ( p->isPackageStoredLocally() ) - name = item->text(); - break; - case 2: // Reinstall or Upgrade - newitem->option = secondOption; - break; + case 0: // Cancel + delete newitem; + return 0x0; + break; + case 1: // Remove + newitem->option = "D"; + // If local file, remove using package name, not filename + if ( p->isPackageStoredLocally() ) + name = item->text(); + break; + case 2: // Reinstall or Upgrade + newitem->option = secondOption; + break; } } else { -// newitem->option = stickyOption; + // newitem->option = stickyOption; } } @@ -1115,7 +1118,7 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) // Check if we are reinstalling the same version if ( newitem->option != "R" ) - newitem->recreateLinks = true; + newitem->recreateLinks = true; else - newitem->recreateLinks = false; + newitem->recreateLinks = false; // User hit cancel (on dlg - assume remove) @@ -1139,12 +1142,12 @@ void MainWindow :: reloadData( InstallDlgImpl *dlg ) #ifdef QWS if ( reloadDocuments ) - { - m_status->setText( tr( "Updating Launcher..." ) ); - - // Finally let the main system update itself - QCopEnvelope e("QPE/System", "linkChanged(QString)"); - QString lf = QString::null; - e << lf; - } + { + m_status->setText( tr( "Updating Launcher..." ) ); + + // Finally let the main system update itself + QCopEnvelope e("QPE/System", "linkChanged(QString)"); + QString lf = QString::null; + e << lf; + } #endif @@ -1182,5 +1185,6 @@ void MainWindow :: letterPushed( QString t ) if ( !item ) item = (QCheckListItem *)packagesList->firstChild(); - } while ( item != start); + } + while ( item != start); } @@ -1189,9 +1193,9 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item ) QString itemstr( ((QCheckListItem*)item)->text() ); PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); - p->showMaximized(); + QPEApplication::showWidget( p ); } QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) - : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) + : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) { setCaption( caption ); 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 @@ -25,11 +25,19 @@ 59 Temple Place - Suite 330, 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> #include <qgroupbox.h> @@ -40,20 +48,14 @@ using namespace std; #include <qpushbutton.h> -#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 QVBoxLayout *layout = new QVBoxLayout( this ); @@ -69,5 +71,5 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); tabwidget->setCurrentTab( tr( "Servers" ) ); - + dataMgr = dataManager; setupData(); @@ -79,16 +81,13 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const SettingsImpl :: ~SettingsImpl() { - } bool SettingsImpl :: showDlg() { - showMaximized(); - exec(); - - if ( changed ) - dataMgr->writeOutIpkgConf(); + QPEApplication::execDialog( this ); + if ( changed ) + dataMgr->writeOutIpkgConf(); - return changed; + return changed; } @@ -119,9 +118,9 @@ QWidget *SettingsImpl :: initServerTab() connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); layout->addWidget( btn, 1, 0 ); - + btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); layout->addWidget( btn, 1, 1 ); - + QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); grpbox->layout()->setSpacing( 2 ); @@ -130,5 +129,5 @@ QWidget *SettingsImpl :: initServerTab() QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); - + QLabel *label = new QLabel( tr( "Name:" ), grpbox ); grplayout->addWidget( label, 0, 0 ); @@ -143,9 +142,9 @@ QWidget *SettingsImpl :: initServerTab() active = new QCheckBox( tr( "Active Server" ), grpbox ); grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); - + btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); - + return control; } @@ -177,9 +176,9 @@ QWidget *SettingsImpl :: initDestinationTab() connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); layout->addWidget( btn, 1, 0 ); - + btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); layout->addWidget( btn, 1, 1 ); - + QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); grpbox->layout()->setSpacing( 2 ); @@ -188,5 +187,5 @@ QWidget *SettingsImpl :: initDestinationTab() QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); - + QLabel *label = new QLabel( tr( "Name:" ), grpbox ); grplayout->addWidget( label, 0, 0 ); @@ -201,9 +200,9 @@ QWidget *SettingsImpl :: initDestinationTab() linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); - + btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); - + return control; } @@ -236,5 +235,5 @@ QWidget *SettingsImpl :: initProxyTab() chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); grplayout->addWidget( chkHttpProxyEnabled ); - + grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); grpbox->layout()->setSpacing( 2 ); @@ -246,5 +245,5 @@ QWidget *SettingsImpl :: initProxyTab() chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); grplayout->addWidget( chkFtpProxyEnabled ); - + QLabel *label = new QLabel( tr( "Username:" ), container ); layout->addWidget( label, 2, 0 ); @@ -260,5 +259,5 @@ QWidget *SettingsImpl :: initProxyTab() connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); - + return control; } @@ -270,5 +269,5 @@ void SettingsImpl :: setupData() QListIterator<Server> it( dataMgr->getServerList() ); for ( ; it.current(); ++it ) - { + { serverName = it.current()->getServerName(); if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) @@ -276,5 +275,5 @@ void SettingsImpl :: setupData() servers->insertItem( serverName ); - } + } @@ -283,5 +282,5 @@ void SettingsImpl :: setupData() for ( ; it2.current(); ++it2 ) destinations->insertItem( it2.current()->getDestinationName() ); - + // setup proxy tab txtHttpProxy->setText( dataMgr->getHttpProxy() ); @@ -337,51 +336,51 @@ void SettingsImpl :: removeServer() 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() ); dataMgr->getServerList().append( new Server( newName, serverurl->text() ) ); dataMgr->getServerList().last()->setActive( active->isChecked() ); - servers->insertItem( newName ); - servers->setCurrentItem( servers->count() ); - newserver = false; - } + servers->insertItem( newName ); + servers->setCurrentItem( servers->count() ); + newserver = false; + } } @@ -410,8 +409,8 @@ void SettingsImpl :: editDestination( int sel ) void SettingsImpl :: newDestination() { - newdestination = true; - destinationname->setText( "" ); - destinationurl->setText( "" ); - destinationname->setFocus(); + newdestination = true; + destinationname->setText( "" ); + destinationurl->setText( "" ); + destinationname->setFocus(); linkToRoot->setChecked( true ); } @@ -430,5 +429,5 @@ void SettingsImpl :: removeDestination() void SettingsImpl :: changeDestinationDetails() { - changed = true; + changed = true; #ifdef QWS @@ -438,37 +437,38 @@ 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; #ifdef QWS @@ -477,5 +477,6 @@ void SettingsImpl :: changeDestinationDetails() cfg.writeEntry( key, true ); #endif - } + + } } |