author | tille <tille> | 2002-04-24 19:15:02 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-24 19:15:02 (UTC) |
commit | 17eb865ad8248b1f47c565b074b9b6bbbd44935b (patch) (unidiff) | |
tree | c494b5050ce910df3c74e2a21c5579571792d926 | |
parent | 997b7685dcc48cc36737240ca53331f83b66dbeb (diff) | |
download | opie-17eb865ad8248b1f47c565b074b9b6bbbd44935b.zip opie-17eb865ad8248b1f47c565b074b9b6bbbd44935b.tar.gz opie-17eb865ad8248b1f47c565b074b9b6bbbd44935b.tar.bz2 |
added find
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 204 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 26 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 23 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pkwindow.ui | 147 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 2 |
7 files changed, 180 insertions, 230 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index cb2b4cd..997f449 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,272 +1,348 @@ | |||
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 <qaction.h> | 10 | #include <qaction.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | #include <qpopupmenu.h> | 12 | #include <qpopupmenu.h> |
13 | #include <qtoolbutton.h> | 13 | #include <qtoolbutton.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qlabel.h> | ||
15 | #include <qlistview.h> | 16 | #include <qlistview.h> |
16 | #include <qtextview.h> | 17 | #include <qtextview.h> |
18 | #include <qlineedit.h> | ||
17 | #include <qtabwidget.h> | 19 | #include <qtabwidget.h> |
18 | #include <qcombobox.h> | 20 | #include <qcombobox.h> |
19 | #include <qlayout.h> | 21 | #include <qlayout.h> |
20 | 22 | ||
21 | #include "pksettingsbase.h" | 23 | #include "pksettingsbase.h" |
22 | #include "packagelistitem.h" | 24 | #include "packagelistitem.h" |
23 | 25 | ||
24 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 26 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
25 | QMainWindow( parent, name, f ) | 27 | QMainWindow( parent, name, f ) |
26 | { | 28 | { |
27 | setCaption( tr("Package Manager") ); | 29 | setCaption( tr("Package Manager") ); |
28 | table = new PackageWindow( this,0,0 ); | 30 | |
29 | setCentralWidget( table ); | 31 | listViewPackages = new QListView( this,0,0 ); |
32 | setCentralWidget( listViewPackages ); | ||
33 | |||
30 | makeMenu(); | 34 | makeMenu(); |
31 | 35 | ||
32 | QFontMetrics fm = fontMetrics(); | 36 | QFontMetrics fm = fontMetrics(); |
33 | int w0 = fm.width(tr("Package"))+30; | 37 | int wlw = width()*2; |
34 | int w2 = fm.width("00000")+4; | 38 | int w0 = fm.width(tr("Package"))+30; |
35 | table->ListViewPackages->setColumnWidth(0,w0); | 39 | // int w0 = fm.width(tr("Package"))+30; |
36 | table->ListViewPackages->setColumnWidth(1,228-w2-w0); // ### screen-biased | 40 | int w2 = fm.width("00000")+4; |
37 | table->ListViewPackages->setColumnWidth(2,w2); | 41 | int w1 = wlw-w2-w0-20; |
38 | table->ListViewPackages->setColumnWidthMode(0,QListView::Manual); | 42 | listViewPackages->addColumn( tr("Package"), w0 ); |
39 | table->ListViewPackages->setColumnWidthMode(1,QListView::Manual); | 43 | listViewPackages->addColumn( tr("Description"), w1 ); |
40 | table->ListViewPackages->setColumnWidthMode(2,QListView::Manual); | 44 | listViewPackages->addColumn( tr("Size"), w2 ); |
41 | table->ListViewPackages->setSelectionMode( QListView::Multi ); | 45 | listViewPackages->setColumnWidthMode(0,QListView::Manual); |
42 | 46 | listViewPackages->setColumnWidthMode(1,QListView::Manual); | |
43 | connect( table->section, SIGNAL( activated(int) ), | 47 | listViewPackages->setColumnWidthMode(2,QListView::Manual); |
48 | listViewPackages->setSelectionMode( QListView::Multi ); | ||
49 | |||
50 | connect( section, SIGNAL( activated(int) ), | ||
44 | this, SLOT( sectionChanged() ) ); | 51 | this, SLOT( sectionChanged() ) ); |
45 | connect( table->subsection, SIGNAL(activated(int) ), | 52 | connect( subsection, SIGNAL(activated(int) ), |
46 | this, SLOT( subSectionChanged() ) ); | 53 | this, SLOT( subSectionChanged() ) ); |
47 | connect( table->ListViewPackages, SIGNAL( clicked( QListViewItem* ) ), | 54 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), |
48 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 55 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
49 | 56 | ||
50 | settings = new PackageManagerSettings(this,0,TRUE); | 57 | settings = new PackageManagerSettings(this,0,TRUE); |
51 | 58 | ||
52 | ipkg = new PmIpkg( settings, this ); | 59 | ipkg = new PmIpkg( settings, this ); |
53 | packageList.setSettings( settings ); | 60 | packageList.setSettings( settings ); |
54 | getList(); | 61 | getList(); |
55 | setSections(); | 62 | setSections(); |
56 | setSubSections(); | 63 | setSubSections(); |
57 | displayList(); | 64 | displayList(); |
58 | } | 65 | } |
59 | 66 | ||
60 | void MainWindow::makeMenu() | 67 | void MainWindow::makeMenu() |
61 | { | 68 | { |
62 | 69 | ||
63 | QPEToolBar *toolBar = new QPEToolBar( this ); | 70 | QPEToolBar *toolBar = new QPEToolBar( this ); |
64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 71 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 72 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | ||
66 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
67 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
68 | 76 | ||
69 | //#define TOOLBAR | 77 | popupMenu = new QPopupMenu( this ); |
70 | #ifdef TOOLBAR | ||
71 | QPEToolBar *secBar = new QPEToolBar( this ); | ||
72 | QComboBox *sections = new QComboBox( false, this ); | ||
73 | secBar->addTo( sections ); | ||
74 | #endif | ||
75 | 78 | ||
76 | contextMenu = new QPopupMenu( this ); | 79 | contextMenu = new QPopupMenu( this ); |
77 | 80 | ||
78 | setToolBarsMovable( false ); | 81 | setToolBarsMovable( false ); |
79 | toolBar->setHorizontalStretchable( true ); | 82 | toolBar->setHorizontalStretchable( true ); |
80 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 83 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
84 | menuBar->insertItem( tr( "View" ), viewMenu ); | ||
81 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
82 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
83 | 87 | ||
84 | toolBar->setStretchableWidget (srvMenu); | 88 | QLabel *spacer = new QLabel( "", toolBar ); |
89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | ||
90 | toolBar->setStretchableWidget( spacer ); | ||
85 | 91 | ||
86 | 92 | ||
87 | runAction = new QAction( tr( "Run" ), | 93 | runAction = new QAction( tr( "Commit" ), |
88 | Resource::loadPixmap( "oipkg/install" ), | 94 | Resource::loadPixmap( "oipkg/install" ), |
89 | QString::null, 0, this, 0 ); | 95 | QString::null, 0, this, 0 ); |
90 | connect( runAction, SIGNAL( activated() ), | 96 | connect( runAction, SIGNAL( activated() ), |
91 | this, SLOT( runIpkg() ) ); | 97 | this, SLOT( runIpkg() ) ); |
92 | runAction->addTo( toolBar ); | 98 | runAction->addTo( toolBar ); |
93 | runAction->addTo( srvMenu ); | 99 | runAction->addTo( srvMenu ); |
94 | 100 | ||
95 | srvMenu->insertSeparator (); | 101 | srvMenu->insertSeparator (); |
96 | 102 | ||
97 | updateAction = new QAction( tr( "Update" ), | 103 | updateAction = new QAction( tr( "Update" ), |
98 | Resource::loadIconSet( "oipkg/repeat" ), | 104 | Resource::loadIconSet( "oipkg/repeat" ), |
99 | QString::null, 0, this, 0 ); | 105 | QString::null, 0, this, 0 ); |
100 | connect( updateAction, SIGNAL( activated() ), | 106 | connect( updateAction, SIGNAL( activated() ), |
101 | this , SLOT( updateList() ) ); | 107 | this , SLOT( updateList() ) ); |
102 | updateAction->addTo( toolBar ); | 108 | updateAction->addTo( toolBar ); |
103 | updateAction->addTo( srvMenu ); | 109 | updateAction->addTo( srvMenu ); |
104 | 110 | ||
105 | // detailsAction = new QAction( tr( "Details" ), | 111 | detailsAction = new QAction( tr( "Details" ), |
106 | // Resource::loadIconSet( "oipkg/details" ), | 112 | Resource::loadIconSet( "find" ), |
107 | // QString::null, 0, this, 0 ); | 113 | QString::null, 0, this, 0 ); |
108 | // connect( detailsAction, SIGNAL( activated() ), | 114 | connect( detailsAction, SIGNAL( activated() ), |
109 | // this , SLOT( showDetails() ) ); | 115 | this , SLOT( showDetails() ) ); |
110 | // detailsAction->addTo( toolBar ); | 116 | detailsAction->addTo( toolBar ); |
111 | // detailsAction->addTo( srvMenu ); | 117 | detailsAction->addTo( srvMenu ); |
112 | 118 | ||
113 | QAction *cfgact; | 119 | QAction *cfgact; |
114 | 120 | ||
115 | cfgact = new QAction( tr( "Setups" ), | 121 | cfgact = new QAction( tr( "Setups" ), |
116 | Resource::loadIconSet( "" ), | 122 | // Resource::loadIconSet( "" ), |
117 | QString::null, 0, this, 0 ); | 123 | QString::null, 0, this, 0 ); |
118 | connect( cfgact, SIGNAL( activated() ), | 124 | connect( cfgact, SIGNAL( activated() ), |
119 | SLOT( showSettings() ) ); | 125 | SLOT( showSettings() ) ); |
120 | cfgact->addTo( cfgMenu ); | 126 | cfgact->addTo( cfgMenu ); |
121 | 127 | ||
122 | cfgact = new QAction( tr( "Servers" ), | 128 | cfgact = new QAction( tr( "Servers" ), |
123 | Resource::loadIconSet( "" ), | 129 | // Resource::loadIconSet( "" ), |
124 | QString::null, 0, this, 0 ); | 130 | QString::null, 0, this, 0 ); |
125 | connect( cfgact, SIGNAL( activated() ), | 131 | connect( cfgact, SIGNAL( activated() ), |
126 | SLOT( showSettingsSrv() ) ); | 132 | SLOT( showSettingsSrv() ) ); |
127 | cfgact->addTo( cfgMenu ); | 133 | cfgact->addTo( cfgMenu ); |
128 | cfgact = new QAction( tr( "Destinations" ), | 134 | cfgact = new QAction( tr( "Destinations" ), |
129 | Resource::loadIconSet( "" ), | 135 | //Resource::loadIconSet( "" ), |
130 | QString::null, 0, this, 0 ); | 136 | QString::null, 0, this, 0 ); |
131 | connect( cfgact, SIGNAL( activated() ), | 137 | connect( cfgact, SIGNAL( activated() ), |
132 | SLOT( showSettingsDst() ) ); | 138 | SLOT( showSettingsDst() ) ); |
133 | cfgact->addTo( cfgMenu ); | 139 | cfgact->addTo( cfgMenu ); |
134 | 140 | ||
141 | QAction *a; | ||
142 | |||
143 | sectionBar = new QPEToolBar( this ); | ||
144 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | ||
145 | sectionBar->setHorizontalStretchable( true ); | ||
146 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | ||
147 | label->setBackgroundColor( sectionBar->backgroundColor() ); | ||
148 | section = new QComboBox( false, sectionBar ); | ||
149 | // section->setBackgroundMode( PaletteBackground ); | ||
150 | label = new QLabel( " / ", sectionBar ); | ||
151 | label->setBackgroundColor( sectionBar->backgroundColor() ); | ||
152 | subsection = new QComboBox( false, sectionBar ); | ||
153 | sectionBar->setStretchableWidget( label ); | ||
154 | |||
155 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | ||
156 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | ||
157 | a->addTo( sectionBar ); | ||
158 | |||
159 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | ||
160 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | ||
161 | sectionAction->setToggleAction( true ); | ||
162 | sectionAction->setOn( true ); | ||
163 | sectionAction->addTo( viewMenu ); | ||
164 | |||
165 | findBar = new QPEToolBar(this); | ||
166 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | ||
167 | label = new QLabel( tr("Filter: "), findBar ); | ||
168 | label->setBackgroundColor( findBar->backgroundColor() ); | ||
169 | findBar->setHorizontalStretchable( TRUE ); | ||
170 | findEdit = new QLineEdit( findBar, "findEdit" ); | ||
171 | findBar->setStretchableWidget( findEdit ); | ||
172 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | ||
173 | this, SLOT( displayList() ) ); | ||
174 | //a = new QAction( tr( "Filter" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | ||
175 | // connect( a, SIGNAL( activated() ), this, SLOT( filterList() ) ); | ||
176 | // a->addTo( findBar ); | ||
177 | // a->addTo( edit ); | ||
178 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | ||
179 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | ||
180 | a->addTo( findBar ); | ||
181 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | ||
182 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | ||
183 | findAction->setToggleAction( true ); | ||
184 | findAction->setOn( true ); | ||
185 | findAction->addTo( viewMenu ); | ||
186 | |||
135 | } | 187 | } |
136 | 188 | ||
137 | MainWindow::~MainWindow() | 189 | MainWindow::~MainWindow() |
138 | { | 190 | { |
139 | } | 191 | } |
140 | 192 | ||
141 | void MainWindow::runIpkg() | 193 | void MainWindow::runIpkg() |
142 | { | 194 | { |
143 | ipkg->commit( packageList ); | 195 | ipkg->commit( packageList ); |
144 | updateList(); | 196 | updateList(); //to remove |
145 | } | 197 | } |
146 | 198 | ||
147 | void MainWindow::updateList() | 199 | void MainWindow::updateList() |
148 | { | 200 | { |
149 | // todo: packageList.clear(); | 201 | packageList.clear(); |
150 | ipkg->update(); | 202 | ipkg->update(); |
151 | getList(); | 203 | getList(); |
152 | } | 204 | } |
153 | 205 | ||
154 | void MainWindow::getList() | 206 | void MainWindow::getList() |
155 | { | 207 | { |
156 | packageList.update(); | 208 | packageList.update(); |
157 | displayList(); | 209 | displayList(); |
158 | } | 210 | } |
159 | 211 | ||
160 | void MainWindow::filterList() | 212 | void MainWindow::filterList() |
161 | { | 213 | { |
162 | packageList.filterPackages(); | 214 | QString f = ""; |
215 | if ( findAction->isOn() ) f = findEdit->text(); | ||
216 | packageList.filterPackages( f ); | ||
163 | } | 217 | } |
164 | 218 | ||
165 | void MainWindow::displayList() | 219 | void MainWindow::displayList() |
166 | { | 220 | { |
167 | table->ListViewPackages->clear(); | 221 | filterList(); |
222 | listViewPackages->clear(); | ||
168 | Package *pack = packageList.first(); | 223 | Package *pack = packageList.first(); |
169 | while( pack ) | 224 | while( pack ) |
170 | { | 225 | { |
171 | if ( pack && (pack->name() != "") ) | 226 | if ( pack && (pack->name() != "") ) |
172 | { | 227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); |
173 | table->ListViewPackages->insertItem( | 228 | pack = packageList.next(); |
174 | new PackageListItem( table->ListViewPackages, pack ) ); | 229 | } |
175 | } | ||
176 | pack = packageList.next(); | ||
177 | } | ||
178 | } | 230 | } |
179 | 231 | ||
180 | void MainWindow::sectionChanged() | 232 | void MainWindow::sectionChanged() |
181 | { | 233 | { |
182 | disconnect( table->section, SIGNAL( activated(int) ), | 234 | disconnect( section, SIGNAL( activated(int) ), |
183 | this, SLOT( sectionChanged() ) ); | 235 | this, SLOT( sectionChanged() ) ); |
184 | disconnect( table->subsection, SIGNAL(activated(int) ), | 236 | disconnect( subsection, SIGNAL(activated(int) ), |
185 | this, SLOT( subSectionChanged() ) ); | 237 | this, SLOT( subSectionChanged() ) ); |
186 | table->subsection->clear(); | 238 | subsection->clear(); |
187 | packageList.setSection( table->section->currentText() ); | 239 | packageList.setSection( section->currentText() ); |
188 | setSubSections(); | 240 | setSubSections(); |
189 | filterList(); | 241 | connect( section, SIGNAL( activated(int) ), |
190 | connect( table->section, SIGNAL( activated(int) ), | ||
191 | this, SLOT( sectionChanged() ) ); | 242 | this, SLOT( sectionChanged() ) ); |
192 | connect( table->subsection, SIGNAL(activated(int) ), | 243 | connect( subsection, SIGNAL(activated(int) ), |
193 | this, SLOT( subSectionChanged() ) ); | 244 | this, SLOT( subSectionChanged() ) ); |
194 | displayList(); | 245 | displayList(); |
195 | } | 246 | } |
196 | 247 | ||
197 | void MainWindow::subSectionChanged() | 248 | void MainWindow::subSectionChanged() |
198 | { | 249 | { |
199 | disconnect( table->section, SIGNAL( activated(int) ), | 250 | disconnect( section, SIGNAL( activated(int) ), |
200 | this, SLOT( sectionChanged() ) ); | 251 | this, SLOT( sectionChanged() ) ); |
201 | disconnect( table->subsection, SIGNAL(activated(int) ), | 252 | disconnect( subsection, SIGNAL(activated(int) ), |
202 | this, SLOT( subSectionChanged() ) ); | 253 | this, SLOT( subSectionChanged() ) ); |
203 | packageList.setSubSection( table->subsection->currentText() ); | 254 | packageList.setSubSection( subsection->currentText() ); |
204 | filterList(); | 255 | connect( section, SIGNAL( activated(int) ), |
205 | connect( table->section, SIGNAL( activated(int) ), | ||
206 | this, SLOT( sectionChanged() ) ); | 256 | this, SLOT( sectionChanged() ) ); |
207 | connect( table->subsection, SIGNAL(activated(int) ), | 257 | connect( subsection, SIGNAL(activated(int) ), |
208 | this, SLOT( subSectionChanged() ) ); | 258 | this, SLOT( subSectionChanged() ) ); |
209 | displayList(); | 259 | displayList(); |
210 | } | 260 | } |
211 | 261 | ||
212 | void MainWindow::setSections() | 262 | void MainWindow::setSections() |
213 | { | 263 | { |
214 | table->section->clear(); | 264 | section->clear(); |
215 | table->section->insertStringList( packageList.getSections() ); | 265 | section->insertStringList( packageList.getSections() ); |
216 | } | 266 | } |
217 | 267 | ||
218 | void MainWindow::setSubSections() | 268 | void MainWindow::setSubSections() |
219 | { | 269 | { |
220 | table->subsection->clear(); | 270 | subsection->clear(); |
221 | table->subsection->insertStringList( packageList.getSubSections() ); | 271 | subsection->insertStringList( packageList.getSubSections() ); |
222 | } | 272 | } |
223 | 273 | ||
224 | 274 | ||
225 | void MainWindow::showSettings() | 275 | void MainWindow::showSettings() |
226 | { | 276 | { |
227 | if ( settings->showDialog( 0 ) ) | 277 | if ( settings->showDialog( 0 ) ) |
228 | getList(); | 278 | getList(); |
229 | } | 279 | } |
230 | void MainWindow::showSettingsSrv() | 280 | void MainWindow::showSettingsSrv() |
231 | { | 281 | { |
232 | if ( settings->showDialog( 1 ) ) | 282 | if ( settings->showDialog( 1 ) ) |
233 | getList(); | 283 | getList(); |
234 | } | 284 | } |
235 | void MainWindow::showSettingsDst() | 285 | void MainWindow::showSettingsDst() |
236 | { | 286 | { |
237 | if ( settings->showDialog( 2 ) ) | 287 | if ( settings->showDialog( 2 ) ) |
238 | getList(); | 288 | getList(); |
239 | } | 289 | } |
240 | 290 | ||
241 | 291 | ||
242 | void MainWindow::showDetails() | 292 | void MainWindow::showDetails() |
243 | { | 293 | { |
244 | if ( activePackage ) return; | 294 | if ( activePackage ) return; |
245 | if ( details ) | 295 | if ( details ) |
246 | { | 296 | { |
247 | details = new PackageDetails( this ); | 297 | details = new PackageDetails( this ); |
248 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 298 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
249 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 299 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
250 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); | 300 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); |
251 | details->description->setTextFormat(RichText); | 301 | details->description->setTextFormat(RichText); |
252 | } | 302 | } |
253 | 303 | ||
254 | details->setCaption("Package: " + activePackage->name()); | 304 | details->setCaption("Package: " + activePackage->name()); |
255 | details->description->setText(activePackage->details() ); | 305 | details->description->setText(activePackage->details() ); |
256 | details->install->setEnabled(!activePackage->installed()); | 306 | details->install->setEnabled(!activePackage->installed()); |
257 | details->remove->setEnabled(activePackage->installed()); | 307 | details->remove->setEnabled(activePackage->installed()); |
258 | details->showMaximized(); | 308 | details->showMaximized(); |
259 | } | 309 | } |
260 | 310 | ||
261 | void MainWindow::toggleActivePackage() | 311 | void MainWindow::toggleActivePackage() |
262 | { | 312 | { |
263 | activePackage->toggleProcess(); | 313 | activePackage->toggleProcess(); |
264 | if ( details ) details->close(); | 314 | if ( details ) details->close(); |
265 | } | 315 | } |
266 | 316 | ||
267 | void MainWindow::setCurrent( QListViewItem* p ) | 317 | void MainWindow::setCurrent( QListViewItem* p ) |
268 | { | 318 | { |
269 | pvDebug(2, "MainWindow::setCurrent "); | 319 | pvDebug(2, "MainWindow::setCurrent "); |
270 | //+((Package*)p)->name()); | 320 | return; |
321 | pvDebug(2, "name "+((Package*)p)->name()); | ||
271 | activePackage = (Package*)p; | 322 | activePackage = (Package*)p; |
272 | } | 323 | } |
324 | |||
325 | void MainWindow::sectionShow(bool b) | ||
326 | { | ||
327 | if (b) sectionBar->show(); | ||
328 | else sectionBar->hide(); | ||
329 | sectionAction->setOn( b ); | ||
330 | } | ||
331 | |||
332 | void MainWindow::sectionClose() | ||
333 | { | ||
334 | sectionAction->setOn( false ); | ||
335 | } | ||
336 | |||
337 | void MainWindow::findShow(bool b) | ||
338 | { | ||
339 | if (b) findBar->show(); | ||
340 | else findBar->hide(); | ||
341 | findAction->setOn( b ); | ||
342 | } | ||
343 | |||
344 | void MainWindow::findClose() | ||
345 | { | ||
346 | findAction->setOn( false ); | ||
347 | } | ||
348 | |||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 95dcc90..0c1e474 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,62 +1,74 @@ | |||
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 <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | 7 | ||
8 | #include "packagelist.h" | 8 | #include "packagelist.h" |
9 | #include "pmipkg.h" | 9 | #include "pmipkg.h" |
10 | #include "pksettings.h" | 10 | #include "pksettings.h" |
11 | #include "pkdesc.h" | 11 | #include "pkdesc.h" |
12 | 12 | ||
13 | #include "pkwindow.h" | 13 | class QComboBox; |
14 | class QPEToolBar; | ||
15 | class QLineEdit; | ||
16 | class QListView; | ||
17 | |||
14 | 18 | ||
15 | class MainWindow : public QMainWindow | 19 | class MainWindow : public QMainWindow |
16 | { | 20 | { |
17 | Q_OBJECT | 21 | Q_OBJECT |
18 | 22 | ||
19 | 23 | ||
20 | public: | 24 | public: |
21 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 25 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
22 | ~MainWindow(); | 26 | ~MainWindow(); |
23 | 27 | ||
24 | |||
25 | protected: | ||
26 | PackageWindow *table; | ||
27 | |||
28 | |||
29 | protected slots: | 28 | protected slots: |
30 | void runIpkg(); | 29 | void runIpkg(); |
31 | void getList(); | 30 | void getList(); |
32 | void updateList(); | 31 | void updateList(); |
33 | void filterList(); | ||
34 | void displayList(); | 32 | void displayList(); |
35 | void subSectionChanged(); | 33 | void subSectionChanged(); |
36 | void sectionChanged(); | 34 | void sectionChanged(); |
37 | void showSettings(); | 35 | void showSettings(); |
38 | void showSettingsSrv(); | 36 | void showSettingsSrv(); |
39 | void showSettingsDst(); | 37 | void showSettingsDst(); |
40 | 38 | ||
41 | public slots: | 39 | public slots: |
42 | void showDetails(); | 40 | void showDetails(); |
43 | void toggleActivePackage(); | 41 | void toggleActivePackage(); |
44 | void setCurrent( QListViewItem* ); | 42 | void setCurrent( QListViewItem* ); |
43 | void sectionClose(); | ||
44 | void sectionShow(bool); | ||
45 | void findClose(); | ||
46 | void findShow(bool); | ||
47 | void filterList(); | ||
45 | 48 | ||
46 | private: | 49 | private: |
47 | void makeMenu(); | 50 | void makeMenu(); |
48 | void setSections(); | 51 | void setSections(); |
49 | void setSubSections(); | 52 | void setSubSections(); |
50 | 53 | ||
51 | PmIpkg* ipkg; | 54 | PmIpkg* ipkg; |
52 | PackageManagerSettings *settings; | 55 | PackageManagerSettings *settings; |
53 | PackageDetails* details; | 56 | PackageDetails* details; |
54 | PackageList packageList; | 57 | PackageList packageList; |
55 | Package *activePackage; | 58 | Package *activePackage; |
56 | QAction *runAction; | 59 | QAction *runAction; |
57 | QAction *detailsAction; | 60 | QAction *detailsAction; |
58 | QAction *updateAction; | 61 | QAction *updateAction; |
62 | QAction *findAction; | ||
63 | QAction *sectionAction; | ||
64 | QListView *listViewPackages; | ||
59 | QPopupMenu *contextMenu; | 65 | QPopupMenu *contextMenu; |
66 | QPEToolBar *findBar; | ||
67 | QLineEdit *findEdit; | ||
68 | QPEToolBar *sectionBar; | ||
69 | QComboBox *section; | ||
70 | QComboBox *subsection; | ||
71 | QPopupMenu *popupMenu; | ||
60 | }; | 72 | }; |
61 | 73 | ||
62 | #endif | 74 | #endif |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index c61af0f..c16cc73 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -1,27 +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 | package.h | 10 | package.h |
11 | SOURCES = main.cpp \ | 11 | SOURCES = main.cpp \ |
12 | mainwindow.cpp \ | 12 | mainwindow.cpp \ |
13 | pksettings.cpp \ | 13 | pksettings.cpp \ |
14 | pmipkg.cpp \ | 14 | pmipkg.cpp \ |
15 | packagelistitem.cpp \ | 15 | packagelistitem.cpp \ |
16 | packagelist.cpp \ | 16 | packagelist.cpp \ |
17 | package.cpp | 17 | package.cpp |
18 | INCLUDEPATH += $(OPIEDIR)/include | 18 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH+= $(OPIEDIR)/include | 19 | DEPENDPATH+= $(OPIEDIR)/include |
20 | LIBS += -lqpe | 20 | LIBS += -lqpe |
21 | INTERFACES= pkdesc.ui \ | 21 | INTERFACES= pkdesc.ui \ |
22 | pkfind.ui \ | 22 | pkfind.ui \ |
23 | runwindow.ui \ | 23 | runwindow.ui \ |
24 | pkwindow.ui \ | ||
25 | pksettingsbase.ui | 24 | pksettingsbase.ui |
26 | TARGET = oipkg | 25 | TARGET = oipkg |
27 | 26 | ||
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 5f6934d..944bb83 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,216 +1,223 @@ | |||
1 | #include "packagelist.h" | 1 | #include "packagelist.h" |
2 | 2 | ||
3 | #include <assert.h> | 3 | #include <assert.h> |
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <qpe/config.h> | 7 | #include <qpe/config.h> |
8 | 8 | ||
9 | #include "debug.h" | 9 | #include "debug.h" |
10 | 10 | ||
11 | PackageList::PackageList() | 11 | PackageList::PackageList() |
12 | : packageIter( packageList ) | 12 | : packageIter( packageList ) |
13 | { | 13 | { |
14 | empty=true; | 14 | empty=true; |
15 | { | 15 | { |
16 | Config cfg( "oipkg", Config::User ); | 16 | Config cfg( "oipkg", Config::User ); |
17 | cfg.setGroup( "Common" ); | 17 | cfg.setGroup( "Common" ); |
18 | statusDir = cfg.readEntry( "statusDir", "" ); | 18 | statusDir = cfg.readEntry( "statusDir", "" ); |
19 | listsDir = cfg.readEntry( "listsDir", "" ); | 19 | listsDir = cfg.readEntry( "listsDir", "" ); |
20 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) | 20 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) |
21 | { | 21 | { |
22 | statusDir="/usr/lib/ipkg/"; | 22 | statusDir="/usr/lib/ipkg/"; |
23 | listsDir="/usr/lib/ipkg/lists/"; | 23 | listsDir="/usr/lib/ipkg/lists/"; |
24 | cfg.writeEntry( "statusDir", statusDir ); | 24 | cfg.writeEntry( "statusDir", statusDir ); |
25 | cfg.writeEntry( "listsDir", listsDir ); | 25 | cfg.writeEntry( "listsDir", listsDir ); |
26 | } | 26 | } |
27 | } | 27 | } |
28 | pvDebug( 5, "PackageList::PackageList statusDir "+statusDir); | ||
29 | pvDebug( 5, "PackageList::PackageList listsDir "+listsDir); | ||
30 | sections << "All"; | 28 | sections << "All"; |
31 | subSections.insert("All", new QStringList() ); | 29 | subSections.insert("All", new QStringList() ); |
32 | QStringList *ss = subSections["All"]; | 30 | QStringList *ss = subSections["All"]; |
33 | *ss << "All"; | 31 | *ss << "All"; |
34 | aktSection = "All"; | 32 | aktSection = "All"; |
35 | aktSubSection = "All"; | 33 | aktSubSection = "All"; |
36 | } | 34 | } |
37 | 35 | ||
38 | PackageList::PackageList( PackageManagerSettings* s) | 36 | PackageList::PackageList( PackageManagerSettings* s) |
39 | : packageIter( packageList ) | 37 | : packageIter( packageList ) |
40 | { | 38 | { |
41 | settings = s; | 39 | settings = s; |
42 | PackageList(); | 40 | PackageList(); |
43 | } | 41 | } |
44 | 42 | ||
45 | PackageList::~PackageList() | 43 | PackageList::~PackageList() |
46 | { | 44 | { |
47 | } | 45 | } |
48 | 46 | ||
49 | /** Inserts a package into the list */ | 47 | /** Inserts a package into the list */ |
50 | void PackageList::insertPackage( Package* pack ) | 48 | void PackageList::insertPackage( Package* pack ) |
51 | { | 49 | { |
52 | Package* p = packageList.find( pack->name() ); | 50 | Package* p = packageList.find( pack->name() ); |
53 | if ( p ) | 51 | if ( p ) |
54 | { | 52 | { |
55 | p->copyValues( pack ); | 53 | p->copyValues( pack ); |
56 | delete pack; | 54 | delete pack; |
57 | pack = p; | 55 | pack = p; |
58 | }else{ | 56 | }else{ |
59 | packageList.insert( pack->name(), pack ); | 57 | packageList.insert( pack->name(), pack ); |
60 | origPackageList.insert( pack->name(), pack ); | 58 | origPackageList.insert( pack->name(), pack ); |
61 | empty=false; | 59 | empty=false; |
62 | }; | 60 | }; |
63 | updateSections( pack ); | 61 | updateSections( pack ); |
64 | } | 62 | } |
65 | 63 | ||
66 | void PackageList::filterPackages() | 64 | void PackageList::filterPackages( QString f ) |
67 | { | 65 | { |
68 | packageList.clear(); | 66 | packageList.clear(); |
69 | QDictIterator<Package> filterIter( origPackageList ); | 67 | QDictIterator<Package> filterIter( origPackageList ); |
70 | filterIter.toFirst(); | 68 | filterIter.toFirst(); |
71 | Package *pack= filterIter.current() ; | 69 | Package *pack= filterIter.current() ; |
72 | while ( pack ) | 70 | while ( pack ) |
73 | { | 71 | { |
74 | if ( ((aktSection=="All")||(pack->getSection()==aktSection)) && | 72 | if ( |
75 | ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) ) | 73 | ((aktSection=="All")||(pack->getSection()==aktSection)) && |
76 | { | 74 | ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) && |
77 | packageList.insert( pack->name(), pack ); | 75 | pack->name().contains( f ) |
78 | } | 76 | ) |
77 | { | ||
78 | packageList.insert( pack->name(), pack ); | ||
79 | } | ||
79 | ++filterIter; | 80 | ++filterIter; |
80 | pack = filterIter.current(); | 81 | pack = filterIter.current(); |
81 | } | 82 | } |
82 | } | 83 | } |
83 | 84 | ||
84 | Package* PackageList::find( QString n ) | 85 | Package* PackageList::find( QString n ) |
85 | { | 86 | { |
86 | return packageList.find( n ); | 87 | return packageList.find( n ); |
87 | } | 88 | } |
88 | 89 | ||
89 | Package* PackageList::first() | 90 | Package* PackageList::first() |
90 | { | 91 | { |
91 | packageIter.toFirst(); | 92 | packageIter.toFirst(); |
92 | return packageIter.current(); | 93 | return packageIter.current(); |
93 | } | 94 | } |
94 | 95 | ||
95 | Package* PackageList::next() | 96 | Package* PackageList::next() |
96 | { | 97 | { |
97 | ++packageIter; | 98 | ++packageIter; |
98 | return packageIter.current(); | 99 | return packageIter.current(); |
99 | } | 100 | } |
100 | 101 | ||
101 | QStringList PackageList::getSections() | 102 | QStringList PackageList::getSections() |
102 | { | 103 | { |
103 | sections.sort(); | 104 | sections.sort(); |
104 | return sections; | 105 | return sections; |
105 | } | 106 | } |
106 | 107 | ||
107 | QStringList PackageList::getSubSections() | 108 | QStringList PackageList::getSubSections() |
108 | { | 109 | { |
109 | QStringList ss; | 110 | QStringList ss; |
110 | if ( !subSections[aktSection] ) return ss; | 111 | if ( !subSections[aktSection] ) return ss; |
111 | ss = *subSections[aktSection]; | 112 | ss = *subSections[aktSection]; |
112 | ss.sort(); | 113 | ss.sort(); |
113 | return ss; | 114 | return ss; |
114 | } | 115 | } |
115 | 116 | ||
116 | void PackageList::setSection( QString sec ) | 117 | void PackageList::setSection( QString sec ) |
117 | { | 118 | { |
118 | aktSection = sec; | 119 | aktSection = sec; |
119 | } | 120 | } |
120 | 121 | ||
121 | void PackageList::setSubSection( QString ssec ) | 122 | void PackageList::setSubSection( QString ssec ) |
122 | { | 123 | { |
123 | aktSubSection = ssec; | 124 | aktSubSection = ssec; |
124 | } | 125 | } |
125 | 126 | ||
126 | void PackageList::updateSections( Package* pack ) | 127 | void PackageList::updateSections( Package* pack ) |
127 | { | 128 | { |
128 | QString s = pack->getSection(); | 129 | QString s = pack->getSection(); |
129 | if ( s.isEmpty() || s == "") return; | 130 | if ( s.isEmpty() || s == "") return; |
130 | if ( sections.contains(s) ) return; | 131 | if ( sections.contains(s) ) return; |
131 | sections += s; | 132 | sections += s; |
132 | QString ss = pack->getSubSection(); | 133 | QString ss = pack->getSubSection(); |
133 | if ( ss.isEmpty() || ss == "" ) return; | 134 | if ( ss.isEmpty() || ss == "" ) return; |
134 | if ( !subSections[s] ) { | 135 | if ( !subSections[s] ) { |
135 | subSections.insert( s, new QStringList() ); | 136 | subSections.insert( s, new QStringList() ); |
136 | QStringList *subsecs = subSections[s]; | 137 | QStringList *subsecs = subSections[s]; |
137 | *subsecs += "All"; | 138 | *subsecs += "All"; |
138 | } | 139 | } |
139 | QStringList *subsecs = subSections[s]; | 140 | QStringList *subsecs = subSections[s]; |
140 | *subsecs += ss; | 141 | *subsecs += ss; |
141 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 142 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
142 | subsecs = subSections["All"]; | 143 | subsecs = subSections["All"]; |
143 | *subsecs += ss; | 144 | *subsecs += ss; |
144 | } | 145 | } |
145 | 146 | ||
146 | 147 | ||
147 | 148 | ||
148 | /** No descriptions */ | 149 | /** No descriptions */ |
149 | void PackageList::parseStatus() | 150 | void PackageList::parseStatus() |
150 | { | 151 | { |
151 | QStringList dests = settings->getDestinationUrls(); | 152 | QStringList dests = settings->getDestinationUrls(); |
152 | for ( QStringList::Iterator it = dests.begin(); it != dests.end(); ++it ) | 153 | for ( QStringList::Iterator it = dests.begin(); it != dests.end(); ++it ) |
153 | { | 154 | { |
154 | pvDebug( 2,"Status Dir: "+*it+statusDir+"/status"); | 155 | pvDebug( 2,"Status Dir: "+*it+statusDir+"/status"); |
155 | readFileEntries( *it+statusDir+"/status" ); | 156 | readFileEntries( *it+statusDir+"/status" ); |
156 | }; | 157 | }; |
157 | } | 158 | } |
158 | 159 | ||
159 | void PackageList::parseList() | 160 | void PackageList::parseList() |
160 | { | 161 | { |
161 | QStringList srvs = settings->getActiveServers(); | 162 | QStringList srvs = settings->getActiveServers(); |
162 | 163 | ||
163 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | 164 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) |
164 | { | 165 | { |
165 | pvDebug( 2, "List Dir: "+listsDir+"/"+*it); | 166 | pvDebug( 2, "List Dir: "+listsDir+"/"+*it); |
166 | readFileEntries( listsDir+"/"+*it ); | 167 | readFileEntries( listsDir+"/"+*it ); |
167 | } | 168 | } |
168 | } | 169 | } |
169 | 170 | ||
170 | void PackageList::readFileEntries( QString filename ) | 171 | void PackageList::readFileEntries( QString filename ) |
171 | { | 172 | { |
172 | QStringList packEntry; | 173 | QStringList packEntry; |
173 | QFile f( filename ); | 174 | QFile f( filename ); |
174 | if ( !f.open(IO_ReadOnly) ) return; | 175 | if ( !f.open(IO_ReadOnly) ) return; |
175 | QTextStream *statusStream = new QTextStream( &f ); | 176 | QTextStream *statusStream = new QTextStream( &f ); |
176 | while ( !statusStream ->eof() ) | 177 | while ( !statusStream ->eof() ) |
177 | { | 178 | { |
178 | QString line = statusStream->readLine(); | 179 | QString line = statusStream->readLine(); |
179 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 180 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
180 | { | 181 | { |
181 | //end of package | 182 | //end of package |
182 | if ( ! packEntry.isEmpty() ) | 183 | if ( ! packEntry.isEmpty() ) |
183 | { | 184 | { |
184 | Package *p = new Package( packEntry ); | 185 | Package *p = new Package( packEntry ); |
185 | if ( p ) | 186 | if ( p ) |
186 | { | 187 | { |
187 | insertPackage( p ); | 188 | insertPackage( p ); |
188 | packEntry.clear(); | 189 | packEntry.clear(); |
189 | } | 190 | } |
190 | } | 191 | } |
191 | }else{ | 192 | }else{ |
192 | packEntry << line; | 193 | packEntry << line; |
193 | }; | 194 | }; |
194 | } | 195 | } |
195 | return; | 196 | return; |
196 | } | 197 | } |
197 | 198 | ||
198 | 199 | ||
199 | void PackageList::update() | 200 | void PackageList::update() |
200 | { | 201 | { |
201 | pvDebug( 3, "parseStatus"); | 202 | pvDebug( 3, "parseStatus"); |
202 | parseStatus(); | 203 | parseStatus(); |
203 | pvDebug( 3, "parseList"); | 204 | pvDebug( 3, "parseList"); |
204 | parseList(); | 205 | parseList(); |
205 | pvDebug( 3, "finished parsing"); | 206 | pvDebug( 3, "finished parsing"); |
206 | } | 207 | } |
207 | 208 | ||
208 | void PackageList::setSettings( PackageManagerSettings *s ) | 209 | void PackageList::setSettings( PackageManagerSettings *s ) |
209 | { | 210 | { |
210 | settings = s; | 211 | settings = s; |
211 | } | 212 | } |
212 | 213 | ||
213 | Package* PackageList::getByName( QString n ) | 214 | Package* PackageList::getByName( QString n ) |
214 | { | 215 | { |
215 | origPackageList[n]; | 216 | origPackageList[n]; |
216 | } | 217 | } |
218 | |||
219 | void PackageList::clear() | ||
220 | { | ||
221 | origPackageList.clear(); | ||
222 | packageList.clear(); | ||
223 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 68b89f0..4ce97af 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -1,65 +1,68 @@ | |||
1 | #ifndef PACKAGELIST_H | 1 | #ifndef PACKAGELIST_H |
2 | #define PACKAGELIST_H | 2 | #define PACKAGELIST_H |
3 | 3 | ||
4 | #include <qdict.h> | 4 | #include <qdict.h> |
5 | #include "package.h" | 5 | #include "package.h" |
6 | #include "pksettings.h" | 6 | #include "pksettings.h" |
7 | #include "debug.h" | 7 | #include "debug.h" |
8 | 8 | ||
9 | #define HACK | 9 | #define HACK |
10 | #ifdef HACK | 10 | #ifdef HACK |
11 | static QString listsDir="/usr/lib/ipkg/"; | 11 | static QString listsDir="/usr/lib/ipkg/"; |
12 | static QString statusDir="/usr/lib/ipkg/"; | 12 | static QString statusDir="/usr/lib/ipkg/"; |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | class PackageList { | 15 | class PackageList { |
16 | public: | 16 | public: |
17 | //static QString all = QObject::tr("All"); | ||
18 | |||
17 | PackageList(); | 19 | PackageList(); |
18 | PackageList( PackageManagerSettings* ); | 20 | PackageList( PackageManagerSettings* ); |
19 | ~PackageList(); | 21 | ~PackageList(); |
20 | void insertPackage( Package* ); | 22 | void insertPackage( Package* ); |
21 | Package* find( QString ); | 23 | Package* find( QString ); |
22 | Package* next(); | 24 | Package* next(); |
23 | Package* first(); | 25 | Package* first(); |
24 | 26 | ||
25 | QStringList getSections(); | 27 | QStringList getSections(); |
26 | QStringList getSubSections(); | 28 | QStringList getSubSections(); |
27 | void setSettings( PackageManagerSettings* ); | 29 | void setSettings( PackageManagerSettings* ); |
28 | void filterPackages(); | 30 | void filterPackages( QString ); |
29 | /** No descriptions */ | ||
30 | Package* getByName( QString ); | 31 | Package* getByName( QString ); |
32 | /** No descriptions */ | ||
33 | void clear(); | ||
31 | 34 | ||
32 | public slots: | 35 | public slots: |
33 | void setSection(QString); | 36 | void setSection(QString); |
34 | void setSubSection(QString); | 37 | void setSubSection(QString); |
35 | void update(); | 38 | void update(); |
36 | 39 | ||
37 | private: | 40 | private: |
38 | int currentPackage; | 41 | int currentPackage; |
39 | int packageCount; | 42 | int packageCount; |
40 | 43 | ||
41 | PackageManagerSettings *settings; | 44 | PackageManagerSettings *settings; |
42 | QDict<Package> packageList; | 45 | QDict<Package> packageList; |
43 | QDict<Package> origPackageList; | 46 | QDict<Package> origPackageList; |
44 | QDictIterator<Package> packageIter; | 47 | QDictIterator<Package> packageIter; |
45 | 48 | ||
46 | bool empty; | 49 | bool empty; |
47 | #ifndef HACK | 50 | #ifndef HACK |
48 | QString listsDir; | 51 | QString listsDir; |
49 | QString statusDir; | 52 | QString statusDir; |
50 | #endif | 53 | #endif |
51 | QString aktSection; | 54 | QString aktSection; |
52 | QString aktSubSection; | 55 | QString aktSubSection; |
53 | QStringList sections; | 56 | QStringList sections; |
54 | QDict<QStringList> subSections; | 57 | QDict<QStringList> subSections; |
55 | QDict<bool> sectionsDict; | 58 | QDict<bool> sectionsDict; |
56 | 59 | ||
57 | 60 | ||
58 | void updateSections( Package* ); | 61 | void updateSections( Package* ); |
59 | void parseStatus(); | 62 | void parseStatus(); |
60 | void parseList(); | 63 | void parseList(); |
61 | void readFileEntries( QString ); | 64 | void readFileEntries( QString ); |
62 | }; | 65 | }; |
63 | 66 | ||
64 | 67 | ||
65 | #endif | 68 | #endif |
diff --git a/noncore/unsupported/oipkg/pkwindow.ui b/noncore/unsupported/oipkg/pkwindow.ui deleted file mode 100644 index 9e44338..0000000 --- a/noncore/unsupported/oipkg/pkwindow.ui +++ b/dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PackageWindow</class> | ||
3 | <widget> | ||
4 | <class>QWidget</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>PackageWindow</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>254</width> | ||
15 | <height>298</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>PackageWindow</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>2</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>2</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout5</cstring> | ||
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutSpacing</name> | ||
45 | </property> | ||
46 | <hbox> | ||
47 | <property stdset="1"> | ||
48 | <name>margin</name> | ||
49 | <number>0</number> | ||
50 | </property> | ||
51 | <property stdset="1"> | ||
52 | <name>spacing</name> | ||
53 | <number>1</number> | ||
54 | </property> | ||
55 | <widget> | ||
56 | <class>QLabel</class> | ||
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>LabelSection</cstring> | ||
60 | </property> | ||
61 | <property stdset="1"> | ||
62 | <name>text</name> | ||
63 | <string>Section:</string> | ||
64 | </property> | ||
65 | </widget> | ||
66 | <widget> | ||
67 | <class>QComboBox</class> | ||
68 | <property stdset="1"> | ||
69 | <name>name</name> | ||
70 | <cstring>section</cstring> | ||
71 | </property> | ||
72 | <property stdset="1"> | ||
73 | <name>sizePolicy</name> | ||
74 | <sizepolicy> | ||
75 | <hsizetype>0</hsizetype> | ||
76 | <vsizetype>0</vsizetype> | ||
77 | </sizepolicy> | ||
78 | </property> | ||
79 | </widget> | ||
80 | <widget> | ||
81 | <class>QComboBox</class> | ||
82 | <property stdset="1"> | ||
83 | <name>name</name> | ||
84 | <cstring>subsection</cstring> | ||
85 | </property> | ||
86 | <property stdset="1"> | ||
87 | <name>sizePolicy</name> | ||
88 | <sizepolicy> | ||
89 | <hsizetype>0</hsizetype> | ||
90 | <vsizetype>0</vsizetype> | ||
91 | </sizepolicy> | ||
92 | </property> | ||
93 | </widget> | ||
94 | </hbox> | ||
95 | </widget> | ||
96 | <widget> | ||
97 | <class>QListView</class> | ||
98 | <column> | ||
99 | <property> | ||
100 | <name>text</name> | ||
101 | <string>Package</string> | ||
102 | </property> | ||
103 | <property> | ||
104 | <name>clickable</name> | ||
105 | <bool>true</bool> | ||
106 | </property> | ||
107 | <property> | ||
108 | <name>resizeable</name> | ||
109 | <bool>true</bool> | ||
110 | </property> | ||
111 | </column> | ||
112 | <column> | ||
113 | <property> | ||
114 | <name>text</name> | ||
115 | <string>Description</string> | ||
116 | </property> | ||
117 | <property> | ||
118 | <name>clickable</name> | ||
119 | <bool>true</bool> | ||
120 | </property> | ||
121 | <property> | ||
122 | <name>resizeable</name> | ||
123 | <bool>true</bool> | ||
124 | </property> | ||
125 | </column> | ||
126 | <column> | ||
127 | <property> | ||
128 | <name>text</name> | ||
129 | <string>Size</string> | ||
130 | </property> | ||
131 | <property> | ||
132 | <name>clickable</name> | ||
133 | <bool>true</bool> | ||
134 | </property> | ||
135 | <property> | ||
136 | <name>resizeable</name> | ||
137 | <bool>true</bool> | ||
138 | </property> | ||
139 | </column> | ||
140 | <property stdset="1"> | ||
141 | <name>name</name> | ||
142 | <cstring>ListViewPackages</cstring> | ||
143 | </property> | ||
144 | </widget> | ||
145 | </vbox> | ||
146 | </widget> | ||
147 | </UI> | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 94ca824..b2ddf95 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,247 +1,247 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pkdesc.h" | 2 | #include "pkdesc.h" |
3 | #include "pkfind.h" | 3 | #include "pkfind.h" |
4 | #include "pksettings.h" | 4 | #include "pksettings.h" |
5 | #include "package.h" | 5 | #include "package.h" |
6 | #include "packagelistitem.h" | 6 | #include "packagelistitem.h" |
7 | 7 | ||
8 | #include <qpe/process.h> | 8 | #include <qpe/process.h> |
9 | #include <qpe/resource.h> | 9 | #include <qpe/resource.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qpe/stringutil.h> | 11 | #include <qpe/stringutil.h> |
12 | #include <qpe/qcopenvelope_qws.h> | 12 | #include <qpe/qcopenvelope_qws.h> |
13 | #include <qdir.h> | 13 | #include <qdir.h> |
14 | #include <qfile.h> | 14 | #include <qfile.h> |
15 | #include <qmultilineedit.h> | 15 | #include <qmultilineedit.h> |
16 | #include <qstring.h> | 16 | #include <qstring.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #include <qtextview.h> | 18 | #include <qtextview.h> |
19 | 19 | ||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | 22 | ||
23 | #include "mainwindow.h" | 23 | #include "mainwindow.h" |
24 | #include "runwindow.h" | 24 | #include "runwindow.h" |
25 | 25 | ||
26 | 26 | ||
27 | #define PARSE_FILELIST | 27 | #define PARSE_FILELIST |
28 | // #define IPKG_FILELIST | 28 | // #define IPKG_FILELIST |
29 | 29 | ||
30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
31 | // : RunWindow ( p, name, f ) | 31 | // : RunWindow ( p, name, f ) |
32 | : QObject ( p ) | 32 | : QObject ( p ) |
33 | { | 33 | { |
34 | settings = s; | 34 | settings = s; |
35 | runwindow = new RunWindow ( p, name, f ); | 35 | runwindow = new RunWindow ( p, name, f ); |
36 | linkDest = new QCopChannel( "QPE/MakeLinks", this ); | 36 | linkDest = new QCopChannel( "QPE/oipkg", this ); |
37 | connect( linkDest, SIGNAL(received(const QCString &, const QByteArray &)), | 37 | connect( linkDest, SIGNAL(received(const QCString &, const QByteArray &)), |
38 | this, SLOT(linkDestination( const QString &, const QByteArray&)) ); | 38 | this, SLOT(linkDestination( const QString &, const QByteArray&)) ); |
39 | } | 39 | } |
40 | 40 | ||
41 | PmIpkg::~PmIpkg() | 41 | PmIpkg::~PmIpkg() |
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | //#define PROC | 45 | //#define PROC |
46 | #define SYSTEM | 46 | #define SYSTEM |
47 | int PmIpkg::runIpkg(const QString& args) | 47 | int PmIpkg::runIpkg(const QString& args) |
48 | { | 48 | { |
49 | pvDebug(2,"PmIpkg::runIpkg "+args); | 49 | pvDebug(2,"PmIpkg::runIpkg "+args); |
50 | #ifdef PROC | 50 | #ifdef PROC |
51 | QStringList cmd = "/usr/bin/ipkg "; | 51 | QStringList cmd = "/usr/bin/ipkg "; |
52 | #endif | 52 | #endif |
53 | #ifdef SYSTEM | 53 | #ifdef SYSTEM |
54 | QString cmd = "/usr/bin/ipkg "; | 54 | QString cmd = "/usr/bin/ipkg "; |
55 | #endif | 55 | #endif |
56 | cmd += " -dest "+settings->getDestinationName(); | 56 | cmd += " -dest "+settings->getDestinationName(); |
57 | cmd += " -force-defaults "; | 57 | cmd += " -force-defaults "; |
58 | 58 | ||
59 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 59 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
60 | cmd += args; | 60 | cmd += args; |
61 | out( "running:<br>\n"+cmd+"<br>\n" ); | 61 | out( "running:<br>\n"+cmd+"<br>\n" ); |
62 | int r = 0; | 62 | int r = 0; |
63 | #ifdef PROC | 63 | #ifdef PROC |
64 | QString o = "start"; | 64 | QString o = "start"; |
65 | Process ipkg( cmd ); | 65 | Process ipkg( cmd ); |
66 | QString description; | 66 | QString description; |
67 | ipkg.exec("",o); | 67 | ipkg.exec("",o); |
68 | out( o ); | 68 | out( o ); |
69 | #endif | 69 | #endif |
70 | #ifdef SYSTEM | 70 | #ifdef SYSTEM |
71 | QString redirect = "/tmp/oipkg.pipe"; | 71 | QString redirect = "/tmp/oipkg.pipe"; |
72 | cmd += " | tee "+redirect+" 2>&1"; | 72 | cmd += " | tee "+redirect+" 2>&1"; |
73 | pvDebug(2, "running >"+cmd+"<"); | 73 | pvDebug(2, "running >"+cmd+"<"); |
74 | r = system(cmd.latin1()); | 74 | r = system(cmd.latin1()); |
75 | QFile f( redirect ); | 75 | QFile f( redirect ); |
76 | while ( ! f.open(IO_ReadOnly) ) {}; | 76 | while ( ! f.open(IO_ReadOnly) ) {}; |
77 | // if ( f.open(IO_ReadOnly) ) {}; | 77 | // if ( f.open(IO_ReadOnly) ) {}; |
78 | { | 78 | { |
79 | QTextStream t( &f ); | 79 | QTextStream t( &f ); |
80 | QString fp; | 80 | QString fp; |
81 | while ( !t.eof() ) | 81 | while ( !t.eof() ) |
82 | { | 82 | { |
83 | out( t.readLine() +"<br>" ); | 83 | out( t.readLine() +"<br>" ); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | f.close(); | 86 | f.close(); |
87 | out( "Finished!<br>"); | 87 | out( "Finished!<br>"); |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | return r; | 90 | return r; |
91 | } | 91 | } |
92 | 92 | ||
93 | void PmIpkg::makeLinks(QString pack) | 93 | void PmIpkg::makeLinks(QString pack) |
94 | { | 94 | { |
95 | pvDebug( 2, "PmIpkg::makeLinks "+ pack); | 95 | pvDebug( 2, "PmIpkg::makeLinks "+ pack); |
96 | out( "<br>creating links<br>" ); | 96 | out( "<br>creating links<br>" ); |
97 | QString dest = settings->getDestinationUrl(); | 97 | QString dest = settings->getDestinationUrl(); |
98 | out("for package "+pack+" in "+dest+"<br>"); | 98 | out("for package "+pack+" in "+dest+"<br>"); |
99 | #ifdef IPKG_FILELIST | 99 | #ifdef IPKG_FILELIST |
100 | system(("ipkg -d "+dest+" files "+pack+"> /tmp/oipkg.pipe 2>&1").latin1()); | 100 | system(("ipkg -d "+dest+" files "+pack+"> /tmp/oipkg.pipe 2>&1").latin1()); |
101 | QFile f( "/tmp/oipkg.pipe" ); | 101 | QFile f( "/tmp/oipkg.pipe" ); |
102 | while ( ! f.open(IO_ReadOnly) ) {}; | 102 | while ( ! f.open(IO_ReadOnly) ) {}; |
103 | #endif | 103 | #endif |
104 | #ifdef PARSE_FILELIST | 104 | #ifdef PARSE_FILELIST |
105 | { | 105 | { |
106 | Config cfg( "oipkg", Config::User ); | 106 | Config cfg( "oipkg", Config::User ); |
107 | cfg.setGroup( "Common" ); | 107 | cfg.setGroup( "Common" ); |
108 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 108 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
109 | } | 109 | } |
110 | QString fn = dest+"/"+statusDir+"/info/"+pack+".list"; | 110 | QString fn = dest+"/"+statusDir+"/info/"+pack+".list"; |
111 | QFile f( fn ); | 111 | QFile f( fn ); |
112 | if ( ! f.open(IO_ReadOnly) ) | 112 | if ( ! f.open(IO_ReadOnly) ) |
113 | { | 113 | { |
114 | out( "<b>Panik!</b> Could not open:<br>"+fn ); | 114 | out( "<b>Panik!</b> Could not open:<br>"+fn ); |
115 | }; | 115 | }; |
116 | #endif | 116 | #endif |
117 | QTextStream t( &f ); | 117 | QTextStream t( &f ); |
118 | QString fp; | 118 | QString fp; |
119 | while ( !t.eof() ) | 119 | while ( !t.eof() ) |
120 | { | 120 | { |
121 | fp = t.readLine(); | 121 | fp = t.readLine(); |
122 | processLinkDir( fp, dest ); | 122 | processLinkDir( fp, dest ); |
123 | } | 123 | } |
124 | f.close(); | 124 | f.close(); |
125 | } | 125 | } |
126 | 126 | ||
127 | void PmIpkg::processLinkDir( QString file, QString dest ) | 127 | void PmIpkg::processLinkDir( QString file, QString dest ) |
128 | { | 128 | { |
129 | 129 | ||
130 | #ifdef PARSE_FILELIST | 130 | #ifdef PARSE_FILELIST |
131 | QString destFile = file; | 131 | QString destFile = file; |
132 | file = dest+"/"+file; | 132 | file = dest+"/"+file; |
133 | #endif | 133 | #endif |
134 | #ifdef IPKG_FILELIST | 134 | #ifdef IPKG_FILELIST |
135 | QString destFile = file.right( file.length() - dest.length() ); | 135 | QString destFile = file.right( file.length() - dest.length() ); |
136 | #endif | 136 | #endif |
137 | QFileInfo fileInfo( file ); | 137 | QFileInfo fileInfo( file ); |
138 | if ( fileInfo.isDir() ) | 138 | if ( fileInfo.isDir() ) |
139 | { | 139 | { |
140 | QDir destDir( destFile ); | 140 | QDir destDir( destFile ); |
141 | destDir.mkdir( destFile, true ); | 141 | destDir.mkdir( destFile, true ); |
142 | QDir d( file ); | 142 | QDir d( file ); |
143 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 143 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
144 | const QFileInfoList *list = d.entryInfoList(); | 144 | const QFileInfoList *list = d.entryInfoList(); |
145 | QFileInfoListIterator it( *list ); | 145 | QFileInfoListIterator it( *list ); |
146 | QFileInfo *fi; | 146 | QFileInfo *fi; |
147 | while ( (fi=it.current()) ) | 147 | while ( (fi=it.current()) ) |
148 | { | 148 | { |
149 | out( "<b>"+fi->absFilePath()+"</b>" ); | 149 | out( "<b>"+fi->absFilePath()+"</b>" ); |
150 | processLinkDir( fi->absFilePath(), dest ); | 150 | processLinkDir( fi->absFilePath(), dest ); |
151 | ++it; | 151 | ++it; |
152 | } | 152 | } |
153 | } else | 153 | } else |
154 | if ( fileInfo.isFile() ) | 154 | if ( fileInfo.isFile() ) |
155 | { | 155 | { |
156 | const char *instFile = strdup( (file).ascii() ); | 156 | const char *instFile = strdup( (file).ascii() ); |
157 | const char *linkFile = strdup( (destFile).ascii()); | 157 | const char *linkFile = strdup( (destFile).ascii()); |
158 | out( "linking: "+file+" -> "+destFile ); | 158 | out( "linking: "+file+" -> "+destFile ); |
159 | qDebug( "linking: %s -> %s", instFile, linkFile ); | 159 | qDebug( "linking: %s -> %s", instFile, linkFile ); |
160 | symlink( instFile, linkFile ); | 160 | symlink( instFile, linkFile ); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | void PmIpkg::commit( PackageList pl ) | 164 | void PmIpkg::commit( PackageList pl ) |
165 | { | 165 | { |
166 | runwindow->showMaximized(); | 166 | runwindow->showMaximized(); |
167 | // exec(); | 167 | // exec(); |
168 | runwindow->outPut->setText(""); | 168 | runwindow->outPut->setText(""); |
169 | out( "<h1>Starting...</h1><br>\n"); | 169 | out( "<h1>Starting...</h1><br>\n"); |
170 | QStringList to_remove, to_install; | 170 | QStringList to_remove, to_install; |
171 | 171 | ||
172 | QString rem="<b>To remove:</b><br>\n"; | 172 | QString rem="<b>To remove:</b><br>\n"; |
173 | QString inst="<b>To install:</b><br>\n";; | 173 | QString inst="<b>To install:</b><br>\n";; |
174 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 174 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
175 | { | 175 | { |
176 | if ( pack && (pack->name() != "") && pack) | 176 | if ( pack && (pack->name() != "") && pack) |
177 | { | 177 | { |
178 | if ( pack->toInstall() ) | 178 | if ( pack->toInstall() ) |
179 | { | 179 | { |
180 | to_install.append( pack->name() ); | 180 | to_install.append( pack->name() ); |
181 | inst += pack->name()+"<br>"; | 181 | inst += pack->name()+"<br>"; |
182 | } | 182 | } |
183 | if ( pack->toRemove() ) | 183 | if ( pack->toRemove() ) |
184 | { | 184 | { |
185 | to_remove.append( pack->name() ); | 185 | to_remove.append( pack->name() ); |
186 | rem += pack->name()+"<br>"; | 186 | rem += pack->name()+"<br>"; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p>"); | 191 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p>"); |
192 | bool ok=TRUE; | 192 | bool ok=TRUE; |
193 | 193 | ||
194 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); | 194 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); |
195 | 195 | ||
196 | int jobs = to_remove.count()+to_install.count(); | 196 | int jobs = to_remove.count()+to_install.count(); |
197 | if ( jobs < 1 ) return; | 197 | if ( jobs < 1 ) return; |
198 | 198 | ||
199 | if ( to_remove.count() ) | 199 | if ( to_remove.count() ) |
200 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) | 200 | for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it) |
201 | if ( runIpkg("remove " + *it) != 0 ) ok = false; | 201 | if ( runIpkg("remove " + *it) != 0 ) ok = false; |
202 | if ( to_install.count() ) | 202 | if ( to_install.count() ) |
203 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) | 203 | for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it) |
204 | { | 204 | { |
205 | if ( runIpkg("install " + *it) == 0 ) | 205 | if ( runIpkg("install " + *it) == 0 ) |
206 | { | 206 | { |
207 | if ( settings->createLinks() ) | 207 | if ( settings->createLinks() ) |
208 | makeLinks( *it ); | 208 | makeLinks( *it ); |
209 | }else{ | 209 | }else{ |
210 | ok = false; | 210 | ok = false; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | // ##### If we looked in the list of files, we could send out accurate | 214 | // ##### If we looked in the list of files, we could send out accurate |
215 | // ##### messages. But we don't bother yet, and just do an "all". | 215 | // ##### messages. But we don't bother yet, and just do an "all". |
216 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 216 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
217 | QString lf = QString::null; | 217 | QString lf = QString::null; |
218 | e << lf; | 218 | e << lf; |
219 | } | 219 | } |
220 | 220 | ||
221 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 221 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
222 | // add 3rd package parameter | 222 | // add 3rd package parameter |
223 | { | 223 | { |
224 | qDebug("msg="+msg+" -- "+QString(dest) ); | 224 | qDebug("msg="+msg+" -- "+QString(dest) ); |
225 | // QDir d( src ); | 225 | // QDir d( src ); |
226 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 226 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
227 | //// if (! d.exists() ) return; | 227 | //// if (! d.exists() ) return; |
228 | // const QFileInfoList *list = d.entryInfoList(); | 228 | // const QFileInfoList *list = d.entryInfoList(); |
229 | // QFileInfoListIterator it( *list ); | 229 | // QFileInfoListIterator it( *list ); |
230 | // QFileInfo *fi; | 230 | // QFileInfo *fi; |
231 | // while ( (fi=it.current()) ) { | 231 | // while ( (fi=it.current()) ) { |
232 | // processLinkDir( fi->absFilePath(), dest ); | 232 | // processLinkDir( fi->absFilePath(), dest ); |
233 | // ++it; | 233 | // ++it; |
234 | // } | 234 | // } |
235 | } | 235 | } |
236 | 236 | ||
237 | void PmIpkg::update() | 237 | void PmIpkg::update() |
238 | { | 238 | { |
239 | runwindow->showMaximized(); | 239 | runwindow->showMaximized(); |
240 | runIpkg( "update" ); | 240 | runIpkg( "update" ); |
241 | } | 241 | } |
242 | 242 | ||
243 | void PmIpkg::out( QString o ) | 243 | void PmIpkg::out( QString o ) |
244 | { | 244 | { |
245 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | 245 | runwindow->outPut->setText( runwindow->outPut->text()+o ); |
246 | runwindow->outPut->setContentsPos(0,runwindow->outPut->contentsHeight()); | 246 | runwindow->outPut->setContentsPos(0,runwindow->outPut->contentsHeight()); |
247 | } | 247 | } |