-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 @@ -27,18 +27,24 @@ */ -#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" ) ); @@ -52,11 +58,11 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin layout->addWidget( grpbox ); 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; @@ -76,16 +82,16 @@ 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 @@ -27,25 +27,28 @@ */ +#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> #include <qgroupbox.h> #include <qlabel.h> #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 ); layout->setSpacing( 4 ); @@ -56,7 +59,7 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par layout->addWidget( grpbox ); QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); - + forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); grplayout->addWidget( forceDepends ); @@ -71,7 +74,7 @@ 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" ) ); verboseIpkg->insertItem( tr( "Normal messages" ) ); @@ -79,29 +82,28 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par verboseIpkg->insertItem( tr( "Troubleshooting output" ) ); 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() -{ -} +{} int InstallOptionsDlgImpl :: getFlags() 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,6 +1,6 @@ /* This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> .=l. Dan Williams <drw@handhelds.org> .>+-= @@ -27,16 +27,27 @@ */ -#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> #include <qfile.h> @@ -52,22 +63,14 @@ #include <qwhatsthis.h> #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 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; @@ -239,7 +242,7 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) MainWindow :: ~MainWindow() { - delete mgr; + delete mgr; // Reenable suspend mode QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; @@ -296,7 +299,7 @@ void MainWindow :: init() Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); -// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); + // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); #endif @@ -337,8 +340,8 @@ 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 ) ) { @@ -354,7 +357,7 @@ void MainWindow :: displaySettings() if ( dlg->showDlg() ) { stack->raiseWidget( progressWindow ); - updateData(); + updateData(); stack->raiseWidget( networkPkgWindow ); } delete dlg; @@ -582,12 +585,12 @@ 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 ); } @@ -625,10 +628,10 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) packagesList->clear(); #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 int i = 0; @@ -678,7 +681,7 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), - QCheckListItem::CheckBox ); + QCheckListItem::CheckBox ); if ( package->isInstalled() ) { @@ -738,7 +741,7 @@ void MainWindow :: searchForPackage( const QString &text ) start = (QCheckListItem *)packagesList->firstChild(); for ( QCheckListItem *item = start; item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item = (QCheckListItem *)item->nextSibling() ) { if ( item->text().lower().find( text ) != -1 ) { @@ -766,13 +769,13 @@ void MainWindow :: updateServer() ipkg->setOption( "update" ); 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; } void MainWindow :: upgradePackages() @@ -782,9 +785,9 @@ void MainWindow :: upgradePackages() // TODO - ODevice???? 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(); if ( warn.exec() == QMessageBox::Yes ) @@ -797,9 +800,9 @@ void MainWindow :: upgradePackages() ipkg->setOption( "upgrade" ); 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 ); } @@ -815,8 +818,8 @@ void MainWindow :: downloadPackage() if ( serversList->currentText() != LOCAL_SERVER ) { for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 && !found; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 && !found; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) found = true; @@ -836,8 +839,8 @@ 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() ) { @@ -855,7 +858,7 @@ void MainWindow :: downloadPackage() QString msgtext; 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; QFile f( p->getFilename() ); @@ -908,8 +911,8 @@ void MainWindow :: downloadSelectedPackages() ipkg.setOption( "download" ); ipkg.setRuntimeDirectory( dir ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { @@ -926,12 +929,12 @@ void MainWindow :: downloadRemotePackage() QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 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(); item->option = "I"; @@ -942,7 +945,7 @@ 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 ); } @@ -961,8 +964,8 @@ void MainWindow :: applyChanges() QList<InstallData> workingPackages; workingPackages.setAutoDelete( TRUE ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { @@ -971,14 +974,14 @@ void MainWindow :: applyChanges() workingPackages.append( instdata ); else return; - } + } } if ( workingPackages.count() == 0 ) { // Nothing to do QMessageBox::information( this, tr( "Nothing to do" ), - tr( "No packages selected" ), tr( "OK" ) ); + tr( "No packages selected" ), tr( "OK" ) ); return; } @@ -986,7 +989,7 @@ void MainWindow :: applyChanges() // do the stuff 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 ); } @@ -1024,7 +1027,7 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) // If local file, remove using package name, not filename if ( p->isPackageStoredLocally() ) name = item->text(); - + if ( !p->isPackageStoredLocally() ) newitem->packageName = p->getInstalledPackageName(); else @@ -1090,33 +1093,33 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) QuestionDlg dlg( text, msgtext, secondButton ); 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; } } // 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) return newitem; @@ -1138,14 +1141,14 @@ 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 stack->raiseWidget( networkPkgWindow ); @@ -1181,18 +1184,19 @@ void MainWindow :: letterPushed( QString t ) item = (QCheckListItem *)item->nextSibling(); if ( !item ) item = (QCheckListItem *)packagesList->firstChild(); - } while ( item != start); + } + while ( item != start); } 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 ); resize( 175, 100 ); 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 @@ -24,13 +24,21 @@ -- :-=` Free Software Foundation, Inc., 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> #include <qlabel.h> @@ -39,22 +47,16 @@ using namespace std; #include <qlistbox.h> #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 ); layout->setMargin( 2 ); @@ -68,7 +70,7 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); tabwidget->setCurrentTab( tr( "Servers" ) ); - + dataMgr = dataManager; setupData(); changed = false; @@ -78,18 +80,15 @@ 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; } QWidget *SettingsImpl :: initServerTab() @@ -118,18 +117,18 @@ QWidget *SettingsImpl :: initServerTab() QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 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 ); grpbox->layout()->setMargin( 4 ); layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); - + QLabel *label = new QLabel( tr( "Name:" ), grpbox ); grplayout->addWidget( label, 0, 0 ); servername = new QLineEdit( grpbox ); @@ -142,11 +141,11 @@ 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; } @@ -176,18 +175,18 @@ QWidget *SettingsImpl :: initDestinationTab() QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 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 ); grpbox->layout()->setMargin( 4 ); layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); - + QLabel *label = new QLabel( tr( "Name:" ), grpbox ); grplayout->addWidget( label, 0, 0 ); destinationname = new QLineEdit( grpbox ); @@ -200,11 +199,11 @@ 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; } @@ -235,7 +234,7 @@ QWidget *SettingsImpl :: initProxyTab() grplayout->addWidget( txtHttpProxy ); chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); grplayout->addWidget( chkHttpProxyEnabled ); - + grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); grpbox->layout()->setSpacing( 2 ); grpbox->layout()->setMargin( 4 ); @@ -245,7 +244,7 @@ QWidget *SettingsImpl :: initProxyTab() grplayout->addWidget( txtFtpProxy ); chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); grplayout->addWidget( chkFtpProxyEnabled ); - + QLabel *label = new QLabel( tr( "Username:" ), container ); layout->addWidget( label, 2, 0 ); txtUsername = new QLineEdit( container ); @@ -259,7 +258,7 @@ QWidget *SettingsImpl :: initProxyTab() QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); - + return control; } @@ -269,20 +268,20 @@ void SettingsImpl :: setupData() QString serverName; QListIterator<Server> it( dataMgr->getServerList() ); for ( ; it.current(); ++it ) - { + { serverName = it.current()->getServerName(); if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) continue; servers->insertItem( serverName ); - } + } // add destinations QListIterator<Destination> it2( dataMgr->getDestinationList() ); for ( ; it2.current(); ++it2 ) destinations->insertItem( it2.current()->getDestinationName() ); - + // setup proxy tab txtHttpProxy->setText( dataMgr->getHttpProxy() ); txtFtpProxy->setText( dataMgr->getFtpProxy() ); @@ -336,53 +335,53 @@ 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; + } } //------------------ Destinations tab ---------------------- @@ -409,10 +408,10 @@ 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 ); } @@ -429,7 +428,7 @@ void SettingsImpl :: removeDestination() void SettingsImpl :: changeDestinationDetails() { - changed = true; + changed = true; #ifdef QWS Config cfg( "aqpkg" ); @@ -437,46 +436,48 @@ void SettingsImpl :: changeDestinationDetails() #endif 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 QString key = newName; key += "_linkToRoot"; cfg.writeEntry( key, true ); #endif - } + + } } //------------------ Proxy tab ---------------------- |