author | tille <tille> | 2002-04-27 13:06:45 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 13:06:45 (UTC) |
commit | db90999f6298c1107888f062f2c25cb8817b528a (patch) (unidiff) | |
tree | 020ebe65beb9286f3c63e4329fc3a0f298d34460 /noncore | |
parent | e2f3288d468508f2cf7c0a327044963ca4b1b54a (diff) | |
download | opie-db90999f6298c1107888f062f2c25cb8817b528a.zip opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.gz opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.bz2 |
added popup menu to choose inst dest (and more...)
-rw-r--r-- | noncore/unsupported/oipkg/TODO | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/debug.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 87 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 9 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/opie-oipkg.control | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 54 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 46 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 44 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.h | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 24 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 104 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 12 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.h | 2 |
17 files changed, 294 insertions, 137 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index c53ca93..744cba4 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,4 +1,2 @@ | |||
1 | * search | ||
2 | * Settings Class | 1 | * Settings Class |
3 | * make oipkg determine dest of "to remove" apps | ||
4 | * tr() ;) | 2 | * tr() ;) |
@@ -7,3 +5,2 @@ | |||
7 | * install local file | 5 | * install local file |
8 | * install to dest with click on packet | ||
9 | * qcop | 6 | * qcop |
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index c53e36c..e73b9b2 100644 --- a/noncore/unsupported/oipkg/debug.h +++ b/noncore/unsupported/oipkg/debug.h | |||
@@ -9,2 +9,3 @@ extern int debugLevel; | |||
9 | 9 | ||
10 | #define NEWLAYOUT | ||
10 | 11 | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index c803ca0..25ca889 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -9,2 +9,3 @@ | |||
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | ||
10 | #include <qaction.h> | 11 | #include <qaction.h> |
@@ -31,2 +32,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
31 | listViewPackages = new QListView( this,0,0 ); | 32 | listViewPackages = new QListView( this,0,0 ); |
33 | listViewPackages->setSelectionMode(QListView::NoSelection); | ||
32 | setCentralWidget( listViewPackages ); | 34 | setCentralWidget( listViewPackages ); |
@@ -34,3 +36,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
34 | makeMenu(); | 36 | makeMenu(); |
35 | 37 | #ifdef NEWLAYOUT | |
38 | listViewPackages->addColumn( tr("Package") ); | ||
39 | listViewPackages->setRootIsDecorated( true ); | ||
40 | #endif | ||
41 | #ifndef NEWLAYOUT | ||
36 | QFontMetrics fm = fontMetrics(); | 42 | QFontMetrics fm = fontMetrics(); |
@@ -40,3 +46,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
40 | int w2 = fm.width("00000")+4; | 46 | int w2 = fm.width("00000")+4; |
41 | int w1 = wlw-w2-w0-20; | 47 | int w1 = wlw-w2-w0-24; |
42 | listViewPackages->addColumn( tr("Package"), w0 ); | 48 | listViewPackages->addColumn( tr("Package"), w0 ); |
@@ -48,3 +54,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
48 | listViewPackages->setSelectionMode( QListView::Multi ); | 54 | listViewPackages->setSelectionMode( QListView::Multi ); |
49 | 55 | #endif | |
50 | connect( section, SIGNAL( activated(int) ), | 56 | connect( section, SIGNAL( activated(int) ), |
@@ -55,2 +61,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
55 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 61 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
62 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), | ||
63 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
64 | |||
65 | popupMenu = new QPopupMenu( this ); | ||
56 | 66 | ||
@@ -77,4 +87,5 @@ void MainWindow::makeMenu() | |||
77 | popupMenu = new QPopupMenu( this ); | 87 | popupMenu = new QPopupMenu( this ); |
78 | 88 | destsMenu = new QPopupMenu( popupMenu ); | |
79 | contextMenu = new QPopupMenu( this ); | 89 | popupTimer = new QTimer( this ); |
90 | connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); | ||
80 | 91 | ||
@@ -182,2 +193,10 @@ void MainWindow::makeMenu() | |||
182 | findAction->addTo( viewMenu ); | 193 | findAction->addTo( viewMenu ); |
194 | |||
195 | #ifdef NEW | ||
196 | Config cfg( "oipkg", Config::User ); | ||
197 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | ||
198 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | ||
199 | findShow(bool b) | ||
200 | sectionShow(bool b) | ||
201 | #endif | ||
183 | } | 202 | } |
@@ -191,3 +210,8 @@ void MainWindow::runIpkg() | |||
191 | ipkg->commit( packageList ); | 210 | ipkg->commit( packageList ); |
192 | // updateList(); //to remove | 211 | // ##### If we looked in the list of files, we could send out accurate |
212 | // ##### messages. But we don't bother yet, and just do an "all". | ||
213 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
214 | QString lf = QString::null; | ||
215 | e << lf; | ||
216 | displayList(); | ||
193 | } | 217 | } |
@@ -226,3 +250,3 @@ void MainWindow::displayList() | |||
226 | if ( pack && (pack->name() != "") ) | 250 | if ( pack && (pack->name() != "") ) |
227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); | 251 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); |
228 | pack = packageList.next(); | 252 | pack = packageList.next(); |
@@ -293,3 +317,2 @@ void MainWindow::showDetails() | |||
293 | { | 317 | { |
294 | if ( activePackage ) return; | ||
295 | if ( details ) | 318 | if ( details ) |
@@ -302,3 +325,7 @@ void MainWindow::showDetails() | |||
302 | } | 325 | } |
303 | 326 | if ( !activePackage ) | |
327 | { | ||
328 | details->description->setText(tr("no package selected")); | ||
329 | details->description->setText(tr("errmm...<br>...not working?")); | ||
330 | }else{ | ||
304 | details->setCaption("Package: " + activePackage->name()); | 331 | details->setCaption("Package: " + activePackage->name()); |
@@ -307,2 +334,3 @@ void MainWindow::showDetails() | |||
307 | details->remove->setEnabled(activePackage->installed()); | 334 | details->remove->setEnabled(activePackage->installed()); |
335 | } | ||
308 | details->showMaximized(); | 336 | details->showMaximized(); |
@@ -318,6 +346,7 @@ void MainWindow::setCurrent( QListViewItem* p ) | |||
318 | { | 346 | { |
319 | pvDebug(2, "MainWindow::setCurrent "); | 347 | if ( !p ) return; |
320 | return; | 348 | activePackageListItem = (PackageListItem*)p; |
321 | pvDebug(2, "name "+((Package*)p)->name()); | 349 | activePackage = activePackageListItem->getPackage(); |
322 | activePackage = (Package*)p; | 350 | pvDebug(5, "start timer"); |
351 | popupTimer->start( 750, true ); | ||
323 | } | 352 | } |
@@ -357 +386,33 @@ void MainWindow::rotateUpdateIcon() | |||
357 | } | 386 | } |
387 | |||
388 | void MainWindow::showPopup() | ||
389 | { | ||
390 | popupMenu->clear(); | ||
391 | destsMenu->clear(); | ||
392 | |||
393 | QAction *popupAction; | ||
394 | popupMenu->insertItem( tr("Install to"), destsMenu ); | ||
395 | QStringList dests = settings->getDestinationNames(); | ||
396 | for (uint i = 0; i < dests.count(); i++ ) | ||
397 | { | ||
398 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | ||
399 | popupAction->addTo( destsMenu ); | ||
400 | } | ||
401 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
402 | this, SLOT( changePackageDest( int ) ) ); | ||
403 | popupMenu->popup( QCursor::pos() ); | ||
404 | } | ||
405 | |||
406 | void MainWindow::changePackageDest( int i ) | ||
407 | { | ||
408 | activePackage->setDest( destsMenu->text(i) ); | ||
409 | activePackage->setOn(); | ||
410 | activePackage->setLink( settings->createLinks() ); | ||
411 | activePackageListItem->displayDetails(); | ||
412 | } | ||
413 | |||
414 | void MainWindow::stopTimer( QListViewItem* ) | ||
415 | { | ||
416 | pvDebug( 5, "stop timer" ); | ||
417 | popupTimer->stop(); | ||
418 | } | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 892d5e8..adc5e78 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -17,3 +17,3 @@ class QLineEdit; | |||
17 | class QListView; | 17 | class QListView; |
18 | 18 | class PackageListItem; | |
19 | 19 | ||
@@ -48,2 +48,5 @@ public slots: | |||
48 | void filterList(); | 48 | void filterList(); |
49 | void showPopup(); | ||
50 | void changePackageDest( int ); | ||
51 | void stopTimer( QListViewItem* ); | ||
49 | 52 | ||
@@ -59,2 +62,3 @@ private: | |||
59 | Package *activePackage; | 62 | Package *activePackage; |
63 | PackageListItem *activePackageListItem; | ||
60 | QAction *runAction; | 64 | QAction *runAction; |
@@ -65,3 +69,2 @@ private: | |||
65 | QListView *listViewPackages; | 69 | QListView *listViewPackages; |
66 | QPopupMenu *contextMenu; | ||
67 | QPEToolBar *findBar; | 70 | QPEToolBar *findBar; |
@@ -71,3 +74,5 @@ private: | |||
71 | QComboBox *subsection; | 74 | QComboBox *subsection; |
75 | QTimer *popupTimer; | ||
72 | QPopupMenu *popupMenu; | 76 | QPopupMenu *popupMenu; |
77 | QPopupMenu *destsMenu; | ||
73 | bool updateIcon; | 78 | bool updateIcon; |
diff --git a/noncore/unsupported/oipkg/opie-oipkg.control b/noncore/unsupported/oipkg/opie-oipkg.control index 89cc0b4..2ffec71 100644 --- a/noncore/unsupported/oipkg/opie-oipkg.control +++ b/noncore/unsupported/oipkg/opie-oipkg.control | |||
@@ -6,3 +6,3 @@ Architecture: arm | |||
6 | Version: $QPE_VERSION-$SUB_VERSION | 6 | Version: $QPE_VERSION-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), ipkg (>0.9) |
8 | Description: Package Manager | 8 | Description: Package Manager |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 1705f78..9f602b5 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -11,4 +11,10 @@ Package::~Package() | |||
11 | 11 | ||
12 | Package::Package() | 12 | Package::Package( PackageManagerSettings *s ) |
13 | { | 13 | { |
14 | init(s); | ||
15 | } | ||
16 | |||
17 | void Package::init( PackageManagerSettings *s ) | ||
18 | { | ||
19 | settings = s; | ||
14 | _size = ""; | 20 | _size = ""; |
@@ -21,7 +27,8 @@ Package::Package() | |||
21 | _status = ""; | 27 | _status = ""; |
28 | _dest = ""; | ||
22 | } | 29 | } |
23 | 30 | ||
24 | Package::Package( QStringList pack ) | 31 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
25 | { | 32 | { |
26 | Package(); | 33 | init(s); |
27 | parsePackage( pack ); | 34 | parsePackage( pack ); |
@@ -30,5 +37,5 @@ Package::Package( QStringList pack ) | |||
30 | 37 | ||
31 | Package::Package( QString n ) | 38 | Package::Package( QString n, PackageManagerSettings *s ) |
32 | { | 39 | { |
33 | Package(); | 40 | init(s); |
34 | _name = QString( n ); | 41 | _name = QString( n ); |
@@ -39,3 +46,3 @@ Package::Package( Package *pi ) | |||
39 | { | 46 | { |
40 | Package(); | 47 | init(pi->settings); |
41 | copyValues( pi ); | 48 | copyValues( pi ); |
@@ -174,3 +181,3 @@ void Package::copyValues( Package* pack ) | |||
174 | 181 | ||
175 | QString Package::getSection() | 182 | QString Package::section() |
176 | { | 183 | { |
@@ -192,3 +199,3 @@ void Package::setSection( QString s) | |||
192 | 199 | ||
193 | QString Package::getSubSection() | 200 | QString Package::subSection() |
194 | { | 201 | { |
@@ -255,3 +262,2 @@ QString Package::details() | |||
255 | 262 | ||
256 | /** No descriptions */ | ||
257 | void Package::processed() | 263 | void Package::processed() |
@@ -259,3 +265,3 @@ void Package::processed() | |||
259 | _toProcess = false; | 265 | _toProcess = false; |
260 | //hack, but we're mot writing status anyway... | 266 | //hack, but we're not writing status anyway... |
261 | if ( installed() ) _status = "install"; | 267 | if ( installed() ) _status = "install"; |
@@ -263 +269,29 @@ void Package::processed() | |||
263 | } | 269 | } |
270 | |||
271 | QString Package::dest() | ||
272 | { | ||
273 | if ( installed()||(!installed() && _toProcess) ) | ||
274 | return _dest!=""?_dest:settings->getDestinationName(); | ||
275 | else return ""; | ||
276 | } | ||
277 | |||
278 | void Package::setDest( QString d ) | ||
279 | { | ||
280 | _dest = d; | ||
281 | } | ||
282 | |||
283 | void Package::setOn() | ||
284 | { | ||
285 | _toProcess = true; | ||
286 | } | ||
287 | |||
288 | bool Package::link() | ||
289 | { | ||
290 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | ||
291 | return _link; | ||
292 | } | ||
293 | |||
294 | void Package::setLink(bool b) | ||
295 | { | ||
296 | _link = b; | ||
297 | } | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index cf2af75..6c292ed 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -10,2 +10,4 @@ | |||
10 | 10 | ||
11 | #include "pksettings.h" | ||
12 | |||
11 | class Package //: public QObject | 13 | class Package //: public QObject |
@@ -14,6 +16,6 @@ class Package //: public QObject | |||
14 | public: | 16 | public: |
15 | Package(); | 17 | Package(PackageManagerSettings *); |
16 | ~Package(); | 18 | ~Package(); |
17 | Package( QStringList ); | 19 | Package( QStringList, PackageManagerSettings * ); |
18 | Package( QString ); | 20 | Package( QString, PackageManagerSettings * ); |
19 | Package( Package* ); | 21 | Package( Package* ); |
@@ -31,4 +33,4 @@ class Package //: public QObject | |||
31 | void setSection( QString ); | 33 | void setSection( QString ); |
32 | QString getSection(); | 34 | QString section(); |
33 | QString getSubSection(); | 35 | QString subSection(); |
34 | QString details(); | 36 | QString details(); |
@@ -37,4 +39,8 @@ class Package //: public QObject | |||
37 | bool toRemove(); | 39 | bool toRemove(); |
38 | /** No descriptions */ | ||
39 | void processed(); | 40 | void processed(); |
41 | QString dest(); | ||
42 | void setDest( QString d ); | ||
43 | void setOn(); | ||
44 | bool link(); | ||
45 | void setLink(bool); | ||
40 | public slots: | 46 | public slots: |
@@ -43,4 +49,6 @@ public slots: | |||
43 | private: | 49 | private: |
50 | PackageManagerSettings *settings; | ||
44 | QString _name; | 51 | QString _name; |
45 | bool _toProcess; | 52 | bool _toProcess; |
53 | bool _link; | ||
46 | QString _status; | 54 | QString _status; |
@@ -51,3 +59,5 @@ private: | |||
51 | QString _desc; | 59 | QString _desc; |
60 | QString _dest; | ||
52 | void parsePackage( QStringList ); | 61 | void parsePackage( QStringList ); |
62 | void init(PackageManagerSettings *); | ||
53 | }; | 63 | }; |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 944bb83..035ec81 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -72,4 +72,4 @@ void PackageList::filterPackages( QString f ) | |||
72 | if ( | 72 | if ( |
73 | ((aktSection=="All")||(pack->getSection()==aktSection)) && | 73 | ((aktSection=="All")||(pack->section()==aktSection)) && |
74 | ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) && | 74 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && |
75 | pack->name().contains( f ) | 75 | pack->name().contains( f ) |
@@ -128,3 +128,3 @@ void PackageList::updateSections( Package* pack ) | |||
128 | { | 128 | { |
129 | QString s = pack->getSection(); | 129 | QString s = pack->section(); |
130 | if ( s.isEmpty() || s == "") return; | 130 | if ( s.isEmpty() || s == "") return; |
@@ -132,3 +132,3 @@ void PackageList::updateSections( Package* pack ) | |||
132 | sections += s; | 132 | sections += s; |
133 | QString ss = pack->getSubSection(); | 133 | QString ss = pack->subSection(); |
134 | if ( ss.isEmpty() || ss == "" ) return; | 134 | if ( ss.isEmpty() || ss == "" ) return; |
@@ -152,6 +152,9 @@ void PackageList::parseStatus() | |||
152 | QStringList dests = settings->getDestinationUrls(); | 152 | QStringList dests = settings->getDestinationUrls(); |
153 | for ( QStringList::Iterator it = dests.begin(); it != dests.end(); ++it ) | 153 | QStringList destnames = settings->getDestinationNames(); |
154 | QStringList::Iterator name = destnames.begin(); | ||
155 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | ||
154 | { | 156 | { |
155 | pvDebug( 2,"Status Dir: "+*it+statusDir+"/status"); | 157 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); |
156 | readFileEntries( *it+statusDir+"/status" ); | 158 | readFileEntries( *dir+statusDir+"/status", *name ); |
159 | ++name; | ||
157 | }; | 160 | }; |
@@ -165,4 +168,4 @@ void PackageList::parseList() | |||
165 | { | 168 | { |
166 | pvDebug( 2, "List Dir: "+listsDir+"/"+*it); | 169 | pvDebug( 2, "List: "+listsDir+"/"+*it); |
167 | readFileEntries( listsDir+"/"+*it ); | 170 | readFileEntries( listsDir+"/"+*it, "" ); |
168 | } | 171 | } |
@@ -170,3 +173,3 @@ void PackageList::parseList() | |||
170 | 173 | ||
171 | void PackageList::readFileEntries( QString filename ) | 174 | void PackageList::readFileEntries( QString filename, QString dest ) |
172 | { | 175 | { |
@@ -184,3 +187,4 @@ void PackageList::readFileEntries( QString filename ) | |||
184 | { | 187 | { |
185 | Package *p = new Package( packEntry ); | 188 | Package *p = new Package( packEntry, settings ); |
189 | p->setDest( dest ); | ||
186 | if ( p ) | 190 | if ( p ) |
@@ -201,7 +205,7 @@ void PackageList::update() | |||
201 | { | 205 | { |
202 | pvDebug( 3, "parseStatus"); | 206 | pvDebug( 2, "parseStatus"); |
203 | parseStatus(); | 207 | parseStatus(); |
204 | pvDebug( 3, "parseList"); | 208 | pvDebug( 2, "parseList"); |
205 | parseList(); | 209 | parseList(); |
206 | pvDebug( 3, "finished parsing"); | 210 | pvDebug( 2, "finished parsing"); |
207 | } | 211 | } |
@@ -223 +227,15 @@ void PackageList::clear() | |||
223 | } | 227 | } |
228 | |||
229 | void PackageList::allPackages() | ||
230 | { | ||
231 | packageList.clear(); | ||
232 | QDictIterator<Package> filterIter( origPackageList ); | ||
233 | filterIter.toFirst(); | ||
234 | Package *pack= filterIter.current() ; | ||
235 | while ( pack ) | ||
236 | { | ||
237 | packageList.insert( pack->name(), pack ); | ||
238 | ++filterIter; | ||
239 | pack = filterIter.current(); | ||
240 | } | ||
241 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 4ce97af..7c326ca 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -14,3 +14,5 @@ | |||
14 | 14 | ||
15 | class PackageList { | 15 | class PackageList //:QObject |
16 | { | ||
17 | // Q_OBJECT | ||
16 | public: | 18 | public: |
@@ -31,4 +33,4 @@ public: | |||
31 | Package* getByName( QString ); | 33 | Package* getByName( QString ); |
32 | /** No descriptions */ | ||
33 | void clear(); | 34 | void clear(); |
35 | void allPackages(); | ||
34 | 36 | ||
@@ -63,3 +65,3 @@ private: | |||
63 | void parseList(); | 65 | void parseList(); |
64 | void readFileEntries( QString ); | 66 | void readFileEntries( QString file, QString dest ); |
65 | }; | 67 | }; |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 5d08bb1..149ba35 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -3,2 +3,5 @@ | |||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qobject.h> | ||
5 | |||
6 | #include "debug.h" | ||
4 | 7 | ||
@@ -9,3 +12,3 @@ static QPixmap *pm_install=0; | |||
9 | 12 | ||
10 | PackageListItem::PackageListItem(QListView* lv, Package *pi) | 13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
11 | :QCheckListItem(lv,pi->name(),CheckBox) | 14 | :QCheckListItem(lv,pi->name(),CheckBox) |
@@ -13,2 +16,24 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi) | |||
13 | package = pi; | 16 | package = pi; |
17 | settings = s; | ||
18 | setExpandable( true ); | ||
19 | QCheckListItem *item; | ||
20 | #ifndef NEWLAYOUT | ||
21 | item = new QCheckListItem( this, QObject::tr("Name") ); | ||
22 | item->setText(1,pi->name()); | ||
23 | item = new QCheckListItem( this, QObject::tr("Description") ); | ||
24 | item->setText(1,pi->desc()+"\ntest multi\nline"); | ||
25 | item = new QCheckListItem( this, QObject::tr("Size") ); | ||
26 | item->setText(1,pi->size()); | ||
27 | item = new QCheckListItem( this, QObject::tr("Destination") ); | ||
28 | item->setText(1,pi->getDest()); | ||
29 | #endif | ||
30 | #ifdef NEWLAYOUT | ||
31 | item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() ); | ||
32 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); | ||
33 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | ||
34 | destItem = new QCheckListItem( this, "" ); | ||
35 | linkItem = new QCheckListItem( this, "" ); | ||
36 | displayDetails(); | ||
37 | #endif | ||
38 | |||
14 | if (!pm_uninstalled) { | 39 | if (!pm_uninstalled) { |
@@ -19,4 +44,6 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi) | |||
19 | } | 44 | } |
45 | #ifndef NEWLAYOUT | ||
20 | setText(1, package->shortDesc() ); | 46 | setText(1, package->shortDesc() ); |
21 | setText(2, package->size() ); | 47 | setText(2, package->size() ); |
48 | #endif | ||
22 | } | 49 | } |
@@ -95,2 +122,17 @@ void PackageListItem::setOn( bool b ) | |||
95 | package->toggleProcess(); | 122 | package->toggleProcess(); |
123 | // if ( b ) | ||
124 | // { | ||
125 | // if ((package->dest()).isEmpty) | ||
126 | // package->setDest( settings->getDestinationName() ); | ||
127 | // }else{ | ||
128 | // package->setDest( QObject::tr("not installed")); | ||
129 | // } | ||
130 | package->setLink( settings->createLinks() ); | ||
131 | displayDetails(); | ||
132 | } | ||
133 | |||
134 | void PackageListItem::displayDetails() | ||
135 | { | ||
136 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); | ||
137 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | ||
96 | repaint(); | 138 | repaint(); |
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index 6983e58..f695432 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h | |||
@@ -11,2 +11,4 @@ | |||
11 | 11 | ||
12 | #include "pksettings.h" | ||
13 | |||
12 | class PackageListItem | 14 | class PackageListItem |
@@ -15,3 +17,3 @@ class PackageListItem | |||
15 | public: | 17 | public: |
16 | PackageListItem(QListView*, Package* ); | 18 | PackageListItem(QListView*, Package*, PackageManagerSettings*); |
17 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); | 19 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); |
@@ -24,4 +26,8 @@ public: | |||
24 | virtual void setOn ( bool ); | 26 | virtual void setOn ( bool ); |
27 | void displayDetails(); | ||
25 | 28 | ||
26 | private: | 29 | private: |
30 | QCheckListItem *destItem; | ||
31 | QCheckListItem *linkItem; | ||
32 | PackageManagerSettings *settings; | ||
27 | Package *package; | 33 | Package *package; |
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 32224b5..f84a9c4 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -471,2 +471,3 @@ QStringList PackageManagerSettings::getActiveServers() | |||
471 | } | 471 | } |
472 | |||
472 | /** returns the destination listed in ipkg.conf */ | 473 | /** returns the destination listed in ipkg.conf */ |
@@ -482,2 +483,25 @@ QStringList PackageManagerSettings::getDestinationUrls() | |||
482 | 483 | ||
484 | /** returns the destination listed in ipkg.conf */ | ||
485 | QString PackageManagerSettings::getDestinationUrlByName(QString n) | ||
486 | { | ||
487 | QStringList sl; | ||
488 | for (int i=0; i<(int)destinations->count(); i++) | ||
489 | { | ||
490 | if ( n == destinations->text(i)) return*destinationurlDic[i]; | ||
491 | } | ||
492 | return ""; | ||
493 | } | ||
494 | |||
495 | /** returns the destination listed in ipkg.conf */ | ||
496 | QStringList PackageManagerSettings::getDestinationNames() | ||
497 | { | ||
498 | QStringList sl; | ||
499 | for (int i=0; i<(int)destinations->count(); i++) | ||
500 | { | ||
501 | sl += destinations->text(i); | ||
502 | } | ||
503 | return sl; | ||
504 | } | ||
505 | |||
506 | |||
483 | void PackageManagerSettings::linkEnabled( bool b ) | 507 | void PackageManagerSettings::linkEnabled( bool b ) |
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index 2982f1c..11ba55c 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -21,2 +21,5 @@ public: | |||
21 | QStringList getDestinationUrls(); | 21 | QStringList getDestinationUrls(); |
22 | QStringList getDestinationNames(); | ||
23 | QString getDestinationUrlByName(QString); | ||
24 | |||
22 | private: | 25 | private: |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index eae73ad..3b31b4d 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -10,3 +10,2 @@ | |||
10 | #include <qpe/stringutil.h> | 10 | #include <qpe/stringutil.h> |
11 | #include <qpe/qcopenvelope_qws.h> | ||
12 | #include <qdir.h> | 11 | #include <qdir.h> |
@@ -42,3 +41,3 @@ PmIpkg::~PmIpkg() | |||
42 | #define SYSTEM | 41 | #define SYSTEM |
43 | int PmIpkg::runIpkg(const QString& args) | 42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
44 | { | 43 | { |
@@ -46,9 +45,2 @@ int PmIpkg::runIpkg(const QString& args) | |||
46 | 45 | ||
47 | //to make script ipkg happy | ||
48 | pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg"); | ||
49 | if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg")) | ||
50 | { | ||
51 | QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg"); | ||
52 | instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg"); | ||
53 | } | ||
54 | #ifdef PROC | 46 | #ifdef PROC |
@@ -59,3 +51,8 @@ int PmIpkg::runIpkg(const QString& args) | |||
59 | #endif | 51 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | ||
53 | if ( dest == "" ) | ||
60 | cmd += " -dest "+settings->getDestinationName(); | 54 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | ||
56 | cmd += " -dest "+ dest; | ||
57 | |||
61 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
@@ -64,3 +61,2 @@ int PmIpkg::runIpkg(const QString& args) | |||
64 | cmd += args; | 61 | cmd += args; |
65 | out( "running:<br>\n"+cmd+"<br>\n" ); | ||
66 | int r = 0; | 62 | int r = 0; |
@@ -68,8 +64,10 @@ int PmIpkg::runIpkg(const QString& args) | |||
68 | QString o = "start"; | 64 | QString o = "start"; |
69 | Process ipkg( cmd ); | 65 | Process *ipkg = new Process( "ls");//cmd ); |
66 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | ||
70 | QString description; | 67 | QString description; |
71 | ipkg.exec("",o); | 68 | ipkg->exec("",o); |
72 | out( o ); | 69 | // out( o ); |
73 | #endif | 70 | #endif |
74 | #ifdef SYSTEM | 71 | #ifdef SYSTEM |
72 | out( "running:<br>\n"+cmd+"<br>\n" ); | ||
75 | QString redirect = "/tmp/oipkg.pipe"; | 73 | QString redirect = "/tmp/oipkg.pipe"; |
@@ -82,3 +80,3 @@ int PmIpkg::runIpkg(const QString& args) | |||
82 | while ( ! f.open(IO_ReadOnly) ) {}; | 80 | while ( ! f.open(IO_ReadOnly) ) {}; |
83 | { | 81 | // { |
84 | QTextStream t( &f ); | 82 | QTextStream t( &f ); |
@@ -88,3 +86,5 @@ int PmIpkg::runIpkg(const QString& args) | |||
88 | line = t.readLine(); | 86 | line = t.readLine(); |
89 | if ( line != oldLine ) out( line +"<br>" ); | 87 | if ( line != oldLine ) |
88 | { | ||
89 | out( line +"<br>" ); | ||
90 | oldLine = line; | 90 | oldLine = line; |
@@ -92,2 +92,3 @@ int PmIpkg::runIpkg(const QString& args) | |||
92 | } | 92 | } |
93 | // } | ||
93 | f.close(); | 94 | f.close(); |
@@ -99,8 +100,9 @@ int PmIpkg::runIpkg(const QString& args) | |||
99 | 100 | ||
100 | void PmIpkg::makeLinks(QString pack) | 101 | void PmIpkg::makeLinks(Package *pack) |
101 | { | 102 | { |
102 | pvDebug( 2, "PmIpkg::makeLinks "+ pack); | 103 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
104 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | ||
105 | if (dest == "/" ) return; | ||
103 | out( "<br>creating links<br>" ); | 106 | out( "<br>creating links<br>" ); |
104 | QString dest = settings->getDestinationUrl(); | 107 | out("for package "+pack->name()+" in "+dest+"<br>"); |
105 | out("for package "+pack+" in "+dest+"<br>"); | ||
106 | { | 108 | { |
@@ -110,3 +112,3 @@ void PmIpkg::makeLinks(QString pack) | |||
110 | } | 112 | } |
111 | QString fn = dest+"/"+statusDir+"/info/"+pack+".list"; | 113 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; |
112 | QFile f( fn ); | 114 | QFile f( fn ); |
@@ -115,2 +117,3 @@ void PmIpkg::makeLinks(QString pack) | |||
115 | out( "<b>Panik!</b> Could not open:<br>"+fn ); | 117 | out( "<b>Panik!</b> Could not open:<br>"+fn ); |
118 | return; | ||
116 | }; | 119 | }; |
@@ -128,4 +131,6 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
128 | { | 131 | { |
132 | if ( dest == "???" ) return; | ||
129 | QString destFile = file; | 133 | QString destFile = file; |
130 | file = dest+"/"+file; | 134 | file = dest+"/"+file; |
135 | if (file == dest) return; | ||
131 | QFileInfo fileInfo( file ); | 136 | QFileInfo fileInfo( file ); |
@@ -168,2 +173,3 @@ void PmIpkg::commit( PackageList pl ) | |||
168 | QString inst="<b>To install:</b><br>\n";; | 173 | QString inst="<b>To install:</b><br>\n";; |
174 | pl.allPackages(); | ||
169 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 175 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
@@ -174,10 +180,5 @@ void PmIpkg::commit( PackageList pl ) | |||
174 | { | 180 | { |
175 | #ifndef NEWLIST | ||
176 | to_install.append( pack->name() ); | ||
177 | #endif | ||
178 | #ifdef NEWLIST | ||
179 | to_install.append( pack ); | 181 | to_install.append( pack ); |
180 | sizecount += pack->size().toInt(); | 182 | sizecount += pack->size().toInt(); |
181 | #endif | 183 | inst += pack->name()+"\t(on "+pack->dest()+")<br>"; |
182 | inst += pack->name()+"<br>"; | ||
183 | } | 184 | } |
@@ -185,9 +186,4 @@ void PmIpkg::commit( PackageList pl ) | |||
185 | { | 186 | { |
186 | #ifndef NEWLIST | ||
187 | to_remove.append( pack->name() ); | ||
188 | #endif | ||
189 | #ifdef NEWLIST | ||
190 | to_remove.append( pack ); | 187 | to_remove.append( pack ); |
191 | sizecount += 1; | 188 | sizecount += 1; |
192 | #endif | ||
193 | rem += pack->name()+"<br>"; | 189 | rem += pack->name()+"<br>"; |
@@ -213,7 +209,2 @@ void PmIpkg::commit( PackageList pl ) | |||
213 | runwindow->exec(); | 209 | runwindow->exec(); |
214 | // ##### If we looked in the list of files, we could send out accurate | ||
215 | // ##### messages. But we don't bother yet, and just do an "all". | ||
216 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
217 | QString lf = QString::null; | ||
218 | e << lf; | ||
219 | return; | 210 | return; |
@@ -235,14 +226,2 @@ void PmIpkg::remove() | |||
235 | 226 | ||
236 | #ifndef NEWLIST | ||
237 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) | ||
238 | { | ||
239 | if ( runIpkg("remove " + *it) == 0) | ||
240 | { | ||
241 | |||
242 | }else{ | ||
243 | out("<b>"+tr("Error while removing")+"</b>"+*it); | ||
244 | } | ||
245 | } | ||
246 | #endif | ||
247 | #ifdef NEWLIST | ||
248 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 227 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
@@ -258,3 +237,2 @@ void PmIpkg::remove() | |||
258 | } | 237 | } |
259 | #endif | ||
260 | } | 238 | } |
@@ -267,22 +245,10 @@ void PmIpkg::install() | |||
267 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 245 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
268 | #ifndef NEWLIST | ||
269 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) | ||
270 | { | ||
271 | if ( runIpkg("install " + *it) == 0 ) | ||
272 | { | ||
273 | if ( settings->createLinks() ) | ||
274 | makeLinks( *it ); | ||
275 | }else{ | ||
276 | out("<b>"+tr("Error while installing")+"</b>"+*it); | ||
277 | } | ||
278 | } | ||
279 | #endif | ||
280 | #ifdef NEWLIST | ||
281 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 246 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
282 | { | 247 | { |
283 | if ( runIpkg("install " + it->name()) == 0 ) | 248 | |
249 | if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) | ||
284 | { | 250 | { |
285 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 251 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
286 | if ( settings->createLinks() ) | 252 | if ( it->link() ) |
287 | makeLinks( it->name() ); | 253 | makeLinks( it ); |
288 | it->processed(); | 254 | it->processed(); |
@@ -292,3 +258,2 @@ void PmIpkg::install() | |||
292 | } | 258 | } |
293 | #endif | ||
294 | } | 259 | } |
@@ -296,3 +261,2 @@ void PmIpkg::install() | |||
296 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 261 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
297 | // add 3rd package parameter | ||
298 | { | 262 | { |
@@ -347,6 +311,6 @@ void PmIpkg::show(bool b) | |||
347 | showButtons(b); | 311 | showButtons(b); |
348 | //if ( b ) | 312 | if ( b ) |
349 | runwindow->progress->hide(); | 313 | runwindow->progress->hide(); |
350 | // else | 314 | else |
351 | // runwindow->progress->show(); | 315 | runwindow->progress->show(); |
352 | } | 316 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 2692017..c57adb7 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -13,3 +13,2 @@ | |||
13 | 13 | ||
14 | //#define NEWLIST | ||
15 | class Package; | 14 | class Package; |
@@ -31,16 +30,9 @@ private: | |||
31 | RunWindow *runwindow; | 30 | RunWindow *runwindow; |
32 | #ifndef NEWLIST | ||
33 | QStringList to_remove; | ||
34 | QStringList to_install; | ||
35 | #endif | ||
36 | #ifdef NEWLIST | ||
37 | QList<Package> to_remove; | 31 | QList<Package> to_remove; |
38 | QList<Package> to_install; | 32 | QList<Package> to_install; |
39 | #endif | ||
40 | bool runwindowopen; | 33 | bool runwindowopen; |
41 | 34 | ||
42 | void makeLinks(QString); | 35 | void makeLinks(Package*); |
43 | void processLinkDir( QString, QString ); | 36 | void processLinkDir( QString, QString ); |
44 | 37 | int runIpkg(const QString& args, const QString& dest="" ); | |
45 | int runIpkg(const QString& args); | ||
46 | void out( QString ); | 38 | void out( QString ); |
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui index 5359fe2..52da408 100644 --- a/noncore/unsupported/oipkg/runwindow.ui +++ b/noncore/unsupported/oipkg/runwindow.ui | |||
@@ -44,3 +44,3 @@ | |||
44 | <name>progress</name> | 44 | <name>progress</name> |
45 | <number>42</number> | 45 | <number>0</number> |
46 | </property> | 46 | </property> |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index 5df522b..cf6e614 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -22,4 +22,2 @@ public: | |||
22 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | /** No descriptions */ | ||
24 | QComboBox getActiveDestinationCombo(); | ||
25 | 23 | ||