summaryrefslogtreecommitdiff
path: root/noncore
authorhrw <hrw>2006-01-16 15:07:34 (UTC)
committer hrw <hrw>2006-01-16 15:07:34 (UTC)
commit50b379b4637c80273b6f5397c9c20db78410f125 (patch) (side-by-side diff)
tree13ebc10d48900beaa44450f94a710736420179b9 /noncore
parent2664267708d5ed695151bf0ec9376080e7bf617e (diff)
downloadopie-50b379b4637c80273b6f5397c9c20db78410f125.zip
opie-50b379b4637c80273b6f5397c9c20db78410f125.tar.gz
opie-50b379b4637c80273b6f5397c9c20db78410f125.tar.bz2
opie-packagemanager: added two options
- "Force resursive" for -recursive ipkg option - "Verbose fetch" for -verbose_wget ipkg option
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp2
-rw-r--r--noncore/settings/packagemanager/oipkg.h2
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp26
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.h2
4 files changed, 27 insertions, 5 deletions
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index ffb3687..38cd824 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -393,64 +393,66 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString &
return pl;
}
OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name )
{
// Find configuration item in list
OConfItemListIterator configIt( *m_confInfo );
OConfItem *config = 0l;
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 0l;
}
bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parameters, const QString &destination,
const QObject *receiver, const char *slotOutput, bool rawOutput )
{
if ( command == OPackage::NotDefined )
return false;
// Set ipkg run-time options/arguments
m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
// TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
+ m_ipkgArgs.force_removal_of_dependent_packages = ( m_ipkgExecOptions & FORCE_RECURSIVE );
+ m_ipkgArgs.verbose_wget = ( m_ipkgExecOptions & FORCE_VERBOSE_WGET );
m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
if ( m_ipkgArgs.dest )
free( m_ipkgArgs.dest );
if ( !destination.isNull() )
{
int len = destination.length() + 1;
m_ipkgArgs.dest = (char *)malloc( len );
strncpy( m_ipkgArgs.dest, destination, destination.length() );
m_ipkgArgs.dest[ len - 1 ] = '\0';
}
else
m_ipkgArgs.dest = 0l;
// Connect output signal to widget
if ( !rawOutput )
{
// TODO - connect to local slot and parse output before emitting signalIpkgMessage
}
switch( command )
{
case OPackage::Update : {
connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
ipkg_lists_update( &m_ipkgArgs );
disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 );
};
break;
case OPackage::Upgrade : {
connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
ipkg_packages_upgrade( &m_ipkgArgs );
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h
index 9a7802c..88f0e32 100644
--- a/noncore/settings/packagemanager/oipkg.h
+++ b/noncore/settings/packagemanager/oipkg.h
@@ -14,64 +14,66 @@
    .%`+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 OIPKG_H
#define OIPKG_H
#include "oconfitem.h"
#include "opackage.h"
#include <qpe/config.h>
#include <qobject.h>
// Ipkg execution options (m_ipkgExecOptions)
#define FORCE_DEPENDS 0x0001
#define FORCE_REMOVE 0x0002
#define FORCE_REINSTALL 0x0004
#define FORCE_OVERWRITE 0x0008
+#define FORCE_RECURSIVE 0x0010
+#define FORCE_VERBOSE_WGET 0x0020
class OConfItemList;
class OIpkg : public QObject
{
Q_OBJECT
public:
OIpkg( Config *config = 0l, QObject *parent = 0l, const char *name = 0l );
~OIpkg();
OConfItemList *configItems();
OConfItemList *servers();
OConfItemList *destinations();
OConfItemList *options();
int ipkgExecOptions() { return m_ipkgExecOptions; }
int ipkgExecVerbosity() { return m_ipkgExecVerbosity; }
void setConfigItems( OConfItemList *configList );
void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; }
void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; }
void saveSettings();
OPackageList *availablePackages( const QString &server = QString::null );
OPackageList *installedPackages( const QString &destName = QString::null,
const QString &destPath = QString::null );
OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
const QString &name = QString::null );
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index 58c572b..d014378 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -121,64 +121,68 @@ void OIpkgConfigDlg::accept()
m_proxyUsername->text() ) );
confItem = m_ipkg->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() ) );
QString listsDir = m_optSourceLists->text();
if ( listsDir == QString::null || listsDir == "" )
listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define
confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" );
if ( confItem )
confItem->setValue( listsDir );
else
m_configs->append( new OConfItem( OConfItem::Other, "lists_dir",
listsDir, "name" ) );
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;
+ if ( m_optForceRecursive->isChecked() )
+ options |= FORCE_RECURSIVE;
+ if ( m_optVerboseWget->isChecked() )
+ options |= FORCE_VERBOSE_WGET;
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, 2, 3, 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(slotServerSelected(int)) );
layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 );
@@ -307,91 +311,99 @@ void OIpkgConfigDlg::initProxyWidget()
}
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 );
QGridLayout *layout = new QGridLayout( container, 8, 2, 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->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 );
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->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 );
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->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 );
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->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 );
+ 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, 4, 4, 0, 1 );
+ 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, 5, 5, 0, 1 );
+ 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, 6, 6, 0, 1 );
+ 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, 7, 0 );
+ 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, 7, 1 );
+ 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" )
{
@@ -404,64 +416,68 @@ void OIpkgConfigDlg::initData()
}
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();
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() );
}
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;
}
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h
index 88381ab..36ab9a0 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.h
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.h
@@ -67,64 +67,66 @@ private:
// UI controls
QVBoxLayout m_layout; // Main dialog layout control
Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control
QWidget *m_serverWidget; // Widget containing server configuration controls
QWidget *m_destWidget; // Widget containing destination configuration controls
QWidget *m_proxyWidget; // Widget containing proxy configuration controls
QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls
// Server configuration UI controls
QListBox *m_serverList; // Server list selection
QPushButton *m_serverEditBtn; // Server edit button
QPushButton *m_serverDeleteBtn; // Server edit button
// Destination configuration UI controls
QListBox *m_destList; // Destination list selection
QPushButton *m_destEditBtn; // Destination edit button
QPushButton *m_destDeleteBtn; // Destination edit button
// Proxy server configuration UI controls
QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box
QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box
QLineEdit *m_proxyFtpServer; // FTP proxy server edit box
QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box
QLineEdit *m_proxyUsername; // Proxy server username edit box
QLineEdit *m_proxyPassword; // Proxy server password edit box
// Options configuration UI controls
QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox
QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox
QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox
QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox
+ QCheckBox *m_optForceRecursive; // Force recursive ipkg option checkbox
+ QCheckBox *m_optVerboseWget; // Force verbose_wget ipkg option checkbox
QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection
QLineEdit *m_optSourceLists; // Ipkg source lists destination directory
void initServerWidget();
void initDestinationWidget();
void initProxyWidget();
void initOptionsWidget();
void initData();
private slots:
void slotServerSelected( int index );
void slotServerNew();
void slotServerEdit();
void slotServerDelete();
void slotDestSelected( int index );
void slotDestNew();
void slotDestEdit();
void slotDestDelete();
void slotOptSelectSourceListsPath();
};
class OIpkgServerDlg : public QDialog
{
Q_OBJECT
public:
OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l );
protected slots: