summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore 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.cpp12
-rw-r--r--noncore/settings/aqpkg/datamgr.h5
-rw-r--r--noncore/settings/aqpkg/global.h160
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp395
-rw-r--r--noncore/settings/aqpkg/mainwin.h131
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp63
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h4
-rw-r--r--noncore/settings/aqpkg/package.h8
-rw-r--r--noncore/settings/aqpkg/server.cpp21
-rw-r--r--noncore/settings/aqpkg/server.h1
14 files changed, 696 insertions, 342 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
@@ -15,7 +15,8 @@ HEADERS = global.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 \
@@ -33,10 +34,12 @@ SOURCES = mainwin.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
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
@@ -28,9 +28,11 @@ using namespace std;
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()
@@ -207,3 +209,11 @@ void DataManager :: writeOutIpkgConf()
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
@@ -21,6 +21,8 @@
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
@@ -53,8 +55,11 @@ public:
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;
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
@@ -1,80 +1,80 @@
1/*************************************************************************** 1/***************************************************************************
2 global.h - description 2 global.h - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
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#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"
34#define ROOT "/" 34#define ROOT "/"
35#define IPKG_DIR "/usr/lib/ipkg/" 35#define IPKG_DIR "/usr/lib/ipkg/"
36 36
37#else 37#else
38 38
39// Running QT/Embedded on a X86 linux box 39// Running QT/Embedded on a X86 linux box
40#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf" 40#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf"
41#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root" 41#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root"
42#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/" 42#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/"
43 43
44#endif 44#endif
45 45
46#else 46#else
47 47
48// Running QT on a X86 linux box 48// Running QT on a X86 linux box
49#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf" 49#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf"
50#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root" 50#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root"
51#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/" 51#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/"
52 52
53#endif 53#endif
54 54
55 55
56// Uncomment the below line to turn on memory checking 56// Uncomment the below line to turn on memory checking
57//#define _DEBUG 1 57//#define _DEBUG 1
58 58
59#ifndef __MEMFILE_C 59#ifndef __MEMFILE_C
60#ifdef _DEBUG 60#ifdef _DEBUG
61void * operator new(unsigned int size,const char *file, int line); 61void * operator new(unsigned int size,const char *file, int line);
62void operator delete(void *p); 62void operator delete(void *p);
63#endif 63#endif
64 64
65#ifdef _DEBUG 65#ifdef _DEBUG
66#define DEBUG_NEW new(__FILE__, __LINE__) 66#define DEBUG_NEW new(__FILE__, __LINE__)
67//#define DEBUG_NEW new 67//#define DEBUG_NEW new
68#else 68#else
69#define DEBUG_NEW new 69#define DEBUG_NEW new
70#endif 70#endif
71 71
72#define new DEBUG_NEW 72#define new DEBUG_NEW
73#endif 73#endif
74 74
75 75
76void AddTrack(long addr, long asize, const char *fname, long lnum); 76void AddTrack(long addr, long asize, const char *fname, long lnum);
77void RemoveTrack(long addr); 77void RemoveTrack(long addr);
78void DumpUnfreed(); 78void DumpUnfreed();
79 79
80#endif 80#endif
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
@@ -1,186 +1,209 @@
1/*************************************************************************** 1/***************************************************************************
2 mainwin.cpp - description 2 mainwin.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
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> 18#include <iostream>
19 19
20#include <qmenubar.h> 20#include <qmenubar.h>
21#include <qpopupmenu.h> 21#include <qpopupmenu.h>
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23 23
24#include "mainwin.h" 24#include "mainwin.h"
25#include "datamgr.h" 25#include "datamgr.h"
26#include "networkpkgmgr.h" 26#include "networkpkgmgr.h"
27#include "settingsimpl.h" 27#include "settingsimpl.h"
28#include "helpwindow.h" 28#include "helpwindow.h"
29#include "utils.h" 29#include "utils.h"
30#include "global.h" 30#include "global.h"
31 31
32MainWindow :: MainWindow( QWidget *p, char *name ) 32MainWindow :: MainWindow( QWidget *p, char *name )
33 :QMainWindow( p, name ) 33 :QMainWindow( p, name )
34{ 34{
35#ifdef QWS 35#ifdef QWS
36 showMaximized(); 36 showMaximized();
37#endif 37#endif
38 38
39 setCaption( "AQPkg - Package Manager" ); 39 setCaption( "AQPkg - Package Manager" );
40 40
41 // Create our menu 41 // Create our menu
42 help = new QPopupMenu( this ); 42 help = new QPopupMenu( this );
43 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G ); 43 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G );
44 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); 44 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
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 57 filter->insertSeparator();
58 // Create the main menu 58 mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C );
59 menu = menuBar(); //new QMenuBar( this ); 59 mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A );
60 menu->insertItem( "&Settings", settings ); 60
61 menu->insertItem( "&Edit", edit ); 61 // Create the main menu
62 menu->insertItem( "&Filter", filter ); 62 menu = menuBar(); //new QMenuBar( this );
63 menu->insertItem( "&Help", help ); 63 menu->insertItem( "&Settings", settings );
64 64 menu->insertItem( "&Edit", edit );
65 mgr = new DataManager(); 65 menu->insertItem( "&Filter", filter );
66 mgr->loadServers(); 66 menu->insertItem( "&Help", help );
67 67
68 stack = new QWidgetStack( this ); 68 mgr = new DataManager();
69 69 mgr->loadServers();
70 networkPkgWindow = new NetworkPackageManager( mgr, stack ); 70
71 stack->addWidget( networkPkgWindow, 1 ); 71 stack = new QWidgetStack( this );
72 72
73 setCentralWidget( stack ); 73 networkPkgWindow = new NetworkPackageManager( mgr, stack );
74 stack->raiseWidget( networkPkgWindow ); 74 stack->addWidget( networkPkgWindow, 1 );
75} 75
76 76 setCentralWidget( stack );
77MainWindow :: ~MainWindow() 77 stack->raiseWidget( networkPkgWindow );
78{ 78}
79 delete networkPkgWindow; 79
80} 80MainWindow :: ~MainWindow()
81 81{
82void MainWindow :: setDocument( const QString &doc ) 82 delete networkPkgWindow;
83{ 83}
84 // Remove path from package 84
85 QString package = Utils::getPackageNameFromIpkFilename( doc ); 85void MainWindow :: setDocument( const QString &doc )
86 std::cout << "Selecting package " << package << std::endl; 86{
87 networkPkgWindow->selectLocalPackage( package ); 87 // Remove path from package
88} 88 QString package = Utils::getPackageNameFromIpkFilename( doc );
89 89 std::cout << "Selecting package " << package << std::endl;
90void MainWindow :: displaySettings() 90 networkPkgWindow->selectLocalPackage( package );
91{ 91}
92 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 92
93 if ( dlg->showDlg( 0 ) ) 93void MainWindow :: displaySettings()
94 networkPkgWindow->updateData(); 94{
95 delete dlg; 95 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
96} 96 if ( dlg->showDlg( 0 ) )
97 97 networkPkgWindow->updateData();
98void MainWindow :: displayHelp() 98 delete dlg;
99{ 99}
100 HelpWindow *dlg = new HelpWindow( this ); 100
101 dlg->exec(); 101void MainWindow :: displayHelp()
102 delete dlg; 102{
103} 103 HelpWindow *dlg = new HelpWindow( this );
104 104 dlg->exec();
105void MainWindow :: searchForPackage() 105 delete dlg;
106{ 106}
107 networkPkgWindow->searchForPackage( false ); 107
108} 108void MainWindow :: searchForPackage()
109 109{
110void MainWindow :: repeatSearchForPackage() 110 networkPkgWindow->searchForPackage( false );
111{ 111}
112 networkPkgWindow->searchForPackage( true ); 112
113} 113void MainWindow :: repeatSearchForPackage()
114 114{
115void MainWindow :: displayAbout() 115 networkPkgWindow->searchForPackage( true );
116{ 116}
117 QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); 117
118} 118void MainWindow :: displayAbout()
119 119{
120 120 QMessageBox::about( this, "About AQPkg", VERSION_TEXT );
121void MainWindow :: filterUninstalledPackages() 121}
122{ 122
123 bool val; 123
124 if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) 124void MainWindow :: filterUninstalledPackages()
125 { 125{
126 val = false; 126 bool val;
127 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 127 if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) )
128 } 128 {
129 else 129 val = false;
130 { 130 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
131 val = true; 131 }
132 filter->setItemChecked( mnuShowUninstalledPkgsId, true ); 132 else
133 } 133 {
134 134 val = true;
135 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 135 filter->setItemChecked( mnuShowUninstalledPkgsId, true );
136 networkPkgWindow->showOnlyInstalledPackages( false ); 136 }
137 filter->setItemChecked( mnuShowUpgradedPkgsId, false ); 137
138 networkPkgWindow->showUpgradedPackages( false ); 138 filter->setItemChecked( mnuShowInstalledPkgsId, false );
139 139 networkPkgWindow->showOnlyInstalledPackages( false );
140 networkPkgWindow->showOnlyUninstalledPackages( val ); 140 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
141 141 networkPkgWindow->showUpgradedPackages( false );
142} 142
143 143 networkPkgWindow->showOnlyUninstalledPackages( val );
144void MainWindow :: filterInstalledPackages() 144
145{ 145}
146 bool val; 146
147 if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) 147void MainWindow :: filterInstalledPackages()
148 { 148{
149 val = false; 149 bool val;
150 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 150 if ( filter->isItemChecked( mnuShowInstalledPkgsId ) )
151 } 151 {
152 else 152 val = false;
153 { 153 filter->setItemChecked( mnuShowInstalledPkgsId, false );
154 val = true; 154 }
155 filter->setItemChecked( mnuShowInstalledPkgsId, true ); 155 else
156 } 156 {
157 157 val = true;
158 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 158 filter->setItemChecked( mnuShowInstalledPkgsId, true );
159 networkPkgWindow->showOnlyUninstalledPackages( false ); 159 }
160 filter->setItemChecked( mnuShowUpgradedPkgsId, false ); 160
161 networkPkgWindow->showUpgradedPackages( false ); 161 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
162 162 networkPkgWindow->showOnlyUninstalledPackages( false );
163 networkPkgWindow->showOnlyInstalledPackages( val ); 163 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
164} 164 networkPkgWindow->showUpgradedPackages( false );
165 165
166void MainWindow :: filterUpgradedPackages() 166 networkPkgWindow->showOnlyInstalledPackages( val );
167{ 167}
168 bool val; 168
169 if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) ) 169void MainWindow :: filterUpgradedPackages()
170 { 170{
171 val = false; 171 bool val;
172 filter->setItemChecked( mnuShowUpgradedPkgsId, false ); 172 if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) )
173 } 173 {
174 else 174 val = false;
175 { 175 filter->setItemChecked( mnuShowUpgradedPkgsId, false );
176 val = true; 176 }
177 filter->setItemChecked( mnuShowUpgradedPkgsId, true ); 177 else
178 } 178 {
179 179 val = true;
180 filter->setItemChecked( mnuShowUninstalledPkgsId, false ); 180 filter->setItemChecked( mnuShowUpgradedPkgsId, true );
181 networkPkgWindow->showOnlyUninstalledPackages( false ); 181 }
182 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 182
183 networkPkgWindow->showOnlyInstalledPackages( false ); 183 filter->setItemChecked( mnuShowUninstalledPkgsId, false );
184 184 networkPkgWindow->showOnlyUninstalledPackages( false );
185 networkPkgWindow->showUpgradedPackages( val ); 185 filter->setItemChecked( mnuShowInstalledPkgsId, false );
186} 186 networkPkgWindow->showOnlyInstalledPackages( false );
187
188 networkPkgWindow->showUpgradedPackages( val );
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
@@ -1,63 +1,68 @@
1/*************************************************************************** 1/***************************************************************************
2 mainwin.h - description 2 mainwin.h - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
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#ifndef MAINWIN_H 18#ifndef MAINWIN_H
19#define MAINWIN_H 19#define MAINWIN_H
20 20
21#include <qmainwindow.h> 21#include <qmainwindow.h>
22#include <qwidgetstack.h> 22#include <qwidgetstack.h>
23 23
24 24
25class NetworkPackageManager; 25class NetworkPackageManager;
26class DataManager; 26class DataManager;
27 27
28class MainWindow :public QMainWindow 28class MainWindow :public QMainWindow
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31public: 31public:
32 32
33 MainWindow( QWidget *p = 0, char *name = 0 ); 33 MainWindow( QWidget *p = 0, char *name = 0 );
34 ~MainWindow(); 34 ~MainWindow();
35 35
36private: 36private:
37 DataManager *mgr; 37 DataManager *mgr;
38 38
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 51 int mnuFilterByCategory;
52public slots: 52 int mnuSetFilterCategory;
53 void setDocument( const QString &doc ); 53
54 void displayHelp(); 54public slots:
55 void searchForPackage(); 55 void setDocument( const QString &doc );
56 void repeatSearchForPackage(); 56 void displayHelp();
57 void displayAbout(); 57 void searchForPackage();
58 void displaySettings(); 58 void repeatSearchForPackage();
59 void filterUninstalledPackages(); 59 void displayAbout();
60 void filterInstalledPackages(); 60 void displaySettings();
61 void filterUpgradedPackages(); 61 void filterUninstalledPackages();
62}; 62 void filterInstalledPackages();
63#endif 63 void filterUpgradedPackages();
64 void filterCategory();
65 void setFilterCategory();
66
67};
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
@@ -40,6 +40,7 @@ using namespace std;
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
@@ -62,7 +63,7 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
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();
@@ -239,6 +240,13 @@ void NetworkPackageManager :: serverSelected( int )
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;
@@ -295,6 +303,9 @@ void NetworkPackageManager :: serverSelected( int )
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
@@ -325,10 +336,6 @@ void NetworkPackageManager :: updateServer()
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
@@ -686,7 +693,7 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
686 msgtext, "Remove", secondButton ) ) 693 msgtext, "Remove", secondButton ) )
687 { 694 {
688 case 0: // Try again or Enter 695 case 0: // Try again or Enter
689 // option 0 = Remove 696 // option 0 = Remove
690 item.option = "D"; 697 item.option = "D";
691 break; 698 break;
692 case 1: // Quit or Escape 699 case 1: // Quit or Escape
@@ -743,7 +750,7 @@ void NetworkPackageManager :: letterPushed( QString t )
743 packagesList->setSelected( item, true ); 750 packagesList->setSelected( item, true );
744 packagesList->ensureItemVisible( item ); 751 packagesList->ensureItemVisible( item );
745 break; 752 break;
746 } 753 }
747 754
748 item = (QCheckListItem *)item->nextSibling(); 755 item = (QCheckListItem *)item->nextSibling();
749 if ( !item ) 756 if ( !item )
@@ -804,3 +811,45 @@ void NetworkPackageManager :: showUpgradedPackages( bool val )
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
@@ -44,6 +44,8 @@ public:
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;
@@ -58,7 +60,9 @@ private:
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;
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
@@ -44,14 +44,18 @@ public:
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; }
@@ -76,6 +80,8 @@ private:
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};
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
@@ -28,6 +28,7 @@
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>
@@ -210,7 +211,19 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
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;
@@ -270,7 +283,13 @@ QString Server :: 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{
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
@@ -59,6 +59,7 @@ private:
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