author | andyq <andyq> | 2002-11-17 20:03:25 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-11-17 20:03:25 (UTC) |
commit | d94c9d39ab6e744f848a04c07eac03f20c91987c (patch) (unidiff) | |
tree | a9f32cca7c59ae565ab9caa3caf567100ed07cb4 | |
parent | a94877f543bf0ebc2ec9c4c931cb5f21713b7872 (diff) | |
download | opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.zip opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.tar.gz opie-d94c9d39ab6e744f848a04c07eac03f20c91987c.tar.bz2 |
Added filter by category, and added extra fields to package display (Section and size)
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 9 | ||||
-rw-r--r-- | noncore/settings/aqpkg/categoryfilter.ui | 118 | ||||
-rw-r--r-- | noncore/settings/aqpkg/categoryfilterimpl.cpp | 71 | ||||
-rw-r--r-- | noncore/settings/aqpkg/categoryfilterimpl.h | 40 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 12 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.h | 5 | ||||
-rw-r--r-- | noncore/settings/aqpkg/global.h | 160 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 395 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 131 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 63 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/package.h | 8 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 21 | ||||
-rw-r--r-- | noncore/settings/aqpkg/server.h | 1 |
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 | |||
@@ -1,44 +1,47 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on debug | 2 | CONFIG = qt warn_on debug |
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 | 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 |
41 | INCLUDEPATH += $(OPIEDIR)/include | 44 | INCLUDEPATH += $(OPIEDIR)/include |
42 | DEPENDPATH += $(OPIEDIR)/include | 45 | DEPENDPATH += $(OPIEDIR)/include |
43 | LIBS += -lqpe -lstdc++ | 46 | LIBS += -lqpe -lstdc++ |
44 | DESTDIR = $(OPIEDIR)/bin | 47 | DESTDIR = $(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>&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>&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> | ||
18 | using namespace std; | ||
19 | |||
20 | #include <qlistbox.h> | ||
21 | #include <qstring.h> | ||
22 | |||
23 | #include "categoryfilterimpl.h" | ||
24 | |||
25 | CategoryFilterImpl :: 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 | |||
53 | CategoryFilterImpl :: ~CategoryFilterImpl() | ||
54 | { | ||
55 | } | ||
56 | |||
57 | QString 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 | |||
30 | class CategoryFilterImpl : public CategoryFilterDlg | ||
31 | { | ||
32 | Q_OBJECT | ||
33 | public: | ||
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 | |||
@@ -1,209 +1,219 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | datamgr.cpp - description | 2 | datamgr.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Thu Aug 29 2002 | 4 | begin : Thu Aug 29 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 | #include <fstream> | 17 | #include <fstream> |
18 | #include <iostream> | 18 | #include <iostream> |
19 | using namespace std; | 19 | using 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 | ||
31 | QString DataManager::availableCategories = ""; | ||
31 | DataManager::DataManager() | 32 | DataManager::DataManager() |
32 | { | 33 | { |
33 | activeServer = ""; | 34 | activeServer = ""; |
35 | availableCategories = "#"; | ||
34 | } | 36 | } |
35 | 37 | ||
36 | DataManager::~DataManager() | 38 | DataManager::~DataManager() |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | Server *DataManager :: getServer( const char *name ) | 42 | Server *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 | { |
46 | if ( it->getServerName() == name ) | 48 | if ( it->getServerName() == name ) |
47 | s = &(*it); | 49 | s = &(*it); |
48 | 50 | ||
49 | ++it; | 51 | ++it; |
50 | } | 52 | } |
51 | 53 | ||
52 | return s; | 54 | return s; |
53 | } | 55 | } |
54 | 56 | ||
55 | Destination *DataManager :: getDestination( const char *name ) | 57 | Destination *DataManager :: getDestination( const char *name ) |
56 | { | 58 | { |
57 | Destination *d = 0; | 59 | Destination *d = 0; |
58 | vector<Destination>::iterator it = destList.begin(); | 60 | vector<Destination>::iterator it = destList.begin(); |
59 | while ( it != destList.end() && d == 0 ) | 61 | while ( it != destList.end() && d == 0 ) |
60 | { | 62 | { |
61 | if ( it->getDestinationName() == name ) | 63 | if ( it->getDestinationName() == name ) |
62 | d = &(*it); | 64 | d = &(*it); |
63 | 65 | ||
64 | ++it; | 66 | ++it; |
65 | } | 67 | } |
66 | 68 | ||
67 | return d; | 69 | return d; |
68 | } | 70 | } |
69 | 71 | ||
70 | void DataManager :: loadServers() | 72 | void DataManager :: loadServers() |
71 | { | 73 | { |
72 | // First add our local server - not really a server but | 74 | // First add our local server - not really a server but |
73 | // the local config (which packages are installed) | 75 | // the local config (which packages are installed) |
74 | serverList.push_back( Server( LOCAL_SERVER, "" ) ); | 76 | serverList.push_back( Server( LOCAL_SERVER, "" ) ); |
75 | serverList.push_back( Server( LOCAL_IPKGS, "" ) ); | 77 | serverList.push_back( Server( LOCAL_IPKGS, "" ) ); |
76 | 78 | ||
77 | #ifdef QWS | 79 | #ifdef QWS |
78 | Config cfg( "aqpkg" ); | 80 | Config cfg( "aqpkg" ); |
79 | cfg.setGroup( "destinations" ); | 81 | cfg.setGroup( "destinations" ); |
80 | #endif | 82 | #endif |
81 | 83 | ||
82 | // Read file from /etc/ipkg.conf | 84 | // Read file from /etc/ipkg.conf |
83 | QString ipkg_conf = IPKG_CONF; | 85 | QString ipkg_conf = IPKG_CONF; |
84 | FILE *fp; | 86 | FILE *fp; |
85 | fp = fopen( ipkg_conf, "r" ); | 87 | fp = fopen( ipkg_conf, "r" ); |
86 | char line[130]; | 88 | char line[130]; |
87 | QString lineStr; | 89 | QString lineStr; |
88 | if ( fp == NULL ) | 90 | if ( fp == NULL ) |
89 | { | 91 | { |
90 | cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl; | 92 | cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl; |
91 | return; | 93 | return; |
92 | } | 94 | } |
93 | else | 95 | else |
94 | { | 96 | { |
95 | while ( fgets( line, sizeof line, fp) != NULL ) | 97 | while ( fgets( line, sizeof line, fp) != NULL ) |
96 | { | 98 | { |
97 | lineStr = line; | 99 | lineStr = line; |
98 | if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) | 100 | if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) |
99 | { | 101 | { |
100 | char alias[20]; | 102 | char alias[20]; |
101 | char url[100]; | 103 | char url[100]; |
102 | 104 | ||
103 | 105 | ||
104 | // Looks a little wierd but read up to the r of src (throwing it away), | 106 | // Looks a little wierd but read up to the r of src (throwing it away), |
105 | // then read up to the next space and throw that away, the alias | 107 | // then read up to the next space and throw that away, the alias |
106 | // is next. | 108 | // is next. |
107 | // Should Handle #src, # src, src, and combinations of | 109 | // Should Handle #src, # src, src, and combinations of |
108 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); | 110 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); |
109 | Server s( alias, url ); | 111 | Server s( alias, url ); |
110 | if ( lineStr.startsWith( "src" ) ) | 112 | if ( lineStr.startsWith( "src" ) ) |
111 | s.setActive( true ); | 113 | s.setActive( true ); |
112 | else | 114 | else |
113 | s.setActive( false ); | 115 | s.setActive( false ); |
114 | 116 | ||
115 | serverList.push_back( s ); | 117 | serverList.push_back( s ); |
116 | 118 | ||
117 | } | 119 | } |
118 | else if ( lineStr.startsWith( "dest" ) ) | 120 | else if ( lineStr.startsWith( "dest" ) ) |
119 | { | 121 | { |
120 | char alias[20]; | 122 | char alias[20]; |
121 | char path[50]; | 123 | char path[50]; |
122 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); | 124 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); |
123 | Destination d( alias, path ); | 125 | Destination d( alias, path ); |
124 | bool linkToRoot = true; | 126 | bool linkToRoot = true; |
125 | #ifdef QWS | 127 | #ifdef QWS |
126 | QString key = alias; | 128 | QString key = alias; |
127 | key += "_linkToRoot"; | 129 | key += "_linkToRoot"; |
128 | linkToRoot = cfg.readBoolEntry( key, true ); | 130 | linkToRoot = cfg.readBoolEntry( key, true ); |
129 | #endif | 131 | #endif |
130 | d.linkToRoot( linkToRoot ); | 132 | d.linkToRoot( linkToRoot ); |
131 | 133 | ||
132 | destList.push_back( d ); | 134 | destList.push_back( d ); |
133 | } | 135 | } |
134 | } | 136 | } |
135 | } | 137 | } |
136 | fclose( fp ); | 138 | fclose( fp ); |
137 | 139 | ||
138 | reloadServerData( ); | 140 | reloadServerData( ); |
139 | } | 141 | } |
140 | 142 | ||
141 | void DataManager :: reloadServerData( ) | 143 | void DataManager :: reloadServerData( ) |
142 | { | 144 | { |
143 | vector<Server>::iterator it = serverList.begin(); | 145 | vector<Server>::iterator it = serverList.begin(); |
144 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | 146 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) |
145 | { | 147 | { |
146 | // Now we've read the config file in we need to read the servers | 148 | // Now we've read the config file in we need to read the servers |
147 | // The local server is a special case. This holds the contents of the | 149 | // The local server is a special case. This holds the contents of the |
148 | // status files the number of which depends on how many destinations | 150 | // status files the number of which depends on how many destinations |
149 | // we've set up | 151 | // we've set up |
150 | // The other servers files hold the contents of the server package list | 152 | // The other servers files hold the contents of the server package list |
151 | if ( it->getServerName() == LOCAL_SERVER ) | 153 | if ( it->getServerName() == LOCAL_SERVER ) |
152 | it->readStatusFile( destList ); | 154 | it->readStatusFile( destList ); |
153 | else if ( it->getServerName() == LOCAL_IPKGS ) | 155 | else if ( it->getServerName() == LOCAL_IPKGS ) |
154 | it->readLocalIpks( getServer( LOCAL_SERVER ) ); | 156 | it->readLocalIpks( getServer( LOCAL_SERVER ) ); |
155 | else | 157 | else |
156 | it->readPackageFile( getServer( LOCAL_SERVER ) ); | 158 | it->readPackageFile( getServer( LOCAL_SERVER ) ); |
157 | } | 159 | } |
158 | } | 160 | } |
159 | 161 | ||
160 | void DataManager :: writeOutIpkgConf() | 162 | void DataManager :: writeOutIpkgConf() |
161 | { | 163 | { |
162 | QString ipkg_conf = IPKG_CONF; | 164 | QString ipkg_conf = IPKG_CONF; |
163 | ofstream out( ipkg_conf ); | 165 | ofstream out( ipkg_conf ); |
164 | 166 | ||
165 | out << "# Written by AQPkg" << endl; | 167 | out << "# Written by AQPkg" << endl; |
166 | out << "# Must have one or more source entries of the form:" << endl; | 168 | out << "# Must have one or more source entries of the form:" << endl; |
167 | out << "#" << endl; | 169 | out << "#" << endl; |
168 | out << "# src <src-name> <source-url>" << endl; | 170 | out << "# src <src-name> <source-url>" << endl; |
169 | out << "#" << endl; | 171 | out << "#" << endl; |
170 | out << "# and one or more destination entries of the form:" << endl; | 172 | out << "# and one or more destination entries of the form:" << endl; |
171 | out << "#" << endl; | 173 | out << "#" << endl; |
172 | out << "# dest <dest-name> <target-path>" << endl; | 174 | out << "# dest <dest-name> <target-path>" << endl; |
173 | out << "#" << endl; | 175 | out << "#" << endl; |
174 | out << "# where <src-name> and <dest-names> are identifiers that" << endl; | 176 | out << "# where <src-name> and <dest-names> are identifiers that" << endl; |
175 | out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; | 177 | out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; |
176 | out << "# URL that points to a directory containing a Familiar" << endl; | 178 | out << "# URL that points to a directory containing a Familiar" << endl; |
177 | out << "# Packages file, and <target-path> should be a directory" << endl; | 179 | out << "# Packages file, and <target-path> should be a directory" << endl; |
178 | out << "# that exists on the target system." << endl << endl; | 180 | out << "# that exists on the target system." << endl << endl; |
179 | 181 | ||
180 | // Write out servers | 182 | // Write out servers |
181 | vector<Server>::iterator it = serverList.begin(); | 183 | vector<Server>::iterator it = serverList.begin(); |
182 | while ( it != serverList.end() ) | 184 | while ( it != serverList.end() ) |
183 | { | 185 | { |
184 | QString alias = it->getServerName(); | 186 | QString alias = it->getServerName(); |
185 | // Don't write out local as its a dummy | 187 | // Don't write out local as its a dummy |
186 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) | 188 | if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) |
187 | { | 189 | { |
188 | QString url = it->getServerUrl();; | 190 | QString url = it->getServerUrl();; |
189 | 191 | ||
190 | if ( !it->isServerActive() ) | 192 | if ( !it->isServerActive() ) |
191 | out << "#"; | 193 | out << "#"; |
192 | out << "src " << alias << " " << url << endl; | 194 | out << "src " << alias << " " << url << endl; |
193 | } | 195 | } |
194 | 196 | ||
195 | it++; | 197 | it++; |
196 | } | 198 | } |
197 | 199 | ||
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 | |||
214 | void 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 | |||
@@ -1,64 +1,69 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | datamgr.h - description | 2 | datamgr.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Thu Aug 29 2002 | 4 | begin : Thu Aug 29 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 DATAMGR_H | 18 | #ifndef DATAMGR_H |
19 | #define DATAMGR_H | 19 | #define DATAMGR_H |
20 | 20 | ||
21 | #include <map> | 21 | #include <map> |
22 | using namespace std; | 22 | using 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 | ||
35 | class DataManager | 37 | class DataManager |
36 | { | 38 | { |
37 | public: | 39 | public: |
38 | DataManager(); | 40 | DataManager(); |
39 | ~DataManager(); | 41 | ~DataManager(); |
40 | 42 | ||
41 | void setActiveServer( const QString &act ) { activeServer = act; } | 43 | void setActiveServer( const QString &act ) { activeServer = act; } |
42 | QString &getActiveServer( ) { return activeServer; } | 44 | QString &getActiveServer( ) { return activeServer; } |
43 | 45 | ||
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 | ||
57 | private: | 61 | private: |
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 | |||
@@ -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 |
61 | void * operator new(unsigned int size,const char *file, int line); | 61 | void * operator new(unsigned int size,const char *file, int line); |
62 | void operator delete(void *p); | 62 | void 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 | ||
76 | void AddTrack(long addr, long asize, const char *fname, long lnum); | 76 | void AddTrack(long addr, long asize, const char *fname, long lnum); |
77 | void RemoveTrack(long addr); | 77 | void RemoveTrack(long addr); |
78 | void DumpUnfreed(); | 78 | void 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 | ||
32 | MainWindow :: MainWindow( QWidget *p, char *name ) | 32 | MainWindow :: 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 ); | |
77 | MainWindow :: ~MainWindow() | 77 | stack->raiseWidget( networkPkgWindow ); |
78 | { | 78 | } |
79 | delete networkPkgWindow; | 79 | |
80 | } | 80 | MainWindow :: ~MainWindow() |
81 | 81 | { | |
82 | void MainWindow :: setDocument( const QString &doc ) | 82 | delete networkPkgWindow; |
83 | { | 83 | } |
84 | // Remove path from package | 84 | |
85 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 85 | void 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; | |
90 | void MainWindow :: displaySettings() | 90 | networkPkgWindow->selectLocalPackage( package ); |
91 | { | 91 | } |
92 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 92 | |
93 | if ( dlg->showDlg( 0 ) ) | 93 | void 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(); | |
98 | void MainWindow :: displayHelp() | 98 | delete dlg; |
99 | { | 99 | } |
100 | HelpWindow *dlg = new HelpWindow( this ); | 100 | |
101 | dlg->exec(); | 101 | void MainWindow :: displayHelp() |
102 | delete dlg; | 102 | { |
103 | } | 103 | HelpWindow *dlg = new HelpWindow( this ); |
104 | 104 | dlg->exec(); | |
105 | void MainWindow :: searchForPackage() | 105 | delete dlg; |
106 | { | 106 | } |
107 | networkPkgWindow->searchForPackage( false ); | 107 | |
108 | } | 108 | void MainWindow :: searchForPackage() |
109 | 109 | { | |
110 | void MainWindow :: repeatSearchForPackage() | 110 | networkPkgWindow->searchForPackage( false ); |
111 | { | 111 | } |
112 | networkPkgWindow->searchForPackage( true ); | 112 | |
113 | } | 113 | void MainWindow :: repeatSearchForPackage() |
114 | 114 | { | |
115 | void MainWindow :: displayAbout() | 115 | networkPkgWindow->searchForPackage( true ); |
116 | { | 116 | } |
117 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | 117 | |
118 | } | 118 | void MainWindow :: displayAbout() |
119 | 119 | { | |
120 | 120 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | |
121 | void MainWindow :: filterUninstalledPackages() | 121 | } |
122 | { | 122 | |
123 | bool val; | 123 | |
124 | if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) | 124 | void 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 ); | |
144 | void MainWindow :: filterInstalledPackages() | 144 | |
145 | { | 145 | } |
146 | bool val; | 146 | |
147 | if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) | 147 | void 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 | ||
166 | void MainWindow :: filterUpgradedPackages() | 166 | networkPkgWindow->showOnlyInstalledPackages( val ); |
167 | { | 167 | } |
168 | bool val; | 168 | |
169 | if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) ) | 169 | void 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 | |||
191 | void MainWindow :: setFilterCategory() | ||
192 | { | ||
193 | if ( networkPkgWindow->setFilterCategory( ) ) | ||
194 | filter->setItemChecked( mnuFilterByCategory, true ); | ||
195 | } | ||
196 | |||
197 | void 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 | ||
25 | class NetworkPackageManager; | 25 | class NetworkPackageManager; |
26 | class DataManager; | 26 | class DataManager; |
27 | 27 | ||
28 | class MainWindow :public QMainWindow | 28 | class MainWindow :public QMainWindow |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | 32 | ||
33 | MainWindow( QWidget *p = 0, char *name = 0 ); | 33 | MainWindow( QWidget *p = 0, char *name = 0 ); |
34 | ~MainWindow(); | 34 | ~MainWindow(); |
35 | 35 | ||
36 | private: | 36 | private: |
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; | |
52 | public slots: | 52 | int mnuSetFilterCategory; |
53 | void setDocument( const QString &doc ); | 53 | |
54 | void displayHelp(); | 54 | public 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 | |||
@@ -1,427 +1,434 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | networkpkgmgr.cpp - description | 2 | networkpkgmgr.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 <fstream> | 18 | #include <fstream> |
19 | #include <iostream> | 19 | #include <iostream> |
20 | using namespace std; | 20 | using namespace std; |
21 | 21 | ||
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <linux/limits.h> | 24 | #include <linux/limits.h> |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/qcopenvelope_qws.h> | 28 | #include <qpe/qcopenvelope_qws.h> |
29 | #include <qpe/config.h> | 29 | #include <qpe/config.h> |
30 | #else | 30 | #else |
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 | ||
46 | extern int compareVersions( const char *v1, const char *v2 ); | 47 | extern int compareVersions( const char *v1, const char *v2 ); |
47 | 48 | ||
48 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) | 49 | NetworkPackageManager::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 | ||
73 | NetworkPackageManager::~NetworkPackageManager() | 74 | NetworkPackageManager::~NetworkPackageManager() |
74 | { | 75 | { |
75 | } | 76 | } |
76 | 77 | ||
77 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) | 78 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) |
78 | { | 79 | { |
79 | killTimer( timerId ); | 80 | killTimer( timerId ); |
80 | 81 | ||
81 | // Add server names to listbox | 82 | // Add server names to listbox |
82 | updateData(); | 83 | updateData(); |
83 | } | 84 | } |
84 | 85 | ||
85 | void NetworkPackageManager :: updateData() | 86 | void NetworkPackageManager :: updateData() |
86 | { | 87 | { |
87 | serversList->clear(); | 88 | serversList->clear(); |
88 | packagesList->clear(); | 89 | packagesList->clear(); |
89 | 90 | ||
90 | 91 | ||
91 | vector<Server>::iterator it; | 92 | vector<Server>::iterator it; |
92 | int activeItem = -1; | 93 | int activeItem = -1; |
93 | int i; | 94 | int i; |
94 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) | 95 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) |
95 | { | 96 | { |
96 | if ( !it->isServerActive() ) | 97 | if ( !it->isServerActive() ) |
97 | { | 98 | { |
98 | i--; | 99 | i--; |
99 | continue; | 100 | continue; |
100 | } | 101 | } |
101 | serversList->insertItem( it->getServerName() ); | 102 | serversList->insertItem( it->getServerName() ); |
102 | if ( it->getServerName() == currentlySelectedServer ) | 103 | if ( it->getServerName() == currentlySelectedServer ) |
103 | activeItem = i; | 104 | activeItem = i; |
104 | } | 105 | } |
105 | 106 | ||
106 | // set selected server to be active server | 107 | // set selected server to be active server |
107 | if ( activeItem != -1 ) | 108 | if ( activeItem != -1 ) |
108 | serversList->setCurrentItem( activeItem ); | 109 | serversList->setCurrentItem( activeItem ); |
109 | serverSelected( 0 ); | 110 | serverSelected( 0 ); |
110 | } | 111 | } |
111 | 112 | ||
112 | void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) | 113 | void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) |
113 | { | 114 | { |
114 | // First select local server | 115 | // First select local server |
115 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 116 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
116 | { | 117 | { |
117 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 118 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
118 | { | 119 | { |
119 | serversList->setCurrentItem( i ); | 120 | serversList->setCurrentItem( i ); |
120 | break; | 121 | break; |
121 | } | 122 | } |
122 | } | 123 | } |
123 | serverSelected( 0 ); | 124 | serverSelected( 0 ); |
124 | 125 | ||
125 | // Now set the check box of the selected package | 126 | // Now set the check box of the selected package |
126 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 127 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
127 | item != 0 ; | 128 | item != 0 ; |
128 | item = (QCheckListItem *)item->nextSibling() ) | 129 | item = (QCheckListItem *)item->nextSibling() ) |
129 | { | 130 | { |
130 | if ( item->text().startsWith( pkg ) ) | 131 | if ( item->text().startsWith( pkg ) ) |
131 | { | 132 | { |
132 | item->setOn( true ); | 133 | item->setOn( true ); |
133 | break; | 134 | break; |
134 | } | 135 | } |
135 | } | 136 | } |
136 | } | 137 | } |
137 | 138 | ||
138 | 139 | ||
139 | void NetworkPackageManager :: initGui() | 140 | void NetworkPackageManager :: initGui() |
140 | { | 141 | { |
141 | QLabel *l = new QLabel( "Servers", this ); | 142 | QLabel *l = new QLabel( "Servers", this ); |
142 | serversList = new QComboBox( this ); | 143 | serversList = new QComboBox( this ); |
143 | packagesList = new QListView( this ); | 144 | packagesList = new QListView( this ); |
144 | update = new QPushButton( "Refresh Lists", this ); | 145 | update = new QPushButton( "Refresh Lists", this ); |
145 | download = new QPushButton( "Download", this ); | 146 | download = new QPushButton( "Download", this ); |
146 | upgrade = new QPushButton( "Upgrade", this ); | 147 | upgrade = new QPushButton( "Upgrade", this ); |
147 | apply = new QPushButton( "Apply", this ); | 148 | apply = new QPushButton( "Apply", this ); |
148 | 149 | ||
149 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); | 150 | QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); |
150 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); | 151 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); |
151 | hbox1->addWidget( l ); | 152 | hbox1->addWidget( l ); |
152 | hbox1->addWidget( serversList ); | 153 | hbox1->addWidget( serversList ); |
153 | 154 | ||
154 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); | 155 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); |
155 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); | 156 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); |
156 | 157 | ||
157 | 158 | ||
158 | if ( showJumpTo ) | 159 | if ( showJumpTo ) |
159 | { | 160 | { |
160 | char text[2]; | 161 | char text[2]; |
161 | text[1] = '\0'; | 162 | text[1] = '\0'; |
162 | for ( int i = 0 ; i < 26 ; ++i ) | 163 | for ( int i = 0 ; i < 26 ; ++i ) |
163 | { | 164 | { |
164 | text[0] = 'A' + i; | 165 | text[0] = 'A' + i; |
165 | LetterPushButton *b = new LetterPushButton( text, this ); | 166 | LetterPushButton *b = new LetterPushButton( text, this ); |
166 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 167 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
167 | if ( i < 13 ) | 168 | if ( i < 13 ) |
168 | hbox3->addWidget( b ); | 169 | hbox3->addWidget( b ); |
169 | else | 170 | else |
170 | hbox4->addWidget( b ); | 171 | hbox4->addWidget( b ); |
171 | } | 172 | } |
172 | } | 173 | } |
173 | 174 | ||
174 | vbox->addWidget( packagesList ); | 175 | vbox->addWidget( packagesList ); |
175 | packagesList->addColumn( "Packages" ); | 176 | packagesList->addColumn( "Packages" ); |
176 | 177 | ||
177 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); | 178 | QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); |
178 | hbox2->addWidget( update ); | 179 | hbox2->addWidget( update ); |
179 | hbox2->addWidget( download ); | 180 | hbox2->addWidget( download ); |
180 | hbox2->addWidget( upgrade ); | 181 | hbox2->addWidget( upgrade ); |
181 | hbox2->addWidget( apply ); | 182 | hbox2->addWidget( apply ); |
182 | } | 183 | } |
183 | 184 | ||
184 | void NetworkPackageManager :: setupConnections() | 185 | void NetworkPackageManager :: setupConnections() |
185 | { | 186 | { |
186 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); | 187 | connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); |
187 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); | 188 | connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); |
188 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); | 189 | connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); |
189 | connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); | 190 | connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); |
190 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); | 191 | connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); |
191 | } | 192 | } |
192 | 193 | ||
193 | void NetworkPackageManager :: showProgressDialog( char *initialText ) | 194 | void NetworkPackageManager :: showProgressDialog( char *initialText ) |
194 | { | 195 | { |
195 | if ( !progressDlg ) | 196 | if ( !progressDlg ) |
196 | progressDlg = new ProgressDlg( this, "Progress", false ); | 197 | progressDlg = new ProgressDlg( this, "Progress", false ); |
197 | progressDlg->setText( initialText ); | 198 | progressDlg->setText( initialText ); |
198 | progressDlg->show(); | 199 | progressDlg->show(); |
199 | } | 200 | } |
200 | 201 | ||
201 | 202 | ||
202 | void NetworkPackageManager :: serverSelected( int ) | 203 | void NetworkPackageManager :: serverSelected( int ) |
203 | { | 204 | { |
204 | packagesList->clear(); | 205 | packagesList->clear(); |
205 | 206 | ||
206 | // display packages | 207 | // display packages |
207 | QString serverName = serversList->currentText(); | 208 | QString serverName = serversList->currentText(); |
208 | currentlySelectedServer = serverName; | 209 | currentlySelectedServer = serverName; |
209 | 210 | ||
210 | #ifdef QWS | 211 | #ifdef QWS |
211 | // read download directory from config file | 212 | // read download directory from config file |
212 | Config cfg( "aqpkg" ); | 213 | Config cfg( "aqpkg" ); |
213 | cfg.setGroup( "settings" ); | 214 | cfg.setGroup( "settings" ); |
214 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 215 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
215 | #endif | 216 | #endif |
216 | 217 | ||
217 | Server *s = dataMgr->getServer( serverName ); | 218 | Server *s = dataMgr->getServer( serverName ); |
218 | 219 | ||
219 | vector<Package> &list = s->getPackageList(); | 220 | vector<Package> &list = s->getPackageList(); |
220 | vector<Package>::iterator it; | 221 | vector<Package>::iterator it; |
221 | for ( it = list.begin() ; it != list.end() ; ++it ) | 222 | for ( it = list.begin() ; it != list.end() ; ++it ) |
222 | { | 223 | { |
223 | 224 | ||
224 | QString text = ""; | 225 | QString text = ""; |
225 | 226 | ||
226 | // Apply show only uninstalled packages filter | 227 | // Apply show only uninstalled packages filter |
227 | if ( showUninstalledPkgs && it->isInstalled() ) | 228 | if ( showUninstalledPkgs && it->isInstalled() ) |
228 | continue; | 229 | continue; |
229 | 230 | ||
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() ) |
254 | { | 262 | { |
255 | 263 | ||
256 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) | 264 | if ( compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1 ) |
257 | text += "*"; | 265 | text += "*"; |
258 | } | 266 | } |
259 | } | 267 | } |
260 | 268 | ||
261 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 269 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
262 | 270 | ||
263 | if ( it->isInstalled() ) | 271 | if ( it->isInstalled() ) |
264 | { | 272 | { |
265 | QString destName = ""; | 273 | QString destName = ""; |
266 | if ( it->getLocalPackage() ) | 274 | if ( it->getLocalPackage() ) |
267 | { | 275 | { |
268 | if ( it->getLocalPackage()->getInstalledTo() ) | 276 | if ( it->getLocalPackage()->getInstalledTo() ) |
269 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | 277 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); |
270 | } | 278 | } |
271 | else | 279 | else |
272 | { | 280 | { |
273 | if ( it->getInstalledTo() ) | 281 | if ( it->getInstalledTo() ) |
274 | destName = it->getInstalledTo()->getDestinationName(); | 282 | destName = it->getInstalledTo()->getDestinationName(); |
275 | } | 283 | } |
276 | if ( destName != "" ) | 284 | if ( destName != "" ) |
277 | new QCheckListItem( item, QString( "Installed To - " ) + destName ); | 285 | new QCheckListItem( item, QString( "Installed To - " ) + destName ); |
278 | } | 286 | } |
279 | 287 | ||
280 | if ( !it->isPackageStoredLocally() ) | 288 | if ( !it->isPackageStoredLocally() ) |
281 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); | 289 | new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); |
282 | else | 290 | else |
283 | new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); | 291 | new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); |
284 | 292 | ||
285 | if ( serverName == LOCAL_SERVER ) | 293 | if ( serverName == LOCAL_SERVER ) |
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 | { |
310 | upgrade->setEnabled( false ); | 321 | upgrade->setEnabled( false ); |
311 | download->setEnabled( true ); | 322 | download->setEnabled( true ); |
312 | download->setText( "Remove" ); | 323 | download->setText( "Remove" ); |
313 | } | 324 | } |
314 | else | 325 | else |
315 | { | 326 | { |
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 | ||
322 | void NetworkPackageManager :: updateServer() | 333 | void 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 | ||
344 | // Reload data | 351 | // Reload data |
345 | dataMgr->reloadServerData(); | 352 | dataMgr->reloadServerData(); |
346 | serverSelected(-1); | 353 | serverSelected(-1); |
347 | // delete progDlg; | 354 | // delete progDlg; |
348 | } | 355 | } |
349 | 356 | ||
350 | void NetworkPackageManager :: upgradePackages() | 357 | void NetworkPackageManager :: upgradePackages() |
351 | { | 358 | { |
352 | // We're gonna do an upgrade of all packages | 359 | // We're gonna do an upgrade of all packages |
353 | // First warn user that this isn't recommended | 360 | // First warn user that this isn't recommended |
354 | QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; | 361 | QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; |
355 | QMessageBox warn("Warning", text, QMessageBox::Warning, | 362 | QMessageBox warn("Warning", text, QMessageBox::Warning, |
356 | QMessageBox::Yes, | 363 | QMessageBox::Yes, |
357 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , | 364 | QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , |
358 | 0, this ); | 365 | 0, this ); |
359 | warn.adjustSize(); | 366 | warn.adjustSize(); |
360 | 367 | ||
361 | if ( warn.exec() == QMessageBox::Yes ) | 368 | if ( warn.exec() == QMessageBox::Yes ) |
362 | { | 369 | { |
363 | // First, write out ipkg_conf file so that ipkg can use it | 370 | // First, write out ipkg_conf file so that ipkg can use it |
364 | dataMgr->writeOutIpkgConf(); | 371 | dataMgr->writeOutIpkgConf(); |
365 | 372 | ||
366 | // Now run upgrade | 373 | // Now run upgrade |
367 | Ipkg ipkg; | 374 | Ipkg ipkg; |
368 | ipkg.setOption( "upgrade" ); | 375 | ipkg.setOption( "upgrade" ); |
369 | 376 | ||
370 | InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true ); | 377 | InstallDlgImpl dlg( &ipkg, "Upgrading installed packages", this, "Upgrade", true ); |
371 | dlg.showDlg(); | 378 | dlg.showDlg(); |
372 | 379 | ||
373 | // Reload data | 380 | // Reload data |
374 | dataMgr->reloadServerData(); | 381 | dataMgr->reloadServerData(); |
375 | serverSelected(-1); | 382 | serverSelected(-1); |
376 | } | 383 | } |
377 | } | 384 | } |
378 | 385 | ||
379 | 386 | ||
380 | void NetworkPackageManager :: downloadPackage() | 387 | void NetworkPackageManager :: downloadPackage() |
381 | { | 388 | { |
382 | bool doUpdate = true; | 389 | bool doUpdate = true; |
383 | if ( download->text() == "Download" ) | 390 | if ( download->text() == "Download" ) |
384 | { | 391 | { |
385 | // See if any packages are selected | 392 | // See if any packages are selected |
386 | bool found = false; | 393 | bool found = false; |
387 | if ( serversList->currentText() != LOCAL_SERVER ) | 394 | if ( serversList->currentText() != LOCAL_SERVER ) |
388 | { | 395 | { |
389 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 396 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
390 | item != 0 && !found; | 397 | item != 0 && !found; |
391 | item = (QCheckListItem *)item->nextSibling() ) | 398 | item = (QCheckListItem *)item->nextSibling() ) |
392 | { | 399 | { |
393 | if ( item->isOn() ) | 400 | if ( item->isOn() ) |
394 | found = true; | 401 | found = true; |
395 | } | 402 | } |
396 | } | 403 | } |
397 | 404 | ||
398 | // If user selected some packages then download the and store the locally | 405 | // If user selected some packages then download the and store the locally |
399 | // otherwise, display dialog asking user what package to download from an http server | 406 | // otherwise, display dialog asking user what package to download from an http server |
400 | // and whether to install it | 407 | // and whether to install it |
401 | if ( found ) | 408 | if ( found ) |
402 | downloadSelectedPackages(); | 409 | downloadSelectedPackages(); |
403 | else | 410 | else |
404 | downloadRemotePackage(); | 411 | downloadRemotePackage(); |
405 | 412 | ||
406 | } | 413 | } |
407 | else if ( download->text() == "Remove" ) | 414 | else if ( download->text() == "Remove" ) |
408 | { | 415 | { |
409 | doUpdate = false; | 416 | doUpdate = false; |
410 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 417 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
411 | item != 0 ; | 418 | item != 0 ; |
412 | item = (QCheckListItem *)item->nextSibling() ) | 419 | item = (QCheckListItem *)item->nextSibling() ) |
413 | { | 420 | { |
414 | if ( item->isOn() ) | 421 | if ( item->isOn() ) |
415 | { | 422 | { |
416 | QString name = item->text(); | 423 | QString name = item->text(); |
417 | int pos = name.find( "*" ); | 424 | int pos = name.find( "*" ); |
418 | name.truncate( pos ); | 425 | name.truncate( pos ); |
419 | 426 | ||
420 | // if (there is a (installed), remove it | 427 | // if (there is a (installed), remove it |
421 | pos = name.find( "(installed)" ); | 428 | pos = name.find( "(installed)" ); |
422 | if ( pos > 0 ) | 429 | if ( pos > 0 ) |
423 | name.truncate( pos - 1 ); | 430 | name.truncate( pos - 1 ); |
424 | 431 | ||
425 | Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); | 432 | Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); |
426 | 433 | ||
427 | QString msgtext; | 434 | QString msgtext; |
@@ -593,214 +600,256 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
593 | { | 600 | { |
594 | QString name = item->text(); | 601 | QString name = item->text(); |
595 | int pos = name.find( "*" ); | 602 | int pos = name.find( "*" ); |
596 | name.truncate( pos ); | 603 | name.truncate( pos ); |
597 | 604 | ||
598 | // if (there is a (installed), remove it | 605 | // if (there is a (installed), remove it |
599 | pos = name.find( "(installed)" ); | 606 | pos = name.find( "(installed)" ); |
600 | if ( pos > 0 ) | 607 | if ( pos > 0 ) |
601 | name.truncate( pos - 1 ); | 608 | name.truncate( pos - 1 ); |
602 | 609 | ||
603 | // Get package | 610 | // Get package |
604 | Server *s = dataMgr->getServer( serversList->currentText() ); | 611 | Server *s = dataMgr->getServer( serversList->currentText() ); |
605 | Package *p = s->getPackage( name ); | 612 | Package *p = s->getPackage( name ); |
606 | 613 | ||
607 | // If the package has a filename then it is a local file | 614 | // If the package has a filename then it is a local file |
608 | if ( p->isPackageStoredLocally() ) | 615 | if ( p->isPackageStoredLocally() ) |
609 | name = p->getFilename(); | 616 | name = p->getFilename(); |
610 | 617 | ||
611 | QString option; | 618 | QString option; |
612 | QString dest = "root"; | 619 | QString dest = "root"; |
613 | if ( !p->isInstalled() ) | 620 | if ( !p->isInstalled() ) |
614 | { | 621 | { |
615 | InstallData item; | 622 | InstallData item; |
616 | item.option = "I"; | 623 | item.option = "I"; |
617 | item.packageName = name; | 624 | item.packageName = name; |
618 | return item; | 625 | return item; |
619 | } | 626 | } |
620 | else | 627 | else |
621 | { | 628 | { |
622 | InstallData item; | 629 | InstallData item; |
623 | item.option = "D"; | 630 | item.option = "D"; |
624 | if ( !p->isPackageStoredLocally() ) | 631 | if ( !p->isPackageStoredLocally() ) |
625 | item.packageName = p->getInstalledPackageName(); | 632 | item.packageName = p->getInstalledPackageName(); |
626 | else | 633 | else |
627 | item.packageName = name; | 634 | item.packageName = name; |
628 | 635 | ||
629 | if ( p->getInstalledTo() ) | 636 | if ( p->getInstalledTo() ) |
630 | { | 637 | { |
631 | item.destination = p->getInstalledTo(); | 638 | item.destination = p->getInstalledTo(); |
632 | cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; | 639 | cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; |
633 | cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; | 640 | cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; |
634 | } | 641 | } |
635 | else | 642 | else |
636 | { | 643 | { |
637 | item.destination = p->getLocalPackage()->getInstalledTo(); | 644 | item.destination = p->getLocalPackage()->getInstalledTo(); |
638 | } | 645 | } |
639 | 646 | ||
640 | // Now see if version is newer or not | 647 | // Now see if version is newer or not |
641 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); | 648 | int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); |
642 | 649 | ||
643 | // If the version requested is older and user selected a local ipk file, then reinstall the file | 650 | // If the version requested is older and user selected a local ipk file, then reinstall the file |
644 | if ( p->isPackageStoredLocally() && val == -1 ) | 651 | if ( p->isPackageStoredLocally() && val == -1 ) |
645 | val = 0; | 652 | val = 0; |
646 | 653 | ||
647 | if ( val == -2 ) | 654 | if ( val == -2 ) |
648 | { | 655 | { |
649 | // Error - should handle | 656 | // Error - should handle |
650 | } | 657 | } |
651 | else if ( val == -1 ) | 658 | else if ( val == -1 ) |
652 | { | 659 | { |
653 | // Version available is older - remove only | 660 | // Version available is older - remove only |
654 | item.option = "D"; | 661 | item.option = "D"; |
655 | } | 662 | } |
656 | else | 663 | else |
657 | { | 664 | { |
658 | QString caption; | 665 | QString caption; |
659 | QString text; | 666 | QString text; |
660 | QString secondButton; | 667 | QString secondButton; |
661 | QString secondOption; | 668 | QString secondOption; |
662 | if ( val == 0 ) | 669 | if ( val == 0 ) |
663 | { | 670 | { |
664 | // Version available is the same - option to remove or reinstall | 671 | // Version available is the same - option to remove or reinstall |
665 | caption = "Do you wish to remove or reinstall\n%s?"; | 672 | caption = "Do you wish to remove or reinstall\n%s?"; |
666 | text = "Remove or ReInstall"; | 673 | text = "Remove or ReInstall"; |
667 | secondButton = "ReInstall"; | 674 | secondButton = "ReInstall"; |
668 | secondOption = "R"; | 675 | secondOption = "R"; |
669 | } | 676 | } |
670 | else if ( val == 1 ) | 677 | else if ( val == 1 ) |
671 | { | 678 | { |
672 | // Version available is newer - option to remove or upgrade | 679 | // Version available is newer - option to remove or upgrade |
673 | caption = "Do you wish to remove or upgrade\n%s?"; | 680 | caption = "Do you wish to remove or upgrade\n%s?"; |
674 | text = "Remove or Upgrade"; | 681 | text = "Remove or Upgrade"; |
675 | secondButton = "Upgrade"; | 682 | secondButton = "Upgrade"; |
676 | secondOption = "U"; | 683 | secondOption = "U"; |
677 | } | 684 | } |
678 | 685 | ||
679 | // Sticky option not implemented yet, but will eventually allow | 686 | // Sticky option not implemented yet, but will eventually allow |
680 | // the user to say something like 'remove all' | 687 | // the user to say something like 'remove all' |
681 | if ( stickyOption == "" ) | 688 | if ( stickyOption == "" ) |
682 | { | 689 | { |
683 | QString msgtext; | 690 | QString msgtext; |
684 | msgtext.sprintf( caption, (const char *)name ); | 691 | msgtext.sprintf( caption, (const char *)name ); |
685 | switch( QMessageBox::information( this, text, | 692 | switch( QMessageBox::information( this, text, |
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 |
693 | item.option = secondOption; | 700 | item.option = secondOption; |
694 | break; | 701 | break; |
695 | } | 702 | } |
696 | } | 703 | } |
697 | else | 704 | else |
698 | { | 705 | { |
699 | // item.option = stickyOption; | 706 | // item.option = stickyOption; |
700 | } | 707 | } |
701 | } | 708 | } |
702 | 709 | ||
703 | 710 | ||
704 | // Check if we are reinstalling the same version | 711 | // Check if we are reinstalling the same version |
705 | if ( item.option != "R" ) | 712 | if ( item.option != "R" ) |
706 | item.recreateLinks = true; | 713 | item.recreateLinks = true; |
707 | else | 714 | else |
708 | item.recreateLinks = false; | 715 | item.recreateLinks = false; |
709 | 716 | ||
710 | // User hit cancel (on dlg - assume remove) | 717 | // User hit cancel (on dlg - assume remove) |
711 | return item; | 718 | return item; |
712 | } | 719 | } |
713 | } | 720 | } |
714 | 721 | ||
715 | void NetworkPackageManager :: displayText( const QString &t ) | 722 | void NetworkPackageManager :: displayText( const QString &t ) |
716 | { | 723 | { |
717 | cout << t << endl; | 724 | cout << t << endl; |
718 | } | 725 | } |
719 | 726 | ||
720 | 727 | ||
721 | void NetworkPackageManager :: letterPushed( QString t ) | 728 | void NetworkPackageManager :: letterPushed( QString t ) |
722 | { | 729 | { |
723 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); | 730 | QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); |
724 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 731 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
725 | if ( packagesList->firstChild() == 0 ) | 732 | if ( packagesList->firstChild() == 0 ) |
726 | return; | 733 | return; |
727 | 734 | ||
728 | QCheckListItem *item; | 735 | QCheckListItem *item; |
729 | if ( start == 0 ) | 736 | if ( start == 0 ) |
730 | { | 737 | { |
731 | item = (QCheckListItem *)packagesList->firstChild(); | 738 | item = (QCheckListItem *)packagesList->firstChild(); |
732 | start = top; | 739 | start = top; |
733 | } | 740 | } |
734 | else | 741 | else |
735 | item = (QCheckListItem *)start->nextSibling(); | 742 | item = (QCheckListItem *)start->nextSibling(); |
736 | 743 | ||
737 | if ( item == 0 ) | 744 | if ( item == 0 ) |
738 | item = (QCheckListItem *)packagesList->firstChild(); | 745 | item = (QCheckListItem *)packagesList->firstChild(); |
739 | do | 746 | do |
740 | { | 747 | { |
741 | if ( item->text().lower().startsWith( t.lower() ) ) | 748 | if ( item->text().lower().startsWith( t.lower() ) ) |
742 | { | 749 | { |
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 ) |
750 | item = (QCheckListItem *)packagesList->firstChild(); | 757 | item = (QCheckListItem *)packagesList->firstChild(); |
751 | } while ( item != start); | 758 | } while ( item != start); |
752 | } | 759 | } |
753 | 760 | ||
754 | 761 | ||
755 | void NetworkPackageManager :: searchForPackage( bool findNext ) | 762 | void NetworkPackageManager :: searchForPackage( bool findNext ) |
756 | { | 763 | { |
757 | bool ok = false; | 764 | bool ok = false; |
758 | if ( !findNext || lastSearchText.isEmpty() ) | 765 | if ( !findNext || lastSearchText.isEmpty() ) |
759 | lastSearchText = InputDialog::getText( "Search for package", "Enter package to search for", lastSearchText, &ok, this ).lower(); | 766 | lastSearchText = InputDialog::getText( "Search for package", "Enter package to search for", lastSearchText, &ok, this ).lower(); |
760 | else | 767 | else |
761 | ok = true; | 768 | ok = true; |
762 | 769 | ||
763 | if ( ok && !lastSearchText.isEmpty() ) | 770 | if ( ok && !lastSearchText.isEmpty() ) |
764 | { | 771 | { |
765 | cout << "searching for " << lastSearchText << endl; | 772 | cout << "searching for " << lastSearchText << endl; |
766 | // look through package list for text startng at current position | 773 | // look through package list for text startng at current position |
767 | vector<InstallData> workingPackages; | 774 | vector<InstallData> workingPackages; |
768 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 775 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
769 | if ( start != 0 ) | 776 | if ( start != 0 ) |
770 | start = (QCheckListItem *)start->nextSibling(); | 777 | start = (QCheckListItem *)start->nextSibling(); |
771 | 778 | ||
772 | if ( start == 0 ) | 779 | if ( start == 0 ) |
773 | start = (QCheckListItem *)packagesList->firstChild(); | 780 | start = (QCheckListItem *)packagesList->firstChild(); |
774 | 781 | ||
775 | for ( QCheckListItem *item = start; item != 0 ; | 782 | for ( QCheckListItem *item = start; item != 0 ; |
776 | item = (QCheckListItem *)item->nextSibling() ) | 783 | item = (QCheckListItem *)item->nextSibling() ) |
777 | { | 784 | { |
778 | cout << "checking " << item->text().lower() << endl; | 785 | cout << "checking " << item->text().lower() << endl; |
779 | if ( item->text().lower().find( lastSearchText ) != -1 ) | 786 | if ( item->text().lower().find( lastSearchText ) != -1 ) |
780 | { | 787 | { |
781 | cout << "matched " << item->text() << endl; | 788 | cout << "matched " << item->text() << endl; |
782 | packagesList->ensureItemVisible( item ); | 789 | packagesList->ensureItemVisible( item ); |
783 | packagesList->setCurrentItem( item ); | 790 | packagesList->setCurrentItem( item ); |
784 | break; | 791 | break; |
785 | } | 792 | } |
786 | } | 793 | } |
787 | } | 794 | } |
788 | } | 795 | } |
789 | 796 | ||
790 | void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) | 797 | void NetworkPackageManager :: showOnlyUninstalledPackages( bool val ) |
791 | { | 798 | { |
792 | showUninstalledPkgs = val; | 799 | showUninstalledPkgs = val; |
793 | serverSelected( -1 ); | 800 | serverSelected( -1 ); |
794 | } | 801 | } |
795 | 802 | ||
796 | void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) | 803 | void NetworkPackageManager :: showOnlyInstalledPackages( bool val ) |
797 | { | 804 | { |
798 | showInstalledPkgs = val; | 805 | showInstalledPkgs = val; |
799 | serverSelected( -1 ); | 806 | serverSelected( -1 ); |
800 | } | 807 | } |
801 | 808 | ||
802 | void NetworkPackageManager :: showUpgradedPackages( bool val ) | 809 | void NetworkPackageManager :: showUpgradedPackages( bool val ) |
803 | { | 810 | { |
804 | showUpgradedPkgs = val; | 811 | showUpgradedPkgs = val; |
805 | serverSelected( -1 ); | 812 | serverSelected( -1 ); |
806 | } | 813 | } |
814 | |||
815 | bool 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 | |||
838 | bool 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 | |||
@@ -1,88 +1,92 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | networkpkgmgr.h - description | 2 | networkpkgmgr.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 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 <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qlistview.h> | 25 | #include <qlistview.h> |
26 | 26 | ||
27 | #include "datamgr.h" | 27 | #include "datamgr.h" |
28 | #include "progressdlg.h" | 28 | #include "progressdlg.h" |
29 | class InstallData; | 29 | class InstallData; |
30 | 30 | ||
31 | /** NetworkPackageManager is the base class of the project */ | 31 | /** NetworkPackageManager is the base class of the project */ |
32 | class NetworkPackageManager : public QWidget | 32 | class NetworkPackageManager : public QWidget |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
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 | ||
48 | private: | 50 | private: |
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(); |
74 | void downloadRemotePackage(); | 78 | void downloadRemotePackage(); |
75 | InstallData dealWithItem( QCheckListItem *item ); | 79 | InstallData dealWithItem( QCheckListItem *item ); |
76 | QString stickyOption; | 80 | QString stickyOption; |
77 | 81 | ||
78 | public slots: | 82 | public slots: |
79 | void serverSelected( int index ); | 83 | void serverSelected( int index ); |
80 | void applyChanges(); | 84 | void applyChanges(); |
81 | void upgradePackages(); | 85 | void upgradePackages(); |
82 | void downloadPackage(); | 86 | void downloadPackage(); |
83 | void updateServer(); | 87 | void updateServer(); |
84 | void displayText( const QString &t ); | 88 | void displayText( const QString &t ); |
85 | void letterPushed( QString t ); | 89 | void letterPushed( QString t ); |
86 | }; | 90 | }; |
87 | 91 | ||
88 | #endif | 92 | #endif |
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 | |||
@@ -1,83 +1,89 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | package.h - description | 2 | package.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 PACKAGE_H | 18 | #ifndef PACKAGE_H |
19 | #define PACKAGE_H | 19 | #define PACKAGE_H |
20 | 20 | ||
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | 22 | ||
23 | /** | 23 | /** |
24 | *@author Andy Qua | 24 | *@author Andy Qua |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include "destination.h" | 28 | #include "destination.h" |
29 | 29 | ||
30 | class Package | 30 | class Package |
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | Package( QString &name ); | 33 | Package( QString &name ); |
34 | Package( char *name ); | 34 | Package( char *name ); |
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 | ||
66 | private: | 70 | private: |
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 | |||
@@ -1,279 +1,298 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | server.cpp - description | 2 | server.cpp - 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 | description : This class holds details about a server | 7 | description : This class holds details about a server |
8 | : e.g. all the packages that contained on the server | 8 | : e.g. all the packages that contained on the server |
9 | : the installation status | 9 | : the installation status |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * * | 13 | * * |
14 | * This program is free software; you can redistribute it and/or modify * | 14 | * This program is free software; you can redistribute it and/or modify * |
15 | * it under the terms of the GNU General Public License as published by * | 15 | * it under the terms of the GNU General Public License as published by * |
16 | * the Free Software Foundation; either version 2 of the License, or * | 16 | * the Free Software Foundation; either version 2 of the License, or * |
17 | * (at your option) any later version. * | 17 | * (at your option) any later version. * |
18 | * * | 18 | * * |
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> |
28 | using namespace std; | 28 | using 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 | ||
42 | Server :: Server( const char *name, const char *url ) | 43 | Server :: Server( const char *name, const char *url ) |
43 | { | 44 | { |
44 | serverName = name; | 45 | serverName = name; |
45 | serverUrl = url; | 46 | serverUrl = url; |
46 | packageFile = IPKG_DIR; | 47 | packageFile = IPKG_DIR; |
47 | packageFile += "lists/" + serverName; | 48 | packageFile += "lists/" + serverName; |
48 | } | 49 | } |
49 | 50 | ||
50 | Server :: ~Server() | 51 | Server :: ~Server() |
51 | { | 52 | { |
52 | cleanUp(); | 53 | cleanUp(); |
53 | } | 54 | } |
54 | 55 | ||
55 | void Server :: cleanUp() | 56 | void Server :: cleanUp() |
56 | { | 57 | { |
57 | packageList.clear(); | 58 | packageList.clear(); |
58 | } | 59 | } |
59 | 60 | ||
60 | void Server :: readStatusFile( vector<Destination> &destList ) | 61 | void Server :: readStatusFile( vector<Destination> &destList ) |
61 | { | 62 | { |
62 | cleanUp(); | 63 | cleanUp(); |
63 | 64 | ||
64 | vector<Destination>::iterator dit; | 65 | vector<Destination>::iterator dit; |
65 | bool rootRead = false; | 66 | bool rootRead = false; |
66 | for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) | 67 | for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) |
67 | { | 68 | { |
68 | bool installingToRoot = false; | 69 | bool installingToRoot = false; |
69 | 70 | ||
70 | QString path = dit->getDestinationPath(); | 71 | QString path = dit->getDestinationPath(); |
71 | if ( path.right( 1 ) != "/" ) | 72 | if ( path.right( 1 ) != "/" ) |
72 | path += "/"; | 73 | path += "/"; |
73 | 74 | ||
74 | if ( path == "/" ) | 75 | if ( path == "/" ) |
75 | { | 76 | { |
76 | rootRead = true; | 77 | rootRead = true; |
77 | installingToRoot = true; | 78 | installingToRoot = true; |
78 | } | 79 | } |
79 | 80 | ||
80 | packageFile = path + "usr/lib/ipkg/status"; | 81 | packageFile = path + "usr/lib/ipkg/status"; |
81 | readPackageFile( 0, false, installingToRoot, dit ); | 82 | readPackageFile( 0, false, installingToRoot, dit ); |
82 | } | 83 | } |
83 | 84 | ||
84 | // Ensure that the root status file is read | 85 | // Ensure that the root status file is read |
85 | if ( !rootRead ) | 86 | if ( !rootRead ) |
86 | { | 87 | { |
87 | cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; | 88 | cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; |
88 | packageFile = "/usr/lib/ipkg/status"; | 89 | packageFile = "/usr/lib/ipkg/status"; |
89 | readPackageFile( 0, false, true ); | 90 | readPackageFile( 0, false, true ); |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
93 | void Server :: readLocalIpks( Server *local ) | 94 | void Server :: readLocalIpks( Server *local ) |
94 | { | 95 | { |
95 | cleanUp(); | 96 | cleanUp(); |
96 | 97 | ||
97 | #ifdef QWS | 98 | #ifdef QWS |
98 | // First, get any local IPKGs in the documents area | 99 | // First, get any local IPKGs in the documents area |
99 | // Only applicable to Qtopie/Opie | 100 | // Only applicable to Qtopie/Opie |
100 | 101 | ||
101 | DocLnkSet files; | 102 | DocLnkSet files; |
102 | Global::findDocuments( &files, "application/ipkg" ); | 103 | Global::findDocuments( &files, "application/ipkg" ); |
103 | 104 | ||
104 | // Now add the items to the list | 105 | // Now add the items to the list |
105 | QListIterator<DocLnk> it( files.children() ); | 106 | QListIterator<DocLnk> it( files.children() ); |
106 | 107 | ||
107 | for ( ; it.current() ; ++it ) | 108 | for ( ; it.current() ; ++it ) |
108 | { | 109 | { |
109 | // OK, we have a local IPK file, I think the standard naming conventions | 110 | // OK, we have a local IPK file, I think the standard naming conventions |
110 | // for these are packagename_version_arm.ipk | 111 | // for these are packagename_version_arm.ipk |
111 | QString file = (*it)->file(); | 112 | QString file = (*it)->file(); |
112 | 113 | ||
113 | // Changed to display the filename (excluding the path) | 114 | // Changed to display the filename (excluding the path) |
114 | QString packageName = Utils::getFilenameFromIpkFilename( file ); | 115 | QString packageName = Utils::getFilenameFromIpkFilename( file ); |
115 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); | 116 | QString ver = Utils::getPackageVersionFromIpkFilename( file ); |
116 | packageList.push_back( Package( packageName ) ); | 117 | packageList.push_back( Package( packageName ) ); |
117 | packageList.back().setVersion( ver ); | 118 | packageList.back().setVersion( ver ); |
118 | packageList.back().setFilename( file ); | 119 | packageList.back().setFilename( file ); |
119 | packageList.back().setPackageStoredLocally( true ); | 120 | packageList.back().setPackageStoredLocally( true ); |
120 | 121 | ||
121 | } | 122 | } |
122 | #else | 123 | #else |
123 | QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; | 124 | QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; |
124 | for ( int i = 0 ; i < 4 ; ++i ) | 125 | for ( int i = 0 ; i < 4 ; ++i ) |
125 | { | 126 | { |
126 | // OK, we have a local IPK file, I think the standard naming conventions | 127 | // OK, we have a local IPK file, I think the standard naming conventions |
127 | // for these are packagename_version_arm.ipk | 128 | // for these are packagename_version_arm.ipk |
128 | QString file = names[i]; | 129 | QString file = names[i]; |
129 | int p = file.find( "_" ); | 130 | int p = file.find( "_" ); |
130 | QString tmp = file.mid( 0, p ); | 131 | QString tmp = file.mid( 0, p ); |
131 | packageList.push_back( Package( tmp ) ); | 132 | packageList.push_back( Package( tmp ) ); |
132 | int p2 = file.find( "_", p+1 ); | 133 | int p2 = file.find( "_", p+1 ); |
133 | tmp = file.mid( p+1, p2-(p+1) ); | 134 | tmp = file.mid( p+1, p2-(p+1) ); |
134 | packageList.back().setVersion( tmp ); | 135 | packageList.back().setVersion( tmp ); |
135 | packageList.back().setPackageStoredLocally( true ); | 136 | packageList.back().setPackageStoredLocally( true ); |
136 | } | 137 | } |
137 | #endif | 138 | #endif |
138 | 139 | ||
139 | // build local packages | 140 | // build local packages |
140 | buildLocalPackages( local ); | 141 | buildLocalPackages( local ); |
141 | } | 142 | } |
142 | 143 | ||
143 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) | 144 | void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) |
144 | { | 145 | { |
145 | ifstream in( packageFile ); | 146 | ifstream in( packageFile ); |
146 | if ( !in.is_open() ) | 147 | if ( !in.is_open() ) |
147 | return; | 148 | return; |
148 | 149 | ||
149 | char line[1001]; | 150 | char line[1001]; |
150 | char k[21]; | 151 | char k[21]; |
151 | char v[1001]; | 152 | char v[1001]; |
152 | QString key; | 153 | QString key; |
153 | QString value; | 154 | QString value; |
154 | 155 | ||
155 | if ( clearAll ) | 156 | if ( clearAll ) |
156 | cleanUp(); | 157 | cleanUp(); |
157 | Package *currPackage = 0; | 158 | Package *currPackage = 0; |
158 | 159 | ||
159 | bool newPackage = true; | 160 | bool newPackage = true; |
160 | do | 161 | do |
161 | { | 162 | { |
162 | in.getline( line, 1000 ); | 163 | in.getline( line, 1000 ); |
163 | if ( in.eof() ) | 164 | if ( in.eof() ) |
164 | continue; | 165 | continue; |
165 | 166 | ||
166 | k[0] = '\0'; | 167 | k[0] = '\0'; |
167 | v[0] = '\0'; | 168 | v[0] = '\0'; |
168 | 169 | ||
169 | sscanf( line, "%[^:]: %[^\n]", k, v ); | 170 | sscanf( line, "%[^:]: %[^\n]", k, v ); |
170 | key = k; | 171 | key = k; |
171 | value = v; | 172 | value = v; |
172 | key = key.stripWhiteSpace(); | 173 | key = key.stripWhiteSpace(); |
173 | value = value.stripWhiteSpace(); | 174 | value = value.stripWhiteSpace(); |
174 | if ( key == "Package" && newPackage ) | 175 | if ( key == "Package" && newPackage ) |
175 | { | 176 | { |
176 | newPackage = false; | 177 | newPackage = false; |
177 | 178 | ||
178 | currPackage = getPackage( value ); | 179 | currPackage = getPackage( value ); |
179 | if ( !currPackage ) | 180 | if ( !currPackage ) |
180 | { | 181 | { |
181 | packageList.push_back( Package( value ) ); | 182 | packageList.push_back( Package( value ) ); |
182 | currPackage = &(packageList.back()); | 183 | currPackage = &(packageList.back()); |
183 | currPackage->setInstalledTo( dest ); | 184 | currPackage->setInstalledTo( dest ); |
184 | 185 | ||
185 | if ( installingToRoot ) | 186 | if ( installingToRoot ) |
186 | currPackage->setInstalledToRoot( true ); | 187 | currPackage->setInstalledToRoot( true ); |
187 | } | 188 | } |
188 | else | 189 | else |
189 | { | 190 | { |
190 | if (currPackage->getStatus().find( "deinstall" ) != -1 ) | 191 | if (currPackage->getStatus().find( "deinstall" ) != -1 ) |
191 | currPackage->setInstalledTo( dest ); | 192 | currPackage->setInstalledTo( dest ); |
192 | } | 193 | } |
193 | } | 194 | } |
194 | else if ( key == "Version" ) | 195 | else if ( key == "Version" ) |
195 | { | 196 | { |
196 | if ( currPackage ) | 197 | if ( currPackage ) |
197 | currPackage->setVersion( value ); | 198 | currPackage->setVersion( value ); |
198 | } | 199 | } |
199 | else if ( key == "Status" ) | 200 | else if ( key == "Status" ) |
200 | { | 201 | { |
201 | if ( currPackage ) | 202 | if ( currPackage ) |
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 | ||
226 | void Server :: buildLocalPackages( Server *local ) | 239 | void Server :: buildLocalPackages( Server *local ) |
227 | { | 240 | { |
228 | for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) | 241 | for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) |
229 | { | 242 | { |
230 | QString name = packageList[i].getPackageName(); | 243 | QString name = packageList[i].getPackageName(); |
231 | 244 | ||
232 | // If the package name is an ipk name, then convert the filename to a package name | 245 | // If the package name is an ipk name, then convert the filename to a package name |
233 | if ( name.find( ".ipk" ) != -1 ) | 246 | if ( name.find( ".ipk" ) != -1 ) |
234 | name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() ); | 247 | name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() ); |
235 | 248 | ||
236 | if ( local ) | 249 | if ( local ) |
237 | packageList[i].setLocalPackage( local->getPackage( name ) ); | 250 | packageList[i].setLocalPackage( local->getPackage( name ) ); |
238 | else | 251 | else |
239 | packageList[i].setLocalPackage( 0 ); | 252 | packageList[i].setLocalPackage( 0 ); |
240 | } | 253 | } |
241 | 254 | ||
242 | } | 255 | } |
243 | 256 | ||
244 | Package *Server :: getPackage( QString &name ) | 257 | Package *Server :: getPackage( QString &name ) |
245 | { | 258 | { |
246 | return getPackage( (const char *)name ); | 259 | return getPackage( (const char *)name ); |
247 | } | 260 | } |
248 | 261 | ||
249 | Package *Server :: getPackage( const char *name ) | 262 | Package *Server :: getPackage( const char *name ) |
250 | { | 263 | { |
251 | Package *ret = 0; | 264 | Package *ret = 0; |
252 | 265 | ||
253 | for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i ) | 266 | for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i ) |
254 | { | 267 | { |
255 | if ( packageList[i].getPackageName() == name ) | 268 | if ( packageList[i].getPackageName() == name ) |
256 | ret = &packageList[i]; | 269 | ret = &packageList[i]; |
257 | } | 270 | } |
258 | 271 | ||
259 | return ret; | 272 | return ret; |
260 | } | 273 | } |
261 | 274 | ||
262 | QString Server :: toString() | 275 | QString 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 | } /* | ||
287 | void addAvailableSection( QString section ) | ||
288 | { | ||
289 | if ( DataManager::availableCategories.find( value ) == -1 ) | ||
290 | // DataManager::availableCategories += "#" + value; | ||
273 | } | 291 | } |
292 | */ | ||
274 | 293 | ||
275 | vector<Package> &Server::getPackageList() | 294 | vector<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 | |||
@@ -1,65 +1,66 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | server.h - description | 2 | server.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 | #ifndef SERVER_H | 17 | #ifndef SERVER_H |
18 | #define SERVER_H | 18 | #define SERVER_H |
19 | 19 | ||
20 | #include <qstring.h> | 20 | #include <qstring.h> |
21 | 21 | ||
22 | #include <vector> | 22 | #include <vector> |
23 | using namespace std; | 23 | using namespace std; |
24 | 24 | ||
25 | #include "package.h" | 25 | #include "package.h" |
26 | #include "destination.h" | 26 | #include "destination.h" |
27 | 27 | ||
28 | class Server | 28 | class Server |
29 | { | 29 | { |
30 | public: | 30 | public: |
31 | Server() {} | 31 | Server() {} |
32 | Server( const char *name, const char *url ); | 32 | Server( const char *name, const char *url ); |
33 | Server( const char *name, const char *url, const char *file ); | 33 | Server( const char *name, const char *url, const char *file ); |
34 | ~Server(); | 34 | ~Server(); |
35 | 35 | ||
36 | void cleanUp(); | 36 | void cleanUp(); |
37 | 37 | ||
38 | void readStatusFile( vector<Destination> &v ); | 38 | void readStatusFile( vector<Destination> &v ); |
39 | void readLocalIpks( Server *local ); | 39 | void readLocalIpks( Server *local ); |
40 | void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 ); | 40 | void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false, Destination *dest = 0 ); |
41 | void buildLocalPackages( Server *local ); | 41 | void buildLocalPackages( Server *local ); |
42 | Package *getPackage( const char *name ); | 42 | Package *getPackage( const char *name ); |
43 | Package *getPackage( QString &name ); | 43 | Package *getPackage( QString &name ); |
44 | QString toString(); | 44 | QString toString(); |
45 | vector<Package> &getPackageList(); | 45 | vector<Package> &getPackageList(); |
46 | bool isServerActive() { return active; } | 46 | bool isServerActive() { return active; } |
47 | 47 | ||
48 | void setServerName( const QString &name ) { serverName = name; } | 48 | void setServerName( const QString &name ) { serverName = name; } |
49 | void setServerUrl( const QString &url ) { serverUrl = url; } | 49 | void setServerUrl( const QString &url ) { serverUrl = url; } |
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 | ||
54 | protected: | 54 | protected: |
55 | 55 | ||
56 | private: | 56 | private: |
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 |