author | tille <tille> | 2002-06-21 09:01:39 (UTC) |
---|---|---|
committer | tille <tille> | 2002-06-21 09:01:39 (UTC) |
commit | 0d5a0129ee055e0f077505b05caa942bf6ef6165 (patch) (unidiff) | |
tree | c718cc805ae49c922a126192c7e98747c025b103 | |
parent | 48847f165b3ee8d096871c1bde8748d18cfb0f43 (diff) | |
download | opie-0d5a0129ee055e0f077505b05caa942bf6ef6165.zip opie-0d5a0129ee055e0f077505b05caa942bf6ef6165.tar.gz opie-0d5a0129ee055e0f077505b05caa942bf6ef6165.tar.bz2 |
some fixes and first version with oprocess (out-ifdefed)
-rw-r--r-- | noncore/unsupported/oipkg/TODO | 13 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 23 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 15 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistdoclnk.cpp | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistdoclnk.h | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 6 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 72 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.h | 2 |
18 files changed, 139 insertions, 49 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index e7b017c..6e0e6ca 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,13 +1,20 @@ | |||
1 | * check for networt before installing from network | 1 | * check for network before installing from network |
2 | * Settings Class | 2 | * Settings Class / new setting dialog |
3 | * parse "to install" and "to remove" from status | 3 | * parse "to install" and "to remove" from status, and change status |
4 | i.e. improve status handling / modify status file | ||
5 | dest keyword in status? -> cworth | ||
4 | * install local file dialog | 6 | * install local file dialog |
7 | * parse lists files after opening feed / doclnk | ||
5 | * qcop | 8 | * qcop |
6 | * error handling | 9 | * error handling |
7 | * manage links | 10 | * manage links |
8 | * dependency checking | 11 | * dependency checking |
9 | * create dest if it does not exist | 12 | * create dest if it does not exist |
10 | * allow reinstalling | 13 | * allow reinstalling |
11 | * different types of filters and searches | 14 | * different types of filters and searches |
12 | i.e. name, desc, files etc | 15 | i.e. name, desc, files etc |
13 | * display new list after update | 16 | * display new list after update |
17 | * make sure oipkg installs to the correct dest when getting packet to install from list | ||
18 | dest keyword? | ||
19 | * cancel button while installing | ||
20 | * duplicate button for settings-servers | ||
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp index a2c9702..bb50103 100644 --- a/noncore/unsupported/oipkg/installdialog.cpp +++ b/noncore/unsupported/oipkg/installdialog.cpp | |||
@@ -58,34 +58,34 @@ InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const | |||
58 | QFont _force_reinstall_font( _force_reinstall->font() ); | 58 | QFont _force_reinstall_font( _force_reinstall->font() ); |
59 | _force_reinstall_font.setPointSize( 8 ); | 59 | _force_reinstall_font.setPointSize( 8 ); |
60 | _force_reinstall->setFont( _force_reinstall_font ); | 60 | _force_reinstall->setFont( _force_reinstall_font ); |
61 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 61 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
62 | 62 | ||
63 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); | 63 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); |
64 | 64 | ||
65 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); | 65 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); |
66 | QFont _force_remove_font( _force_remove->font() ); | 66 | QFont _force_remove_font( _force_remove->font() ); |
67 | _force_remove_font.setPointSize( 8 ); | 67 | _force_remove_font.setPointSize( 8 ); |
68 | _force_remove->setFont( _force_remove_font ); | 68 | _force_remove->setFont( _force_remove_font ); |
69 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 69 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
70 | 70 | ||
71 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); | 71 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); |
72 | 72 | ||
73 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); | 73 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); |
74 | toRemoveItem = new QCheckListItem( ListViewPackages, QObject::tr("To remove") ); | 74 | toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); |
75 | toInstallItem = new QCheckListItem( ListViewPackages, QObject::tr("To install") ); | 75 | toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); |
76 | 76 | ||
77 | } | 77 | } |
78 | 78 | ||
79 | /* | 79 | /* |
80 | * Destroys the object and frees any allocated resources | 80 | * Destroys the object and frees any allocated resources |
81 | */ | 81 | */ |
82 | InstallDialog::~InstallDialog() | 82 | InstallDialog::~InstallDialog() |
83 | { | 83 | { |
84 | // no need to delete child widgets, Qt does it all for us | 84 | // no need to delete child widgets, Qt does it all for us |
85 | } | 85 | } |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Main event handler. Reimplemented to handle application | 88 | * Main event handler. Reimplemented to handle application |
89 | * font changes | 89 | * font changes |
90 | */ | 90 | */ |
91 | bool InstallDialog::event( QEvent* ev ) | 91 | bool InstallDialog::event( QEvent* ev ) |
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp index de25e27..f72540c 100644 --- a/noncore/unsupported/oipkg/main.cpp +++ b/noncore/unsupported/oipkg/main.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | 1 | ||
2 | #include "mainwindow.h" | 2 | #include "mainwindow.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | //#include <qmessagebox.h> | 6 | //#include <qmessagebox.h> |
7 | int debugLevel; | 7 | int debugLevel; |
8 | 8 | ||
9 | int main( int argc, char ** argv ) | 9 | int main( int argc, char ** argv ) |
10 | { | 10 | { |
11 | printf("This is oipkg\n"); | 11 | printf("This is oipkg\n"); |
12 | printf("$ID$\n"); | 12 | printf("$Id$\n"); |
13 | debugLevel = 2; | 13 | debugLevel = 2; |
14 | if (argc > 1) | 14 | if (argc > 1) |
15 | { | 15 | { |
16 | debugLevel = QString ( argv[1] ).toInt(); | 16 | debugLevel = QString ( argv[1] ).toInt(); |
17 | qDebug("setting debug level to %i",debugLevel); | 17 | qDebug("setting debug level to %i",debugLevel); |
18 | } | 18 | } |
19 | QPEApplication a( argc, argv ); | 19 | QPEApplication a( argc, argv ); |
20 | MainWindow mw; | 20 | MainWindow mw; |
21 | // if (argc > 2) | 21 | // if (argc > 2) |
22 | // QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); | 22 | // QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); |
23 | a.showMainDocumentWidget( &mw ); | 23 | a.showMainDocumentWidget( &mw ); |
24 | return a.exec(); | 24 | return a.exec(); |
25 | } | 25 | } |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 27c9f4c..11ab406 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -20,32 +20,35 @@ | |||
20 | #include <qtextview.h> | 20 | #include <qtextview.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | #include "pksettingsbase.h" | 29 | #include "pksettingsbase.h" |
30 | #include "utils.h" | 30 | #include "utils.h" |
31 | #include "packagelistitem.h" | 31 | #include "packagelistitem.h" |
32 | 32 | ||
33 | 33 | ||
34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
35 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
36 | // packageListServers( QObject(parent), name ), | ||
37 | // packageListSearch( parent, name ), | ||
38 | // packageListDocLnk( parent, name ) | ||
36 | { | 39 | { |
37 | setCaption( tr("Package Manager") ); | 40 | setCaption( tr("Package Manager") ); |
38 | settings = new PackageManagerSettings(this,0,TRUE); | 41 | settings = new PackageManagerSettings(this,0,TRUE); |
39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 42 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
40 | setCentralWidget( listViewPackages ); | 43 | setCentralWidget( listViewPackages ); |
41 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 44 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 45 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 46 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
44 | ipkg = new PmIpkg( settings, this ); | 47 | ipkg = new PmIpkg( settings, this ); |
45 | packageListServers.setSettings( settings ); | 48 | packageListServers.setSettings( settings ); |
46 | packageListSearch.setSettings( settings ); | 49 | packageListSearch.setSettings( settings ); |
47 | packageListDocLnk.setSettings( settings ); | 50 | packageListDocLnk.setSettings( settings ); |
48 | pvDebug(9,"packageListServers.update"); | 51 | pvDebug(9,"packageListServers.update"); |
49 | packageListServers.update(); | 52 | packageListServers.update(); |
50 | pvDebug(9,"packageListDocLnk.update"); | 53 | pvDebug(9,"packageListDocLnk.update"); |
51 | packageListDocLnk.update(); | 54 | packageListDocLnk.update(); |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 9e2f5f8..7f60ed8 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -16,21 +16,22 @@ HEADERS = mainwindow.h \ | |||
16 | package.h | 16 | package.h |
17 | SOURCES = main.cpp \ | 17 | SOURCES = main.cpp \ |
18 | mainwindow.cpp \ | 18 | mainwindow.cpp \ |
19 | utils.cpp \ | 19 | utils.cpp \ |
20 | packagelistdoclnk.cpp \ | 20 | packagelistdoclnk.cpp \ |
21 | packagelistview.cpp \ | 21 | packagelistview.cpp \ |
22 | installdialog.cpp \ | 22 | installdialog.cpp \ |
23 | packagelistremote.cpp \ | 23 | packagelistremote.cpp \ |
24 | packagelistlocal.cpp \ | 24 | packagelistlocal.cpp \ |
25 | pksettings.cpp \ | 25 | pksettings.cpp \ |
26 | pmipkg.cpp \ | 26 | pmipkg.cpp \ |
27 | packagelistitem.cpp \ | 27 | packagelistitem.cpp \ |
28 | packagelist.cpp \ | 28 | packagelist.cpp \ |
29 | package.cpp | 29 | package.cpp |
30 | INCLUDEPATH += $(OPIEDIR)/include | 30 | INCLUDEPATH += $(OPIEDIR)/include |
31 | DEPENDPATH+= $(OPIEDIR)/ioclude | 31 | DEPENDPATH+= $(OPIEDIR)/ioclude |
32 | LIBS += -lqpe | 32 | LIBS += -lqpe |
33 | LIBS += -lopie | ||
33 | INTERFACES= runwindow.ui \ | 34 | INTERFACES= runwindow.ui \ |
34 | pksettingsbase.ui | 35 | pksettingsbase.ui |
35 | TARGET = oipkg | 36 | TARGET = oipkg |
36 | 37 | ||
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 4a09b40..97f7813 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,76 +1,85 @@ | |||
1 | #include "package.h" | 1 | #include "package.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 4 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | 11 | ||
12 | //Package::~Package() | 12 | Package::Package( QObject *parent=0, const char *name=0 ) |
13 | //{ | 13 | : QObject(parent,name) |
14 | //} | 14 | { |
15 | |||
16 | } | ||
17 | |||
18 | Package::~Package() | ||
19 | { | ||
20 | } | ||
15 | 21 | ||
16 | Package::Package( PackageManagerSettings *s ) | 22 | Package::Package( PackageManagerSettings *s, QObject *parent=0, const char *name=0 ) |
23 | : QObject(parent,name) | ||
17 | { | 24 | { |
25 | Package(parent,name); | ||
18 | init(s); | 26 | init(s); |
19 | } | 27 | } |
20 | 28 | ||
21 | void Package::init( PackageManagerSettings *s ) | 29 | void Package::init( PackageManagerSettings *s ) |
22 | { | 30 | { |
23 | settings = s; | 31 | settings = s; |
24 | _size = ""; | 32 | _size = ""; |
25 | _section = ""; | 33 | _section = ""; |
26 | _subsection = ""; | 34 | _subsection = ""; |
27 | _shortDesc = ""; | 35 | _shortDesc = ""; |
28 | _desc = ""; | 36 | _desc = ""; |
29 | _name = ""; | 37 | _name = ""; |
30 | _toProcess = false; | 38 | _toProcess = false; |
31 | _useFileName = false; | 39 | _useFileName = false; |
32 | _old = false; | 40 | _old = false; |
33 | _status = ""; | 41 | _status = ""; |
34 | _dest = settings->getDestinationName(); | 42 | _dest = settings->getDestinationName(); |
35 | _link = settings->createLinks(); | 43 | _link = settings->createLinks(); |
36 | _versions=0; | 44 | _versions=0; |
37 | _version=""; | 45 | _version=""; |
38 | } | 46 | } |
39 | 47 | ||
40 | Package::Package( QStringList pack, PackageManagerSettings *s ) | 48 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent=0, const char *name=0 ) |
49 | : QObject(parent,name) | ||
41 | { | 50 | { |
42 | init(s); | 51 | init(s); |
43 | parsePackage( pack ); | 52 | parsePackage( pack ); |
44 | } | 53 | } |
45 | 54 | ||
46 | Package::Package( QString n, PackageManagerSettings *s ) | 55 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ) |
47 | { | 56 | { |
48 | init(s); | 57 | init(s); |
49 | if ( !QFile::exists( n ) ) | 58 | if ( !QFile::exists( n ) ) |
50 | { | 59 | { |
51 | _name = QString( n ); | 60 | _name = QString( n ); |
52 | }else{ | 61 | }else{ |
53 | pvDebug(4,"remote file: "+n); | 62 | pvDebug(4,"remote file: "+n); |
54 | parseIpkgFile( n ); | 63 | parseIpkgFile( n ); |
55 | _useFileName = true; | 64 | _useFileName = true; |
56 | _fileName = QString( n ); | 65 | _fileName = QString( n ); |
57 | } | 66 | } |
58 | } | 67 | } |
59 | 68 | ||
60 | Package::Package( Package *pi ) | 69 | Package::Package( Package *pi, QObject *parent=0, const char *name=0 ) |
61 | { | 70 | { |
62 | init(pi->settings); | 71 | init(pi->settings); |
63 | copyValues( pi ); | 72 | copyValues( pi ); |
64 | } | 73 | } |
65 | 74 | ||
66 | 75 | ||
67 | void Package::setValue( QString n, QString t ) | 76 | void Package::setValue( QString n, QString t ) |
68 | { | 77 | { |
69 | if ( n == "Package" ) | 78 | if ( n == "Package" ) |
70 | { | 79 | { |
71 | _name = QString( t ); | 80 | _name = QString( t ); |
72 | }else if ( n == "Installed-Size" ) | 81 | }else if ( n == "Installed-Size" ) |
73 | { | 82 | { |
74 | _size = t; | 83 | _size = t; |
75 | // }else if ( n == "Priority") | 84 | // }else if ( n == "Priority") |
76 | // { | 85 | // { |
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 68090dc..f50b9b5 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -1,37 +1,38 @@ | |||
1 | #ifndef PK_ITEM_H | 1 | #ifndef PK_ITEM_H |
2 | #define PK_ITEM_H | 2 | #define PK_ITEM_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qdict.h> | 8 | #include <qdict.h> |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | 10 | ||
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | 12 | ||
13 | class Package //: public QObject | 13 | class Package : public QObject |
14 | { | 14 | { |
15 | // Q_OBJECT | 15 | Q_OBJECT |
16 | public: | 16 | public: |
17 | Package(PackageManagerSettings *); | 17 | Package(QObject *parent=0, const char *name=0); |
18 | // ~Package(); | 18 | Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
19 | Package( QStringList, PackageManagerSettings * ); | 19 | ~Package(); |
20 | Package( QString, PackageManagerSettings * ); | 20 | Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); |
21 | Package( Package* ); | 21 | Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); |
22 | Package( Package*s, QObject *parent=0, const char *name=0 ); | ||
22 | 23 | ||
23 | void setValue( QString, QString ); | 24 | void setValue( QString, QString ); |
24 | void copyValues( Package* ); | 25 | void copyValues( Package* ); |
25 | 26 | ||
26 | QString name(); | 27 | QString name(); |
27 | QString installName(); | 28 | QString installName(); |
28 | bool installed(); | 29 | bool installed(); |
29 | bool otherInstalled(); | 30 | bool otherInstalled(); |
30 | 31 | ||
31 | void setDesc( QString ); | 32 | void setDesc( QString ); |
32 | QString shortDesc(); | 33 | QString shortDesc(); |
33 | QString desc(); | 34 | QString desc(); |
34 | QString size(); | 35 | QString size(); |
35 | QString sizeUnits(); | 36 | QString sizeUnits(); |
36 | QString version(); | 37 | QString version(); |
37 | void setSection( QString ); | 38 | void setSection( QString ); |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 1b572e0..3cc0443 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,47 +1,47 @@ | |||
1 | #include "packagelist.h" | 1 | #include "packagelist.h" |
2 | 2 | ||
3 | #include <assert.h> | 3 | #include <assert.h> |
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | 7 | ||
8 | #include "debug.h" | 8 | #include "debug.h" |
9 | 9 | ||
10 | static QDict<Package> *packageListAll; | 10 | static QDict<Package> *packageListAll; |
11 | static int packageListAllRefCount = 0; | 11 | static int packageListAllRefCount = 0; |
12 | 12 | ||
13 | PackageList::PackageList() | 13 | PackageList::PackageList(QObject *parent=0, const char *name=0) |
14 | : packageIter( packageList ) | 14 | : QObject(parent,name), packageIter( packageList ) |
15 | { | 15 | { |
16 | empty=true; | 16 | empty=true; |
17 | if (!packageListAll) packageListAll = new QDict<Package>(); | 17 | if (!packageListAll) packageListAll = new QDict<Package>(); |
18 | packageListAllRefCount++; | 18 | packageListAllRefCount++; |
19 | sections << "All"; | 19 | sections << "All"; |
20 | subSections.insert("All", new QStringList() ); | 20 | subSections.insert("All", new QStringList() ); |
21 | QStringList *ss = subSections["All"]; | 21 | QStringList *ss = subSections["All"]; |
22 | *ss << "All"; | 22 | *ss << "All"; |
23 | aktSection = "All"; | 23 | aktSection = "All"; |
24 | aktSubSection = "All"; | 24 | aktSubSection = "All"; |
25 | } | 25 | } |
26 | 26 | ||
27 | PackageList::PackageList( PackageManagerSettings* s) | 27 | PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) |
28 | : packageIter( packageList ) | 28 | : QObject(parent,name), packageIter( packageList ) |
29 | { | 29 | { |
30 | settings = s; | 30 | settings = s; |
31 | PackageList(); | 31 | PackageList(parent, name); |
32 | } | 32 | } |
33 | 33 | ||
34 | PackageList::~PackageList() | 34 | PackageList::~PackageList() |
35 | { | 35 | { |
36 | if (--packageListAllRefCount < 1 ) delete packageListAll; | 36 | if (--packageListAllRefCount < 1 ) delete packageListAll; |
37 | } | 37 | } |
38 | 38 | ||
39 | /** Inserts a package into the list */ | 39 | /** Inserts a package into the list */ |
40 | void PackageList::insertPackage( Package* pack ) | 40 | void PackageList::insertPackage( Package* pack ) |
41 | { | 41 | { |
42 | if (!pack) return; | 42 | if (!pack) return; |
43 | Package* p = packageListAll->find( pack->name() ); | 43 | Package* p = packageListAll->find( pack->name() ); |
44 | if ( p ) | 44 | if ( p ) |
45 | { | 45 | { |
46 | if ( (p->version() == pack->version()) | 46 | if ( (p->version() == pack->version()) |
47 | // && (p->dest() == pack->dest()) | 47 | // && (p->dest() == pack->dest()) |
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index d0f8897..78dcd92 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -1,32 +1,32 @@ | |||
1 | #ifndef PACKAGELIST_H | 1 | #ifndef PACKAGELIST_H |
2 | #define PACKAGELIST_H | 2 | #define PACKAGELIST_H |
3 | 3 | ||
4 | #include <qdict.h> | 4 | #include <qdict.h> |
5 | #include "package.h" | 5 | #include "package.h" |
6 | #include "pksettings.h" | 6 | #include "pksettings.h" |
7 | #include "debug.h" | 7 | #include "debug.h" |
8 | 8 | ||
9 | class PackageList //:QObject | 9 | class PackageList :QObject |
10 | { | 10 | { |
11 | // Q_OBJECT | 11 | Q_OBJECT |
12 | public: | 12 | public: |
13 | //static QString all = QObject::tr("All"); | 13 | //static QString all = QObject::tr("All"); |
14 | 14 | ||
15 | PackageList(); | 15 | PackageList (QObject *parent=0, const char *name=0); |
16 | PackageList( PackageManagerSettings* ); | 16 | PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
17 | virtual ~PackageList(); | 17 | virtual ~PackageList(); |
18 | void insertPackage( Package* ); | 18 | void insertPackage( Package* ); |
19 | Package* find( QString ); | 19 | Package* find( QString ); |
20 | Package* next(); | 20 | Package* next(); |
21 | Package* first(); | 21 | Package* first(); |
22 | 22 | ||
23 | QStringList getSections(); | 23 | QStringList getSections(); |
24 | QStringList getSubSections(); | 24 | QStringList getSubSections(); |
25 | void setSettings( PackageManagerSettings* ); | 25 | void setSettings( PackageManagerSettings* ); |
26 | void filterPackages( QString ); | 26 | void filterPackages( QString ); |
27 | Package* getByName( QString ); | 27 | Package* getByName( QString ); |
28 | void clear(); | 28 | void clear(); |
29 | void allPackages(); | 29 | void allPackages(); |
30 | 30 | ||
31 | QDict<Package> *versions; | 31 | QDict<Package> *versions; |
32 | 32 | ||
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index f31f742..b42cfdd 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp | |||
@@ -1,34 +1,34 @@ | |||
1 | 1 | ||
2 | #include "packagelistdoclnk.h" | 2 | #include "packagelistdoclnk.h" |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | 7 | ||
8 | #include "package.h" | 8 | #include "package.h" |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | 10 | ||
11 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s) | 11 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent=0, const char *name=0) |
12 | : PackageList(s) | 12 | : PackageList(s) |
13 | { | 13 | { |
14 | PackageListDocLnk(); | 14 | PackageListDocLnk(parent, name); |
15 | } | 15 | } |
16 | 16 | ||
17 | PackageListDocLnk::PackageListDocLnk() | 17 | PackageListDocLnk::PackageListDocLnk(QObject *parent=0, const char *name=0) |
18 | : PackageList() | 18 | : PackageList(parent, name) |
19 | { | 19 | { |
20 | Config cfg( "oipkg", Config::User ); | 20 | Config cfg( "oipkg", Config::User ); |
21 | cfg.setGroup( "Common" ); | 21 | cfg.setGroup( "Common" ); |
22 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); | 22 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); |
23 | pvDebug(2,"opening DocLnkSet "+docLnkDir); | 23 | pvDebug(2,"opening DocLnkSet "+docLnkDir); |
24 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); | 24 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); |
25 | } | 25 | } |
26 | 26 | ||
27 | PackageListDocLnk::~PackageListDocLnk() | 27 | PackageListDocLnk::~PackageListDocLnk() |
28 | { | 28 | { |
29 | Config cfg( "oipkg", Config::User ); | 29 | Config cfg( "oipkg", Config::User ); |
30 | cfg.setGroup( "Common" ); | 30 | cfg.setGroup( "Common" ); |
31 | cfg.writeEntry( "docLnkDir", docLnkDir ); | 31 | cfg.writeEntry( "docLnkDir", docLnkDir ); |
32 | delete doclnkset; | 32 | delete doclnkset; |
33 | } | 33 | } |
34 | 34 | ||
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.h b/noncore/unsupported/oipkg/packagelistdoclnk.h index fe73658..a63fb59 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.h +++ b/noncore/unsupported/oipkg/packagelistdoclnk.h | |||
@@ -1,23 +1,23 @@ | |||
1 | #ifndef PACKAGELISTDOCLNK_H | 1 | #ifndef PACKAGELISTDOCLNK_H |
2 | #define PACKAGELISTDOCLNK_H | 2 | #define PACKAGELISTDOCLNK_H |
3 | 3 | ||
4 | #include "packagelist.h" | 4 | #include "packagelist.h" |
5 | #include "debug.h" | 5 | #include "debug.h" |
6 | 6 | ||
7 | class DocLnkSet; | 7 | class DocLnkSet; |
8 | 8 | ||
9 | class PackageListDocLnk : public PackageList | 9 | class PackageListDocLnk : public PackageList |
10 | { | 10 | { |
11 | public: | 11 | public: |
12 | PackageListDocLnk(); | 12 | PackageListDocLnk(QObject *parent=0, const char *name=0); |
13 | PackageListDocLnk( PackageManagerSettings* s); | 13 | PackageListDocLnk( PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
14 | virtual ~PackageListDocLnk(); | 14 | virtual ~PackageListDocLnk(); |
15 | public slots: | 15 | public slots: |
16 | void update(); | 16 | void update(); |
17 | private: | 17 | private: |
18 | DocLnkSet *doclnkset; | 18 | DocLnkSet *doclnkset; |
19 | QString docLnkDir; | 19 | QString docLnkDir; |
20 | }; | 20 | }; |
21 | 21 | ||
22 | 22 | ||
23 | #endif | 23 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 55047d5..0c9c676 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -146,21 +146,21 @@ void PackageListItem::setOn( bool b ) | |||
146 | { | 146 | { |
147 | QCheckListItem::setOn( b ); | 147 | QCheckListItem::setOn( b ); |
148 | package->toggleProcess(); | 148 | package->toggleProcess(); |
149 | package->setLink( settings->createLinks() ); | 149 | package->setLink( settings->createLinks() ); |
150 | displayDetails(); | 150 | displayDetails(); |
151 | } | 151 | } |
152 | 152 | ||
153 | void PackageListItem::displayDetails() | 153 | void PackageListItem::displayDetails() |
154 | { | 154 | { |
155 | QString sod; | 155 | QString sod; |
156 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); | 156 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); |
157 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); | 157 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); |
158 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); | 158 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); |
159 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); | 159 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); |
160 | setText(0, package->name()+sod ); | 160 | setText(0, package->name()+sod ); |
161 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); | 161 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); |
162 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); | 162 | linkItem->setText( 0, QObject::tr("Link: ")+package->link()?QObject::tr("Yes"):QObject::tr("No")); |
163 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | 163 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); |
164 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); | 164 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); |
165 | repaint(); | 165 | repaint(); |
166 | } | 166 | } |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 70aa48a..2bb74e9 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -46,53 +46,53 @@ void PackageListView::setCurrent( QListViewItem* p ) | |||
46 | // } | 46 | // } |
47 | 47 | ||
48 | return; | 48 | return; |
49 | } | 49 | } |
50 | popupTimer->start( 750, true ); | 50 | popupTimer->start( 750, true ); |
51 | } | 51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void PackageListView::showPopup() | 54 | void PackageListView::showPopup() |
55 | { | 55 | { |
56 | popupMenu->clear(); | 56 | popupMenu->clear(); |
57 | destsMenu->clear(); | 57 | destsMenu->clear(); |
58 | 58 | ||
59 | QAction *popupAction; | 59 | QAction *popupAction; |
60 | if ( !activePackage->installed() ) | 60 | if ( !activePackage->installed() ) |
61 | { | 61 | { |
62 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 62 | popupMenu->insertItem( tr("Install to"), destsMenu ); |
63 | QStringList dests = settings->getDestinationNames(); | 63 | QStringList dests = settings->getDestinationNames(); |
64 | QString ad = settings->getDestinationName(); | 64 | QString ad = settings->getDestinationName(); |
65 | for (uint i = 0; i < dests.count(); i++ ) | 65 | for (uint i = 0; i < dests.count(); i++ ) |
66 | { | 66 | { |
67 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 67 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
68 | popupAction->addTo( destsMenu ); | 68 | popupAction->addTo( destsMenu ); |
69 | if ( dests[i] == ad && activePackage->toInstall() ) | 69 | if ( dests[i] == ad && activePackage->toInstall() ) |
70 | { | 70 | { |
71 | popupAction->setToggleAction( true ); | 71 | popupAction->setToggleAction( true ); |
72 | popupAction->setOn(true); | 72 | popupAction->setOn(true); |
73 | }; | 73 | }; |
74 | } | 74 | } |
75 | connect( destsMenu, SIGNAL( activated( int ) ), | 75 | connect( destsMenu, SIGNAL( activated( int ) ), |
76 | this, SLOT( changePackageDest( int ) ) ); | 76 | this, SLOT( changePackageDest( int ) ) ); |
77 | }else{ | 77 | }else{ |
78 | popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); | 78 | popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 ); |
79 | popupAction->addTo( popupMenu ); | 79 | popupAction->addTo( popupMenu ); |
80 | connect( popupAction, SIGNAL( activated() ), | 80 | connect( popupAction, SIGNAL( activated() ), |
81 | this , SLOT( toggleProcess() ) ); | 81 | this , SLOT( toggleProcess() ) ); |
82 | popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); | 82 | popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 ); |
83 | popupAction->addTo( popupMenu ); | 83 | popupAction->addTo( popupMenu ); |
84 | popupAction->setEnabled( false ); | 84 | popupAction->setEnabled( false ); |
85 | } | 85 | } |
86 | popupMenu->popup( QCursor::pos() ); | 86 | popupMenu->popup( QCursor::pos() ); |
87 | } | 87 | } |
88 | 88 | ||
89 | void PackageListView::stopTimer( QListViewItem* ) | 89 | void PackageListView::stopTimer( QListViewItem* ) |
90 | { | 90 | { |
91 | popupTimer->stop(); | 91 | popupTimer->stop(); |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | void PackageListView::changePackageDest( int i ) | 95 | void PackageListView::changePackageDest( int i ) |
96 | { | 96 | { |
97 | activePackage->setDest( destsMenu->text(i) ); | 97 | activePackage->setDest( destsMenu->text(i) ); |
98 | activePackage->setOn(); | 98 | activePackage->setOn(); |
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 09975b0..59d5a3e 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -228,32 +228,33 @@ void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | |||
228 | s << "#"; | 228 | s << "#"; |
229 | s << "src " << activeServers->text(i) << " " << url << "\n"; | 229 | s << "src " << activeServers->text(i) << " " << url << "\n"; |
230 | } | 230 | } |
231 | for (int i=0; i<(int)destinations->count(); i++) | 231 | for (int i=0; i<(int)destinations->count(); i++) |
232 | { | 232 | { |
233 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); | 233 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); |
234 | s << "dest " << destinations->text(i) << " " << url << "\n"; | 234 | s << "dest " << destinations->text(i) << " " << url << "\n"; |
235 | } | 235 | } |
236 | conf.close(); | 236 | conf.close(); |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | void PackageManagerSettings::readInstallationSettings() | 240 | void PackageManagerSettings::readInstallationSettings() |
241 | { | 241 | { |
242 | Config cfg( "oipkg", Config::User ); | 242 | Config cfg( "oipkg", Config::User ); |
243 | cfg.setGroup( "Settings" ); | 243 | cfg.setGroup( "Settings" ); |
244 | |||
244 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); | 245 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); |
245 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 | 246 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 |
246 | 247 | ||
247 | for (int i = 0; i < installationSettingsCount; i++) | 248 | for (int i = 0; i < installationSettingsCount; i++) |
248 | { | 249 | { |
249 | cfg.setGroup( "Setting_" + QString::number(i) ); | 250 | cfg.setGroup( "Setting_" + QString::number(i) ); |
250 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); | 251 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); |
251 | }; | 252 | }; |
252 | readInstallationSetting( currentSetting ); | 253 | readInstallationSetting( currentSetting ); |
253 | } | 254 | } |
254 | 255 | ||
255 | 256 | ||
256 | 257 | ||
257 | /** | 258 | /** |
258 | * remove from conf file | 259 | * remove from conf file |
259 | */ | 260 | */ |
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index dcc1e3a..8f9fe62 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | //#include "pmipkg.h" | 5 | //#include "pmipkg.h" |
6 | #include <qintdict.h> | 6 | #include <qintdict.h> |
7 | #include <qobject.h> | 7 | #include <qobject.h> |
8 | 8 | ||
9 | 9 | ||
10 | class PackageManagerSettings : public PackageManagerSettingsBase | 10 | class PackageManagerSettings : public PackageManagerSettingsBase |
11 | { | 11 | { |
12 | // Q_OBJECT | 12 | Q_OBJECT |
13 | public: | 13 | public: |
14 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 14 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
15 | ~PackageManagerSettings(); | 15 | ~PackageManagerSettings(); |
16 | 16 | ||
17 | bool showDialog( int ) ; | 17 | bool showDialog( int ) ; |
18 | QString getDestinationUrl(); | 18 | QString getDestinationUrl(); |
19 | QString getDestinationName(); | 19 | QString getDestinationName(); |
20 | QString getLinkDestinationName(); | 20 | QString getLinkDestinationName(); |
21 | bool createLinks(); | 21 | bool createLinks(); |
22 | QStringList getServers(); | 22 | QStringList getServers(); |
23 | QStringList getActiveServers(); | 23 | QStringList getActiveServers(); |
24 | QStringList getDestinationUrls(); | 24 | QStringList getDestinationUrls(); |
25 | QStringList getDestinationNames(); | 25 | QStringList getDestinationNames(); |
26 | QString getDestinationUrlByName(QString); | 26 | QString getDestinationUrlByName(QString); |
27 | QComboBox* getDestCombo(); | 27 | QComboBox* getDestCombo(); |
28 | // void setIpkg( PmIpkg* ); | 28 | // void setIpkg( PmIpkg* ); |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 7b3fa1e..2a534d2 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,118 +1,173 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | #include <qpe/process.h> | 6 | //#infdef OPROCESS |
7 | #include <opie/oprocess.h> | ||
8 | //#endif | ||
7 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 11 | #include <qpe/stringutil.h> |
10 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
11 | #include <qdir.h> | 13 | #include <qdir.h> |
12 | #include <qfile.h> | 14 | #include <qfile.h> |
13 | #include <qgroupbox.h> | 15 | #include <qgroupbox.h> |
14 | #include <qmultilineedit.h> | 16 | #include <qmultilineedit.h> |
15 | #include <qstring.h> | 17 | #include <qstring.h> |
16 | #include <qcheckbox.h> | 18 | #include <qcheckbox.h> |
17 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
18 | #include <qtextview.h> | 20 | #include <qtextview.h> |
19 | 21 | ||
20 | #include <qprogressbar.h> | 22 | #include <qprogressbar.h> |
21 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
22 | #include <qlayout.h> | 24 | #include <qlayout.h> |
23 | 25 | ||
24 | #include <stdlib.h> | 26 | #include <stdlib.h> |
25 | #include <unistd.h> | 27 | #include <unistd.h> |
26 | 28 | ||
27 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
28 | 30 | ||
29 | 31 | ||
30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 32 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
31 | : QObject ( p ) | 33 | : QObject ( p ) |
32 | { | 34 | { |
33 | settings = s; | 35 | settings = s; |
34 | runwindow = new RunWindow( p, name, true, f ); | 36 | runwindow = new RunWindow( p, name, true, f ); |
37 | #ifdef OPROCESS | ||
38 | ipkgProcess = new OProcess(); | ||
39 | connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | ||
40 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); | ||
41 | |||
42 | connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), | ||
43 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); | ||
44 | installDialog = 0; | ||
45 | #endif | ||
35 | } | 46 | } |
36 | 47 | ||
37 | PmIpkg::~PmIpkg() | 48 | PmIpkg::~PmIpkg() |
38 | { | 49 | { |
50 | #ifdef OPROCESS | ||
51 | delete ipkgProcess; | ||
52 | #endif | ||
39 | } | 53 | } |
40 | 54 | ||
41 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
42 | { | 56 | { |
43 | bool ret=false; | 57 | bool ret=false; |
44 | QDir::setCurrent("/tmp"); | 58 | QDir::setCurrent("/tmp"); |
45 | QString cmd = "/usr/bin/ipkg "; | 59 | QString cmd = "/usr/bin/ipkg "; |
60 | #ifdef OPROCESS | ||
61 | ipkgProcess->clearArguments(); | ||
62 | *ipkgProcess << "/usr/bin/ipkg "; | ||
63 | QString cmd = ""; | ||
64 | #endif | ||
46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 65 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
47 | if ( dest == "" ) | 66 | if ( dest == "" ) |
48 | cmd += " -dest "+settings->getDestinationName(); | 67 | cmd += " -dest "+settings->getDestinationName(); |
49 | else | 68 | else |
50 | cmd += " -dest "+ dest; | 69 | cmd += " -dest "+ dest; |
51 | 70 | ||
52 | cmd += " -force-defaults "; | 71 | cmd += " -force-defaults "; |
53 | 72 | ||
54 | if (installDialog && installDialog->_force_depends) | 73 | if (installDialog && installDialog->_force_depends) |
55 | { | 74 | { |
56 | if (installDialog->_force_depends->isChecked()) | 75 | if (installDialog->_force_depends->isChecked()) |
57 | cmd += " -force-depends "; | 76 | cmd += " -force-depends "; |
58 | if (installDialog->_force_reinstall->isChecked()) | 77 | if (installDialog->_force_reinstall->isChecked()) |
59 | cmd += " -force-reinstall "; | 78 | cmd += " -force-reinstall "; |
60 | if (installDialog->_force_remove->isChecked()) | 79 | if (installDialog->_force_remove->isChecked()) |
61 | cmd += " -force-removal-of-essential-packages "; | 80 | cmd += " -force-removal-of-essential-packages "; |
62 | } | 81 | } |
63 | 82 | ||
64 | out( "Starting to "+ args+"\n"); | 83 | out( "Starting to "+ args+"\n"); |
65 | cmd += args; | 84 | cmd += args; |
66 | out( "running:\n"+cmd+"\n" ); | 85 | out( "running:\n"+cmd+"\n" ); |
67 | pvDebug(2,"running:"+cmd); | 86 | pvDebug(2,"running:"+cmd); |
87 | #ifdef OPROCESS | ||
88 | *ipkgProcess << args; | ||
89 | out( "running:\n" + cmd); | ||
90 | *ipkgProcess << cmd; | ||
91 | |||
92 | //debug | ||
93 | ipkgProcess->clearArguments(); | ||
94 | *ipkgProcess << "/bin/ls "; | ||
95 | //debug | ||
96 | QValueList<QCString> a = ipkgProcess->args(); | ||
97 | QValueList<QCString>::Iterator it; | ||
98 | for( it = a.begin(); it != a.end(); ++it ) | ||
99 | { | ||
100 | out( *it ); | ||
101 | cmd += *it; | ||
102 | } | ||
103 | |||
104 | pvDebug(2,"running:"+cmd); | ||
105 | qApp->processEvents(); | ||
106 | // sleep(1); | ||
107 | ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); | ||
108 | if ( !ret ) { | ||
109 | pvDebug(2,"Could not execute '" + cmd); | ||
110 | out("\nError while executing "+ cmd+"\n\n"); | ||
111 | out("\nError while executing\n\n"); | ||
112 | // return false; | ||
113 | } | ||
114 | |||
115 | while ( ipkgProcess->isRunning() ) | ||
116 | { | ||
117 | out("."); | ||
118 | pvDebug(7,"wait for oprocess to terminate"); | ||
119 | qApp->processEvents(); | ||
120 | }; | ||
121 | #else | ||
68 | qApp->processEvents(); | 122 | qApp->processEvents(); |
69 | FILE *fp; | 123 | FILE *fp; |
70 | char line[130]; | 124 | char line[130]; |
71 | QString lineStr, lineStrOld; | 125 | QString lineStr, lineStrOld; |
72 | sleep(1); | 126 | sleep(1); |
73 | cmd +=" 2>&1"; | 127 | cmd +=" 2>&1"; |
74 | fp = popen( (const char *) cmd, "r"); | 128 | fp = popen( (const char *) cmd, "r"); |
75 | if ( !fp ) { | 129 | if ( !fp ) { |
76 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 130 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
77 | pclose(fp); | 131 | pclose(fp); |
78 | out("\nError while executing "+ cmd+"\n\n"); | 132 | out("\nError while executing "+ cmd+"\n\n"); |
79 | return false; | 133 | return false; |
80 | } else { | 134 | } else { |
81 | while ( fgets( line, sizeof line, fp)) { | 135 | while ( fgets( line, sizeof line, fp)) { |
82 | lineStr = line; | 136 | lineStr = line; |
83 | lineStr=lineStr.left(lineStr.length()-1); | 137 | lineStr=lineStr.left(lineStr.length()-1); |
84 | //Configuring opie-oipkg...Done | 138 | //Configuring opie-oipkg...Done |
85 | if (lineStr.contains("Done")) | 139 | if (lineStr.contains("Done")) |
86 | ret = true; | 140 | ret = true; |
87 | if (lineStr!=lineStrOld) | 141 | if (lineStr!=lineStrOld) |
88 | out(lineStr); | 142 | out(lineStr); |
89 | lineStrOld = lineStr; | 143 | lineStrOld = lineStr; |
90 | qApp->processEvents(); | 144 | qApp->processEvents(); |
91 | } | 145 | } |
92 | pclose(fp); | 146 | pclose(fp); |
93 | } | 147 | } |
148 | #endif | ||
94 | //out( "Finished!"); | 149 | //out( "Finished!"); |
95 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 150 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
96 | return ret; | 151 | return ret; |
97 | } | 152 | } |
98 | 153 | ||
99 | void PmIpkg::makeLinks(Package *pack) | 154 | void PmIpkg::makeLinks(Package *pack) |
100 | { | 155 | { |
101 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 156 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
102 | linkPackage( pack->installName(), pack->dest() ); | 157 | linkPackage( pack->name(), pack->dest() ); |
103 | } | 158 | } |
104 | 159 | ||
105 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 160 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
106 | { | 161 | { |
107 | QString dest = settings->getDestinationUrlByName( d ); | 162 | QString dest = settings->getDestinationUrlByName( d ); |
108 | dest = dest==""?d:dest; | 163 | dest = dest==""?d:dest; |
109 | if (dest == "/" ) return 0; | 164 | if (dest == "/" ) return 0; |
110 | { | 165 | { |
111 | Config cfg( "oipkg", Config::User ); | 166 | Config cfg( "oipkg", Config::User ); |
112 | cfg.setGroup( "Common" ); | 167 | cfg.setGroup( "Common" ); |
113 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 168 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
114 | } | 169 | } |
115 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 170 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
116 | QFile f( packFileName ); | 171 | QFile f( packFileName ); |
117 | if ( ! f.open(IO_ReadOnly) ) | 172 | if ( ! f.open(IO_ReadOnly) ) |
118 | { | 173 | { |
@@ -229,32 +284,33 @@ void PmIpkg::commit() | |||
229 | { | 284 | { |
230 | sizecount += to_install.at(i)->size().toInt(); | 285 | sizecount += to_install.at(i)->size().toInt(); |
231 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 286 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
232 | } | 287 | } |
233 | runwindow->progress->setTotalSteps(sizecount); | 288 | runwindow->progress->setTotalSteps(sizecount); |
234 | qDebug("Install size %i",sizecount); | 289 | qDebug("Install size %i",sizecount); |
235 | installDialog->showMaximized(); | 290 | installDialog->showMaximized(); |
236 | installDialog->show(); | 291 | installDialog->show(); |
237 | if ( installDialog->exec() ) | 292 | if ( installDialog->exec() ) |
238 | { | 293 | { |
239 | doIt(); | 294 | doIt(); |
240 | runwindow->showMaximized(); | 295 | runwindow->showMaximized(); |
241 | runwindow->show(); | 296 | runwindow->show(); |
242 | } | 297 | } |
243 | installDialog->close(); | 298 | installDialog->close(); |
244 | delete installDialog; | 299 | delete installDialog; |
300 | installDialog = 0; | ||
245 | out(tr("\nAll done.")); | 301 | out(tr("\nAll done.")); |
246 | } | 302 | } |
247 | 303 | ||
248 | void PmIpkg::doIt() | 304 | void PmIpkg::doIt() |
249 | { | 305 | { |
250 | runwindow->progress->setProgress(0); | 306 | runwindow->progress->setProgress(0); |
251 | show(); | 307 | show(); |
252 | remove(); | 308 | remove(); |
253 | install(); | 309 | install(); |
254 | } | 310 | } |
255 | 311 | ||
256 | 312 | ||
257 | void PmIpkg::remove() | 313 | void PmIpkg::remove() |
258 | { | 314 | { |
259 | if ( to_remove.count() == 0 ) return; | 315 | if ( to_remove.count() == 0 ) return; |
260 | 316 | ||
@@ -383,16 +439,28 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest) | |||
383 | to_install.clear(); | 439 | to_install.clear(); |
384 | to_remove.clear(); | 440 | to_remove.clear(); |
385 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 441 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
386 | Package *p = new Package(fileName,settings); | 442 | Package *p = new Package(fileName,settings); |
387 | if ( dest!="") p->setDest( dest ); | 443 | if ( dest!="") p->setDest( dest ); |
388 | to_remove.append( p ); | 444 | to_remove.append( p ); |
389 | commit(); | 445 | commit(); |
390 | delete p; | 446 | delete p; |
391 | } | 447 | } |
392 | 448 | ||
393 | 449 | ||
394 | void PmIpkg::clearLists() | 450 | void PmIpkg::clearLists() |
395 | { | 451 | { |
396 | to_remove.clear(); | 452 | to_remove.clear(); |
397 | to_install.clear(); | 453 | to_install.clear(); |
398 | } | 454 | } |
455 | |||
456 | |||
457 | void PmIpkg::getIpkgOutput(OProcess *proc, char *buffer, int buflen) | ||
458 | { | ||
459 | QString lineStr, lineStrOld; | ||
460 | lineStr = buffer; | ||
461 | lineStr=lineStr.left(buflen); | ||
462 | //Configuring opie-oipkg...Done | ||
463 | if (lineStr!=lineStrOld) | ||
464 | out(lineStr); | ||
465 | lineStrOld = lineStr; | ||
466 | } \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index d53a74d..2c92348 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,20 +1,21 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <opie/oprocess.h> | ||
5 | #include <qobject.h> | 6 | #include <qobject.h> |
6 | #include <qlist.h> | 7 | #include <qlist.h> |
7 | #include <qstring.h> | 8 | #include <qstring.h> |
8 | #include <qwidget.h> | 9 | #include <qwidget.h> |
9 | #include "pksettings.h" | 10 | #include "pksettings.h" |
10 | #include "runwindow.h" | 11 | #include "runwindow.h" |
11 | #include "packagelist.h" | 12 | #include "packagelist.h" |
12 | #include "installdialog.h" | 13 | #include "installdialog.h" |
13 | #include "debug.h" | 14 | #include "debug.h" |
14 | 15 | ||
15 | #define createLink 0 | 16 | #define createLink 0 |
16 | #define removeLink 1 | 17 | #define removeLink 1 |
17 | 18 | ||
18 | class Package; | 19 | class Package; |
19 | class PmIpkg : public QObject | 20 | class PmIpkg : public QObject |
20 | { | 21 | { |
@@ -27,39 +28,38 @@ public: | |||
27 | void loadList( PackageList* ); | 28 | void loadList( PackageList* ); |
28 | void commit(); | 29 | void commit(); |
29 | void update(); | 30 | void update(); |
30 | void show(); | 31 | void show(); |
31 | /** No descriptions */ | 32 | /** No descriptions */ |
32 | void clearLists(); | 33 | void clearLists(); |
33 | 34 | ||
34 | public slots: | 35 | public slots: |
35 | void doIt(); | 36 | void doIt(); |
36 | void install(); | 37 | void install(); |
37 | void remove(); | 38 | void remove(); |
38 | void installFile(const QString &fileName, const QString &dest=""); | 39 | void installFile(const QString &fileName, const QString &dest=""); |
39 | void removeFile(const QString &fileName, const QString &dest=""); | 40 | void removeFile(const QString &fileName, const QString &dest=""); |
40 | void createLinks( const QString &dest ); | 41 | void createLinks( const QString &dest ); |
41 | void removeLinks( const QString &dest ); | 42 | void removeLinks( const QString &dest ); |
42 | 43 | ||
44 | //private slots: | ||
45 | void getIpkgOutput(OProcess *proc, char *buffer, int buflen); | ||
46 | |||
43 | private: | 47 | private: |
48 | OProcess *ipkgProcess; | ||
44 | PackageManagerSettings* settings; | 49 | PackageManagerSettings* settings; |
45 | RunWindow *runwindow; | 50 | RunWindow *runwindow; |
46 | InstallDialog *installDialog; | 51 | InstallDialog *installDialog; |
47 | QList<Package> to_remove; | 52 | QList<Package> to_remove; |
48 | QList<Package> to_install; | 53 | QList<Package> to_install; |
49 | QString fileNameToInstall; | ||
50 | QCheckBox *_force_reinstall; | ||
51 | QCheckBox *_force_remove; | ||
52 | QCheckBox *_force_depends; | ||
53 | // void startDialog(); | ||
54 | void makeLinks(Package*); | 54 | void makeLinks(Package*); |
55 | void linkPackage( QString, QString ); | 55 | void linkPackage( QString, QString ); |
56 | void processLinkDir( QString , QString ); | 56 | void processLinkDir( QString , QString ); |
57 | bool runIpkg(const QString& args, const QString& dest="" ); | 57 | bool runIpkg(const QString& args, const QString& dest="" ); |
58 | void out( QString ); | 58 | void out( QString ); |
59 | QStringList* getList( QString, QString ); | 59 | QStringList* getList( QString, QString ); |
60 | void processFileList( QStringList*, QString ); | 60 | void processFileList( QStringList*, QString ); |
61 | 61 | ||
62 | 62 | ||
63 | }; | 63 | }; |
64 | 64 | ||
65 | #endif | 65 | #endif |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index f01cb69..9cb7a9b 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -1,27 +1,27 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | #include <qintdict.h> | 5 | #include <qintdict.h> |
6 | 6 | ||
7 | 7 | ||
8 | class PackageManagerSettings : public PackageManagerSettingsBase | 8 | class PackageManagerSettings : public PackageManagerSettingsBase |
9 | //class PackageManagerSettings : private PackageManagerSettingsBase | 9 | //class PackageManagerSettings : private PackageManagerSettingsBase |
10 | { | 10 | { |
11 | // Q_OBJECT | 11 | Q_OBJECT |
12 | public: | 12 | public: |
13 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 13 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
14 | ~PackageManagerSettings(); | 14 | ~PackageManagerSettings(); |
15 | 15 | ||
16 | bool showDialog( int ) ; | 16 | bool showDialog( int ) ; |
17 | QString getDestinationUrl(); | 17 | QString getDestinationUrl(); |
18 | QString getDestinationName(); | 18 | QString getDestinationName(); |
19 | QString getLinkDestinationName(); | 19 | QString getLinkDestinationName(); |
20 | bool createLinks(); | 20 | bool createLinks(); |
21 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | 23 | ||
24 | public slots: /** No descriptions */ | 24 | public slots: /** No descriptions */ |
25 | void createLinks(); | 25 | void createLinks(); |
26 | void removeLinks(); | 26 | void removeLinks(); |
27 | void writeInstallationSettings(); | 27 | void writeInstallationSettings(); |