summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/oipkgconfigdlg.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index d014378..78a18f7 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -343,207 +343,209 @@ void OIpkgConfigDlg::initOptionsWidget()
m_optForceRecursive = new QCheckBox( tr( "Force Recursive" ), container );
QWhatsThis::add( m_optForceRecursive, tr( "Tap here to enable or disable the '-recursive' option for Ipkg." ) );
layout->addMultiCellWidget( m_optForceRecursive, 4, 4, 0, 1 );
m_optVerboseWget = new QCheckBox( tr( "Verbose fetch" ), container );
QWhatsThis::add( m_optVerboseWget, tr( "Tap here to enable or disable the '-verbose_wget' option for Ipkg." ) );
layout->addMultiCellWidget( m_optVerboseWget, 5, 5, 0, 1 );
QLabel *l = new QLabel( tr( "Information level:" ), container );
QWhatsThis::add( l, tr( "Select information level for Ipkg." ) );
layout->addMultiCellWidget( l, 6, 6, 0, 1 );
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->addMultiCellWidget( m_optVerboseIpkg, 7, 7, 0, 1 );
l = new QLabel( tr( "Package source lists directory:" ), container );
QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) );
layout->addMultiCellWidget( l, 8, 8, 0, 1 );
m_optSourceLists = new QLineEdit( container );
QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) );
layout->addWidget( m_optSourceLists, 9, 0 );
QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ),
QString::null, container );
btn->setMinimumHeight( AppLnk::smallIconSize()+4 );
btn->setMaximumWidth( btn->height() );
QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) );
connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) );
layout->addWidget( btn, 9, 1 );
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 )
{
switch ( config->type() )
{
case OConfItem::Source : m_serverList->insertItem( config->name() ); break;
case OConfItem::Destination : m_destList->insertItem( config->name() ); break;
case 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() );
}
}
break;
case OConfItem::Other :
{
if ( config->name() == "lists_dir" )
m_optSourceLists->setText( config->value() );
else // TODO - use proper libipkg define
m_optSourceLists->setText( "/usr/lib/ipkg/lists" );
}
break;
default : break;
};
}
}
}
}
// Get Ipkg execution options
- int options = m_ipkg->ipkgExecOptions();
+ int options = 0;
+ if ( m_ipkg )
+ 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 );
if ( options & FORCE_RECURSIVE )
m_optForceRecursive->setChecked( true );
if ( options & FORCE_VERBOSE_WGET )
m_optVerboseWget->setChecked( true );
- m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() );
+ m_optVerboseIpkg->setCurrentItem( ( m_ipkg ? m_ipkg->ipkgExecVerbosity() : 0 ) );
}
void OIpkgConfigDlg::slotServerSelected( int index )
{
m_serverCurrent = index;
// Enable Edit and Delete buttons
m_serverEditBtn->setEnabled( true );
m_serverDeleteBtn->setEnabled( true );
}
void OIpkgConfigDlg::slotServerNew()
{
OConfItem *server = new OConfItem( OConfItem::Source );
OIpkgServerDlg dlg( server, this );
if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
{
// Add to configuration option list
m_configs->append( server );
m_configs->sort();
// Add to server list
m_serverList->insertItem( server->name() );
m_serverList->setCurrentItem( m_serverList->count() );
}
else
delete server;
}
void OIpkgConfigDlg::slotServerEdit()
{
// Find selected server in list
OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() );
// Edit server
if ( server )
{
QString origName = server->name();
OIpkgServerDlg dlg( server, this );
if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
{
// Check to see if name has changed, if so update the server list
if ( server->name() != origName )
m_serverList->changeItem( server->name(), m_serverCurrent );
}
}
}
void OIpkgConfigDlg::slotServerDelete()
{
// Find selected server in list
OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() );
// Delete server
if ( server )
{
m_configs->removeRef( server );
m_serverList->removeItem( m_serverCurrent );
}
}
void OIpkgConfigDlg::slotDestSelected( int index )
{
m_destCurrent = index;
// Enable Edit and Delete buttons
m_destEditBtn->setEnabled( true );
m_destDeleteBtn->setEnabled( true );
}
void OIpkgConfigDlg::slotDestNew()
{
OConfItem *dest = new OConfItem( OConfItem::Destination );
OIpkgDestDlg dlg( dest, this );
if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
{
// Add to configuration option list
m_configs->append( dest );
m_configs->sort();
// Add to destination list
m_destList->insertItem( dest->name() );
m_destList->setCurrentItem( m_destList->count() );
}
else
delete dest;
}
void OIpkgConfigDlg::slotDestEdit()
{
// Find selected destination in list
OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() );
// Edit destination