author | drw <drw> | 2003-02-04 17:52:14 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-04 17:52:14 (UTC) |
commit | 294f0a9b5e5678a6eba1fb77943201fac804049f (patch) (side-by-side diff) | |
tree | b37638264f6bd22bb0894025ea70037294f15c9d | |
parent | 328aeec813c953b260a992afc53a5c9d812e1bcf (diff) | |
download | opie-294f0a9b5e5678a6eba1fb77943201fac804049f.zip opie-294f0a9b5e5678a6eba1fb77943201fac804049f.tar.gz opie-294f0a9b5e5678a6eba1fb77943201fac804049f.tar.bz2 |
Updates to configure dialog
-rw-r--r-- | noncore/settings/aqpkg/.cvsignore | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 3 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settings.ui | 872 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.cpp | 237 | ||||
-rw-r--r-- | noncore/settings/aqpkg/settingsimpl.h | 45 |
6 files changed, 239 insertions, 922 deletions
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore index 751040e..12658fc 100644 --- a/noncore/settings/aqpkg/.cvsignore +++ b/noncore/settings/aqpkg/.cvsignore @@ -1,8 +1,6 @@ Makefile* instoptions.cpp instoptions.h moc* -settings.cpp -settings.h categoryfilter.cpp categoryfilter.h diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index d3f898b..f66fd95 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro @@ -1,63 +1,62 @@ TEMPLATE = app CONFIG = qt warn_on release HEADERS = global.h \ mainwin.h \ datamgr.h \ settingsimpl.h \ ipkg.h \ package.h \ installdlgimpl.h \ instoptionsimpl.h \ destination.h \ utils.h \ server.h \ helpwindow.h \ letterpushbutton.h \ inputdlg.h \ categoryfilterimpl.h SOURCES = mainwin.cpp \ datamgr.cpp \ mem.cpp \ settingsimpl.cpp \ ipkg.cpp \ main.cpp \ package.cpp \ installdlgimpl.cpp \ instoptionsimpl.cpp \ destination.cpp \ utils.cpp \ server.cpp \ helpwindow.cpp \ letterpushbutton.cpp \ inputdlg.cpp \ version.cpp \ categoryfilterimpl.cpp -INTERFACES = settings.ui \ - instoptions.ui \ +INTERFACES = instoptions.ui \ categoryfilter.ui TARGET = aqpkg INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -lstdc++ DESTDIR = $(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ ../../../i18n/xx/aqpkg.ts \ ../../../i18n/en/aqpkg.ts \ ../../../i18n/es/aqpkg.ts \ ../../../i18n/fr/aqpkg.ts \ ../../../i18n/hu/aqpkg.ts \ ../../../i18n/ja/aqpkg.ts \ ../../../i18n/ko/aqpkg.ts \ ../../../i18n/no/aqpkg.ts \ ../../../i18n/pl/aqpkg.ts \ ../../../i18n/pt/aqpkg.ts \ ../../../i18n/pt_BR/aqpkg.ts \ ../../../i18n/sl/aqpkg.ts \ ../../../i18n/zh_CN/aqpkg.ts \ ../../../i18n/zh_TW/aqpkg.ts \ ../../../i18n/it/aqpkg.ts \ ../../../i18n/da/aqpkg.ts include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 947aace..361946c 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -1,1186 +1,1186 @@ /*************************************************************************** mainwin.cpp - description ------------------- begin : Mon Aug 26 13:32:30 BST 2002 copyright : (C) 2002 by Andy Qua email : andy.qua@blueyonder.co.uk ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <linux/limits.h> #include <unistd.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpemenubar.h> #include <qpe/qpeapplication.h> #include <qpe/qpetoolbar.h> #include <qpe/config.h> #include <qpe/resource.h> #include <qaction.h> #include <qcombobox.h> #include <qfile.h> #include <qlabel.h> #include <qlayout.h> #include <qlineedit.h> #include <qlistview.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qprogressbar.h> #include <qtimer.h> #include <qwhatsthis.h> #include <qwidgetstack.h> #include "categoryfilterimpl.h" #include "datamgr.h" #include "global.h" #include "helpwindow.h" #include "inputdlg.h" #include "ipkg.h" #include "installdlgimpl.h" #include "letterpushbutton.h" #include "mainwin.h" #include "settingsimpl.h" #include "utils.h" extern int compareVersions( const char *v1, const char *v2 ); MainWindow :: MainWindow() : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { setCaption( tr( "AQPkg - Package Manager" ) ); // Create UI widgets initMainWidget(); initProgressWidget(); // Build menu and tool bars setToolBarsMovable( FALSE ); QPEToolBar *bar = new QPEToolBar( this ); bar->setHorizontalStretchable( TRUE ); QPEMenuBar *mb = new QPEMenuBar( bar ); mb->setMargin( 0 ); bar = new QPEToolBar( this ); // Find toolbar findBar = new QPEToolBar( this ); addToolBar( findBar, QMainWindow::Top, true ); findBar->setHorizontalStretchable( true ); findEdit = new QLineEdit( findBar ); QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); findBar->setStretchableWidget( findEdit ); connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); // Quick jump toolbar jumpBar = new QPEToolBar( this ); addToolBar( jumpBar, QMainWindow::Top, true ); jumpBar->setHorizontalStretchable( true ); QWidget *w = new QWidget( jumpBar ); jumpBar->setStretchableWidget( w ); QGridLayout *layout = new QGridLayout( w ); char text[2]; text[1] = '\0'; for ( int i = 0 ; i < 26 ; ++i ) { text[0] = 'A' + i; LetterPushButton *b = new LetterPushButton( text, w ); connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); layout->addWidget( b, i / 13, i % 13); } QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); a->addTo( jumpBar ); jumpBar->hide(); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); a->addTo( popup ); a->addTo( bar ); actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( bar ); iconDownload = Resource::loadPixmap( "aqpkg/download" ); iconRemove = Resource::loadPixmap( "aqpkg/remove" ); actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); actionDownload->addTo( popup ); actionDownload->addTo( bar ); a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); a->addTo( popup ); a->addTo( bar ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); actionUninstalled->setToggleAction( TRUE ); actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); actionUninstalled->addTo( popup ); actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); actionInstalled->setToggleAction( TRUE ); actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); actionInstalled->addTo( popup ); actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); actionUpdated->setToggleAction( TRUE ); actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); actionUpdated->addTo( popup ); popup->insertSeparator(); actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); actionFilter->setToggleAction( TRUE ); actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); actionFilter->addTo( popup ); a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); a->addTo( popup ); popup->insertSeparator(); a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to search for text in package names." ) ); connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); a->addTo( popup ); actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); actionFindNext->setEnabled( FALSE ); actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); actionFindNext->addTo( popup ); actionFindNext->addTo( findBar ); popup->insertSeparator(); a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); a->addTo( popup ); mb->insertItem( tr( "View" ), popup ); // Options menu popup = new QPopupMenu( this ); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to configure this application." ) ); connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); a->addTo( popup ); popup->insertSeparator(); a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here for help." ) ); connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); a->addTo( popup ); a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here for software version information." ) ); connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); a->addTo( popup ); mb->insertItem( tr( "Options" ), popup ); // Finish find toolbar creation a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); a->addTo( findBar ); findBar->hide(); // Create widget stack and add UI widgets stack = new QWidgetStack( this ); stack->addWidget( progressWindow, 2 ); stack->addWidget( networkPkgWindow, 1 ); setCentralWidget( stack ); stack->raiseWidget( progressWindow ); // Delayed call to finish initialization QTimer::singleShot( 100, this, SLOT( init() ) ); } MainWindow :: ~MainWindow() { delete mgr; } void MainWindow :: initMainWidget() { networkPkgWindow = new QWidget( this ); QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); serversList = new QComboBox( networkPkgWindow ); connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); installedIcon = Resource::loadPixmap( "aqpkg/installed" ); updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); packagesList = new QListView( networkPkgWindow ); packagesList->addColumn( tr( "Packages" ), 225 ); QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); hbox1->addWidget( l ); hbox1->addWidget( serversList ); vbox->addWidget( packagesList ); downloadEnabled = TRUE; } void MainWindow :: initProgressWidget() { progressWindow = new QWidget( this ); QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); m_status = new QLabel( progressWindow ); m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); layout->addWidget( m_status ); m_progress = new QProgressBar( progressWindow ); layout->addWidget( m_progress ); } void MainWindow :: init() { #ifdef QWS // read download directory from config file Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); #endif stack->raiseWidget( progressWindow ); mgr = new DataManager(); connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), this, SLOT( setProgressMessage( const QString & ) ) ); connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); mgr->loadServers(); showUninstalledPkgs = false; showInstalledPkgs = false; showUpgradedPkgs = false; categoryFilterEnabled = false; updateData(); stack->raiseWidget( networkPkgWindow ); } /* void MainWindow :: setDocument( const QString &doc ) { // Remove path from package QString package = Utils::getPackageNameFromIpkFilename( doc ); // std::cout << "Selecting package " << package << std::endl; // First select local server for ( int i = 0 ; i < serversList->count() ; ++i ) { if ( serversList->text( i ) == LOCAL_IPKGS ) { serversList->setCurrentItem( i ); break; } } serverSelected( 0 ); // Now set the check box of the selected package for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->text().startsWith( package ) ) { item->setOn( true ); break; } } } */ void MainWindow :: displaySettings() { SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); - if ( dlg->showDlg( 0 ) ) + if ( dlg->showDlg() ) { stack->raiseWidget( progressWindow ); updateData(); stack->raiseWidget( networkPkgWindow ); } delete dlg; } void MainWindow :: displayHelp() { HelpWindow *dlg = new HelpWindow( this ); dlg->exec(); delete dlg; } void MainWindow :: displayFindBar() { findBar->show(); findEdit->setFocus(); } void MainWindow :: displayJumpBar() { jumpBar->show(); } void MainWindow :: repeatFind() { searchForPackage( findEdit->text() ); } void MainWindow :: findPackage( const QString &text ) { actionFindNext->setEnabled( !text.isEmpty() ); searchForPackage( text ); } void MainWindow :: hideFindBar() { findBar->hide(); } void MainWindow :: hideJumpBar() { jumpBar->hide(); } void MainWindow :: displayAbout() { QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); } void MainWindow :: filterUninstalledPackages() { showUninstalledPkgs = actionUninstalled->isOn(); if ( showUninstalledPkgs ) { showInstalledPkgs = FALSE; showUpgradedPkgs = FALSE; } serverSelected( -1 ); actionInstalled->setOn( FALSE ); actionUpdated->setOn( FALSE ); } void MainWindow :: filterInstalledPackages() { showInstalledPkgs = actionInstalled->isOn(); if ( showInstalledPkgs ) { showUninstalledPkgs = FALSE; showUpgradedPkgs = FALSE; } serverSelected( -1 ); actionUninstalled->setOn( FALSE ); actionUpdated->setOn( FALSE ); } void MainWindow :: filterUpgradedPackages() { showUpgradedPkgs = actionUpdated->isOn(); if ( showUpgradedPkgs ) { showUninstalledPkgs = FALSE; showInstalledPkgs = FALSE; } serverSelected( -1 ); actionUninstalled->setOn( FALSE ); actionInstalled->setOn( FALSE ); } bool MainWindow :: setFilterCategory() { // Get categories; CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); if ( dlg.exec() == QDialog::Accepted ) { categoryFilter = dlg.getSelectedFilter(); if ( categoryFilter == "" ) return false; categoryFilterEnabled = true; serverSelected( -1 ); actionFilter->setOn( TRUE ); return true; } return false; } void MainWindow :: filterCategory() { if ( !actionFilter->isOn() ) { filterByCategory( FALSE ); } else { actionFilter->setOn( filterByCategory( TRUE ) ); } } bool MainWindow :: filterByCategory( bool val ) { if ( val ) { if ( categoryFilter == "" ) { if ( !setFilterCategory() ) return false; } categoryFilterEnabled = true; serverSelected( -1 ); return true; } else { // Turn off filter categoryFilterEnabled = false; serverSelected( -1 ); return false; } } void MainWindow :: raiseMainWidget() { stack->raiseWidget( networkPkgWindow ); } void MainWindow :: raiseProgressWidget() { stack->raiseWidget( progressWindow ); } void MainWindow :: enableUpgrade( bool enabled ) { actionUpgrade->setEnabled( enabled ); } void MainWindow :: enableDownload( bool enabled ) { if ( enabled ) { actionDownload->setIconSet( iconDownload ); actionDownload->setText( tr( "Download" ) ); actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); } else { actionDownload->setIconSet( iconRemove ); actionDownload->setText( tr( "Remove" ) ); actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); } } void MainWindow :: setProgressSteps( int numsteps ) { m_progress->setTotalSteps( numsteps ); } void MainWindow :: setProgressMessage( const QString &msg ) { m_status->setText( msg ); } void MainWindow :: updateProgress( int progress ) { m_progress->setProgress( progress ); } void MainWindow :: updateData() { m_progress->setTotalSteps( mgr->getServerList().size() ); serversList->clear(); packagesList->clear(); vector<Server>::iterator it; int activeItem = -1; int i; QString serverName; for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i ) { serverName = it->getServerName(); m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); m_progress->setProgress( i ); qApp->processEvents(); // cout << "Adding " << it->getServerName() << " to combobox" << endl; if ( !it->isServerActive() ) { // cout << serverName << " is not active" << endl; i--; continue; } serversList->insertItem( serverName ); if ( serverName == currentlySelectedServer ) activeItem = i; } // set selected server to be active server if ( activeItem != -1 ) serversList->setCurrentItem( activeItem ); serverSelected( 0, FALSE ); } void MainWindow :: serverSelected( int index ) { serverSelected( index, TRUE ); } void MainWindow :: serverSelected( int, bool raiseProgress ) { QPixmap nullIcon( installedIcon.size() ); nullIcon.fill( colorGroup().base() ); // display packages QString serverName = serversList->currentText(); currentlySelectedServer = serverName; vector<Server>::iterator s = mgr->getServer( serverName ); vector<Package> &list = s->getPackageList(); vector<Package>::iterator it; // Display progress widget while loading list bool doProgress = ( list.size() > 200 ); if ( doProgress ) { if ( raiseProgress ) { stack->raiseWidget( progressWindow ); } m_progress->setTotalSteps( list.size() ); m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); } packagesList->clear(); #ifdef QWS // read download directory from config file Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); cfg.writeEntry( "selectedServer", currentlySelectedServer ); #endif int i = 0; for ( it = list.begin() ; it != list.end() ; ++it ) { // Update progress after every 100th package (arbitrary value, seems to give good balance) i++; if ( ( i % 100 ) == 0 ) { if ( doProgress ) { m_progress->setProgress( i ); } qApp->processEvents(); } QString text = ""; // Apply show only uninstalled packages filter if ( showUninstalledPkgs && it->isInstalled() ) continue; // Apply show only installed packages filter if ( showInstalledPkgs && !it->isInstalled() ) continue; // Apply show only new installed packages filter if ( showUpgradedPkgs ) { if ( !it->isInstalled() || compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) continue; } // Apply the section filter if ( categoryFilterEnabled && categoryFilter != "" ) { if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) continue; } // If the local server, only display installed packages if ( serverName == LOCAL_SERVER && !it->isInstalled() ) continue; QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); if ( it->isInstalled() ) { // If a different version of package is available, show update available icon // Otherwise, show installed icon if ( it->getVersion() != it->getInstalledVersion() && compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) { item->setPixmap( 0, updatedIcon ); } else { item->setPixmap( 0, installedIcon ); } QString destName = ""; if ( it->getLocalPackage() ) { if ( it->getLocalPackage()->getInstalledTo() ) destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); } else { if ( it->getInstalledTo() ) destName = it->getInstalledTo()->getDestinationName(); } if ( destName != "" ) new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); } else { item->setPixmap( 0, nullIcon ); } if ( !it->isPackageStoredLocally() ) { new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); } else new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); if ( serverName == LOCAL_SERVER ) { new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); } else { new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); if ( it->getLocalPackage() ) { if ( it->isInstalled() ) new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); } } packagesList->insertItem( item ); } // If the local server or the local ipkgs server disable the download button if ( serverName == LOCAL_SERVER ) { downloadEnabled = TRUE; actionUpgrade->setEnabled( FALSE ); } else if ( serverName == LOCAL_IPKGS ) { downloadEnabled = FALSE; actionUpgrade->setEnabled( FALSE ); } else { downloadEnabled = TRUE; actionUpgrade->setEnabled( TRUE ); } enableDownload( downloadEnabled ); // Display this widget once everything is done if ( doProgress && raiseProgress ) { stack->raiseWidget( networkPkgWindow ); } } void MainWindow :: searchForPackage( const QString &text ) { if ( !text.isEmpty() ) { // cout << "searching for " << text << endl; // look through package list for text startng at current position vector<InstallData> workingPackages; QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); // if ( start != 0 ) // start = (QCheckListItem *)start->nextSibling(); if ( start == 0 ) start = (QCheckListItem *)packagesList->firstChild(); for ( QCheckListItem *item = start; item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { // cout << "checking " << item->text().lower() << endl; if ( item->text().lower().find( text ) != -1 ) { // cout << "matched " << item->text() << endl; packagesList->ensureItemVisible( item ); packagesList->setCurrentItem( item ); break; } } } } void MainWindow :: updateServer() { QString serverName = serversList->currentText(); // Update the current server // Display dialog // Disable buttons to stop silly people clicking lots on them :) // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); Ipkg *ipkg = new Ipkg; ipkg->setOption( "update" ); InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), tr( "Update lists" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); dlg->showMaximized(); // delete progDlg; } void MainWindow :: upgradePackages() { // We're gonna do an upgrade of all packages // First warn user that this isn't recommended // 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 ); warn.adjustSize(); if ( warn.exec() == QMessageBox::Yes ) { // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); // Now run upgrade Ipkg *ipkg = new Ipkg; ipkg->setOption( "upgrade" ); InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), tr ( "Upgrade" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); dlg->showMaximized(); } } void MainWindow :: downloadPackage() { bool doUpdate = true; if ( downloadEnabled ) { // See if any packages are selected bool found = false; if ( serversList->currentText() != LOCAL_SERVER ) { for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 && !found; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) found = true; } } // If user selected some packages then download the and store the locally // otherwise, display dialog asking user what package to download from an http server // and whether to install it if ( found ) downloadSelectedPackages(); else downloadRemotePackage(); } else { doUpdate = false; for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { QString name = item->text(); int pos = name.find( "*" ); name.truncate( pos ); // if (there is a (installed), remove it pos = name.find( "(installed)" ); if ( pos > 0 ) name.truncate( pos - 1 ); Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); 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 ) { doUpdate = true; QFile f( p->getFilename() ); f.remove(); } } } } if ( doUpdate ) { reloadData( 0x0 ); } } void MainWindow :: downloadSelectedPackages() { // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); // Display dialog to user asking where to download the files to bool ok = FALSE; QString dir = ""; #ifdef QWS // read download directory from config file Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); #endif QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); if ( ok && !text.isEmpty() ) dir = text; // user entered something and pressed ok else return; // user entered nothing or pressed cancel #ifdef QWS // Store download directory in config file cfg.writeEntry( "downloadDir", dir ); #endif // Get starting directory char initDir[PATH_MAX]; getcwd( initDir, PATH_MAX ); // Download each package Ipkg ipkg; connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); ipkg.setOption( "download" ); ipkg.setRuntimeDirectory( dir ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { ipkg.setPackage( item->text() ); ipkg.runIpkg( ); } } } void MainWindow :: downloadRemotePackage() { // Display dialog bool ok; 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; // grab details from dialog // QString package = dlg.getPackageLocation(); InstallData item; item.option = "I"; item.packageName = package; vector<InstallData> workingPackages; workingPackages.push_back( item ); InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); dlg->showMaximized(); } void MainWindow :: applyChanges() { stickyOption = ""; // First, write out ipkg_conf file so that ipkg can use it mgr->writeOutIpkgConf(); // Now for each selected item // deal with it vector<InstallData> workingPackages; for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { InstallData data = dealWithItem( item ); workingPackages.push_back( data ); } } if ( workingPackages.size() == 0 ) { // Nothing to do QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); return; } // do the stuff InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); dlg->showMaximized(); } // decide what to do - either remove, upgrade or install // Current rules: // If not installed - install // If installed and different version available - upgrade // If installed and version up to date - remove InstallData MainWindow :: dealWithItem( QCheckListItem *item ) { QString name = item->text(); // Get package vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); Package *p = s->getPackage( name ); // If the package has a filename then it is a local file if ( p->isPackageStoredLocally() ) name = p->getFilename(); QString option; QString dest = "root"; if ( !p->isInstalled() ) { InstallData item; item.option = "I"; item.packageName = name; return item; } else { InstallData item; item.option = "D"; if ( !p->isPackageStoredLocally() ) item.packageName = p->getInstalledPackageName(); else item.packageName = name; if ( p->getInstalledTo() ) { item.destination = p->getInstalledTo(); // cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; // cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; } else { item.destination = p->getLocalPackage()->getInstalledTo(); } // Now see if version is newer or not int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); // If the version requested is older and user selected a local ipk file, then reinstall the file if ( p->isPackageStoredLocally() && val == -1 ) val = 0; if ( val == -2 ) { // Error - should handle } else if ( val == -1 ) { // Version available is older - remove only item.option = "D"; } else { QString caption; QString text; QString secondButton; QString secondOption; if ( val == 0 ) { // Version available is the same - option to remove or reinstall caption = tr( "Do you wish to remove or reinstall\n%1?" ); text = tr( "Remove or ReInstall" ); secondButton = tr( "ReInstall" ); secondOption = tr( "R" ); } else if ( val == 1 ) { // Version available is newer - option to remove or upgrade caption = tr( "Do you wish to remove or upgrade\n%1?" ); text = tr( "Remove or Upgrade" ); secondButton = tr( "Upgrade" ); secondOption = tr( "U" ); } // Sticky option not implemented yet, but will eventually allow // the user to say something like 'remove all' if ( stickyOption == "" ) { QString msgtext; msgtext = caption.arg( ( const char * )name ); switch( QMessageBox::information( this, text, msgtext, tr( "Remove" ), secondButton ) ) { case 0: // Try again or Enter // option 0 = Remove item.option = "D"; break; case 1: // Quit or Escape item.option = secondOption; break; } } else { // item.option = stickyOption; } } // Check if we are reinstalling the same version if ( item.option != "R" ) item.recreateLinks = true; else item.recreateLinks = false; // User hit cancel (on dlg - assume remove) return item; } } void MainWindow :: reloadData( InstallDlgImpl *dlg ) { stack->raiseWidget( progressWindow ); if ( dlg ) { dlg->close(); delete dlg; } mgr->reloadServerData(); serverSelected( -1, FALSE ); #ifdef QWS 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 ); } void MainWindow :: letterPushed( QString t ) { QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); if ( packagesList->firstChild() == 0 ) return; QCheckListItem *item; if ( start == 0 ) { item = (QCheckListItem *)packagesList->firstChild(); start = top; } else item = (QCheckListItem *)start->nextSibling(); if ( item == 0 ) item = (QCheckListItem *)packagesList->firstChild(); do { if ( item->text().lower().startsWith( t.lower() ) ) { packagesList->setSelected( item, true ); packagesList->ensureItemVisible( item ); break; } item = (QCheckListItem *)item->nextSibling(); if ( !item ) item = (QCheckListItem *)packagesList->firstChild(); } while ( item != start); } diff --git a/noncore/settings/aqpkg/settings.ui b/noncore/settings/aqpkg/settings.ui deleted file mode 100644 index 2db0768..0000000 --- a/noncore/settings/aqpkg/settings.ui +++ b/dev/null @@ -1,872 +0,0 @@ -<!DOCTYPE UI><UI> -<class>SettingsBase</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>Settings</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>238</width> - <height>353</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Configuration</string> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QTabWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>TabWidget</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Servers</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout2</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>Servers</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Servers</string> - </property> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer2</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget row="1" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout8</cstring> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" rowspan="1" colspan="2" > - <class>QListBox</class> - <property stdset="1"> - <name>name</name> - <cstring>servers</cstring> - </property> - <property stdset="1"> - <name>selectionMode</name> - <enum>Extended</enum> - </property> - </widget> - <widget row="2" column="0" rowspan="1" colspan="2" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout6</cstring> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="2" column="1" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>active</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Active Server</string> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Name:</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2_3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>URL:</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>servername</cstring> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>serverurl</cstring> - </property> - </widget> - <widget row="3" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>btnChangeServer</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Change</string> - </property> - </widget> - </grid> - </widget> - <widget row="1" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>removeserver</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>Remove</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> - </property> - </widget> - <widget row="1" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>newserver</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>New</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> - </property> - </widget> - </grid> - </widget> - </grid> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Destinations</string> - </attribute> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout3</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>Destinations</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Destinations</string> - </property> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer2_2</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> - <widget row="2" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout5</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>newdestination</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>New</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>removedestination</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>Remove</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> - </property> - </widget> - </hbox> - </widget> - <spacer row="0" column="0" > - <property> - <name>name</name> - <cstring>Spacer3</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - <widget row="1" column="0" > - <class>QListBox</class> - <property stdset="1"> - <name>name</name> - <cstring>destinations</cstring> - </property> - <property stdset="1"> - <name>selectionMode</name> - <enum>Single</enum> - </property> - </widget> - <widget row="3" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout13</cstring> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3_2_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>URL:</string> - </property> - </widget> - <widget row="3" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>btnChangeDest</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Change</string> - </property> - </widget> - <widget row="0" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>destinationname</cstring> - </property> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_3_2</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Name:</string> - </property> - </widget> - <widget row="2" column="1" > - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>linkToRoot</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Link To Root</string> - </property> - <property stdset="1"> - <name>checked</name> - <bool>true</bool> - </property> - </widget> - <widget row="1" column="1" > - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>destinationurl</cstring> - </property> - </widget> - </grid> - </widget> - </grid> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>Proxies</string> - </attribute> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1_2</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>1</x> - <y>19</y> - <width>67</width> - <height>22</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>HTTP Proxy</string> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>txtFtpProxy</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>72</y> - <width>110</width> - <height>22</height> - </rect> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>txtHttpProxy</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>19</y> - <width>110</width> - <height>22</height> - </rect> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel4</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>1</x> - <y>153</y> - <width>67</width> - <height>22</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Password</string> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>txtUsername</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>125</y> - <width>110</width> - <height>22</height> - </rect> - </property> - </widget> - <widget> - <class>QLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>txtPassword</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>153</y> - <width>110</width> - <height>22</height> - </rect> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>chkFtpProxyEnabled</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>100</y> - <width>110</width> - <height>19</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Enabled</string> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel2</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>1</x> - <y>72</y> - <width>67</width> - <height>22</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>FTP Proxy</string> - </property> - </widget> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>1</x> - <y>125</y> - <width>67</width> - <height>22</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Username</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>chkHttpProxyEnabled</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>47</y> - <width>110</width> - <height>19</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Enabled</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>btnProxyApply</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>74</x> - <y>181</y> - <width>110</width> - <height>28</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>&Apply</string> - </property> - </widget> - </widget> - <widget> - <class>QWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>tab</cstring> - </property> - <attribute> - <name>title</name> - <string>General</string> - </attribute> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>20</x> - <y>30</y> - <width>150</width> - <height>20</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>(Will take effect on restart)</string> - </property> - </widget> - <widget> - <class>QCheckBox</class> - <property stdset="1"> - <name>name</name> - <cstring>jumpTo</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>17</x> - <y>14</y> - <width>150</width> - <height>20</height> - </rect> - </property> - <property stdset="1"> - <name>text</name> - <string>Show Jump To Letters</string> - </property> - </widget> - </widget> - </widget> - </grid> -</widget> -<connections> - <connection> - <sender>newserver</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>newServer()</slot> - </connection> - <connection> - <sender>removeserver</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>removeServer()</slot> - </connection> - <connection> - <sender>newdestination</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>newDestination()</slot> - </connection> - <connection> - <sender>removedestination</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>removeDestination()</slot> - </connection> - <connection> - <sender>servers</sender> - <signal>highlighted(int)</signal> - <receiver>Settings</receiver> - <slot>editServer(int)</slot> - </connection> - <connection> - <sender>destinations</sender> - <signal>highlighted(int)</signal> - <receiver>Settings</receiver> - <slot>editDestination(int)</slot> - </connection> - <connection> - <sender>btnChangeServer</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>changeServerDetails()</slot> - </connection> - <connection> - <sender>btnChangeDest</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>changeDestinationDetails()</slot> - </connection> - <connection> - <sender>jumpTo</sender> - <signal>toggled(bool)</signal> - <receiver>Settings</receiver> - <slot>toggleJumpTo(bool)</slot> - </connection> - <connection> - <sender>btnProxyApply</sender> - <signal>clicked()</signal> - <receiver>Settings</receiver> - <slot>proxyApplyChanges()</slot> - </connection> - <slot access="public">activeServerChanged()</slot> - <slot access="public">changeDestinationDetails()</slot> - <slot access="public">changeServerDetails()</slot> - <slot access="public">createLinksToDest()</slot> - <slot access="public">destNameChanged(const QString&)</slot> - <slot access="public">destUrlChanged(const QString&)</slot> - <slot access="public">editDestination(int)</slot> - <slot access="public">editServer(int)</slot> - <slot access="public">installationSettingChange(int)</slot> - <slot access="public">installationSettingSetName(const QString &)</slot> - <slot access="public">linkEnabled(bool)</slot> - <slot access="public">newDestination()</slot> - <slot access="public">newInstallationSetting()</slot> - <slot access="public">newServer()</slot> - <slot access="public">proxyApplyChanges()</slot> - <slot access="public">removeDestination()</slot> - <slot access="public">removeInstallationSetting()</slot> - <slot access="public">removeLinksToDest()</slot> - <slot access="public">removeServer()</slot> - <slot access="public">renameInstallationSetting()</slot> - <slot access="public">serverNameChanged(const QString&)</slot> - <slot access="public">serverUrlChanged(const QString&)</slot> - <slot access="public">toggleJumpTo(bool)</slot> -</connections> -<tabstops> - <tabstop>servers</tabstop> - <tabstop>newserver</tabstop> - <tabstop>removeserver</tabstop> - <tabstop>servername</tabstop> - <tabstop>serverurl</tabstop> - <tabstop>active</tabstop> - <tabstop>btnChangeServer</tabstop> - <tabstop>TabWidget</tabstop> - <tabstop>destinations</tabstop> - <tabstop>newdestination</tabstop> - <tabstop>removedestination</tabstop> - <tabstop>destinationname</tabstop> - <tabstop>destinationurl</tabstop> - <tabstop>linkToRoot</tabstop> - <tabstop>btnChangeDest</tabstop> - <tabstop>jumpTo</tabstop> -</tabstops> -</UI> diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 4bb928a..c5a55d2 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -1,267 +1,438 @@ /*************************************************************************** settingsimpl.cpp - description ------------------- begin : Thu Aug 29 2002 copyright : (C) 2002 by Andy Qua email : andy.qua@blueyonder.co.uk ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include <fstream> #include <algorithm> using namespace std; -#include <qlistbox.h> +#include <qcheckbox.h> +#include <qgroupbox.h> +#include <qlabel.h> +#include <qlayout.h> #include <qlineedit.h> +#include <qlistbox.h> #include <qpushbutton.h> -#include <qtabwidget.h> -#include <qcheckbox.h> + +#include <opie/otabwidget.h> #ifdef QWS #include <qpe/config.h> +#include <qpe/resource.h> #endif #include "settingsimpl.h" #include "global.h" SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) - : SettingsBase( 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 ); + layout->setSpacing( 4 ); + + // Setup tabs for all info + OTabWidget *tabwidget = new OTabWidget( this ); + layout->addWidget( tabwidget ); + + tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); + tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); + tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); + tabwidget->setCurrentTab( tr( "Servers" ) ); + dataMgr = dataManager; - setupData(); changed = false; newserver = false; newdestination = false; } SettingsImpl :: ~SettingsImpl() { } -bool SettingsImpl :: showDlg( int i ) +bool SettingsImpl :: showDlg() { - TabWidget->setCurrentPage( i ); showMaximized(); exec(); if ( changed ) dataMgr->writeOutIpkgConf(); return changed; } +QWidget *SettingsImpl :: initServerTab() +{ + QWidget *control = new QWidget( this ); + + QVBoxLayout *vb = new QVBoxLayout( control ); + + QScrollView *sv = new QScrollView( control ); + vb->addWidget( sv, 0, 0 ); + sv->setResizePolicy( QScrollView::AutoOneFit ); + sv->setFrameStyle( QFrame::NoFrame ); + + QWidget *container = new QWidget( sv->viewport() ); + sv->addChild( container ); + + QGridLayout *layout = new QGridLayout( container ); + layout->setSpacing( 2 ); + layout->setMargin( 4 ); + + servers = new QListBox( container ); + servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); + connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); + layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); + + 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 ); + grplayout->addWidget( servername, 0, 1 ); + + label = new QLabel( tr( "Address:" ), grpbox ); + grplayout->addWidget( label, 1, 0 ); + serverurl = new QLineEdit( grpbox ); + grplayout->addWidget( serverurl, 1, 1 ); + + 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; +} + +QWidget *SettingsImpl :: initDestinationTab() +{ + QWidget *control = new QWidget( this ); + + QVBoxLayout *vb = new QVBoxLayout( control ); + + QScrollView *sv = new QScrollView( control ); + vb->addWidget( sv, 0, 0 ); + sv->setResizePolicy( QScrollView::AutoOneFit ); + sv->setFrameStyle( QFrame::NoFrame ); + + QWidget *container = new QWidget( sv->viewport() ); + sv->addChild( container ); + + QGridLayout *layout = new QGridLayout( container ); + layout->setSpacing( 2 ); + layout->setMargin( 4 ); + + destinations = new QListBox( container ); + destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); + connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); + layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); + + 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 ); + grplayout->addWidget( destinationname, 0, 1 ); + + label = new QLabel( tr( "Location:" ), grpbox ); + grplayout->addWidget( label, 1, 0 ); + destinationurl = new QLineEdit( grpbox ); + grplayout->addWidget( destinationurl, 1, 1 ); + + 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; +} + +QWidget *SettingsImpl :: initProxyTab() +{ + QWidget *control = new QWidget( this ); + + QVBoxLayout *vb = new QVBoxLayout( control ); + + QScrollView *sv = new QScrollView( control ); + vb->addWidget( sv, 0, 0 ); + sv->setResizePolicy( QScrollView::AutoOneFit ); + sv->setFrameStyle( QFrame::NoFrame ); + + QWidget *container = new QWidget( sv->viewport() ); + sv->addChild( container ); + + QGridLayout *layout = new QGridLayout( container ); + layout->setSpacing( 2 ); + layout->setMargin( 4 ); + + QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); + grpbox->layout()->setSpacing( 2 ); + grpbox->layout()->setMargin( 4 ); + layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); + QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); + txtHttpProxy = new QLineEdit( grpbox ); + 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 ); + layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); + grplayout = new QVBoxLayout( grpbox->layout() ); + txtFtpProxy = new QLineEdit( grpbox ); + 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 ); + layout->addWidget( txtUsername, 2, 1 ); + + label = new QLabel( tr( "Password:" ), container ); + layout->addWidget( label, 3, 0 ); + txtPassword = new QLineEdit( container ); + layout->addWidget( txtPassword, 3, 1 ); + + 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; +} + void SettingsImpl :: setupData() { // add servers vector<Server>::iterator it; for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it ) { if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS ) continue; servers->insertItem( it->getServerName() ); } + // add destinations vector<Destination>::iterator it2; for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) destinations->insertItem( it2->getDestinationName() ); - - // setup general tab -#ifdef QWS - Config cfg( "aqpkg" ); - cfg.setGroup( "settings" ); - jumpTo->setChecked( cfg.readBoolEntry( "showJumpTo", "true" ) ); -#else - jumpTo->setChecked( true ); -#endif - + // setup proxy tab txtHttpProxy->setText( dataMgr->getHttpProxy() ); txtFtpProxy->setText( dataMgr->getFtpProxy() ); txtUsername->setText( dataMgr->getProxyUsername() ); txtPassword->setText( dataMgr->getProxyPassword() ); chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); } //------------------ Servers tab ---------------------- void SettingsImpl :: editServer( int sel ) { - currentSelectedServer = sel; + currentSelectedServer = sel; vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); serverName = s->getServerName(); servername->setText( s->getServerName() ); serverurl->setText( s->getServerUrl() ); active->setChecked( s->isServerActive() ); } void SettingsImpl :: newServer() { - newserver = true; - servername->setText( "" ); - serverurl->setText( "" ); - servername->setFocus(); + newserver = true; + servername->setText( "" ); + serverurl->setText( "" ); + servername->setFocus(); active->setChecked( true ); } void SettingsImpl :: removeServer() { changed = true; vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); dataMgr->getServerList().erase( s ); servers->removeItem( currentSelectedServer ); } void SettingsImpl :: changeServerDetails() { changed = true; QString newName = servername->text(); if ( !newserver ) { vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); // 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 ); // See if this server is the active server // if ( dataMgr->getActiveServer() == serverName ) // dataMgr->setActiveServer( newName ); // Update list box servers->changeItem( newName, currentSelectedServer ); } } else { Server s( newName, serverurl->text() ); dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); dataMgr->getServerList().end()->setActive( active->isChecked() ); servers->insertItem( newName ); servers->setCurrentItem( servers->count() ); newserver = false; } } //------------------ Destinations tab ---------------------- void SettingsImpl :: editDestination( int sel ) { currentSelectedDestination = sel; vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); destinationName = d->getDestinationName(); destinationname->setText( d->getDestinationName() ); destinationurl->setText( d->getDestinationPath() ); linkToRoot->setChecked( d->linkToRoot() ); } void SettingsImpl :: newDestination() { newdestination = true; destinationname->setText( "" ); destinationurl->setText( "" ); destinationname->setFocus(); linkToRoot->setChecked( true ); } void SettingsImpl :: removeDestination() { changed = true; vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); dataMgr->getDestinationList().erase( d ); destinations->removeItem( currentSelectedDestination ); } void SettingsImpl :: changeDestinationDetails() { changed = true; #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "destinations" ); #endif QString newName = destinationname->text(); if ( !newdestination ) { vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); // 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().push_back( 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 } } -//------------------ General tab ---------------------- - -void SettingsImpl :: toggleJumpTo( bool val ) -{ -#ifdef QWS - Config cfg( "aqpkg" ); - cfg.setGroup( "settings" ); - cfg.writeEntry( "showJumpTo", val ); -#endif -} - //------------------ Proxy tab ---------------------- void SettingsImpl :: proxyApplyChanges() { changed = true; dataMgr->setHttpProxy( txtHttpProxy->text() ); dataMgr->setFtpProxy( txtFtpProxy->text() ); dataMgr->setProxyUsername( txtUsername->text() ); dataMgr->setProxyPassword( txtPassword->text() ); dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() ); } diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h index bb027dc..9ffc259 100644 --- a/noncore/settings/aqpkg/settingsimpl.h +++ b/noncore/settings/aqpkg/settingsimpl.h @@ -1,56 +1,77 @@ /*************************************************************************** settingsimpl.h - description ------------------- begin : Thu Aug 29 2002 copyright : (C) 2002 by Andy Qua email : andy.qua@blueyonder.co.uk ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ -#include "settings.h" - #include "datamgr.h" -class SettingsImpl : public SettingsBase +#include <qdialog.h> + +class QCheckBox; +class QLineEdit; +class QListBox; + +class SettingsImpl : public QDialog { + Q_OBJECT public: SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~SettingsImpl(); - bool showDlg( int i ); + bool showDlg(); private: + QListBox *servers; + QLineEdit *servername; + QLineEdit *serverurl; + QCheckBox *active; + QListBox *destinations; + QLineEdit *destinationname; + QLineEdit *destinationurl; + QCheckBox *linkToRoot; + QLineEdit *txtHttpProxy; + QCheckBox *chkHttpProxyEnabled; + QLineEdit *txtFtpProxy; + QCheckBox *chkFtpProxyEnabled; + QLineEdit *txtUsername; + QLineEdit *txtPassword; + DataManager *dataMgr; QString serverName; QString destinationName; int currentSelectedServer; int currentSelectedDestination; bool changed; bool newserver; bool newdestination; + QWidget *initServerTab(); + QWidget *initDestinationTab(); + QWidget *initProxyTab(); + void setupConnections(); void setupData(); +public slots: void editServer( int s ); void changeServerDetails(); - void newServer(); - void removeServer(); - + void newServer(); + void removeServer(); void editDestination( int s ); void changeDestinationDetails(); - void newDestination(); - void removeDestination(); - - void toggleJumpTo( bool val ); - + void newDestination(); + void removeDestination(); void proxyApplyChanges(); }; |