summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-17 20:03:25 (UTC)
committer andyq <andyq>2002-11-17 20:03:25 (UTC)
commitd94c9d39ab6e744f848a04c07eac03f20c91987c (patch) (unidiff)
treea9f32cca7c59ae565ab9caa3caf567100ed07cb4
parenta94877f543bf0ebc2ec9c4c931cb5f21713b7872 (diff)
downloadopie-d94c9d39ab6e744f848a04c07eac03f20c91987c.zip
opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.tar.gz
opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.tar.bz2
Added filter by category, and added extra fields to package display (Section and size)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro9
-rw-r--r--noncore/settings/aqpkg/categoryfilter.ui118
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.cpp71
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.h40
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp10
-rw-r--r--noncore/settings/aqpkg/datamgr.h5
-rw-r--r--noncore/settings/aqpkg/global.h2
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp23
-rw-r--r--noncore/settings/aqpkg/mainwin.h5
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp59
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h4
-rw-r--r--noncore/settings/aqpkg/package.h6
-rw-r--r--noncore/settings/aqpkg/server.cpp19
-rw-r--r--noncore/settings/aqpkg/server.h1
14 files changed, 363 insertions, 9 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index 301f4f2..6cc5a23 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -6,39 +6,42 @@ HEADERS = global.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 progressdlg.h \ 10 progressdlg.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 \
15 server.h \ 15 server.h \
16 helpwindow.h \ 16 helpwindow.h \
17 letterpushbutton.h \ 17 letterpushbutton.h \
18 inputdlg.h 18 inputdlg.h \
19 categoryfilterimpl.h
19 SOURCES = mainwin.cpp \ 20 SOURCES = mainwin.cpp \
20 datamgr.cpp \ 21 datamgr.cpp \
21 mem.cpp \ 22 mem.cpp \
22 settingsimpl.cpp \ 23 settingsimpl.cpp \
23 ipkg.cpp \ 24 ipkg.cpp \
24 networkpkgmgr.cpp \ 25 networkpkgmgr.cpp \
25 main.cpp \ 26 main.cpp \
26 package.cpp \ 27 package.cpp \
27 progressdlg.cpp \ 28 progressdlg.cpp \
28 installdlgimpl.cpp \ 29 installdlgimpl.cpp \
29 instoptionsimpl.cpp \ 30 instoptionsimpl.cpp \
30 destination.cpp \ 31 destination.cpp \
31 utils.cpp \ 32 utils.cpp \
32 server.cpp \ 33 server.cpp \
33 helpwindow.cpp \ 34 helpwindow.cpp \
34 letterpushbutton.cpp \ 35 letterpushbutton.cpp \
35 inputdlg.cpp \ 36 inputdlg.cpp \
36 version.cpp 37 version.cpp \
38 categoryfilterimpl.cpp
37 INTERFACES= settings.ui \ 39 INTERFACES= settings.ui \
38 install.ui \ 40 install.ui \
39 instoptions.ui 41 instoptions.ui \
42 categoryfilter.ui
40 TARGET = aqpkg 43 TARGET = aqpkg
41INCLUDEPATH += $(OPIEDIR)/include 44INCLUDEPATH += $(OPIEDIR)/include
42DEPENDPATH += $(OPIEDIR)/include 45DEPENDPATH += $(OPIEDIR)/include
43LIBS += -lqpe -lstdc++ 46LIBS += -lqpe -lstdc++
44DESTDIR = $(OPIEDIR)/bin 47DESTDIR = $(OPIEDIR)/bin
diff --git a/noncore/settings/aqpkg/categoryfilter.ui b/noncore/settings/aqpkg/categoryfilter.ui
new file mode 100644
index 0000000..3416243
--- a/dev/null
+++ b/noncore/settings/aqpkg/categoryfilter.ui
@@ -0,0 +1,118 @@
1<!DOCTYPE UI><UI>
2<class>CategoryFilterDlg</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>CategoryFilterDlg</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>215</width>
15 <height>295</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Category Filter</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget row="1" column="0" >
32 <class>QLayoutWidget</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>Layout4</cstring>
36 </property>
37 <grid>
38 <property stdset="1">
39 <name>margin</name>
40 <number>0</number>
41 </property>
42 <property stdset="1">
43 <name>spacing</name>
44 <number>6</number>
45 </property>
46 <widget row="0" column="1" >
47 <class>QPushButton</class>
48 <property stdset="1">
49 <name>name</name>
50 <cstring>btnOK</cstring>
51 </property>
52 <property stdset="1">
53 <name>text</name>
54 <string>&amp;OK</string>
55 </property>
56 </widget>
57 <widget row="0" column="0" >
58 <class>QPushButton</class>
59 <property stdset="1">
60 <name>name</name>
61 <cstring>btnCancel</cstring>
62 </property>
63 <property stdset="1">
64 <name>text</name>
65 <string>&amp;Cancel</string>
66 </property>
67 </widget>
68 </grid>
69 </widget>
70 <widget row="0" column="0" >
71 <class>QGroupBox</class>
72 <property stdset="1">
73 <name>name</name>
74 <cstring>GroupBox1</cstring>
75 </property>
76 <property stdset="1">
77 <name>title</name>
78 <string>Select groups to show</string>
79 </property>
80 <grid>
81 <property stdset="1">
82 <name>margin</name>
83 <number>11</number>
84 </property>
85 <property stdset="1">
86 <name>spacing</name>
87 <number>6</number>
88 </property>
89 <widget row="0" column="0" >
90 <class>QListBox</class>
91 <property stdset="1">
92 <name>name</name>
93 <cstring>lstCategories</cstring>
94 </property>
95 <property stdset="1">
96 <name>selectionMode</name>
97 <enum>Multi</enum>
98 </property>
99 </widget>
100 </grid>
101 </widget>
102 </grid>
103</widget>
104<connections>
105 <connection>
106 <sender>btnCancel</sender>
107 <signal>clicked()</signal>
108 <receiver>CategoryFilterDlg</receiver>
109 <slot>reject()</slot>
110 </connection>
111 <connection>
112 <sender>btnOK</sender>
113 <signal>clicked()</signal>
114 <receiver>CategoryFilterDlg</receiver>
115 <slot>accept()</slot>
116 </connection>
117</connections>
118</UI>
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp
new file mode 100644
index 0000000..0746da6
--- a/dev/null
+++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp
@@ -0,0 +1,71 @@
1/***************************************************************************
2 categoryfilterimpl.cpp - description
3 -------------------
4 begin : Sun Nov 17 2002
5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#include <iostream>
18using namespace std;
19
20#include <qlistbox.h>
21#include <qstring.h>
22
23#include "categoryfilterimpl.h"
24
25CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name )
26 : CategoryFilterDlg(parent,name, true)
27{
28 // Split up categories and add them to the listbox
29 int start = 1;
30
31 QString item;
32 int end;
33 do
34 {
35 end = categories.find( "#", start );
36 item = categories.mid( start, end - start );
37 if ( item != "" )
38 {
39 lstCategories->insertItem( item );
40
41 if ( selectedCategories.find( "#" + item + "#" ) != -1 )
42 lstCategories->setSelected( lstCategories->count()-1, true );
43 }
44
45 start = end + 1;
46 } while ( start < (int)categories.length() );
47
48 lstCategories->sort( true );
49
50 showMaximized();
51}
52
53CategoryFilterImpl :: ~CategoryFilterImpl()
54{
55}
56
57QString CategoryFilterImpl :: getSelectedFilter()
58{
59 // Grab cetegories from listbox
60 QString ret = "#";
61
62 for ( int i = 0 ; i < (int)lstCategories->count() ; ++i )
63 {
64 if ( lstCategories->isSelected( i ) )
65 ret += lstCategories->text( i ) + "#";
66 }
67
68 if ( ret == "#" )
69 ret = "";
70 return ret;
71}
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.h b/noncore/settings/aqpkg/categoryfilterimpl.h
new file mode 100644
index 0000000..b6b4fd5
--- a/dev/null
+++ b/noncore/settings/aqpkg/categoryfilterimpl.h
@@ -0,0 +1,40 @@
1/***************************************************************************
2 categoryfilterimpl.h - description
3 -------------------
4 begin : Sun Nov 17 2002
5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef CATEGORYFILTERIMPL_H
19#define CATEGORYFILTERIMPL_H
20
21#include <qwidget.h>
22#include <qstring.h>
23
24#include "categoryfilter.h"
25
26/**
27 *@author Andy Qua
28 */
29
30class CategoryFilterImpl : public CategoryFilterDlg
31{
32 Q_OBJECT
33public:
34 CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent=0, const char *name=0);
35 ~CategoryFilterImpl();
36
37 QString getSelectedFilter();
38};
39
40#endif
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index f342aff..1420242 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -19,27 +19,29 @@
19using namespace std; 19using namespace std;
20 20
21#ifdef QWS 21#ifdef QWS
22#include <qpe/config.h> 22#include <qpe/config.h>
23#endif 23#endif
24 24
25#include <stdio.h> 25#include <stdio.h>
26 26
27#include "datamgr.h" 27#include "datamgr.h"
28#include "global.h" 28#include "global.h"
29 29
30 30
31QString DataManager::availableCategories = "";
31DataManager::DataManager() 32DataManager::DataManager()
32{ 33{
33 activeServer = ""; 34 activeServer = "";
35 availableCategories = "#";
34} 36}
35 37
36DataManager::~DataManager() 38DataManager::~DataManager()
37{ 39{
38} 40}
39 41
40Server *DataManager :: getServer( const char *name ) 42Server *DataManager :: getServer( const char *name )
41{ 43{
42 Server *s = 0; 44 Server *s = 0;
43 vector<Server>::iterator it = serverList.begin(); 45 vector<Server>::iterator it = serverList.begin();
44 while ( it != serverList.end() && s == 0 ) 46 while ( it != serverList.end() && s == 0 )
45 { 47 {
@@ -198,12 +200,20 @@ void DataManager :: writeOutIpkgConf()
198 out << endl; 200 out << endl;
199 201
200 // Write out destinations 202 // Write out destinations
201 vector<Destination>::iterator it2 = destList.begin(); 203 vector<Destination>::iterator it2 = destList.begin();
202 while ( it2 != destList.end() ) 204 while ( it2 != destList.end() )
203 { 205 {
204 out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; 206 out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl;
205 it2++; 207 it2++;
206 } 208 }
207 209
208 out.close(); 210 out.close();
209} 211}
212
213
214void DataManager :: setAvailableCategories( QString section )
215{
216 section = section.lower();
217 if ( availableCategories.find( "#" + section + "#" ) == -1 )
218 availableCategories += section + "#";
219}
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 8c6fb0d..3a64d92 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -12,24 +12,26 @@
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 DATAMGR_H 18#ifndef DATAMGR_H
19#define DATAMGR_H 19#define DATAMGR_H
20 20
21#include <map> 21#include <map>
22using namespace std; 22using namespace std;
23 23
24#include <qstring.h>
25
24#include "server.h" 26#include "server.h"
25#include "destination.h" 27#include "destination.h"
26 28
27 #define LOCAL_SERVER "Installed Pkgs" 29 #define LOCAL_SERVER "Installed Pkgs"
28 #define LOCAL_IPKGS "local IPKG" 30 #define LOCAL_IPKGS "local IPKG"
29 31
30/** 32/**
31 *@author Andy Qua 33 *@author Andy Qua
32 */ 34 */
33 35
34 36
35class DataManager 37class DataManager
@@ -44,21 +46,24 @@ public:
44 Server *getLocalServer() { return getServer( LOCAL_SERVER ); } 46 Server *getLocalServer() { return getServer( LOCAL_SERVER ); }
45 vector<Server> &getServerList() { return serverList; } 47 vector<Server> &getServerList() { return serverList; }
46 Server *getServer( const char *name ); 48 Server *getServer( const char *name );
47 49
48 vector<Destination> &getDestinationList() { return destList; } 50 vector<Destination> &getDestinationList() { return destList; }
49 Destination *getDestination( const char *name ); 51 Destination *getDestination( const char *name );
50 52
51 void loadServers(); 53 void loadServers();
52 void reloadServerData( ); 54 void reloadServerData( );
53 55
54 void writeOutIpkgConf(); 56 void writeOutIpkgConf();
55 57
58 static QString getAvailableCategories() { return availableCategories; }
59 static void setAvailableCategories( QString section );
56 60
57private: 61private:
62 static QString availableCategories;
58 QString activeServer; 63 QString activeServer;
59 64
60 vector<Server> serverList; 65 vector<Server> serverList;
61 vector<Destination> destList; 66 vector<Destination> destList;
62}; 67};
63 68
64#endif 69#endif
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h
index e65e2a0..609e1e8 100644
--- a/noncore/settings/aqpkg/global.h
+++ b/noncore/settings/aqpkg/global.h
@@ -9,25 +9,25 @@
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#ifndef __GLOBAL_H 18#ifndef __GLOBAL_H
19#define __GLOBAL_H 19#define __GLOBAL_H
20 20
21#define VERSION_TEXT "AQPkg Version 1.0" 21#define VERSION_TEXT "AQPkg Version 1.1"
22 22
23// Uncomment the below line to run on a Linux box rather than a Zaurus 23// Uncomment the below line to run on a Linux box rather than a Zaurus
24// box this allows you to change where root is, and where to load config files from 24// box this allows you to change where root is, and where to load config files from
25// #define X86 25// #define X86
26 26
27// Sets up location of ipkg.conf and root directory 27// Sets up location of ipkg.conf and root directory
28#ifdef QWS 28#ifdef QWS
29 29
30#ifndef X86 30#ifndef X86
31 31
32// Running QT/Embedded on an arm processor 32// Running QT/Embedded on an arm processor
33#define IPKG_CONF "/etc/ipkg.conf" 33#define IPKG_CONF "/etc/ipkg.conf"
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 5ccd3c3..0141359 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -45,24 +45,27 @@ MainWindow :: MainWindow( QWidget *p, char *name )
45 45
46 settings = new QPopupMenu( this ); 46 settings = new QPopupMenu( this );
47 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); 47 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
48 48
49 edit = new QPopupMenu( this ); 49 edit = new QPopupMenu( this );
50 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I ); 50 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I );
51 edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N ); 51 edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N );
52 52
53 filter = new QPopupMenu( this ); 53 filter = new QPopupMenu( this );
54 mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U ); 54 mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U );
55 mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S ); 55 mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S );
56 mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P ); 56 mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P );
57 filter->insertSeparator();
58 mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C );
59 mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A );
57 60
58 // Create the main menu 61 // Create the main menu
59 menu = menuBar(); //new QMenuBar( this ); 62 menu = menuBar(); //new QMenuBar( this );
60 menu->insertItem( "&Settings", settings ); 63 menu->insertItem( "&Settings", settings );
61 menu->insertItem( "&Edit", edit ); 64 menu->insertItem( "&Edit", edit );
62 menu->insertItem( "&Filter", filter ); 65 menu->insertItem( "&Filter", filter );
63 menu->insertItem( "&Help", help ); 66 menu->insertItem( "&Help", help );
64 67
65 mgr = new DataManager(); 68 mgr = new DataManager();
66 mgr->loadServers(); 69 mgr->loadServers();
67 70
68 stack = new QWidgetStack( this ); 71 stack = new QWidgetStack( this );
@@ -175,12 +178,32 @@ void MainWindow :: filterUpgradedPackages()
175 { 178 {
176 val = true; 179 val = true;
177 filter->setItemChecked( mnuShowUpgradedPkgsId, true ); 180 filter->setItemChecked( mnuShowUpgradedPkgsId, true );
178 } 181 }
179 182
180 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 183 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
181 networkPkgWindow->showOnlyUninstalledPackages( false ); 184 networkPkgWindow->showOnlyUninstalledPackages( false );
182 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 185 filter->setItemChecked( mnuShowInstalledPkgsId, false );
183 networkPkgWindow->showOnlyInstalledPackages( false ); 186 networkPkgWindow->showOnlyInstalledPackages( false );
184 187
185 networkPkgWindow->showUpgradedPackages( val ); 188 networkPkgWindow->showUpgradedPackages( val );
186} 189}
190
191void MainWindow :: setFilterCategory()
192{
193 if ( networkPkgWindow->setFilterCategory( ) )
194 filter->setItemChecked( mnuFilterByCategory, true );
195}
196
197void MainWindow :: filterCategory()
198{
199 if ( filter->isItemChecked( mnuFilterByCategory ) )
200 {
201 networkPkgWindow->filterByCategory( false );
202 filter->setItemChecked( mnuFilterByCategory, false );
203 }
204 else
205 {
206 if ( networkPkgWindow->filterByCategory( true ) )
207 filter->setItemChecked( mnuFilterByCategory, true );
208 }
209} \ No newline at end of file
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 7b6e0ba..92aba4d 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -39,25 +39,30 @@ private:
39 QMenuBar *menu; 39 QMenuBar *menu;
40 QPopupMenu *help; 40 QPopupMenu *help;
41 QPopupMenu *settings; 41 QPopupMenu *settings;
42 QPopupMenu *edit; 42 QPopupMenu *edit;
43 QPopupMenu *filter; 43 QPopupMenu *filter;
44 QWidgetStack *stack; 44 QWidgetStack *stack;
45 45
46 NetworkPackageManager *networkPkgWindow; 46 NetworkPackageManager *networkPkgWindow;
47 47
48 int mnuShowUninstalledPkgsId; 48 int mnuShowUninstalledPkgsId;
49 int mnuShowInstalledPkgsId; 49 int mnuShowInstalledPkgsId;
50 int mnuShowUpgradedPkgsId; 50 int mnuShowUpgradedPkgsId;
51 int mnuFilterByCategory;
52 int mnuSetFilterCategory;
51 53
52public slots: 54public slots:
53 void setDocument( const QString &doc ); 55 void setDocument( const QString &doc );
54 void displayHelp(); 56 void displayHelp();
55 void searchForPackage(); 57 void searchForPackage();
56 void repeatSearchForPackage(); 58 void repeatSearchForPackage();
57 void displayAbout(); 59 void displayAbout();
58 void displaySettings(); 60 void displaySettings();
59 void filterUninstalledPackages(); 61 void filterUninstalledPackages();
60 void filterInstalledPackages(); 62 void filterInstalledPackages();
61 void filterUpgradedPackages(); 63 void filterUpgradedPackages();
64 void filterCategory();
65 void setFilterCategory();
66
62}; 67};
63#endif 68#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 188f90d..0814121 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -31,47 +31,48 @@ using namespace std;
31#include <qapplication.h> 31#include <qapplication.h>
32#endif 32#endif
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qfile.h> 34#include <qfile.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36 36
37#include "datamgr.h" 37#include "datamgr.h"
38#include "networkpkgmgr.h" 38#include "networkpkgmgr.h"
39#include "installdlgimpl.h" 39#include "installdlgimpl.h"
40#include "ipkg.h" 40#include "ipkg.h"
41#include "inputdlg.h" 41#include "inputdlg.h"
42#include "letterpushbutton.h" 42#include "letterpushbutton.h"
43#include "categoryfilterimpl.h"
43 44
44#include "global.h" 45#include "global.h"
45 46
46extern int compareVersions( const char *v1, const char *v2 ); 47extern int compareVersions( const char *v1, const char *v2 );
47 48
48NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 49NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
49 : QWidget(parent, name) 50 : QWidget(parent, name)
50{ 51{
51 dataMgr = dataManager; 52 dataMgr = dataManager;
52 53
53#ifdef QWS 54#ifdef QWS
54 // read download directory from config file 55 // read download directory from config file
55 Config cfg( "aqpkg" ); 56 Config cfg( "aqpkg" );
56 cfg.setGroup( "settings" ); 57 cfg.setGroup( "settings" );
57 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 58 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
58 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 59 showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
59 60
60#endif 61#endif
61 62
62 showUninstalledPkgs = false; 63 showUninstalledPkgs = false;
63 showInstalledPkgs = false; 64 showInstalledPkgs = false;
64 showUpgradedPkgs = false; 65 showUpgradedPkgs = false;
65 66 categoryFilterEnabled = false;
66 67
67 initGui(); 68 initGui();
68 setupConnections(); 69 setupConnections();
69 70
70 updateData(); 71 updateData();
71} 72}
72 73
73NetworkPackageManager::~NetworkPackageManager() 74NetworkPackageManager::~NetworkPackageManager()
74{ 75{
75} 76}
76 77
77void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 78void NetworkPackageManager :: timerEvent ( QTimerEvent * )
@@ -230,24 +231,31 @@ void NetworkPackageManager :: serverSelected( int )
230 // Apply show only installed packages filter 231 // Apply show only installed packages filter
231 if ( showInstalledPkgs && !it->isInstalled() ) 232 if ( showInstalledPkgs && !it->isInstalled() )
232 continue; 233 continue;
233 234
234 // Apply show only new installed packages filter 235 // Apply show only new installed packages filter
235 if ( showUpgradedPkgs ) 236 if ( showUpgradedPkgs )
236 { 237 {
237 if ( !it->isInstalled() || 238 if ( !it->isInstalled() ||
238 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) 239 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
239 continue; 240 continue;
240 } 241 }
241 242
243 // Apply the section filter
244 if ( categoryFilterEnabled && categoryFilter != "" )
245 {
246 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
247 continue;
248 }
249
242 // If the local server, only display installed packages 250 // If the local server, only display installed packages
243 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 251 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
244 continue; 252 continue;
245 253
246 254
247 text += it->getPackageName(); 255 text += it->getPackageName();
248 if ( it->isInstalled() ) 256 if ( it->isInstalled() )
249 { 257 {
250 text += " (installed)"; 258 text += " (installed)";
251 259
252 // If a different version of package is available, postfix it with an * 260 // If a different version of package is available, postfix it with an *
253 if ( it->getVersion() != it->getInstalledVersion() ) 261 if ( it->getVersion() != it->getInstalledVersion() )
@@ -286,24 +294,27 @@ void NetworkPackageManager :: serverSelected( int )
286 { 294 {
287 new QCheckListItem( item, QString( "V. Installed - " ) + it->getVersion() ); 295 new QCheckListItem( item, QString( "V. Installed - " ) + it->getVersion() );
288 } 296 }
289 else 297 else
290 { 298 {
291 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); 299 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
292 if ( it->getLocalPackage() ) 300 if ( it->getLocalPackage() )
293 { 301 {
294 if ( it->isInstalled() ) 302 if ( it->isInstalled() )
295 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); 303 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
296 } 304 }
297 } 305 }
306
307 new QCheckListItem( item, QString( "Size - " ) + it->getPackageSize() );
308 new QCheckListItem( item, QString( "Section - " ) + it->getSection() );
298 packagesList->insertItem( item ); 309 packagesList->insertItem( item );
299 } 310 }
300 311
301 // If the local server or the local ipkgs server disable the download button 312 // If the local server or the local ipkgs server disable the download button
302 if ( serverName == LOCAL_SERVER ) 313 if ( serverName == LOCAL_SERVER )
303 { 314 {
304 upgrade->setEnabled( false ); 315 upgrade->setEnabled( false );
305 download->setText( "Download" ); 316 download->setText( "Download" );
306 download->setEnabled( true ); 317 download->setEnabled( true );
307 } 318 }
308 else if ( serverName == LOCAL_IPKGS ) 319 else if ( serverName == LOCAL_IPKGS )
309 { 320 {
@@ -316,28 +327,24 @@ void NetworkPackageManager :: serverSelected( int )
316 upgrade->setEnabled( true ); 327 upgrade->setEnabled( true );
317 download->setEnabled( true ); 328 download->setEnabled( true );
318 download->setText( "Download" ); 329 download->setText( "Download" );
319 } 330 }
320} 331}
321 332
322void NetworkPackageManager :: updateServer() 333void NetworkPackageManager :: updateServer()
323{ 334{
324 QString serverName = serversList->currentText(); 335 QString serverName = serversList->currentText();
325 336
326 // Update the current server 337 // Update the current server
327 // Display dialog 338 // Display dialog
328// ProgressDlg *progDlg = new ProgressDlg( this );
329// QString status = "Updating package lists...";
330// progDlg->show();
331// progDlg->setText( status );
332 339
333 // Disable buttons to stop silly people clicking lots on them :) 340 // Disable buttons to stop silly people clicking lots on them :)
334 341
335 // First, write out ipkg_conf file so that ipkg can use it 342 // First, write out ipkg_conf file so that ipkg can use it
336 dataMgr->writeOutIpkgConf(); 343 dataMgr->writeOutIpkgConf();
337 344
338 Ipkg ipkg; 345 Ipkg ipkg;
339 ipkg.setOption( "update" ); 346 ipkg.setOption( "update" );
340 347
341 InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true ); 348 InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true );
342 dlg.showDlg(); 349 dlg.showDlg();
343 350
@@ -795,12 +802,54 @@ void NetworkPackageManager :: showOnlyUninstalledPackages( bool val )
795 802
796void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) 803void NetworkPackageManager :: showOnlyInstalledPackages( bool val )
797{ 804{
798 showInstalledPkgs = val; 805 showInstalledPkgs = val;
799 serverSelected( -1 ); 806 serverSelected( -1 );
800} 807}
801 808
802void NetworkPackageManager :: showUpgradedPackages( bool val ) 809void NetworkPackageManager :: showUpgradedPackages( bool val )
803{ 810{
804 showUpgradedPkgs = val; 811 showUpgradedPkgs = val;
805 serverSelected( -1 ); 812 serverSelected( -1 );
806} 813}
814
815bool NetworkPackageManager :: filterByCategory( bool val )
816{
817 if ( val )
818 {
819 if ( categoryFilter == "" )
820 {
821 if ( !setFilterCategory() )
822 return false;
823 }
824
825 categoryFilterEnabled = true;
826 serverSelected( -1 );
827 return true;
828 }
829 else
830 {
831 // Turn off filter
832 categoryFilterEnabled = false;
833 serverSelected( -1 );
834 return false;
835 }
836}
837
838bool NetworkPackageManager :: setFilterCategory( )
839{
840 // Get categories;
841 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this );
842 if ( dlg.exec() == QDialog::Accepted )
843 {
844 categoryFilter = dlg.getSelectedFilter();
845
846 if ( categoryFilter == "" )
847 return false;
848
849 categoryFilterEnabled = true;
850 serverSelected( -1 );
851 return true;
852 }
853
854 return false;
855}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 937c9b4..46919d7 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -35,39 +35,43 @@ class NetworkPackageManager : public QWidget
35public: 35public:
36 /** construtor */ 36 /** construtor */
37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); 37 NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0);
38 /** destructor */ 38 /** destructor */
39 ~NetworkPackageManager(); 39 ~NetworkPackageManager();
40 40
41 void selectLocalPackage( const QString &pkg ); 41 void selectLocalPackage( const QString &pkg );
42 void updateData(); 42 void updateData();
43 void searchForPackage( bool findNext ); 43 void searchForPackage( bool findNext );
44 void showOnlyUninstalledPackages( bool val ); 44 void showOnlyUninstalledPackages( bool val );
45 void showOnlyInstalledPackages( bool val ); 45 void showOnlyInstalledPackages( bool val );
46 void showUpgradedPackages( bool val ); 46 void showUpgradedPackages( bool val );
47 bool filterByCategory( bool val );
48 bool setFilterCategory();
47 49
48private: 50private:
49 DataManager *dataMgr; 51 DataManager *dataMgr;
50 52
51 QComboBox *serversList; 53 QComboBox *serversList;
52 QListView *packagesList; 54 QListView *packagesList;
53 QPushButton *update; 55 QPushButton *update;
54 QPushButton *upgrade; 56 QPushButton *upgrade;
55 QPushButton *download; 57 QPushButton *download;
56 QPushButton *apply; 58 QPushButton *apply;
57 59
58 ProgressDlg *progressDlg; 60 ProgressDlg *progressDlg;
59 QString currentlySelectedServer; 61 QString currentlySelectedServer;
60 QString lastSearchText; 62 QString lastSearchText;
63 QString categoryFilter;
61 64
65 bool categoryFilterEnabled;
62 bool showJumpTo; 66 bool showJumpTo;
63 bool showUninstalledPkgs; 67 bool showUninstalledPkgs;
64 bool showInstalledPkgs; 68 bool showInstalledPkgs;
65 bool showUpgradedPkgs; 69 bool showUpgradedPkgs;
66 int timerId; 70 int timerId;
67 71
68 void timerEvent ( QTimerEvent * ); 72 void timerEvent ( QTimerEvent * );
69 73
70 void initGui(); 74 void initGui();
71 void setupConnections(); 75 void setupConnections();
72 void showProgressDialog( char *initialText ); 76 void showProgressDialog( char *initialText );
73 void downloadSelectedPackages(); 77 void downloadSelectedPackages();
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h
index 56ef874..7545818 100644
--- a/noncore/settings/aqpkg/package.h
+++ b/noncore/settings/aqpkg/package.h
@@ -35,49 +35,55 @@ public:
35 ~Package(); 35 ~Package();
36 36
37 void setLocalPackage( Package *p ); 37 void setLocalPackage( Package *p );
38 void setPackageName( QString &name ); 38 void setPackageName( QString &name );
39 void setVersion( QString &v ); 39 void setVersion( QString &v );
40 void setStatus( QString &s ); 40 void setStatus( QString &s );
41 void setDescription( QString &d ); 41 void setDescription( QString &d );
42 void setFilename( QString &f ); 42 void setFilename( QString &f );
43 void setPackageStoredLocally( bool local ){ packageStoredLocally = local; } 43 void setPackageStoredLocally( bool local ){ packageStoredLocally = local; }
44 void setInstalledToRoot( bool root ) { installedToRoot = root; } 44 void setInstalledToRoot( bool root ) { installedToRoot = root; }
45 void setInstalledTo( Destination *d ) { installedTo = d; } 45 void setInstalledTo( Destination *d ) { installedTo = d; }
46 void setDependancies( QString &deps ) { dependancies = deps; } 46 void setDependancies( QString &deps ) { dependancies = deps; }
47 void setPackageSize( QString size ) { packageSize = size; }
48 void setSection( QString sect) { section = sect; }
47 49
48 Package *getLocalPackage() { return localPackage; } 50 Package *getLocalPackage() { return localPackage; }
49 QString getPackageName() { return packageName; } 51 QString getPackageName() { return packageName; }
50 QString getVersion() { return version; } 52 QString getVersion() { return version; }
51 QString getStatus() { return status; } 53 QString getStatus() { return status; }
52 QString getDescription() { return description; } 54 QString getDescription() { return description; }
53 QString getFilename() { return filename; } 55 QString getFilename() { return filename; }
54 QString getDependancies() { return dependancies; } 56 QString getDependancies() { return dependancies; }
57 QString getPackageSize() { return packageSize; }
58 QString getSection() { return section; }
55 59
56 bool isInstalled(); 60 bool isInstalled();
57 bool isPackageStoredLocally(){ return packageStoredLocally; } 61 bool isPackageStoredLocally(){ return packageStoredLocally; }
58 bool isInstalledToRoot() { return installedToRoot; } 62 bool isInstalledToRoot() { return installedToRoot; }
59 QString getInstalledVersion(); 63 QString getInstalledVersion();
60 QString getInstalledPackageName(); 64 QString getInstalledPackageName();
61 Destination *getInstalledTo() { return installedTo; } 65 Destination *getInstalledTo() { return installedTo; }
62 66
63 QString toString(); 67 QString toString();
64 68
65 69
66private: 70private:
67 Package *localPackage; 71 Package *localPackage;
68 72
69 QString packageName; 73 QString packageName;
70 QString version; 74 QString version;
71 QString status; 75 QString status;
72 QString description; 76 QString description;
73 QString filename; 77 QString filename;
74 bool packageStoredLocally; 78 bool packageStoredLocally;
75 bool installedToRoot; 79 bool installedToRoot;
76 bool installed; 80 bool installed;
77 bool differentVersionAvailable; 81 bool differentVersionAvailable;
78 QString dependancies; 82 QString dependancies;
83 QString packageSize;
84 QString section;
79 85
80 Destination *installedTo; 86 Destination *installedTo;
81}; 87};
82 88
83#endif 89#endif
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 539ebf0..7c3257b 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -19,24 +19,25 @@
19 ***************************************************************************/ 19 ***************************************************************************/
20 20
21 21
22#include <stdio.h> 22#include <stdio.h>
23#include <string.h> 23#include <string.h>
24#include <stdlib.h> 24#include <stdlib.h>
25 25
26#include <iostream> 26#include <iostream>
27#include <fstream> 27#include <fstream>
28using namespace std; 28using namespace std;
29 29
30#include "server.h" 30#include "server.h"
31#include "datamgr.h"
31 32
32#ifdef QWS 33#ifdef QWS
33#include <qpe/global.h> 34#include <qpe/global.h>
34#include <qpe/applnk.h> 35#include <qpe/applnk.h>
35#include <qlist.h> 36#include <qlist.h>
36#endif 37#endif
37 38
38#include "utils.h" 39#include "utils.h"
39 40
40#include "global.h" 41#include "global.h"
41 42
42Server :: Server( const char *name, const char *url ) 43Server :: Server( const char *name, const char *url )
@@ -202,24 +203,36 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
202 currPackage->setStatus( value ); 203 currPackage->setStatus( value );
203 } 204 }
204 else if ( key == "Description" ) 205 else if ( key == "Description" )
205 { 206 {
206 if ( currPackage ) 207 if ( currPackage )
207 currPackage->setDescription( value ); 208 currPackage->setDescription( value );
208 } 209 }
209 else if ( key == "Filename" ) 210 else if ( key == "Filename" )
210 { 211 {
211 if ( currPackage ) 212 if ( currPackage )
212 currPackage->setFilename( value ); 213 currPackage->setFilename( value );
213 } 214 }
215 else if ( key == "Size" )
216 {
217 if ( currPackage )
218 currPackage->setPackageSize( value );
219 }
220 else if ( key == "Section" )
221 {
222 if ( currPackage )
223 currPackage->setSection( value );
224
225 DataManager::setAvailableCategories( value );
226 }
214 else if ( key == "" ) 227 else if ( key == "" )
215 { 228 {
216 newPackage = true; 229 newPackage = true;
217 } 230 }
218 } while ( !in.eof() ); 231 } while ( !in.eof() );
219 232
220 in.close(); 233 in.close();
221 234
222 // build local packages 235 // build local packages
223 buildLocalPackages( local ); 236 buildLocalPackages( local );
224} 237}
225 238
@@ -261,19 +274,25 @@ Package *Server :: getPackage( const char *name )
261 274
262QString Server :: toString() 275QString Server :: toString()
263{ 276{
264 QString ret = "Server\n name - " + serverName + 277 QString ret = "Server\n name - " + serverName +
265 "\n url - " + serverUrl + 278 "\n url - " + serverUrl +
266 "\n"; 279 "\n";
267 280
268 for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) 281 for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
269 ret += "\n " + packageList[i].toString(); 282 ret += "\n " + packageList[i].toString();
270 283
271 284
272 return ret; 285 return ret;
286} /*
287void addAvailableSection( QString section )
288{
289 if ( DataManager::availableCategories.find( value ) == -1 )
290// DataManager::availableCategories += "#" + value;
273} 291}
292*/
274 293
275vector<Package> &Server::getPackageList() 294vector<Package> &Server::getPackageList()
276{ 295{
277 return packageList; 296 return packageList;
278} 297}
279 298
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h
index e9f434c..f585b8f 100644
--- a/noncore/settings/aqpkg/server.h
+++ b/noncore/settings/aqpkg/server.h
@@ -50,16 +50,17 @@ public:
50 void setActive( bool val ) { active = val; } 50 void setActive( bool val ) { active = val; }
51 QString &getServerName() { return serverName; } 51 QString &getServerName() { return serverName; }
52 QString &getServerUrl() { return serverUrl; } 52 QString &getServerUrl() { return serverUrl; }
53 53
54protected: 54protected:
55 55
56private: 56private:
57 QString serverName; 57 QString serverName;
58 QString serverUrl; 58 QString serverUrl;
59 QString packageFile; 59 QString packageFile;
60 bool active; 60 bool active;
61 61
62
62 vector<Package> packageList; 63 vector<Package> packageList;
63}; 64};
64 65
65#endif 66#endif