-rw-r--r-- | noncore/settings/packagemanager/filterdlg.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 28 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 41 |
3 files changed, 64 insertions, 21 deletions
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp index eeed398..70875bd 100644 --- a/noncore/settings/packagemanager/filterdlg.cpp +++ b/noncore/settings/packagemanager/filterdlg.cpp @@ -1,179 +1,189 @@ /* This file is part of the OPIE Project =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> .=l. .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "filterdlg.h" +#include <qwhatsthis.h> + FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, const QString &server, const QString &destination, OPackageManager::Status status, const QString &category ) - : QDialog( parent, QString::null, true ) + : QDialog( parent, QString::null, true, WStyle_ContextHelp ) { setCaption( tr( "Filter packages" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); QScrollView *sv = new QScrollView( this ); layout->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); layout = new QVBoxLayout( container, 4, 4 ); // Category m_categoryCB = new QCheckBox( tr( "Category:" ), container ); + QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) ); connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); m_category = new QComboBox( container ); + QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) ); m_category->insertStringList( pm->categories() ); initItem( m_category, m_categoryCB, category ); layout->addWidget( m_categoryCB ); layout->addWidget( m_category ); // Package name m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); + QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) ); connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); m_name = new QLineEdit( name, container ); + QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) ); if ( !name.isNull() ) m_nameCB->setChecked( true ); m_name->setEnabled( !name.isNull() ); layout->addWidget( m_nameCB ); layout->addWidget( m_name ); // Status m_statusCB = new QCheckBox( tr( "With the status:" ), container ); + QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) ); connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); m_status = new QComboBox( container ); + QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) ); connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) ); QString currStatus; switch ( status ) { case OPackageManager::All : currStatus = tr( "All" ); break; case OPackageManager::Installed : currStatus = tr( "Installed" ); break; case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); break; case OPackageManager::Updated : currStatus = tr( "Updated" ); break; default : currStatus = QString::null; }; m_status->insertItem( tr( "All" ) ); m_status->insertItem( tr( "Installed" ) ); m_status->insertItem( tr( "Not installed" ) ); m_status->insertItem( tr( "Updated" ) ); initItem( m_status, m_statusCB, currStatus ); layout->addWidget( m_statusCB ); layout->addWidget( m_status ); // Server m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); + QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) ); connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); m_server = new QComboBox( container ); + QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) ); m_server->insertStringList( *(pm->servers()) ); initItem( m_server, m_serverCB, server ); layout->addWidget( m_serverCB ); layout->addWidget( m_server ); // Destination m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); + QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) ); connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); m_destination = new QComboBox( container ); + QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) ); m_destination->insertStringList( *(pm->destinations()) ); initItem( m_destination, m_destCB, destination ); layout->addWidget( m_destCB ); layout->addWidget( m_destination ); - - //showMaximized(); } void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) { if ( !selection.isNull() ) { checkBox->setChecked( true ); for ( int i = 0; i < comboBox->count(); i++ ) { if ( comboBox->text( i ) == selection ) { comboBox->setCurrentItem( i ); return; } } } comboBox->setEnabled( !selection.isNull() ); } void FilterDlg::slotNameSelected( bool selected ) { m_name->setEnabled( selected ); } void FilterDlg::slotServerSelected( bool selected ) { m_server->setEnabled( selected ); } void FilterDlg::slotDestSelected( bool selected ) { m_destination->setEnabled( selected ); } void FilterDlg::slotStatusSelected( bool selected ) { m_status->setEnabled( selected ); if ( !selected && !m_destCB->isEnabled() ) { // If status check box has been deselected and destination option was previously deselected // (because status == "Not installed"), re-enable destination option m_destCB->setEnabled( true ); m_destination->setEnabled( true ); } else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) ) { // If status check box has been selected and status == "Not installed", disable destination option m_destCB->setEnabled( false ); m_destCB->setChecked( false ); m_destination->setEnabled( false ); } } void FilterDlg::slotStatusChanged( const QString &category ) { bool notInstalled = ( category == tr( "Not installed" ) ); m_destCB->setEnabled( !notInstalled ); m_destination->setEnabled( !notInstalled ); if ( notInstalled ) m_destCB->setChecked( false ); } void FilterDlg::slotCategorySelected( bool selected ) { m_category->setEnabled( selected ); } diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index b334bca..810046f 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp @@ -23,320 +23,320 @@ -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qaction.h> #include <qdir.h> #include <qlayout.h> #include <qlineedit.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qtoolbar.h> #include <qwhatsthis.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include "mainwindow.h" #include "installdlg.h" #include "filterdlg.h" #include "promptdlg.h" #include "entrydlg.h" #include "packageinfodlg.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) : QMainWindow( parent, name, WStyle_ContextHelp ) , m_config( "packman" ) , m_packman( &m_config, this ) , m_menuBar( this ) , m_toolBar( this ) , m_findBar( this ) , m_widgetStack( this ) , m_packageList( this ) , m_statusWidget( this ) , m_statusText( &m_statusWidget ) , m_statusBar( &m_statusWidget ) , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) , m_iconInstalled( Resource::loadPixmap( "installed" ) ) , m_iconNull( m_iconUpdated.size() ) , m_filterName( QString::null ) , m_filterServer( QString::null ) , m_filterDest( QString::null ) , m_filterStatus( OPackageManager::NotDefined ) , m_filterCategory( QString::null ) { // setCaption( tr( "Package Manager" ) ); m_iconNull.fill( colorGroup().base() ); connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); // Initialize widget stack, package list and status widget initStatusWidget(); initPackageList(); m_widgetStack.addWidget( &m_statusWidget, 2 ); m_widgetStack.addWidget( &m_packageList, 1 ); setCentralWidget( &m_widgetStack ); // Initialize remaining user interface items initUI(); // Initialize package information QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); } void MainWindow::closeEvent( QCloseEvent *event ) { // Close app only if either the package or status widgets are currently active bool close = m_widgetStack.visibleWidget() == &m_packageList || m_widgetStack.visibleWidget() == &m_statusWidget; if ( close ) { // TODO - write out application configuration settings // Write out package manager configuration settings m_packman.saveSettings(); event->accept(); } else { delete m_widgetStack.visibleWidget(); m_widgetStack.raiseWidget( &m_packageList ); event->ignore(); } } void MainWindow::initPackageList() { m_packageList.addColumn( tr( "Packages" ) ); - QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\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." ) ); + QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\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\nTap inside the box at the left to select a package. Tap and hold to view package details." ) ); QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); } void MainWindow::initStatusWidget() { QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); layout->addWidget( &m_statusText ); connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); layout->addWidget( &m_statusBar ); } void MainWindow::initUI() { // Build menu and tool bars setToolBarsMovable( false ); m_menuBar.setHorizontalStretchable( true ); QMenuBar *mb = new QMenuBar( &m_menuBar ); mb->setMargin( 0 ); // Find toolbar addToolBar( &m_findBar, QMainWindow::Top, true ); m_findBar.setHorizontalStretchable( true ); m_findEdit = new QLineEdit( &m_findBar ); QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); m_findBar.setStretchableWidget( m_findEdit ); connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); // Packages menu QPopupMenu *popup = new QPopupMenu( this ); QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); - a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); + a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); a->addTo( popup ); a->addTo( &m_toolBar ); QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); - actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); + actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); actionUpgrade->addTo( popup ); actionUpgrade->addTo( &m_toolBar ); QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); - actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); + actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); actionDownload->addTo( popup ); actionDownload->addTo( &m_toolBar ); a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); - a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); + a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); a->addTo( popup ); a->addTo( &m_toolBar ); popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); - a->setWhatsThis( tr( "Click here to configure this application." ) ); + a->setWhatsThis( tr( "Tap here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); a->addTo( popup ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); m_actionShowNotInstalled->setToggleAction( true ); - m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); + m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); m_actionShowNotInstalled->addTo( popup ); m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); m_actionShowInstalled->setToggleAction( true ); - m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); + m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); m_actionShowInstalled->addTo( popup ); m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); m_actionShowUpdated->setToggleAction( true ); - m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); + m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); m_actionShowUpdated->addTo( popup ); popup->insertSeparator(); m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), QString::null, 0, this, 0 ); m_actionFilter->setToggleAction( true ); - m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); + m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); m_actionFilter->addTo( popup ); a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); - a->setWhatsThis( tr( "Click here to change the package filter criteria." ) ); + a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); 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." ) ); + a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); a->addTo( popup ); m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); m_actionFindNext->setEnabled( false ); - m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); + m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); m_actionFindNext->addTo( popup ); m_actionFindNext->addTo( &m_findBar ); mb->insertItem( tr( "View" ), 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." ) ); + a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); a->addTo( &m_findBar ); m_findBar.hide(); } void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) { if ( clearList ) m_packageList.clear(); if ( packages ) { for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) { OPackage *package = packageIt.current(); QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), QCheckListItem::CheckBox ); m_packageList.insertItem( item ); // If a different version of package is available, show update available icon // Otherwise, show installed icon if ( !package->versionInstalled().isNull() ) { if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) item->setPixmap( 0, m_iconUpdated ); else item->setPixmap( 0, m_iconInstalled ); } else item->setPixmap( 0, m_iconNull ); } } } void MainWindow::searchForPackage( const QString &text ) { if ( !text.isEmpty() ) { // look through package list for text startng at current position QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); if ( start == 0 ) start = static_cast<QCheckListItem *>(m_packageList.firstChild()); // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; item = static_cast<QCheckListItem *>(item->nextSibling()) ) { if ( item->text().lower().find( text ) != -1 ) { m_packageList.ensureItemVisible( item ); m_packageList.setCurrentItem( item ); break; } } } } void MainWindow::initPackageInfo() { m_widgetStack.raiseWidget( &m_statusWidget ); // Load package list m_packman.loadAvailablePackages(); m_packman.loadInstalledPackages(); OPackageList *packageList = m_packman.packages(); if ( packageList ) { loadPackageList( packageList, true ); delete packageList; } m_widgetStack.raiseWidget( &m_packageList ); } void MainWindow::slotWidgetStackShow( QWidget *widget ) { if ( widget == &m_packageList ) { setCaption( tr( "Package Manager" ) ); m_menuBar.show(); m_toolBar.show(); } else { m_menuBar.hide(); m_toolBar.hide(); } } void MainWindow::slotInitStatusBar( int numSteps ) { m_statusBar.setTotalSteps( numSteps ); } diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 74e7137..d134651 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp @@ -1,432 +1,465 @@ /* This file is part of the Opie Project Copyright (c) 2003 Dan Williams <drw@handhelds.org> =. .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. .` .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "oipkgconfigdlg.h" #include <qcheckbox.h> #include <qcombobox.h> #include <qgroupbox.h> #include <qlabel.h> #include <qlineedit.h> #include <qlistbox.h> #include <qpushbutton.h> #include <qscrollview.h> +#include <qwhatsthis.h> #include <qpe/resource.h> using namespace Opie::Ui; OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) - : QDialog( parent, QString::null, true ) + : QDialog( parent, QString::null, true, WStyle_ContextHelp ) , m_ipkg( ipkg ) , m_configs( 0x0 ) , m_installOptions( installOptions ) , m_serverNew( false ) , m_serverCurrent( -1 ) , m_destNew( false ) , m_destCurrent( -1 ) , m_layout( this, 2, 4 ) , m_tabWidget( this ) { setCaption( tr( "Configuration" ) ); // Initialize configuration widgets if ( !installOptions ) { initServerWidget(); initDestinationWidget(); initProxyWidget(); } initOptionsWidget(); // Load configuration information initData(); // Setup tabs for all info m_layout.addWidget( &m_tabWidget ); if ( !m_installOptions ) { m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); m_tabWidget.setCurrentTab( tr( "Servers" ) ); } else { m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); } //showMaximized(); } void OIpkgConfigDlg::accept() { // Save server, destination and proxy configuration if ( !m_installOptions ) { // Update proxy information before saving settings OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); if ( confItem ) { confItem->setValue( m_proxyHttpServer->text() ); confItem->setActive( m_proxyHttpActive->isChecked() ); } else m_configs->append( new OConfItem( QString::null, OConfItem::Option, "http_proxy", m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); if ( confItem ) { confItem->setValue( m_proxyFtpServer->text() ); confItem->setActive( m_proxyFtpActive->isChecked() ); } else m_configs->append( new OConfItem( QString::null, OConfItem::Option, "ftp_proxy", m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); confItem = findConfItem( OConfItem::Option, "proxy_username" ); if ( confItem ) confItem->setValue( m_proxyUsername->text() ); else m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_username", m_proxyUsername->text() ) ); confItem = findConfItem( OConfItem::Option, "proxy_password" ); if ( confItem ) confItem->setValue( m_proxyPassword->text() ); else m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_password", m_proxyPassword->text() ) ); m_ipkg->setConfigItems( m_configs ); } // Save options configuration int options = 0; if ( m_optForceDepends->isChecked() ) options |= FORCE_DEPENDS; if ( m_optForceReinstall->isChecked() ) options |= FORCE_REINSTALL; if ( m_optForceRemove->isChecked() ) options |= FORCE_REMOVE; if ( m_optForceOverwrite->isChecked() ) options |= FORCE_OVERWRITE; m_ipkg->setIpkgExecOptions( options ); m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); QDialog::accept(); } void OIpkgConfigDlg::reject() { if ( m_configs ) delete m_configs; } void OIpkgConfigDlg::initServerWidget() { m_serverWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); QScrollView *sv = new QScrollView( m_serverWidget ); 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, 3, 2, 2, 4 ); m_serverList = new QListBox( container ); + QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) ); layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); + QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); layout->addWidget( btn, 1, 0 ); btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); + QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); 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 ); + QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); grplayout->addWidget( label, 0, 0 ); m_serverName = new QLineEdit( grpbox ); + QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) ); grplayout->addWidget( m_serverName, 0, 1 ); label = new QLabel( tr( "Address:" ), grpbox ); + QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); grplayout->addWidget( label, 1, 0 ); m_serverLocation = new QLineEdit( grpbox ); + QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) ); grplayout->addWidget( m_serverLocation, 1, 1 ); - m_serverActive = new QCheckBox( tr( "Active Server" ), grpbox ); + m_serverActive = new QCheckBox( tr( "Active" ), grpbox ); + QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) ); grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); + QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) ); grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); } void OIpkgConfigDlg::initDestinationWidget() { m_destWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); QScrollView *sv = new QScrollView( m_destWidget ); 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, 3, 2, 2, 4 ); m_destList = new QListBox( container ); + QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestEdit(int)) ); layout->addMultiCellWidget( m_destList, 0, 0, 0, 1 ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); + QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); layout->addWidget( btn, 1, 0 ); btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); + QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); 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 ); + QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); grplayout->addWidget( label, 0, 0 ); m_destName = new QLineEdit( grpbox ); + QWhatsThis::add( m_destName, tr( "Enter the name of this entry here." ) ); grplayout->addWidget( m_destName, 0, 1 ); - label = new QLabel( tr( "Address:" ), grpbox ); + label = new QLabel( tr( "Location:" ), grpbox ); + QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); grplayout->addWidget( label, 1, 0 ); m_destLocation = new QLineEdit( grpbox ); + QWhatsThis::add( m_destLocation, tr( "Enter the absolute directory path of this entry here." ) ); grplayout->addWidget( m_destLocation, 1, 1 ); - m_destActive = new QCheckBox( tr( "Active Server" ), grpbox ); + m_destActive = new QCheckBox( tr( "Active" ), grpbox ); + QWhatsThis::add( m_destActive, tr( "Tap here to indicate whether this entry is active or not." ) ); grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 1 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); + QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); connect( btn, SIGNAL(clicked()), this, SLOT(slotDestUpdate()) ); grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); } void OIpkgConfigDlg::initProxyWidget() { m_proxyWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); QScrollView *sv = new QScrollView( m_proxyWidget ); 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, 4, 2, 2, 4 ); // HTTP proxy server configuration 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() ); m_proxyHttpServer = new QLineEdit( grpbox ); + QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); grplayout->addWidget( m_proxyHttpServer ); m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); + QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); grplayout->addWidget( m_proxyHttpActive ); // FTP proxy server configuration 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() ); m_proxyFtpServer = new QLineEdit( grpbox ); + QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); grplayout->addWidget( m_proxyFtpServer ); m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); + QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); grplayout->addWidget( m_proxyFtpActive ); // Proxy server username and password configuration QLabel *label = new QLabel( tr( "Username:" ), container ); + QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); layout->addWidget( label, 2, 0 ); m_proxyUsername = new QLineEdit( container ); + QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); layout->addWidget( m_proxyUsername, 2, 1 ); label = new QLabel( tr( "Password:" ), container ); + QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); layout->addWidget( label, 3, 0 ); m_proxyPassword = new QLineEdit( container ); + QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); layout->addWidget( m_proxyPassword, 3, 1 ); } void OIpkgConfigDlg::initOptionsWidget() { m_optionsWidget = new QWidget( this ); // Initialize UI QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); QScrollView *sv = new QScrollView( m_optionsWidget ); vb->addWidget( sv, 0, 0 ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setFrameStyle( QFrame::NoFrame ); QWidget *container = new QWidget( sv->viewport() ); sv->addChild( container ); QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 ); m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); + QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); layout->addWidget( m_optForceDepends ); m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); + QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); layout->addWidget( m_optForceReinstall ); m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); + QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); layout->addWidget( m_optForceRemove ); m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); + QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); layout->addWidget( m_optForceOverwrite ); QLabel *l = new QLabel( tr( "Information Level" ), container ); + QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); layout->addWidget( l ); m_optVerboseIpkg = new QComboBox( container ); + QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); layout->addWidget( m_optVerboseIpkg ); layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); } void OIpkgConfigDlg::initData() { // Read ipkg configuration (server/destination/proxy) information if ( m_ipkg && !m_installOptions ) { m_configs = m_ipkg->configItems(); if ( m_configs ) { for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) { OConfItem *config = configIt.current(); // Add configuration item to the appropriate dialog controls if ( config ) { if ( config->type() == OConfItem::Source ) { m_serverList->insertItem( config->name() ); } else if ( config->type() == OConfItem::Destination ) { m_destList->insertItem( config->name() ); } else if ( config->type() == OConfItem::Option ) { if ( config->name() == "http_proxy" ) { m_proxyHttpServer->setText( config->value() ); m_proxyHttpActive->setChecked( config->active() ); } else if ( config->name() == "ftp_proxy" ) { m_proxyFtpServer->setText( config->value() ); m_proxyFtpActive->setChecked( config->active() ); } else if ( config->name() == "proxy_username" ) { m_proxyUsername->setText( config->value() ); } else if ( config->name() == "proxy_password" ) { m_proxyPassword->setText( config->value() ); } } } } } } // Get Ipkg execution options int options = m_ipkg->ipkgExecOptions(); if ( options & FORCE_DEPENDS ) m_optForceDepends->setChecked( true ); if ( options & FORCE_REINSTALL ) m_optForceReinstall->setChecked( true ); if ( options & FORCE_REMOVE ) m_optForceRemove->setChecked( true ); if ( options & FORCE_OVERWRITE ) m_optForceOverwrite->setChecked( true ); m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); } OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) { // Find selected server in list OConfItemListIterator configIt( *m_configs ); OConfItem *config = 0x0; for ( ; configIt.current(); ++configIt ) { config = configIt.current(); if ( config->type() == type && config->name() == name ) break; } if ( config && config->type() == type && config->name() == name ) return config; return 0x0; } void OIpkgConfigDlg::slotServerEdit( int index ) { m_serverNew = false; m_serverCurrent = index; // Find selected server in list |