-rw-r--r-- | noncore/unsupported/oipkg/packagelistdoclnk.cpp | 9 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistdoclnk.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 13 |
3 files changed, 21 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index 575ac62..5787fdf 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp | |||
@@ -1,36 +1,43 @@ | |||
1 | 1 | ||
2 | #include "packagelistdoclnk.h" | 2 | #include "packagelistdoclnk.h" |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | #include <qpe/config.h> | ||
5 | #include <qlist.h> | 6 | #include <qlist.h> |
6 | 7 | ||
7 | #include "package.h" | 8 | #include "package.h" |
8 | #include "pksettings.h" | 9 | #include "pksettings.h" |
9 | 10 | ||
10 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s) | 11 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s) |
11 | : PackageList(s) | 12 | : PackageList(s) |
12 | { | 13 | { |
13 | PackageListDocLnk(); | 14 | PackageListDocLnk(); |
14 | } | 15 | } |
15 | 16 | ||
16 | PackageListDocLnk::PackageListDocLnk() | 17 | PackageListDocLnk::PackageListDocLnk() |
17 | : PackageList() | 18 | : PackageList() |
18 | { | 19 | { |
19 | doclnkset = new DocLnkSet("/mnt/nfs/ipk","application/ipkg"); | 20 | Config cfg( "oipkg", Config::User ); |
21 | cfg.setGroup( "Common" ); | ||
22 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); | ||
23 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); | ||
20 | } | 24 | } |
21 | 25 | ||
22 | PackageListDocLnk::~PackageListDocLnk() | 26 | PackageListDocLnk::~PackageListDocLnk() |
23 | { | 27 | { |
28 | Config cfg( "oipkg", Config::User ); | ||
29 | cfg.setGroup( "Common" ); | ||
30 | cfg.writeEntry( "docLnkDir", docLnkDir ); | ||
24 | } | 31 | } |
25 | 32 | ||
26 | 33 | ||
27 | 34 | ||
28 | void PackageListDocLnk::update() | 35 | void PackageListDocLnk::update() |
29 | { | 36 | { |
30 | pvDebug(2,"PackageListDocLnk::update "); | 37 | pvDebug(2,"PackageListDocLnk::update "); |
31 | QList<DocLnk> packlist = doclnkset->children(); | 38 | QList<DocLnk> packlist = doclnkset->children(); |
32 | for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) | 39 | for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) |
33 | { | 40 | { |
34 | insertPackage( new Package(pack->file(), settings) ); | 41 | insertPackage( new Package(pack->file(), settings) ); |
35 | } | 42 | } |
36 | } | 43 | } |
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.h b/noncore/unsupported/oipkg/packagelistdoclnk.h index 3864ace..fe73658 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.h +++ b/noncore/unsupported/oipkg/packagelistdoclnk.h | |||
@@ -1,22 +1,23 @@ | |||
1 | #ifndef PACKAGELISTDOCLNK_H | 1 | #ifndef PACKAGELISTDOCLNK_H |
2 | #define PACKAGELISTDOCLNK_H | 2 | #define PACKAGELISTDOCLNK_H |
3 | 3 | ||
4 | #include "packagelist.h" | 4 | #include "packagelist.h" |
5 | #include "debug.h" | 5 | #include "debug.h" |
6 | 6 | ||
7 | class DocLnkSet; | 7 | class DocLnkSet; |
8 | 8 | ||
9 | class PackageListDocLnk : public PackageList | 9 | class PackageListDocLnk : public PackageList |
10 | { | 10 | { |
11 | public: | 11 | public: |
12 | PackageListDocLnk(); | 12 | PackageListDocLnk(); |
13 | PackageListDocLnk( PackageManagerSettings* s); | 13 | PackageListDocLnk( PackageManagerSettings* s); |
14 | virtual ~PackageListDocLnk(); | 14 | virtual ~PackageListDocLnk(); |
15 | public slots: | 15 | public slots: |
16 | void update(); | 16 | void update(); |
17 | private: | 17 | private: |
18 | DocLnkSet *doclnkset; | 18 | DocLnkSet *doclnkset; |
19 | QString docLnkDir; | ||
19 | }; | 20 | }; |
20 | 21 | ||
21 | 22 | ||
22 | #endif | 23 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index b6b520b..70aa48a 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,86 +1,97 @@ | |||
1 | #include "packagelistview.h" | 1 | #include "packagelistview.h" |
2 | 2 | ||
3 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | 5 | ||
6 | #include "packagelistitem.h" | 6 | #include "packagelistitem.h" |
7 | #include "pksettings.h" | 7 | #include "pksettings.h" |
8 | 8 | ||
9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) |
10 | : QListView(p,n) | 10 | : QListView(p,n) |
11 | { | 11 | { |
12 | settings = s; | 12 | settings = s; |
13 | popupMenu = new QPopupMenu( this ); | 13 | popupMenu = new QPopupMenu( this ); |
14 | destsMenu = new QPopupMenu( popupMenu ); | 14 | destsMenu = new QPopupMenu( popupMenu ); |
15 | popupTimer = new QTimer( this ); | 15 | popupTimer = new QTimer( this ); |
16 | setSelectionMode(QListView::NoSelection); | 16 | setSelectionMode(QListView::NoSelection); |
17 | addColumn( tr("Package") ); | 17 | addColumn( tr("Package") ); |
18 | setRootIsDecorated( true ); | 18 | setRootIsDecorated( true ); |
19 | 19 | ||
20 | connect( popupTimer, SIGNAL(timeout()), | 20 | connect( popupTimer, SIGNAL(timeout()), |
21 | this, SLOT(showPopup()) ); | 21 | this, SLOT(showPopup()) ); |
22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
23 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 23 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
25 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 25 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | //PackageListView::~PackageListView() | 29 | //PackageListView::~PackageListView() |
30 | //{ | 30 | //{ |
31 | //} | 31 | //} |
32 | 32 | ||
33 | void PackageListView::setCurrent( QListViewItem* p ) | 33 | void PackageListView::setCurrent( QListViewItem* p ) |
34 | { | 34 | { |
35 | if ( !p ) return; | 35 | if ( !p ) return; |
36 | activePackageListItem = (PackageListItem*)p; | 36 | activePackageListItem = (PackageListItem*)p; |
37 | activePackage = activePackageListItem->getPackage(); | 37 | activePackage = activePackageListItem->getPackage(); |
38 | if (!activePackage) return; | 38 | if (!activePackage) |
39 | { | ||
40 | // QDictIterator<QCheckListItem> it( rootItems ); | ||
41 | // while ( it.current() ) | ||
42 | // { | ||
43 | // if ( it.current()==p ) | ||
44 | // pvDebug(2,"current item"); | ||
45 | // ++it; | ||
46 | // } | ||
47 | |||
48 | return; | ||
49 | } | ||
39 | popupTimer->start( 750, true ); | 50 | popupTimer->start( 750, true ); |
40 | } | 51 | } |
41 | 52 | ||
42 | 53 | ||
43 | void PackageListView::showPopup() | 54 | void PackageListView::showPopup() |
44 | { | 55 | { |
45 | popupMenu->clear(); | 56 | popupMenu->clear(); |
46 | destsMenu->clear(); | 57 | destsMenu->clear(); |
47 | 58 | ||
48 | QAction *popupAction; | 59 | QAction *popupAction; |
49 | if ( !activePackage->installed() ) | 60 | if ( !activePackage->installed() ) |
50 | { | 61 | { |
51 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 62 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); |
52 | QStringList dests = settings->getDestinationNames(); | 63 | QStringList dests = settings->getDestinationNames(); |
53 | QString ad = settings->getDestinationName(); | 64 | QString ad = settings->getDestinationName(); |
54 | for (uint i = 0; i < dests.count(); i++ ) | 65 | for (uint i = 0; i < dests.count(); i++ ) |
55 | { | 66 | { |
56 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 67 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
57 | popupAction->addTo( destsMenu ); | 68 | popupAction->addTo( destsMenu ); |
58 | if ( dests[i] == ad && activePackage->toInstall() ) | 69 | if ( dests[i] == ad && activePackage->toInstall() ) |
59 | { | 70 | { |
60 | popupAction->setToggleAction( true ); | 71 | popupAction->setToggleAction( true ); |
61 | popupAction->setOn(true); | 72 | popupAction->setOn(true); |
62 | }; | 73 | }; |
63 | } | 74 | } |
64 | connect( destsMenu, SIGNAL( activated( int ) ), | 75 | connect( destsMenu, SIGNAL( activated( int ) ), |
65 | this, SLOT( changePackageDest( int ) ) ); | 76 | this, SLOT( changePackageDest( int ) ) ); |
66 | }else{ | 77 | }else{ |
67 | popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); | 78 | popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); |
68 | popupAction->addTo( popupMenu ); | 79 | popupAction->addTo( popupMenu ); |
69 | connect( popupAction, SIGNAL( activated() ), | 80 | connect( popupAction, SIGNAL( activated() ), |
70 | this , SLOT( toggleProcess() ) ); | 81 | this , SLOT( toggleProcess() ) ); |
71 | popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); | 82 | popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); |
72 | popupAction->addTo( popupMenu ); | 83 | popupAction->addTo( popupMenu ); |
73 | popupAction->setEnabled( false ); | 84 | popupAction->setEnabled( false ); |
74 | } | 85 | } |
75 | popupMenu->popup( QCursor::pos() ); | 86 | popupMenu->popup( QCursor::pos() ); |
76 | } | 87 | } |
77 | 88 | ||
78 | void PackageListView::stopTimer( QListViewItem* ) | 89 | void PackageListView::stopTimer( QListViewItem* ) |
79 | { | 90 | { |
80 | popupTimer->stop(); | 91 | popupTimer->stop(); |
81 | } | 92 | } |
82 | 93 | ||
83 | 94 | ||
84 | void PackageListView::changePackageDest( int i ) | 95 | void PackageListView::changePackageDest( int i ) |
85 | { | 96 | { |
86 | activePackage->setDest( destsMenu->text(i) ); | 97 | activePackage->setDest( destsMenu->text(i) ); |