summaryrefslogtreecommitdiff
authortille <tille>2002-07-30 14:37:26 (UTC)
committer tille <tille>2002-07-30 14:37:26 (UTC)
commit988409a5a21b3a4238ce41316e48777c885f147a (patch) (side-by-side diff)
tree0c62baa663e715f81e936664e0775dddb96ea519
parent0adb56cb2cd83e9933baa9776c77c4c637f93d04 (diff)
downloadopie-988409a5a21b3a4238ce41316e48777c885f147a.zip
opie-988409a5a21b3a4238ce41316e48777c885f147a.tar.gz
opie-988409a5a21b3a4238ce41316e48777c885f147a.tar.bz2
Added -force-overwrite ipkg option
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/installdialog.cpp17
-rw-r--r--noncore/unsupported/oipkg/installdialog.h1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp2
3 files changed, 16 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp
index c676e84..fd93ad3 100644
--- a/noncore/unsupported/oipkg/installdialog.cpp
+++ b/noncore/unsupported/oipkg/installdialog.cpp
@@ -1,108 +1,117 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "installdialog.h"
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qheader.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
settings = s;
if ( !name )
setName( "InstallDialog" );
resize( 223, 269 );
setCaption( tr( "Install" ) );
InstallDialogLayout = new QGridLayout( this );
InstallDialogLayout->setSpacing( 2 );
InstallDialogLayout->setMargin( 2 );
ListViewPackages = new PackageListView( this,"listViewPackages",settings );
InstallDialogLayout->addWidget( ListViewPackages, 0, 0 );
GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" );
GroupBoxOptions->setTitle( tr( "Ipkg options" ) );
GroupBoxOptions->setColumnLayout(0, Qt::Vertical );
GroupBoxOptions->layout()->setSpacing( 0 );
GroupBoxOptions->layout()->setMargin( 0 );
GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() );
GroupBoxOptionsLayout->setAlignment( Qt::AlignTop );
- GroupBoxOptionsLayout->setSpacing( 2 );
- GroupBoxOptionsLayout->setMargin( 2 );
+ GroupBoxOptionsLayout->setSpacing( 0 );
+ GroupBoxOptionsLayout->setMargin( 0 );
_force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" );
QFont _force_depends_font( _force_depends->font() );
_force_depends_font.setPointSize( 8 );
_force_depends->setFont( _force_depends_font );
_force_depends->setText( tr( "-force-depends" ) );
//_force_depends->setChecked( true );
GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 );
_force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" );
QFont _force_reinstall_font( _force_reinstall->font() );
_force_reinstall_font.setPointSize( 8 );
_force_reinstall->setFont( _force_reinstall_font );
_force_reinstall->setText( tr( "-force-reinstall" ) );
GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 );
_force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" );
QFont _force_remove_font( _force_remove->font() );
_force_remove_font.setPointSize( 8 );
- _force_remove->setFont( _force_remove_font );
+ _force_remove->setFont( _force_remove_font );
_force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 );
+ _force_overwrite = new QCheckBox( GroupBoxOptions, "_force_overwrite" );
+ QFont _force_overwrite_font( _force_overwrite->font() );
+ _force_overwrite_font.setPointSize( 8 );
+ _force_overwrite->setFont( _force_overwrite_font );
+ _force_overwrite->setText( tr( "-force-overwrite" ) );
+
+ GroupBoxOptionsLayout->addWidget(_force_overwrite, 3, 0 );
+
InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 );
toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") );
toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") );
}
/*
* Destroys the object and frees any allocated resources
*/
InstallDialog::~InstallDialog()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Main event handler. Reimplemented to handle application
* font changes
*/
bool InstallDialog::event( QEvent* ev )
{
bool ret = QDialog::event( ev );
if ( ev->type() == QEvent::ApplicationFontChange ) {
QFont _force_depends_font( _force_depends->font() );
_force_depends_font.setPointSize( 8 );
_force_depends->setFont( _force_depends_font );
QFont _force_reinstall_font( _force_reinstall->font() );
_force_reinstall_font.setPointSize( 8 );
- _force_reinstall->setFont( _force_reinstall_font );
+ _force_reinstall->setFont( _force_reinstall_font );
QFont _force_remove_font( _force_remove->font() );
+ QFont _force_overwrite_font( _force_overwrite->font() );
_force_remove_font.setPointSize( 8 );
_force_remove->setFont( _force_remove_font );
}
return ret;
}
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h
index 828c8df..d3510ff 100644
--- a/noncore/unsupported/oipkg/installdialog.h
+++ b/noncore/unsupported/oipkg/installdialog.h
@@ -1,50 +1,51 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#ifndef INSTALLDIALOG_H
#define INSTALLDIALOG_H
#include "pksettings.h"
#include "packagelistview.h"
#include <qvariant.h>
#include <qdialog.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QCheckBox;
class QGroupBox;
class QListView;
class QListViewItem;
class InstallDialog : public QDialog
{
Q_OBJECT
public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~InstallDialog();
PackageListView* ListViewPackages;
QGroupBox* GroupBoxOptions;
QCheckBox* _force_depends;
QCheckBox* _force_reinstall;
+ QCheckBox* _force_overwrite;
QCheckBox* _force_remove;
QCheckListItem *toRemoveItem;
QCheckListItem *toInstallItem;
protected:
QGridLayout* InstallDialogLayout;
QGridLayout* GroupBoxOptionsLayout;
bool event( QEvent* );
private:
PackageManagerSettings* settings;
};
#endif // INSTALLDIALOG_H
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 84de67b..2ed313c 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -1,173 +1,175 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "pmipkg.h"
#include "pksettings.h"
#include "package.h"
#include "packagelistitem.h"
//#include <opie/oprocess.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/stringutil.h>
#include <qpe/qpeapplication.h>
#include <qdir.h>
#include <qfile.h>
#include <qgroupbox.h>
#include <qmultilineedit.h>
#include <qstring.h>
#include <qcheckbox.h>
#include <qtextstream.h>
#include <qtextview.h>
#include <qmessagebox.h>
#include <qprogressbar.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <stdlib.h>
#include <unistd.h>
#include "mainwindow.h"
PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
: QObject ( p )
{
settings = s;
runwindow = new RunWindow( p, name, true, f );
Config cfg( "oipkg", Config::User );
cfg.setGroup( "ipkg" );
ipkg_cmd = cfg.readEntry( "cmd", "ipkg" )+" ";
}
PmIpkg::~PmIpkg()
{
}
bool PmIpkg::runIpkg(const QString& args, const QString& dest )
{
bool ret=false;
QDir::setCurrent("/tmp");
QString cmd = ipkg_cmd;
pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
if (!args.contains("update"))
{
if ( dest == "" )
cmd += " -dest "+settings->getDestinationName();
else
cmd += " -dest "+ dest;
cmd += " -force-defaults ";
if ( installDialog && installDialog->_force_depends )
{
if (installDialog->_force_depends->isChecked())
cmd += " -force-depends ";
if (installDialog->_force_reinstall->isChecked())
cmd += " -force-reinstall ";
if (installDialog->_force_remove->isChecked())
cmd += " -force-removal-of-essential-packages ";
+ if (installDialog->_force_overwrite->isChecked())
+ cmd += " -force-overwrite ";
}
} //!args.contains("update")
out( "Starting to "+ args+"\n");
qApp->processEvents();
cmd += args;
out( "running:\n"+cmd+"\n" );
pvDebug(2,"running:"+cmd);
qApp->processEvents();
FILE *fp;
char line[130];
QString lineStr, lineStrOld;
sleep(1);
cmd +=" 2>&1";
fp = popen( (const char *) cmd, "r");
if ( fp == NULL ) {
qDebug("Could not execute '" + cmd + "'! err=%d", fp);
out("\nError while executing "+ cmd+"\n\n");
ret = false;
} else {
while ( fgets( line, sizeof line, fp) != NULL)
{
lineStr = line;
lineStr=lineStr.left(lineStr.length()-1);
//Configuring opie-oipkg...Done
if (lineStr.contains("Done")) ret = true;
if (lineStr!=lineStrOld)
out(lineStr);
lineStrOld = lineStr;
qApp->processEvents();
}
}
pclose(fp);
pvDebug(2,QString(ret?"success\n":"failure\n"));
return ret;
}
void PmIpkg::makeLinks(Package *pack)
{
pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
QString pn = pack->name();
linkPackage( pack->packageName(), pack->dest() );
}
QStringList* PmIpkg::getList( QString packFileName, QString d )
{
QString dest = settings->getDestinationUrlByName( d );
dest = dest==""?d:dest;
// if (dest == "/" ) return 0;
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
QString statusDir = cfg.readEntry( "statusDir", "" );
}
QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
QFile f( packFileDir );
qDebug("Try to open %s", packFileDir.latin1());
if ( ! f.open(IO_ReadOnly) )
{
out( "Could not open:\n"+packFileDir );
f.close();
packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
f.setName( packFileDir );
qDebug("Try to open %s", packFileDir.latin1());
if ( ! f.open(IO_ReadOnly) )
{
qDebug(" Panik! Could not open"+packFileDir);
out( "Could not open:\n"+packFileDir+"\n Panik!" );
return (QStringList*)0;
}
}
QStringList *fileList = new QStringList();
QTextStream t( &f );
while ( !t.eof() )
{
*fileList += t.readLine();
}
f.close();
return fileList;
}
void PmIpkg::linkPackage( QString packFileName, QString dest )
{
if (dest == "root" || dest == "/" ) return;
QStringList *fileList = getList( packFileName, dest );
processFileList( fileList, dest );
delete fileList;
}
void PmIpkg::processFileList( QStringList *fileList, QString d )
{
if (!fileList || fileList->isEmpty()) return;
for (uint i=0; i < fileList->count(); i++)
{
QString dest = settings->getDestinationUrlByName( d );
dest = dest==""?d:dest;