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.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index 886430f..d9a67f3 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -56,107 +56,109 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren
, 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" ) );
}
}
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",
- m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) );
+ m_proxyHttpServer->text(), QString::null,
+ 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( OConfItem::Option, "ftp_proxy",
- m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) );
+ m_proxyFtpServer->text(), QString::null,
+ m_proxyFtpActive->isChecked() ) );
confItem = findConfItem( OConfItem::Option, "proxy_username" );
if ( confItem )
confItem->setValue( m_proxyUsername->text() );
else
m_configs->append( new OConfItem( 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( 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 );
@@ -490,151 +492,152 @@ void OIpkgConfigDlg::slotServerNew()
m_serverName->setFocus();
}
void OIpkgConfigDlg::slotServerDelete()
{
// Find selected server in list
OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() );
// Delete server
if ( server )
{
m_configs->removeRef( server );
m_serverList->removeItem( m_serverCurrent );
}
}
void OIpkgConfigDlg::slotServerUpdate()
{
QString newName = m_serverName->text();
// Convert any spaces to underscores
newName.replace( QRegExp( " " ), "_" );
if ( !m_serverNew )
{
// Find selected server in list
OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName );
// Delete server
if ( server )
{
// Update url
server->setValue( m_serverLocation->text() );
server->setActive( m_serverActive->isChecked() );
// Check if server name has changed, if it has then we need to replace the key in the map
if ( m_serverCurrName != newName )
{
// Update server name
server->setName( newName );
// Update list box
m_serverList->changeItem( newName, m_serverCurrent );
}
}
}
else
{
- // Add new destination to configuration list
- m_configs->append( new OConfItem( OConfItem::Source, newName,
- m_serverLocation->text(), m_serverActive->isChecked() ) );
+ // Add new server to configuration list
+ // TODO - support src/gz
+ m_configs->append( new OConfItem( OConfItem::Source, newName, m_serverLocation->text(),
+ QString::null, m_serverActive->isChecked() ) );
m_configs->sort();
m_serverList->insertItem( newName );
m_serverList->setCurrentItem( m_serverList->count() );
m_serverNew = false;
}
}
void OIpkgConfigDlg::slotDestEdit( int index )
{
m_destNew = false;
m_destCurrent = index;
// Find selected destination in list
OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() );
// Display destination details
if ( destination )
{
m_destCurrName = destination->name();
m_destName->setText( destination->name() );
m_destLocation->setText( destination->value() );
m_destActive->setChecked( destination->active() );
m_destName->setFocus();
}
}
void OIpkgConfigDlg::slotDestNew()
{
m_destNew = true;
m_destName->setText( QString::null );
m_destLocation->setText( QString::null );
m_destActive->setChecked( true );
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
destination->setValue( m_destLocation->text() );
destination->setActive( m_destActive->isChecked() );
// Check if destination name has changed, if it has then we need to replace the key in the map
if ( m_destCurrName != newName )
{
// Update destination name
destination->setName( newName );
// Update list box
m_destList->changeItem( newName, m_destCurrent );
}
}
}
else
{
// Add new destination to configuration list
m_configs->append( new OConfItem( OConfItem::Destination, newName,
- m_destLocation->text(), m_destActive->isChecked() ) );
+ m_destLocation->text(), QString::null, m_destActive->isChecked() ) );
m_configs->sort();
m_destList->insertItem( newName );
m_destList->setCurrentItem( m_destList->count() );
m_destNew = false;
}
}