summaryrefslogtreecommitdiff
authortille <tille>2002-05-02 19:53:56 (UTC)
committer tille <tille>2002-05-02 19:53:56 (UTC)
commit7833ad013239d04669edd54041287563a47728ec (patch) (unidiff)
tree9b733caf7880a052580ecbb496cb2914e17a2a69
parentce6758eccada41f5c3fef13e6b4808c525213bee (diff)
downloadopie-7833ad013239d04669edd54041287563a47728ec.zip
opie-7833ad013239d04669edd54041287563a47728ec.tar.gz
opie-7833ad013239d04669edd54041287563a47728ec.tar.bz2
fixed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp9
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.h1
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp13
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
10PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s) 11PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s)
11 : PackageList(s) 12 : PackageList(s)
12{ 13{
13 PackageListDocLnk(); 14 PackageListDocLnk();
14} 15}
15 16
16PackageListDocLnk::PackageListDocLnk() 17PackageListDocLnk::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
22PackageListDocLnk::~PackageListDocLnk() 26PackageListDocLnk::~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
28void PackageListDocLnk::update() 35void 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
7class DocLnkSet; 7class DocLnkSet;
8 8
9class PackageListDocLnk : public PackageList 9class PackageListDocLnk : public PackageList
10{ 10{
11public: 11public:
12 PackageListDocLnk(); 12 PackageListDocLnk();
13 PackageListDocLnk( PackageManagerSettings* s); 13 PackageListDocLnk( PackageManagerSettings* s);
14 virtual ~PackageListDocLnk(); 14 virtual ~PackageListDocLnk();
15public slots: 15public slots:
16 void update(); 16 void update();
17private: 17private:
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,133 +1,144 @@
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
9PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) 9PackageListView::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
33void PackageListView::setCurrent( QListViewItem* p ) 33void 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
43void PackageListView::showPopup() 54void 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
78void PackageListView::stopTimer( QListViewItem* ) 89void PackageListView::stopTimer( QListViewItem* )
79{ 90{
80 popupTimer->stop(); 91 popupTimer->stop();
81} 92}
82 93
83 94
84void PackageListView::changePackageDest( int i ) 95void PackageListView::changePackageDest( int i )
85{ 96{
86 activePackage->setDest( destsMenu->text(i) ); 97 activePackage->setDest( destsMenu->text(i) );
87 activePackage->setOn(); 98 activePackage->setOn();
88 activePackage->setLink( settings->createLinks() ); 99 activePackage->setLink( settings->createLinks() );
89 activePackageListItem->displayDetails(); 100 activePackageListItem->displayDetails();
90} 101}
91 102
92void PackageListView::toggleProcess() 103void PackageListView::toggleProcess()
93{ 104{
94 activePackage->toggleProcess() ; 105 activePackage->toggleProcess() ;
95 activePackageListItem->displayDetails(); 106 activePackageListItem->displayDetails();
96} 107}
97 108
98void PackageListView::display() 109void PackageListView::display()
99{ 110{
100 QDictIterator<PackageList> list( PackageLists ); 111 QDictIterator<PackageList> list( PackageLists );
101 PackageList *packlist; 112 PackageList *packlist;
102 Package *pack; 113 Package *pack;
103 PackageListItem *item; 114 PackageListItem *item;
104 QCheckListItem *rootItem; 115 QCheckListItem *rootItem;
105 QListViewItem* it; 116 QListViewItem* it;
106 QListViewItem* itdel; 117 QListViewItem* itdel;
107 while ( list.current() ) { 118 while ( list.current() ) {
108 packlist = list.current(); 119 packlist = list.current();
109 rootItem = rootItems.find( list.currentKey() ); 120 rootItem = rootItems.find( list.currentKey() );
110 //rootItem->clear(); 121 //rootItem->clear();
111 it=rootItem->firstChild(); 122 it=rootItem->firstChild();
112 while ( it ) 123 while ( it )
113 { 124 {
114 itdel = it; 125 itdel = it;
115 it = it->nextSibling(); 126 it = it->nextSibling();
116 delete itdel; 127 delete itdel;
117 } 128 }
118 pack = packlist->first(); 129 pack = packlist->first();
119 while( pack ) 130 while( pack )
120 { 131 {
121 item = new PackageListItem( rootItem, pack, settings ); 132 item = new PackageListItem( rootItem, pack, settings );
122 pack = packlist->next(); 133 pack = packlist->next();
123 } 134 }
124 ++list; 135 ++list;
125 } 136 }
126} 137}
127 138
128void PackageListView::addList( QString n, PackageList* pl) 139void PackageListView::addList( QString n, PackageList* pl)
129{ 140{
130 PackageLists.insert(n, pl); 141 PackageLists.insert(n, pl);
131 QCheckListItem *item = new QCheckListItem(this,n); 142 QCheckListItem *item = new QCheckListItem(this,n);
132 rootItems.insert(n, item); 143 rootItems.insert(n, item);
133} 144}