-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 23 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.h | 43 |
2 files changed, 40 insertions, 26 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 1561470..ea0aef0 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp @@ -18,32 +18,34 @@ _;:, .> :=|. This program is free software; you can =_ + =;=|` 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 <opie2/ofiledialog.h> + #include <qpe/resource.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> OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) : QDialog( parent, QString::null, true, WStyle_ContextHelp ) , m_ipkg( ipkg ) , m_configs( 0x0 ) @@ -70,34 +72,32 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren 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( OConfItem::Option, "http_proxy", @@ -242,49 +242,54 @@ void OIpkgConfigDlg::initDestinationWidget() 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( "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 ); 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 ); + grplayout->addMultiCellWidget( m_destName, 0, 0, 1, 2 ); 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 ); + btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, grpbox ); + btn->setMaximumWidth( btn->height() ); + QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); + connect( btn, SIGNAL(clicked()), this, SLOT(slotDestSelectPath()) ); + grplayout->addWidget( btn, 1, 2 ); 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 ); + grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 2 ); 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 ); + grplayout->addMultiCellWidget( btn, 3, 3, 0, 2 ); } 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 ); @@ -571,32 +576,40 @@ void OIpkgConfigDlg::slotDestNew() m_destName->setFocus(); } void OIpkgConfigDlg::slotDestDelete() { // Find selected destination in list OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); // Delete destination if ( destination ) { m_configs->removeRef( destination ); m_destList->removeItem( m_destCurrent ); } } +void OIpkgConfigDlg::slotDestSelectPath() +{ + QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_destLocation->text() ); + if ( path.at( path.length() - 1 ) == '/' ) + path.truncate( path.length() - 1 ); + m_destLocation->setText( path ); +} + void OIpkgConfigDlg::slotDestUpdate() { QString newName = m_destName->text(); // Convert any spaces to underscores newName.replace( QRegExp( " " ), "_" ); if ( !m_destNew ) { // Find selected destination in list OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); // Display destination details if ( destination ) { // Update url diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h index 800d94a..a4e4f82 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.h +++ b/noncore/settings/packagemanager/oipkgconfigdlg.h @@ -1,41 +1,41 @@ /* - This file is part of the Opie Project + This file is part of the Opie Project - Copyright (c) 2003 Dan Williams <drw@handhelds.org> + 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. + .>+-= +_;:, .> :=|. 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. */ #ifndef OIPKGCONFIGDLG_H #define OIPKGCONFIGDLG_H #include <opie2/otabwidget.h> #include <qdialog.h> #include <qlayout.h> #include "oipkg.h" @@ -112,20 +112,21 @@ private: void initProxyWidget(); void initOptionsWidget(); void initData(); OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, const QString &name = 0x0 ); private slots: void slotServerEdit( int index ); void slotServerNew(); void slotServerDelete(); void slotServerUpdate(); void slotDestEdit( int index ); void slotDestNew(); void slotDestDelete(); + void slotDestSelectPath(); void slotDestUpdate(); }; #endif |