summaryrefslogtreecommitdiff
path: root/noncore/settings/packagemanager/oipkgconfigdlg.cpp
authordrw <drw>2005-02-22 22:25:39 (UTC)
committer drw <drw>2005-02-22 22:25:39 (UTC)
commit504c5f59c082106028e3dbc9126d7b655908224f (patch) (side-by-side diff)
tree2cf4465cb2a46b0d13f909d073225585ad4e5092 /noncore/settings/packagemanager/oipkgconfigdlg.cpp
parenta2eea1c6273acd16fed2406493923c52fba19ebc (diff)
downloadopie-504c5f59c082106028e3dbc9126d7b655908224f.zip
opie-504c5f59c082106028e3dbc9126d7b655908224f.tar.gz
opie-504c5f59c082106028e3dbc9126d7b655908224f.tar.bz2
Add support for lists_dir ipkg configuration option, optimize ipkg configuration file read routine, update version to 0.6.2
Diffstat (limited to 'noncore/settings/packagemanager/oipkgconfigdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp138
1 files changed, 87 insertions, 51 deletions
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index e6d6a81..7ee2d74 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -130,2 +130,9 @@ void OIpkgConfigDlg::accept()
+ confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" );
+ if ( confItem )
+ confItem->setValue( m_optSourceLists->text() );
+ else
+ m_configs->append( new OConfItem( OConfItem::Other, "lists_dir",
+ m_optSourceLists->text(), "name" ) );
+
m_ipkg->setConfigItems( m_configs );
@@ -185,3 +192,3 @@ void OIpkgConfigDlg::initServerWidget()
layout->addWidget( m_serverEditBtn, 1, 1 );
-
+
m_serverDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
@@ -223,3 +230,3 @@ void OIpkgConfigDlg::initDestinationWidget()
layout->addWidget( m_destEditBtn, 1, 1 );
-
+
m_destDeleteBtn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
@@ -299,3 +306,3 @@ void OIpkgConfigDlg::initOptionsWidget()
sv->addChild( container );
- QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 );
+ QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 );
@@ -303,3 +310,3 @@ void OIpkgConfigDlg::initOptionsWidget()
QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) );
- layout->addWidget( m_optForceDepends );
+ layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 );
@@ -307,3 +314,3 @@ void OIpkgConfigDlg::initOptionsWidget()
QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) );
- layout->addWidget( m_optForceReinstall );
+ layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 );
@@ -311,3 +318,3 @@ void OIpkgConfigDlg::initOptionsWidget()
QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) );
- layout->addWidget( m_optForceRemove );
+ layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 );
@@ -315,7 +322,7 @@ void OIpkgConfigDlg::initOptionsWidget()
QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) );
- layout->addWidget( m_optForceOverwrite );
+ layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 );
- QLabel *l = new QLabel( tr( "Information Level" ), container );
+ QLabel *l = new QLabel( tr( "Information level:" ), container );
QWhatsThis::add( l, tr( "Select information level for Ipkg." ) );
- layout->addWidget( l );
+ layout->addMultiCellWidget( l, 4, 4, 0, 1 );
@@ -327,3 +334,16 @@ void OIpkgConfigDlg::initOptionsWidget()
m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) );
- layout->addWidget( m_optVerboseIpkg );
+ layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 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, 6, 6, 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, 7, 0 );
+ QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, container );
+ 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, 7, 1 );
@@ -347,31 +367,38 @@ void OIpkgConfigDlg::initData()
{
- if ( config->type() == OConfItem::Source )
+ switch ( config->type() )
{
- 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() );
- }
- }
+ 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;
+ };
}
@@ -398,3 +425,3 @@ void OIpkgConfigDlg::slotServerSelected( int index )
m_serverCurrent = index;
-
+
// Enable Edit and Delete buttons
@@ -407,3 +434,3 @@ void OIpkgConfigDlg::slotServerNew()
OConfItem *server = new OConfItem( OConfItem::Source );
-
+
OIpkgServerDlg dlg( server, this );
@@ -458,3 +485,3 @@ void OIpkgConfigDlg::slotDestSelected( int index )
m_destCurrent = index;
-
+
// Enable Edit and Delete buttons
@@ -467,3 +494,3 @@ void OIpkgConfigDlg::slotDestNew()
OConfItem *dest = new OConfItem( OConfItem::Destination );
-
+
OIpkgDestDlg dlg( dest, this );
@@ -515,2 +542,11 @@ void OIpkgConfigDlg::slotDestDelete()
+void OIpkgConfigDlg::slotOptSelectSourceListsPath()
+{
+ QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() );
+ if ( path.at( path.length() - 1 ) == '/' )
+ path.truncate( path.length() - 1 );
+ if ( !path.isNull() )
+ m_optSourceLists->setText( path );
+}
+
OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
@@ -521,3 +557,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
- // Initialize UI
+ // Initialize UI
QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
@@ -529,3 +565,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
layout->addStretch();
-
+
QLabel *label = new QLabel( tr( "Name:" ), this );
@@ -538,3 +574,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
layout->addStretch();
-
+
label = new QLabel( tr( "Address:" ), this );
@@ -551,3 +587,3 @@ OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
layout->addWidget( m_compressed );
-
+
// Populate initial information
@@ -582,3 +618,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
- // Initialize UI
+ // Initialize UI
QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
@@ -590,3 +626,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
layout->addStretch();
-
+
QLabel *label = new QLabel( tr( "Name:" ), this );
@@ -599,3 +635,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
layout->addStretch();
-
+
label = new QLabel( tr( "Location:" ), this );
@@ -606,3 +642,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
layout->addLayout( layout2 );
-
+
m_location = new QLineEdit( this );
@@ -615,3 +651,3 @@ OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
layout2->addWidget( btn );
-
+
// Populate initial information