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 @@ -29,7 +29,10 @@ -#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> @@ -37,6 +40,9 @@ using namespace std; -#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 ) { @@ -54,3 +60,3 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); - + lstCategories = new QListBox( grpbox ); @@ -58,3 +64,3 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin grplayout->addWidget( lstCategories ); - + // Split up categories and add them to the listbox @@ -78,3 +84,4 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin start = end + 1; - } while ( start < (int)categories.length() ); + } + while ( start < (int)categories.length() ); @@ -82,3 +89,3 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin - showMaximized(); + QPEApplication::showDialog( this ); } @@ -86,4 +93,3 @@ CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QStrin CategoryFilterImpl :: ~CategoryFilterImpl() -{ -} +{} 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 @@ -29,2 +29,7 @@ +#include "global.h" +#include "instoptionsimpl.h" +#include "ipkg.h" + +/* OPIE */ #ifdef QWS @@ -32,3 +37,5 @@ #endif +#include <qpe/qpeapplication.h> +/* QT */ #include <qcheckbox.h> @@ -39,11 +46,7 @@ -#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 ); @@ -58,3 +61,3 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); - + forceDepends = new QCheckBox( tr( "Force Depends" ), grpbox ); @@ -73,3 +76,3 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par grplayout->addWidget( l ); - + verboseIpkg = new QComboBox( grpbox ); @@ -81,19 +84,19 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par 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 ); @@ -102,4 +105,3 @@ InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, int verb, QWidget * par 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 @@ -2,3 +2,3 @@ This file is part of the OPIE Project - + =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> @@ -29,9 +29,17 @@ -#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> @@ -39,2 +47,5 @@ +/* QT */ +#include <qmenubar.h> +#include <qtoolbar.h> #include <qaction.h> @@ -54,13 +65,5 @@ -#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> @@ -69,3 +72,3 @@ 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 ) { @@ -241,3 +244,3 @@ MainWindow :: ~MainWindow() { - delete mgr; + delete mgr; @@ -298,3 +301,3 @@ void MainWindow :: init() currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); -// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); + // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); @@ -339,4 +342,4 @@ void MainWindow :: setDocument( const QString &doc ) for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -356,3 +359,3 @@ void MainWindow :: displaySettings() stack->raiseWidget( progressWindow ); - updateData(); + updateData(); stack->raiseWidget( networkPkgWindow ); @@ -584,8 +587,8 @@ void MainWindow :: updateData() 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 ); @@ -627,6 +630,6 @@ 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 @@ -680,3 +683,3 @@ void MainWindow :: serverSelected( int, bool raiseProgress ) QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), - QCheckListItem::CheckBox ); + QCheckListItem::CheckBox ); @@ -740,3 +743,3 @@ void MainWindow :: searchForPackage( const QString &text ) for ( QCheckListItem *item = start; item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item = (QCheckListItem *)item->nextSibling() ) { @@ -768,5 +771,5 @@ 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 ); @@ -774,3 +777,3 @@ void MainWindow :: updateServer() -// delete progDlg; + // delete progDlg; } @@ -784,5 +787,5 @@ void MainWindow :: upgradePackages() 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(); @@ -799,5 +802,5 @@ 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 ); @@ -817,4 +820,4 @@ void MainWindow :: downloadPackage() for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 && !found; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 && !found; + item = (QCheckListItem *)item->nextSibling() ) { @@ -838,4 +841,4 @@ void MainWindow :: downloadPackage() for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -857,3 +860,3 @@ void MainWindow :: downloadPackage() if ( QMessageBox::information( this, tr( "Are you sure?" ), - msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) + msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) { @@ -910,4 +913,4 @@ void MainWindow :: downloadSelectedPackages() for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -928,8 +931,8 @@ void MainWindow :: downloadRemotePackage() 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(); @@ -944,3 +947,3 @@ void MainWindow :: downloadRemotePackage() connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); - reloadDocuments = TRUE; + reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); @@ -963,4 +966,4 @@ void MainWindow :: applyChanges() for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); - item != 0 ; - item = (QCheckListItem *)item->nextSibling() ) + item != 0 ; + item = (QCheckListItem *)item->nextSibling() ) { @@ -973,3 +976,3 @@ void MainWindow :: applyChanges() return; - } + } } @@ -980,3 +983,3 @@ void MainWindow :: applyChanges() QMessageBox::information( this, tr( "Nothing to do" ), - tr( "No packages selected" ), tr( "OK" ) ); + tr( "No packages selected" ), tr( "OK" ) ); @@ -988,3 +991,3 @@ void MainWindow :: applyChanges() connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); - reloadDocuments = TRUE; + reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); @@ -1026,3 +1029,3 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) name = item->text(); - + if ( !p->isPackageStoredLocally() ) @@ -1092,15 +1095,15 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) { - 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; } @@ -1109,3 +1112,3 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) { -// newitem->option = stickyOption; + // newitem->option = stickyOption; } @@ -1116,5 +1119,5 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) if ( newitem->option != "R" ) - newitem->recreateLinks = true; + newitem->recreateLinks = true; else - newitem->recreateLinks = false; + newitem->recreateLinks = false; @@ -1140,10 +1143,10 @@ void MainWindow :: reloadData( InstallDlgImpl *dlg ) 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 @@ -1183,3 +1186,4 @@ void MainWindow :: letterPushed( QString t ) item = (QCheckListItem *)packagesList->firstChild(); - } while ( item != start); + } + while ( item != start); } @@ -1190,3 +1194,3 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item ) PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); - p->showMaximized(); + QPEApplication::showWidget( p ); } @@ -1194,3 +1198,3 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item ) 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 ) { 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 - } + + } } |