summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro2
-rw-r--r--noncore/settings/aqpkg/main.cpp9
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp5
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp85
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h4
5 files changed, 47 insertions, 58 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index 5fc323a..b69bae4 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,14 +1,14 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on release
3 HEADERS = global.h \ 3 HEADERS = global.h \
4 mainwin.h \ 4 mainwin.h \
5 datamgr.h \ 5 datamgr.h \
6 settingsimpl.h \ 6 settingsimpl.h \
7 ipkg.h \ 7 ipkg.h \
8 networkpkgmgr.h \ 8 networkpkgmgr.h \
9 package.h \ 9 package.h \
10 progresswidget.h \ 10 progresswidget.h \
11 installdlgimpl.h \ 11 installdlgimpl.h \
12 instoptionsimpl.h \ 12 instoptionsimpl.h \
13 destination.h \ 13 destination.h \
14 utils.h \ 14 utils.h \
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp
index 53c392e..15ef9d6 100644
--- a/noncore/settings/aqpkg/main.cpp
+++ b/noncore/settings/aqpkg/main.cpp
@@ -6,60 +6,57 @@
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <iostream>
19using namespace std;
20
21#ifdef QWS 18#ifdef QWS
22#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
23#include <qpe/qcopenvelope_qws.h> 20#include <qpe/qcopenvelope_qws.h>
24#else 21#else
25#include <qapplication.h> 22#include <qapplication.h>
26#endif 23#endif
27 24
28#include <qobjectdefs.h> 25#include <qobjectdefs.h>
29 26
30#include "mainwin.h" 27#include "mainwin.h"
31#include "server.h" 28#include "server.h"
32 29
33#include "global.h" 30#include "global.h"
34 31
35 32
36int main(int argc, char *argv[]) 33int main(int argc, char *argv[])
37{ 34{
38 cout << "Root dir = " << ROOT << endl; 35// cout << "Root dir = " << ROOT << endl;
39#ifdef QWS 36#ifdef QWS
40 QPEApplication a( argc, argv ); 37 QPEApplication a( argc, argv );
41#else 38#else
42 QApplication a( argc, argv ); 39 QApplication a( argc, argv );
43#endif 40#endif
44 41
45#ifdef QWS 42#ifdef QWS
46 // Disable suspend mode 43 // Disable suspend mode
47 cout << "Disabling suspend mode" << endl; 44// cout << "Disabling suspend mode" << endl;
48 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 45 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
49#endif 46#endif
50 47
51 MainWindow *win = new MainWindow(); 48 MainWindow *win = new MainWindow();
52 a.setMainWidget(win); 49 a.setMainWidget(win);
53 win->showMaximized(); 50 win->showMaximized();
54 51
55 a.exec(); 52 a.exec();
56 53
57#ifdef QWS 54#ifdef QWS
58 // Reenable suspend mode 55 // Reenable suspend mode
59 cout << "Enabling suspend mode" << endl; 56// cout << "Enabling suspend mode" << endl;
60 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 57 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
61#endif 58#endif
62 #ifdef _DEBUG 59 #ifdef _DEBUG
63 DumpUnfreed(); 60 DumpUnfreed();
64 #endif 61 #endif
65} 62}
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 1a2ac37..d79673f 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -6,27 +6,24 @@
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <iostream>
19using namespace std;
20
21#include <qpe/qpemenubar.h> 18#include <qpe/qpemenubar.h>
22#include <qpe/qpetoolbar.h> 19#include <qpe/qpetoolbar.h>
23#include <qpe/resource.h> 20#include <qpe/resource.h>
24 21
25#include <qaction.h> 22#include <qaction.h>
26#include <qlineedit.h> 23#include <qlineedit.h>
27#include <qmenubar.h> 24#include <qmenubar.h>
28#include <qmessagebox.h> 25#include <qmessagebox.h>
29#include <qpopupmenu.h> 26#include <qpopupmenu.h>
30#include <qtimer.h> 27#include <qtimer.h>
31#include <qwhatsthis.h> 28#include <qwhatsthis.h>
32#include <qwidgetstack.h> 29#include <qwidgetstack.h>
@@ -215,25 +212,25 @@ void MainWindow :: init()
215 connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); 212 connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) );
216 connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), 213 connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ),
217 progressWindow, SLOT( setMessage( const QString & ) ) ); 214 progressWindow, SLOT( setMessage( const QString & ) ) );
218 connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); 215 connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) );
219 216
220 stack->raiseWidget( networkPkgWindow ); 217 stack->raiseWidget( networkPkgWindow );
221} 218}
222 219
223void MainWindow :: setDocument( const QString &doc ) 220void MainWindow :: setDocument( const QString &doc )
224{ 221{
225 // Remove path from package 222 // Remove path from package
226 QString package = Utils::getPackageNameFromIpkFilename( doc ); 223 QString package = Utils::getPackageNameFromIpkFilename( doc );
227 std::cout << "Selecting package " << package << std::endl; 224// std::cout << "Selecting package " << package << std::endl;
228 networkPkgWindow->selectLocalPackage( package ); 225 networkPkgWindow->selectLocalPackage( package );
229} 226}
230 227
231void MainWindow :: displaySettings() 228void MainWindow :: displaySettings()
232{ 229{
233 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 230 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
234 if ( dlg->showDlg( 0 ) ) 231 if ( dlg->showDlg( 0 ) )
235 networkPkgWindow->updateData(); 232 networkPkgWindow->updateData();
236 delete dlg; 233 delete dlg;
237} 234}
238 235
239void MainWindow :: displayHelp() 236void MainWindow :: displayHelp()
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index c209589..b4b6475 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -6,42 +6,38 @@
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <fstream>
19#include <iostream>
20using namespace std;
21
22#include <unistd.h> 18#include <unistd.h>
23#include <stdlib.h>
24#include <linux/limits.h>
25 19
26#ifdef QWS 20#ifdef QWS
27#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
28#include <qpe/qcopenvelope_qws.h> 22#include <qpe/qcopenvelope_qws.h>
29#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/resource.h>
30#else 25#else
31#include <qapplication.h> 26#include <qapplication.h>
32#endif 27#endif
33#include <qlabel.h> 28#include <qlabel.h>
34#include <qfile.h> 29#include <qfile.h>
35#include <qmessagebox.h> 30#include <qmessagebox.h>
31#include <qwhatsthis.h>
36 32
37#include "datamgr.h" 33#include "datamgr.h"
38#include "networkpkgmgr.h" 34#include "networkpkgmgr.h"
39#include "installdlgimpl.h" 35#include "installdlgimpl.h"
40#include "ipkg.h" 36#include "ipkg.h"
41#include "inputdlg.h" 37#include "inputdlg.h"
42#include "letterpushbutton.h" 38#include "letterpushbutton.h"
43#include "categoryfilterimpl.h" 39#include "categoryfilterimpl.h"
44 40
45#include "global.h" 41#include "global.h"
46 42
47extern int compareVersions( const char *v1, const char *v2 ); 43extern int compareVersions( const char *v1, const char *v2 );
@@ -88,25 +84,25 @@ void NetworkPackageManager :: updateData()
88 int i; 84 int i;
89 QString serverName; 85 QString serverName;
90 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) 86 for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
91 { 87 {
92 serverName = it->getServerName(); 88 serverName = it->getServerName();
93 emit progressSetMessage( tr( "Building server list:\n\t%1" ).arg( serverName ) ); 89 emit progressSetMessage( tr( "Building server list:\n\t%1" ).arg( serverName ) );
94 emit progressUpdate( i ); 90 emit progressUpdate( i );
95 qApp->processEvents(); 91 qApp->processEvents();
96 92
97// cout << "Adding " << it->getServerName() << " to combobox" << endl; 93// cout << "Adding " << it->getServerName() << " to combobox" << endl;
98 if ( !it->isServerActive() ) 94 if ( !it->isServerActive() )
99 { 95 {
100 cout << serverName << " is not active" << endl; 96// cout << serverName << " is not active" << endl;
101 i--; 97 i--;
102 continue; 98 continue;
103 } 99 }
104 100
105 serversList->insertItem( serverName ); 101 serversList->insertItem( serverName );
106 if ( serverName == currentlySelectedServer ) 102 if ( serverName == currentlySelectedServer )
107 activeItem = i; 103 activeItem = i;
108 } 104 }
109 105
110 // set selected server to be active server 106 // set selected server to be active server
111 if ( activeItem != -1 ) 107 if ( activeItem != -1 )
112 serversList->setCurrentItem( activeItem ); 108 serversList->setCurrentItem( activeItem );
@@ -136,26 +132,32 @@ void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
136 item->setOn( true ); 132 item->setOn( true );
137 break; 133 break;
138 } 134 }
139 } 135 }
140} 136}
141 137
142 138
143void NetworkPackageManager :: initGui() 139void NetworkPackageManager :: initGui()
144{ 140{
145 QLabel *l = new QLabel( tr( "Servers" ), this ); 141 QLabel *l = new QLabel( tr( "Servers" ), this );
146 serversList = new QComboBox( this ); 142 serversList = new QComboBox( this );
147 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); 143 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
144 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
145
146 installedIcon = Resource::loadPixmap( "aqpkg/installed" );
147 updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
148 148
149 packagesList = new QListView( this ); 149 packagesList = new QListView( this );
150 packagesList->addColumn( tr( "Packages" ), 225 );
151 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
150 152
151 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 ); 153 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1 );
152 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 154 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
153 hbox1->addWidget( l ); 155 hbox1->addWidget( l );
154 hbox1->addWidget( serversList ); 156 hbox1->addWidget( serversList );
155 157
156 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); 158 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
157 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); 159 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
158 160
159 161
160 if ( showJumpTo ) 162 if ( showJumpTo )
161 { 163 {
@@ -165,36 +167,38 @@ void NetworkPackageManager :: initGui()
165 { 167 {
166 text[0] = 'A' + i; 168 text[0] = 'A' + i;
167 LetterPushButton *b = new LetterPushButton( text, this ); 169 LetterPushButton *b = new LetterPushButton( text, this );
168 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 170 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
169 if ( i < 13 ) 171 if ( i < 13 )
170 hbox3->addWidget( b ); 172 hbox3->addWidget( b );
171 else 173 else
172 hbox4->addWidget( b ); 174 hbox4->addWidget( b );
173 } 175 }
174 } 176 }
175 177
176 vbox->addWidget( packagesList ); 178 vbox->addWidget( packagesList );
177 packagesList->addColumn( tr( "Packages" ) ); 179
178
179 downloadEnabled = TRUE; 180 downloadEnabled = TRUE;
180} 181}
181 182
182void NetworkPackageManager :: serverSelected( int index ) 183void NetworkPackageManager :: serverSelected( int index )
183{ 184{
184 serverSelected( index, TRUE ); 185 serverSelected( index, TRUE );
185} 186}
186 187
187void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) 188void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
188{ 189{
190 QPixmap nullIcon( installedIcon.size() );
191 nullIcon.fill( colorGroup().base() );
192
189 // display packages 193 // display packages
190 QString serverName = serversList->currentText(); 194 QString serverName = serversList->currentText();
191 currentlySelectedServer = serverName; 195 currentlySelectedServer = serverName;
192 196
193 vector<Server>::iterator s = dataMgr->getServer( serverName ); 197 vector<Server>::iterator s = dataMgr->getServer( serverName );
194 198
195 vector<Package> &list = s->getPackageList(); 199 vector<Package> &list = s->getPackageList();
196 vector<Package>::iterator it; 200 vector<Package>::iterator it;
197 201
198 // Display progress widget while loading list 202 // Display progress widget while loading list
199 bool doProgress = ( list.size() > 200 ); 203 bool doProgress = ( list.size() > 200 );
200 if ( doProgress ) 204 if ( doProgress )
@@ -251,63 +255,66 @@ void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
251 // Apply the section filter 255 // Apply the section filter
252 if ( categoryFilterEnabled && categoryFilter != "" ) 256 if ( categoryFilterEnabled && categoryFilter != "" )
253 { 257 {
254 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) 258 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
255 continue; 259 continue;
256 } 260 }
257 261
258 // If the local server, only display installed packages 262 // If the local server, only display installed packages
259 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 263 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
260 continue; 264 continue;
261 265
262 266
263 text.append( it->getPackageName() ); 267 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox );
268
264 if ( it->isInstalled() ) 269 if ( it->isInstalled() )
265 { 270 {
266 text.append( " (installed)" ); 271 // If a different version of package is available, show update available icon
267 272 // Otherwise, show installed icon
268 // If a different version of package is available, postfix it with an * 273 if ( it->getVersion() != it->getInstalledVersion() &&
269 if ( it->getVersion() != it->getInstalledVersion() ) 274 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1)
270 { 275 {
271 276
272 if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) 277 item->setPixmap( 0, updatedIcon );
273 text.append( "*" );
274 } 278 }
275 } 279 else
276 280 {
277 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); 281 item->setPixmap( 0, installedIcon );
278 282 }
279 if ( it->isInstalled() ) 283
280 {
281 QString destName = ""; 284 QString destName = "";
282 if ( it->getLocalPackage() ) 285 if ( it->getLocalPackage() )
283 { 286 {
284 if ( it->getLocalPackage()->getInstalledTo() ) 287 if ( it->getLocalPackage()->getInstalledTo() )
285 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 288 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
286 } 289 }
287 else 290 else
288 { 291 {
289 if ( it->getInstalledTo() ) 292 if ( it->getInstalledTo() )
290 destName = it->getInstalledTo()->getDestinationName(); 293 destName = it->getInstalledTo()->getDestinationName();
291 } 294 }
292 if ( destName != "" ) 295 if ( destName != "" )
293 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); 296 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) );
294 } 297 }
298 else
299 {
300 item->setPixmap( 0, nullIcon );
301 }
295 302
296 if ( !it->isPackageStoredLocally() ) 303 if ( !it->isPackageStoredLocally() )
297 { 304 {
298 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); 305 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) );
299 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); 306 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) );
300 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); 307 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) );
301 } 308 }
302 else 309 else
303 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); 310 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) );
304 311
305 if ( serverName == LOCAL_SERVER ) 312 if ( serverName == LOCAL_SERVER )
306 { 313 {
307 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); 314 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) );
308 } 315 }
309 else 316 else
310 { 317 {
311 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); 318 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) );
312 if ( it->getLocalPackage() ) 319 if ( it->getLocalPackage() )
313 { 320 {
@@ -499,34 +506,25 @@ void NetworkPackageManager :: downloadSelectedPackages()
499 // Download each package 506 // Download each package
500 Ipkg ipkg; 507 Ipkg ipkg;
501 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 508 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
502 509
503 ipkg.setOption( "download" ); 510 ipkg.setOption( "download" );
504 ipkg.setRuntimeDirectory( dir ); 511 ipkg.setRuntimeDirectory( dir );
505 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 512 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
506 item != 0 ; 513 item != 0 ;
507 item = (QCheckListItem *)item->nextSibling() ) 514 item = (QCheckListItem *)item->nextSibling() )
508 { 515 {
509 if ( item->isOn() ) 516 if ( item->isOn() )
510 { 517 {
511 QString name = item->text(); 518 ipkg.setPackage( item->text() );
512 int pos = name.find( "*" );
513 name.truncate( pos );
514
515 // if (there is a (installed), remove it
516 pos = name.find( "(installed)" );
517 if ( pos > 0 )
518 name.truncate( pos - 1 );
519
520 ipkg.setPackage( name );
521 ipkg.runIpkg( ); 519 ipkg.runIpkg( );
522 } 520 }
523 } 521 }
524} 522}
525 523
526void NetworkPackageManager :: downloadRemotePackage() 524void NetworkPackageManager :: downloadRemotePackage()
527{ 525{
528 // Display dialog 526 // Display dialog
529 bool ok; 527 bool ok;
530 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 528 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
531 if ( !ok || package.isEmpty() ) 529 if ( !ok || package.isEmpty() )
532 return; 530 return;
@@ -605,31 +603,24 @@ void NetworkPackageManager :: applyChanges()
605 e << lf; 603 e << lf;
606#endif 604#endif
607} 605}
608 606
609// decide what to do - either remove, upgrade or install 607// decide what to do - either remove, upgrade or install
610// Current rules: 608// Current rules:
611// If not installed - install 609// If not installed - install
612// If installed and different version available - upgrade 610// If installed and different version available - upgrade
613// If installed and version up to date - remove 611// If installed and version up to date - remove
614InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 612InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
615{ 613{
616 QString name = item->text(); 614 QString name = item->text();
617 int pos = name.find( "*" );
618 name.truncate( pos );
619
620 // if (there is a (installed), remove it
621 pos = name.find( "(installed)" );
622 if ( pos > 0 )
623 name.truncate( pos - 1 );
624 615
625 // Get package 616 // Get package
626 vector<Server>::iterator s = dataMgr->getServer( serversList->currentText() ); 617 vector<Server>::iterator s = dataMgr->getServer( serversList->currentText() );
627 Package *p = s->getPackage( name ); 618 Package *p = s->getPackage( name );
628 619
629 // If the package has a filename then it is a local file 620 // If the package has a filename then it is a local file
630 if ( p->isPackageStoredLocally() ) 621 if ( p->isPackageStoredLocally() )
631 name = p->getFilename(); 622 name = p->getFilename();
632 623
633 QString option; 624 QString option;
634 QString dest = "root"; 625 QString dest = "root";
635 if ( !p->isInstalled() ) 626 if ( !p->isInstalled() )
@@ -642,26 +633,26 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
642 else 633 else
643 { 634 {
644 InstallData item; 635 InstallData item;
645 item.option = "D"; 636 item.option = "D";
646 if ( !p->isPackageStoredLocally() ) 637 if ( !p->isPackageStoredLocally() )
647 item.packageName = p->getInstalledPackageName(); 638 item.packageName = p->getInstalledPackageName();
648 else 639 else
649 item.packageName = name; 640 item.packageName = name;
650 641
651 if ( p->getInstalledTo() ) 642 if ( p->getInstalledTo() )
652 { 643 {
653 item.destination = p->getInstalledTo(); 644 item.destination = p->getInstalledTo();
654 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 645// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
655 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 646// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
656 } 647 }
657 else 648 else
658 { 649 {
659 item.destination = p->getLocalPackage()->getInstalledTo(); 650 item.destination = p->getLocalPackage()->getInstalledTo();
660 } 651 }
661 652
662 // Now see if version is newer or not 653 // Now see if version is newer or not
663 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 654 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
664 655
665 // If the version requested is older and user selected a local ipk file, then reinstall the file 656 // If the version requested is older and user selected a local ipk file, then reinstall the file
666 if ( p->isPackageStoredLocally() && val == -1 ) 657 if ( p->isPackageStoredLocally() && val == -1 )
667 val = 0; 658 val = 0;
@@ -725,27 +716,27 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
725 716
726 // Check if we are reinstalling the same version 717 // Check if we are reinstalling the same version
727 if ( item.option != "R" ) 718 if ( item.option != "R" )
728 item.recreateLinks = true; 719 item.recreateLinks = true;
729 else 720 else
730 item.recreateLinks = false; 721 item.recreateLinks = false;
731 722
732 // User hit cancel (on dlg - assume remove) 723 // User hit cancel (on dlg - assume remove)
733 return item; 724 return item;
734 } 725 }
735} 726}
736 727
737void NetworkPackageManager :: displayText( const QString &t ) 728void NetworkPackageManager :: displayText( const QString &/*t*/ )
738{ 729{
739 cout << t << endl; 730// cout << t << endl;
740} 731}
741 732
742 733
743void NetworkPackageManager :: letterPushed( QString t ) 734void NetworkPackageManager :: letterPushed( QString t )
744{ 735{
745 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 736 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
746 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 737 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
747 if ( packagesList->firstChild() == 0 ) 738 if ( packagesList->firstChild() == 0 )
748 return; 739 return;
749 740
750 QCheckListItem *item; 741 QCheckListItem *item;
751 if ( start == 0 ) 742 if ( start == 0 )
@@ -769,41 +760,41 @@ void NetworkPackageManager :: letterPushed( QString t )
769 760
770 item = (QCheckListItem *)item->nextSibling(); 761 item = (QCheckListItem *)item->nextSibling();
771 if ( !item ) 762 if ( !item )
772 item = (QCheckListItem *)packagesList->firstChild(); 763 item = (QCheckListItem *)packagesList->firstChild();
773 } while ( item != start); 764 } while ( item != start);
774} 765}
775 766
776 767
777void NetworkPackageManager :: searchForPackage( const QString &text ) 768void NetworkPackageManager :: searchForPackage( const QString &text )
778{ 769{
779 if ( !text.isEmpty() ) 770 if ( !text.isEmpty() )
780 { 771 {
781 cout << "searching for " << text << endl; 772// cout << "searching for " << text << endl;
782 // look through package list for text startng at current position 773 // look through package list for text startng at current position
783 vector<InstallData> workingPackages; 774 vector<InstallData> workingPackages;
784 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 775 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
785 if ( start != 0 ) 776 if ( start != 0 )
786 start = (QCheckListItem *)start->nextSibling(); 777 start = (QCheckListItem *)start->nextSibling();
787 778
788 if ( start == 0 ) 779 if ( start == 0 )
789 start = (QCheckListItem *)packagesList->firstChild(); 780 start = (QCheckListItem *)packagesList->firstChild();
790 781
791 for ( QCheckListItem *item = start; item != 0 ; 782 for ( QCheckListItem *item = start; item != 0 ;
792 item = (QCheckListItem *)item->nextSibling() ) 783 item = (QCheckListItem *)item->nextSibling() )
793 { 784 {
794 cout << "checking " << item->text().lower() << endl; 785// cout << "checking " << item->text().lower() << endl;
795 if ( item->text().lower().find( text ) != -1 ) 786 if ( item->text().lower().find( text ) != -1 )
796 { 787 {
797 cout << "matched " << item->text() << endl; 788// cout << "matched " << item->text() << endl;
798 packagesList->ensureItemVisible( item ); 789 packagesList->ensureItemVisible( item );
799 packagesList->setCurrentItem( item ); 790 packagesList->setCurrentItem( item );
800 break; 791 break;
801 } 792 }
802 } 793 }
803 } 794 }
804} 795}
805 796
806void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) 797void NetworkPackageManager :: showOnlyUninstalledPackages( bool val )
807{ 798{
808 showUninstalledPkgs = val; 799 showUninstalledPkgs = val;
809 if ( val ) 800 if ( val )
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index bd005e2..99eff2e 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -10,24 +10,25 @@
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifndef NETWORKPKGMGR_H 18#ifndef NETWORKPKGMGR_H
19#define NETWORKPKGMGR_H 19#define NETWORKPKGMGR_H
20 20
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qpixmap.h>
22#include <qpushbutton.h> 23#include <qpushbutton.h>
23#include <qwidget.h> 24#include <qwidget.h>
24#include <qcombobox.h> 25#include <qcombobox.h>
25#include <qlistview.h> 26#include <qlistview.h>
26 27
27#include "datamgr.h" 28#include "datamgr.h"
28 29
29class InstallData; 30class InstallData;
30 31
31/** NetworkPackageManager is the base class of the project */ 32/** NetworkPackageManager is the base class of the project */
32class NetworkPackageManager : public QWidget 33class NetworkPackageManager : public QWidget
33{ 34{
@@ -44,24 +45,27 @@ public:
44 void searchForPackage( const QString & ); 45 void searchForPackage( const QString & );
45 void showOnlyUninstalledPackages( bool val ); 46 void showOnlyUninstalledPackages( bool val );
46 void showOnlyInstalledPackages( bool val ); 47 void showOnlyInstalledPackages( bool val );
47 void showUpgradedPackages( bool val ); 48 void showUpgradedPackages( bool val );
48 bool filterByCategory( bool val ); 49 bool filterByCategory( bool val );
49 bool setFilterCategory(); 50 bool setFilterCategory();
50 51
51private: 52private:
52 DataManager *dataMgr; 53 DataManager *dataMgr;
53 54
54 QComboBox *serversList; 55 QComboBox *serversList;
55 QListView *packagesList; 56 QListView *packagesList;
57
58 QPixmap installedIcon;
59 QPixmap updatedIcon;
56 60
57 QString currentlySelectedServer; 61 QString currentlySelectedServer;
58 QString categoryFilter; 62 QString categoryFilter;
59 63
60 bool categoryFilterEnabled; 64 bool categoryFilterEnabled;
61 bool showJumpTo; 65 bool showJumpTo;
62 bool showUninstalledPkgs; 66 bool showUninstalledPkgs;
63 bool showInstalledPkgs; 67 bool showInstalledPkgs;
64 bool showUpgradedPkgs; 68 bool showUpgradedPkgs;
65 69
66 bool downloadEnabled; 70 bool downloadEnabled;
67 71