-rw-r--r-- | noncore/unsupported/oipkg/TODO | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/debug.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 145 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 42 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 91 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.h | 53 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 132 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 32 |
12 files changed, 331 insertions, 200 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index b07542a..3fc84e5 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -9,2 +9,3 @@ | |||
9 | * manage links | 9 | * manage links |
10 | * dependency checking \ No newline at end of file | 10 | * dependency checking \ No newline at end of file |
11 | * ipkg options in runwindow \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index e73b9b2..973d96c 100644 --- a/noncore/unsupported/oipkg/debug.h +++ b/noncore/unsupported/oipkg/debug.h | |||
@@ -16,5 +16,5 @@ if ( debugLevel < 3 ) \ | |||
16 | }else{\ | 16 | }else{\ |
17 | if ( I <= debugLevel ) \ | 17 | if ( I <= debugLevel ) \ |
18 | printf("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\ | 18 | qDebug("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\ |
19 | } | 19 | } |
20 | 20 | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index e3abf36..6bf9a7a 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -15,4 +15,5 @@ | |||
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qfile.h> | ||
17 | #include <qlistview.h> | 18 | #include <qlistview.h> |
18 | #include <qtextview.h> | 19 | #include <qtextview.h> |
@@ -28,9 +29,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
28 | QMainWindow( parent, name, f ) | 29 | QMainWindow( parent, name, f ) |
29 | { | 30 | { |
30 | setCaption( tr("Package Manager") ); | 31 | settings = new PackageManagerSettings(this,0,TRUE); |
32 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | ||
33 | ipkg = new PmIpkg( settings, this ); | ||
31 | 34 | ||
32 | listViewPackages = new QListView( this,0,0 ); | ||
33 | listViewPackages->setSelectionMode(QListView::NoSelection); | ||
34 | setCentralWidget( listViewPackages ); | 35 | setCentralWidget( listViewPackages ); |
36 | setCaption( tr("Package Manager") ); | ||
35 | 37 | ||
36 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 38 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
@@ -39,35 +41,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
39 | 41 | ||
40 | makeMenu(); | 42 | makeMenu(); |
41 | #ifdef NEWLAYOUT | 43 | |
42 | listViewPackages->addColumn( tr("Package") ); | ||
43 | listViewPackages->setRootIsDecorated( true ); | ||
44 | #endif | ||
45 | #ifndef NEWLAYOUT | ||
46 | QFontMetrics fm = fontMetrics(); | ||
47 | int wlw = width()*2; | ||
48 | int w0 = fm.width(tr("Package"))+30; | ||
49 | // int w0 = fm.width(tr("Package"))+30; | ||
50 | int w2 = fm.width("00000")+4; | ||
51 | int w1 = wlw-w2-w0-24; | ||
52 | listViewPackages->addColumn( tr("Package"), w0 ); | ||
53 | listViewPackages->addColumn( tr("Description"), w1 ); | ||
54 | listViewPackages->addColumn( tr("Size"), w2 ); | ||
55 | listViewPackages->setColumnWidthMode(0,QListView::Manual); | ||
56 | listViewPackages->setColumnWidthMode(1,QListView::Manual); | ||
57 | listViewPackages->setColumnWidthMode(2,QListView::Manual); | ||
58 | listViewPackages->setSelectionMode( QListView::Multi ); | ||
59 | #endif | ||
60 | connect( section, SIGNAL( activated(int) ), | 44 | connect( section, SIGNAL( activated(int) ), |
61 | this, SLOT( sectionChanged() ) ); | 45 | this, SLOT( sectionChanged() ) ); |
62 | connect( subsection, SIGNAL(activated(int) ), | 46 | connect( subsection, SIGNAL(activated(int) ), |
63 | this, SLOT( subSectionChanged() ) ); | 47 | this, SLOT( subSectionChanged() ) ); |
64 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), | ||
65 | this, SLOT( setCurrent( QListViewItem* ) ) ); | ||
66 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), | ||
67 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
68 | |||
69 | popupMenu = new QPopupMenu( this ); | ||
70 | |||
71 | settings = new PackageManagerSettings(this,0,TRUE); | ||
72 | 48 | ||
73 | ipkg = new PmIpkg( settings, this ); | 49 | ipkg = new PmIpkg( settings, this ); |
@@ -89,9 +65,4 @@ void MainWindow::makeMenu() | |||
89 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 65 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
90 | 66 | ||
91 | popupMenu = new QPopupMenu( this ); | ||
92 | destsMenu = new QPopupMenu( popupMenu ); | ||
93 | popupTimer = new QTimer( this ); | ||
94 | connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); | ||
95 | |||
96 | setToolBarsMovable( false ); | 67 | setToolBarsMovable( false ); |
97 | toolBar->setHorizontalStretchable( true ); | 68 | toolBar->setHorizontalStretchable( true ); |
@@ -124,11 +95,12 @@ void MainWindow::makeMenu() | |||
124 | updateAction->addTo( srvMenu ); | 95 | updateAction->addTo( srvMenu ); |
125 | 96 | ||
126 | detailsAction = new QAction( tr( "Details" ), | 97 | // would we use for find |
127 | Resource::loadIconSet( "find" ), | 98 | // detailsAction = new QAction( tr( "Details" ), |
128 | QString::null, 0, this, 0 ); | 99 | // Resource::loadIconSet( "find" ), |
129 | connect( detailsAction, SIGNAL( activated() ), | 100 | // QString::null, 0, this, 0 ); |
130 | this , SLOT( showDetails() ) ); | 101 | // connect( detailsAction, SIGNAL( activated() ), |
131 | detailsAction->addTo( toolBar ); | 102 | // this , SLOT( showDetails() ) ); |
132 | detailsAction->addTo( srvMenu ); | 103 | // detailsAction->addTo( toolBar ); |
104 | // detailsAction->addTo( srvMenu ); | ||
133 | 105 | ||
134 | QAction *cfgact; | 106 | QAction *cfgact; |
@@ -317,43 +289,4 @@ void MainWindow::showSettingsDst() | |||
317 | } | 289 | } |
318 | 290 | ||
319 | |||
320 | void MainWindow::showDetails() | ||
321 | { | ||
322 | if ( details ) | ||
323 | { | ||
324 | details = new PackageDetails( this ); | ||
325 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | ||
326 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | ||
327 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); | ||
328 | details->description->setTextFormat(RichText); | ||
329 | } | ||
330 | if ( !activePackage ) | ||
331 | { | ||
332 | details->description->setText(tr("no package selected")); | ||
333 | details->description->setText(tr("errmm...<br>...not working?")); | ||
334 | }else{ | ||
335 | details->setCaption("Package: " + activePackage->name()); | ||
336 | details->description->setText(activePackage->details() ); | ||
337 | details->install->setEnabled(!activePackage->installed()); | ||
338 | details->remove->setEnabled(activePackage->installed()); | ||
339 | } | ||
340 | details->showMaximized(); | ||
341 | } | ||
342 | |||
343 | void MainWindow::toggleActivePackage() | ||
344 | { | ||
345 | activePackage->toggleProcess(); | ||
346 | if ( details ) details->close(); | ||
347 | } | ||
348 | |||
349 | void MainWindow::setCurrent( QListViewItem* p ) | ||
350 | { | ||
351 | if ( !p ) return; | ||
352 | activePackageListItem = (PackageListItem*)p; | ||
353 | activePackage = activePackageListItem->getPackage(); | ||
354 | pvDebug(5, "start timer"); | ||
355 | popupTimer->start( 750, true ); | ||
356 | } | ||
357 | |||
358 | void MainWindow::sectionShow(bool b) | 291 | void MainWindow::sectionShow(bool b) |
359 | { | 292 | { |
@@ -390,39 +323,27 @@ void MainWindow::rotateUpdateIcon() | |||
390 | } | 323 | } |
391 | 324 | ||
392 | void MainWindow::showPopup() | ||
393 | { | ||
394 | popupMenu->clear(); | ||
395 | destsMenu->clear(); | ||
396 | |||
397 | QAction *popupAction; | ||
398 | popupMenu->insertItem( tr("Install to"), destsMenu ); | ||
399 | QStringList dests = settings->getDestinationNames(); | ||
400 | for (uint i = 0; i < dests.count(); i++ ) | ||
401 | { | ||
402 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | ||
403 | popupAction->addTo( destsMenu ); | ||
404 | } | ||
405 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
406 | this, SLOT( changePackageDest( int ) ) ); | ||
407 | popupMenu->popup( QCursor::pos() ); | ||
408 | } | ||
409 | |||
410 | void MainWindow::changePackageDest( int i ) | ||
411 | { | ||
412 | activePackage->setDest( destsMenu->text(i) ); | ||
413 | activePackage->setOn(); | ||
414 | activePackage->setLink( settings->createLinks() ); | ||
415 | activePackageListItem->displayDetails(); | ||
416 | } | ||
417 | 325 | ||
418 | void MainWindow::stopTimer( QListViewItem* ) | 326 | void MainWindow::setDocument(const QString &fileName) |
419 | { | 327 | { |
420 | pvDebug( 5, "stop timer" ); | 328 | installFile(fileName); |
421 | popupTimer->stop(); | 329 | // ##### If we looked in the list of files, we could send out accurate |
330 | // ##### messages. But we don't bother yet, and just do an "all". | ||
331 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
332 | QString lf = QString::null; | ||
333 | e << lf; | ||
334 | displayList(); | ||
422 | } | 335 | } |
423 | 336 | ||
424 | void MainWindow::setDocument(const QString &fileName) | 337 | void MainWindow::installFile(const QString &fileName) |
425 | { | 338 | { |
339 | pvDebug(3, "MainWindow::installFile "+fileName); | ||
340 | if ( !QFile::exists( fileName ) ) return; | ||
426 | ipkg->installFile( fileName ); | 341 | ipkg->installFile( fileName ); |
342 | // ##### If we looked in the list of files, we could send out accurate | ||
343 | // ##### messages. But we don't bother yet, and just do an "all". | ||
344 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
345 | QString lf = QString::null; | ||
346 | e << lf; | ||
347 | displayList(); | ||
427 | } | 348 | } |
428 | 349 | ||
@@ -430,7 +351,7 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg) | |||
430 | { | 351 | { |
431 | pvDebug(3, "QCop "+msg); | 352 | pvDebug(3, "QCop "+msg); |
432 | if ( msg == "setDocument(QString)" ) | 353 | if ( msg == "installFile(QString)" ) |
433 | { | 354 | { |
434 | setDocument( QString(arg) ); | 355 | installFile( QString(arg) ); |
435 | } | 356 | } |
436 | } \ No newline at end of file | 357 | } \ No newline at end of file |
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 34943f2..bcb0cc9 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -10,10 +10,9 @@ | |||
10 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | #include "pkdesc.h" | 12 | #include "packagelistview.h" |
13 | 13 | ||
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QPEToolBar; | 15 | class QPEToolBar; |
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class QListView; | ||
18 | class PackageListItem; | 17 | class PackageListItem; |
19 | class QCopChannel; | 18 | class QCopChannel; |
@@ -40,10 +39,6 @@ protected slots: | |||
40 | void showSettingsSrv(); | 39 | void showSettingsSrv(); |
41 | void showSettingsDst(); | 40 | void showSettingsDst(); |
42 | void setDocument (const QString &); | ||
43 | 41 | ||
44 | public slots: | 42 | public slots: |
45 | void showDetails(); | ||
46 | void toggleActivePackage(); | ||
47 | void setCurrent( QListViewItem* ); | ||
48 | void sectionClose(); | 43 | void sectionClose(); |
49 | void sectionShow(bool); | 44 | void sectionShow(bool); |
@@ -51,8 +46,6 @@ public slots: | |||
51 | void findShow(bool); | 46 | void findShow(bool); |
52 | void filterList(); | 47 | void filterList(); |
53 | void showPopup(); | ||
54 | void changePackageDest( int ); | ||
55 | void stopTimer( QListViewItem* ); | ||
56 | void receive (const QCString &, const QByteArray &); | 48 | void receive (const QCString &, const QByteArray &); |
49 | void setDocument (const QString &); | ||
57 | 50 | ||
58 | private: | 51 | private: |
@@ -60,11 +53,10 @@ private: | |||
60 | void setSections(); | 53 | void setSections(); |
61 | void setSubSections(); | 54 | void setSubSections(); |
55 | void installFile(const QString &); | ||
56 | bool updateIcon; | ||
62 | 57 | ||
63 | PmIpkg* ipkg; | 58 | PmIpkg* ipkg; |
64 | PackageManagerSettings *settings; | 59 | PackageManagerSettings *settings; |
65 | PackageDetails* details; | ||
66 | PackageList packageList; | 60 | PackageList packageList; |
67 | Package *activePackage; | ||
68 | PackageListItem *activePackageListItem; | ||
69 | QAction *runAction; | 61 | QAction *runAction; |
70 | QAction *detailsAction; | 62 | QAction *detailsAction; |
@@ -72,5 +64,5 @@ private: | |||
72 | QAction *findAction; | 64 | QAction *findAction; |
73 | QAction *sectionAction; | 65 | QAction *sectionAction; |
74 | QListView *listViewPackages; | 66 | PackageListView *listViewPackages; |
75 | QPEToolBar *findBar; | 67 | QPEToolBar *findBar; |
76 | QLineEdit *findEdit; | 68 | QLineEdit *findEdit; |
@@ -78,8 +70,4 @@ private: | |||
78 | QComboBox *section; | 70 | QComboBox *section; |
79 | QComboBox *subsection; | 71 | QComboBox *subsection; |
80 | QTimer *popupTimer; | ||
81 | QPopupMenu *popupMenu; | ||
82 | QPopupMenu *destsMenu; | ||
83 | bool updateIcon; | ||
84 | private slots: | 72 | private slots: |
85 | void rotateUpdateIcon(); | 73 | void rotateUpdateIcon(); |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 955c7f3..1f7a70d 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -8,7 +8,9 @@ HEADERS = mainwindow.h \ | |||
8 | packagelistitem.h \ | 8 | packagelistitem.h \ |
9 | packagelist.h \ | 9 | packagelist.h \ |
10 | packagelistview.h \ | ||
10 | package.h | 11 | package.h |
11 | SOURCES = main.cpp \ | 12 | SOURCES = main.cpp \ |
12 | mainwindow.cpp \ | 13 | mainwindow.cpp \ |
14 | packagelistview.cpp \ | ||
13 | pksettings.cpp \ | 15 | pksettings.cpp \ |
14 | pmipkg.cpp \ | 16 | pmipkg.cpp \ |
@@ -19,6 +21,5 @@ INCLUDEPATH += $(OPIEDIR)/include | |||
19 | DEPENDPATH+= $(OPIEDIR)/ioclude | 21 | DEPENDPATH+= $(OPIEDIR)/ioclude |
20 | LIBS += -lqpe | 22 | LIBS += -lqpe |
21 | INTERFACES= pkdesc.ui \ | 23 | INTERFACES= runwindow.ui \ |
22 | runwindow.ui \ | ||
23 | pksettingsbase.ui | 24 | pksettingsbase.ui |
24 | TARGET = oipkg | 25 | TARGET = oipkg |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 9f602b5..5f0e5fa 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -3,4 +3,8 @@ | |||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 4 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | ||
6 | #include <qtextstream.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <unistd.h> | ||
5 | 9 | ||
6 | #include "debug.h" | 10 | #include "debug.h" |
@@ -26,5 +30,6 @@ void Package::init( PackageManagerSettings *s ) | |||
26 | _toProcess = false; | 30 | _toProcess = false; |
27 | _status = ""; | 31 | _status = ""; |
28 | _dest = ""; | 32 | _dest = settings->getDestinationName(); |
33 | _link = settings->createLinks(); | ||
29 | } | 34 | } |
30 | 35 | ||
@@ -33,5 +38,4 @@ Package::Package( QStringList pack, PackageManagerSettings *s ) | |||
33 | init(s); | 38 | init(s); |
34 | parsePackage( pack ); | 39 | parsePackage( pack ); |
35 | _toProcess = false; | ||
36 | } | 40 | } |
37 | 41 | ||
@@ -39,6 +43,12 @@ Package::Package( QString n, PackageManagerSettings *s ) | |||
39 | { | 43 | { |
40 | init(s); | 44 | init(s); |
45 | if ( !QFile::exists( n ) ) | ||
46 | { | ||
41 | _name = QString( n ); | 47 | _name = QString( n ); |
42 | _toProcess = false; | 48 | }else{ |
49 | parseIpkgFile( n ); | ||
50 | _toProcess = true; | ||
51 | _packageName = QString( n ); | ||
52 | } | ||
43 | } | 53 | } |
44 | 54 | ||
@@ -47,5 +57,4 @@ Package::Package( Package *pi ) | |||
47 | init(pi->settings); | 57 | init(pi->settings); |
48 | copyValues( pi ); | 58 | copyValues( pi ); |
49 | _toProcess = false; | ||
50 | } | 59 | } |
51 | 60 | ||
@@ -296,2 +305,27 @@ void Package::setLink(bool b) | |||
296 | _link = b; | 305 | _link = b; |
297 | } | 306 | } |
307 | |||
308 | void Package::parseIpkgFile( QString file) | ||
309 | { | ||
310 | system("tar xzf "+file+" -C /tmp"); | ||
311 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | ||
312 | QFile f("/tmp/control"); | ||
313 | if ( f.open(IO_ReadOnly) ) | ||
314 | { | ||
315 | QTextStream t( &f ); | ||
316 | QStringList pack; | ||
317 | while ( !t.eof() ) | ||
318 | { | ||
319 | pack << t.readLine(); | ||
320 | } | ||
321 | f.close(); | ||
322 | parsePackage( pack ); | ||
323 | } | ||
324 | |||
325 | } | ||
326 | |||
327 | QString Package::getPackageName() | ||
328 | { | ||
329 | if ( _packageName.isEmpty() ) return _name; | ||
330 | else return _packageName; | ||
331 | } | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 6c292ed..31b0010 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -44,9 +44,13 @@ class Package //: public QObject | |||
44 | bool link(); | 44 | bool link(); |
45 | void setLink(bool); | 45 | void setLink(bool); |
46 | void parseIpkgFile( QString );; | ||
46 | public slots: | 47 | public slots: |
48 | /** No descriptions */ | ||
49 | QString getPackageName(); | ||
47 | void toggleProcess(); | 50 | void toggleProcess(); |
48 | 51 | ||
49 | private: | 52 | private: |
50 | PackageManagerSettings *settings; | 53 | PackageManagerSettings *settings; |
54 | QString _packageName; | ||
51 | QString _name; | 55 | QString _name; |
52 | bool _toProcess; | 56 | bool _toProcess; |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp new file mode 100644 index 0000000..693ea6a --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -0,0 +1,91 @@ | |||
1 | /*************************************************************************** | ||
2 | packagelistview.cpp - description | ||
3 | ------------------- | ||
4 | begin : Sat Apr 27 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #include "packagelistview.h" | ||
19 | |||
20 | #include <qpopupmenu.h> | ||
21 | #include <qaction.h> | ||
22 | |||
23 | #include "packagelistitem.h" | ||
24 | #include "pksettings.h" | ||
25 | |||
26 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | ||
27 | : QListView(p,n) | ||
28 | { | ||
29 | settings = s; | ||
30 | popupMenu = new QPopupMenu( this ); | ||
31 | destsMenu = new QPopupMenu( popupMenu ); | ||
32 | popupTimer = new QTimer( this ); | ||
33 | setSelectionMode(QListView::NoSelection); | ||
34 | addColumn( tr("Package") ); | ||
35 | setRootIsDecorated( true ); | ||
36 | |||
37 | connect( popupTimer, SIGNAL(timeout()), | ||
38 | this, SLOT(showPopup()) ); | ||
39 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | ||
40 | this, SLOT( setCurrent( QListViewItem* ) ) ); | ||
41 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | ||
42 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
43 | |||
44 | } | ||
45 | |||
46 | //PackageListView::~PackageListView() | ||
47 | //{ | ||
48 | //} | ||
49 | |||
50 | void PackageListView::setCurrent( QListViewItem* p ) | ||
51 | { | ||
52 | if ( !p ) return; | ||
53 | activePackageListItem = (PackageListItem*)p; | ||
54 | activePackage = activePackageListItem->getPackage(); | ||
55 | pvDebug(5, "start timer"); | ||
56 | popupTimer->start( 750, true ); | ||
57 | } | ||
58 | |||
59 | |||
60 | void PackageListView::showPopup() | ||
61 | { | ||
62 | popupMenu->clear(); | ||
63 | destsMenu->clear(); | ||
64 | |||
65 | QAction *popupAction; | ||
66 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | ||
67 | QStringList dests = settings->getDestinationNames(); | ||
68 | for (uint i = 0; i < dests.count(); i++ ) | ||
69 | { | ||
70 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | ||
71 | popupAction->addTo( destsMenu ); | ||
72 | } | ||
73 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
74 | this, SLOT( changePackageDest( int ) ) ); | ||
75 | popupMenu->popup( QCursor::pos() ); | ||
76 | } | ||
77 | |||
78 | void PackageListView::stopTimer( QListViewItem* ) | ||
79 | { | ||
80 | pvDebug( 5, "stop timer" ); | ||
81 | popupTimer->stop(); | ||
82 | } | ||
83 | |||
84 | |||
85 | void PackageListView::changePackageDest( int i ) | ||
86 | { | ||
87 | activePackage->setDest( destsMenu->text(i) ); | ||
88 | activePackage->setOn(); | ||
89 | activePackage->setLink( settings->createLinks() ); | ||
90 | activePackageListItem->displayDetails(); | ||
91 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h new file mode 100644 index 0000000..15e200b --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistview.h | |||
@@ -0,0 +1,53 @@ | |||
1 | /*************************************************************************** | ||
2 | packagelistview.h - description | ||
3 | ------------------- | ||
4 | begin : Sat Apr 27 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #ifndef PACKAGELISTVIEW_H | ||
19 | #define PACKAGELISTVIEW_H | ||
20 | |||
21 | #include <qlistview.h> | ||
22 | #include <qaction.h> | ||
23 | #include <qtimer.h> | ||
24 | #include <qwidget.h> | ||
25 | #include <qpopupmenu.h> | ||
26 | #include "debug.h" | ||
27 | |||
28 | class PackageListItem; | ||
29 | class Package; | ||
30 | class PackageManagerSettings; | ||
31 | |||
32 | class PackageListView : public QListView | ||
33 | { | ||
34 | Q_OBJECT | ||
35 | |||
36 | public: | ||
37 | PackageListView(QWidget*, const char*, PackageManagerSettings*); | ||
38 | //~PackageListView(); | ||
39 | QTimer *popupTimer; | ||
40 | private: | ||
41 | PackageManagerSettings *settings; | ||
42 | Package *activePackage; | ||
43 | PackageListItem *activePackageListItem; | ||
44 | QPopupMenu *popupMenu; | ||
45 | QPopupMenu *destsMenu; | ||
46 | public slots: | ||
47 | void showPopup(); | ||
48 | void changePackageDest( int ); | ||
49 | void setCurrent( QListViewItem* ); | ||
50 | void stopTimer( QListViewItem* ); | ||
51 | }; | ||
52 | |||
53 | #endif | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 45c89c5..f0992f5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,4 +1,3 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pkdesc.h" | ||
3 | #include "pksettings.h" | 2 | #include "pksettings.h" |
4 | #include "package.h" | 3 | #include "package.h" |
@@ -13,4 +12,5 @@ | |||
13 | #include <qmultilineedit.h> | 12 | #include <qmultilineedit.h> |
14 | #include <qstring.h> | 13 | #include <qstring.h> |
14 | #include <qcheckbox.h> | ||
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <qtextview.h> | 16 | #include <qtextview.h> |
@@ -58,4 +58,7 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
58 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
59 | 59 | ||
60 | // if (runwindow->forcedepends->isChecked()) | ||
61 | // cmd += " -force-depends "; | ||
62 | |||
60 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 63 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
61 | cmd += args; | 64 | cmd += args; |
@@ -72,5 +75,5 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
72 | out( "running:<br>\n"+cmd+"<br>\n" ); | 75 | out( "running:<br>\n"+cmd+"<br>\n" ); |
73 | QString redirect = "/tmp/oipkg.pipe"; | 76 | QString redirect = "/tmp/oipkg.pipe"; |
74 | cmd += " | tee "+redirect+" 2>&1"; | 77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
75 | pvDebug(2, "running >"+cmd+"<"); | 78 | pvDebug(2, "running >"+cmd+"<"); |
76 | r = system(cmd.latin1()); | 79 | r = system(cmd.latin1()); |
@@ -104,6 +107,4 @@ void PmIpkg::makeLinks(Package *pack) | |||
104 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | 107 | QString dest = settings->getDestinationUrlByName( pack->dest() ); |
105 | if (dest == "/" ) return; | 108 | if (dest == "/" ) return; |
106 | out( "<br>creating links<br>" ); | ||
107 | out("for package "+pack->name()+" in "+dest+"<br>"); | ||
108 | { | 109 | { |
109 | Config cfg( "oipkg", Config::User ); | 110 | Config cfg( "oipkg", Config::User ); |
@@ -123,4 +124,6 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) | |||
123 | return; | 124 | return; |
124 | }; | 125 | }; |
126 | out( "<br>creating links<br>" ); | ||
127 | out("for package "+packFileName+" in "+dest+"<br>"); | ||
125 | QTextStream t( &f ); | 128 | QTextStream t( &f ); |
126 | QString fp; | 129 | QString fp; |
@@ -135,4 +138,5 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) | |||
135 | void PmIpkg::processLinkDir( QString file, QString dest ) | 138 | void PmIpkg::processLinkDir( QString file, QString dest ) |
136 | { | 139 | { |
140 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); | ||
137 | if ( dest == "???" ) return; | 141 | if ( dest == "???" ) return; |
138 | QString destFile = file; | 142 | QString destFile = file; |
@@ -168,13 +172,9 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
168 | void PmIpkg::commit( PackageList pl ) | 172 | void PmIpkg::commit( PackageList pl ) |
169 | { | 173 | { |
170 | show( false ); | 174 | int sizecount = 0; |
171 | runwindow->outPut->setText(""); | ||
172 | out( "<h1>"+tr("Todo")+"</h1>\n"); | ||
173 | |||
174 | to_install.clear(); | 175 | to_install.clear(); |
175 | to_remove.clear(); | 176 | to_remove.clear(); |
176 | int sizecount = 0; | 177 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; |
177 | QString rem="<b>To remove:</b><br>\n"; | 178 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; |
178 | QString inst="<b>To install:</b><br>\n";; | ||
179 | pl.allPackages(); | 179 | pl.allPackages(); |
180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
@@ -186,5 +186,5 @@ void PmIpkg::commit( PackageList pl ) | |||
186 | to_install.append( pack ); | 186 | to_install.append( pack ); |
187 | sizecount += pack->size().toInt(); | 187 | sizecount += pack->size().toInt(); |
188 | inst += pack->name()+"\t(on "+pack->dest()+")<br>"; | 188 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; |
189 | } | 189 | } |
190 | if ( pack->toRemove() ) | 190 | if ( pack->toRemove() ) |
@@ -197,21 +197,75 @@ void PmIpkg::commit( PackageList pl ) | |||
197 | } | 197 | } |
198 | 198 | ||
199 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); | 199 | startDialog(); |
200 | 200 | ||
201 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); | 201 | } |
202 | |||
203 | void PmIpkg::startDialog() | ||
204 | { | ||
205 | QDialog *d = new QDialog(); | ||
206 | QGridLayout *RunWindowLayout = new QGridLayout( d ); | ||
207 | RunWindowLayout->setSpacing( 2 ); | ||
208 | RunWindowLayout->setMargin( 2 ); | ||
202 | 209 | ||
203 | runwindow->progress->setTotalSteps( sizecount ); | 210 | QHBoxLayout *buttons = new QHBoxLayout; |
211 | buttons->setSpacing( 6 ); | ||
212 | buttons->setMargin( 0 ); | ||
204 | 213 | ||
205 | connect( runwindow->doItButton, SIGNAL( clicked() ), | 214 | PackageListView *plv = new PackageListView(d, "install",settings); |
206 | SLOT( doIt() ) ); | 215 | RunWindowLayout->addWidget( plv, 1, 0 ); |
207 | connect( runwindow->installButton, SIGNAL( clicked() ), | 216 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
217 | { | ||
218 | plv->insertItem( new PackageListItem(plv, it,settings) ); | ||
219 | } | ||
220 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | ||
221 | { | ||
222 | plv->insertItem( new PackageListItem(plv, it,settings) ); | ||
223 | } | ||
224 | QPushButton *doItButton = new QPushButton( d, "doItButton" ); | ||
225 | doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); | ||
226 | QFont doItButton_font( doItButton->font() ); | ||
227 | doItButton_font.setPointSize( 8 ); | ||
228 | doItButton->setFont( doItButton_font ); | ||
229 | doItButton->setText( tr( "Do all " ) ); | ||
230 | doItButton->setAutoResize( FALSE ); | ||
231 | buttons->addWidget( doItButton ); | ||
232 | |||
233 | QPushButton *installButton = new QPushButton( d, "installButton" ); | ||
234 | QFont installButton_font( installButton->font() ); | ||
235 | installButton_font.setPointSize( 8 ); | ||
236 | installButton->setFont( installButton_font ); | ||
237 | installButton->setText( tr( "Install" ) ); | ||
238 | installButton->setAutoResize( TRUE ); | ||
239 | buttons->addWidget( installButton ); | ||
240 | |||
241 | QPushButton *removeButton = new QPushButton( d, "removeButton" ); | ||
242 | QFont removeButton_font( removeButton->font() ); | ||
243 | removeButton_font.setPointSize( 7 ); | ||
244 | removeButton->setFont( removeButton_font ); | ||
245 | removeButton->setText( tr( "Remove" ) ); | ||
246 | removeButton->setAutoResize( TRUE ); | ||
247 | buttons->addWidget( removeButton ); | ||
248 | |||
249 | QPushButton *cancelButton = new QPushButton( d, "cancelButton" ); | ||
250 | QFont cancelButton_font( cancelButton->font() ); | ||
251 | cancelButton_font.setPointSize( 8 ); | ||
252 | cancelButton->setFont( cancelButton_font ); | ||
253 | cancelButton->setText( tr( "Cancel" ) ); | ||
254 | cancelButton->setAutoResize( TRUE ); | ||
255 | buttons->addWidget( cancelButton ); | ||
256 | |||
257 | RunWindowLayout->addLayout( buttons, 3, 0 ); | ||
258 | |||
259 | connect( doItButton, SIGNAL( clicked() ), | ||
260 | this, SLOT( doIt() ) ); | ||
261 | connect( installButton, SIGNAL( clicked() ), | ||
208 | this, SLOT( install() ) ); | 262 | this, SLOT( install() ) ); |
209 | connect( runwindow->removeButton, SIGNAL( clicked() ), | 263 | connect( removeButton, SIGNAL( clicked() ), |
210 | this, SLOT( remove() ) ); | 264 | this, SLOT( remove() ) ); |
211 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | 265 | connect( cancelButton, SIGNAL( clicked() ), |
212 | runwindow, SLOT( close() ) ); | 266 | d, SLOT( close() ) ); |
213 | 267 | d->showMaximized(); | |
214 | runwindow->exec(); | 268 | d->exec(); |
215 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); | 269 | // d->close(); |
216 | } | 270 | } |
217 | 271 | ||
@@ -252,5 +306,5 @@ void PmIpkg::install() | |||
252 | { | 306 | { |
253 | 307 | ||
254 | if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) | 308 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) |
255 | { | 309 | { |
256 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 310 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
@@ -315,5 +369,5 @@ void PmIpkg::show(bool b) | |||
315 | runwindow->showMaximized(); | 369 | runwindow->showMaximized(); |
316 | showButtons(b); | 370 | showButtons(b); |
317 | if ( b ) | 371 | if ( !b ) |
318 | runwindow->progress->hide(); | 372 | runwindow->progress->hide(); |
319 | else | 373 | else |
@@ -323,26 +377,10 @@ void PmIpkg::show(bool b) | |||
323 | void PmIpkg::installFile(const QString &fileName) | 377 | void PmIpkg::installFile(const QString &fileName) |
324 | { | 378 | { |
325 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | ||
326 | show( false ); | ||
327 | runwindow->outPut->setText(""); | ||
328 | fileNameToInstall = fileName; | ||
329 | runwindow->doItButton->hide(); | ||
330 | runwindow->removeButton->hide(); | ||
331 | out("<b>"+tr("Install: ")+fileName); | ||
332 | connect( runwindow->installButton, SIGNAL( clicked() ), | ||
333 | this, SLOT( installFileName() ) ); | ||
334 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | ||
335 | runwindow, SLOT( close() ) ); | ||
336 | 379 | ||
337 | runwindow->exec(); | 380 | to_install.clear(); |
381 | to_remove.clear(); | ||
382 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | ||
383 | to_install.append( new Package(fileName,settings) ); | ||
384 | startDialog(); | ||
338 | } | 385 | } |
339 | 386 | ||
340 | void PmIpkg::installFileName() | ||
341 | { | ||
342 | if ( !QFile::exists( fileNameToInstall ) ) return; | ||
343 | out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>"); | ||
344 | runIpkg("install " + fileNameToInstall ); | ||
345 | if ( settings->createLinks() ) | ||
346 | linkPackage( fileNameToInstall, settings->getDestinationUrl() ); | ||
347 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); | ||
348 | } \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 8e06f4c..f70283e 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -34,4 +34,5 @@ private: | |||
34 | QString fileNameToInstall; | 34 | QString fileNameToInstall; |
35 | 35 | ||
36 | void startDialog(); | ||
36 | void makeLinks(Package*); | 37 | void makeLinks(Package*); |
37 | void linkPackage( QString, QString ); | 38 | void linkPackage( QString, QString ); |
@@ -43,5 +44,4 @@ public slots: | |||
43 | void doIt(); | 44 | void doIt(); |
44 | void install(); | 45 | void install(); |
45 | void installFileName(); | ||
46 | void remove(); | 46 | void remove(); |
47 | void installFile(const QString &fileName); | 47 | void installFile(const QString &fileName); |
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui index 52da408..8582ce8 100644 --- a/noncore/unsupported/oipkg/runwindow.ui +++ b/noncore/unsupported/oipkg/runwindow.ui | |||
@@ -13,5 +13,5 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>344</width> | 14 | <width>344</width> |
15 | <height>291</height> | 15 | <height>442</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
@@ -46,18 +46,5 @@ | |||
46 | </property> | 46 | </property> |
47 | </widget> | 47 | </widget> |
48 | <widget row="1" column="0" > | 48 | <widget row="3" column="0" > |
49 | <class>QTextView</class> | ||
50 | <property stdset="1"> | ||
51 | <name>name</name> | ||
52 | <cstring>outPut</cstring> | ||
53 | </property> | ||
54 | <property stdset="1"> | ||
55 | <name>font</name> | ||
56 | <font> | ||
57 | <pointsize>6</pointsize> | ||
58 | </font> | ||
59 | </property> | ||
60 | </widget> | ||
61 | <widget row="2" column="0" > | ||
62 | <class>QLayoutWidget</class> | 49 | <class>QLayoutWidget</class> |
63 | <property stdset="1"> | 50 | <property stdset="1"> |
@@ -99,5 +86,5 @@ | |||
99 | <property stdset="1"> | 86 | <property stdset="1"> |
100 | <name>autoResize</name> | 87 | <name>autoResize</name> |
101 | <bool>true</bool> | 88 | <bool>false</bool> |
102 | </property> | 89 | </property> |
103 | </widget> | 90 | </widget> |
@@ -167,4 +154,17 @@ | |||
167 | </hbox> | 154 | </hbox> |
168 | </widget> | 155 | </widget> |
156 | <widget row="1" column="0" > | ||
157 | <class>QTextView</class> | ||
158 | <property stdset="1"> | ||
159 | <name>name</name> | ||
160 | <cstring>outPut</cstring> | ||
161 | </property> | ||
162 | <property stdset="1"> | ||
163 | <name>font</name> | ||
164 | <font> | ||
165 | <pointsize>6</pointsize> | ||
166 | </font> | ||
167 | </property> | ||
168 | </widget> | ||
169 | </grid> | 169 | </grid> |
170 | </widget> | 170 | </widget> |