summaryrefslogtreecommitdiff
Unidiff
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 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
10#include "installdialog.h" 10#include "installdialog.h"
11 11
12#include <qcheckbox.h> 12#include <qcheckbox.h>
13#include <qgroupbox.h> 13#include <qgroupbox.h>
14#include <qheader.h> 14#include <qheader.h>
15#include <qlistview.h> 15#include <qlistview.h>
16#include <qpushbutton.h> 16#include <qpushbutton.h>
17#include <qlayout.h> 17#include <qlayout.h>
18#include <qvariant.h> 18#include <qvariant.h>
19#include <qtooltip.h> 19#include <qtooltip.h>
20#include <qwhatsthis.h> 20#include <qwhatsthis.h>
21 21
22 22
23InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) 23InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl )
24 : QDialog( parent, name, modal, fl ) 24 : QDialog( parent, name, modal, fl )
25{ 25{
26 settings = s; 26 settings = s;
27 if ( !name ) 27 if ( !name )
28 setName( "InstallDialog" ); 28 setName( "InstallDialog" );
29 resize( 223, 269 ); 29 resize( 223, 269 );
30 setCaption( tr( "Install" ) ); 30 setCaption( tr( "Install" ) );
31 InstallDialogLayout = new QGridLayout( this ); 31 InstallDialogLayout = new QGridLayout( this );
32 InstallDialogLayout->setSpacing( 2 ); 32 InstallDialogLayout->setSpacing( 2 );
33 InstallDialogLayout->setMargin( 2 ); 33 InstallDialogLayout->setMargin( 2 );
34 34
35 ListViewPackages = new PackageListView( this,"listViewPackages",settings ); 35 ListViewPackages = new PackageListView( this,"listViewPackages",settings );
36 36
37 InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); 37 InstallDialogLayout->addWidget( ListViewPackages, 0, 0 );
38 38
39 GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); 39 GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" );
40 GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); 40 GroupBoxOptions->setTitle( tr( "Ipkg options" ) );
41 GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); 41 GroupBoxOptions->setColumnLayout(0, Qt::Vertical );
42 GroupBoxOptions->layout()->setSpacing( 0 ); 42 GroupBoxOptions->layout()->setSpacing( 0 );
43 GroupBoxOptions->layout()->setMargin( 0 ); 43 GroupBoxOptions->layout()->setMargin( 0 );
44 GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); 44 GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() );
45 GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); 45 GroupBoxOptionsLayout->setAlignment( Qt::AlignTop );
46 GroupBoxOptionsLayout->setSpacing( 2 ); 46 GroupBoxOptionsLayout->setSpacing( 0 );
47 GroupBoxOptionsLayout->setMargin( 2 ); 47 GroupBoxOptionsLayout->setMargin( 0 );
48 48
49 _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); 49 _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" );
50 QFont _force_depends_font( _force_depends->font() ); 50 QFont _force_depends_font( _force_depends->font() );
51 _force_depends_font.setPointSize( 8 ); 51 _force_depends_font.setPointSize( 8 );
52 _force_depends->setFont( _force_depends_font ); 52 _force_depends->setFont( _force_depends_font );
53 _force_depends->setText( tr( "-force-depends" ) ); 53 _force_depends->setText( tr( "-force-depends" ) );
54 //_force_depends->setChecked( true ); 54 //_force_depends->setChecked( true );
55 55
56 GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); 56 GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 );
57 57
58 _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); 58 _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" );
59 QFont _force_reinstall_font( _force_reinstall->font() ); 59 QFont _force_reinstall_font( _force_reinstall->font() );
60 _force_reinstall_font.setPointSize( 8 ); 60 _force_reinstall_font.setPointSize( 8 );
61 _force_reinstall->setFont( _force_reinstall_font ); 61 _force_reinstall->setFont( _force_reinstall_font );
62 _force_reinstall->setText( tr( "-force-reinstall" ) ); 62 _force_reinstall->setText( tr( "-force-reinstall" ) );
63 63
64 GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); 64 GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 );
65 65
66 _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); 66 _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" );
67 QFont _force_remove_font( _force_remove->font() ); 67 QFont _force_remove_font( _force_remove->font() );
68 _force_remove_font.setPointSize( 8 ); 68 _force_remove_font.setPointSize( 8 );
69 _force_remove->setFont( _force_remove_font ); 69 _force_remove->setFont( _force_remove_font );
70 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); 70 _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
71 71
72 GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); 72 GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 );
73 73
74 _force_overwrite = new QCheckBox( GroupBoxOptions, "_force_overwrite" );
75 QFont _force_overwrite_font( _force_overwrite->font() );
76 _force_overwrite_font.setPointSize( 8 );
77 _force_overwrite->setFont( _force_overwrite_font );
78 _force_overwrite->setText( tr( "-force-overwrite" ) );
79
80 GroupBoxOptionsLayout->addWidget(_force_overwrite, 3, 0 );
81
74 InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); 82 InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 );
75 toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); 83 toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") );
76 toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); 84 toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") );
77 85
78} 86}
79 87
80/* 88/*
81 * Destroys the object and frees any allocated resources 89 * Destroys the object and frees any allocated resources
82 */ 90 */
83InstallDialog::~InstallDialog() 91InstallDialog::~InstallDialog()
84{ 92{
85 // no need to delete child widgets, Qt does it all for us 93 // no need to delete child widgets, Qt does it all for us
86} 94}
87 95
88/* 96/*
89 * Main event handler. Reimplemented to handle application 97 * Main event handler. Reimplemented to handle application
90 * font changes 98 * font changes
91 */ 99 */
92bool InstallDialog::event( QEvent* ev ) 100bool InstallDialog::event( QEvent* ev )
93{ 101{
94 bool ret = QDialog::event( ev ); 102 bool ret = QDialog::event( ev );
95 if ( ev->type() == QEvent::ApplicationFontChange ) { 103 if ( ev->type() == QEvent::ApplicationFontChange ) {
96 QFont _force_depends_font( _force_depends->font() ); 104 QFont _force_depends_font( _force_depends->font() );
97 _force_depends_font.setPointSize( 8 ); 105 _force_depends_font.setPointSize( 8 );
98 _force_depends->setFont( _force_depends_font ); 106 _force_depends->setFont( _force_depends_font );
99 QFont _force_reinstall_font( _force_reinstall->font() ); 107 QFont _force_reinstall_font( _force_reinstall->font() );
100 _force_reinstall_font.setPointSize( 8 ); 108 _force_reinstall_font.setPointSize( 8 );
101 _force_reinstall->setFont( _force_reinstall_font ); 109 _force_reinstall->setFont( _force_reinstall_font );
102 QFont _force_remove_font( _force_remove->font() ); 110 QFont _force_remove_font( _force_remove->font() );
111 QFont _force_overwrite_font( _force_overwrite->font() );
103 _force_remove_font.setPointSize( 8 ); 112 _force_remove_font.setPointSize( 8 );
104 _force_remove->setFont( _force_remove_font ); 113 _force_remove->setFont( _force_remove_font );
105 } 114 }
106 return ret; 115 return ret;
107} 116}
108 117
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 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 9// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
10 10
11 11
12#ifndef INSTALLDIALOG_H 12#ifndef INSTALLDIALOG_H
13#define INSTALLDIALOG_H 13#define INSTALLDIALOG_H
14 14
15#include "pksettings.h" 15#include "pksettings.h"
16#include "packagelistview.h" 16#include "packagelistview.h"
17#include <qvariant.h> 17#include <qvariant.h>
18#include <qdialog.h> 18#include <qdialog.h>
19class QVBoxLayout; 19class QVBoxLayout;
20class QHBoxLayout; 20class QHBoxLayout;
21class QGridLayout; 21class QGridLayout;
22class QCheckBox; 22class QCheckBox;
23class QGroupBox; 23class QGroupBox;
24class QListView; 24class QListView;
25class QListViewItem; 25class QListViewItem;
26 26
27class InstallDialog : public QDialog 27class InstallDialog : public QDialog
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 30
31public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 31public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
32 ~InstallDialog(); 32 ~InstallDialog();
33 33
34 PackageListView* ListViewPackages; 34 PackageListView* ListViewPackages;
35 QGroupBox* GroupBoxOptions; 35 QGroupBox* GroupBoxOptions;
36 QCheckBox* _force_depends; 36 QCheckBox* _force_depends;
37 QCheckBox* _force_reinstall; 37 QCheckBox* _force_reinstall;
38 QCheckBox* _force_overwrite;
38 QCheckBox* _force_remove; 39 QCheckBox* _force_remove;
39 QCheckListItem *toRemoveItem; 40 QCheckListItem *toRemoveItem;
40 QCheckListItem *toInstallItem; 41 QCheckListItem *toInstallItem;
41 42
42protected: 43protected:
43 QGridLayout* InstallDialogLayout; 44 QGridLayout* InstallDialogLayout;
44 QGridLayout* GroupBoxOptionsLayout; 45 QGridLayout* GroupBoxOptionsLayout;
45 bool event( QEvent* ); 46 bool event( QEvent* );
46private: 47private:
47 PackageManagerSettings* settings; 48 PackageManagerSettings* settings;
48}; 49};
49 50
50#endif // INSTALLDIALOG_H 51#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
@@ -14,128 +14,130 @@
14 14
15//#include <opie/oprocess.h> 15//#include <opie/oprocess.h>
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/config.h> 17#include <qpe/config.h>
18#include <qpe/stringutil.h> 18#include <qpe/stringutil.h>
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qdir.h> 20#include <qdir.h>
21#include <qfile.h> 21#include <qfile.h>
22#include <qgroupbox.h> 22#include <qgroupbox.h>
23#include <qmultilineedit.h> 23#include <qmultilineedit.h>
24#include <qstring.h> 24#include <qstring.h>
25#include <qcheckbox.h> 25#include <qcheckbox.h>
26#include <qtextstream.h> 26#include <qtextstream.h>
27#include <qtextview.h> 27#include <qtextview.h>
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qprogressbar.h> 29#include <qprogressbar.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qlayout.h> 31#include <qlayout.h>
32 32
33#include <stdlib.h> 33#include <stdlib.h>
34#include <unistd.h> 34#include <unistd.h>
35 35
36#include "mainwindow.h" 36#include "mainwindow.h"
37 37
38 38
39 39
40PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 40PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
41 : QObject ( p ) 41 : QObject ( p )
42{ 42{
43 settings = s; 43 settings = s;
44 runwindow = new RunWindow( p, name, true, f ); 44 runwindow = new RunWindow( p, name, true, f );
45 45
46 Config cfg( "oipkg", Config::User ); 46 Config cfg( "oipkg", Config::User );
47 cfg.setGroup( "ipkg" ); 47 cfg.setGroup( "ipkg" );
48 ipkg_cmd = cfg.readEntry( "cmd", "ipkg" )+" "; 48 ipkg_cmd = cfg.readEntry( "cmd", "ipkg" )+" ";
49} 49}
50 50
51PmIpkg::~PmIpkg() 51PmIpkg::~PmIpkg()
52{ 52{
53} 53}
54 54
55bool PmIpkg::runIpkg(const QString& args, const QString& dest ) 55bool PmIpkg::runIpkg(const QString& args, const QString& dest )
56{ 56{
57 bool ret=false; 57 bool ret=false;
58 QDir::setCurrent("/tmp"); 58 QDir::setCurrent("/tmp");
59 QString cmd = ipkg_cmd; 59 QString cmd = ipkg_cmd;
60 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 60 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
61 if (!args.contains("update")) 61 if (!args.contains("update"))
62 { 62 {
63 if ( dest == "" ) 63 if ( dest == "" )
64 cmd += " -dest "+settings->getDestinationName(); 64 cmd += " -dest "+settings->getDestinationName();
65 else 65 else
66 cmd += " -dest "+ dest; 66 cmd += " -dest "+ dest;
67 67
68 cmd += " -force-defaults "; 68 cmd += " -force-defaults ";
69 69
70 if ( installDialog && installDialog->_force_depends ) 70 if ( installDialog && installDialog->_force_depends )
71 { 71 {
72 if (installDialog->_force_depends->isChecked()) 72 if (installDialog->_force_depends->isChecked())
73 cmd += " -force-depends "; 73 cmd += " -force-depends ";
74 if (installDialog->_force_reinstall->isChecked()) 74 if (installDialog->_force_reinstall->isChecked())
75 cmd += " -force-reinstall "; 75 cmd += " -force-reinstall ";
76 if (installDialog->_force_remove->isChecked()) 76 if (installDialog->_force_remove->isChecked())
77 cmd += " -force-removal-of-essential-packages "; 77 cmd += " -force-removal-of-essential-packages ";
78 if (installDialog->_force_overwrite->isChecked())
79 cmd += " -force-overwrite ";
78 } 80 }
79 } //!args.contains("update") 81 } //!args.contains("update")
80 82
81 out( "Starting to "+ args+"\n"); 83 out( "Starting to "+ args+"\n");
82 qApp->processEvents(); 84 qApp->processEvents();
83 cmd += args; 85 cmd += args;
84 out( "running:\n"+cmd+"\n" ); 86 out( "running:\n"+cmd+"\n" );
85 pvDebug(2,"running:"+cmd); 87 pvDebug(2,"running:"+cmd);
86 qApp->processEvents(); 88 qApp->processEvents();
87 FILE *fp; 89 FILE *fp;
88 char line[130]; 90 char line[130];
89 QString lineStr, lineStrOld; 91 QString lineStr, lineStrOld;
90 sleep(1); 92 sleep(1);
91 cmd +=" 2>&1"; 93 cmd +=" 2>&1";
92 fp = popen( (const char *) cmd, "r"); 94 fp = popen( (const char *) cmd, "r");
93 if ( fp == NULL ) { 95 if ( fp == NULL ) {
94 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 96 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
95 out("\nError while executing "+ cmd+"\n\n"); 97 out("\nError while executing "+ cmd+"\n\n");
96 ret = false; 98 ret = false;
97 } else { 99 } else {
98 while ( fgets( line, sizeof line, fp) != NULL) 100 while ( fgets( line, sizeof line, fp) != NULL)
99 { 101 {
100 lineStr = line; 102 lineStr = line;
101 lineStr=lineStr.left(lineStr.length()-1); 103 lineStr=lineStr.left(lineStr.length()-1);
102 //Configuring opie-oipkg...Done 104 //Configuring opie-oipkg...Done
103 if (lineStr.contains("Done")) ret = true; 105 if (lineStr.contains("Done")) ret = true;
104 if (lineStr!=lineStrOld) 106 if (lineStr!=lineStrOld)
105 out(lineStr); 107 out(lineStr);
106 lineStrOld = lineStr; 108 lineStrOld = lineStr;
107 qApp->processEvents(); 109 qApp->processEvents();
108 } 110 }
109 } 111 }
110 pclose(fp); 112 pclose(fp);
111 pvDebug(2,QString(ret?"success\n":"failure\n")); 113 pvDebug(2,QString(ret?"success\n":"failure\n"));
112 return ret; 114 return ret;
113} 115}
114 116
115void PmIpkg::makeLinks(Package *pack) 117void PmIpkg::makeLinks(Package *pack)
116{ 118{
117 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 119 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
118 QString pn = pack->name(); 120 QString pn = pack->name();
119 linkPackage( pack->packageName(), pack->dest() ); 121 linkPackage( pack->packageName(), pack->dest() );
120} 122}
121 123
122QStringList* PmIpkg::getList( QString packFileName, QString d ) 124QStringList* PmIpkg::getList( QString packFileName, QString d )
123{ 125{
124 QString dest = settings->getDestinationUrlByName( d ); 126 QString dest = settings->getDestinationUrlByName( d );
125 dest = dest==""?d:dest; 127 dest = dest==""?d:dest;
126 // if (dest == "/" ) return 0; 128 // if (dest == "/" ) return 0;
127 { 129 {
128 Config cfg( "oipkg", Config::User ); 130 Config cfg( "oipkg", Config::User );
129 cfg.setGroup( "Common" ); 131 cfg.setGroup( "Common" );
130 QString statusDir = cfg.readEntry( "statusDir", "" ); 132 QString statusDir = cfg.readEntry( "statusDir", "" );
131 } 133 }
132 QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; 134 QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
133 QFile f( packFileDir ); 135 QFile f( packFileDir );
134 qDebug("Try to open %s", packFileDir.latin1()); 136 qDebug("Try to open %s", packFileDir.latin1());
135 if ( ! f.open(IO_ReadOnly) ) 137 if ( ! f.open(IO_ReadOnly) )
136 { 138 {
137 out( "Could not open:\n"+packFileDir ); 139 out( "Could not open:\n"+packFileDir );
138 f.close(); 140 f.close();
139 packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; 141 packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
140 f.setName( packFileDir ); 142 f.setName( packFileDir );
141 qDebug("Try to open %s", packFileDir.latin1()); 143 qDebug("Try to open %s", packFileDir.latin1());