summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/listviewitemoipkg.cpp38
-rw-r--r--noncore/unsupported/oipkg/listviewitemoipkg.h33
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h1
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro4
-rw-r--r--noncore/unsupported/oipkg/package.cpp100
-rw-r--r--noncore/unsupported/oipkg/package.h22
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp34
-rw-r--r--noncore/unsupported/oipkg/packagelist.h20
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp2
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp159
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h32
-rw-r--r--noncore/unsupported/oipkg/packagelistlocal.cpp2
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp141
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h17
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp10
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h8
16 files changed, 370 insertions, 253 deletions
diff --git a/noncore/unsupported/oipkg/listviewitemoipkg.cpp b/noncore/unsupported/oipkg/listviewitemoipkg.cpp
new file mode 100644
index 0000000..30b5a5e
--- a/dev/null
+++ b/noncore/unsupported/oipkg/listviewitemoipkg.cpp
@@ -0,0 +1,38 @@
1#include "listviewitemoipkg.h"
2#include "packagelistview.h"
3
4#include <qlistview.h>
5
6ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type)
7 : QCheckListItem(parent,name,qct)
8{
9 _type = type;
10}
11ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, Type type)
12 : QCheckListItem(parent,name,CheckBox)
13{
14 _type = type;
15}
16
17ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type)
18 : QCheckListItem(parent,name,CheckBox)
19{
20 _type = type;
21}
22
23ListViewItemOipkg::ListViewItemOipkg(PackageListView *parent, QString name, Type type)
24 : QCheckListItem(parent,name,Controller)
25{
26 _type = type;
27}
28
29ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name)
30 : QCheckListItem(parent,name,Controller)
31{
32 _type = type;
33}
34
35ListViewItemOipkg::~ListViewItemOipkg()
36{
37// delete _popupMenu;
38}
diff --git a/noncore/unsupported/oipkg/listviewitemoipkg.h b/noncore/unsupported/oipkg/listviewitemoipkg.h
new file mode 100644
index 0000000..4f7d2d7
--- a/dev/null
+++ b/noncore/unsupported/oipkg/listviewitemoipkg.h
@@ -0,0 +1,33 @@
1#ifndef LISTVIEWITEMOIPKG_H
2#define LISTVIEWITEMOIPKG_H
3
4#include <qpopupmenu.h>
5#include <qstring.h>
6#include <qlistview.h>
7#include <qcheckbox.h>
8
9class PackageListItem;
10class PackageListView;
11
12class ListViewItemOipkg : public QObject, public QCheckListItem
13{
14Q_OBJECT
15public:
16 enum Type {Package, Feed, Attribute};
17
18 ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type);ListViewItemOipkg(QListView *parent, QString name, Type type);
19 ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type);
20 ListViewItemOipkg(PackageListView *parent, QString name, Type type);
21 ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name);
22 ~ListViewItemOipkg();
23
24 int getType() {return _type;};
25 virtual QPopupMenu* getPopupMenu() {return 0;};
26protected slots:
27 virtual void menuAction(int ) {};
28protected:
29 int _type;
30 static QPopupMenu* _popupMenu;
31};
32
33#endif
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 354c585..f32352b 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -1,107 +1,108 @@
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// Copyright (C) 2000 Trolltech AS. 9// Copyright (C) 2000 Trolltech AS.
10// adadpted form qpe/qipkg 10// adadpted form qpe/qipkg
11// (c) 2002 Patrick S. Vogt <tille@handhelds.org> 11// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
12 12
13#ifndef MAINWINDOW_H 13#ifndef MAINWINDOW_H
14#define MAINWINDOW_H 14#define MAINWINDOW_H
15 15
16#include <qmainwindow.h> 16#include <qmainwindow.h>
17#include <qaction.h> 17#include <qaction.h>
18#include <qtimer.h> 18#include <qtimer.h>
19#include <qpopupmenu.h> 19#include <qpopupmenu.h>
20 20
21#include "package.h"
21#include "packagelist.h" 22#include "packagelist.h"
22#include "packagelistremote.h" 23#include "packagelistremote.h"
23#include "packagelistlocal.h" 24#include "packagelistlocal.h"
24#include "packagelistdoclnk.h" 25#include "packagelistdoclnk.h"
25#include "pmipkg.h" 26#include "pmipkg.h"
26#include "pksettings.h" 27#include "pksettings.h"
27#include "packagelistview.h" 28#include "packagelistview.h"
28 29
29class QComboBox; 30class QComboBox;
30class QPEToolBar; 31class QPEToolBar;
31class QLineEdit; 32class QLineEdit;
32class PackageListItem; 33class PackageListItem;
33class QCopChannel; 34class QCopChannel;
34class QMessageBox; 35class QMessageBox;
35class QCheckBox; 36class QCheckBox;
36 37
37class MainWindow : public QMainWindow 38class MainWindow : public QMainWindow
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40 41
41 42
42public: 43public:
43 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 44 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
44 ~MainWindow(); 45 ~MainWindow();
45 void makeChannel(); 46 void makeChannel();
46 47
47 QCopChannel *channel; 48 QCopChannel *channel;
48 49
49protected slots: 50protected slots:
50 void runIpkg(); 51 void runIpkg();
51 void updateList(); 52 void updateList();
52 void displayList(); 53 void displayList();
53 void subSectionChanged(); 54 void subSectionChanged();
54 void sectionChanged(); 55 void sectionChanged();
55 void showSettings(int); 56 void showSettings(int);
56 void showSettingsSetup(); 57 void showSettingsSetup();
57 void showSettingsSrv(); 58 void showSettingsSrv();
58 void showSettingsDst(); 59 void showSettingsDst();
59 60
60public slots: 61public slots:
61 void sectionClose(); 62 void sectionClose();
62 void sectionShow(bool); 63 void sectionShow(bool);
63 void findClose(); 64 void findClose();
64 void findShow(bool); 65 void findShow(bool);
65 void searchClose(); 66 void searchClose();
66 void searchShow(bool); 67 void searchShow(bool);
67 void destClose(); 68 void destClose();
68 void destShow(bool); 69 void destShow(bool);
69 void filterList(); 70 void filterList();
70 void createLinks(); 71 void createLinks();
71 void removeLinks(); 72 void removeLinks();
72 void receive (const QCString &, const QByteArray &); 73 void receive (const QCString &, const QByteArray &);
73 void setDocument (const QString &); 74 void setDocument (const QString &);
74 void remotePackageQuery(); 75 void remotePackageQuery();
75 76
76private: 77private:
77 void makeMenu(); 78 void makeMenu();
78 void setSections(); 79 void setSections();
79 void setSubSections(); 80 void setSubSections();
80 bool updateIcon; 81 bool updateIcon;
81 82
82 PmIpkg* ipkg; 83 PmIpkg* ipkg;
83 PackageManagerSettings *settings; 84 PackageManagerSettings *settings;
84 PackageListLocal packageListServers; 85 PackageListLocal packageListServers;
85 PackageListRemote packageListSearch; 86 PackageListRemote packageListSearch;
86 PackageListDocLnk packageListDocLnk; 87 PackageListDocLnk packageListDocLnk;
87 PackageListView *listViewPackages; 88 PackageListView *listViewPackages;
88 QAction *runAction; 89 QAction *runAction;
89 QAction *updateAction; 90 QAction *updateAction;
90 QAction *findAction; 91 QAction *findAction;
91 QPEToolBar *findBar; 92 QPEToolBar *findBar;
92 QLineEdit *findEdit; 93 QLineEdit *findEdit;
93 QAction *searchAction; 94 QAction *searchAction;
94 QAction *searchCommit; 95 QAction *searchCommit;
95 QPEToolBar *searchBar; 96 QPEToolBar *searchBar;
96 QLineEdit *searchEdit; 97 QLineEdit *searchEdit;
97 QAction *sectionAction; 98 QAction *sectionAction;
98 QPEToolBar *sectionBar; 99 QPEToolBar *sectionBar;
99 QComboBox *section; 100 QComboBox *section;
100 QComboBox *subsection; 101 QComboBox *subsection;
101 QAction *destAction; 102 QAction *destAction;
102 QPEToolBar *destBar; 103 QPEToolBar *destBar;
103 QComboBox *destination; 104 QComboBox *destination;
104 QCheckBox* CheckBoxLink; 105 QCheckBox* CheckBoxLink;
105}; 106};
106 107
107#endif 108#endif
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index 986cbcd..230df2c 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -1,51 +1,53 @@
1 DESTDIR = $(OPIEDIR)/bin 1 DESTDIR = $(OPIEDIR)/bin
2 TEMPLATE= app 2 TEMPLATE= app
3 #CONFIG = qt warn_on release 3 #CONFIG = qt warn_on release
4 CONFIG = qt warn_on debug 4 CONFIG = qt warn_on debug
5 HEADERS = mainwindow.h \ 5 HEADERS = mainwindow.h \
6 pksettings.h \ 6 pksettings.h \
7 pmipkg.h \ 7 pmipkg.h \
8 packagelistdoclnk.h \ 8 packagelistdoclnk.h \
9 installdialog.h \ 9 installdialog.h \
10 utils.h \ 10 utils.h \
11 listviewitemoipkg.h \
11 packagelistitem.h \ 12 packagelistitem.h \
12 packagelistremote.h \ 13 packagelistremote.h \
13 packagelist.h \ 14 packagelist.h \
14 packagelistlocal.h \ 15 packagelistlocal.h \
15 packagelistview.h \ 16 packagelistview.h \
16 package.h 17 package.h
17 SOURCES = main.cpp \ 18 SOURCES = main.cpp \
18 mainwindow.cpp \ 19 mainwindow.cpp \
19 utils.cpp \ 20 utils.cpp \
20 packagelistdoclnk.cpp \ 21 packagelistdoclnk.cpp \
21 packagelistview.cpp \ 22 packagelistview.cpp \
22 installdialog.cpp \ 23 installdialog.cpp \
24 listviewitemoipkg.cpp \
23 packagelistremote.cpp \ 25 packagelistremote.cpp \
24 packagelistlocal.cpp \ 26 packagelistlocal.cpp \
25 pksettings.cpp \ 27 pksettings.cpp \
26 pmipkg.cpp \ 28 pmipkg.cpp \
27 packagelistitem.cpp \ 29 packagelistitem.cpp \
28 packagelist.cpp \ 30 packagelist.cpp \
29 package.cpp 31 package.cpp
30INCLUDEPATH += $(OPIEDIR)/include 32INCLUDEPATH += $(OPIEDIR)/include
31 DEPENDPATH+= $(OPIEDIR)/ioclude 33 DEPENDPATH+= $(OPIEDIR)/ioclude
32LIBS += -lqpe 34LIBS += -lqpe
33LIBS += -lopie 35LIBS += -lopie
34 INTERFACES= runwindow.ui \ 36 INTERFACES= runwindow.ui \
35 pksettingsbase.ui 37 pksettingsbase.ui
36 TARGET = oipkg 38 TARGET = oipkg
37 39
38TRANSLATIONS = ../../../i18n/de/oipkg.ts \ 40TRANSLATIONS = ../../../i18n/de/oipkg.ts \
39 ../../../i18n/en/oipkg.ts \ 41 ../../../i18n/en/oipkg.ts \
40 ../../../i18n/es/oipkg.ts \ 42 ../../../i18n/es/oipkg.ts \
41 ../../../i18n/fr/oipkg.ts \ 43 ../../../i18n/fr/oipkg.ts \
42 ../../../i18n/hu/oipkg.ts \ 44 ../../../i18n/hu/oipkg.ts \
43 ../../../i18n/ja/oipkg.ts \ 45 ../../../i18n/ja/oipkg.ts \
44 ../../../i18n/ko/oipkg.ts \ 46 ../../../i18n/ko/oipkg.ts \
45 ../../../i18n/no/oipkg.ts \ 47 ../../../i18n/no/oipkg.ts \
46 ../../../i18n/pl/oipkg.ts \ 48 ../../../i18n/pl/oipkg.ts \
47 ../../../i18n/pt/oipkg.ts \ 49 ../../../i18n/pt/oipkg.ts \
48 ../../../i18n/pt_BR/oipkg.ts \ 50 ../../../i18n/pt_BR/oipkg.ts \
49 ../../../i18n/sl/oipkg.ts \ 51 ../../../i18n/sl/oipkg.ts \
50 ../../../i18n/zh_CN/oipkg.ts \ 52 ../../../i18n/zh_CN/oipkg.ts \
51 ../../../i18n/zh_TW/oipkg.ts 53 ../../../i18n/zh_TW/oipkg.ts
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 3effb73..e020601 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,479 +1,477 @@
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 "package.h" 10#include "package.h"
11 11
12#include <qpe/process.h> 12#include <qpe/process.h>
13#include <qpe/stringutil.h> 13#include <qpe/stringutil.h>
14#include <qfile.h> 14#include <qfile.h>
15#include <qtextstream.h> 15#include <qtextstream.h>
16#include <stdlib.h> 16#include <stdlib.h>
17#include <unistd.h> 17#include <unistd.h>
18 18
19#include "debug.h" 19#include "debug.h"
20 20
21Package::Package( QObject *parent, const char *name ) 21OipkgPackage::OipkgPackage( QObject *parent, const char *name )
22 : QObject(parent,name) 22 : QObject(parent,name)
23{ 23{
24 24
25} 25}
26 26
27Package::~Package() 27OipkgPackage::~OipkgPackage()
28{ 28{
29} 29}
30 30
31Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) 31OipkgPackage::OipkgPackage( PackageManagerSettings *s, QObject *parent, const char *name )
32 : QObject(parent,name) 32 : QObject(parent,name)
33{ 33 {
34 Package(parent,name);
35 init(s); 34 init(s);
36} 35}
37 36
38void Package::init( PackageManagerSettings *s ) 37void OipkgPackage::init( PackageManagerSettings *s )
39{ 38{
40 settings = s; 39 settings = s;
41 _size = ""; 40 _size = "";
42 _section = ""; 41 _section = "";
43 _subsection = ""; 42 _subsection = "";
44 _shortDesc = ""; 43 _shortDesc = "";
45 _desc = ""; 44 _desc = "";
46 _name = ""; 45 _name = "";
47 _toProcess = false; 46 _toProcess = false;
48 _useFileName = false; 47 _useFileName = false;
49 _old = false; 48 _old = false;
50 _status = ""; 49 _status = "";
51 _dest = settings->getDestinationName(); 50 _dest = settings->getDestinationName();
52 _link = settings->createLinks(); 51 _link = settings->createLinks();
53 _versions=0; 52 _versions=0;
54 _version=""; 53 _version="";
55} 54}
56 55
57Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) 56OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name )
58 : QObject(parent,name) 57 : QObject(parent,name)
59{ 58{
60 init(s); 59 init(s);
61 parsePackage( pack ); 60 parsePackage( pack );
62} 61}
63 62
64Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) 63OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name )
65 : QObject(parent,name) 64 : QObject(parent,name)
66{ 65{
67 init(s); 66 init(s);
68 if ( !QFile::exists( n ) ) 67 if ( !QFile::exists( n ) )
69 { 68 {
70 _name = QString( n ); 69 _name = QString( n );
71 }else{ 70 }else{
72 pvDebug(4,"remote file: "+n); 71 pvDebug(4,"remote file: "+n);
73 parseIpkgFile( n ); 72 parseIpkgFile( n );
74 _useFileName = true; 73 _useFileName = true;
75 _fileName = QString( n ); 74 _fileName = QString( n );
76 } 75 }
77} 76}
78 77
79Package::Package( Package *pi, QObject *parent, const char *name ) 78OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name )
80 : QObject(parent,name) 79 : QObject(parent,name)
81{ 80{
82 init(pi->settings); 81 init(pi->settings);
83 copyValues( pi ); 82 copyValues( pi );
84} 83}
85 84
86 85
87void Package::setValue( QString n, QString t ) 86void OipkgPackage::setValue( QString n, QString t )
88{ 87{
89 if ( n == "Package" ) 88 if ( n == "Package" )
90 { 89 {
91 _name = QString( t ); 90 _name = QString( t );
92 }else if ( n == "Installed-Size" ) 91 }else if ( n == "Installed-Size" )
93 { 92 {
94 _size = t; 93 _size = t;
95// }else if ( n == "Priority") 94// }else if ( n == "Priority")
96// { 95// {
97 96
98 }else if ( n == "Section") 97 }else if ( n == "Section")
99 { 98 {
100 setSection( t ); 99 setSection( t );
101// }else if ( n == "Maintainer") 100// }else if ( n == "Maintainer")
102// { 101// {
103// 102//
104// }else if ( n == "Architecture") 103// }else if ( n == "Architecture")
105// { 104// {
106 105
107 }else if ( n == "Version") 106 }else if ( n == "Version")
108 { 107 {
109 _version = t; 108 _version = t;
110// }else if ( n == "Pre-Depends") 109// }else if ( n == "Pre-Depends")
111// { 110// {
112// 111//
113// }else if ( n == "Depends") 112// }else if ( n == "Depends")
114// { 113// {
115 114
116 }else if ( n == "Filename") 115 }else if ( n == "Filename")
117 { 116 {
118 _fileName = t; 117 _fileName = t;
119// }else if ( n == "Size") 118// }else if ( n == "Size")
120 // { 119 // {
121// 120//
122 //}else if ( n == "MD5Sum") 121 //}else if ( n == "MD5Sum")
123 //{ 122 //{
124 123
125 }else if ( n == "Description") 124 }else if ( n == "Description")
126 { 125 {
127 setDesc( t ); 126 setDesc( t );
128 }else if ( n == "Status") 127 }else if ( n == "Status")
129 { 128 {
130 if ( installed() ) return; 129 if ( installed() ) return;
131 _status = t; 130 _status = t;
132// }else if ( n == "Essential") 131// }else if ( n == "Essential")
133// { 132// {
134 133
135 }else{ 134 }else{
136 _values.insert(n,new QString(t)); 135 _values.insert(n,new QString(t));
137 } 136 }
138} 137}
139 138
140QString Package::name() 139QString OipkgPackage::name()
141{ 140{
142 if (_displayName.isEmpty() ) return _name; 141 if (_displayName.isEmpty() ) return _name;
143 else return _displayName; 142 else return _displayName;
144} 143}
145 144
146 145
147QString Package::installName() 146QString OipkgPackage::installName()
148{ 147{
149 if (_useFileName) return _fileName; 148 if (_useFileName) return _fileName;
150 else return _name; 149 else return _name;
151} 150}
152 151
153QString Package::packageName() 152QString OipkgPackage::packageName()
154{ 153{
155 QString pn = installName(); 154 QString pn = installName();
156 pn = pn.right(pn.length()-pn.findRev("/")); 155 pn = pn.right(pn.length()-pn.findRev("/"));
157 pn = pn.left(pn.find("_")); 156 pn = pn.left(pn.find("_"));
158 return pn; 157 return pn;
159} 158}
160 159
161bool Package::installed() 160bool OipkgPackage::installed()
162{ 161{
163 if (_status.contains("installed")) 162 if (_status.contains("installed"))
164 { 163 {
165 if (_status.contains("not-installed")) 164 if (_status.contains("not-installed"))
166 { 165 {
167 _toProcess = true; 166 _toProcess = true;
168 return false; 167 return false;
169 } 168 }
170 else return true; 169 else return true;
171 } 170 }
172 else 171 else
173 if (_versions) 172 if (_versions)
174 { 173 {
175 QDictIterator<Package> other( *_versions ); 174 QDictIterator<OipkgPackage> other( *_versions );
176 while ( other.current() ) 175 while ( other.current() )
177 { 176 {
178 if (other.current()->status().contains("installed") 177 if (other.current()->status().contains("installed")
179 && other.current()->version() == version()) 178 && other.current()->version() == version())
180 return true; 179 return true;
181 ++other; 180 ++other;
182 } 181 }
183 } 182 }
184 return false; 183 return false;
185} 184}
186 185
187bool Package::otherInstalled() 186bool OipkgPackage::otherInstalled()
188{ 187{
189 if (_versions) 188 if (_versions)
190 { 189 {
191 QDictIterator<Package> other( *_versions ); 190 QDictIterator<OipkgPackage> other( *_versions );
192 while ( other.current() ) 191 while ( other.current() )
193 { 192 {
194 if (other.current()->installed()) return true; 193 if (other.current()->installed()) return true;
195 ++other; 194 ++other;
196 } 195 }
197 } 196 }
198 return false; 197 return false;
199} 198}
200 199
201void Package::setDesc( QString s ) 200void OipkgPackage::setDesc( QString s )
202{ 201{
203 _desc = s; 202 _desc = s;
204 _shortDesc = s.left( s.find("\n") ); 203 _shortDesc = s.left( s.find("\n") );
205} 204}
206 205
207QString Package::desc() 206QString OipkgPackage::desc()
208{ 207{
209 return _desc; 208 return _desc;
210} 209}
211 210
212QString Package::shortDesc() 211QString OipkgPackage::shortDesc()
213{ 212{
214 return _shortDesc; 213 return _shortDesc;
215} 214}
216 215
217QString Package::size() 216QString OipkgPackage::size()
218{ 217{
219 return _size; 218 return _size;
220} 219}
221 220
222 221
223QString Package::version() 222QString OipkgPackage::version()
224{ 223{
225 return _version; 224 return _version;
226} 225}
227 226
228QString Package::sizeUnits() 227QString OipkgPackage::sizeUnits()
229{ 228{
230 int i = _size.toInt(); 229 int i = _size.toInt();
231 int c = 0; 230 int c = 0;
232 QString ret; 231 QString ret;
233 QStringList unit; 232 QStringList unit;
234 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) 233 unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;)
235 while (i > 1) 234 while (i > 1)
236 { 235 {
237 ret=QString::number(i)+" "+unit[c]; 236 ret=QString::number(i)+" "+unit[c];
238 c++; 237 c++;
239 i /= 1024; 238 i /= 1024;
240 } 239 }
241 return ret; 240 return ret;
242} 241}
243 242
244bool Package::toProcess() 243bool OipkgPackage::toProcess()
245{ 244{
246 return _toProcess; 245 return _toProcess;
247} 246}
248 247
249bool Package::toRemove() 248bool OipkgPackage::toRemove()
250{ 249{
251 if ( _toProcess && installed() ) return true; 250 if ( _toProcess && installed() ) return true;
252 else return false; 251 else return false;
253} 252}
254 253
255bool Package::toInstall() 254bool OipkgPackage::toInstall()
256{ 255{
257 if ( _toProcess && !installed() ) return true; 256 if ( _toProcess && !installed() ) return true;
258 else return false; 257 else return false;
259} 258}
260 259
261void Package::toggleProcess() 260void OipkgPackage::toggleProcess()
262{ 261{
263 _toProcess = ! _toProcess; 262 _toProcess = ! _toProcess;
264} 263}
265 264
266 265
267 266void OipkgPackage::copyValues( OipkgPackage* pack )
268void Package::copyValues( Package* pack )
269{ 267{
270 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); 268 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size );
271 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); 269 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section );
272 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); 270 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection );
273 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); 271 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc );
274 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); 272 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc );
275 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); 273 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name );
276 if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); 274 if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest );
277 if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); 275 if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName );
278 if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); 276 if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName );
279 if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); 277 if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version );
280 if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); 278 if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values );
281 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); 279 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status );
282} 280}
283 281
284QString Package::section() 282QString OipkgPackage::section()
285{ 283{
286 return _section; 284 return _section;
287} 285}
288 286
289void Package::setSection( QString s) 287void OipkgPackage::setSection( QString s)
290{ 288{
291 int i = s.find("/"); 289 int i = s.find("/");
292 if ( i > 0 ) 290 if ( i > 0 )
293 { 291 {
294 _section = s.left(i); 292 _section = s.left(i);
295 _subsection = s.mid(i+1); 293 _subsection = s.mid(i+1);
296 }else{ 294 }else{
297 _section = s; 295 _section = s;
298 _subsection = ""; 296 _subsection = "";
299 } 297 }
300} 298}
301 299
302QString Package::subSection() 300QString OipkgPackage::subSection()
303{ 301{
304 return _subsection; 302 return _subsection;
305} 303}
306 304
307void Package::parsePackage( QStringList pack ) 305void OipkgPackage::parsePackage( QStringList pack )
308{ 306{
309 if ( pack.isEmpty() ) return; 307 if ( pack.isEmpty() ) return;
310 int count = pack.count(); 308 int count = pack.count();
311 for( int i = 0; i < count; i++ ) 309 for( int i = 0; i < count; i++ )
312 { 310 {
313 QString line = pack[i]; 311 QString line = pack[i];
314 int sep = line.find( QRegExp(":[\t ]+") ); 312 int sep = line.find( QRegExp(":[\t ]+") );
315 if ( sep >= 0 ) 313 if ( sep >= 0 )
316 { 314 {
317 QString tag = line.left(sep); 315 QString tag = line.left(sep);
318 QString value = line.mid(sep+2).simplifyWhiteSpace(); 316 QString value = line.mid(sep+2).simplifyWhiteSpace();
319 setValue( tag, value ); 317 setValue( tag, value );
320 }else{ 318 }else{
321 } 319 }
322 } 320 }
323 return; 321 return;
324} 322}
325 323
326QString Package::details() 324QString OipkgPackage::details()
327{ 325{
328 QString status; 326 QString status;
329 Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); 327 Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
330 QString description; 328 QString description;
331 if ( ipkg_status.exec("",status) ) 329 if ( ipkg_status.exec("",status) )
332 { 330 {
333 QStringList lines = QStringList::split('\n',status,TRUE); 331 QStringList lines = QStringList::split('\n',status,TRUE);
334 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { 332 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
335 QString line = *it; 333 QString line = *it;
336 if ( line == " ." ) 334 if ( line == " ." )
337 { 335 {
338 description.append("<p>"); 336 description.append("<p>");
339 } else 337 } else
340 if ( line[0] == ' ' || line[0] == '\t' ) 338 if ( line[0] == ' ' || line[0] == '\t' )
341 { 339 {
342 // continuation 340 // continuation
343 description.append(" "); 341 description.append(" ");
344 description.append(Qtopia::escapeString(line)); 342 description.append(Qtopia::escapeString(line));
345 } else { 343 } else {
346 int sep = line.find(QRegExp(":[\t ]+")); 344 int sep = line.find(QRegExp(":[\t ]+"));
347 if ( sep >= 0 ) 345 if ( sep >= 0 )
348 { 346 {
349 QString tag = line.left(sep); 347 QString tag = line.left(sep);
350 description.append("<br>"); 348 description.append("<br>");
351 description.append("<b>"); 349 description.append("<b>");
352 description.append(Qtopia::escapeString(tag)); 350 description.append(Qtopia::escapeString(tag));
353 description.append(":</b> "); 351 description.append(":</b> ");
354 description.append(Qtopia::escapeString(line.mid(sep+2))); 352 description.append(Qtopia::escapeString(line.mid(sep+2)));
355 } else { 353 } else {
356 description.append(" "); 354 description.append(" ");
357 description.append(Qtopia::escapeString(line)); 355 description.append(Qtopia::escapeString(line));
358 } 356 }
359 } 357 }
360 } 358 }
361 } 359 }
362 return description; 360 return description;
363} 361}
364 362
365void Package::processed() 363void OipkgPackage::processed()
366{ 364{
367 _toProcess = false; 365 _toProcess = false;
368 //hack, but we're not writing status anyway... 366 //hack, but we're not writing status anyway...
369 if ( installed() ) _status = "install"; 367 if ( installed() ) _status = "install";
370 else _status = "installed"; 368 else _status = "installed";
371} 369}
372 370
373QString Package::dest() 371QString OipkgPackage::dest()
374{ 372{
375 if ( installed()||(!installed() && _toProcess) ) 373 if ( installed()||(!installed() && _toProcess) )
376 return _dest!=""?_dest:settings->getDestinationName(); 374 return _dest!=""?_dest:settings->getDestinationName();
377 else return ""; 375 else return "";
378} 376}
379 377
380void Package::setDest( QString d ) 378void OipkgPackage::setDest( QString d )
381{ 379{
382 if ( d == "remote") _useFileName = true; 380 if ( d == "remote") _useFileName = true;
383 else _dest = d; 381 else _dest = d;
384} 382}
385 383
386void Package::setOn() 384void OipkgPackage::setOn()
387{ 385{
388 _toProcess = true; 386 _toProcess = true;
389} 387}
390 388
391bool Package::link() 389bool OipkgPackage::link()
392{ 390{
393 if ( _dest == "root" || (!installed() && !_toProcess) ) return false; 391 if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
394 return _link; 392 return _link;
395} 393}
396 394
397void Package::setLink(bool b) 395void OipkgPackage::setLink(bool b)
398{ 396{
399 _link = b; 397 _link = b;
400} 398}
401 399
402void Package::parseIpkgFile( QString file) 400void OipkgPackage::parseIpkgFile( QString file)
403{ 401{
404// 20020830 402// 20020830
405// a quick hack to make oipkg understand the new ipk format 403// a quick hack to make oipkg understand the new ipk format
406// neu: ar pf PACKAGE control.tar.gz | tar xfOz - ./control > /tmp/control 404// neu: ar pf PACKAGE control.tar.gz | tar xfOz - ./control > /tmp/control
407 if (system("ar pf "+file+" control.tar.gz | tar xfOz - ./control > /tmp/control") != 0) 405 if (system("ar pf "+file+" control.tar.gz | tar xfOz - ./control > /tmp/control") != 0)
408 { 406 {
409//#old tar ipk format 407//#old tar ipk format
410 system("tar xzf "+file+" -C /tmp"); 408 system("tar xzf "+file+" -C /tmp");
411 system("tar xzf /tmp/control.tar.gz -C /tmp"); 409 system("tar xzf /tmp/control.tar.gz -C /tmp");
412 } 410 }
413 QFile f("/tmp/control"); 411 QFile f("/tmp/control");
414 if ( f.open(IO_ReadOnly) ) 412 if ( f.open(IO_ReadOnly) )
415 { 413 {
416 QTextStream t( &f ); 414 QTextStream t( &f );
417 QStringList pack; 415 QStringList pack;
418 while ( !t.eof() ) 416 while ( !t.eof() )
419 { 417 {
420 pack << t.readLine(); 418 pack << t.readLine();
421 } 419 }
422 f.close(); 420 f.close();
423 parsePackage( pack ); 421 parsePackage( pack );
424 } 422 }
425 423
426} 424}
427 425
428//QString Package::getPackageName() 426//QString OipkgPackage::getPackageName()
429//{ 427//{
430 //if ( _packageName.isEmpty() ) return _name; 428 //if ( _packageName.isEmpty() ) return _name;
431 //else return _packageName; 429 //else return _packageName;
432//} 430//}
433 431
434void Package::instalFromFile(bool iff) 432void OipkgPackage::instalFromFile(bool iff)
435{ 433{
436 _useFileName = iff; 434 _useFileName = iff;
437} 435}
438 436
439void Package::setName(QString n) 437void OipkgPackage::setName(QString n)
440{ 438{
441 _displayName = n; 439 _displayName = n;
442} 440}
443 441
444QDict<QString>* Package::getFields() 442QDict<QString>* OipkgPackage::getFields()
445{ 443{
446 return &_values; 444 return &_values;
447} 445}
448 446
449QString Package::status() 447QString OipkgPackage::status()
450{ 448{
451 return _status; 449 return _status;
452} 450}
453 451
454bool Package::isOld() 452bool OipkgPackage::isOld()
455{ 453{
456 if (!_versions) return false; 454 if (!_versions) return false;
457 QDictIterator<Package> other( *_versions ); 455 QDictIterator<OipkgPackage> other( *_versions );
458 while ( other.current() ) { 456 while ( other.current() ) {
459 if (other.current()->version() > version() ) return true; 457 if (other.current()->version() > version() ) return true;
460 ++other; 458 ++other;
461 } 459 }
462 return false; 460 return false;
463} 461}
464 462
465bool Package::hasVersions() 463bool OipkgPackage::hasVersions()
466{ 464{
467 if (!_versions) return false; 465 if (!_versions) return false;
468 else return true; 466 else return true;
469} 467}
470 468
471QDict<Package>* Package::getOtherVersions() 469QDict<OipkgPackage>* OipkgPackage::getOtherVersions()
472{ 470{
473 return _versions; 471 return _versions;
474} 472}
475 473
476void Package::setOtherVersions(QDict<Package> *v) 474void OipkgPackage::setOtherVersions(QDict<OipkgPackage> *v)
477{ 475{
478 _versions=v; 476 _versions=v;
479} 477}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index c147420..2334c31 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -1,100 +1,100 @@
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#ifndef PK_ITEM_H 10#ifndef PK_ITEM_H
11#define PK_ITEM_H 11#define PK_ITEM_H
12 12
13#include <qstring.h> 13#include <qstring.h>
14#include <qlistview.h> 14#include <qlistview.h>
15#include <qpainter.h> 15#include <qpainter.h>
16#include <qpixmap.h> 16#include <qpixmap.h>
17#include <qdict.h> 17#include <qdict.h>
18#include <qobject.h> 18#include <qobject.h>
19 19
20#include "pksettings.h" 20#include "pksettings.h"
21 21
22class Package : public QObject 22class OipkgPackage : public QObject
23{ 23{
24 Q_OBJECT 24 Q_OBJECT
25 public: 25 public:
26 Package(QObject *parent=0, const char *name=0); 26 OipkgPackage(QObject *parent=0, const char *name=0);
27 Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); 27 OipkgPackage(PackageManagerSettings *s, QObject *parent=0, const char *name=0);
28 ~Package(); 28 ~OipkgPackage();
29 Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); 29 OipkgPackage( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 );
30 Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); 30 OipkgPackage( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 );
31 Package( Package*s, QObject *parent=0, const char *name=0 ); 31 OipkgPackage( OipkgPackage*s, QObject *parent=0, const char *name=0 );
32 32
33 void setValue( QString, QString ); 33 void setValue( QString, QString );
34 void copyValues( Package* ); 34 void copyValues( OipkgPackage* );
35 35
36 QString name(); 36 QString name();
37 QString installName(); 37 QString installName();
38 QString packageName(); 38 QString packageName();
39 bool installed(); 39 bool installed();
40 bool otherInstalled(); 40 bool otherInstalled();
41 41
42 void setDesc( QString ); 42 void setDesc( QString );
43 QString shortDesc(); 43 QString shortDesc();
44 QString desc(); 44 QString desc();
45 QString size(); 45 QString size();
46 QString sizeUnits(); 46 QString sizeUnits();
47 QString version(); 47 QString version();
48 void setSection( QString ); 48 void setSection( QString );
49 QString section(); 49 QString section();
50 QString subSection(); 50 QString subSection();
51 QString details(); 51 QString details();
52 bool toProcess(); 52 bool toProcess();
53 bool toInstall(); 53 bool toInstall();
54 bool toRemove(); 54 bool toRemove();
55 void processed(); 55 void processed();
56 QString dest(); 56 QString dest();
57 void setDest( QString d ); 57 void setDest( QString d );
58 void setOn(); 58 void setOn();
59 bool link(); 59 bool link();
60 void setLink(bool); 60 void setLink(bool);
61 bool isOld(); 61 bool isOld();
62 bool hasVersions(); 62 bool hasVersions();
63 void parseIpkgFile( QString ); 63 void parseIpkgFile( QString );
64 void instalFromFile(bool iff=true); 64 void instalFromFile(bool iff=true);
65 void setName(QString); 65 void setName(QString);
66 QDict<QString>* getFields(); 66 QDict<QString>* getFields();
67 QString status(); 67 QString status();
68 68
69 QDict<Package>* getOtherVersions(); 69 QDict<OipkgPackage>* getOtherVersions();
70 void setOtherVersions(QDict<Package>*); 70 void setOtherVersions(QDict<OipkgPackage>*);
71 71
72public slots: 72public slots:
73 void toggleProcess(); 73 void toggleProcess();
74 74
75private: 75private:
76 PackageManagerSettings *settings; 76 PackageManagerSettings *settings;
77 QString _displayName; 77 QString _displayName;
78 QString _name; 78 QString _name;
79 QString _fileName; 79 QString _fileName;
80 bool _old; 80 bool _old;
81 bool _hasVersions; 81 bool _hasVersions;
82 bool _toProcess; 82 bool _toProcess;
83 bool _link; 83 bool _link;
84 QString _status; 84 QString _status;
85 QString _size; 85 QString _size;
86 QString _section; 86 QString _section;
87 QString _subsection; 87 QString _subsection;
88 QString _shortDesc; 88 QString _shortDesc;
89 QString _desc; 89 QString _desc;
90 QString _version; 90 QString _version;
91 QString _dest; 91 QString _dest;
92 QDict<QString> _values; 92 QDict<QString> _values;
93 QDict<Package> *_versions; 93 QDict<OipkgPackage> *_versions;
94 bool _useFileName; 94 bool _useFileName;
95 void parsePackage( QStringList ); 95 void parsePackage( QStringList );
96 void init(PackageManagerSettings *); 96 void init(PackageManagerSettings *);
97}; 97};
98 98
99 99
100#endif 100#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index edb9cc5..5f79ec1 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,240 +1,240 @@
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 "packagelist.h" 10#include "packagelist.h"
11 11
12#include <assert.h> 12#include <assert.h>
13#include <qfile.h> 13#include <qfile.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qtextstream.h> 15#include <qtextstream.h>
16 16
17#include "debug.h" 17#include "debug.h"
18 18
19static QDict<Package> *packageListAll; 19static QDict<OipkgPackage> *packageListAll;
20static int packageListAllRefCount = 0; 20static int packageListAllRefCount = 0;
21 21
22PackageList::PackageList(QObject *parent, const char *name) 22PackageList::PackageList(QObject *parent, const char *name)
23 : QObject(parent,name), packageIter( packageList ) 23 : QObject(parent,name), packageIter( packageList )
24{ 24{
25 empty=true; 25 empty=true;
26 if (!packageListAll) packageListAll = new QDict<Package>(); 26 if (!packageListAll) packageListAll = new QDict<OipkgPackage>();
27 packageListAllRefCount++; 27 packageListAllRefCount++;
28 sections << "All"; 28 sections << "All";
29 subSections.insert("All", new QStringList() ); 29 subSections.insert("All", new QStringList() );
30 QStringList *ss = subSections["All"]; 30 QStringList *ss = subSections["All"];
31 *ss << "All"; 31 *ss << "All";
32 aktSection = "All"; 32 aktSection = "All";
33 aktSubSection = "All"; 33 aktSubSection = "All";
34} 34}
35 35
36PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) 36PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name)
37 : QObject(parent,name), packageIter( packageList ) 37 : QObject(parent,name), packageIter( packageList )
38{ 38{
39 settings = s; 39 settings = s;
40 PackageList(parent, name); 40 PackageList(parent, name);
41} 41}
42 42
43PackageList::~PackageList() 43PackageList::~PackageList()
44{ 44{
45 if (--packageListAllRefCount < 1 ) delete packageListAll; 45 if (--packageListAllRefCount < 1 ) delete packageListAll;
46} 46}
47 47
48/** Inserts a package into the list */ 48/** Inserts a package into the list */
49void PackageList::insertPackage( Package* pack ) 49void PackageList::insertPackage( OipkgPackage* pack )
50{ 50{
51 if (!pack) return; 51 if (!pack) return;
52 Package* p = packageListAll->find( pack->name() ); 52 OipkgPackage* p = packageListAll->find( pack->name() );
53 if ( p ) 53 if ( p )
54 { 54 {
55 if ( (p->version() == pack->version()) 55 if ( (p->version() == pack->version())
56 // && (p->dest() == pack->dest()) 56 // && (p->dest() == pack->dest())
57 ) 57 )
58 { 58 {
59 p->copyValues( pack ); 59 p->copyValues( pack );
60 delete pack; 60 delete pack;
61 pack = p; 61 pack = p;
62 } else { 62 } else {
63 QDict<Package> *packver = p->getOtherVersions(); 63 QDict<OipkgPackage> *packver = p->getOtherVersions();
64 // p->setName( pack->name()+"["+p->version()+"]" ); 64 // p->setName( pack->name()+"["+p->version()+"]" );
65 if (!packver) 65 if (!packver)
66 { 66 {
67 packver = new QDict<Package>(); 67 packver = new QDict<OipkgPackage>();
68 packver->insert( pack->name(), p ); 68 packver->insert( pack->name(), p );
69 p->setOtherVersions( packver ); 69 p->setOtherVersions( packver );
70 } 70 }
71 pack->setName( pack->name() );//+"["+pack->version()+"]" ); 71 pack->setName( pack->name() );//+"["+pack->version()+"]" );
72 pack->setOtherVersions( packver ); 72 pack->setOtherVersions( packver );
73 packver->insert( pack->name(), pack ); 73 packver->insert( pack->name(), pack );
74 packageListAll->insert( pack->name(), pack ); 74 packageListAll->insert( pack->name(), pack );
75 packageList.insert( pack->name(), pack ); 75 packageList.insert( pack->name(), pack );
76 origPackageList.insert( pack->name(), pack ); 76 origPackageList.insert( pack->name(), pack );
77 } 77 }
78 }else{ 78 }else{
79 packageListAll->insert( pack->name(), pack ); 79 packageListAll->insert( pack->name(), pack );
80 packageList.insert( pack->name(), pack ); 80 packageList.insert( pack->name(), pack );
81 origPackageList.insert( pack->name(), pack ); 81 origPackageList.insert( pack->name(), pack );
82 }; 82 };
83 empty=false; 83 empty=false;
84 updateSections( pack ); 84 updateSections( pack );
85} 85}
86 86
87void PackageList::filterPackages( QString f ) 87void PackageList::filterPackages( QString f )
88 { 88 {
89 packageList.clear(); 89 packageList.clear();
90 QDictIterator<Package> filterIter( origPackageList ); 90 QDictIterator<OipkgPackage> filterIter( origPackageList );
91 filterIter.toFirst(); 91 filterIter.toFirst();
92 Package *pack= filterIter.current() ; 92 OipkgPackage *pack= filterIter.current() ;
93 while ( pack ) 93 while ( pack )
94 { 94 {
95 if ( 95 if (
96 ((aktSection=="All")||(pack->section()==aktSection)) && 96 ((aktSection=="All")||(pack->section()==aktSection)) &&
97 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && 97 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
98 pack->name().contains( f ) 98 pack->name().contains( f )
99 ) 99 )
100 { 100 {
101 packageList.insert( pack->name(), pack ); 101 packageList.insert( pack->name(), pack );
102 } 102 }
103 ++filterIter; 103 ++filterIter;
104 pack = filterIter.current(); 104 pack = filterIter.current();
105 } 105 }
106} 106}
107 107
108Package* PackageList::find( QString n ) 108OipkgPackage* PackageList::find( QString n )
109{ 109{
110 return packageList.find( n ); 110 return packageList.find( n );
111} 111}
112 112
113Package* PackageList::first() 113OipkgPackage* PackageList::first()
114 { 114 {
115 packageIter.toFirst(); 115 packageIter.toFirst();
116 return packageIter.current(); 116 return packageIter.current();
117} 117}
118 118
119Package* PackageList::next() 119OipkgPackage* PackageList::next()
120{ 120{
121 ++packageIter; 121 ++packageIter;
122 return packageIter.current(); 122 return packageIter.current();
123} 123}
124 124
125QStringList PackageList::getSections() 125QStringList PackageList::getSections()
126{ 126{
127 sections.sort(); 127 sections.sort();
128 return sections; 128 return sections;
129} 129}
130 130
131QStringList PackageList::getSubSections() 131QStringList PackageList::getSubSections()
132{ 132{
133 QStringList ss; 133 QStringList ss;
134 if ( !subSections[aktSection] ) return ss; 134 if ( !subSections[aktSection] ) return ss;
135 ss = *subSections[aktSection]; 135 ss = *subSections[aktSection];
136 ss.sort(); 136 ss.sort();
137 return ss; 137 return ss;
138} 138}
139 139
140void PackageList::setSection( QString sec ) 140void PackageList::setSection( QString sec )
141{ 141{
142 aktSection = sec; 142 aktSection = sec;
143} 143}
144 144
145void PackageList::setSubSection( QString ssec ) 145void PackageList::setSubSection( QString ssec )
146{ 146{
147 aktSubSection = ssec; 147 aktSubSection = ssec;
148} 148}
149 149
150void PackageList::updateSections( Package* pack ) 150void PackageList::updateSections( OipkgPackage* pack )
151{ 151{
152 QString s = pack->section(); 152 QString s = pack->section();
153 if ( s.isEmpty() || s == "") return; 153 if ( s.isEmpty() || s == "") return;
154 if ( !sections.contains(s) ) sections += s; 154 if ( !sections.contains(s) ) sections += s;
155 QString ss = pack->subSection(); 155 QString ss = pack->subSection();
156 if ( ss.isEmpty() || ss == "" ) return; 156 if ( ss.isEmpty() || ss == "" ) return;
157 if ( !subSections[s] ) { 157 if ( !subSections[s] ) {
158 subSections.insert( s, new QStringList() ); 158 subSections.insert( s, new QStringList() );
159 QStringList *subsecs = subSections[s]; 159 QStringList *subsecs = subSections[s];
160 *subsecs += "All"; 160 *subsecs += "All";
161 } 161 }
162 QStringList *subsecs = subSections[s]; 162 QStringList *subsecs = subSections[s];
163 if ( !subsecs->contains(ss) ) *subsecs += ss; 163 if ( !subsecs->contains(ss) ) *subsecs += ss;
164// if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); 164// if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
165// subsecs = subSections["All"]; 165// subsecs = subSections["All"];
166// *subsecs += ss; 166// *subsecs += ss;
167} 167}
168 168
169 169
170void PackageList::readFileEntries( QString filename, QString dest ) 170void PackageList::readFileEntries( QString filename, QString dest )
171 { 171 {
172 pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); 172 pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
173 QStringList packEntry; 173 QStringList packEntry;
174 QFile f( filename ); 174 QFile f( filename );
175 if ( !f.open(IO_ReadOnly) ) return; 175 if ( !f.open(IO_ReadOnly) ) return;
176 QTextStream *statusStream = new QTextStream( &f ); 176 QTextStream *statusStream = new QTextStream( &f );
177 while ( !statusStream ->eof() ) 177 while ( !statusStream ->eof() )
178 { 178 {
179 QString line = statusStream->readLine(); 179 QString line = statusStream->readLine();
180 if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) 180 if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
181 { 181 {
182 //end of package 182 //end of package
183 if ( ! packEntry.isEmpty() ) 183 if ( ! packEntry.isEmpty() )
184 { 184 {
185 Package *p = new Package( packEntry, settings ); 185 OipkgPackage *p = new OipkgPackage( packEntry, settings );
186 if ( p ) 186 if ( p )
187 { 187 {
188 p->setDest( dest ); 188 p->setDest( dest );
189 insertPackage( p ); 189 insertPackage( p );
190 packEntry.clear(); 190 packEntry.clear();
191 } 191 }
192 } 192 }
193 }else{ 193 }else{
194 packEntry << line; 194 packEntry << line;
195 }; 195 };
196 } 196 }
197 //there might be no nl at the end of the package file 197 //there might be no nl at the end of the package file
198 if ( ! packEntry.isEmpty() ) 198 if ( ! packEntry.isEmpty() )
199 { 199 {
200 Package *p = new Package( packEntry, settings ); 200 OipkgPackage *p = new OipkgPackage( packEntry, settings );
201 if ( p ) 201 if ( p )
202 { 202 {
203 p->setDest( dest ); 203 p->setDest( dest );
204 insertPackage( p ); 204 insertPackage( p );
205 packEntry.clear(); 205 packEntry.clear();
206 } 206 }
207 } 207 }
208 delete statusStream; 208 delete statusStream;
209 return; 209 return;
210} 210}
211 211
212void PackageList::setSettings( PackageManagerSettings *s ) 212void PackageList::setSettings( PackageManagerSettings *s )
213{ 213{
214 settings = s; 214 settings = s;
215} 215}
216 216
217Package* PackageList::getByName( QString n ) 217OipkgPackage* PackageList::getByName( QString n )
218{ 218{
219 return origPackageList[n]; 219 return origPackageList[n];
220} 220}
221 221
222void PackageList::clear() 222void PackageList::clear()
223{ 223{
224 origPackageList.clear(); 224 origPackageList.clear();
225 packageList.clear(); 225 packageList.clear();
226} 226}
227 227
228void PackageList::allPackages() 228void PackageList::allPackages()
229{ 229{
230 packageList.clear(); 230 packageList.clear();
231 QDictIterator<Package> filterIter( origPackageList ); 231 QDictIterator<OipkgPackage> filterIter( origPackageList );
232 filterIter.toFirst(); 232 filterIter.toFirst();
233 Package *pack= filterIter.current() ; 233 OipkgPackage *pack= filterIter.current() ;
234 while ( pack ) 234 while ( pack )
235 { 235 {
236 packageList.insert( pack->name(), pack ); 236 packageList.insert( pack->name(), pack );
237 ++filterIter; 237 ++filterIter;
238 pack = filterIter.current(); 238 pack = filterIter.current();
239 } 239 }
240} 240}
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index 0c13688..88a8793 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -1,69 +1,69 @@
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#ifndef PACKAGELIST_H 10#ifndef PACKAGELIST_H
11#define PACKAGELIST_H 11#define PACKAGELIST_H
12 12
13#include <qdict.h> 13#include <qdict.h>
14#include "package.h" 14#include "package.h"
15#include "pksettings.h" 15#include "pksettings.h"
16#include "debug.h" 16#include "debug.h"
17 17
18class PackageList : public QObject 18class PackageList : public QObject
19{ 19{
20 Q_OBJECT 20 Q_OBJECT
21public: 21public:
22 //static QString all = QObject::tr("All"); 22 //static QString all = QObject::tr("All");
23 23
24 PackageList (QObject *parent=0, const char *name=0); 24 PackageList (QObject *parent=0, const char *name=0);
25 PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); 25 PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0);
26 virtual ~PackageList(); 26 virtual ~PackageList();
27 void insertPackage( Package* ); 27 void insertPackage( OipkgPackage* );
28 Package* find( QString ); 28 OipkgPackage* find( QString );
29 Package* next(); 29 OipkgPackage* next();
30 Package* first(); 30 OipkgPackage* first();
31 31
32 QStringList getSections(); 32 QStringList getSections();
33 QStringList getSubSections(); 33 QStringList getSubSections();
34 void setSettings( PackageManagerSettings* ); 34 void setSettings( PackageManagerSettings* );
35 void filterPackages( QString ); 35 void filterPackages( QString );
36 Package* getByName( QString ); 36 OipkgPackage* getByName( QString );
37 void clear(); 37 void clear();
38 void allPackages(); 38 void allPackages();
39 39
40 QDict<Package> *versions; 40 QDict<OipkgPackage> *versions;
41 41
42public slots: 42public slots:
43 void setSection(QString); 43 void setSection(QString);
44 void setSubSection(QString); 44 void setSubSection(QString);
45 // virtual void update(); 45 // virtual void update();
46 46
47protected: 47protected:
48 int currentPackage; 48 int currentPackage;
49 int packageCount; 49 int packageCount;
50 50
51 PackageManagerSettings *settings; 51 PackageManagerSettings *settings;
52 QDict<Package> packageList; 52 QDict<OipkgPackage> packageList;
53 QDict<Package> origPackageList; 53 QDict<OipkgPackage> origPackageList;
54 QDictIterator<Package> packageIter; 54 QDictIterator<OipkgPackage> packageIter;
55 55
56 bool empty; 56 bool empty;
57 QString aktSection; 57 QString aktSection;
58 QString aktSubSection; 58 QString aktSubSection;
59 QStringList sections; 59 QStringList sections;
60 QDict<QStringList> subSections; 60 QDict<QStringList> subSections;
61 QDict<bool> sectionsDict; 61 QDict<bool> sectionsDict;
62 62
63 63
64 void updateSections( Package* ); 64 void updateSections( OipkgPackage* );
65 void readFileEntries( QString file, QString dest="" ); 65 void readFileEntries( QString file, QString dest="" );
66}; 66};
67 67
68 68
69#endif 69#endif
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
index 76e91ff..a7a6f70 100644
--- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp
+++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
@@ -1,53 +1,53 @@
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 "packagelistdoclnk.h" 10#include "packagelistdoclnk.h"
11 11
12#include <qpe/applnk.h> 12#include <qpe/applnk.h>
13#include <qpe/config.h> 13#include <qpe/config.h>
14#include <qlist.h> 14#include <qlist.h>
15 15
16#include "package.h" 16#include "package.h"
17#include "pksettings.h" 17#include "pksettings.h"
18 18
19PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name) 19PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name)
20 : PackageList(s) 20 : PackageList(s)
21{ 21{
22 PackageListDocLnk(parent, name); 22 PackageListDocLnk(parent, name);
23} 23}
24 24
25PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name) 25PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name)
26 : PackageList(parent, name) 26 : PackageList(parent, name)
27{ 27{
28 Config cfg( "oipkg", Config::User ); 28 Config cfg( "oipkg", Config::User );
29 cfg.setGroup( "Common" ); 29 cfg.setGroup( "Common" );
30 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); 30 docLnkDir = cfg.readEntry( "docLnkDir", "/root/" );
31 pvDebug(2,"opening DocLnkSet "+docLnkDir); 31 pvDebug(2,"opening DocLnkSet "+docLnkDir);
32 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); 32 doclnkset = new DocLnkSet(docLnkDir,"application/ipkg");
33} 33}
34 34
35PackageListDocLnk::~PackageListDocLnk() 35PackageListDocLnk::~PackageListDocLnk()
36{ 36{
37 Config cfg( "oipkg", Config::User ); 37 Config cfg( "oipkg", Config::User );
38 cfg.setGroup( "Common" ); 38 cfg.setGroup( "Common" );
39 cfg.writeEntry( "docLnkDir", docLnkDir ); 39 cfg.writeEntry( "docLnkDir", docLnkDir );
40 delete doclnkset; 40 delete doclnkset;
41} 41}
42 42
43 43
44 44
45void PackageListDocLnk::update() 45void PackageListDocLnk::update()
46{ 46{
47 pvDebug(2,"PackageListDocLnk::update "); 47 pvDebug(2,"PackageListDocLnk::update ");
48 QList<DocLnk> packlist = doclnkset->children(); 48 QList<DocLnk> packlist = doclnkset->children();
49 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) 49 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
50 { 50 {
51 insertPackage( new Package(pack->file(), settings ) ); 51 insertPackage( new OipkgPackage(pack->file(), settings ) );
52 } 52 }
53} 53}
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 03bf477..4380393 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -1,174 +1,239 @@
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 "packagelistitem.h" 10#include "packagelistitem.h"
11 11
12#include <qpe/resource.h> 12#include <qpe/resource.h>
13#include <qobject.h> 13#include <qobject.h>
14#include <qpopupmenu.h>
15#include <qaction.h>
14 16
15#include "debug.h" 17#include "debug.h"
16 18
17static QPixmap *pm_uninstalled=0; 19static QPixmap *pm_uninstalled=0;
18static QPixmap *pm_uninstalled_old=0; 20static QPixmap *pm_uninstalled_old=0;
19static QPixmap *pm_installed=0; 21static QPixmap *pm_installed=0;
20static QPixmap *pm_installed_old=0; 22static QPixmap *pm_installed_old=0;
21static QPixmap *pm_uninstall=0; 23static QPixmap *pm_uninstall=0;
22static QPixmap *pm_install=0; 24static QPixmap *pm_install=0;
23static QPixmap *pm_uninstalled_old_installed_new=0; 25static QPixmap *pm_uninstalled_old_installed_new=0;
24static QPixmap *pm_uninstalled_installed_old=0; 26static QPixmap *pm_uninstalled_installed_old=0;
25 27
26PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) 28PackageListItem::PackageListItem(ListViewItemOipkg *parent, QString name, Type ittype)
27 :QCheckListItem(lv,pi->name(),CheckBox) 29 : ListViewItemOipkg(parent,name,ittype)
28{ 30{
29 init(pi,s); 31
30} 32}
31 33
32PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) 34PackageListItem::PackageListItem(QListView* lv, OipkgPackage *pi, PackageManagerSettings *s)
33 :QCheckListItem(lvi,pi->name(),CheckBox) 35 :ListViewItemOipkg(lv,pi->name(),ListViewItemOipkg::Package)
34{ 36{
35 init(pi,s); 37 init(pi,s);
36} 38}
37 39
38void PackageListItem::init( Package *pi, PackageManagerSettings *s) 40PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s)
41 :ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package)
42{
43 init(pi,s);
44}
45PackageListItem::~PackageListItem()
39{ 46{
47 delete popupMenu;
48 delete destsMenu;
49}
50
51void PackageListItem::init( OipkgPackage *pi, PackageManagerSettings *s)
52{
53 popupMenu = new QPopupMenu( 0 );
54 destsMenu = new QPopupMenu( 0 );
40 package = pi; 55 package = pi;
41 settings = s; 56 settings = s;
42 setExpandable( true ); 57 setExpandable( true );
43 QCheckListItem *item; 58 ListViewItemOipkg *item;
44 nameItem = new QCheckListItem( this, "" ); 59 nameItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute,"name" );
45 item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); 60 item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Description: ")+pi->desc() );
46 item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); 61 item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Size: ")+pi->size() );
47 destItem = new QCheckListItem( this, "" ); 62 destItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "dest" );
48 linkItem = new QCheckListItem( this, "" ); 63 linkItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "link" );
49 statusItem = new QCheckListItem( this, "" ); 64 statusItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "status" );
50 QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); 65 ListViewItemOipkg *otherItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("other") );
51 item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() ); 66 item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QObject::tr("Install Name: ")+pi->installName() );
52 QDict<QString> *fields = pi->getFields(); 67 QDict<QString> *fields = pi->getFields();
53 QDictIterator<QString> it( *fields ); 68 QDictIterator<QString> it( *fields );
54 while ( it.current() ) { 69 while ( it.current() ) {
55 item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); 70 item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QString(it.currentKey()+": "+*it.current()) );
56 ++it; 71 ++it;
57 } 72 }
58 displayDetails(); 73 displayDetails();
59 74
60 if (!pm_uninstalled) 75 if (!pm_uninstalled)
61 { 76 {
62 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); 77 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
63 pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); 78 pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld"));
64 pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); 79 pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew"));
65 pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); 80 pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld"));
66 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); 81 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
67 pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); 82 pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld"));
68 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); 83 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
69 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); 84 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
70 } 85 }
71} 86}
72 87
73void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, 88void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
74 int column, int width, int alignment ) 89 int column, int width, int alignment )
75{ 90{
76 if ( !p ) 91 if ( !p )
77 return; 92 return;
78 93
79 p->fillRect( 0, 0, width, height(), 94 p->fillRect( 0, 0, width, height(),
80 isSelected()? cg.highlight() : cg.base() ); 95 isSelected()? cg.highlight() : cg.base() );
81 96
82 if ( column != 0 ) { 97 if ( column != 0 ) {
83 // The rest is text 98 // The rest is text
84 QListViewItem::paintCell( p, cg, column, width, alignment ); 99 QListViewItem::paintCell( p, cg, column, width, alignment );
85 return; 100 return;
86 } 101 }
87 102
88 QListView *lv = listView(); 103 QListView *lv = listView();
89 if ( !lv ) 104 if ( !lv )
90 return; 105 return;
91 int marg = lv->itemMargin(); 106 int marg = lv->itemMargin();
92 int r = marg; 107 int r = marg;
93 108
94 QPixmap pm = statePixmap(); 109 QPixmap pm = statePixmap();
95 p->drawPixmap(marg,(height()-pm.height())/2,pm); 110 p->drawPixmap(marg,(height()-pm.height())/2,pm);
96 r += pm.width()+1; 111 r += pm.width()+1;
97 112
98 p->translate( r, 0 ); 113 p->translate( r, 0 );
99 QListViewItem::paintCell( p, cg, column, width - r, alignment ); 114 QListViewItem::paintCell( p, cg, column, width - r, alignment );
100} 115}
101 116
102 117
103void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, 118void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
104 const QRect & r ) 119 const QRect & r )
105{ 120{
106 // Skip QCheckListItem 121 // Skip QCheckListItem
107 // (makes you wonder what we're getting from QCheckListItem) 122 // (makes you wonder what we're getting from QCheckListItem)
108 QListViewItem::paintFocus(p,cg,r); 123 QListViewItem::paintFocus(p,cg,r);
109} 124}
110 125
111QPixmap PackageListItem::statePixmap() const 126QPixmap PackageListItem::statePixmap() const
112{ 127{
113 bool installed = package->installed(); 128 bool installed = package->installed();
114 bool old = package->isOld(); 129 bool old = package->isOld();
115 bool verinstalled = package->otherInstalled(); 130 bool verinstalled = package->otherInstalled();
116 if ( !package->toProcess() ) { 131 if ( !package->toProcess() ) {
117 if ( !installed ) 132 if ( !installed )
118 if (old) 133 if (old)
119 { 134 {
120 if (verinstalled) return *pm_uninstalled_old_installed_new; 135 if (verinstalled) return *pm_uninstalled_old_installed_new;
121 else return *pm_uninstalled_old; 136 else return *pm_uninstalled_old;
122 } 137 }
123 else 138 else
124 { 139 {
125 if (verinstalled) return *pm_uninstalled_installed_old; 140 if (verinstalled) return *pm_uninstalled_installed_old;
126 else return *pm_uninstalled; 141 else return *pm_uninstalled;
127 } 142 }
128 else 143 else
129 if (old) return *pm_installed_old; 144 if (old) return *pm_installed_old;
130 else return *pm_installed; 145 else return *pm_installed;
131 } else { //toProcess() == true 146 } else { //toProcess() == true
132 if ( !installed ) 147 if ( !installed )
133 return *pm_install; 148 return *pm_install;
134 else 149 else
135 return *pm_uninstall; 150 return *pm_uninstall;
136 } 151 }
137} 152}
138 153
139QString PackageListItem::key( int column, bool ascending ) const 154QString PackageListItem::key( int column, bool ascending ) const
140{ 155{
141 if ( column == 2 ) { 156 if ( column == 2 ) {
142 QString t = text(2); 157 QString t = text(2);
143 double bytes=t.toDouble(); 158 double bytes=t.toDouble();
144 if ( t.contains('M') ) bytes*=1024*1024; 159 if ( t.contains('M') ) bytes*=1024*1024;
145 else if ( t.contains('K') || t.contains('k') ) bytes*=1024; 160 else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
146 if ( !ascending ) bytes=999999999-bytes; 161 if ( !ascending ) bytes=999999999-bytes;
147 return QString().sprintf("%09d",(int)bytes); 162 return QString().sprintf("%09d",(int)bytes);
148 } else { 163 } else {
149 return QListViewItem::key(column,ascending); 164 return QListViewItem::key(column,ascending);
150 } 165 }
151} 166}
152 167
153void PackageListItem::setOn( bool b ) 168void PackageListItem::setOn( bool b )
154{ 169{
155 QCheckListItem::setOn( b ); 170 QCheckListItem::setOn( b );
156 package->toggleProcess(); 171 package->toggleProcess();
157 package->setLink( settings->createLinks() ); 172 package->setLink( settings->createLinks() );
158 displayDetails(); 173 displayDetails();
159} 174}
160 175
161void PackageListItem::displayDetails() 176void PackageListItem::displayDetails()
162{ 177{
163 QString sod; 178 QString sod;
164 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); 179 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
165 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); 180 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
166 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); 181 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
167 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); 182 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
168 setText(0, package->name()+sod ); 183 setText(0, package->name()+sod );
169 nameItem->setText( 0, QObject::tr("Name: ")+package->name()); 184 nameItem->setText( 0, QObject::tr("Name: ")+package->name());
170 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); 185 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No")));
171 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); 186 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
172 statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); 187 statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
173 repaint(); 188 repaint();
174} 189}
190
191QPopupMenu* PackageListItem::getPopupMenu()
192{
193 popupMenu->clear();
194 destsMenu->clear();
195
196 QAction *popupAction;
197 qDebug("PackageListItem::showPopup ");
198
199 if (!package->installed()){
200 popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
201 QStringList dests = settings->getDestinationNames();
202 QString ad = settings->getDestinationName();
203 for (uint i = 0; i < dests.count(); i++ )
204 {
205 popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 );
206 popupAction->addTo( destsMenu );
207 if ( dests[i] == ad && getPackage()->toInstall() )
208 {
209 popupAction->setToggleAction( true );
210 popupAction->setOn(true);
211 }
212 }
213 connect( destsMenu, SIGNAL( activated( int ) ),
214 this, SLOT( menuAction( int ) ) );
215 popupMenu->popup( QCursor::pos() );
216 }else{
217 popupMenu->insertItem( QObject::tr("Remove"));
218 connect( popupMenu, SIGNAL( activated( int ) ),
219 this, SLOT( menuAction( int ) ) );
220 popupMenu->popup( QCursor::pos() );
221 }
222 return popupMenu;
223}
224
225void PackageListItem::menuAction( int i )
226{
227 if (package->installed()){
228 package->setDest( destsMenu->text(i) );
229 package->setLink( settings->createLinks() );
230 }
231 package->setOn();
232 displayDetails();
233}
234
235//void PackageListItem::toggleProcess()
236//{
237// package->toggleProcess() ;
238// displayDetails();
239//} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h
index dba44f7..ca0cf17 100644
--- a/noncore/unsupported/oipkg/packagelistitem.h
+++ b/noncore/unsupported/oipkg/packagelistitem.h
@@ -1,50 +1,64 @@
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#ifndef PK_LISTITEM_H 10#ifndef PK_LISTITEM_H
11#define PK_LISTITEM_H 11#define PK_LISTITEM_H
12 12
13#include "package.h"
14 13
15#include <qstring.h> 14#include <qstring.h>
16#include <qlistview.h> 15//#include <qlistview.h>
17#include <qpainter.h> 16#include <qpainter.h>
18#include <qpixmap.h> 17#include <qpixmap.h>
19#include <qdict.h> 18#include <qdict.h>
20 19
20#include "listviewitemoipkg.h"
21#include "package.h"
21#include "pksettings.h" 22#include "pksettings.h"
22 23
23class PackageListItem 24class QPopupMenu;
24: public QCheckListItem 25
26class PackageListItem : public ListViewItemOipkg
25{ 27{
26public: 28public:
27 PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); 29 PackageListItem(ListViewItemOipkg *parent, QString name, Type ittype);
28 PackageListItem(QListView*, Package*, PackageManagerSettings*); 30 PackageListItem(
31 ListViewItemOipkg *parent,
32 OipkgPackage *pack,
33 PackageManagerSettings *s);
34 PackageListItem(QListView*, OipkgPackage*, PackageManagerSettings*);
35 ~PackageListItem();
29 void paintCell( QPainter*, const QColorGroup&, int, int, int ); 36 void paintCell( QPainter*, const QColorGroup&, int, int, int );
30 void paintFocus( QPainter*, const QColorGroup&, const QRect& ); 37 void paintFocus( QPainter*, const QColorGroup&, const QRect& );
31 QPixmap statePixmap() const; 38 QPixmap statePixmap() const;
32 QString key( int, bool ) const; 39 QString key( int, bool ) const;
33 Package* getPackage() { return package; } ; 40 OipkgPackage* getPackage() { return package; } ;
34 QString getName() { return package->name(); } ; 41 QString getName() { return package->name(); } ;
35 bool isInstalled(){ return package->installed(); }; 42 bool isInstalled(){ return package->installed(); };
36 virtual void setOn ( bool ); 43 virtual void setOn ( bool );
37 void displayDetails(); 44 void displayDetails();
38 45
39private: 46private:
40 void init(Package*, PackageManagerSettings*); 47 QPopupMenu *popupMenu;
48 QPopupMenu *destsMenu;
49 void init(OipkgPackage*, PackageManagerSettings*);
50 virtual QPopupMenu* getPopupMenu();
51 static QPopupMenu *_destsMenu;
41 QCheckListItem *nameItem; 52 QCheckListItem *nameItem;
42 QCheckListItem *destItem; 53 QCheckListItem *destItem;
43 QCheckListItem *linkItem; 54 QCheckListItem *linkItem;
44 QCheckListItem *statusItem; 55 QCheckListItem *statusItem;
45 PackageManagerSettings *settings; 56 PackageManagerSettings *settings;
46 Package *package; 57 OipkgPackage *package;
58protected slots:
59 // void toggleProcess();
60 virtual void menuAction( int );
47}; 61};
48 62
49 63
50#endif 64#endif
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp
index b8a19253..2fe75bc 100644
--- a/noncore/unsupported/oipkg/packagelistlocal.cpp
+++ b/noncore/unsupported/oipkg/packagelistlocal.cpp
@@ -1,75 +1,75 @@
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 <qpe/config.h> 10#include <qpe/config.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qtextstream.h> 13#include <qtextstream.h>
14#include <qstringlist.h> 14#include <qstringlist.h>
15#include "packagelistlocal.h" 15#include "packagelistlocal.h"
16 16
17PackageListLocal::PackageListLocal() 17PackageListLocal::PackageListLocal()
18 : PackageList() 18 : PackageList()
19{ 19{
20 Config cfg( "oipkg", Config::User ); 20 Config cfg( "oipkg", Config::User );
21 cfg.setGroup( "Common" ); 21 cfg.setGroup( "Common" );
22 statusDir = cfg.readEntry( "statusDir", "" ); 22 statusDir = cfg.readEntry( "statusDir", "" );
23 listsDir = cfg.readEntry( "listsDir", "" ); 23 listsDir = cfg.readEntry( "listsDir", "" );
24 if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) 24 if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
25 { 25 {
26 statusDir="/usr/lib/ipkg/"; 26 statusDir="/usr/lib/ipkg/";
27 listsDir="/usr/lib/ipkg/lists/"; 27 listsDir="/usr/lib/ipkg/lists/";
28 cfg.writeEntry( "statusDir", statusDir ); 28 cfg.writeEntry( "statusDir", statusDir );
29 cfg.writeEntry( "listsDir", listsDir ); 29 cfg.writeEntry( "listsDir", listsDir );
30 } 30 }
31} 31}
32 32
33PackageListLocal::PackageListLocal(PackageManagerSettings* s) 33PackageListLocal::PackageListLocal(PackageManagerSettings* s)
34 : PackageList(s) 34 : PackageList(s)
35{ 35{
36 PackageListLocal(); 36 PackageListLocal();
37} 37}
38 38
39PackageListLocal::~PackageListLocal() 39PackageListLocal::~PackageListLocal()
40{ 40{
41} 41}
42 42
43void PackageListLocal::parseStatus() 43void PackageListLocal::parseStatus()
44{ 44{
45 QStringList dests = settings->getDestinationUrls(); 45 QStringList dests = settings->getDestinationUrls();
46 QStringList destnames = settings->getDestinationNames(); 46 QStringList destnames = settings->getDestinationNames();
47 QStringList::Iterator name = destnames.begin(); 47 QStringList::Iterator name = destnames.begin();
48 for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) 48 for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
49 { 49 {
50 pvDebug( 2,"Status: "+*dir+statusDir+"/status"); 50 pvDebug( 2,"Status: "+*dir+statusDir+"/status");
51 readFileEntries( *dir+statusDir+"/status", *name ); 51 readFileEntries( *dir+statusDir+"/status", *name );
52 ++name; 52 ++name;
53 }; 53 };
54} 54}
55 55
56void PackageListLocal::parseList() 56void PackageListLocal::parseList()
57{ 57{
58 QStringList srvs = settings->getActiveServers(); 58 QStringList srvs = settings->getActiveServers();
59 59
60 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) 60 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
61 { 61 {
62 pvDebug( 2, "List: "+listsDir+"/"+*it); 62 pvDebug( 2, "List: "+listsDir+"/"+*it);
63 readFileEntries( listsDir+"/"+*it ); 63 readFileEntries( listsDir+"/"+*it );
64 } 64 }
65} 65}
66 66
67 67
68void PackageListLocal::update() 68void PackageListLocal::update()
69{ 69{
70 pvDebug( 2, "parseStatus"); 70 pvDebug( 2, "parseStatus");
71 parseStatus(); 71 parseStatus();
72 pvDebug( 2, "parseList"); 72 pvDebug( 2, "parseList "+listsDir);
73 parseList(); 73 parseList();
74 pvDebug( 2, "finished parsing"); 74 pvDebug( 2, "finished parsing");
75} 75}
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 0d6fa80..3c7435d 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -1,153 +1,118 @@
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 "packagelistview.h" 10#include "packagelistview.h"
11 11
12#include <qpopupmenu.h> 12#include <qpopupmenu.h>
13#include <qaction.h> 13#include <qaction.h>
14 14
15#include "listviewitemoipkg.h"
15#include "packagelistitem.h" 16#include "packagelistitem.h"
16#include "pksettings.h" 17#include "pksettings.h"
17 18
18PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) 19PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s)
19 : QListView(p,n) 20 : QListView(p,n)
20{ 21{
21 settings = s; 22 settings = s;
22 popupMenu = new QPopupMenu( this );
23 destsMenu = new QPopupMenu( popupMenu );
24 popupTimer = new QTimer( this ); 23 popupTimer = new QTimer( this );
25 setSelectionMode(QListView::NoSelection); 24 setSelectionMode(QListView::NoSelection);
26 addColumn( tr("Package") ); 25 addColumn( tr("Package") );
27 setRootIsDecorated( true ); 26 setRootIsDecorated( true );
28 27
29 connect( popupTimer, SIGNAL(timeout()), 28 connect( popupTimer, SIGNAL(timeout()),
30 this, SLOT(showPopup()) ); 29 this, SLOT(showPopup()) );
31 connect( this, SIGNAL( pressed( QListViewItem* ) ), 30 connect( this, SIGNAL( pressed( QListViewItem* ) ),
32 this, SLOT( setCurrent( QListViewItem* ) ) ); 31 this, SLOT( setCurrent( QListViewItem* ) ) );
33 connect( this, SIGNAL( clicked( QListViewItem* ) ), 32 connect( this, SIGNAL( clicked( QListViewItem* ) ),
34 this, SLOT( stopTimer( QListViewItem* ) ) ); 33 this, SLOT( stopTimer( QListViewItem* ) ) );
35 34
36} 35}
37 36
38//PackageListView::~PackageListView() 37//PackageListView::~PackageListView()
39//{ 38//{
40//} 39//}
41 40
42void PackageListView::setCurrent( QListViewItem* p ) 41void PackageListView::setCurrent( QListViewItem* p )
43{ 42{
44 if ( !p ) return; 43 qDebug("PackageListView::setCurrent ");
45 activePackageListItem = (PackageListItem*)p; 44 activeItem = (ListViewItemOipkg*)p;
46 activePackage = activePackageListItem->getPackage(); 45
47 if (!activePackage) 46 if ( activeItem != 0 ) popupTimer->start( 750, true );
48 { 47
49 // QDictIterator<QCheckListItem> it( rootItems ); 48// if ( activeItem->getType() != ListViewItemOipkg::Package ){
50 // while ( it.current() ) 49// qDebug("PackageListView::setCurrent !p ");
50// activePackage = 0;
51 // activePackageListItem = 0;
52// qDebug("PackageListView::setCurrent returning ");
53// return;
54// };
55// activePackageListItem = (PackageListItem*)p;
56// activePackage = activePackageListItem->getPackage();
57// if (activePackage == 0 )
51// { 58// {
52 // if ( it.current()==p ) 59// qDebug("PackageListView::setCurrent if (!activePackage)");
53 // pvDebug(2,"current item"); 60// return;
54 // ++it; 61// }
55 // } 62
56 63
57 return; 64 qDebug("PackageListView::setCurrent popupTimer->start");
58 }
59 popupTimer->start( 750, true );
60} 65}
61 66
62 67
63void PackageListView::showPopup() 68void PackageListView::showPopup()
64{ 69{
65 popupMenu->clear(); 70 qDebug("PackageListView::showPopup");
66 destsMenu->clear(); 71 QPopupMenu *popup = activeItem->getPopupMenu();
67 72 if (popup == 0) return;
68 QAction *popupAction; 73 popup->popup( QCursor::pos() );
69 if ( !activePackage->installed() ) 74 qDebug("PackageListView::showPopup");
70 {
71 popupMenu->insertItem( tr("Install to"), destsMenu );
72 QStringList dests = settings->getDestinationNames();
73 QString ad = settings->getDestinationName();
74 for (uint i = 0; i < dests.count(); i++ )
75 {
76 popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
77 popupAction->addTo( destsMenu );
78 if ( dests[i] == ad && activePackage->toInstall() )
79 {
80 popupAction->setToggleAction( true );
81 popupAction->setOn(true);
82 };
83 }
84 connect( destsMenu, SIGNAL( activated( int ) ),
85 this, SLOT( changePackageDest( int ) ) );
86 }else{
87 popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 );
88 popupAction->addTo( popupMenu );
89 connect( popupAction, SIGNAL( activated() ),
90 this , SLOT( toggleProcess() ) );
91 popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 );
92 popupAction->addTo( popupMenu );
93 popupAction->setEnabled( false );
94 }
95 popupMenu->popup( QCursor::pos() );
96} 75}
97 76
98void PackageListView::stopTimer( QListViewItem* ) 77void PackageListView::stopTimer( QListViewItem* )
99{ 78{
100 popupTimer->stop(); 79 popupTimer->stop();
101} 80}
102 81
103 82
104void PackageListView::changePackageDest( int i )
105{
106 activePackage->setDest( destsMenu->text(i) );
107 activePackage->setOn();
108 activePackage->setLink( settings->createLinks() );
109 activePackageListItem->displayDetails();
110}
111
112void PackageListView::toggleProcess()
113{
114 activePackage->toggleProcess() ;
115 activePackageListItem->displayDetails();
116}
117
118void PackageListView::display() 83void PackageListView::display()
119{ 84{
120 QDictIterator<PackageList> list( PackageLists ); 85 QDictIterator<PackageList> list( PackageLists );
121 PackageList *packlist; 86 PackageList *packlist;
122 Package *pack; 87 OipkgPackage *pack;
123 PackageListItem *item; 88 PackageListItem *item;
124 QCheckListItem *rootItem; 89 ListViewItemOipkg *rootItem;
125 QListViewItem* it; 90 QListViewItem* it;
126 QListViewItem* itdel; 91 QListViewItem* itdel;
127 while ( list.current() ) { 92 while ( list.current() ) {
128 packlist = list.current(); 93 packlist = list.current();
129 rootItem = rootItems.find( list.currentKey() ); 94 rootItem = rootItems.find( list.currentKey() );
130 //rootItem->clear(); 95 //rootItem->clear();
131 it=rootItem->firstChild(); 96 it=rootItem->firstChild();
132 while ( it ) 97 while ( it )
133 { 98 {
134 itdel = it; 99 itdel = it;
135 it = it->nextSibling(); 100 it = it->nextSibling();
136 delete itdel; 101 delete itdel;
137 } 102 }
138 pack = packlist->first(); 103 pack = packlist->first();
139 while( pack ) 104 while( pack )
140 { 105 {
141 item = new PackageListItem( rootItem, pack, settings ); 106 item = new PackageListItem( rootItem, pack, settings );
142 pack = packlist->next(); 107 pack = packlist->next();
143 } 108 }
144 ++list; 109 ++list;
145 } 110 }
146} 111}
147 112
148void PackageListView::addList( QString n, PackageList* pl) 113void PackageListView::addList( QString n, PackageList* pl)
149{ 114{
150 PackageLists.insert(n, pl); 115 PackageLists.insert(n, pl);
151 QCheckListItem *item = new QCheckListItem(this,n); 116 ListViewItemOipkg *item = new ListViewItemOipkg(this,n,ListViewItemOipkg::Feed);
152 rootItems.insert(n, item); 117 rootItems.insert(n, item);
153} 118}
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h
index 3c09ba8..17dcb95 100644
--- a/noncore/unsupported/oipkg/packagelistview.h
+++ b/noncore/unsupported/oipkg/packagelistview.h
@@ -1,54 +1,55 @@
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#ifndef PACKAGELISTVIEW_H 11#ifndef PACKAGELISTVIEW_H
12#define PACKAGELISTVIEW_H 12#define PACKAGELISTVIEW_H
13 13
14#include <qlistview.h> 14#include <qlistview.h>
15#include <qaction.h> 15#include <qaction.h>
16#include <qdict.h> 16#include <qdict.h>
17#include <qstring.h> 17#include <qstring.h>
18#include <qtimer.h> 18#include <qtimer.h>
19#include <qwidget.h> 19#include <qwidget.h>
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include "listviewitemoipkg.h"
21#include "packagelist.h" 22#include "packagelist.h"
22#include "debug.h" 23#include "debug.h"
23 24
24class PackageListItem; 25class PackageListItem;
25class Package; 26class OipkgPackage;
26class PackageManagerSettings; 27class PackageManagerSettings;
28//class ListViewItemOipkg;
27 29
28class PackageListView : public QListView 30class PackageListView : public QListView
29{ 31{
30 Q_OBJECT 32 Q_OBJECT
31 33
32public: 34public:
33 PackageListView(QWidget*, const char*, PackageManagerSettings*); 35 PackageListView(QWidget*, const char*, PackageManagerSettings*);
34 void addList( QString, PackageList* ); 36 void addList( QString, PackageList* );
35 //~PackageListView(); 37 //~PackageListView();
36 QTimer *popupTimer; 38 QTimer *popupTimer;
37private: 39private:
38 QDict<PackageList> PackageLists; 40 QDict<PackageList> PackageLists;
39 QDict<QCheckListItem> rootItems; 41 QDict<ListViewItemOipkg> rootItems;
40 PackageManagerSettings *settings; 42 PackageManagerSettings *settings;
41 Package *activePackage; 43// OipkgPackage *activePackage;
42 PackageListItem *activePackageListItem; 44// PackageListItem *activePackageListItem;
45 ListViewItemOipkg *activeItem;
43 QPopupMenu *popupMenu; 46 QPopupMenu *popupMenu;
44 QPopupMenu *destsMenu; 47 QPopupMenu *destsMenu;
45public slots: 48public slots:
46 void showPopup(); 49 void showPopup();
47 void changePackageDest( int );
48 void setCurrent( QListViewItem* ); 50 void setCurrent( QListViewItem* );
49 void stopTimer( QListViewItem* ); 51 void stopTimer( QListViewItem* );
50 void toggleProcess();
51 void display(); 52 void display();
52}; 53};
53 54
54#endif 55#endif
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 2ed313c..cfaadbf 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -21,424 +21,424 @@
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()) 78 if (installDialog->_force_overwrite->isChecked())
79 cmd += " -force-overwrite "; 79 cmd += " -force-overwrite ";
80 } 80 }
81 } //!args.contains("update") 81 } //!args.contains("update")
82 82
83 out( "Starting to "+ args+"\n"); 83 out( "Starting to "+ args+"\n");
84 qApp->processEvents(); 84 qApp->processEvents();
85 cmd += args; 85 cmd += args;
86 out( "running:\n"+cmd+"\n" ); 86 out( "running:\n"+cmd+"\n" );
87 pvDebug(2,"running:"+cmd); 87 pvDebug(2,"running:"+cmd);
88 qApp->processEvents(); 88 qApp->processEvents();
89 FILE *fp; 89 FILE *fp;
90 char line[130]; 90 char line[130];
91 QString lineStr, lineStrOld; 91 QString lineStr, lineStrOld;
92 sleep(1); 92 sleep(1);
93 cmd +=" 2>&1"; 93 cmd +=" 2>&1";
94 fp = popen( (const char *) cmd, "r"); 94 fp = popen( (const char *) cmd, "r");
95 if ( fp == NULL ) { 95 if ( fp == NULL ) {
96 qDebug("Could not execute '" + cmd + "'! err=%d", fp); 96 qDebug("Could not execute '" + cmd + "'! err=%d", fp);
97 out("\nError while executing "+ cmd+"\n\n"); 97 out("\nError while executing "+ cmd+"\n\n");
98 ret = false; 98 ret = false;
99 } else { 99 } else {
100 while ( fgets( line, sizeof line, fp) != NULL) 100 while ( fgets( line, sizeof line, fp) != NULL)
101 { 101 {
102 lineStr = line; 102 lineStr = line;
103 lineStr=lineStr.left(lineStr.length()-1); 103 lineStr=lineStr.left(lineStr.length()-1);
104 //Configuring opie-oipkg...Done 104 //Configuring opie-oipkg...Done
105 if (lineStr.contains("Done")) ret = true; 105 if (lineStr.contains("Done")) ret = true;
106 if (lineStr!=lineStrOld) 106 if (lineStr!=lineStrOld)
107 out(lineStr); 107 out(lineStr);
108 lineStrOld = lineStr; 108 lineStrOld = lineStr;
109 qApp->processEvents(); 109 qApp->processEvents();
110 } 110 }
111 } 111 }
112 pclose(fp); 112 pclose(fp);
113 pvDebug(2,QString(ret?"success\n":"failure\n")); 113 pvDebug(2,QString(ret?"success\n":"failure\n"));
114 return ret; 114 return ret;
115} 115}
116 116
117void PmIpkg::makeLinks(Package *pack) 117void PmIpkg::makeLinks(OipkgPackage *pack)
118{ 118{
119 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 119 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
120 QString pn = pack->name(); 120 QString pn = pack->name();
121 linkPackage( pack->packageName(), pack->dest() ); 121 linkPackage( pack->packageName(), pack->dest() );
122} 122}
123 123
124QStringList* PmIpkg::getList( QString packFileName, QString d ) 124QStringList* PmIpkg::getList( QString packFileName, QString d )
125{ 125{
126 QString dest = settings->getDestinationUrlByName( d ); 126 QString dest = settings->getDestinationUrlByName( d );
127 dest = dest==""?d:dest; 127 dest = dest==""?d:dest;
128 // if (dest == "/" ) return 0; 128 // if (dest == "/" ) return 0;
129 { 129 {
130 Config cfg( "oipkg", Config::User ); 130 Config cfg( "oipkg", Config::User );
131 cfg.setGroup( "Common" ); 131 cfg.setGroup( "Common" );
132 QString statusDir = cfg.readEntry( "statusDir", "" ); 132 QString statusDir = cfg.readEntry( "statusDir", "" );
133 } 133 }
134 QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; 134 QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list";
135 QFile f( packFileDir ); 135 QFile f( packFileDir );
136 qDebug("Try to open %s", packFileDir.latin1()); 136 qDebug("Try to open %s", packFileDir.latin1());
137 if ( ! f.open(IO_ReadOnly) ) 137 if ( ! f.open(IO_ReadOnly) )
138 { 138 {
139 out( "Could not open:\n"+packFileDir ); 139 out( "Could not open:\n"+packFileDir );
140 f.close(); 140 f.close();
141 packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; 141 packFileDir = "/"+statusDir+"/info/"+packFileName+".list";
142 f.setName( packFileDir ); 142 f.setName( packFileDir );
143 qDebug("Try to open %s", packFileDir.latin1()); 143 qDebug("Try to open %s", packFileDir.latin1());
144 if ( ! f.open(IO_ReadOnly) ) 144 if ( ! f.open(IO_ReadOnly) )
145 { 145 {
146 qDebug(" Panik! Could not open"+packFileDir); 146 qDebug(" Panik! Could not open"+packFileDir);
147 out( "Could not open:\n"+packFileDir+"\n Panik!" ); 147 out( "Could not open:\n"+packFileDir+"\n Panik!" );
148 return (QStringList*)0; 148 return (QStringList*)0;
149 } 149 }
150 } 150 }
151 QStringList *fileList = new QStringList(); 151 QStringList *fileList = new QStringList();
152 QTextStream t( &f ); 152 QTextStream t( &f );
153 while ( !t.eof() ) 153 while ( !t.eof() )
154 { 154 {
155 *fileList += t.readLine(); 155 *fileList += t.readLine();
156 } 156 }
157 f.close(); 157 f.close();
158 return fileList; 158 return fileList;
159} 159}
160 160
161void PmIpkg::linkPackage( QString packFileName, QString dest ) 161void PmIpkg::linkPackage( QString packFileName, QString dest )
162{ 162{
163 if (dest == "root" || dest == "/" ) return; 163 if (dest == "root" || dest == "/" ) return;
164 QStringList *fileList = getList( packFileName, dest ); 164 QStringList *fileList = getList( packFileName, dest );
165 processFileList( fileList, dest ); 165 processFileList( fileList, dest );
166 delete fileList; 166 delete fileList;
167} 167}
168 168
169void PmIpkg::processFileList( QStringList *fileList, QString d ) 169void PmIpkg::processFileList( QStringList *fileList, QString d )
170{ 170{
171 if (!fileList || fileList->isEmpty()) return; 171 if (!fileList || fileList->isEmpty()) return;
172 for (uint i=0; i < fileList->count(); i++) 172 for (uint i=0; i < fileList->count(); i++)
173 { 173 {
174 QString dest = settings->getDestinationUrlByName( d ); 174 QString dest = settings->getDestinationUrlByName( d );
175 dest = dest==""?d:dest; 175 dest = dest==""?d:dest;
176 processLinkDir( (*fileList)[i], dest ); 176 processLinkDir( (*fileList)[i], dest );
177 } 177 }
178} 178}
179 179
180 180
181void PmIpkg::processLinkDir( QString file, QString dest ) 181void PmIpkg::processLinkDir( QString file, QString dest )
182{ 182{
183 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); 183 pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest);
184 if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); 184 if (linkOpp==createLink) pvDebug( 4,"opp: createLink");
185 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); 185 if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink");
186 if ( dest == "???" || dest == "" ) return; 186 if ( dest == "???" || dest == "" ) return;
187 QString destFile = file; 187 QString destFile = file;
188 file = dest+"/"+file; 188 file = dest+"/"+file;
189 if (file == dest) return; 189 if (file == dest) return;
190// if (linkOpp==createLink) out( "\ncreating links\n" ); 190// if (linkOpp==createLink) out( "\ncreating links\n" );
191 // if (linkOpp==removeLink) out( "\nremoving links\n" ); 191 // if (linkOpp==removeLink) out( "\nremoving links\n" );
192 QFileInfo fileInfo( file ); 192 QFileInfo fileInfo( file );
193 if ( fileInfo.isDir() ) 193 if ( fileInfo.isDir() )
194 { 194 {
195 pvDebug(4, "process dir "+file); 195 pvDebug(4, "process dir "+file);
196 QDir destDir( destFile ); 196 QDir destDir( destFile );
197 if (linkOpp==createLink) destDir.mkdir( destFile, true ); 197 if (linkOpp==createLink) destDir.mkdir( destFile, true );
198 QDir d( file ); 198 QDir d( file );
199// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 199// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
200 const QFileInfoList *list = d.entryInfoList(); 200 const QFileInfoList *list = d.entryInfoList();
201 QFileInfoListIterator it( *list ); 201 QFileInfoListIterator it( *list );
202 QFileInfo *fi; 202 QFileInfo *fi;
203 while ( (fi=it.current()) ) 203 while ( (fi=it.current()) )
204 { 204 {
205 pvDebug(4, "processLinkDir "+fi->absFilePath()); 205 pvDebug(4, "processLinkDir "+fi->absFilePath());
206 processLinkDir( fi->absFilePath(), dest ); 206 processLinkDir( fi->absFilePath(), dest );
207 ++it; 207 ++it;
208 } 208 }
209 } else 209 } else
210 if ( fileInfo.isFile() ) 210 if ( fileInfo.isFile() )
211 { 211 {
212 const char *instFile = strdup( (file).latin1() ); 212 const char *instFile = strdup( (file).latin1() );
213 const char *linkFile = strdup( (destFile).latin1()); 213 const char *linkFile = strdup( (destFile).latin1());
214 if( linkOpp==createLink ) 214 if( linkOpp==createLink )
215 { 215 {
216 pvDebug(4, "linking: "+file+" -> "+destFile ); 216 pvDebug(4, "linking: "+file+" -> "+destFile );
217 symlink( instFile, linkFile ); 217 symlink( instFile, linkFile );
218 } 218 }
219 } else { 219 } else {
220 const char *linkFile = strdup( (destFile).latin1()); 220 const char *linkFile = strdup( (destFile).latin1());
221 if( linkOpp==removeLink ) 221 if( linkOpp==removeLink )
222 { 222 {
223 QFileInfo toRemoveLink( destFile ); 223 QFileInfo toRemoveLink( destFile );
224 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) 224 if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
225 { 225 {
226 pvDebug(4,"removing "+destFile+" no "+file); 226 pvDebug(4,"removing "+destFile+" no "+file);
227 unlink( linkFile ); 227 unlink( linkFile );
228 } 228 }
229 } 229 }
230 } 230 }
231} 231}
232 232
233void PmIpkg::loadList( PackageList *pl ) 233void PmIpkg::loadList( PackageList *pl )
234 { 234 {
235 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 235 for( OipkgPackage *pack = pl->first();pack ; (pack = pl->next()) )
236 { 236 {
237 if ( pack && (pack->name() != "") && pack) 237 if ( pack && (pack->name() != "") && pack)
238 { 238 {
239 if ( pack->toInstall() ) 239 if ( pack->toInstall() )
240 to_install.append( pack ); 240 to_install.append( pack );
241 if ( pack->toRemove() ) 241 if ( pack->toRemove() )
242 to_remove.append( pack ); 242 to_remove.append( pack );
243 } 243 }
244 } 244 }
245} 245}
246 246
247void PmIpkg::commit() 247void PmIpkg::commit()
248 { 248 {
249 int sizecount = 0; 249 int sizecount = 0;
250 installDialog = new InstallDialog(settings,0,0,true); 250 installDialog = new InstallDialog(settings,0,0,true);
251 installDialog->toRemoveItem->setOpen( true ); 251 installDialog->toRemoveItem->setOpen( true );
252 installDialog->toInstallItem->setOpen( true ); 252 installDialog->toInstallItem->setOpen( true );
253 for (uint i=0; i < to_remove.count(); i++) 253 for (uint i=0; i < to_remove.count(); i++)
254 { 254 {
255 sizecount += 1; 255 sizecount += 1;
256 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); 256 installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) );
257 } 257 }
258 for (uint i=0; i < to_install.count(); i++) 258 for (uint i=0; i < to_install.count(); i++)
259 { 259 {
260 sizecount += to_install.at(i)->size().toInt(); 260 sizecount += to_install.at(i)->size().toInt();
261 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); 261 installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) );
262 } 262 }
263 runwindow->progress->setTotalSteps(sizecount); 263 runwindow->progress->setTotalSteps(sizecount);
264 qDebug("Install size %i",sizecount); 264 qDebug("Install size %i",sizecount);
265 installDialog->showMaximized(); 265 installDialog->showMaximized();
266 installDialog->show(); 266 installDialog->show();
267 if ( installDialog->exec() ) 267 if ( installDialog->exec() )
268 { 268 {
269 doIt(); 269 doIt();
270 runwindow->showMaximized(); 270 runwindow->showMaximized();
271 runwindow->show(); 271 runwindow->show();
272 } 272 }
273 installDialog->close(); 273 installDialog->close();
274 delete installDialog; 274 delete installDialog;
275 installDialog = 0; 275 installDialog = 0;
276 out(tr("\nAll done.")); 276 out(tr("\nAll done."));
277} 277}
278 278
279void PmIpkg::doIt() 279void PmIpkg::doIt()
280{ 280{
281 runwindow->progress->setProgress(0); 281 runwindow->progress->setProgress(0);
282 show(); 282 show();
283 remove(); 283 remove();
284 install(); 284 install();
285} 285}
286 286
287 287
288void PmIpkg::remove() 288void PmIpkg::remove()
289{ 289{
290 if ( to_remove.count() == 0 ) return; 290 if ( to_remove.count() == 0 ) return;
291 291
292 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 292 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
293 293
294 QStringList *fileList; 294 QStringList *fileList = new QStringList;
295 for (uint i=0; i < to_remove.count(); i++) 295 for (uint i=0; i < to_remove.count(); i++)
296 { 296 {
297 if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 297 if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
298 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) 298 if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() ))
299 { 299 {
300 runwindow->progress->setProgress( 1 ); 300 runwindow->progress->setProgress( 1 );
301 linkOpp = removeLink; 301 linkOpp = removeLink;
302 to_remove.at(i)->processed(); 302 to_remove.at(i)->processed();
303 pvDebug(3,"link "+QString::number(i)); 303 pvDebug(3,"link "+QString::number(i));
304 if ( to_remove.at(i)->link() ) 304 if ( to_remove.at(i)->link() )
305 processFileList( fileList, to_remove.at(i)->dest() ); 305 processFileList( fileList, to_remove.at(i)->dest() );
306 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); 306 //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count()));
307 //if ( to_remove.at(i) ) to_remove.take( i ); 307 //if ( to_remove.at(i) ) to_remove.take( i );
308 308
309 out("\n"); 309 out("\n");
310 }else{ 310 }else{
311 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); 311 out(tr("Error while removing ")+to_remove.at(i)->name()+"\n");
312 if ( to_remove.at(i)->link() ) 312 if ( to_remove.at(i)->link() )
313 processFileList( fileList, to_remove.at(i)->dest() ); 313 processFileList( fileList, to_remove.at(i)->dest() );
314 } 314 }
315 if ( to_remove.at(i)->link() ) 315 if ( to_remove.at(i)->link() )
316 processFileList( fileList, to_remove.at(i)->dest() ); 316 processFileList( fileList, to_remove.at(i)->dest() );
317 if ( to_remove.at(i)->link() )delete fileList; 317 if ( to_remove.at(i)->link() )delete fileList;
318 } 318 }
319 to_remove.clear(); 319 to_remove.clear();
320 out("\n"); 320 out("\n");
321} 321}
322 322
323 323
324void PmIpkg::install() 324void PmIpkg::install()
325{ 325{
326 if ( to_install.count() == 0 ) return; 326 if ( to_install.count() == 0 ) return;
327 out(tr("Installing")+"\n"+tr("please wait")+"\n"); 327 out(tr("Installing")+"\n"+tr("please wait")+"\n");
328 for (uint i=0; i < to_install.count(); i++) 328 for (uint i=0; i < to_install.count(); i++)
329 { 329 {
330 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 330 qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug
331 if (to_install.at(i)->link()) 331 if (to_install.at(i)->link())
332 { 332 {
333 // hack to have package.list 333 // hack to have package.list
334 // in "dest"/usr/lib/ipkg/info/ 334 // in "dest"/usr/lib/ipkg/info/
335 QString rds = settings->getDestinationUrlByName("root"); 335 QString rds = settings->getDestinationUrlByName("root");
336 QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); 336 QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest());
337 QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; 337 QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list";
338 rds += listFile; 338 rds += listFile;
339 lds += listFile; 339 lds += listFile;
340 const char *rd = rds.latin1(); 340 const char *rd = rds.latin1();
341 const char *ld = lds.latin1(); 341 const char *ld = lds.latin1();
342 pvDebug(4, "linking: "+rds+" -> "+lds ); 342 pvDebug(4, "linking: "+rds+" -> "+lds );
343 symlink( rd, ld ); 343 symlink( rd, ld );
344 } 344 }
345 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) 345 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ))
346 { 346 {
347 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); 347 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
348 to_install.at(i)->processed(); 348 to_install.at(i)->processed();
349 linkOpp = createLink; 349 linkOpp = createLink;
350 if ( to_install.at(i)->link() ) 350 if ( to_install.at(i)->link() )
351 makeLinks( to_install.at(i) ); 351 makeLinks( to_install.at(i) );
352 // to_install.take( i ); 352 // to_install.take( i );
353 out("\n"); 353 out("\n");
354 }else{ 354 }else{
355 out(tr("Error while installing")+to_install.at(i)->name()+"\n"); 355 out(tr("Error while installing")+to_install.at(i)->name()+"\n");
356 linkOpp = createLink; 356 linkOpp = createLink;
357 if ( to_install.at(i)->link() ) 357 if ( to_install.at(i)->link() )
358 makeLinks( to_install.at(i) ); 358 makeLinks( to_install.at(i) );
359 } 359 }
360 } 360 }
361 out("\n"); 361 out("\n");
362 to_install.clear(); 362 to_install.clear();
363} 363}
364 364
365void PmIpkg::createLinks( const QString &dest ) 365void PmIpkg::createLinks( const QString &dest )
366{ 366{
367 pvDebug(2,"PmIpkg::createLinks "+dest); 367 pvDebug(2,"PmIpkg::createLinks "+dest);
368 linkOpp=createLink; 368 linkOpp=createLink;
369 QString url = settings->getDestinationUrlByName( dest ); 369 QString url = settings->getDestinationUrlByName( dest );
370 url = url==""?dest:url; 370 url = url==""?dest:url;
371 processLinkDir( "/opt", url ); 371 processLinkDir( "/opt", url );
372 processLinkDir( "/usr", url ); 372 processLinkDir( "/usr", url );
373} 373}
374 374
375void PmIpkg::removeLinks( const QString &dest ) 375void PmIpkg::removeLinks( const QString &dest )
376{ 376{
377 pvDebug(2,"PmIpkg::removeLinks "+dest); 377 pvDebug(2,"PmIpkg::removeLinks "+dest);
378 linkOpp=removeLink; 378 linkOpp=removeLink;
379 QString url = settings->getDestinationUrlByName( dest ); 379 QString url = settings->getDestinationUrlByName( dest );
380 url = url==""?dest:url; 380 url = url==""?dest:url;
381 processLinkDir( "/opt", url ); 381 processLinkDir( "/opt", url );
382 processLinkDir( "/usr", url ); 382 processLinkDir( "/usr", url );
383} 383}
384 384
385void PmIpkg::update() 385void PmIpkg::update()
386{ 386{
387 show(); 387 show();
388 runIpkg( "update" ); 388 runIpkg( "update" );
389} 389}
390 390
391void PmIpkg::out( QString o ) 391void PmIpkg::out( QString o )
392{ 392{
393 //runwindow->outPut->append(o); 393 //runwindow->outPut->append(o);
394 runwindow->outPut->setText(runwindow->outPut->text()+o); 394 runwindow->outPut->setText(runwindow->outPut->text()+o);
395 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); 395 runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE);
396} 396}
397 397
398 398
399 399
400 400
401void PmIpkg::show() 401void PmIpkg::show()
402{ 402{
403 if (!runwindow->isVisible()) 403 if (!runwindow->isVisible())
404 { 404 {
405 runwindow->showMaximized(); 405 runwindow->showMaximized();
406 runwindow->show(); 406 runwindow->show();
407 } 407 }
408 runwindow->outPut->setText(""); 408 runwindow->outPut->setText("");
409} 409}
410 410
411void PmIpkg::installFile(const QString &fileName, const QString &dest) 411void PmIpkg::installFile(const QString &fileName, const QString &dest)
412{ 412{
413 413
414 to_install.clear(); 414 to_install.clear();
415 to_remove.clear(); 415 to_remove.clear();
416 pvDebug( 2,"PmIpkg::installFile "+ fileName); 416 pvDebug( 2,"PmIpkg::installFile "+ fileName);
417 Package *p = new Package(fileName,settings); 417 OipkgPackage *p = new OipkgPackage(fileName,settings);
418 if ( dest!="") p->setDest( dest ); 418 if ( dest!="") p->setDest( dest );
419 to_install.append( p ); 419 to_install.append( p );
420 commit(); 420 commit();
421 delete p; 421 delete p;
422} 422}
423 423
424void PmIpkg::removeFile(const QString &fileName, const QString &dest) 424void PmIpkg::removeFile(const QString &fileName, const QString &dest)
425{ 425{
426 426
427 to_install.clear(); 427 to_install.clear();
428 to_remove.clear(); 428 to_remove.clear();
429 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 429 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
430 Package *p = new Package(fileName,settings); 430 OipkgPackage *p = new OipkgPackage(fileName,settings);
431 if ( dest!="") p->setDest( dest ); 431 if ( dest!="") p->setDest( dest );
432 to_remove.append( p ); 432 to_remove.append( p );
433 commit(); 433 commit();
434 delete p; 434 delete p;
435} 435}
436 436
437 437
438void PmIpkg::clearLists() 438void PmIpkg::clearLists()
439{ 439{
440 to_remove.clear(); 440 to_remove.clear();
441 to_install.clear(); 441 to_install.clear();
442} 442}
443 443
444 444
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 2f4d6ae..cb0759a 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -1,69 +1,69 @@
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#ifndef PMIPKG_H 10#ifndef PMIPKG_H
11#define PMIPKG_H 11#define PMIPKG_H
12 12
13#include <qobject.h> 13#include <qobject.h>
14#include <qlist.h> 14#include <qlist.h>
15#include <qstring.h> 15#include <qstring.h>
16#include <qwidget.h> 16#include <qwidget.h>
17#include "pksettings.h" 17#include "pksettings.h"
18#include "runwindow.h" 18#include "runwindow.h"
19#include "packagelist.h" 19#include "packagelist.h"
20#include "installdialog.h" 20#include "installdialog.h"
21#include "debug.h" 21#include "debug.h"
22 22
23#define createLink 0 23#define createLink 0
24#define removeLink 1 24#define removeLink 1
25 25
26class Package; 26class OipkgPackage;
27class PmIpkg : public QObject 27class PmIpkg : public QObject
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 31 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
32 ~PmIpkg(); 32 ~PmIpkg();
33 33
34 int linkOpp; 34 int linkOpp;
35 void loadList( PackageList* ); 35 void loadList( PackageList* );
36 void commit(); 36 void commit();
37 void update(); 37 void update();
38 void show(); 38 void show();
39 void clearLists(); 39 void clearLists();
40 40
41public slots: 41public slots:
42 void doIt(); 42 void doIt();
43 void install(); 43 void install();
44 void remove(); 44 void remove();
45 void installFile(const QString &fileName, const QString &dest=""); 45 void installFile(const QString &fileName, const QString &dest="");
46 void removeFile(const QString &fileName, const QString &dest=""); 46 void removeFile(const QString &fileName, const QString &dest="");
47 void createLinks( const QString &dest ); 47 void createLinks( const QString &dest );
48 void removeLinks( const QString &dest ); 48 void removeLinks( const QString &dest );
49 49
50 50
51private: 51private:
52 QString ipkg_cmd; 52 QString ipkg_cmd;
53 PackageManagerSettings* settings; 53 PackageManagerSettings* settings;
54 RunWindow *runwindow; 54 RunWindow *runwindow;
55 InstallDialog *installDialog; 55 InstallDialog *installDialog;
56 QList<Package> to_remove; 56 QList<OipkgPackage> to_remove;
57 QList<Package> to_install; 57 QList<OipkgPackage> to_install;
58 void makeLinks(Package*); 58 void makeLinks(OipkgPackage*);
59 void linkPackage( QString, QString ); 59 void linkPackage( QString, QString );
60 void processLinkDir( QString , QString ); 60 void processLinkDir( QString , QString );
61 bool runIpkg(const QString& args, const QString& dest="" ); 61 bool runIpkg(const QString& args, const QString& dest="" );
62 void out( QString ); 62 void out( QString );
63 QStringList* getList( QString, QString ); 63 QStringList* getList( QString, QString );
64 void processFileList( QStringList*, QString ); 64 void processFileList( QStringList*, QString );
65 65
66 66
67}; 67};
68 68
69#endif 69#endif