author | drw <drw> | 2003-03-04 01:15:19 (UTC) |
---|---|---|
committer | drw <drw> | 2003-03-04 01:15:19 (UTC) |
commit | 7cf53b4030437bdbd405b8b16684ba9f68e2891d (patch) (unidiff) | |
tree | 5dd4474a127422a837f886b83947ab494806225e | |
parent | c0045eaf96fc06316bfab1ac2f5c4fade050c088 (diff) | |
download | opie-7cf53b4030437bdbd405b8b16684ba9f68e2891d.zip opie-7cf53b4030437bdbd405b8b16684ba9f68e2891d.tar.gz opie-7cf53b4030437bdbd405b8b16684ba9f68e2891d.tar.bz2 |
Remove AQPkg's own help window, use standard help system
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/doc.txt | 49 | ||||
-rw-r--r-- | noncore/settings/aqpkg/helpwindow.cpp | 95 | ||||
-rw-r--r-- | noncore/settings/aqpkg/helpwindow.h | 34 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 25 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 2 |
6 files changed, 0 insertions, 207 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index 6b4fb30..e4076f5 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro | |||
@@ -1,61 +1,59 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | HEADERS = global.h \ | 3 | HEADERS = global.h \ |
4 | mainwin.h \ | 4 | mainwin.h \ |
5 | datamgr.h \ | 5 | datamgr.h \ |
6 | settingsimpl.h \ | 6 | settingsimpl.h \ |
7 | ipkg.h \ | 7 | ipkg.h \ |
8 | package.h \ | 8 | package.h \ |
9 | installdlgimpl.h \ | 9 | installdlgimpl.h \ |
10 | instoptionsimpl.h \ | 10 | instoptionsimpl.h \ |
11 | destination.h \ | 11 | destination.h \ |
12 | utils.h \ | 12 | utils.h \ |
13 | server.h \ | 13 | server.h \ |
14 | helpwindow.h \ | ||
15 | letterpushbutton.h \ | 14 | letterpushbutton.h \ |
16 | inputdlg.h \ | 15 | inputdlg.h \ |
17 | categoryfilterimpl.h | 16 | categoryfilterimpl.h |
18 | SOURCES = mainwin.cpp \ | 17 | SOURCES = mainwin.cpp \ |
19 | datamgr.cpp \ | 18 | datamgr.cpp \ |
20 | mem.cpp \ | 19 | mem.cpp \ |
21 | settingsimpl.cpp \ | 20 | settingsimpl.cpp \ |
22 | ipkg.cpp \ | 21 | ipkg.cpp \ |
23 | main.cpp \ | 22 | main.cpp \ |
24 | package.cpp \ | 23 | package.cpp \ |
25 | installdlgimpl.cpp \ | 24 | installdlgimpl.cpp \ |
26 | instoptionsimpl.cpp \ | 25 | instoptionsimpl.cpp \ |
27 | destination.cpp \ | 26 | destination.cpp \ |
28 | utils.cpp \ | 27 | utils.cpp \ |
29 | server.cpp \ | 28 | server.cpp \ |
30 | helpwindow.cpp \ | ||
31 | letterpushbutton.cpp \ | 29 | letterpushbutton.cpp \ |
32 | inputdlg.cpp \ | 30 | inputdlg.cpp \ |
33 | version.cpp \ | 31 | version.cpp \ |
34 | categoryfilterimpl.cpp | 32 | categoryfilterimpl.cpp |
35 | INTERFACES= | 33 | INTERFACES= |
36 | TARGET = aqpkg | 34 | TARGET = aqpkg |
37 | INCLUDEPATH += $(OPIEDIR)/include | 35 | INCLUDEPATH += $(OPIEDIR)/include |
38 | DEPENDPATH += $(OPIEDIR)/include | 36 | DEPENDPATH += $(OPIEDIR)/include |
39 | LIBS += -lqpe -lopie -lstdc++ | 37 | LIBS += -lqpe -lopie -lstdc++ |
40 | DESTDIR = $(OPIEDIR)/bin | 38 | DESTDIR = $(OPIEDIR)/bin |
41 | 39 | ||
42 | TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ | 40 | TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ |
43 | ../../../i18n/xx/aqpkg.ts \ | 41 | ../../../i18n/xx/aqpkg.ts \ |
44 | ../../../i18n/en/aqpkg.ts \ | 42 | ../../../i18n/en/aqpkg.ts \ |
45 | ../../../i18n/es/aqpkg.ts \ | 43 | ../../../i18n/es/aqpkg.ts \ |
46 | ../../../i18n/fr/aqpkg.ts \ | 44 | ../../../i18n/fr/aqpkg.ts \ |
47 | ../../../i18n/hu/aqpkg.ts \ | 45 | ../../../i18n/hu/aqpkg.ts \ |
48 | ../../../i18n/ja/aqpkg.ts \ | 46 | ../../../i18n/ja/aqpkg.ts \ |
49 | ../../../i18n/ko/aqpkg.ts \ | 47 | ../../../i18n/ko/aqpkg.ts \ |
50 | ../../../i18n/no/aqpkg.ts \ | 48 | ../../../i18n/no/aqpkg.ts \ |
51 | ../../../i18n/pl/aqpkg.ts \ | 49 | ../../../i18n/pl/aqpkg.ts \ |
52 | ../../../i18n/pt/aqpkg.ts \ | 50 | ../../../i18n/pt/aqpkg.ts \ |
53 | ../../../i18n/pt_BR/aqpkg.ts \ | 51 | ../../../i18n/pt_BR/aqpkg.ts \ |
54 | ../../../i18n/sl/aqpkg.ts \ | 52 | ../../../i18n/sl/aqpkg.ts \ |
55 | ../../../i18n/zh_CN/aqpkg.ts \ | 53 | ../../../i18n/zh_CN/aqpkg.ts \ |
56 | ../../../i18n/zh_TW/aqpkg.ts \ | 54 | ../../../i18n/zh_TW/aqpkg.ts \ |
57 | ../../../i18n/it/aqpkg.ts \ | 55 | ../../../i18n/it/aqpkg.ts \ |
58 | ../../../i18n/da/aqpkg.ts | 56 | ../../../i18n/da/aqpkg.ts |
59 | 57 | ||
60 | 58 | ||
61 | include ( $(OPIEDIR)/include.pro ) | 59 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/settings/aqpkg/doc.txt b/noncore/settings/aqpkg/doc.txt deleted file mode 100644 index 7722c07..0000000 --- a/noncore/settings/aqpkg/doc.txt +++ b/dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | <qt><h1>Documentation for AQPkg</h1><p> | ||
2 | AQPkg is a package manager for the Sharp Zaurus.<br> | ||
3 | Basic Instructions:<br> | ||
4 | On startup, you will be shown a window. The main part of the window is taken up | ||
5 | by a list box showing packages. The packages shown will depend on the server selected.<br> | ||
6 | The servers list contains network servers containing feeds of packages that can be downloaded | ||
7 | and installed onto your Zaurus. These are held in the file /etc/ipkg.conf and can be maintained | ||
8 | using AQPkg. In addition to the servers defined in ipkg.conf file, there are two other servers - | ||
9 | local and local IPKGs. These are not network servers but views of yours Zaurus.<br> | ||
10 | The local server shows all installed packages, and the local IPKGs server shows all ipks | ||
11 | that are stored on your Zaurus.<br> | ||
12 | On the local server, you can only remove packages. On the local IPKGs server you can only | ||
13 | install and delete packages - removing installed packages is currently not working. On all other | ||
14 | servers you can install, uninstall, upgrade and download packages.<br> | ||
15 | To get the latest package list for a server (or refresh the view), select the server you | ||
16 | wish to update and click the Refresh List button.<br> | ||
17 | To download a package from a remote server, select the server (any except local and local IPKGs), | ||
18 | then select the package(s) you wish to download (by tapping in the box next to the package | ||
19 | name so that a tick appears in the box) and click the Download button. Enter the path where you | ||
20 | want the package to be downloaded to and click OK to download the package.<br> | ||
21 | To install, upgrade or remove a package select the packages you wish to install and click the Apply | ||
22 | button. You will then be shown a dialog which allows you to select which destination you wish | ||
23 | to install the package to, which packages will be installed, removed and upgraded. You can also | ||
24 | set various options. (for the moment, see the documentation for IPKG for more details on these | ||
25 | options). To start the process, click Start. This will perform the necessary operations and | ||
26 | will show you what is happening. Once everything has completed click the Close button.<br> | ||
27 | Note: Currently, the operation to perform for a package is automatically decided based on the | ||
28 | following rules:<br> | ||
29 | If a package isn't installed, then it will be installed.<br> | ||
30 | If a package is installed and there isn't a later version available then it will be removed.<br> | ||
31 | If a package is installed and a different version is available then it will be upgraded. (Note, | ||
32 | I haven't yet found a way to determine if an available package is newer or older than the one | ||
33 | currently installed so it is possible that a package may be downgraded).<br> | ||
34 | As previously mentioned, a package can be explicitly removed by using the local server.<br><br> | ||
35 | A couple of last notes, in the main window, the following may be useful:<br> | ||
36 | If a package is installed then it will have (installed) after it.<br> | ||
37 | If a different version is available then it will have a * after the package name.<br> | ||
38 | You can view details of a package by tapping twice (quickly) on the package name (NOT the | ||
39 | box next to the package name). This will show you a brief description of the package, the | ||
40 | version installed (if it is installed), and the version available for download/installation | ||
41 | (if a different on is available).<br><br><br> | ||
42 | Well, hope you enjoy using this program. If you have any ideas/suggestions/ideas for improvements | ||
43 | then please let me know at andy.qua@blueyonder.co.uk.<br><br> | ||
44 | Thanks for using this. | ||
45 | Andy. | ||
46 | </p></qt> | ||
47 | |||
48 | |||
49 | |||
diff --git a/noncore/settings/aqpkg/helpwindow.cpp b/noncore/settings/aqpkg/helpwindow.cpp deleted file mode 100644 index 0302b3f..0000000 --- a/noncore/settings/aqpkg/helpwindow.cpp +++ b/dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | helpwindow.cpp - description | ||
3 | ------------------- | ||
4 | begin : Sun Sep 8 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 | #include <qwidget.h> | ||
19 | #include <qlayout.h> | ||
20 | #include <qstring.h> | ||
21 | #include <qtextview.h> | ||
22 | |||
23 | #include "helpwindow.h" | ||
24 | #include "global.h" | ||
25 | |||
26 | |||
27 | #define HELP_TEXT \ | ||
28 | "<qt><h1>Documentation for AQPkg</h1><p> " \ | ||
29 | "AQPkg is a package manager for the Sharp Zaurus.<br><br> " \ | ||
30 | "Basic Instructions:<br><br> " \ | ||
31 | "On startup, you will be shown a window. The main part of the window is taken up " \ | ||
32 | "by a list box showing packages. The packages shown will depend on the server selected.<br><br> " \ | ||
33 | "The servers list contains network servers containing feeds of packages that can be downloaded " \ | ||
34 | "and installed onto your Zaurus. These are held in the file /etc/ipkg.conf and can be maintained " \ | ||
35 | "using AQPkg. In addition to the servers defined in ipkg.conf file, there are two other servers - " \ | ||
36 | "local and local IPKGs. These are not network servers but views of yours Zaurus.<br><br> " \ | ||
37 | "The local server shows all installed packages, and the local IPKGs server shows all ipks " \ | ||
38 | "that are stored on your Zaurus.<br><br> " \ | ||
39 | "On the local server, you can only remove packages. On the local IPKGs server you can only " \ | ||
40 | "install and delete packages - removing installed packages is currently not working. On all other " \ | ||
41 | "servers you can install, uninstall, upgrade and download packages.<br><br> " \ | ||
42 | "To get the latest package list for a server (or refresh the view), select the server you " \ | ||
43 | "wish to update and click the Refresh List button.<br><br> " \ | ||
44 | "To download a package from a remote server, select the server (any except local and local IPKGs), " \ | ||
45 | "then select the package(s) you wish to download (by tapping in the box next to the package " \ | ||
46 | "name so that a tick appears in the box) and click the Download button. Enter the path where you " \ | ||
47 | "want the package to be downloaded to and click OK to download the package.<br><br> " \ | ||
48 | "To install, upgrade or remove a package select the packages you wish to install and click the Apply " \ | ||
49 | "button. You will then be shown a dialog which allows you to select which destination you wish " \ | ||
50 | "to install the package to, which packages will be installed, removed and upgraded. You can also " \ | ||
51 | "set various options. (for the moment, see the documentation for IPKG for more details on these " \ | ||
52 | "options). To start the process, click Start. This will perform the necessary operations and " \ | ||
53 | "will show you what is happening. Once everything has completed click the Close button.<br><br> " \ | ||
54 | "Note: Currently, the operation to perform for a package is automatically decided based on the " \ | ||
55 | "following rules:<br><br> " \ | ||
56 | " If a package isn't installed, then it will be installed.<br> " \ | ||
57 | " If a package is installed and there isn't a later version available then it will be removed.<br> " \ | ||
58 | " If a package is installed and a different version is available then it will be upgraded. (Note, " \ | ||
59 | "I haven't yet found a way to determine if an available package is newer or older than the one " \ | ||
60 | "currently installed so it is possible that a package may be downgraded).<br><br> " \ | ||
61 | "As previously mentioned, a package can be explicitly removed by using the local server.<br><br> " \ | ||
62 | "A couple of last notes, in the main window, the following may be useful:<br><br> " \ | ||
63 | "If a package is installed then it will have (installed) after it.<br><br> " \ | ||
64 | "If a different version is available then it will have a * after the package name.<br><br> " \ | ||
65 | "You can view details of a package by tapping twice (quickly) on the package name (NOT the " \ | ||
66 | "box next to the package name). This will show you a brief description of the package, the " \ | ||
67 | "version installed (if it is installed), and the version available for download or installation " \ | ||
68 | "(if a different on is available).<br><br> " \ | ||
69 | "Well, hope you enjoy using this program. If you have any ideas/suggestions/ideas for improvements " \ | ||
70 | "then please let me know at andy.qua@blueyonder.co.uk.<br><br> " \ | ||
71 | "Thanks for using this. " \ | ||
72 | "Andy. " \ | ||
73 | "</p></qt>" | ||
74 | |||
75 | |||
76 | HelpWindow::HelpWindow( QWidget *parent, const char *name, bool modal, WFlags flags ) | ||
77 | : QDialog( parent, name, modal, flags ) | ||
78 | { | ||
79 | // resize( 230, 280 ); | ||
80 | |||
81 | setCaption( "Help for AQPkg" ); | ||
82 | |||
83 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
84 | QString text = HELP_TEXT;; | ||
85 | QTextView *view = new QTextView( text, 0, this, "view" ); | ||
86 | layout->insertSpacing( -1, 5 ); | ||
87 | layout->insertWidget( -1, view ); | ||
88 | layout->insertSpacing( -1, 5 ); | ||
89 | |||
90 | showMaximized(); | ||
91 | } | ||
92 | |||
93 | HelpWindow::~HelpWindow() | ||
94 | { | ||
95 | } | ||
diff --git a/noncore/settings/aqpkg/helpwindow.h b/noncore/settings/aqpkg/helpwindow.h deleted file mode 100644 index edc1b6e..0000000 --- a/noncore/settings/aqpkg/helpwindow.h +++ b/dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | helpwindow.h - description | ||
3 | ------------------- | ||
4 | begin : Sun Sep 8 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 HELPWINDOW_H | ||
19 | #define HELPWINDOW_H | ||
20 | |||
21 | #include <qdialog.h> | ||
22 | |||
23 | /** | ||
24 | *@author Andy Qua | ||
25 | */ | ||
26 | |||
27 | class HelpWindow : public QDialog | ||
28 | { | ||
29 | public: | ||
30 | HelpWindow( QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags flags = 0 ); | ||
31 | ~HelpWindow(); | ||
32 | }; | ||
33 | |||
34 | #endif | ||
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 8ae5815..392d04d 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,784 +1,759 @@ | |||
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 <linux/limits.h> | 18 | #include <linux/limits.h> |
19 | #include <unistd.h> | 19 | #include <unistd.h> |
20 | 20 | ||
21 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
22 | #include <qpe/qpemenubar.h> | 22 | #include <qpe/qpemenubar.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qpe/qpetoolbar.h> | 24 | #include <qpe/qpetoolbar.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | 27 | ||
28 | #include <qaction.h> | 28 | #include <qaction.h> |
29 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qmenubar.h> | 35 | #include <qmenubar.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qprogressbar.h> | 38 | #include <qprogressbar.h> |
39 | #include <qtimer.h> | 39 | #include <qtimer.h> |
40 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
41 | #include <qwidgetstack.h> | 41 | #include <qwidgetstack.h> |
42 | 42 | ||
43 | #include "categoryfilterimpl.h" | 43 | #include "categoryfilterimpl.h" |
44 | #include "datamgr.h" | 44 | #include "datamgr.h" |
45 | #include "global.h" | 45 | #include "global.h" |
46 | #include "helpwindow.h" | ||
47 | #include "inputdlg.h" | 46 | #include "inputdlg.h" |
48 | #include "ipkg.h" | 47 | #include "ipkg.h" |
49 | #include "installdlgimpl.h" | 48 | #include "installdlgimpl.h" |
50 | #include "letterpushbutton.h" | 49 | #include "letterpushbutton.h" |
51 | #include "mainwin.h" | 50 | #include "mainwin.h" |
52 | #include "settingsimpl.h" | 51 | #include "settingsimpl.h" |
53 | #include "utils.h" | 52 | #include "utils.h" |
54 | 53 | ||
55 | extern int compareVersions( const char *v1, const char *v2 ); | 54 | extern int compareVersions( const char *v1, const char *v2 ); |
56 | 55 | ||
57 | MainWindow :: MainWindow() | 56 | MainWindow :: MainWindow() |
58 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 57 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
59 | { | 58 | { |
60 | setCaption( tr( "AQPkg - Package Manager" ) ); | 59 | setCaption( tr( "AQPkg - Package Manager" ) ); |
61 | 60 | ||
62 | // Create UI widgets | 61 | // Create UI widgets |
63 | initMainWidget(); | 62 | initMainWidget(); |
64 | initProgressWidget(); | 63 | initProgressWidget(); |
65 | 64 | ||
66 | // Build menu and tool bars | 65 | // Build menu and tool bars |
67 | setToolBarsMovable( FALSE ); | 66 | setToolBarsMovable( FALSE ); |
68 | 67 | ||
69 | QPEToolBar *bar = new QPEToolBar( this ); | 68 | QPEToolBar *bar = new QPEToolBar( this ); |
70 | bar->setHorizontalStretchable( TRUE ); | 69 | bar->setHorizontalStretchable( TRUE ); |
71 | QPEMenuBar *mb = new QPEMenuBar( bar ); | 70 | QPEMenuBar *mb = new QPEMenuBar( bar ); |
72 | mb->setMargin( 0 ); | 71 | mb->setMargin( 0 ); |
73 | bar = new QPEToolBar( this ); | 72 | bar = new QPEToolBar( this ); |
74 | 73 | ||
75 | // Find toolbar | 74 | // Find toolbar |
76 | findBar = new QPEToolBar( this ); | 75 | findBar = new QPEToolBar( this ); |
77 | addToolBar( findBar, QMainWindow::Top, true ); | 76 | addToolBar( findBar, QMainWindow::Top, true ); |
78 | findBar->setHorizontalStretchable( true ); | 77 | findBar->setHorizontalStretchable( true ); |
79 | findEdit = new QLineEdit( findBar ); | 78 | findEdit = new QLineEdit( findBar ); |
80 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 79 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
81 | findBar->setStretchableWidget( findEdit ); | 80 | findBar->setStretchableWidget( findEdit ); |
82 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | 81 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); |
83 | 82 | ||
84 | // Quick jump toolbar | 83 | // Quick jump toolbar |
85 | jumpBar = new QPEToolBar( this ); | 84 | jumpBar = new QPEToolBar( this ); |
86 | addToolBar( jumpBar, QMainWindow::Top, true ); | 85 | addToolBar( jumpBar, QMainWindow::Top, true ); |
87 | jumpBar->setHorizontalStretchable( true ); | 86 | jumpBar->setHorizontalStretchable( true ); |
88 | QWidget *w = new QWidget( jumpBar ); | 87 | QWidget *w = new QWidget( jumpBar ); |
89 | jumpBar->setStretchableWidget( w ); | 88 | jumpBar->setStretchableWidget( w ); |
90 | 89 | ||
91 | QGridLayout *layout = new QGridLayout( w ); | 90 | QGridLayout *layout = new QGridLayout( w ); |
92 | 91 | ||
93 | char text[2]; | 92 | char text[2]; |
94 | text[1] = '\0'; | 93 | text[1] = '\0'; |
95 | for ( int i = 0 ; i < 26 ; ++i ) | 94 | for ( int i = 0 ; i < 26 ; ++i ) |
96 | { | 95 | { |
97 | text[0] = 'A' + i; | 96 | text[0] = 'A' + i; |
98 | LetterPushButton *b = new LetterPushButton( text, w ); | 97 | LetterPushButton *b = new LetterPushButton( text, w ); |
99 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | 98 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); |
100 | layout->addWidget( b, i / 13, i % 13); | 99 | layout->addWidget( b, i / 13, i % 13); |
101 | } | 100 | } |
102 | 101 | ||
103 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | 102 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); |
104 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | 103 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); |
105 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | 104 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); |
106 | a->addTo( jumpBar ); | 105 | a->addTo( jumpBar ); |
107 | jumpBar->hide(); | 106 | jumpBar->hide(); |
108 | 107 | ||
109 | // Packages menu | 108 | // Packages menu |
110 | QPopupMenu *popup = new QPopupMenu( this ); | 109 | QPopupMenu *popup = new QPopupMenu( this ); |
111 | 110 | ||
112 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 111 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
113 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 112 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
114 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); | 113 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); |
115 | a->addTo( popup ); | 114 | a->addTo( popup ); |
116 | a->addTo( bar ); | 115 | a->addTo( bar ); |
117 | 116 | ||
118 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 117 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
119 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 118 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
120 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); | 119 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); |
121 | actionUpgrade->addTo( popup ); | 120 | actionUpgrade->addTo( popup ); |
122 | actionUpgrade->addTo( bar ); | 121 | actionUpgrade->addTo( bar ); |
123 | 122 | ||
124 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 123 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
125 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 124 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); |
126 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 125 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
127 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 126 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
128 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); | 127 | connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); |
129 | actionDownload->addTo( popup ); | 128 | actionDownload->addTo( popup ); |
130 | actionDownload->addTo( bar ); | 129 | actionDownload->addTo( bar ); |
131 | 130 | ||
132 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 131 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
133 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 132 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
134 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); | 133 | connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); |
135 | a->addTo( popup ); | 134 | a->addTo( popup ); |
136 | a->addTo( bar ); | 135 | a->addTo( bar ); |
137 | 136 | ||
138 | mb->insertItem( tr( "Actions" ), popup ); | 137 | mb->insertItem( tr( "Actions" ), popup ); |
139 | 138 | ||
140 | // View menu | 139 | // View menu |
141 | popup = new QPopupMenu( this ); | 140 | popup = new QPopupMenu( this ); |
142 | 141 | ||
143 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 142 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
144 | actionUninstalled->setToggleAction( TRUE ); | 143 | actionUninstalled->setToggleAction( TRUE ); |
145 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 144 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
146 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); | 145 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); |
147 | actionUninstalled->addTo( popup ); | 146 | actionUninstalled->addTo( popup ); |
148 | 147 | ||
149 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 148 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
150 | actionInstalled->setToggleAction( TRUE ); | 149 | actionInstalled->setToggleAction( TRUE ); |
151 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 150 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
152 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); | 151 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); |
153 | actionInstalled->addTo( popup ); | 152 | actionInstalled->addTo( popup ); |
154 | 153 | ||
155 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 154 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
156 | actionUpdated->setToggleAction( TRUE ); | 155 | actionUpdated->setToggleAction( TRUE ); |
157 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 156 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
158 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | 157 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); |
159 | actionUpdated->addTo( popup ); | 158 | actionUpdated->addTo( popup ); |
160 | 159 | ||
161 | popup->insertSeparator(); | 160 | popup->insertSeparator(); |
162 | 161 | ||
163 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | 162 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); |
164 | actionFilter->setToggleAction( TRUE ); | 163 | actionFilter->setToggleAction( TRUE ); |
165 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | 164 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); |
166 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | 165 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); |
167 | actionFilter->addTo( popup ); | 166 | actionFilter->addTo( popup ); |
168 | 167 | ||
169 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | 168 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); |
170 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | 169 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | 170 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); |
172 | a->addTo( popup ); | 171 | a->addTo( popup ); |
173 | 172 | ||
174 | popup->insertSeparator(); | 173 | popup->insertSeparator(); |
175 | 174 | ||
176 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
177 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 176 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
178 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | 177 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); |
179 | a->addTo( popup ); | 178 | a->addTo( popup ); |
180 | 179 | ||
181 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 180 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
182 | actionFindNext->setEnabled( FALSE ); | 181 | actionFindNext->setEnabled( FALSE ); |
183 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 182 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
184 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 183 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
185 | actionFindNext->addTo( popup ); | 184 | actionFindNext->addTo( popup ); |
186 | actionFindNext->addTo( findBar ); | 185 | actionFindNext->addTo( findBar ); |
187 | 186 | ||
188 | 187 | ||
189 | popup->insertSeparator(); | 188 | popup->insertSeparator(); |
190 | 189 | ||
191 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | 190 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); |
192 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | 191 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); |
193 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | 192 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); |
194 | a->addTo( popup ); | 193 | a->addTo( popup ); |
195 | 194 | ||
196 | mb->insertItem( tr( "View" ), popup ); | 195 | mb->insertItem( tr( "View" ), popup ); |
197 | 196 | ||
198 | 197 | ||
199 | // Options menu | 198 | // Options menu |
200 | popup = new QPopupMenu( this ); | 199 | popup = new QPopupMenu( this ); |
201 | 200 | ||
202 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); | 201 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); |
203 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 202 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
204 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 203 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
205 | a->addTo( popup ); | 204 | a->addTo( popup ); |
206 | 205 | ||
207 | popup->insertSeparator(); | ||
208 | |||
209 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); | ||
210 | a->setWhatsThis( tr( "Click here for help." ) ); | ||
211 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); | ||
212 | a->addTo( popup ); | ||
213 | |||
214 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); | ||
215 | a->setWhatsThis( tr( "Click here for software version information." ) ); | ||
216 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); | ||
217 | a->addTo( popup ); | ||
218 | |||
219 | mb->insertItem( tr( "Options" ), popup ); | 206 | mb->insertItem( tr( "Options" ), popup ); |
220 | 207 | ||
221 | // Finish find toolbar creation | 208 | // Finish find toolbar creation |
222 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 209 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
223 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 210 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
224 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 211 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
225 | a->addTo( findBar ); | 212 | a->addTo( findBar ); |
226 | findBar->hide(); | 213 | findBar->hide(); |
227 | 214 | ||
228 | // Create widget stack and add UI widgets | 215 | // Create widget stack and add UI widgets |
229 | stack = new QWidgetStack( this ); | 216 | stack = new QWidgetStack( this ); |
230 | stack->addWidget( progressWindow, 2 ); | 217 | stack->addWidget( progressWindow, 2 ); |
231 | stack->addWidget( networkPkgWindow, 1 ); | 218 | stack->addWidget( networkPkgWindow, 1 ); |
232 | setCentralWidget( stack ); | 219 | setCentralWidget( stack ); |
233 | stack->raiseWidget( progressWindow ); | 220 | stack->raiseWidget( progressWindow ); |
234 | 221 | ||
235 | // Delayed call to finish initialization | 222 | // Delayed call to finish initialization |
236 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 223 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
237 | } | 224 | } |
238 | 225 | ||
239 | MainWindow :: ~MainWindow() | 226 | MainWindow :: ~MainWindow() |
240 | { | 227 | { |
241 | delete mgr; | 228 | delete mgr; |
242 | } | 229 | } |
243 | 230 | ||
244 | void MainWindow :: initMainWidget() | 231 | void MainWindow :: initMainWidget() |
245 | { | 232 | { |
246 | networkPkgWindow = new QWidget( this ); | 233 | networkPkgWindow = new QWidget( this ); |
247 | 234 | ||
248 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); | 235 | QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); |
249 | 236 | ||
250 | serversList = new QComboBox( networkPkgWindow ); | 237 | serversList = new QComboBox( networkPkgWindow ); |
251 | connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); | 238 | connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); |
252 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); | 239 | QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); |
253 | 240 | ||
254 | installedIcon = Resource::loadPixmap( "aqpkg/installed" ); | 241 | installedIcon = Resource::loadPixmap( "aqpkg/installed" ); |
255 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); | 242 | updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); |
256 | 243 | ||
257 | packagesList = new QListView( networkPkgWindow ); | 244 | packagesList = new QListView( networkPkgWindow ); |
258 | packagesList->addColumn( tr( "Packages" ), 225 ); | 245 | packagesList->addColumn( tr( "Packages" ), 225 ); |
259 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 246 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); |
260 | 247 | ||
261 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 248 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
262 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 249 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
263 | hbox1->addWidget( l ); | 250 | hbox1->addWidget( l ); |
264 | hbox1->addWidget( serversList ); | 251 | hbox1->addWidget( serversList ); |
265 | 252 | ||
266 | vbox->addWidget( packagesList ); | 253 | vbox->addWidget( packagesList ); |
267 | 254 | ||
268 | downloadEnabled = TRUE; | 255 | downloadEnabled = TRUE; |
269 | } | 256 | } |
270 | 257 | ||
271 | void MainWindow :: initProgressWidget() | 258 | void MainWindow :: initProgressWidget() |
272 | { | 259 | { |
273 | progressWindow = new QWidget( this ); | 260 | progressWindow = new QWidget( this ); |
274 | 261 | ||
275 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); | 262 | QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); |
276 | 263 | ||
277 | m_status = new QLabel( progressWindow ); | 264 | m_status = new QLabel( progressWindow ); |
278 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 265 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
279 | layout->addWidget( m_status ); | 266 | layout->addWidget( m_status ); |
280 | 267 | ||
281 | m_progress = new QProgressBar( progressWindow ); | 268 | m_progress = new QProgressBar( progressWindow ); |
282 | layout->addWidget( m_progress ); | 269 | layout->addWidget( m_progress ); |
283 | } | 270 | } |
284 | 271 | ||
285 | void MainWindow :: init() | 272 | void MainWindow :: init() |
286 | { | 273 | { |
287 | #ifdef QWS | 274 | #ifdef QWS |
288 | // read download directory from config file | 275 | // read download directory from config file |
289 | Config cfg( "aqpkg" ); | 276 | Config cfg( "aqpkg" ); |
290 | cfg.setGroup( "settings" ); | 277 | cfg.setGroup( "settings" ); |
291 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | 278 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); |
292 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | 279 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); |
293 | 280 | ||
294 | #endif | 281 | #endif |
295 | 282 | ||
296 | stack->raiseWidget( progressWindow ); | 283 | stack->raiseWidget( progressWindow ); |
297 | 284 | ||
298 | mgr = new DataManager(); | 285 | mgr = new DataManager(); |
299 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); | 286 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); |
300 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 287 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
301 | this, SLOT( setProgressMessage( const QString & ) ) ); | 288 | this, SLOT( setProgressMessage( const QString & ) ) ); |
302 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); | 289 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); |
303 | mgr->loadServers(); | 290 | mgr->loadServers(); |
304 | 291 | ||
305 | showUninstalledPkgs = false; | 292 | showUninstalledPkgs = false; |
306 | showInstalledPkgs = false; | 293 | showInstalledPkgs = false; |
307 | showUpgradedPkgs = false; | 294 | showUpgradedPkgs = false; |
308 | categoryFilterEnabled = false; | 295 | categoryFilterEnabled = false; |
309 | 296 | ||
310 | updateData(); | 297 | updateData(); |
311 | 298 | ||
312 | stack->raiseWidget( networkPkgWindow ); | 299 | stack->raiseWidget( networkPkgWindow ); |
313 | } | 300 | } |
314 | /* | 301 | /* |
315 | void MainWindow :: setDocument( const QString &doc ) | 302 | void MainWindow :: setDocument( const QString &doc ) |
316 | { | 303 | { |
317 | // Remove path from package | 304 | // Remove path from package |
318 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 305 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
319 | // std::cout << "Selecting package " << package << std::endl; | 306 | // std::cout << "Selecting package " << package << std::endl; |
320 | 307 | ||
321 | // First select local server | 308 | // First select local server |
322 | for ( int i = 0 ; i < serversList->count() ; ++i ) | 309 | for ( int i = 0 ; i < serversList->count() ; ++i ) |
323 | { | 310 | { |
324 | if ( serversList->text( i ) == LOCAL_IPKGS ) | 311 | if ( serversList->text( i ) == LOCAL_IPKGS ) |
325 | { | 312 | { |
326 | serversList->setCurrentItem( i ); | 313 | serversList->setCurrentItem( i ); |
327 | break; | 314 | break; |
328 | } | 315 | } |
329 | } | 316 | } |
330 | serverSelected( 0 ); | 317 | serverSelected( 0 ); |
331 | 318 | ||
332 | // Now set the check box of the selected package | 319 | // Now set the check box of the selected package |
333 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 320 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
334 | item != 0 ; | 321 | item != 0 ; |
335 | item = (QCheckListItem *)item->nextSibling() ) | 322 | item = (QCheckListItem *)item->nextSibling() ) |
336 | { | 323 | { |
337 | if ( item->text().startsWith( package ) ) | 324 | if ( item->text().startsWith( package ) ) |
338 | { | 325 | { |
339 | item->setOn( true ); | 326 | item->setOn( true ); |
340 | break; | 327 | break; |
341 | } | 328 | } |
342 | } | 329 | } |
343 | } | 330 | } |
344 | */ | 331 | */ |
345 | void MainWindow :: displaySettings() | 332 | void MainWindow :: displaySettings() |
346 | { | 333 | { |
347 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 334 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
348 | if ( dlg->showDlg() ) | 335 | if ( dlg->showDlg() ) |
349 | { | 336 | { |
350 | stack->raiseWidget( progressWindow ); | 337 | stack->raiseWidget( progressWindow ); |
351 | updateData(); | 338 | updateData(); |
352 | stack->raiseWidget( networkPkgWindow ); | 339 | stack->raiseWidget( networkPkgWindow ); |
353 | } | 340 | } |
354 | delete dlg; | 341 | delete dlg; |
355 | } | 342 | } |
356 | |||
357 | void MainWindow :: displayHelp() | ||
358 | { | ||
359 | HelpWindow *dlg = new HelpWindow( this ); | ||
360 | dlg->exec(); | ||
361 | delete dlg; | ||
362 | } | ||
363 | 343 | ||
364 | void MainWindow :: displayFindBar() | 344 | void MainWindow :: displayFindBar() |
365 | { | 345 | { |
366 | findBar->show(); | 346 | findBar->show(); |
367 | findEdit->setFocus(); | 347 | findEdit->setFocus(); |
368 | } | 348 | } |
369 | 349 | ||
370 | void MainWindow :: displayJumpBar() | 350 | void MainWindow :: displayJumpBar() |
371 | { | 351 | { |
372 | jumpBar->show(); | 352 | jumpBar->show(); |
373 | } | 353 | } |
374 | 354 | ||
375 | void MainWindow :: repeatFind() | 355 | void MainWindow :: repeatFind() |
376 | { | 356 | { |
377 | searchForPackage( findEdit->text() ); | 357 | searchForPackage( findEdit->text() ); |
378 | } | 358 | } |
379 | 359 | ||
380 | void MainWindow :: findPackage( const QString &text ) | 360 | void MainWindow :: findPackage( const QString &text ) |
381 | { | 361 | { |
382 | actionFindNext->setEnabled( !text.isEmpty() ); | 362 | actionFindNext->setEnabled( !text.isEmpty() ); |
383 | searchForPackage( text ); | 363 | searchForPackage( text ); |
384 | } | 364 | } |
385 | 365 | ||
386 | void MainWindow :: hideFindBar() | 366 | void MainWindow :: hideFindBar() |
387 | { | 367 | { |
388 | findBar->hide(); | 368 | findBar->hide(); |
389 | } | 369 | } |
390 | 370 | ||
391 | void MainWindow :: hideJumpBar() | 371 | void MainWindow :: hideJumpBar() |
392 | { | 372 | { |
393 | jumpBar->hide(); | 373 | jumpBar->hide(); |
394 | } | 374 | } |
395 | 375 | ||
396 | void MainWindow :: displayAbout() | ||
397 | { | ||
398 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); | ||
399 | } | ||
400 | |||
401 | void MainWindow :: filterUninstalledPackages() | 376 | void MainWindow :: filterUninstalledPackages() |
402 | { | 377 | { |
403 | showUninstalledPkgs = actionUninstalled->isOn(); | 378 | showUninstalledPkgs = actionUninstalled->isOn(); |
404 | if ( showUninstalledPkgs ) | 379 | if ( showUninstalledPkgs ) |
405 | { | 380 | { |
406 | showInstalledPkgs = FALSE; | 381 | showInstalledPkgs = FALSE; |
407 | showUpgradedPkgs = FALSE; | 382 | showUpgradedPkgs = FALSE; |
408 | } | 383 | } |
409 | serverSelected( -1 ); | 384 | serverSelected( -1 ); |
410 | 385 | ||
411 | actionInstalled->setOn( FALSE ); | 386 | actionInstalled->setOn( FALSE ); |
412 | actionUpdated->setOn( FALSE ); | 387 | actionUpdated->setOn( FALSE ); |
413 | } | 388 | } |
414 | 389 | ||
415 | void MainWindow :: filterInstalledPackages() | 390 | void MainWindow :: filterInstalledPackages() |
416 | { | 391 | { |
417 | showInstalledPkgs = actionInstalled->isOn(); | 392 | showInstalledPkgs = actionInstalled->isOn(); |
418 | if ( showInstalledPkgs ) | 393 | if ( showInstalledPkgs ) |
419 | { | 394 | { |
420 | showUninstalledPkgs = FALSE; | 395 | showUninstalledPkgs = FALSE; |
421 | showUpgradedPkgs = FALSE; | 396 | showUpgradedPkgs = FALSE; |
422 | } | 397 | } |
423 | serverSelected( -1 ); | 398 | serverSelected( -1 ); |
424 | 399 | ||
425 | actionUninstalled->setOn( FALSE ); | 400 | actionUninstalled->setOn( FALSE ); |
426 | actionUpdated->setOn( FALSE ); | 401 | actionUpdated->setOn( FALSE ); |
427 | } | 402 | } |
428 | 403 | ||
429 | void MainWindow :: filterUpgradedPackages() | 404 | void MainWindow :: filterUpgradedPackages() |
430 | { | 405 | { |
431 | showUpgradedPkgs = actionUpdated->isOn(); | 406 | showUpgradedPkgs = actionUpdated->isOn(); |
432 | if ( showUpgradedPkgs ) | 407 | if ( showUpgradedPkgs ) |
433 | { | 408 | { |
434 | showUninstalledPkgs = FALSE; | 409 | showUninstalledPkgs = FALSE; |
435 | showInstalledPkgs = FALSE; | 410 | showInstalledPkgs = FALSE; |
436 | } | 411 | } |
437 | serverSelected( -1 ); | 412 | serverSelected( -1 ); |
438 | 413 | ||
439 | actionUninstalled->setOn( FALSE ); | 414 | actionUninstalled->setOn( FALSE ); |
440 | actionInstalled->setOn( FALSE ); | 415 | actionInstalled->setOn( FALSE ); |
441 | } | 416 | } |
442 | 417 | ||
443 | bool MainWindow :: setFilterCategory() | 418 | bool MainWindow :: setFilterCategory() |
444 | { | 419 | { |
445 | // Get categories; | 420 | // Get categories; |
446 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); | 421 | CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); |
447 | if ( dlg.exec() == QDialog::Accepted ) | 422 | if ( dlg.exec() == QDialog::Accepted ) |
448 | { | 423 | { |
449 | categoryFilter = dlg.getSelectedFilter(); | 424 | categoryFilter = dlg.getSelectedFilter(); |
450 | 425 | ||
451 | if ( categoryFilter == "" ) | 426 | if ( categoryFilter == "" ) |
452 | return false; | 427 | return false; |
453 | 428 | ||
454 | categoryFilterEnabled = true; | 429 | categoryFilterEnabled = true; |
455 | serverSelected( -1 ); | 430 | serverSelected( -1 ); |
456 | actionFilter->setOn( TRUE ); | 431 | actionFilter->setOn( TRUE ); |
457 | return true; | 432 | return true; |
458 | } | 433 | } |
459 | 434 | ||
460 | return false; | 435 | return false; |
461 | } | 436 | } |
462 | 437 | ||
463 | void MainWindow :: filterCategory() | 438 | void MainWindow :: filterCategory() |
464 | { | 439 | { |
465 | if ( !actionFilter->isOn() ) | 440 | if ( !actionFilter->isOn() ) |
466 | { | 441 | { |
467 | filterByCategory( FALSE ); | 442 | filterByCategory( FALSE ); |
468 | } | 443 | } |
469 | else | 444 | else |
470 | { | 445 | { |
471 | actionFilter->setOn( filterByCategory( TRUE ) ); | 446 | actionFilter->setOn( filterByCategory( TRUE ) ); |
472 | } | 447 | } |
473 | } | 448 | } |
474 | 449 | ||
475 | bool MainWindow :: filterByCategory( bool val ) | 450 | bool MainWindow :: filterByCategory( bool val ) |
476 | { | 451 | { |
477 | if ( val ) | 452 | if ( val ) |
478 | { | 453 | { |
479 | if ( categoryFilter == "" ) | 454 | if ( categoryFilter == "" ) |
480 | { | 455 | { |
481 | if ( !setFilterCategory() ) | 456 | if ( !setFilterCategory() ) |
482 | return false; | 457 | return false; |
483 | } | 458 | } |
484 | 459 | ||
485 | categoryFilterEnabled = true; | 460 | categoryFilterEnabled = true; |
486 | serverSelected( -1 ); | 461 | serverSelected( -1 ); |
487 | return true; | 462 | return true; |
488 | } | 463 | } |
489 | else | 464 | else |
490 | { | 465 | { |
491 | // Turn off filter | 466 | // Turn off filter |
492 | categoryFilterEnabled = false; | 467 | categoryFilterEnabled = false; |
493 | serverSelected( -1 ); | 468 | serverSelected( -1 ); |
494 | return false; | 469 | return false; |
495 | } | 470 | } |
496 | } | 471 | } |
497 | 472 | ||
498 | void MainWindow :: raiseMainWidget() | 473 | void MainWindow :: raiseMainWidget() |
499 | { | 474 | { |
500 | stack->raiseWidget( networkPkgWindow ); | 475 | stack->raiseWidget( networkPkgWindow ); |
501 | } | 476 | } |
502 | 477 | ||
503 | void MainWindow :: raiseProgressWidget() | 478 | void MainWindow :: raiseProgressWidget() |
504 | { | 479 | { |
505 | stack->raiseWidget( progressWindow ); | 480 | stack->raiseWidget( progressWindow ); |
506 | } | 481 | } |
507 | 482 | ||
508 | void MainWindow :: enableUpgrade( bool enabled ) | 483 | void MainWindow :: enableUpgrade( bool enabled ) |
509 | { | 484 | { |
510 | actionUpgrade->setEnabled( enabled ); | 485 | actionUpgrade->setEnabled( enabled ); |
511 | } | 486 | } |
512 | 487 | ||
513 | void MainWindow :: enableDownload( bool enabled ) | 488 | void MainWindow :: enableDownload( bool enabled ) |
514 | { | 489 | { |
515 | if ( enabled ) | 490 | if ( enabled ) |
516 | { | 491 | { |
517 | actionDownload->setIconSet( iconDownload ); | 492 | actionDownload->setIconSet( iconDownload ); |
518 | actionDownload->setText( tr( "Download" ) ); | 493 | actionDownload->setText( tr( "Download" ) ); |
519 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 494 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
520 | } | 495 | } |
521 | else | 496 | else |
522 | { | 497 | { |
523 | actionDownload->setIconSet( iconRemove ); | 498 | actionDownload->setIconSet( iconRemove ); |
524 | actionDownload->setText( tr( "Remove" ) ); | 499 | actionDownload->setText( tr( "Remove" ) ); |
525 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); | 500 | actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); |
526 | } | 501 | } |
527 | } | 502 | } |
528 | 503 | ||
529 | void MainWindow :: setProgressSteps( int numsteps ) | 504 | void MainWindow :: setProgressSteps( int numsteps ) |
530 | { | 505 | { |
531 | m_progress->setTotalSteps( numsteps ); | 506 | m_progress->setTotalSteps( numsteps ); |
532 | } | 507 | } |
533 | 508 | ||
534 | void MainWindow :: setProgressMessage( const QString &msg ) | 509 | void MainWindow :: setProgressMessage( const QString &msg ) |
535 | { | 510 | { |
536 | m_status->setText( msg ); | 511 | m_status->setText( msg ); |
537 | } | 512 | } |
538 | 513 | ||
539 | void MainWindow :: updateProgress( int progress ) | 514 | void MainWindow :: updateProgress( int progress ) |
540 | { | 515 | { |
541 | m_progress->setProgress( progress ); | 516 | m_progress->setProgress( progress ); |
542 | } | 517 | } |
543 | 518 | ||
544 | void MainWindow :: updateData() | 519 | void MainWindow :: updateData() |
545 | { | 520 | { |
546 | m_progress->setTotalSteps( mgr->getServerList().count() ); | 521 | m_progress->setTotalSteps( mgr->getServerList().count() ); |
547 | 522 | ||
548 | serversList->clear(); | 523 | serversList->clear(); |
549 | packagesList->clear(); | 524 | packagesList->clear(); |
550 | 525 | ||
551 | int activeItem = -1; | 526 | int activeItem = -1; |
552 | int i = 0; | 527 | int i = 0; |
553 | QString serverName; | 528 | QString serverName; |
554 | 529 | ||
555 | QListIterator<Server> it( mgr->getServerList() ); | 530 | QListIterator<Server> it( mgr->getServerList() ); |
556 | Server *server; | 531 | Server *server; |
557 | 532 | ||
558 | for ( ; it.current(); ++it, ++i ) | 533 | for ( ; it.current(); ++it, ++i ) |
559 | { | 534 | { |
560 | server = it.current(); | 535 | server = it.current(); |
561 | serverName = server->getServerName(); | 536 | serverName = server->getServerName(); |
562 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); | 537 | m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); |
563 | m_progress->setProgress( i ); | 538 | m_progress->setProgress( i ); |
564 | qApp->processEvents(); | 539 | qApp->processEvents(); |
565 | 540 | ||
566 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; | 541 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; |
567 | if ( !server->isServerActive() ) | 542 | if ( !server->isServerActive() ) |
568 | { | 543 | { |
569 | // cout << serverName << " is not active" << endl; | 544 | // cout << serverName << " is not active" << endl; |
570 | i--; | 545 | i--; |
571 | continue; | 546 | continue; |
572 | } | 547 | } |
573 | 548 | ||
574 | serversList->insertItem( serverName ); | 549 | serversList->insertItem( serverName ); |
575 | if ( serverName == currentlySelectedServer ) | 550 | if ( serverName == currentlySelectedServer ) |
576 | activeItem = i; | 551 | activeItem = i; |
577 | } | 552 | } |
578 | 553 | ||
579 | // set selected server to be active server | 554 | // set selected server to be active server |
580 | if ( activeItem != -1 ) | 555 | if ( activeItem != -1 ) |
581 | serversList->setCurrentItem( activeItem ); | 556 | serversList->setCurrentItem( activeItem ); |
582 | serverSelected( 0, FALSE ); | 557 | serverSelected( 0, FALSE ); |
583 | } | 558 | } |
584 | 559 | ||
585 | void MainWindow :: serverSelected( int index ) | 560 | void MainWindow :: serverSelected( int index ) |
586 | { | 561 | { |
587 | serverSelected( index, TRUE ); | 562 | serverSelected( index, TRUE ); |
588 | } | 563 | } |
589 | 564 | ||
590 | void MainWindow :: serverSelected( int, bool raiseProgress ) | 565 | void MainWindow :: serverSelected( int, bool raiseProgress ) |
591 | { | 566 | { |
592 | QPixmap nullIcon( installedIcon.size() ); | 567 | QPixmap nullIcon( installedIcon.size() ); |
593 | nullIcon.fill( colorGroup().base() ); | 568 | nullIcon.fill( colorGroup().base() ); |
594 | 569 | ||
595 | // display packages | 570 | // display packages |
596 | QString serverName = serversList->currentText(); | 571 | QString serverName = serversList->currentText(); |
597 | currentlySelectedServer = serverName; | 572 | currentlySelectedServer = serverName; |
598 | 573 | ||
599 | Server *s = mgr->getServer( serverName ); | 574 | Server *s = mgr->getServer( serverName ); |
600 | 575 | ||
601 | QList<Package> &list = s->getPackageList(); | 576 | QList<Package> &list = s->getPackageList(); |
602 | QListIterator<Package> it( list ); | 577 | QListIterator<Package> it( list ); |
603 | 578 | ||
604 | // Display progress widget while loading list | 579 | // Display progress widget while loading list |
605 | bool doProgress = ( list.count() > 200 ); | 580 | bool doProgress = ( list.count() > 200 ); |
606 | if ( doProgress ) | 581 | if ( doProgress ) |
607 | { | 582 | { |
608 | if ( raiseProgress ) | 583 | if ( raiseProgress ) |
609 | { | 584 | { |
610 | stack->raiseWidget( progressWindow ); | 585 | stack->raiseWidget( progressWindow ); |
611 | } | 586 | } |
612 | m_progress->setTotalSteps( list.count() ); | 587 | m_progress->setTotalSteps( list.count() ); |
613 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | 588 | m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); |
614 | } | 589 | } |
615 | 590 | ||
616 | packagesList->clear(); | 591 | packagesList->clear(); |
617 | 592 | ||
618 | #ifdef QWS | 593 | #ifdef QWS |
619 | // read download directory from config file | 594 | // read download directory from config file |
620 | Config cfg( "aqpkg" ); | 595 | Config cfg( "aqpkg" ); |
621 | cfg.setGroup( "settings" ); | 596 | cfg.setGroup( "settings" ); |
622 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); | 597 | cfg.writeEntry( "selectedServer", currentlySelectedServer ); |
623 | #endif | 598 | #endif |
624 | 599 | ||
625 | int i = 0; | 600 | int i = 0; |
626 | Package *package; | 601 | Package *package; |
627 | for ( ; it.current(); ++it ) | 602 | for ( ; it.current(); ++it ) |
628 | { | 603 | { |
629 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | 604 | // Update progress after every 100th package (arbitrary value, seems to give good balance) |
630 | i++; | 605 | i++; |
631 | if ( ( i % 100 ) == 0 ) | 606 | if ( ( i % 100 ) == 0 ) |
632 | { | 607 | { |
633 | if ( doProgress ) | 608 | if ( doProgress ) |
634 | { | 609 | { |
635 | m_progress->setProgress( i ); | 610 | m_progress->setProgress( i ); |
636 | } | 611 | } |
637 | qApp->processEvents(); | 612 | qApp->processEvents(); |
638 | } | 613 | } |
639 | 614 | ||
640 | QString text = ""; | 615 | QString text = ""; |
641 | 616 | ||
642 | package = it.current(); | 617 | package = it.current(); |
643 | 618 | ||
644 | // Apply show only uninstalled packages filter | 619 | // Apply show only uninstalled packages filter |
645 | if ( showUninstalledPkgs && package->isInstalled() ) | 620 | if ( showUninstalledPkgs && package->isInstalled() ) |
646 | continue; | 621 | continue; |
647 | 622 | ||
648 | // Apply show only installed packages filter | 623 | // Apply show only installed packages filter |
649 | if ( showInstalledPkgs && !package->isInstalled() ) | 624 | if ( showInstalledPkgs && !package->isInstalled() ) |
650 | continue; | 625 | continue; |
651 | 626 | ||
652 | // Apply show only new installed packages filter | 627 | // Apply show only new installed packages filter |
653 | if ( showUpgradedPkgs ) | 628 | if ( showUpgradedPkgs ) |
654 | { | 629 | { |
655 | if ( !package->isInstalled() || | 630 | if ( !package->isInstalled() || |
656 | compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 ) | 631 | compareVersions( package->getInstalledVersion(), package->getVersion() ) != 1 ) |
657 | continue; | 632 | continue; |
658 | } | 633 | } |
659 | 634 | ||
660 | // Apply the section filter | 635 | // Apply the section filter |
661 | if ( categoryFilterEnabled && categoryFilter != "" ) | 636 | if ( categoryFilterEnabled && categoryFilter != "" ) |
662 | { | 637 | { |
663 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) | 638 | if ( package->getSection() == "" || categoryFilter.find( package->getSection().lower() ) == -1 ) |
664 | continue; | 639 | continue; |
665 | } | 640 | } |
666 | 641 | ||
667 | // If the local server, only display installed packages | 642 | // If the local server, only display installed packages |
668 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) | 643 | if ( serverName == LOCAL_SERVER && !package->isInstalled() ) |
669 | continue; | 644 | continue; |
670 | 645 | ||
671 | 646 | ||
672 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), | 647 | QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), |
673 | QCheckListItem::CheckBox ); | 648 | QCheckListItem::CheckBox ); |
674 | 649 | ||
675 | if ( package->isInstalled() ) | 650 | if ( package->isInstalled() ) |
676 | { | 651 | { |
677 | // If a different version of package is available, show update available icon | 652 | // If a different version of package is available, show update available icon |
678 | // Otherwise, show installed icon | 653 | // Otherwise, show installed icon |
679 | if ( package->getVersion() != package->getInstalledVersion() && | 654 | if ( package->getVersion() != package->getInstalledVersion() && |
680 | compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1) | 655 | compareVersions( package->getInstalledVersion(), package->getVersion() ) == 1) |
681 | { | 656 | { |
682 | 657 | ||
683 | item->setPixmap( 0, updatedIcon ); | 658 | item->setPixmap( 0, updatedIcon ); |
684 | } | 659 | } |
685 | else | 660 | else |
686 | { | 661 | { |
687 | item->setPixmap( 0, installedIcon ); | 662 | item->setPixmap( 0, installedIcon ); |
688 | } | 663 | } |
689 | 664 | ||
690 | QString destName = ""; | 665 | QString destName = ""; |
691 | if ( package->getLocalPackage() ) | 666 | if ( package->getLocalPackage() ) |
692 | { | 667 | { |
693 | if ( package->getLocalPackage()->getInstalledTo() ) | 668 | if ( package->getLocalPackage()->getInstalledTo() ) |
694 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); | 669 | destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); |
695 | } | 670 | } |
696 | else | 671 | else |
697 | { | 672 | { |
698 | if ( package->getInstalledTo() ) | 673 | if ( package->getInstalledTo() ) |
699 | destName = package->getInstalledTo()->getDestinationName(); | 674 | destName = package->getInstalledTo()->getDestinationName(); |
700 | } | 675 | } |
701 | if ( destName != "" ) | 676 | if ( destName != "" ) |
702 | new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); | 677 | new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); |
703 | } | 678 | } |
704 | else | 679 | else |
705 | { | 680 | { |
706 | item->setPixmap( 0, nullIcon ); | 681 | item->setPixmap( 0, nullIcon ); |
707 | } | 682 | } |
708 | 683 | ||
709 | if ( !package->isPackageStoredLocally() ) | 684 | if ( !package->isPackageStoredLocally() ) |
710 | { | 685 | { |
711 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); | 686 | new QCheckListItem( item, QString( tr( "Description - %1" ).arg( package->getDescription() ) ) ); |
712 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); | 687 | new QCheckListItem( item, QString( tr( "Size - %1" ).arg( package->getPackageSize() ) ) ); |
713 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); | 688 | new QCheckListItem( item, QString( tr( "Section - %1" ).arg( package->getSection() ) ) ); |
714 | } | 689 | } |
715 | else | 690 | else |
716 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); | 691 | new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( package->getFilename() ) ) ); |
717 | 692 | ||
718 | if ( serverName == LOCAL_SERVER ) | 693 | if ( serverName == LOCAL_SERVER ) |
719 | { | 694 | { |
720 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); | 695 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getVersion() ) ) ); |
721 | } | 696 | } |
722 | else | 697 | else |
723 | { | 698 | { |
724 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); | 699 | new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( package->getVersion() ) ) ); |
725 | if ( package->getLocalPackage() ) | 700 | if ( package->getLocalPackage() ) |
726 | { | 701 | { |
727 | if ( package->isInstalled() ) | 702 | if ( package->isInstalled() ) |
728 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); | 703 | new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( package->getInstalledVersion() ) ) ); |
729 | } | 704 | } |
730 | } | 705 | } |
731 | 706 | ||
732 | packagesList->insertItem( item ); | 707 | packagesList->insertItem( item ); |
733 | } | 708 | } |
734 | 709 | ||
735 | // If the local server or the local ipkgs server disable the download button | 710 | // If the local server or the local ipkgs server disable the download button |
736 | if ( serverName == LOCAL_SERVER ) | 711 | if ( serverName == LOCAL_SERVER ) |
737 | { | 712 | { |
738 | downloadEnabled = TRUE; | 713 | downloadEnabled = TRUE; |
739 | actionUpgrade->setEnabled( FALSE ); | 714 | actionUpgrade->setEnabled( FALSE ); |
740 | } | 715 | } |
741 | else if ( serverName == LOCAL_IPKGS ) | 716 | else if ( serverName == LOCAL_IPKGS ) |
742 | { | 717 | { |
743 | downloadEnabled = FALSE; | 718 | downloadEnabled = FALSE; |
744 | actionUpgrade->setEnabled( FALSE ); | 719 | actionUpgrade->setEnabled( FALSE ); |
745 | } | 720 | } |
746 | else | 721 | else |
747 | { | 722 | { |
748 | downloadEnabled = TRUE; | 723 | downloadEnabled = TRUE; |
749 | actionUpgrade->setEnabled( TRUE ); | 724 | actionUpgrade->setEnabled( TRUE ); |
750 | } | 725 | } |
751 | enableDownload( downloadEnabled ); | 726 | enableDownload( downloadEnabled ); |
752 | 727 | ||
753 | // Display this widget once everything is done | 728 | // Display this widget once everything is done |
754 | if ( doProgress && raiseProgress ) | 729 | if ( doProgress && raiseProgress ) |
755 | { | 730 | { |
756 | stack->raiseWidget( networkPkgWindow ); | 731 | stack->raiseWidget( networkPkgWindow ); |
757 | } | 732 | } |
758 | } | 733 | } |
759 | 734 | ||
760 | void MainWindow :: searchForPackage( const QString &text ) | 735 | void MainWindow :: searchForPackage( const QString &text ) |
761 | { | 736 | { |
762 | if ( !text.isEmpty() ) | 737 | if ( !text.isEmpty() ) |
763 | { | 738 | { |
764 | // cout << "searching for " << text << endl; | 739 | // cout << "searching for " << text << endl; |
765 | // look through package list for text startng at current position | 740 | // look through package list for text startng at current position |
766 | // vector<InstallData> workingPackages; | 741 | // vector<InstallData> workingPackages; |
767 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); | 742 | QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); |
768 | // if ( start != 0 ) | 743 | // if ( start != 0 ) |
769 | // start = (QCheckListItem *)start->nextSibling(); | 744 | // start = (QCheckListItem *)start->nextSibling(); |
770 | 745 | ||
771 | if ( start == 0 ) | 746 | if ( start == 0 ) |
772 | start = (QCheckListItem *)packagesList->firstChild(); | 747 | start = (QCheckListItem *)packagesList->firstChild(); |
773 | 748 | ||
774 | for ( QCheckListItem *item = start; item != 0 ; | 749 | for ( QCheckListItem *item = start; item != 0 ; |
775 | item = (QCheckListItem *)item->nextSibling() ) | 750 | item = (QCheckListItem *)item->nextSibling() ) |
776 | { | 751 | { |
777 | // cout << "checking " << item->text().lower() << endl; | 752 | // cout << "checking " << item->text().lower() << endl; |
778 | if ( item->text().lower().find( text ) != -1 ) | 753 | if ( item->text().lower().find( text ) != -1 ) |
779 | { | 754 | { |
780 | // cout << "matched " << item->text() << endl; | 755 | // cout << "matched " << item->text() << endl; |
781 | packagesList->ensureItemVisible( item ); | 756 | packagesList->ensureItemVisible( item ); |
782 | packagesList->setCurrentItem( item ); | 757 | packagesList->setCurrentItem( item ); |
783 | break; | 758 | break; |
784 | } | 759 | } |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index db06e16..d75e5d2 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -1,138 +1,136 @@ | |||
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 <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | 23 | ||
24 | class DataManager; | 24 | class DataManager; |
25 | class InstallData; | 25 | class InstallData; |
26 | class InstallDlgImpl; | 26 | class InstallDlgImpl; |
27 | 27 | ||
28 | class QAction; | 28 | class QAction; |
29 | class QCheckListItem; | 29 | class QCheckListItem; |
30 | class QComboBox; | 30 | class QComboBox; |
31 | class QLabel; | 31 | class QLabel; |
32 | class QLineEdit; | 32 | class QLineEdit; |
33 | class QListView; | 33 | class QListView; |
34 | class QPEToolBar; | 34 | class QPEToolBar; |
35 | class QProgressBar; | 35 | class QProgressBar; |
36 | class QWidgetStack; | 36 | class QWidgetStack; |
37 | 37 | ||
38 | class MainWindow :public QMainWindow | 38 | class MainWindow :public QMainWindow |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | 42 | ||
43 | MainWindow(); | 43 | MainWindow(); |
44 | ~MainWindow(); | 44 | ~MainWindow(); |
45 | 45 | ||
46 | private: | 46 | private: |
47 | DataManager *mgr; | 47 | DataManager *mgr; |
48 | 48 | ||
49 | QWidgetStack *stack; | 49 | QWidgetStack *stack; |
50 | 50 | ||
51 | QPEToolBar *findBar; | 51 | QPEToolBar *findBar; |
52 | QPEToolBar *jumpBar; | 52 | QPEToolBar *jumpBar; |
53 | QLineEdit *findEdit; | 53 | QLineEdit *findEdit; |
54 | QAction *actionFindNext; | 54 | QAction *actionFindNext; |
55 | QAction *actionFilter; | 55 | QAction *actionFilter; |
56 | QAction *actionUpgrade; | 56 | QAction *actionUpgrade; |
57 | QAction *actionDownload; | 57 | QAction *actionDownload; |
58 | QAction *actionUninstalled; | 58 | QAction *actionUninstalled; |
59 | QAction *actionInstalled; | 59 | QAction *actionInstalled; |
60 | QAction *actionUpdated; | 60 | QAction *actionUpdated; |
61 | 61 | ||
62 | QPixmap iconDownload; | 62 | QPixmap iconDownload; |
63 | QPixmap iconRemove; | 63 | QPixmap iconRemove; |
64 | 64 | ||
65 | int mnuShowUninstalledPkgsId; | 65 | int mnuShowUninstalledPkgsId; |
66 | int mnuShowInstalledPkgsId; | 66 | int mnuShowInstalledPkgsId; |
67 | int mnuShowUpgradedPkgsId; | 67 | int mnuShowUpgradedPkgsId; |
68 | int mnuFilterByCategory; | 68 | int mnuFilterByCategory; |
69 | int mnuSetFilterCategory; | 69 | int mnuSetFilterCategory; |
70 | 70 | ||
71 | // Main package list widget | 71 | // Main package list widget |
72 | QWidget *networkPkgWindow; | 72 | QWidget *networkPkgWindow; |
73 | QComboBox *serversList; | 73 | QComboBox *serversList; |
74 | QListView *packagesList; | 74 | QListView *packagesList; |
75 | QPixmap installedIcon; | 75 | QPixmap installedIcon; |
76 | QPixmap updatedIcon; | 76 | QPixmap updatedIcon; |
77 | QString currentlySelectedServer; | 77 | QString currentlySelectedServer; |
78 | QString categoryFilter; | 78 | QString categoryFilter; |
79 | QString stickyOption; | 79 | QString stickyOption; |
80 | 80 | ||
81 | bool categoryFilterEnabled; | 81 | bool categoryFilterEnabled; |
82 | bool showJumpTo; | 82 | bool showJumpTo; |
83 | bool showUninstalledPkgs; | 83 | bool showUninstalledPkgs; |
84 | bool showInstalledPkgs; | 84 | bool showInstalledPkgs; |
85 | bool showUpgradedPkgs; | 85 | bool showUpgradedPkgs; |
86 | bool downloadEnabled; | 86 | bool downloadEnabled; |
87 | 87 | ||
88 | void initMainWidget(); | 88 | void initMainWidget(); |
89 | void updateData(); | 89 | void updateData(); |
90 | void serverSelected( int index, bool showProgress ); | 90 | void serverSelected( int index, bool showProgress ); |
91 | void searchForPackage( const QString & ); | 91 | void searchForPackage( const QString & ); |
92 | bool filterByCategory( bool val ); | 92 | bool filterByCategory( bool val ); |
93 | void downloadSelectedPackages(); | 93 | void downloadSelectedPackages(); |
94 | void downloadRemotePackage(); | 94 | void downloadRemotePackage(); |
95 | InstallData *dealWithItem( QCheckListItem *item ); | 95 | InstallData *dealWithItem( QCheckListItem *item ); |
96 | 96 | ||
97 | // Progress widget | 97 | // Progress widget |
98 | QWidget *progressWindow; | 98 | QWidget *progressWindow; |
99 | QLabel *m_status; | 99 | QLabel *m_status; |
100 | QProgressBar *m_progress; | 100 | QProgressBar *m_progress; |
101 | 101 | ||
102 | void initProgressWidget(); | 102 | void initProgressWidget(); |
103 | 103 | ||
104 | public slots: | 104 | public slots: |
105 | // void setDocument( const QString &doc ); | 105 | // void setDocument( const QString &doc ); |
106 | void displayHelp(); | ||
107 | void displayFindBar(); | 106 | void displayFindBar(); |
108 | void displayJumpBar(); | 107 | void displayJumpBar(); |
109 | void repeatFind(); | 108 | void repeatFind(); |
110 | void findPackage( const QString & ); | 109 | void findPackage( const QString & ); |
111 | void hideFindBar(); | 110 | void hideFindBar(); |
112 | void hideJumpBar(); | 111 | void hideJumpBar(); |
113 | void displayAbout(); | ||
114 | void displaySettings(); | 112 | void displaySettings(); |
115 | void filterUninstalledPackages(); | 113 | void filterUninstalledPackages(); |
116 | void filterInstalledPackages(); | 114 | void filterInstalledPackages(); |
117 | void filterUpgradedPackages(); | 115 | void filterUpgradedPackages(); |
118 | void filterCategory(); | 116 | void filterCategory(); |
119 | bool setFilterCategory(); | 117 | bool setFilterCategory(); |
120 | void raiseMainWidget(); | 118 | void raiseMainWidget(); |
121 | void raiseProgressWidget(); | 119 | void raiseProgressWidget(); |
122 | void enableUpgrade( bool ); | 120 | void enableUpgrade( bool ); |
123 | void enableDownload( bool ); | 121 | void enableDownload( bool ); |
124 | void reloadData( InstallDlgImpl * ); | 122 | void reloadData( InstallDlgImpl * ); |
125 | 123 | ||
126 | private slots: | 124 | private slots: |
127 | void init(); | 125 | void init(); |
128 | void setProgressSteps( int ); | 126 | void setProgressSteps( int ); |
129 | void setProgressMessage( const QString & ); | 127 | void setProgressMessage( const QString & ); |
130 | void updateProgress( int ); | 128 | void updateProgress( int ); |
131 | void serverSelected( int index ); | 129 | void serverSelected( int index ); |
132 | void updateServer(); | 130 | void updateServer(); |
133 | void upgradePackages(); | 131 | void upgradePackages(); |
134 | void downloadPackage(); | 132 | void downloadPackage(); |
135 | void applyChanges(); | 133 | void applyChanges(); |
136 | void letterPushed( QString t ); | 134 | void letterPushed( QString t ); |
137 | }; | 135 | }; |
138 | #endif | 136 | #endif |