summaryrefslogtreecommitdiff
authortille <tille>2002-05-26 12:17:56 (UTC)
committer tille <tille>2002-05-26 12:17:56 (UTC)
commit602e52f454a3d3a5cd973f3d7957d2d96f86464e (patch) (side-by-side diff)
treeeff9aabdbf44804c1dcc42639eaa00fa92dd200c
parent26eb036407dbade370032dcca6af49d682f0ebf3 (diff)
downloadopie-602e52f454a3d3a5cd973f3d7957d2d96f86464e.zip
opie-602e52f454a3d3a5cd973f3d7957d2d96f86464e.tar.gz
opie-602e52f454a3d3a5cd973f3d7957d2d96f86464e.tar.bz2
do not close update windows when not successful
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp2
-rw-r--r--noncore/unsupported/oipkg/package.cpp2
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp3
3 files changed, 4 insertions, 3 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 9c4c752..27c9f4c 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -46,206 +46,206 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
packageListSearch.setSettings( settings );
packageListDocLnk.setSettings( settings );
pvDebug(9,"packageListServers.update");
packageListServers.update();
pvDebug(9,"packageListDocLnk.update");
packageListDocLnk.update();
pvDebug(9,"makeMenu");
makeMenu();
makeChannel();
//opie is hardcoded default ;)
// pvDebug(9,"section->setCurrentItem");
// for (int i=0;i<section->count();i++)
// if (section->text(i)=="opie")
// section->setCurrentItem(i);
// sectionChanged();
connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
connect( settings->removeLinksButton, SIGNAL( clicked()),
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
pvDebug(9,"displayList");
displayList();
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
QPopupMenu *srvMenu = new QPopupMenu( menuBar );
QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
// QPopupMenu *sectMenu = new QPopupMenu( menuBar );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Package" ), srvMenu );
menuBar->insertItem( tr( "View" ), viewMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
// menuBar->insertItem( tr( "Sections" ), sectMenu );
QLabel *spacer;
// spacer = new QLabel( "", toolBar );
// spacer->setBackgroundColor( toolBar->backgroundColor() );
// toolBar->setStretchableWidget( spacer );
runAction = new QAction( tr( "Apply" ),
Resource::loadPixmap( "oipkg/install" ),
QString::null, 0, this, 0 );
connect( runAction, SIGNAL( activated() ),
this, SLOT( runIpkg() ) );
runAction->addTo( toolBar );
runAction->addTo( srvMenu );
srvMenu->insertSeparator ();
updateAction = new QAction( tr( "Update" ),
Resource::loadIconSet( "oipkg/update" ),
QString::null, 0, this, 0 );
connect( updateAction, SIGNAL( activated() ),
this , SLOT( updateList() ) );
updateAction->addTo( toolBar );
updateAction->addTo( srvMenu );
QAction *cfgact;
cfgact = new QAction( tr( "Setups" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettings() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Servers" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsSrv() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Destinations" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsDst() ) );
cfgact->addTo( cfgMenu );
QAction *a;
// SECTIONS
sectionBar = new QPEToolBar( this );
addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
sectionBar->setHorizontalStretchable( true );
QLabel *label = new QLabel( tr("Section: "), sectionBar );
label->setBackgroundColor( sectionBar->backgroundColor() );
- sectionBar->setStretchableWidget( label );
section = new QComboBox( false, sectionBar );
label = new QLabel( " / ", sectionBar );
label->setBackgroundColor( sectionBar->backgroundColor() );
subsection = new QComboBox( false, sectionBar );
a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
a->addTo( sectionBar );
setSections();
setSubSections();
sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
sectionAction->setToggleAction( true );
sectionAction->addTo( viewMenu );
+ sectionBar->setStretchableWidget( section );
//FIND
findBar = new QPEToolBar(this);
addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
label = new QLabel( tr("Filter: "), findBar );
label->setBackgroundColor( findBar->backgroundColor() );
findBar->setHorizontalStretchable( TRUE );
findEdit = new QLineEdit( findBar, "findEdit" );
findBar->setStretchableWidget( findEdit );
connect( findEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( displayList() ) );
a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
a->addTo( findBar );
a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
a->addTo( findBar );
findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
findAction->setToggleAction( true );
findAction->addTo( viewMenu );
//SEARCH
searchBar = new QPEToolBar(this);
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
label = new QLabel( tr("ipkgfind: "), searchBar );
label->setBackgroundColor( searchBar->backgroundColor() );
searchBar->setHorizontalStretchable( TRUE );
searchEdit = new QLineEdit( searchBar, "seachEdit" );
searchBar->setStretchableWidget( searchEdit );
// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
// this, SLOT( displayList() ) );
a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
a->addTo( searchBar );
searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
searchCommit->addTo( searchBar );
a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
a->addTo( searchBar );
searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
searchAction->setToggleAction( true );
searchAction->addTo( viewMenu );
//DEST
destBar = new QPEToolBar(this);
addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
label = new QLabel( tr("Destination: "), destBar );
label->setBackgroundColor( destBar->backgroundColor() );
destBar->setHorizontalStretchable( TRUE );
destination = new QComboBox( false, destBar );
destination->insertStringList( settings->getDestinationNames() );
setComboName(destination,settings->getDestinationName());
connect( destination, SIGNAL(activated(int)),
settings, SLOT(activeDestinationChange(int)) );
spacer = new QLabel( " ", destBar );
spacer->setBackgroundColor( destBar->backgroundColor() );
CheckBoxLink = new QCheckBox( tr("Link"), destBar);
CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
CheckBoxLink->setChecked( settings->createLinks() );
connect( CheckBoxLink, SIGNAL(toggled(bool)),
settings, SLOT(linkEnabled(bool)) );
destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
a->addTo( destBar );
destBar->setStretchableWidget( CheckBoxLink );
destAction->setToggleAction( true );
// destAction->addTo( viewMenu );
// configure the menus
Config cfg( "oipkg", Config::User );
cfg.setGroup( "gui" );
findShow( cfg.readBoolEntry( "findBar", true ) );
searchShow( cfg.readBoolEntry( "searchBar", true ) );
sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
destShow( cfg.readBoolEntry( "destBar", false ) );
}
MainWindow::~MainWindow()
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "gui" );
cfg.writeEntry( "findBar", !findBar->isHidden() );
cfg.writeEntry( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
cfg.writeEntry( "destBar", !destBar->isHidden() );
}
void MainWindow::runIpkg()
{
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 8c5f0ea..bfb48b3 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,149 +1,149 @@
#include "package.h"
#include <qpe/process.h>
#include <qpe/stringutil.h>
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include <unistd.h>
#include "debug.h"
//Package::~Package()
//{
//}
Package::Package( PackageManagerSettings *s )
{
init(s);
}
void Package::init( PackageManagerSettings *s )
{
settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
_useFileName = false;
_old = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
_versions=0;
_version="";
}
Package::Package( QStringList pack, PackageManagerSettings *s )
{
init(s);
parsePackage( pack );
}
Package::Package( QString n, PackageManagerSettings *s )
{
init(s);
if ( !QFile::exists( n ) )
{
_name = QString( n );
}else{
- pvDebug(2,"remote file: "+n);
+ pvDebug(4,"remote file: "+n);
parseIpkgFile( n );
_useFileName = true;
_fileName = QString( n );
}
}
Package::Package( Package *pi )
{
init(pi->settings);
copyValues( pi );
}
void Package::setValue( QString n, QString t )
{
if ( n == "Package" )
{
_name = QString( t );
}else if ( n == "Installed-Size" )
{
_size = t;
// }else if ( n == "Priority")
// {
}else if ( n == "Section")
{
setSection( t );
// }else if ( n == "Maintainer")
// {
//
// }else if ( n == "Architecture")
// {
}else if ( n == "Version")
{
_version = t;
// }else if ( n == "Pre-Depends")
// {
//
// }else if ( n == "Depends")
// {
}else if ( n == "Filename")
{
_fileName = t;
// }else if ( n == "Size")
// {
//
// }else if ( n == "MD5Sum")
// {
}else if ( n == "Description")
{
setDesc( t );
}else if ( n == "Status")
{
if ( installed() ) return;
_status = t;
// }else if ( n == "Essential")
// {
}else{
_values.insert(n,new QString(t));
}
}
QString Package::name()
{
if (_displayName.isEmpty() ) return _name;
else return _displayName;
}
QString Package::installName()
{
if (_useFileName) return _fileName;
else return _name;
}
bool Package::installed()
{
if (_status.contains("installed")) return true;
else
if (_versions)
{
QDictIterator<Package> other( *_versions );
while ( other.current() )
{
if (other.current()->status().contains("installed")
&& other.current()->version() == version())
return true;
++other;
}
}
return false;
}
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 30777c2..0fa4c61 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -247,151 +247,152 @@ void PmIpkg::commit()
void PmIpkg::doIt()
{
runwindow->progress->setProgress(0);
show();
remove();
install();
}
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
QStringList *fileList;
for (uint i=0; i < to_remove.count(); i++)
{
if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
{
runwindow->progress->setProgress( 1 );
linkOpp = removeLink;
to_remove.at(i)->processed();
pvDebug(3,"link "+QString::number(i));
if ( to_remove.at(i)->link() )
processFileList( fileList, to_remove.at(i)->dest() );
//pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
//if ( to_remove.at(i) ) to_remove.take( i );
out("\n");
}else{
out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
if ( to_remove.at(i)->link() )
processFileList( fileList, to_remove.at(i)->dest() );
}
if ( to_remove.at(i)->link() )
processFileList( fileList, to_remove.at(i)->dest() );
if ( to_remove.at(i)->link() )delete fileList;
}
to_remove.clear();
out("\n");
}
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
out(tr("Installing")+"\n"+tr("please wait")+"\n");
for (uint i=0; i < to_install.count(); i++)
{
qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
{
runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
to_install.at(i)->processed();
linkOpp = createLink;
if ( to_install.at(i)->link() )
makeLinks( to_install.at(i) );
// to_install.take( i );
out("\n");
}else{
out(tr("Error while installing")+to_install.at(i)->name()+"\n");
linkOpp = createLink;
if ( to_install.at(i)->link() )
makeLinks( to_install.at(i) );
}
}
out("\n");
to_install.clear();
}
void PmIpkg::createLinks( const QString &dest )
{
pvDebug(2,"PmIpkg::createLinks "+dest);
linkOpp=createLink;
QString url = settings->getDestinationUrlByName( dest );
url = url==""?dest:url;
processLinkDir( "/opt", url );
processLinkDir( "/usr", url );
}
void PmIpkg::removeLinks( const QString &dest )
{
pvDebug(2,"PmIpkg::removeLinks "+dest);
linkOpp=removeLink;
QString url = settings->getDestinationUrlByName( dest );
url = url==""?dest:url;
processLinkDir( "/opt", url );
processLinkDir( "/usr", url );
}
void PmIpkg::update()
{
show();
- runIpkg( "update" );
+ if ( runIpkg( "update" ) )
runwindow->close();
+ else out("An error occurred!\nPlease check the log.");
}
void PmIpkg::out( QString o )
{
runwindow->outPut->append(o);
runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
}
void PmIpkg::show()
{
if (!runwindow->isVisible())
{
runwindow->showMaximized();
runwindow->show();
}
runwindow->outPut->setText("");
}
void PmIpkg::installFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
pvDebug( 2,"PmIpkg::installFile "+ fileName);
Package *p = new Package(fileName,settings);
if ( dest!="") p->setDest( dest );
to_install.append( p );
commit();
delete p;
}
void PmIpkg::removeFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
pvDebug( 2,"PmIpkg::removeFile "+ fileName);
Package *p = new Package(fileName,settings);
if ( dest!="") p->setDest( dest );
to_remove.append( p );
commit();
delete p;
}
void PmIpkg::clearLists()
{
to_remove.clear();
to_install.clear();
}