summaryrefslogtreecommitdiff
authortille <tille>2002-04-27 21:02:53 (UTC)
committer tille <tille>2002-04-27 21:02:53 (UTC)
commit69e271e44d23befc74a96a98708ddb6ec754a4b6 (patch) (unidiff)
tree6f8300d8858d2c7659eb90066b58b302a2863e43
parentacdc33336307e48ac7089b146006fe7b36e321a5 (diff)
downloadopie-69e271e44d23befc74a96a98708ddb6ec754a4b6.zip
opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.gz
opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.bz2
setDocument working and some changes in install gui
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO3
-rw-r--r--noncore/unsupported/oipkg/debug.h2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp145
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h22
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro5
-rw-r--r--noncore/unsupported/oipkg/package.cpp56
-rw-r--r--noncore/unsupported/oipkg/package.h4
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp91
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h53
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp134
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h2
-rw-r--r--noncore/unsupported/oipkg/runwindow.ui32
12 files changed, 340 insertions, 209 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
@@ -1,10 +1,11 @@
1* setDocument function 1* setDocument function
2* Settings Class 2* Settings Class
3* tr() ;) 3* tr() ;)
4* Dialog to display ipkg output live 4* Dialog to display ipkg output live
5* parse "to install" and "to remove" from status 5* parse "to install" and "to remove" from status
6* install local file 6* install local file
7* qcop 7* qcop
8* error handling 8* error handling
9* manage links 9* manage links
10* dependency checking \ No newline at end of file 10* dependency checking
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
@@ -1,21 +1,21 @@
1#ifndef _DEBUG_H_ 1#ifndef _DEBUG_H_
2#define _DEBUG_H_ 2#define _DEBUG_H_
3 3
4#include <stdio.h> 4#include <stdio.h>
5 5
6extern int debugLevel; 6extern int debugLevel;
7 7
8#define HACK 8#define HACK
9 9
10#define NEWLAYOUT 10#define NEWLAYOUT
11 11
12#define pvDebug(I, S) \ 12#define pvDebug(I, S) \
13if ( debugLevel < 3 ) \ 13if ( debugLevel < 3 ) \
14{ \ 14{ \
15 if ( I <= debugLevel ) qDebug(S);\ 15 if ( I <= debugLevel ) qDebug(S);\
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
21#endif \ No newline at end of file 21#endif \ No newline at end of file
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
@@ -1,436 +1,357 @@
1// adadpted form qpe/qipkg 1// adadpted form qpe/qipkg
2 2
3 3
4#include "mainwindow.h" 4#include "mainwindow.h"
5 5
6#include <qpe/qpemenubar.h> 6#include <qpe/qpemenubar.h>
7#include <qpe/qpemessagebox.h> 7#include <qpe/qpemessagebox.h>
8#include <qpe/resource.h> 8#include <qpe/resource.h>
9#include <qpe/qpetoolbar.h> 9#include <qpe/qpetoolbar.h>
10#include <qpe/qcopenvelope_qws.h> 10#include <qpe/qcopenvelope_qws.h>
11#include <qaction.h> 11#include <qaction.h>
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qpopupmenu.h> 13#include <qpopupmenu.h>
14#include <qtoolbutton.h> 14#include <qtoolbutton.h>
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>
19#include <qlineedit.h> 20#include <qlineedit.h>
20#include <qtabwidget.h> 21#include <qtabwidget.h>
21#include <qcombobox.h> 22#include <qcombobox.h>
22#include <qlayout.h> 23#include <qlayout.h>
23 24
24#include "pksettingsbase.h" 25#include "pksettingsbase.h"
25#include "packagelistitem.h" 26#include "packagelistitem.h"
26 27
27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 28MainWindow::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 );
37 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 39 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
38 this, SLOT(receive(const QCString&, const QByteArray&)) ); 40 this, SLOT(receive(const QCString&, const QByteArray&)) );
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 );
74 packageList.setSettings( settings ); 50 packageList.setSettings( settings );
75 getList(); 51 getList();
76 setSections(); 52 setSections();
77 setSubSections(); 53 setSubSections();
78 displayList(); 54 displayList();
79} 55}
80 56
81void MainWindow::makeMenu() 57void MainWindow::makeMenu()
82{ 58{
83 59
84 QPEToolBar *toolBar = new QPEToolBar( this ); 60 QPEToolBar *toolBar = new QPEToolBar( this );
85 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 61 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
86 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 62 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
87 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 63 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
88 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 64 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
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 );
98 menuBar->insertItem( tr( "Package" ), srvMenu ); 69 menuBar->insertItem( tr( "Package" ), srvMenu );
99 menuBar->insertItem( tr( "View" ), viewMenu ); 70 menuBar->insertItem( tr( "View" ), viewMenu );
100 menuBar->insertItem( tr( "Settings" ), cfgMenu ); 71 menuBar->insertItem( tr( "Settings" ), cfgMenu );
101 // menuBar->insertItem( tr( "Sections" ), sectMenu ); 72 // menuBar->insertItem( tr( "Sections" ), sectMenu );
102 73
103 QLabel *spacer = new QLabel( "", toolBar ); 74 QLabel *spacer = new QLabel( "", toolBar );
104 spacer->setBackgroundColor( toolBar->backgroundColor() ); 75 spacer->setBackgroundColor( toolBar->backgroundColor() );
105 toolBar->setStretchableWidget( spacer ); 76 toolBar->setStretchableWidget( spacer );
106 77
107 78
108 runAction = new QAction( tr( "Apply" ), 79 runAction = new QAction( tr( "Apply" ),
109 Resource::loadPixmap( "oipkg/install" ), 80 Resource::loadPixmap( "oipkg/install" ),
110 QString::null, 0, this, 0 ); 81 QString::null, 0, this, 0 );
111 connect( runAction, SIGNAL( activated() ), 82 connect( runAction, SIGNAL( activated() ),
112 this, SLOT( runIpkg() ) ); 83 this, SLOT( runIpkg() ) );
113 runAction->addTo( toolBar ); 84 runAction->addTo( toolBar );
114 runAction->addTo( srvMenu ); 85 runAction->addTo( srvMenu );
115 86
116 srvMenu->insertSeparator (); 87 srvMenu->insertSeparator ();
117 88
118 updateAction = new QAction( tr( "Update" ), 89 updateAction = new QAction( tr( "Update" ),
119 Resource::loadIconSet( "oipkg/update" ), 90 Resource::loadIconSet( "oipkg/update" ),
120 QString::null, 0, this, 0 ); 91 QString::null, 0, this, 0 );
121 connect( updateAction, SIGNAL( activated() ), 92 connect( updateAction, SIGNAL( activated() ),
122 this , SLOT( updateList() ) ); 93 this , SLOT( updateList() ) );
123 updateAction->addTo( toolBar ); 94 updateAction->addTo( toolBar );
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;
135 107
136 cfgact = new QAction( tr( "Setups" ), 108 cfgact = new QAction( tr( "Setups" ),
137 // Resource::loadIconSet( "" ), 109 // Resource::loadIconSet( "" ),
138 QString::null, 0, this, 0 ); 110 QString::null, 0, this, 0 );
139 connect( cfgact, SIGNAL( activated() ), 111 connect( cfgact, SIGNAL( activated() ),
140 SLOT( showSettings() ) ); 112 SLOT( showSettings() ) );
141 cfgact->addTo( cfgMenu ); 113 cfgact->addTo( cfgMenu );
142 114
143 cfgact = new QAction( tr( "Servers" ), 115 cfgact = new QAction( tr( "Servers" ),
144 // Resource::loadIconSet( "" ), 116 // Resource::loadIconSet( "" ),
145 QString::null, 0, this, 0 ); 117 QString::null, 0, this, 0 );
146 connect( cfgact, SIGNAL( activated() ), 118 connect( cfgact, SIGNAL( activated() ),
147 SLOT( showSettingsSrv() ) ); 119 SLOT( showSettingsSrv() ) );
148 cfgact->addTo( cfgMenu ); 120 cfgact->addTo( cfgMenu );
149 cfgact = new QAction( tr( "Destinations" ), 121 cfgact = new QAction( tr( "Destinations" ),
150 //Resource::loadIconSet( "" ), 122 //Resource::loadIconSet( "" ),
151 QString::null, 0, this, 0 ); 123 QString::null, 0, this, 0 );
152 connect( cfgact, SIGNAL( activated() ), 124 connect( cfgact, SIGNAL( activated() ),
153 SLOT( showSettingsDst() ) ); 125 SLOT( showSettingsDst() ) );
154 cfgact->addTo( cfgMenu ); 126 cfgact->addTo( cfgMenu );
155 127
156 QAction *a; 128 QAction *a;
157 129
158 sectionBar = new QPEToolBar( this ); 130 sectionBar = new QPEToolBar( this );
159 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 131 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
160 sectionBar->setHorizontalStretchable( true ); 132 sectionBar->setHorizontalStretchable( true );
161 QLabel *label = new QLabel( tr("Section: "), sectionBar ); 133 QLabel *label = new QLabel( tr("Section: "), sectionBar );
162 label->setBackgroundColor( sectionBar->backgroundColor() ); 134 label->setBackgroundColor( sectionBar->backgroundColor() );
163 sectionBar->setStretchableWidget( label ); 135 sectionBar->setStretchableWidget( label );
164 section = new QComboBox( false, sectionBar ); 136 section = new QComboBox( false, sectionBar );
165// section->setBackgroundMode( PaletteBackground ); 137// section->setBackgroundMode( PaletteBackground );
166 label = new QLabel( " / ", sectionBar ); 138 label = new QLabel( " / ", sectionBar );
167 label->setBackgroundColor( sectionBar->backgroundColor() ); 139 label->setBackgroundColor( sectionBar->backgroundColor() );
168 subsection = new QComboBox( false, sectionBar ); 140 subsection = new QComboBox( false, sectionBar );
169 141
170 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 142 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
171 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 143 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
172 a->addTo( sectionBar ); 144 a->addTo( sectionBar );
173 145
174 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 146 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
175 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 147 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
176 sectionAction->setToggleAction( true ); 148 sectionAction->setToggleAction( true );
177 sectionAction->setOn( true ); 149 sectionAction->setOn( true );
178 sectionAction->addTo( viewMenu ); 150 sectionAction->addTo( viewMenu );
179 151
180 findBar = new QPEToolBar(this); 152 findBar = new QPEToolBar(this);
181 addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); 153 addToolBar( findBar, "Search", QMainWindow::Top, TRUE );
182 label = new QLabel( tr("Filter: "), findBar ); 154 label = new QLabel( tr("Filter: "), findBar );
183 label->setBackgroundColor( findBar->backgroundColor() ); 155 label->setBackgroundColor( findBar->backgroundColor() );
184 findBar->setHorizontalStretchable( TRUE ); 156 findBar->setHorizontalStretchable( TRUE );
185 findEdit = new QLineEdit( findBar, "findEdit" ); 157 findEdit = new QLineEdit( findBar, "findEdit" );
186 findBar->setStretchableWidget( findEdit ); 158 findBar->setStretchableWidget( findEdit );
187 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 159 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
188 this, SLOT( displayList() ) ); 160 this, SLOT( displayList() ) );
189 161
190 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 162 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
191 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 163 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
192 a->addTo( findBar ); 164 a->addTo( findBar );
193 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); 165 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
194 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 166 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
195 findAction->setToggleAction( true ); 167 findAction->setToggleAction( true );
196 findAction->setOn( true ); 168 findAction->setOn( true );
197 findAction->addTo( viewMenu ); 169 findAction->addTo( viewMenu );
198 170
199 #ifdef NEW 171 #ifdef NEW
200 Config cfg( "oipkg", Config::User ); 172 Config cfg( "oipkg", Config::User );
201 cfg.setGroup( "Setting_" + QString::number( setting ) ); 173 cfg.setGroup( "Setting_" + QString::number( setting ) );
202 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); 174 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) );
203 findShow(bool b) 175 findShow(bool b)
204 sectionShow(bool b) 176 sectionShow(bool b)
205 #endif 177 #endif
206} 178}
207 179
208MainWindow::~MainWindow() 180MainWindow::~MainWindow()
209{ 181{
210} 182}
211 183
212void MainWindow::runIpkg() 184void MainWindow::runIpkg()
213{ 185{
214 ipkg->commit( packageList ); 186 ipkg->commit( packageList );
215 // ##### If we looked in the list of files, we could send out accurate 187 // ##### If we looked in the list of files, we could send out accurate
216 // ##### messages. But we don't bother yet, and just do an "all". 188 // ##### messages. But we don't bother yet, and just do an "all".
217 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 189 QCopEnvelope e("QPE/System", "linkChanged(QString)");
218 QString lf = QString::null; 190 QString lf = QString::null;
219 e << lf; 191 e << lf;
220 displayList(); 192 displayList();
221} 193}
222 194
223void MainWindow::updateList() 195void MainWindow::updateList()
224{ 196{
225 QTimer *t = new QTimer( this ); 197 QTimer *t = new QTimer( this );
226 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 198 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
227 t->start( 0, false ); 199 t->start( 0, false );
228 packageList.clear(); 200 packageList.clear();
229 ipkg->update(); 201 ipkg->update();
230 getList(); 202 getList();
231 t->stop(); 203 t->stop();
232} 204}
233 205
234void MainWindow::getList() 206void MainWindow::getList()
235{ 207{
236 packageList.update(); 208 packageList.update();
237 displayList(); 209 displayList();
238} 210}
239 211
240void MainWindow::filterList() 212void MainWindow::filterList()
241{ 213{
242 QString f = ""; 214 QString f = "";
243 if ( findAction->isOn() ) f = findEdit->text(); 215 if ( findAction->isOn() ) f = findEdit->text();
244 packageList.filterPackages( f ); 216 packageList.filterPackages( f );
245} 217}
246 218
247void MainWindow::displayList() 219void MainWindow::displayList()
248{ 220{
249 filterList(); 221 filterList();
250 listViewPackages->clear(); 222 listViewPackages->clear();
251 Package *pack = packageList.first(); 223 Package *pack = packageList.first();
252 while( pack ) 224 while( pack )
253 { 225 {
254 if ( pack && (pack->name() != "") ) 226 if ( pack && (pack->name() != "") )
255 listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); 227 listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
256 pack = packageList.next(); 228 pack = packageList.next();
257 } 229 }
258} 230}
259 231
260void MainWindow::sectionChanged() 232void MainWindow::sectionChanged()
261{ 233{
262 disconnect( section, SIGNAL( activated(int) ), 234 disconnect( section, SIGNAL( activated(int) ),
263 this, SLOT( sectionChanged() ) ); 235 this, SLOT( sectionChanged() ) );
264 disconnect( subsection, SIGNAL(activated(int) ), 236 disconnect( subsection, SIGNAL(activated(int) ),
265 this, SLOT( subSectionChanged() ) ); 237 this, SLOT( subSectionChanged() ) );
266 subsection->clear(); 238 subsection->clear();
267 packageList.setSection( section->currentText() ); 239 packageList.setSection( section->currentText() );
268 setSubSections(); 240 setSubSections();
269 connect( section, SIGNAL( activated(int) ), 241 connect( section, SIGNAL( activated(int) ),
270 this, SLOT( sectionChanged() ) ); 242 this, SLOT( sectionChanged() ) );
271 connect( subsection, SIGNAL(activated(int) ), 243 connect( subsection, SIGNAL(activated(int) ),
272 this, SLOT( subSectionChanged() ) ); 244 this, SLOT( subSectionChanged() ) );
273 displayList(); 245 displayList();
274} 246}
275 247
276void MainWindow::subSectionChanged() 248void MainWindow::subSectionChanged()
277{ 249{
278 disconnect( section, SIGNAL( activated(int) ), 250 disconnect( section, SIGNAL( activated(int) ),
279 this, SLOT( sectionChanged() ) ); 251 this, SLOT( sectionChanged() ) );
280 disconnect( subsection, SIGNAL(activated(int) ), 252 disconnect( subsection, SIGNAL(activated(int) ),
281 this, SLOT( subSectionChanged() ) ); 253 this, SLOT( subSectionChanged() ) );
282 packageList.setSubSection( subsection->currentText() ); 254 packageList.setSubSection( subsection->currentText() );
283 connect( section, SIGNAL( activated(int) ), 255 connect( section, SIGNAL( activated(int) ),
284 this, SLOT( sectionChanged() ) ); 256 this, SLOT( sectionChanged() ) );
285 connect( subsection, SIGNAL(activated(int) ), 257 connect( subsection, SIGNAL(activated(int) ),
286 this, SLOT( subSectionChanged() ) ); 258 this, SLOT( subSectionChanged() ) );
287 displayList(); 259 displayList();
288} 260}
289 261
290void MainWindow::setSections() 262void MainWindow::setSections()
291{ 263{
292 section->clear(); 264 section->clear();
293 section->insertStringList( packageList.getSections() ); 265 section->insertStringList( packageList.getSections() );
294} 266}
295 267
296void MainWindow::setSubSections() 268void MainWindow::setSubSections()
297{ 269{
298 subsection->clear(); 270 subsection->clear();
299 subsection->insertStringList( packageList.getSubSections() ); 271 subsection->insertStringList( packageList.getSubSections() );
300} 272}
301 273
302 274
303void MainWindow::showSettings() 275void MainWindow::showSettings()
304{ 276{
305 if ( settings->showDialog( 0 ) ) 277 if ( settings->showDialog( 0 ) )
306 updateList(); 278 updateList();
307} 279}
308void MainWindow::showSettingsSrv() 280void MainWindow::showSettingsSrv()
309{ 281{
310 if ( settings->showDialog( 1 ) ) 282 if ( settings->showDialog( 1 ) )
311 updateList(); 283 updateList();
312} 284}
313void MainWindow::showSettingsDst() 285void MainWindow::showSettingsDst()
314{ 286{
315 if ( settings->showDialog( 2 ) ) 287 if ( settings->showDialog( 2 ) )
316 updateList(); 288 updateList();
317} 289}
318 290
319
320void 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
343void MainWindow::toggleActivePackage()
344{
345 activePackage->toggleProcess();
346 if ( details ) details->close();
347}
348
349void 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
358void MainWindow::sectionShow(bool b) 291void MainWindow::sectionShow(bool b)
359{ 292{
360 if (b) sectionBar->show(); 293 if (b) sectionBar->show();
361 else sectionBar->hide(); 294 else sectionBar->hide();
362 sectionAction->setOn( b ); 295 sectionAction->setOn( b );
363} 296}
364 297
365void MainWindow::sectionClose() 298void MainWindow::sectionClose()
366{ 299{
367 sectionAction->setOn( false ); 300 sectionAction->setOn( false );
368} 301}
369 302
370void MainWindow::findShow(bool b) 303void MainWindow::findShow(bool b)
371{ 304{
372 if (b) findBar->show(); 305 if (b) findBar->show();
373 else findBar->hide(); 306 else findBar->hide();
374 findAction->setOn( b ); 307 findAction->setOn( b );
375} 308}
376 309
377void MainWindow::findClose() 310void MainWindow::findClose()
378{ 311{
379 findAction->setOn( false ); 312 findAction->setOn( false );
380} 313}
381 314
382void MainWindow::rotateUpdateIcon() 315void MainWindow::rotateUpdateIcon()
383{ 316{
384 pvDebug(2, "MainWindow::rotateUpdateIcon"); 317 pvDebug(2, "MainWindow::rotateUpdateIcon");
385 if ( updateIcon ) 318 if ( updateIcon )
386 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); 319 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
387 else 320 else
388 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); 321 updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) );
389 updateIcon = !updateIcon; 322 updateIcon = !updateIcon;
390} 323}
391 324
392void 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
410void 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
418void MainWindow::stopTimer( QListViewItem* ) 326void 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
424void MainWindow::setDocument(const QString &fileName) 337void 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
429void MainWindow::receive(const QCString &msg, const QByteArray &arg) 350void 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
@@ -1,88 +1,76 @@
1#ifndef MAINWINDOW_H 1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H 2#define MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qaction.h> 5#include <qaction.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qpopupmenu.h> 7#include <qpopupmenu.h>
8 8
9#include "packagelist.h" 9#include "packagelist.h"
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
14class QComboBox; 14class QComboBox;
15class QPEToolBar; 15class QPEToolBar;
16class QLineEdit; 16class QLineEdit;
17class QListView;
18class PackageListItem; 17class PackageListItem;
19class QCopChannel; 18class QCopChannel;
20 19
21class MainWindow : public QMainWindow 20class MainWindow : public QMainWindow
22{ 21{
23 Q_OBJECT 22 Q_OBJECT
24 23
25 24
26public: 25public:
27 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 26 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
28 ~MainWindow(); 27 ~MainWindow();
29 28
30 QCopChannel *channel; 29 QCopChannel *channel;
31 30
32protected slots: 31protected slots:
33 void runIpkg(); 32 void runIpkg();
34 void getList(); 33 void getList();
35 void updateList(); 34 void updateList();
36 void displayList(); 35 void displayList();
37 void subSectionChanged(); 36 void subSectionChanged();
38 void sectionChanged(); 37 void sectionChanged();
39 void showSettings(); 38 void showSettings();
40 void showSettingsSrv(); 39 void showSettingsSrv();
41 void showSettingsDst(); 40 void showSettingsDst();
42 void setDocument (const QString &);
43 41
44public slots: 42public 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);
50 void findClose(); 45 void findClose();
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
58private: 51private:
59 void makeMenu(); 52 void makeMenu();
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;
71 QAction *updateAction; 63 QAction *updateAction;
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;
77 QPEToolBar *sectionBar; 69 QPEToolBar *sectionBar;
78 QComboBox *section; 70 QComboBox *section;
79 QComboBox *subsection; 71 QComboBox *subsection;
80 QTimer *popupTimer;
81 QPopupMenu *popupMenu;
82 QPopupMenu *destsMenu;
83 bool updateIcon;
84private slots: 72private slots:
85 void rotateUpdateIcon(); 73 void rotateUpdateIcon();
86}; 74};
87 75
88#endif 76#endif
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
@@ -1,25 +1,26 @@
1 DESTDIR = $(OPIEDIR)/bin 1 DESTDIR = $(OPIEDIR)/bin
2 TEMPLATE= app 2 TEMPLATE= app
3 #CONFIG = qt warn_on release 3 #CONFIG = qt warn_on release
4 CONFIG = qt warn_on debug 4 CONFIG = qt warn_on debug
5 HEADERS = mainwindow.h \ 5 HEADERS = mainwindow.h \
6 pksettings.h \ 6 pksettings.h \
7 pmipkg.h \ 7 pmipkg.h \
8 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 \
15 packagelistitem.cpp \ 17 packagelistitem.cpp \
16 packagelist.cpp \ 18 packagelist.cpp \
17 package.cpp 19 package.cpp
18INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
19 DEPENDPATH+= $(OPIEDIR)/ioclude 21 DEPENDPATH+= $(OPIEDIR)/ioclude
20LIBS += -lqpe 22LIBS += -lqpe
21 INTERFACES= pkdesc.ui \ 23 INTERFACES= runwindow.ui \
22 runwindow.ui \
23 pksettingsbase.ui 24 pksettingsbase.ui
24 TARGET = oipkg 25 TARGET = oipkg
25 26
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
@@ -1,297 +1,331 @@
1#include "package.h" 1#include "package.h"
2 2
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"
7 11
8Package::~Package() 12Package::~Package()
9{ 13{
10} 14}
11 15
12Package::Package( PackageManagerSettings *s ) 16Package::Package( PackageManagerSettings *s )
13{ 17{
14 init(s); 18 init(s);
15} 19}
16 20
17void Package::init( PackageManagerSettings *s ) 21void Package::init( PackageManagerSettings *s )
18{ 22{
19 settings = s; 23 settings = s;
20 _size = ""; 24 _size = "";
21 _section = ""; 25 _section = "";
22 _subsection = ""; 26 _subsection = "";
23 _shortDesc = ""; 27 _shortDesc = "";
24 _desc = ""; 28 _desc = "";
25 _name = ""; 29 _name = "";
26 _toProcess = false; 30 _toProcess = false;
27 _status = ""; 31 _status = "";
28 _dest = ""; 32 _dest = settings->getDestinationName();
33 _link = settings->createLinks();
29} 34}
30 35
31Package::Package( QStringList pack, PackageManagerSettings *s ) 36Package::Package( QStringList pack, PackageManagerSettings *s )
32 { 37 {
33 init(s); 38 init(s);
34 parsePackage( pack ); 39 parsePackage( pack );
35 _toProcess = false;
36} 40}
37 41
38Package::Package( QString n, PackageManagerSettings *s ) 42Package::Package( QString n, PackageManagerSettings *s )
39 { 43 {
40 init(s); 44 init(s);
41 _name = QString( n ); 45 if ( !QFile::exists( n ) )
42 _toProcess = false; 46 {
47 _name = QString( n );
48 }else{
49 parseIpkgFile( n );
50 _toProcess = true;
51 _packageName = QString( n );
52 }
43} 53}
44 54
45Package::Package( Package *pi ) 55Package::Package( Package *pi )
46{ 56{
47 init(pi->settings); 57 init(pi->settings);
48 copyValues( pi ); 58 copyValues( pi );
49 _toProcess = false;
50} 59}
51 60
52 61
53void Package::setValue( QString n, QString t ) 62void Package::setValue( QString n, QString t )
54{ 63{
55 if ( n == "Status" && installed() ) return; 64 if ( n == "Status" && installed() ) return;
56 if ( n == "Package" ) 65 if ( n == "Package" )
57 { 66 {
58 _name = QString( t ); 67 _name = QString( t );
59 } 68 }
60 if ( n == "Installed-Size" ) 69 if ( n == "Installed-Size" )
61 { 70 {
62 _size = t; 71 _size = t;
63 } 72 }
64 if ( n == "Priority") 73 if ( n == "Priority")
65 { 74 {
66 75
67 } 76 }
68 if ( n == "Section") 77 if ( n == "Section")
69 { 78 {
70 setSection( t ); 79 setSection( t );
71 } 80 }
72 if ( n == "Maintainer") 81 if ( n == "Maintainer")
73 { 82 {
74 83
75 } 84 }
76 if ( n == "Architecture") 85 if ( n == "Architecture")
77 { 86 {
78 87
79 } 88 }
80 if ( n == "Version") 89 if ( n == "Version")
81 { 90 {
82 91
83 } 92 }
84 if ( n == "Pre-Depends") 93 if ( n == "Pre-Depends")
85 { 94 {
86 95
87 } 96 }
88 if ( n == "Depends") 97 if ( n == "Depends")
89 { 98 {
90 99
91 }else if ( n == "Filename") 100 }else if ( n == "Filename")
92 { 101 {
93 102
94 }else if ( n == "Size") 103 }else if ( n == "Size")
95 { 104 {
96 105
97 }else if ( n == "MD5Sum") 106 }else if ( n == "MD5Sum")
98 { 107 {
99 108
100 } 109 }
101 if ( n == "Description") 110 if ( n == "Description")
102 { 111 {
103 setDesc( t ); 112 setDesc( t );
104 } 113 }
105 if ( n == "Status") 114 if ( n == "Status")
106 { 115 {
107 if ( installed() ) return; 116 if ( installed() ) return;
108 _status = t; 117 _status = t;
109 } 118 }
110 if ( t == "Essential") 119 if ( t == "Essential")
111 { 120 {
112 121
113 } 122 }
114}; 123};
115 124
116QString Package::name() 125QString Package::name()
117{ 126{
118 return _name; 127 return _name;
119} 128}
120 129
121bool Package::installed() 130bool Package::installed()
122{ 131{
123 return _status.contains("installed"); 132 return _status.contains("installed");
124} 133}
125 134
126void Package::setDesc( QString s ) 135void Package::setDesc( QString s )
127{ 136{
128 _desc = s; 137 _desc = s;
129 _shortDesc = s.left( s.find("\n") ); 138 _shortDesc = s.left( s.find("\n") );
130} 139}
131 140
132QString Package::desc() 141QString Package::desc()
133{ 142{
134 return _desc; 143 return _desc;
135} 144}
136 145
137QString Package::shortDesc() 146QString Package::shortDesc()
138{ 147{
139 return _shortDesc; 148 return _shortDesc;
140} 149}
141 150
142QString Package::size() 151QString Package::size()
143{ 152{
144 return _size; 153 return _size;
145} 154}
146 155
147bool Package::toProcess() 156bool Package::toProcess()
148{ 157{
149 return _toProcess; 158 return _toProcess;
150} 159}
151 160
152bool Package::toRemove() 161bool Package::toRemove()
153{ 162{
154 if ( _toProcess && installed() ) return true; 163 if ( _toProcess && installed() ) return true;
155 else return false; 164 else return false;
156} 165}
157 166
158bool Package::toInstall() 167bool Package::toInstall()
159{ 168{
160 if ( _toProcess && !installed() ) return true; 169 if ( _toProcess && !installed() ) return true;
161 else return false; 170 else return false;
162} 171}
163 172
164void Package::toggleProcess() 173void Package::toggleProcess()
165{ 174{
166 _toProcess = ! _toProcess; 175 _toProcess = ! _toProcess;
167} 176}
168 177
169 178
170 179
171void Package::copyValues( Package* pack ) 180void Package::copyValues( Package* pack )
172{ 181{
173 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); 182 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size );
174 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); 183 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section );
175 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); 184 if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection );
176 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); 185 if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc );
177 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); 186 if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc );
178 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); 187 if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name );
179 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); 188 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status );
180} 189}
181 190
182QString Package::section() 191QString Package::section()
183{ 192{
184 return _section; 193 return _section;
185} 194}
186 195
187void Package::setSection( QString s) 196void Package::setSection( QString s)
188{ 197{
189 int i = s.find("/"); 198 int i = s.find("/");
190 if ( i > 0 ) 199 if ( i > 0 )
191 { 200 {
192 _section = s.left(i); 201 _section = s.left(i);
193 _subsection = s.mid(i+1); 202 _subsection = s.mid(i+1);
194 }else{ 203 }else{
195 _section = s; 204 _section = s;
196 _subsection = ""; 205 _subsection = "";
197 } 206 }
198} 207}
199 208
200QString Package::subSection() 209QString Package::subSection()
201{ 210{
202 return _subsection; 211 return _subsection;
203} 212}
204 213
205void Package::parsePackage( QStringList pack ) 214void Package::parsePackage( QStringList pack )
206{ 215{
207 if ( pack.isEmpty() ) return; 216 if ( pack.isEmpty() ) return;
208 int count = pack.count(); 217 int count = pack.count();
209 for( int i = 0; i < count; i++ ) 218 for( int i = 0; i < count; i++ )
210 { 219 {
211 QString line = pack[i]; 220 QString line = pack[i];
212 int sep = line.find( QRegExp(":[\t ]+") ); 221 int sep = line.find( QRegExp(":[\t ]+") );
213 if ( sep >= 0 ) 222 if ( sep >= 0 )
214 { 223 {
215 QString tag = line.left(sep); 224 QString tag = line.left(sep);
216 QString value = line.mid(sep+2).simplifyWhiteSpace(); 225 QString value = line.mid(sep+2).simplifyWhiteSpace();
217 setValue( tag, value ); 226 setValue( tag, value );
218 }else{ 227 }else{
219 } 228 }
220 } 229 }
221 return; 230 return;
222} 231}
223 232
224QString Package::details() 233QString Package::details()
225{ 234{
226 QString status; 235 QString status;
227 Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); 236 Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
228 QString description; 237 QString description;
229 if ( ipkg_status.exec("",status) ) 238 if ( ipkg_status.exec("",status) )
230 { 239 {
231 QStringList lines = QStringList::split('\n',status,TRUE); 240 QStringList lines = QStringList::split('\n',status,TRUE);
232 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { 241 for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
233 QString line = *it; 242 QString line = *it;
234 if ( line == " ." ) 243 if ( line == " ." )
235 { 244 {
236 description.append("<p>"); 245 description.append("<p>");
237 } else 246 } else
238 if ( line[0] == ' ' || line[0] == '\t' ) 247 if ( line[0] == ' ' || line[0] == '\t' )
239 { 248 {
240 // continuation 249 // continuation
241 description.append(" "); 250 description.append(" ");
242 description.append(Qtopia::escapeString(line)); 251 description.append(Qtopia::escapeString(line));
243 } else { 252 } else {
244 int sep = line.find(QRegExp(":[\t ]+")); 253 int sep = line.find(QRegExp(":[\t ]+"));
245 if ( sep >= 0 ) 254 if ( sep >= 0 )
246 { 255 {
247 QString tag = line.left(sep); 256 QString tag = line.left(sep);
248 description.append("<br>"); 257 description.append("<br>");
249 description.append("<b>"); 258 description.append("<b>");
250 description.append(Qtopia::escapeString(tag)); 259 description.append(Qtopia::escapeString(tag));
251 description.append(":</b> "); 260 description.append(":</b> ");
252 description.append(Qtopia::escapeString(line.mid(sep+2))); 261 description.append(Qtopia::escapeString(line.mid(sep+2)));
253 } else { 262 } else {
254 description.append(" "); 263 description.append(" ");
255 description.append(Qtopia::escapeString(line)); 264 description.append(Qtopia::escapeString(line));
256 } 265 }
257 } 266 }
258 } 267 }
259 } 268 }
260 return description; 269 return description;
261} 270}
262 271
263void Package::processed() 272void Package::processed()
264{ 273{
265 _toProcess = false; 274 _toProcess = false;
266 //hack, but we're not writing status anyway... 275 //hack, but we're not writing status anyway...
267 if ( installed() ) _status = "install"; 276 if ( installed() ) _status = "install";
268 else _status = "installed"; 277 else _status = "installed";
269} 278}
270 279
271QString Package::dest() 280QString Package::dest()
272{ 281{
273 if ( installed()||(!installed() && _toProcess) ) 282 if ( installed()||(!installed() && _toProcess) )
274 return _dest!=""?_dest:settings->getDestinationName(); 283 return _dest!=""?_dest:settings->getDestinationName();
275 else return ""; 284 else return "";
276} 285}
277 286
278void Package::setDest( QString d ) 287void Package::setDest( QString d )
279{ 288{
280 _dest = d; 289 _dest = d;
281} 290}
282 291
283void Package::setOn() 292void Package::setOn()
284{ 293{
285 _toProcess = true; 294 _toProcess = true;
286} 295}
287 296
288bool Package::link() 297bool Package::link()
289{ 298{
290 if ( _dest == "root" || (!installed() && !_toProcess) ) return false; 299 if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
291 return _link; 300 return _link;
292} 301}
293 302
294void Package::setLink(bool b) 303void Package::setLink(bool b)
295{ 304{
296 _link = b; 305 _link = b;
297} 306}
307
308void 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
327QString 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
@@ -1,66 +1,70 @@
1#ifndef PK_ITEM_H 1#ifndef PK_ITEM_H
2#define PK_ITEM_H 2#define PK_ITEM_H
3 3
4#include <qstring.h> 4#include <qstring.h>
5#include <qlistview.h> 5#include <qlistview.h>
6#include <qpainter.h> 6#include <qpainter.h>
7#include <qpixmap.h> 7#include <qpixmap.h>
8#include <qdict.h> 8#include <qdict.h>
9#include <qobject.h> 9#include <qobject.h>
10 10
11#include "pksettings.h" 11#include "pksettings.h"
12 12
13class Package //: public QObject 13class Package //: public QObject
14{ 14{
15 //Q_OBJECT 15 //Q_OBJECT
16 public: 16 public:
17 Package(PackageManagerSettings *); 17 Package(PackageManagerSettings *);
18 ~Package(); 18 ~Package();
19 Package( QStringList, PackageManagerSettings * ); 19 Package( QStringList, PackageManagerSettings * );
20 Package( QString, PackageManagerSettings * ); 20 Package( QString, PackageManagerSettings * );
21 Package( Package* ); 21 Package( Package* );
22 22
23 void setValue( QString, QString ); 23 void setValue( QString, QString );
24 void copyValues( Package* ); 24 void copyValues( Package* );
25 25
26 QString name() ; 26 QString name() ;
27 bool installed(); 27 bool installed();
28 28
29 void setDesc( QString ); 29 void setDesc( QString );
30 QString shortDesc(); 30 QString shortDesc();
31 QString desc(); 31 QString desc();
32 QString size(); 32 QString size();
33 void setSection( QString ); 33 void setSection( QString );
34 QString section(); 34 QString section();
35 QString subSection(); 35 QString subSection();
36 QString details(); 36 QString details();
37 bool toProcess(); 37 bool toProcess();
38 bool toInstall(); 38 bool toInstall();
39 bool toRemove(); 39 bool toRemove();
40 void processed(); 40 void processed();
41 QString dest(); 41 QString dest();
42 void setDest( QString d ); 42 void setDest( QString d );
43 void setOn(); 43 void setOn();
44 bool link(); 44 bool link();
45 void setLink(bool); 45 void setLink(bool);
46 void parseIpkgFile( QString );;
46public slots: 47public slots:
48 /** No descriptions */
49 QString getPackageName();
47 void toggleProcess(); 50 void toggleProcess();
48 51
49private: 52private:
50 PackageManagerSettings *settings; 53 PackageManagerSettings *settings;
54 QString _packageName;
51 QString _name; 55 QString _name;
52 bool _toProcess; 56 bool _toProcess;
53 bool _link; 57 bool _link;
54 QString _status; 58 QString _status;
55 QString _size; 59 QString _size;
56 QString _section; 60 QString _section;
57 QString _subsection; 61 QString _subsection;
58 QString _shortDesc; 62 QString _shortDesc;
59 QString _desc; 63 QString _desc;
60 QString _dest; 64 QString _dest;
61 void parsePackage( QStringList ); 65 void parsePackage( QStringList );
62 void init(PackageManagerSettings *); 66 void init(PackageManagerSettings *);
63}; 67};
64 68
65 69
66#endif 70#endif
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
26PackageListView::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
50void 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
60void 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
78void PackageListView::stopTimer( QListViewItem* )
79{
80 pvDebug( 5, "stop timer" );
81 popupTimer->stop();
82}
83
84
85void 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
28class PackageListItem;
29class Package;
30class PackageManagerSettings;
31
32class PackageListView : public QListView
33{
34 Q_OBJECT
35
36public:
37 PackageListView(QWidget*, const char*, PackageManagerSettings*);
38 //~PackageListView();
39 QTimer *popupTimer;
40private:
41 PackageManagerSettings *settings;
42 Package *activePackage;
43 PackageListItem *activePackageListItem;
44 QPopupMenu *popupMenu;
45 QPopupMenu *destsMenu;
46public 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,348 +1,386 @@
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"
5#include "packagelistitem.h" 4#include "packagelistitem.h"
6 5
7#include <qpe/process.h> 6#include <qpe/process.h>
8#include <qpe/resource.h> 7#include <qpe/resource.h>
9#include <qpe/config.h> 8#include <qpe/config.h>
10#include <qpe/stringutil.h> 9#include <qpe/stringutil.h>
11#include <qdir.h> 10#include <qdir.h>
12#include <qfile.h> 11#include <qfile.h>
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>
17 17
18#include <qprogressbar.h> 18#include <qprogressbar.h>
19#include <qpushbutton.h> 19#include <qpushbutton.h>
20#include <qlayout.h> 20#include <qlayout.h>
21 21
22#include <stdlib.h> 22#include <stdlib.h>
23#include <unistd.h> 23#include <unistd.h>
24 24
25#include "mainwindow.h" 25#include "mainwindow.h"
26 26
27 27
28PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) 28PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
29 : QObject ( p ) 29 : QObject ( p )
30{ 30{
31 settings = s; 31 settings = s;
32 runwindowopen = false; 32 runwindowopen = false;
33 runwindow = new RunWindow( p, name, true, f ); 33 runwindow = new RunWindow( p, name, true, f );
34} 34}
35 35
36PmIpkg::~PmIpkg() 36PmIpkg::~PmIpkg()
37{ 37{
38} 38}
39 39
40//#define PROC 40//#define PROC
41#define SYSTEM 41#define SYSTEM
42int PmIpkg::runIpkg(const QString& args, const QString& dest ) 42int PmIpkg::runIpkg(const QString& args, const QString& dest )
43{ 43{
44 pvDebug(2,"PmIpkg::runIpkg "+args); 44 pvDebug(2,"PmIpkg::runIpkg "+args);
45 45
46#ifdef PROC 46#ifdef PROC
47 QStringList cmd = "/usr/bin/ipkg "; 47 QStringList cmd = "/usr/bin/ipkg ";
48#endif 48#endif
49#ifdef SYSTEM 49#ifdef SYSTEM
50 QString cmd = "/usr/bin/ipkg "; 50 QString cmd = "/usr/bin/ipkg ";
51#endif 51#endif
52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
53 if ( dest == "" ) 53 if ( dest == "" )
54 cmd += " -dest "+settings->getDestinationName(); 54 cmd += " -dest "+settings->getDestinationName();
55 else 55 else
56 cmd += " -dest "+ dest; 56 cmd += " -dest "+ dest;
57 57
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;
62 int r = 0; 65 int r = 0;
63#ifdef PROC 66#ifdef PROC
64 QString o = "start"; 67 QString o = "start";
65 Process *ipkg = new Process( "ls");//cmd ); 68 Process *ipkg = new Process( "ls");//cmd );
66 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); 69 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
67 QString description; 70 QString description;
68 ipkg->exec("",o); 71 ipkg->exec("",o);
69// out( o ); 72// out( o );
70#endif 73#endif
71#ifdef SYSTEM 74#ifdef SYSTEM
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());
77 QFile f( redirect ); 80 QFile f( redirect );
78 QString line; 81 QString line;
79 QString oldLine; 82 QString oldLine;
80 while ( ! f.open(IO_ReadOnly) ) {}; 83 while ( ! f.open(IO_ReadOnly) ) {};
81 // { 84 // {
82 QTextStream t( &f ); 85 QTextStream t( &f );
83 // QString fp; 86 // QString fp;
84 while ( !t.eof() ) 87 while ( !t.eof() )
85 { 88 {
86 line = t.readLine(); 89 line = t.readLine();
87 if ( line != oldLine ) 90 if ( line != oldLine )
88 { 91 {
89 out( line +"<br>" ); 92 out( line +"<br>" );
90 oldLine = line; 93 oldLine = line;
91 } 94 }
92 } 95 }
93// } 96// }
94 f.close(); 97 f.close();
95 out( "Finished!<br>"); 98 out( "Finished!<br>");
96#endif 99#endif
97 100
98 return r; 101 return r;
99} 102}
100 103
101void PmIpkg::makeLinks(Package *pack) 104void PmIpkg::makeLinks(Package *pack)
102{ 105{
103 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 106 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
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 );
110 cfg.setGroup( "Common" ); 111 cfg.setGroup( "Common" );
111 QString statusDir = cfg.readEntry( "statusDir", "" ); 112 QString statusDir = cfg.readEntry( "statusDir", "" );
112 } 113 }
113 QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; 114 QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list";
114 linkPackage( fn, dest ); 115 linkPackage( fn, dest );
115} 116}
116 117
117void PmIpkg::linkPackage( QString packFileName, QString dest ) 118void PmIpkg::linkPackage( QString packFileName, QString dest )
118{ 119{
119 QFile f( packFileName ); 120 QFile f( packFileName );
120 if ( ! f.open(IO_ReadOnly) ) 121 if ( ! f.open(IO_ReadOnly) )
121 { 122 {
122 out( "<b>Panik!</b> Could not open:<br>"+packFileName ); 123 out( "<b>Panik!</b> Could not open:<br>"+packFileName );
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;
127 while ( !t.eof() ) 130 while ( !t.eof() )
128 { 131 {
129 fp = t.readLine(); 132 fp = t.readLine();
130 processLinkDir( fp, dest ); 133 processLinkDir( fp, dest );
131 } 134 }
132 f.close(); 135 f.close();
133} 136}
134 137
135void PmIpkg::processLinkDir( QString file, QString dest ) 138void 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;
139 file = dest+"/"+file; 143 file = dest+"/"+file;
140 if (file == dest) return; 144 if (file == dest) return;
141 QFileInfo fileInfo( file ); 145 QFileInfo fileInfo( file );
142 if ( fileInfo.isDir() ) 146 if ( fileInfo.isDir() )
143 { 147 {
144 QDir destDir( destFile ); 148 QDir destDir( destFile );
145 destDir.mkdir( destFile, true ); 149 destDir.mkdir( destFile, true );
146 QDir d( file ); 150 QDir d( file );
147 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 151 d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
148 const QFileInfoList *list = d.entryInfoList(); 152 const QFileInfoList *list = d.entryInfoList();
149 QFileInfoListIterator it( *list ); 153 QFileInfoListIterator it( *list );
150 QFileInfo *fi; 154 QFileInfo *fi;
151 while ( (fi=it.current()) ) 155 while ( (fi=it.current()) )
152 { 156 {
153 // out( "<b>"+fi->absFilePath()+"</b>" ); 157 // out( "<b>"+fi->absFilePath()+"</b>" );
154 processLinkDir( fi->absFilePath(), dest ); 158 processLinkDir( fi->absFilePath(), dest );
155 ++it; 159 ++it;
156 } 160 }
157 } else 161 } else
158 if ( fileInfo.isFile() ) 162 if ( fileInfo.isFile() )
159 { 163 {
160 const char *instFile = strdup( (file).ascii() ); 164 const char *instFile = strdup( (file).ascii() );
161 const char *linkFile = strdup( (destFile).ascii()); 165 const char *linkFile = strdup( (destFile).ascii());
162// out( "linking: "+file+" -> "+destFile ); 166// out( "linking: "+file+" -> "+destFile );
163 qDebug( "linking: %s -> %s", instFile, linkFile ); 167 qDebug( "linking: %s -> %s", instFile, linkFile );
164 symlink( instFile, linkFile ); 168 symlink( instFile, linkFile );
165 } 169 }
166} 170}
167 171
168void PmIpkg::commit( PackageList pl ) 172void 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()) )
181 { 181 {
182 if ( pack && (pack->name() != "") && pack) 182 if ( pack && (pack->name() != "") && pack)
183 { 183 {
184 if ( pack->toInstall() ) 184 if ( pack->toInstall() )
185 { 185 {
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() )
191 { 191 {
192 to_remove.append( pack ); 192 to_remove.append( pack );
193 sizecount += 1; 193 sizecount += 1;
194 rem += pack->name()+"<br>"; 194 rem += pack->name()+"<br>";
195 } 195 }
196 } 196 }
197 } 197 }
198 198
199 out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); 199 startDialog();
200
201 qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count());
202 200
203 runwindow->progress->setTotalSteps( sizecount ); 201}
204 202
205 connect( runwindow->doItButton, SIGNAL( clicked() ), 203void PmIpkg::startDialog()
206 SLOT( doIt() ) ); 204{
207 connect( runwindow->installButton, SIGNAL( clicked() ), 205 QDialog *d = new QDialog();
206 QGridLayout *RunWindowLayout = new QGridLayout( d );
207 RunWindowLayout->setSpacing( 2 );
208 RunWindowLayout->setMargin( 2 );
209
210 QHBoxLayout *buttons = new QHBoxLayout;
211 buttons->setSpacing( 6 );
212 buttons->setMargin( 0 );
213
214 PackageListView *plv = new PackageListView(d, "install",settings);
215 RunWindowLayout->addWidget( plv, 1, 0 );
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
218void PmIpkg::doIt() 272void PmIpkg::doIt()
219{ 273{
220 remove(); 274 remove();
221 install(); 275 install();
222} 276}
223 277
224 278
225void PmIpkg::remove() 279void PmIpkg::remove()
226{ 280{
227 if ( to_remove.count() == 0 ) return; 281 if ( to_remove.count() == 0 ) return;
228 show( true ); 282 show( true );
229 283
230 out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); 284 out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>");
231 285
232 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 286 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
233 { 287 {
234 if ( runIpkg("remove " + it->name()) == 0) 288 if ( runIpkg("remove " + it->name()) == 0)
235 { 289 {
236 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 290 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
237 it->processed(); 291 it->processed();
238 runwindow->progress->setProgress( 1 ); 292 runwindow->progress->setProgress( 1 );
239 }else{ 293 }else{
240 out("<b>"+tr("Error while removing")+"</b>"+it->name()); 294 out("<b>"+tr("Error while removing")+"</b>"+it->name());
241 } 295 }
242 } 296 }
243} 297}
244 298
245 299
246void PmIpkg::install() 300void PmIpkg::install()
247{ 301{
248 if ( to_install.count() == 0 ) return; 302 if ( to_install.count() == 0 ) return;
249 show( true ); 303 show( true );
250 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 304 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
251 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 305 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
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());
257 if ( it->link() ) 311 if ( it->link() )
258 makeLinks( it ); 312 makeLinks( it );
259 it->processed(); 313 it->processed();
260 }else{ 314 }else{
261 out("<b>"+tr("Error while installing")+"</b>"+it->name()); 315 out("<b>"+tr("Error while installing")+"</b>"+it->name());
262 } 316 }
263 } 317 }
264} 318}
265 319
266void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) 320void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
267{ 321{
268 qDebug("msg="+msg+" -- "+QString(dest) ); 322 qDebug("msg="+msg+" -- "+QString(dest) );
269// QDir d( src ); 323// QDir d( src );
270// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); 324// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
271//// if (! d.exists() ) return; 325//// if (! d.exists() ) return;
272// const QFileInfoList *list = d.entryInfoList(); 326// const QFileInfoList *list = d.entryInfoList();
273// QFileInfoListIterator it( *list ); 327// QFileInfoListIterator it( *list );
274// QFileInfo *fi; 328// QFileInfo *fi;
275// while ( (fi=it.current()) ) { 329// while ( (fi=it.current()) ) {
276 // processLinkDir( fi->absFilePath(), dest ); 330 // processLinkDir( fi->absFilePath(), dest );
277// ++it; 331// ++it;
278// } 332// }
279} 333}
280 334
281void PmIpkg::update() 335void PmIpkg::update()
282{ 336{
283 show( false ); 337 show( false );
284 runIpkg( "update" ); 338 runIpkg( "update" );
285 runwindow->close(); 339 runwindow->close();
286} 340}
287 341
288void PmIpkg::out( QString o ) 342void PmIpkg::out( QString o )
289{ 343{
290 runwindow->outPut->setText( runwindow->outPut->text()+o ); 344 runwindow->outPut->setText( runwindow->outPut->text()+o );
291 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); 345 runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight());
292} 346}
293 347
294 348
295void PmIpkg::showButtons(bool b) 349void PmIpkg::showButtons(bool b)
296{ 350{
297 if ( b ) 351 if ( b )
298 { 352 {
299 runwindow->cancelButton->hide(); 353 runwindow->cancelButton->hide();
300 runwindow->doItButton->hide(); 354 runwindow->doItButton->hide();
301 runwindow->removeButton->hide(); 355 runwindow->removeButton->hide();
302 runwindow->installButton->hide(); 356 runwindow->installButton->hide();
303 }else{ 357 }else{
304 runwindow->cancelButton->show(); 358 runwindow->cancelButton->show();
305 runwindow->doItButton->show(); 359 runwindow->doItButton->show();
306 runwindow->removeButton->show(); 360 runwindow->removeButton->show();
307 runwindow->installButton->show(); 361 runwindow->installButton->show();
308 362
309 } 363 }
310} 364}
311 365
312void PmIpkg::show(bool b) 366void PmIpkg::show(bool b)
313{ 367{
314 if (!runwindow->isVisible()) 368 if (!runwindow->isVisible())
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
320 runwindow->progress->show(); 374 runwindow->progress->show();
321} 375}
322 376
323void PmIpkg::installFile(const QString &fileName) 377void PmIpkg::installFile(const QString &fileName)
324{ 378{
379
380 to_install.clear();
381 to_remove.clear();
325 pvDebug( 2,"PmIpkg::installFile "+ fileName); 382 pvDebug( 2,"PmIpkg::installFile "+ fileName);
326 show( false ); 383 to_install.append( new Package(fileName,settings) );
327 runwindow->outPut->setText(""); 384 startDialog();
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
337 runwindow->exec();
338} 385}
339 386
340void 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
@@ -1,51 +1,51 @@
1#ifndef PMIPKG_H 1#ifndef PMIPKG_H
2#define PMIPKG_H 2#define PMIPKG_H
3 3
4 4
5#include <qobject.h> 5#include <qobject.h>
6#include <qlist.h> 6#include <qlist.h>
7#include <qstring.h> 7#include <qstring.h>
8#include <qwidget.h> 8#include <qwidget.h>
9#include "pksettings.h" 9#include "pksettings.h"
10#include "runwindow.h" 10#include "runwindow.h"
11#include "packagelist.h" 11#include "packagelist.h"
12#include "debug.h" 12#include "debug.h"
13 13
14class Package; 14class Package;
15class PmIpkg : public QObject 15class PmIpkg : public QObject
16{ 16{
17 Q_OBJECT 17 Q_OBJECT
18public: 18public:
19 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 19 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
20 ~PmIpkg(); 20 ~PmIpkg();
21 21
22 void commit( PackageList ); 22 void commit( PackageList );
23 void update(); 23 void update();
24 PackageList* getPackageList(); 24 PackageList* getPackageList();
25 void showButtons(bool b=true); 25 void showButtons(bool b=true);
26 void show( bool buttons=true ); 26 void show( bool buttons=true );
27 27
28private: 28private:
29 PackageManagerSettings* settings; 29 PackageManagerSettings* settings;
30 RunWindow *runwindow; 30 RunWindow *runwindow;
31 QList<Package> to_remove; 31 QList<Package> to_remove;
32 QList<Package> to_install; 32 QList<Package> to_install;
33 bool runwindowopen; 33 bool runwindowopen;
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 );
38 void processLinkDir( QString, QString ); 39 void processLinkDir( QString, QString );
39 int runIpkg(const QString& args, const QString& dest="" ); 40 int runIpkg(const QString& args, const QString& dest="" );
40 void out( QString ); 41 void out( QString );
41 42
42public slots: 43public 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);
48 void linkDestination( const QString, const QByteArray ); 48 void linkDestination( const QString, const QByteArray );
49}; 49};
50 50
51#endif 51#endif
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
@@ -1,171 +1,171 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>RunWindow</class> 2<class>RunWindow</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>RunWindow</cstring> 7 <cstring>RunWindow</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
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>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>running...</string> 20 <string>running...</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <grid> 28 <grid>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>2</number> 31 <number>2</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>2</number> 35 <number>2</number>
36 </property> 36 </property>
37 <widget row="0" column="0" > 37 <widget row="0" column="0" >
38 <class>QProgressBar</class> 38 <class>QProgressBar</class>
39 <property stdset="1"> 39 <property stdset="1">
40 <name>name</name> 40 <name>name</name>
41 <cstring>progress</cstring> 41 <cstring>progress</cstring>
42 </property> 42 </property>
43 <property stdset="1"> 43 <property stdset="1">
44 <name>progress</name> 44 <name>progress</name>
45 <number>0</number> 45 <number>0</number>
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">
64 <name>name</name> 51 <name>name</name>
65 <cstring>buttons</cstring> 52 <cstring>buttons</cstring>
66 </property> 53 </property>
67 <hbox> 54 <hbox>
68 <property stdset="1"> 55 <property stdset="1">
69 <name>margin</name> 56 <name>margin</name>
70 <number>0</number> 57 <number>0</number>
71 </property> 58 </property>
72 <property stdset="1"> 59 <property stdset="1">
73 <name>spacing</name> 60 <name>spacing</name>
74 <number>6</number> 61 <number>6</number>
75 </property> 62 </property>
76 <widget> 63 <widget>
77 <class>QPushButton</class> 64 <class>QPushButton</class>
78 <property stdset="1"> 65 <property stdset="1">
79 <name>name</name> 66 <name>name</name>
80 <cstring>doItButton</cstring> 67 <cstring>doItButton</cstring>
81 </property> 68 </property>
82 <property stdset="1"> 69 <property stdset="1">
83 <name>sizePolicy</name> 70 <name>sizePolicy</name>
84 <sizepolicy> 71 <sizepolicy>
85 <hsizetype>0</hsizetype> 72 <hsizetype>0</hsizetype>
86 <vsizetype>0</vsizetype> 73 <vsizetype>0</vsizetype>
87 </sizepolicy> 74 </sizepolicy>
88 </property> 75 </property>
89 <property stdset="1"> 76 <property stdset="1">
90 <name>font</name> 77 <name>font</name>
91 <font> 78 <font>
92 <pointsize>8</pointsize> 79 <pointsize>8</pointsize>
93 </font> 80 </font>
94 </property> 81 </property>
95 <property stdset="1"> 82 <property stdset="1">
96 <name>text</name> 83 <name>text</name>
97 <string>Do all </string> 84 <string>Do all </string>
98 </property> 85 </property>
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>
104 <widget> 91 <widget>
105 <class>QPushButton</class> 92 <class>QPushButton</class>
106 <property stdset="1"> 93 <property stdset="1">
107 <name>name</name> 94 <name>name</name>
108 <cstring>installButton</cstring> 95 <cstring>installButton</cstring>
109 </property> 96 </property>
110 <property stdset="1"> 97 <property stdset="1">
111 <name>font</name> 98 <name>font</name>
112 <font> 99 <font>
113 <pointsize>8</pointsize> 100 <pointsize>8</pointsize>
114 </font> 101 </font>
115 </property> 102 </property>
116 <property stdset="1"> 103 <property stdset="1">
117 <name>text</name> 104 <name>text</name>
118 <string>Install</string> 105 <string>Install</string>
119 </property> 106 </property>
120 <property stdset="1"> 107 <property stdset="1">
121 <name>autoResize</name> 108 <name>autoResize</name>
122 <bool>true</bool> 109 <bool>true</bool>
123 </property> 110 </property>
124 </widget> 111 </widget>
125 <widget> 112 <widget>
126 <class>QPushButton</class> 113 <class>QPushButton</class>
127 <property stdset="1"> 114 <property stdset="1">
128 <name>name</name> 115 <name>name</name>
129 <cstring>removeButton</cstring> 116 <cstring>removeButton</cstring>
130 </property> 117 </property>
131 <property stdset="1"> 118 <property stdset="1">
132 <name>font</name> 119 <name>font</name>
133 <font> 120 <font>
134 <pointsize>7</pointsize> 121 <pointsize>7</pointsize>
135 </font> 122 </font>
136 </property> 123 </property>
137 <property stdset="1"> 124 <property stdset="1">
138 <name>text</name> 125 <name>text</name>
139 <string>Remove</string> 126 <string>Remove</string>
140 </property> 127 </property>
141 <property stdset="1"> 128 <property stdset="1">
142 <name>autoResize</name> 129 <name>autoResize</name>
143 <bool>true</bool> 130 <bool>true</bool>
144 </property> 131 </property>
145 </widget> 132 </widget>
146 <widget> 133 <widget>
147 <class>QPushButton</class> 134 <class>QPushButton</class>
148 <property stdset="1"> 135 <property stdset="1">
149 <name>name</name> 136 <name>name</name>
150 <cstring>cancelButton</cstring> 137 <cstring>cancelButton</cstring>
151 </property> 138 </property>
152 <property stdset="1"> 139 <property stdset="1">
153 <name>font</name> 140 <name>font</name>
154 <font> 141 <font>
155 <pointsize>8</pointsize> 142 <pointsize>8</pointsize>
156 </font> 143 </font>
157 </property> 144 </property>
158 <property stdset="1"> 145 <property stdset="1">
159 <name>text</name> 146 <name>text</name>
160 <string>Cancel</string> 147 <string>Cancel</string>
161 </property> 148 </property>
162 <property stdset="1"> 149 <property stdset="1">
163 <name>autoResize</name> 150 <name>autoResize</name>
164 <bool>true</bool> 151 <bool>true</bool>
165 </property> 152 </property>
166 </widget> 153 </widget>
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>
171</UI> 171</UI>