-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 8 | ||||
-rw-r--r-- | noncore/settings/packagemanager/README | 2 | ||||
-rw-r--r-- | noncore/settings/packagemanager/TODO | 14 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 104 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.h | 7 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 29 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opie-packagemanager.control | 4 |
7 files changed, 105 insertions, 63 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index c9e33c4..7799136 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,37 +1,45 @@ | |||
1 | 2004-11-18 Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Released version 0.5.0 | ||
4 | * All v1.0 functionality implemented | ||
5 | * Implemented installation of local packages | ||
6 | * Implemented linking of non-root apps (using ipkg-link) | ||
7 | * Many UI tweaks for installation and filter dialogs | ||
8 | |||
1 | 2004-04-21 Dan Williams <drw@handhelds.org> | 9 | 2004-04-21 Dan Williams <drw@handhelds.org> |
2 | 10 | ||
3 | * Released version 0.4.0 | 11 | * Released version 0.4.0 |
4 | * Added saving of ipkg configuration information | 12 | * Added saving of ipkg configuration information |
5 | * Re-initialize ipkg when configuration information changes | 13 | * Re-initialize ipkg when configuration information changes |
6 | * Added QWhatsThis for all UI controls | 14 | * Added QWhatsThis for all UI controls |
7 | * Remove Location from OConfItem as it is not used/needed | 15 | * Remove Location from OConfItem as it is not used/needed |
8 | * Re-ordered includes to follow Opie standards | 16 | * Re-ordered includes to follow Opie standards |
9 | 17 | ||
10 | 2004-02-13 Dan Williams <drw@handhelds.org> | 18 | 2004-02-13 Dan Williams <drw@handhelds.org> |
11 | 19 | ||
12 | * Released version 0.3.0 | 20 | * Released version 0.3.0 |
13 | * Fix handling of filtering options in View menu | 21 | * Fix handling of filtering options in View menu |
14 | * Do proper version string comparison | 22 | * Do proper version string comparison |
15 | * Fix string alignment code in PromptDlg to eliminate QT warning messages | 23 | * Fix string alignment code in PromptDlg to eliminate QT warning messages |
16 | 24 | ||
17 | 2004-02-12 Dan Williams <drw@handhelds.org> | 25 | 2004-02-12 Dan Williams <drw@handhelds.org> |
18 | 26 | ||
19 | * Package information dialog implemented | 27 | * Package information dialog implemented |
20 | * What's This app icon enabled | 28 | * What's This app icon enabled |
21 | * Changed all QDialog::exec() occurences to QPEApplication::execDialog() | 29 | * Changed all QDialog::exec() occurences to QPEApplication::execDialog() |
22 | 30 | ||
23 | 2004-01-23 Dan Williams <drw@handhelds.org> | 31 | 2004-01-23 Dan Williams <drw@handhelds.org> |
24 | 32 | ||
25 | * Added package download functionality | 33 | * Added package download functionality |
26 | * Have Opie update links after install/removal so that apps | 34 | * Have Opie update links after install/removal so that apps |
27 | will display properly in Launcher | 35 | will display properly in Launcher |
28 | 36 | ||
29 | 2004-01-20 Dan Williams <drw@handhelds.org> | 37 | 2004-01-20 Dan Williams <drw@handhelds.org> |
30 | 38 | ||
31 | * Released version 0.2.0 | 39 | * Released version 0.2.0 |
32 | * Converted to use libipkg in place of spawning ipkg process | 40 | * Converted to use libipkg in place of spawning ipkg process |
33 | 41 | ||
34 | 2004-01-13 Dan Williams <drw@handhelds.org> | 42 | 2004-01-13 Dan Williams <drw@handhelds.org> |
35 | 43 | ||
36 | * Released version 0.1.0 | 44 | * Released version 0.1.0 |
37 | * Initial check-in of new package management client to eventually replace AQPkg | 45 | * Initial check-in of new package management client to eventually replace AQPkg |
diff --git a/noncore/settings/packagemanager/README b/noncore/settings/packagemanager/README index bf93c98..c34a6af 100644 --- a/noncore/settings/packagemanager/README +++ b/noncore/settings/packagemanager/README | |||
@@ -1,55 +1,55 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | /* | 2 | /* |
3 | /* Opie - Package Manager | 3 | /* Opie - Package Manager |
4 | /* ======================== | 4 | /* ======================== |
5 | /* Version 0.4.0 | 5 | /* Version 0.5.0 |
6 | /* | 6 | /* |
7 | /* A package management client for Opie | 7 | /* A package management client for Opie |
8 | /* | 8 | /* |
9 | /************************************************************************ | 9 | /************************************************************************ |
10 | 10 | ||
11 | ------------------------------------------------------- | 11 | ------------------------------------------------------- |
12 | Release Notes for Opie-PackageManager - January, 2004 | 12 | Release Notes for Opie-PackageManager - January, 2004 |
13 | ------------------------------------------------------- | 13 | ------------------------------------------------------- |
14 | 14 | ||
15 | ====================== | 15 | ====================== |
16 | = To-do = | 16 | = To-do = |
17 | ====================== | 17 | ====================== |
18 | 18 | ||
19 | - See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. | 19 | - See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. |
20 | 20 | ||
21 | ====================== | 21 | ====================== |
22 | = Build = | 22 | = Build = |
23 | ====================== | 23 | ====================== |
24 | 24 | ||
25 | In order to build opie-packagemanager, libipkg needs to be present on | 25 | In order to build opie-packagemanager, libipkg needs to be present on |
26 | the build system along with the appropriate headers. | 26 | the build system along with the appropriate headers. |
27 | 27 | ||
28 | - libipkg source (best to use version 109 or greater): | 28 | - libipkg source (best to use version 109 or greater): |
29 | - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') | 29 | - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') |
30 | - FTP: ftp://handhelds.org/linux/packages/ipkg | 30 | - FTP: ftp://handhelds.org/linux/packages/ipkg |
31 | 31 | ||
32 | - before building opie-packagemanager, define the environmental variable | 32 | - before building opie-packagemanager, define the environmental variable |
33 | IPKGDIR to point to the directory containing the ipkg source code | 33 | IPKGDIR to point to the directory containing the ipkg source code |
34 | - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C' | 34 | - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C' |
35 | 35 | ||
36 | ====================== | 36 | ====================== |
37 | = Run = | 37 | = Run = |
38 | ====================== | 38 | ====================== |
39 | 39 | ||
40 | - In order to use opie-packagemanager, libipkg must be installed | 40 | - In order to use opie-packagemanager, libipkg must be installed |
41 | on the system. | 41 | on the system. |
42 | 42 | ||
43 | ====================== | 43 | ====================== |
44 | = Credits = | 44 | = Credits = |
45 | ====================== | 45 | ====================== |
46 | 46 | ||
47 | - Opie-PackageManager is (C) 2003-2004 Dan Williams | 47 | - Opie-PackageManager is (C) 2003-2004 Dan Williams |
48 | 48 | ||
49 | ====================== | 49 | ====================== |
50 | = Links = | 50 | = Links = |
51 | ====================== | 51 | ====================== |
52 | 52 | ||
53 | - Opie Project: http://opie.handhelds.org | 53 | - Opie Project: http://opie.handhelds.org |
54 | - OpenZaurus Project: http://openzaurus.org | 54 | - OpenZaurus Project: http://openzaurus.org |
55 | - Familiar Project: http://familiar.handhelds.org | 55 | - Familiar Project: http://familiar.handhelds.org |
diff --git a/noncore/settings/packagemanager/TODO b/noncore/settings/packagemanager/TODO index 633c589..265beda 100644 --- a/noncore/settings/packagemanager/TODO +++ b/noncore/settings/packagemanager/TODO | |||
@@ -1,27 +1,25 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | /* | 2 | /* |
3 | /* Opie - Package Manager | 3 | /* Opie - Package Manager |
4 | /* ======================== | 4 | /* ======================== |
5 | /* Version 0.4.0 | 5 | /* Version 0.5.0 |
6 | /* | 6 | /* |
7 | /* A package management client for Opie | 7 | /* A package management client for Opie |
8 | /* | 8 | /* |
9 | /************************************************************************ | 9 | /************************************************************************ |
10 | 10 | ||
11 | --------------------------------------------- | 11 | ----------------------------------------------- |
12 | To-do for Opie-PackageManager - April, 2004 | 12 | To-do for Opie-PackageManager - November, 2004 |
13 | --------------------------------------------- | 13 | ----------------------------------------------- |
14 | 14 | ||
15 | ====================== | 15 | ====================== |
16 | = Current release = | 16 | = Current release = |
17 | ====================== | 17 | ====================== |
18 | 18 | ||
19 | 1. Link non-root destination apps | 19 | 1. Re-work package download dialog |
20 | 2. Implement QCOP interface for installing, removing, etc. | ||
21 | 3. Redesign configuration dialog | ||
22 | 20 | ||
23 | ====================== | 21 | ====================== |
24 | = Future releases = | 22 | = Future releases = |
25 | ====================== | 23 | ====================== |
26 | 24 | ||
27 | 1. ??? \ No newline at end of file | 25 | 1. Re-work server and destination tabs in configuration dialog \ No newline at end of file |
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 781f8f5..494603b 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -1,336 +1,372 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "installdlg.h" | 30 | #include "installdlg.h" |
31 | 31 | ||
32 | #include <opie2/ofiledialog.h> | 32 | #include <opie2/ofiledialog.h> |
33 | #include <opie2/oprocess.h> | 33 | #include <opie2/oprocess.h> |
34 | 34 | ||
35 | #include <qpe/fileselector.h> | 35 | #include <qpe/fileselector.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/storage.h> | 37 | #include <qpe/storage.h> |
38 | 38 | ||
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qfileinfo.h> | 41 | #include <qfileinfo.h> |
42 | #include <qgroupbox.h> | 42 | #include <qgroupbox.h> |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qmap.h> | 45 | #include <qmap.h> |
46 | #include <qmultilineedit.h> | 46 | #include <qmultilineedit.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | 48 | ||
49 | #include <sys/vfs.h> | 49 | #include <sys/vfs.h> |
50 | 50 | ||
51 | #include "opackagemanager.h" | 51 | #include "opackagemanager.h" |
52 | 52 | ||
53 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, | 53 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, |
54 | OPackage::Command command1, const QStringList &packages1, | 54 | OPackage::Command command1, const QStringList &packages1, |
55 | OPackage::Command command2, const QStringList &packages2, | 55 | OPackage::Command command2, const QStringList &packages2, |
56 | OPackage::Command command3, const QStringList &packages3 ) | 56 | OPackage::Command command3, const QStringList &packages3 ) |
57 | : QWidget( 0x0 ) | 57 | : QWidget( 0x0 ) |
58 | , m_packman( pm ) | 58 | , m_packman( pm ) |
59 | , m_installFound( false ) | ||
59 | , m_numCommands( 0 ) | 60 | , m_numCommands( 0 ) |
60 | , m_currCommand( 0 ) | 61 | , m_currCommand( 0 ) |
61 | , m_destItem( 0x0 ) | 62 | , m_destItem( 0x0 ) |
62 | { | 63 | { |
63 | // Save command/package list information | 64 | // Save command/package list information |
64 | if ( command1 != OPackage::NotDefined ) | 65 | if ( command1 != OPackage::NotDefined ) |
65 | { | 66 | { |
66 | m_command[ m_numCommands ] = command1; | 67 | m_command[ m_numCommands ] = command1; |
67 | m_packages[ m_numCommands ] = packages1; | 68 | m_packages[ m_numCommands ] = packages1; |
68 | ++m_numCommands; | 69 | ++m_numCommands; |
70 | |||
71 | if ( command1 == OPackage::Install ) | ||
72 | m_installFound = true; | ||
69 | } | 73 | } |
70 | if ( command2 != OPackage::NotDefined ) | 74 | if ( command2 != OPackage::NotDefined ) |
71 | { | 75 | { |
72 | m_command[ m_numCommands ] = command2; | 76 | m_command[ m_numCommands ] = command2; |
73 | m_packages[ m_numCommands ] = packages2; | 77 | m_packages[ m_numCommands ] = packages2; |
74 | ++m_numCommands; | 78 | ++m_numCommands; |
79 | |||
80 | if ( command2 == OPackage::Install ) | ||
81 | m_installFound = true; | ||
75 | } | 82 | } |
76 | if ( command3 != OPackage::NotDefined ) | 83 | if ( command3 != OPackage::NotDefined ) |
77 | { | 84 | { |
78 | m_command[ m_numCommands ] = command3; | 85 | m_command[ m_numCommands ] = command3; |
79 | m_packages[ m_numCommands ] = packages3; | 86 | m_packages[ m_numCommands ] = packages3; |
80 | ++m_numCommands; | 87 | ++m_numCommands; |
88 | |||
89 | if ( command3 == OPackage::Install ) | ||
90 | m_installFound = true; | ||
81 | } | 91 | } |
82 | 92 | ||
83 | // Initialize UI | 93 | // Initialize UI |
84 | if ( parent ) | 94 | if ( parent ) |
85 | parent->setCaption( caption ); | 95 | parent->setCaption( caption ); |
86 | 96 | ||
87 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); | 97 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); |
88 | 98 | ||
89 | if ( showDestInfo ) | 99 | if ( m_installFound ) |
90 | { | 100 | { |
91 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 101 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
92 | layout->addWidget( label, 0, 0 ); | 102 | layout->addWidget( label, 0, 0 ); |
93 | m_destination = new QComboBox( this ); | 103 | m_destination = new QComboBox( this ); |
94 | m_destination->insertStringList( m_packman->destinations() ); | 104 | m_destination->insertStringList( m_packman->destinations() ); |
95 | layout->addWidget( m_destination, 0, 1 ); | 105 | layout->addWidget( m_destination, 0, 1 ); |
96 | connect( m_destination, SIGNAL(highlighted(const QString&)), | 106 | connect( m_destination, SIGNAL(highlighted(const QString&)), |
97 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); | 107 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); |
98 | 108 | ||
99 | label = new QLabel( tr( "Space Avail" ), this ); | 109 | label = new QLabel( tr( "Space Avail" ), this ); |
100 | layout->addWidget( label, 1, 0 ); | 110 | layout->addWidget( label, 1, 0 ); |
101 | m_availSpace = new QLabel( this ); | 111 | m_availSpace = new QLabel( this ); |
102 | layout->addWidget( m_availSpace, 1, 1 ); | 112 | layout->addWidget( m_availSpace, 1, 1 ); |
103 | 113 | ||
104 | // TODO - select correct destination | 114 | // TODO - select correct destination |
105 | slotDisplayAvailSpace( m_destination->currentText() ); | 115 | slotDisplayAvailSpace( m_destination->currentText() ); |
106 | } | 116 | } |
107 | else | 117 | else |
108 | { | 118 | { |
109 | m_destination = 0x0; | 119 | m_destination = 0x0; |
110 | m_availSpace = 0x0; | 120 | m_availSpace = 0x0; |
111 | } | 121 | } |
112 | 122 | ||
113 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 123 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
114 | groupBox->layout()->setSpacing( 0 ); | 124 | groupBox->layout()->setSpacing( 0 ); |
115 | groupBox->layout()->setMargin( 4 ); | 125 | groupBox->layout()->setMargin( 4 ); |
116 | 126 | ||
117 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); | 127 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); |
118 | m_output = new QMultiLineEdit( groupBox ); | 128 | m_output = new QMultiLineEdit( groupBox ); |
119 | m_output->setReadOnly( true ); | 129 | m_output->setReadOnly( true ); |
120 | groupBoxLayout->addWidget( m_output ); | 130 | groupBoxLayout->addWidget( m_output ); |
121 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); | 131 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); |
122 | 132 | ||
123 | m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); | 133 | m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); |
124 | layout->addWidget( m_btnStart, 3, 0 ); | 134 | layout->addWidget( m_btnStart, 3, 0 ); |
125 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); | 135 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); |
126 | 136 | ||
127 | m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); | 137 | m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); |
128 | layout->addWidget( m_btnOptions, 3, 1 ); | 138 | layout->addWidget( m_btnOptions, 3, 1 ); |
129 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); | 139 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); |
130 | 140 | ||
131 | // Display packages being acted upon in output widget | 141 | // Display packages being acted upon in output widget |
132 | for( int i = 0; i < m_numCommands; i++ ) | 142 | for( int i = 0; i < m_numCommands; i++ ) |
133 | { | 143 | { |
134 | if ( !m_packages[ i ].isEmpty() ) | 144 | if ( !m_packages[ i ].isEmpty() ) |
135 | { | 145 | { |
136 | QString lineStr = tr( "Packages to " ); | 146 | QString lineStr = tr( "Packages to " ); |
137 | 147 | ||
138 | switch( m_command[ i ] ) | 148 | switch( m_command[ i ] ) |
139 | { | 149 | { |
140 | case OPackage::Install : lineStr.append( tr( "install" ) ); | 150 | case OPackage::Install : lineStr.append( tr( "install" ) ); |
141 | break; | 151 | break; |
142 | case OPackage::Remove : lineStr.append( tr( "remove" ) ); | 152 | case OPackage::Remove : lineStr.append( tr( "remove" ) ); |
143 | break; | 153 | break; |
144 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); | 154 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); |
145 | break; | 155 | break; |
146 | case OPackage::Download : lineStr.append( tr( "download" ) ); | 156 | case OPackage::Download : lineStr.append( tr( "download" ) ); |
147 | break; | 157 | break; |
148 | default : | 158 | default : |
149 | break; | 159 | break; |
150 | }; | 160 | }; |
151 | lineStr.append( ":\n" ); | 161 | lineStr.append( ":\n" ); |
152 | 162 | ||
153 | QStringList tmpPackage = m_packages[ i ]; | 163 | QStringList tmpPackage = m_packages[ i ]; |
154 | for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) | 164 | for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) |
155 | { | 165 | { |
156 | lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); | 166 | lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); |
157 | } | 167 | } |
158 | 168 | ||
159 | m_output->append( lineStr ); | 169 | m_output->append( lineStr ); |
160 | } | 170 | } |
161 | } | 171 | } |
162 | 172 | ||
163 | m_output->append( tr( "Press the start button to begin.\n" ) ); | 173 | m_output->append( tr( "Press the start button to begin.\n" ) ); |
164 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 174 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
165 | 175 | ||
166 | } | 176 | } |
167 | 177 | ||
168 | void InstallDlg::slotDisplayAvailSpace( const QString &destination ) | 178 | void InstallDlg::slotDisplayAvailSpace( const QString &destination ) |
169 | { | 179 | { |
170 | // If available space is not displayed, exit | 180 | // If available space is not displayed, exit |
171 | if ( !m_availSpace ) | 181 | if ( !m_availSpace ) |
172 | return; | 182 | return; |
173 | 183 | ||
174 | QString space = tr( "Unknown" ); | 184 | QString space = tr( "Unknown" ); |
175 | 185 | ||
176 | // Get destination | 186 | // Get destination |
177 | if ( !destination.isNull() ) | 187 | if ( !destination.isNull() ) |
178 | m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); | 188 | m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); |
179 | 189 | ||
180 | if ( m_destItem ) | 190 | if ( m_destItem ) |
181 | { | 191 | { |
182 | // Calculate available space | 192 | // Calculate available space |
183 | struct statfs fs; | 193 | struct statfs fs; |
184 | if ( !statfs( m_destItem->value(), &fs ) ) | 194 | if ( !statfs( m_destItem->value(), &fs ) ) |
185 | { | 195 | { |
186 | long mult = fs.f_bsize / 1024; | 196 | long mult = fs.f_bsize / 1024; |
187 | long div = 1024 / fs.f_bsize; | 197 | long div = 1024 / fs.f_bsize; |
188 | 198 | ||
189 | if ( !mult ) mult = 1; | 199 | if ( !mult ) mult = 1; |
190 | if ( !div ) div = 1; | 200 | if ( !div ) div = 1; |
191 | long avail = fs.f_bavail * mult / div; | 201 | long avail = fs.f_bavail * mult / div; |
192 | 202 | ||
193 | space = tr( "%1 Kb" ).arg( avail ); | 203 | space = tr( "%1 Kb" ).arg( avail ); |
194 | } | 204 | } |
195 | } | 205 | } |
196 | 206 | ||
197 | // Display available space | 207 | // Display available space |
198 | m_availSpace->setText( space ); | 208 | m_availSpace->setText( space ); |
199 | } | 209 | } |
200 | 210 | ||
201 | void InstallDlg::slotBtnStart() | 211 | void InstallDlg::slotBtnStart() |
202 | { | 212 | { |
203 | QString btnText = m_btnStart->text(); | 213 | QString btnText = m_btnStart->text(); |
204 | if ( btnText == tr( "Abort" ) ) | 214 | if ( btnText == tr( "Abort" ) ) |
205 | { | 215 | { |
206 | // Prevent unexecuted commands from executing | 216 | // Prevent unexecuted commands from executing |
207 | m_currCommand = 999; | 217 | m_currCommand = 999; |
208 | 218 | ||
209 | // Allow user to close dialog | 219 | // Allow user to close dialog |
210 | m_btnStart->setText( tr( "Close" ) ); | 220 | m_btnStart->setText( tr( "Close" ) ); |
211 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 221 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); |
212 | return; | 222 | return; |
213 | } | 223 | } |
214 | else if ( btnText == tr( "Close" ) ) | 224 | else if ( btnText == tr( "Close" ) ) |
215 | { | 225 | { |
216 | // TODO - force reload of package data | 226 | // TODO - force reload of package data |
217 | emit closeInstallDlg(); | 227 | emit closeInstallDlg(); |
218 | return; | 228 | return; |
219 | } | 229 | } |
220 | 230 | ||
221 | // Start was clicked, start executing | 231 | // Start was clicked, start executing |
222 | QString dest; | 232 | QString dest; |
223 | if ( m_destination ) | 233 | if ( m_installFound ) |
224 | { | 234 | { |
225 | dest = m_destination->currentText(); | 235 | dest = m_destination->currentText(); |
226 | m_destination->setEnabled( false ); | 236 | m_destination->setEnabled( false ); |
227 | } | 237 | } |
228 | 238 | ||
229 | m_btnOptions->setEnabled( false ); | 239 | m_btnOptions->setEnabled( false ); |
230 | if ( m_numCommands > 1 ) | 240 | if ( m_numCommands > 1 ) |
231 | { | 241 | { |
232 | m_btnStart->setText( tr( "Abort" ) ); | 242 | m_btnStart->setText( tr( "Abort" ) ); |
233 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | 243 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); |
234 | } | 244 | } |
235 | else | 245 | else |
236 | { | 246 | { |
237 | m_btnStart->setEnabled( false ); | 247 | m_btnStart->setEnabled( false ); |
238 | } | 248 | } |
239 | 249 | ||
250 | Opie::Core::OProcess process( this ); | ||
240 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 251 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
241 | { | 252 | { |
242 | // Execute next command | 253 | // Execute next command |
243 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | 254 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, |
244 | this, SLOT(slotOutput(char*)), true ); | 255 | this, SLOT(slotOutput(char*)), true ); |
256 | |||
257 | // Link/Unlink application if the package was removed from or installed to a destination | ||
258 | // other than root | ||
259 | if ( ( m_command[ m_currCommand ] == OPackage::Install && dest != "root" ) || | ||
260 | ( m_command[ m_currCommand ] == OPackage::Remove ) ) | ||
261 | { | ||
262 | //m_packman->findPackage( m_packages[ m_currCommand ]->destination() != "root"*/ ) | ||
263 | |||
264 | // Loop through all package names in the command group | ||
265 | for ( QStringList::Iterator it = m_packages[ m_currCommand ].begin(); | ||
266 | it != m_packages[ m_currCommand ].end(); | ||
267 | ++it ) | ||
268 | { | ||
269 | OPackage *currPackage = m_packman->findPackage( (*it) ); | ||
270 | |||
271 | // Skip package if it is not found or being removed from 'root' | ||
272 | if ( !currPackage || ( m_command[ m_currCommand ] == OPackage::Remove && | ||
273 | currPackage->destination() == "root" ) ) | ||
274 | continue; | ||
275 | |||
276 | // Display feedback to user | ||
277 | if ( m_command[ m_currCommand ] == OPackage::Install ) | ||
278 | m_output->append( tr( QString( "Running ipkg-link to link package '%1'." ) | ||
279 | .arg( currPackage->name() ) ) ); | ||
280 | else | ||
281 | m_output->append( tr( QString( "Running ipkg-link to remove links for package '%1'." ) | ||
282 | .arg( currPackage->name() ) ) ); | ||
283 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
284 | |||
285 | // Execute ipkg-link | ||
286 | process.clearArguments(); | ||
287 | process << "ipkg-link" | ||
288 | << ( ( m_command[ m_currCommand ] == OPackage::Install ) ? "add" : "remove" ) | ||
289 | << currPackage->name(); | ||
290 | if ( !process.start( Opie::Core::OProcess::Block, | ||
291 | Opie::Core::OProcess::NoCommunication ) ) | ||
292 | { | ||
293 | slotProcessDone( 0x0 ); | ||
294 | m_output->append( tr( "Unable to run ipkg-link." ) ); | ||
295 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
296 | return; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | } | ||
245 | } | 301 | } |
246 | slotProcessDone(0l); | 302 | |
247 | 303 | slotProcessDone( 0x0 ); | |
248 | // Get destination | ||
249 | /* | ||
250 | if ( dest == "root" ) | ||
251 | { | ||
252 | slotProcessDone(0l); | ||
253 | return; | ||
254 | } | ||
255 | |||
256 | m_destItem = m_packman->findConfItem( OConfItem::Destination, dest ); | ||
257 | if ( m_destItem ) | ||
258 | { | ||
259 | QString path = m_destItem->value(); | ||
260 | Opie::Core::OProcess *process = new Opie::Core::OProcess( this, "ipkg-link process" ); | ||
261 | connect( process, SIGNAL(processExited(Opie::Core::OProcess*)), | ||
262 | this, SLOT(slotProcessDone(Opie::Core::OProcess*)) ); | ||
263 | |||
264 | *process << "ipkg-link" << "mount" << path; | ||
265 | if ( !process->start( Opie::Core::OProcess::NotifyOnExit, | ||
266 | Opie::Core::OProcess::NoCommunication ) ) | ||
267 | slotProcessDone( 0l ); | ||
268 | m_output->append( tr( "Starting ipkg-link to link installed applications." ) ); | ||
269 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
270 | } | ||
271 | */ | ||
272 | } | 304 | } |
273 | 305 | ||
274 | void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc ) | 306 | void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc ) |
275 | { | 307 | { |
276 | delete proc; | 308 | if ( proc ) |
277 | 309 | { | |
278 | m_output->append( tr( "The package linking is done." ) ); | 310 | // Display message pnly if linking was done |
279 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 311 | m_output->append( tr( "The package linking is done." ) ); |
280 | 312 | m_output->setCursorPosition( m_output->numLines(), 0 ); | |
313 | |||
314 | delete proc; | ||
315 | } | ||
316 | |||
281 | // All commands executed, allow user to close dialog | 317 | // All commands executed, allow user to close dialog |
282 | m_btnStart->setEnabled( true ); | 318 | m_btnStart->setEnabled( true ); |
283 | m_btnStart->setText( tr( "Close" ) ); | 319 | m_btnStart->setText( tr( "Close" ) ); |
284 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 320 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); |
285 | 321 | ||
286 | m_btnOptions->setEnabled( true ); | 322 | m_btnOptions->setEnabled( true ); |
287 | m_btnOptions->setText( tr( "Save output" ) ); | 323 | m_btnOptions->setText( tr( "Save output" ) ); |
288 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); | 324 | m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); |
289 | } | 325 | } |
290 | 326 | ||
291 | void InstallDlg::slotBtnOptions() | 327 | void InstallDlg::slotBtnOptions() |
292 | { | 328 | { |
293 | QString btnText = m_btnOptions->text(); | 329 | QString btnText = m_btnOptions->text(); |
294 | if ( btnText == tr( "Options" ) ) | 330 | if ( btnText == tr( "Options" ) ) |
295 | { | 331 | { |
296 | // Display configuration dialog (only options tab is enabled) | 332 | // Display configuration dialog (only options tab is enabled) |
297 | m_packman->configureDlg( true ); | 333 | m_packman->configureDlg( true ); |
298 | return; | 334 | return; |
299 | } | 335 | } |
300 | 336 | ||
301 | // Save output was clicked | 337 | // Save output was clicked |
302 | QMap<QString, QStringList> map; | 338 | QMap<QString, QStringList> map; |
303 | map.insert( tr( "All" ), QStringList() ); | 339 | map.insert( tr( "All" ), QStringList() ); |
304 | QStringList text; | 340 | QStringList text; |
305 | text << "text/*"; | 341 | text << "text/*"; |
306 | map.insert(tr( "Text" ), text ); | 342 | map.insert(tr( "Text" ), text ); |
307 | text << "*"; | 343 | text << "*"; |
308 | map.insert( tr( "All" ), text ); | 344 | map.insert( tr( "All" ), text ); |
309 | 345 | ||
310 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 346 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
311 | if( !filename.isEmpty() ) | 347 | if( !filename.isEmpty() ) |
312 | { | 348 | { |
313 | QString currentFileName = QFileInfo( filename ).fileName(); | 349 | QString currentFileName = QFileInfo( filename ).fileName(); |
314 | DocLnk doc; | 350 | DocLnk doc; |
315 | doc.setType( "text/plain" ); | 351 | doc.setType( "text/plain" ); |
316 | doc.setFile( filename ); | 352 | doc.setFile( filename ); |
317 | doc.setName( currentFileName ); | 353 | doc.setName( currentFileName ); |
318 | FileManager fm; | 354 | FileManager fm; |
319 | fm.saveFile( doc, m_output->text() ); | 355 | fm.saveFile( doc, m_output->text() ); |
320 | } | 356 | } |
321 | } | 357 | } |
322 | 358 | ||
323 | void InstallDlg::slotOutput( char *msg ) | 359 | void InstallDlg::slotOutput( char *msg ) |
324 | { | 360 | { |
325 | // Allow processing of other events | 361 | // Allow processing of other events |
326 | qApp->processEvents(); | 362 | qApp->processEvents(); |
327 | 363 | ||
328 | QString lineStr = msg; | 364 | QString lineStr = msg; |
329 | if ( lineStr[lineStr.length()-1] == '\n' ) | 365 | if ( lineStr[lineStr.length()-1] == '\n' ) |
330 | lineStr.truncate( lineStr.length() - 1 ); | 366 | lineStr.truncate( lineStr.length() - 1 ); |
331 | m_output->append( lineStr ); | 367 | m_output->append( lineStr ); |
332 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 368 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
333 | 369 | ||
334 | // Update available space | 370 | // Update available space |
335 | slotDisplayAvailSpace( QString::null ); | 371 | slotDisplayAvailSpace( QString::null ); |
336 | } | 372 | } |
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h index f45c17c..eabb717 100644 --- a/noncore/settings/packagemanager/installdlg.h +++ b/noncore/settings/packagemanager/installdlg.h | |||
@@ -1,98 +1,101 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef INSTALLDLG_H | 30 | #ifndef INSTALLDLG_H |
31 | #define INSTALLDLG_H | 31 | #define INSTALLDLG_H |
32 | 32 | ||
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | 34 | ||
35 | #include "opackage.h" | 35 | #include "opackage.h" |
36 | 36 | ||
37 | class QComboBox; | 37 | class QComboBox; |
38 | class QLabel; | 38 | class QLabel; |
39 | class QMultiLineEdit; | 39 | class QMultiLineEdit; |
40 | class QPushButton; | 40 | class QPushButton; |
41 | 41 | ||
42 | class OConfItem; | 42 | class OConfItem; |
43 | class OPackageManager; | 43 | class OPackageManager; |
44 | 44 | ||
45 | namespace Opie | 45 | namespace Opie |
46 | { | 46 | { |
47 | namespace Core | 47 | namespace Core |
48 | { | 48 | { |
49 | class OProcess; | 49 | class OProcess; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | 52 | ||
53 | class InstallDlg : public QWidget | 53 | class InstallDlg : public QWidget |
54 | { | 54 | { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | 56 | ||
57 | public: | 57 | public: |
58 | InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null, | 58 | InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, |
59 | bool showDestInfo = true, | 59 | const QString &caption = QString::null, |
60 | OPackage::Command command1 = OPackage::NotDefined, | 60 | OPackage::Command command1 = OPackage::NotDefined, |
61 | const QStringList &packages1 = QStringList(), | 61 | const QStringList &packages1 = QStringList(), |
62 | OPackage::Command command2 = OPackage::NotDefined, | 62 | OPackage::Command command2 = OPackage::NotDefined, |
63 | const QStringList &packages2 = QStringList(), | 63 | const QStringList &packages2 = QStringList(), |
64 | OPackage::Command command3 = OPackage::NotDefined, | 64 | OPackage::Command command3 = OPackage::NotDefined, |
65 | const QStringList &packages3 = QStringList() ); | 65 | const QStringList &packages3 = QStringList() ); |
66 | 66 | ||
67 | private: | 67 | private: |
68 | OPackageManager *m_packman; // Pointer to application instance of package manager | 68 | OPackageManager *m_packman; // Pointer to application instance of package manager |
69 | |||
70 | bool m_installFound; // Indicates if an install is being done, controls display of | ||
71 | // destination selection, available space | ||
69 | 72 | ||
70 | // UI controls | 73 | // UI controls |
71 | QComboBox *m_destination; // Destination selection list | 74 | QComboBox *m_destination; // Destination selection list |
72 | QLabel *m_availSpace; // Text label to display available space on selected destination | 75 | QLabel *m_availSpace; // Text label to display available space on selected destination |
73 | QMultiLineEdit *m_output; // Multi-line edit to display status | 76 | QMultiLineEdit *m_output; // Multi-line edit to display status |
74 | QPushButton *m_btnStart; // Start/abort/close button | 77 | QPushButton *m_btnStart; // Start/abort/close button |
75 | QPushButton *m_btnOptions; // Installation options button | 78 | QPushButton *m_btnOptions; // Installation options button |
76 | 79 | ||
77 | // Commands and packages to execute | 80 | // Commands and packages to execute |
78 | int m_numCommands; // Number of commands to be executed | 81 | int m_numCommands; // Number of commands to be executed |
79 | int m_currCommand; // Number of currently executing command | 82 | int m_currCommand; // Number of currently executing command |
80 | OPackage::Command m_command[3]; // List of commands to be executed | 83 | OPackage::Command m_command[3]; // List of commands to be executed |
81 | QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) | 84 | QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) |
82 | OConfItem *m_destItem; // Pointer to destination for package installation | 85 | OConfItem *m_destItem; // Pointer to destination for package installation |
83 | 86 | ||
84 | private slots: | 87 | private slots: |
85 | // UI control slots | 88 | // UI control slots |
86 | void slotDisplayAvailSpace( const QString &destination ); | 89 | void slotDisplayAvailSpace( const QString &destination ); |
87 | void slotBtnStart(); | 90 | void slotBtnStart(); |
88 | void slotBtnOptions(); | 91 | void slotBtnOptions(); |
89 | void slotProcessDone( Opie::Core::OProcess *proc ); | 92 | void slotProcessDone( Opie::Core::OProcess *proc ); |
90 | 93 | ||
91 | // Execution slots | 94 | // Execution slots |
92 | void slotOutput( char *msg ); | 95 | void slotOutput( char *msg ); |
93 | 96 | ||
94 | signals: | 97 | signals: |
95 | void closeInstallDlg(); | 98 | void closeInstallDlg(); |
96 | }; | 99 | }; |
97 | 100 | ||
98 | #endif | 101 | #endif |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 459a75b..8a5b90c 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -187,476 +187,473 @@ void MainWindow::initUI() | |||
187 | a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); | 187 | a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); |
188 | a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); | 188 | a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); |
189 | connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); | 189 | connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); |
190 | a->addTo( popup ); | 190 | a->addTo( popup ); |
191 | //a->addTo( &m_toolBar ); | 191 | //a->addTo( &m_toolBar ); |
192 | 192 | ||
193 | popup->insertSeparator(); | 193 | popup->insertSeparator(); |
194 | 194 | ||
195 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 195 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
196 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); | 196 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); |
197 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 197 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
198 | a->addTo( popup ); | 198 | a->addTo( popup ); |
199 | mb->insertItem( tr( "Actions" ), popup ); | 199 | mb->insertItem( tr( "Actions" ), popup ); |
200 | 200 | ||
201 | // View menu | 201 | // View menu |
202 | popup = new QPopupMenu( this ); | 202 | popup = new QPopupMenu( this ); |
203 | 203 | ||
204 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 204 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
205 | m_actionShowNotInstalled->setToggleAction( true ); | 205 | m_actionShowNotInstalled->setToggleAction( true ); |
206 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); | 206 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); |
207 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); | 207 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); |
208 | m_actionShowNotInstalled->addTo( popup ); | 208 | m_actionShowNotInstalled->addTo( popup ); |
209 | 209 | ||
210 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 210 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
211 | m_actionShowInstalled->setToggleAction( true ); | 211 | m_actionShowInstalled->setToggleAction( true ); |
212 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); | 212 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); |
213 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); | 213 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); |
214 | m_actionShowInstalled->addTo( popup ); | 214 | m_actionShowInstalled->addTo( popup ); |
215 | 215 | ||
216 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 216 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
217 | m_actionShowUpdated->setToggleAction( true ); | 217 | m_actionShowUpdated->setToggleAction( true ); |
218 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); | 218 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); |
219 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); | 219 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); |
220 | m_actionShowUpdated->addTo( popup ); | 220 | m_actionShowUpdated->addTo( popup ); |
221 | 221 | ||
222 | popup->insertSeparator(); | 222 | popup->insertSeparator(); |
223 | 223 | ||
224 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 224 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), |
225 | QString::null, 0, this, 0 ); | 225 | QString::null, 0, this, 0 ); |
226 | m_actionFilter->setToggleAction( true ); | 226 | m_actionFilter->setToggleAction( true ); |
227 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); | 227 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); |
228 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 228 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
229 | m_actionFilter->addTo( popup ); | 229 | m_actionFilter->addTo( popup ); |
230 | 230 | ||
231 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); | 231 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); |
232 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); | 232 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); |
233 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | 233 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); |
234 | a->addTo( popup ); | 234 | a->addTo( popup ); |
235 | 235 | ||
236 | popup->insertSeparator(); | 236 | popup->insertSeparator(); |
237 | 237 | ||
238 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 238 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
239 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); | 239 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); |
240 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); | 240 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); |
241 | a->addTo( popup ); | 241 | a->addTo( popup ); |
242 | 242 | ||
243 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 243 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
244 | m_actionFindNext->setEnabled( false ); | 244 | m_actionFindNext->setEnabled( false ); |
245 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); | 245 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); |
246 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); | 246 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); |
247 | m_actionFindNext->addTo( popup ); | 247 | m_actionFindNext->addTo( popup ); |
248 | m_actionFindNext->addTo( &m_findBar ); | 248 | m_actionFindNext->addTo( &m_findBar ); |
249 | 249 | ||
250 | mb->insertItem( tr( "View" ), popup ); | 250 | mb->insertItem( tr( "View" ), popup ); |
251 | 251 | ||
252 | // Finish find toolbar creation | 252 | // Finish find toolbar creation |
253 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 253 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
254 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); | 254 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); |
255 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); | 255 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); |
256 | a->addTo( &m_findBar ); | 256 | a->addTo( &m_findBar ); |
257 | m_findBar.hide(); | 257 | m_findBar.hide(); |
258 | } | 258 | } |
259 | 259 | ||
260 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | 260 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) |
261 | { | 261 | { |
262 | if ( clearList ) | 262 | if ( clearList ) |
263 | m_packageList.clear(); | 263 | m_packageList.clear(); |
264 | 264 | ||
265 | if ( packages ) | 265 | if ( packages ) |
266 | { | 266 | { |
267 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) | 267 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) |
268 | { | 268 | { |
269 | OPackage *package = packageIt.current(); | 269 | OPackage *package = packageIt.current(); |
270 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), | 270 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), |
271 | QCheckListItem::CheckBox ); | 271 | QCheckListItem::CheckBox ); |
272 | m_packageList.insertItem( item ); | 272 | m_packageList.insertItem( item ); |
273 | 273 | ||
274 | // If a different version of package is available, show update available icon | 274 | // If a different version of package is available, show update available icon |
275 | // Otherwise, show installed icon | 275 | // Otherwise, show installed icon |
276 | if ( !package->versionInstalled().isNull() ) | 276 | if ( !package->versionInstalled().isNull() ) |
277 | { | 277 | { |
278 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 278 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
279 | item->setPixmap( 0, m_iconUpdated ); | 279 | item->setPixmap( 0, m_iconUpdated ); |
280 | else | 280 | else |
281 | item->setPixmap( 0, m_iconInstalled ); | 281 | item->setPixmap( 0, m_iconInstalled ); |
282 | } | 282 | } |
283 | else | 283 | else |
284 | item->setPixmap( 0, m_iconNull ); | 284 | item->setPixmap( 0, m_iconNull ); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | void MainWindow::searchForPackage( const QString &text ) | 289 | void MainWindow::searchForPackage( const QString &text ) |
290 | { | 290 | { |
291 | if ( !text.isEmpty() ) | 291 | if ( !text.isEmpty() ) |
292 | { | 292 | { |
293 | // look through package list for text startng at current position | 293 | // look through package list for text startng at current position |
294 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); | 294 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); |
295 | if ( start == 0 ) | 295 | if ( start == 0 ) |
296 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 296 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
297 | 297 | ||
298 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; | 298 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; |
299 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; | 299 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; |
300 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 300 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
301 | { | 301 | { |
302 | if ( item->text().lower().find( text ) != -1 ) | 302 | if ( item->text().lower().find( text ) != -1 ) |
303 | { | 303 | { |
304 | m_packageList.ensureItemVisible( item ); | 304 | m_packageList.ensureItemVisible( item ); |
305 | m_packageList.setCurrentItem( item ); | 305 | m_packageList.setCurrentItem( item ); |
306 | break; | 306 | break; |
307 | } | 307 | } |
308 | } | 308 | } |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | void MainWindow::installLocalPackage( const QString &ipkFile ) | 312 | void MainWindow::installLocalPackage( const QString &ipkFile ) |
313 | { | 313 | { |
314 | // Install selected file | 314 | // Install selected file |
315 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, | 315 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), |
316 | OPackage::Install, ipkFile ); | 316 | OPackage::Install, ipkFile ); |
317 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 317 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
318 | 318 | ||
319 | // Display widget | 319 | // Display widget |
320 | m_widgetStack.addWidget( dlg, 3 ); | 320 | m_widgetStack.addWidget( dlg, 3 ); |
321 | m_widgetStack.raiseWidget( dlg ); | 321 | m_widgetStack.raiseWidget( dlg ); |
322 | } | 322 | } |
323 | 323 | ||
324 | void MainWindow::setDocument( const QString &ipkFile ) | 324 | void MainWindow::setDocument( const QString &ipkFile ) |
325 | { | 325 | { |
326 | QString file = ipkFile; | 326 | QString file = ipkFile; |
327 | DocLnk lnk( ipkFile ); | 327 | DocLnk lnk( ipkFile ); |
328 | if ( lnk.isValid() ) | 328 | if ( lnk.isValid() ) |
329 | file = lnk.file(); | 329 | file = lnk.file(); |
330 | 330 | ||
331 | installLocalPackage( file ); | 331 | installLocalPackage( file ); |
332 | } | 332 | } |
333 | 333 | ||
334 | void MainWindow::initPackageInfo() | 334 | void MainWindow::initPackageInfo() |
335 | { | 335 | { |
336 | m_widgetStack.raiseWidget( &m_statusWidget ); | 336 | m_widgetStack.raiseWidget( &m_statusWidget ); |
337 | 337 | ||
338 | // Load package list | 338 | // Load package list |
339 | m_packman.loadAvailablePackages(); | 339 | m_packman.loadAvailablePackages(); |
340 | m_packman.loadInstalledPackages(); | 340 | m_packman.loadInstalledPackages(); |
341 | 341 | ||
342 | OPackageList *packageList = m_packman.packages(); | 342 | OPackageList *packageList = m_packman.packages(); |
343 | if ( packageList ) | 343 | if ( packageList ) |
344 | { | 344 | { |
345 | loadPackageList( packageList, true ); | 345 | loadPackageList( packageList, true ); |
346 | delete packageList; | 346 | delete packageList; |
347 | } | 347 | } |
348 | 348 | ||
349 | QWidget *widget = m_widgetStack.widget( 3 ); | 349 | QWidget *widget = m_widgetStack.widget( 3 ); |
350 | if ( !widget ) | 350 | if ( !widget ) |
351 | widget = &m_packageList; | 351 | widget = &m_packageList; |
352 | m_widgetStack.raiseWidget( widget ); | 352 | m_widgetStack.raiseWidget( widget ); |
353 | } | 353 | } |
354 | 354 | ||
355 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 355 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
356 | { | 356 | { |
357 | if ( widget == &m_packageList ) | 357 | if ( widget == &m_packageList ) |
358 | { | 358 | { |
359 | setCaption( tr( "Package Manager" ) ); | 359 | setCaption( tr( "Package Manager" ) ); |
360 | 360 | ||
361 | m_menuBar.show(); | 361 | m_menuBar.show(); |
362 | m_toolBar.show(); | 362 | m_toolBar.show(); |
363 | } | 363 | } |
364 | else | 364 | else |
365 | { | 365 | { |
366 | m_menuBar.hide(); | 366 | m_menuBar.hide(); |
367 | m_toolBar.hide(); | 367 | m_toolBar.hide(); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | void MainWindow::slotInitStatusBar( int numSteps ) | 371 | void MainWindow::slotInitStatusBar( int numSteps ) |
372 | { | 372 | { |
373 | m_statusBar.setTotalSteps( numSteps ); | 373 | m_statusBar.setTotalSteps( numSteps ); |
374 | } | 374 | } |
375 | 375 | ||
376 | void MainWindow::slotStatusText( const QString &status ) | 376 | void MainWindow::slotStatusText( const QString &status ) |
377 | { | 377 | { |
378 | m_statusText.setText( status ); | 378 | m_statusText.setText( status ); |
379 | } | 379 | } |
380 | 380 | ||
381 | void MainWindow::slotStatusBar( int currStep ) | 381 | void MainWindow::slotStatusBar( int currStep ) |
382 | { | 382 | { |
383 | m_statusBar.setProgress( currStep ); | 383 | m_statusBar.setProgress( currStep ); |
384 | } | 384 | } |
385 | 385 | ||
386 | void MainWindow::slotUpdate() | 386 | void MainWindow::slotUpdate() |
387 | { | 387 | { |
388 | // Create package manager output widget | 388 | // Create package manager output widget |
389 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, | 389 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), |
390 | OPackage::Update ); | 390 | OPackage::Update ); |
391 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 391 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
392 | 392 | ||
393 | // Display widget | 393 | // Display widget |
394 | m_widgetStack.addWidget( dlg, 3 ); | 394 | m_widgetStack.addWidget( dlg, 3 ); |
395 | m_widgetStack.raiseWidget( dlg ); | 395 | m_widgetStack.raiseWidget( dlg ); |
396 | } | 396 | } |
397 | 397 | ||
398 | void MainWindow::slotUpgrade() | 398 | void MainWindow::slotUpgrade() |
399 | { | 399 | { |
400 | // Create package manager output widget | 400 | // Create package manager output widget |
401 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, | 401 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), |
402 | OPackage::Upgrade ); | 402 | OPackage::Upgrade ); |
403 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 403 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
404 | 404 | ||
405 | // Display widget | 405 | // Display widget |
406 | m_widgetStack.addWidget( dlg, 3 ); | 406 | m_widgetStack.addWidget( dlg, 3 ); |
407 | m_widgetStack.raiseWidget( dlg ); | 407 | m_widgetStack.raiseWidget( dlg ); |
408 | } | 408 | } |
409 | 409 | ||
410 | void MainWindow::slotDownload() | 410 | void MainWindow::slotDownload() |
411 | { | 411 | { |
412 | // Retrieve list of packages selected for download (if any) | 412 | // Retrieve list of packages selected for download (if any) |
413 | QStringList workingPackages; | 413 | QStringList workingPackages; |
414 | 414 | ||
415 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 415 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
416 | item != 0 ; | 416 | item != 0 ; |
417 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 417 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
418 | { | 418 | { |
419 | if ( item->isOn() ) | 419 | if ( item->isOn() ) |
420 | workingPackages.append( item->text() ); | 420 | workingPackages.append( item->text() ); |
421 | } | 421 | } |
422 | 422 | ||
423 | if ( workingPackages.isEmpty() ) | 423 | if ( workingPackages.isEmpty() ) |
424 | { | 424 | { |
425 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 425 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
426 | return; | 426 | return; |
427 | } | 427 | } |
428 | else | 428 | else |
429 | { | 429 | { |
430 | // Download selected packages | 430 | // Download selected packages |
431 | m_config.setGroup( "settings" ); | 431 | m_config.setGroup( "settings" ); |
432 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); | 432 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); |
433 | 433 | ||
434 | bool ok = false; | 434 | bool ok = false; |
435 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); | 435 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); |
436 | if ( ok && !text.isEmpty() ) | 436 | if ( ok && !text.isEmpty() ) |
437 | workingDir = text; // user entered something and pressed ok | 437 | workingDir = text; // user entered something and pressed ok |
438 | else | 438 | else |
439 | return; // user entered nothing or pressed cancel | 439 | return; // user entered nothing or pressed cancel |
440 | 440 | ||
441 | // Store download directory in config file | 441 | // Store download directory in config file |
442 | m_config.writeEntry( "DownloadDir", workingDir ); | 442 | m_config.writeEntry( "DownloadDir", workingDir ); |
443 | 443 | ||
444 | // Get starting directory | 444 | // Get starting directory |
445 | QDir::setCurrent( workingDir ); | 445 | QDir::setCurrent( workingDir ); |
446 | 446 | ||
447 | // Create package manager output widget | 447 | // Create package manager output widget |
448 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, | 448 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), |
449 | OPackage::Download, workingPackages ); | 449 | OPackage::Download, workingPackages ); |
450 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 450 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
451 | 451 | ||
452 | // Display widget | 452 | // Display widget |
453 | m_widgetStack.addWidget( dlg, 3 ); | 453 | m_widgetStack.addWidget( dlg, 3 ); |
454 | m_widgetStack.raiseWidget( dlg ); | 454 | m_widgetStack.raiseWidget( dlg ); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | 457 | ||
458 | void MainWindow::slotApply() | 458 | void MainWindow::slotApply() |
459 | { | 459 | { |
460 | QStringList removeList; | 460 | QStringList removeList; |
461 | QStringList installList; | 461 | QStringList installList; |
462 | QStringList upgradeList; | 462 | QStringList upgradeList; |
463 | 463 | ||
464 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 464 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
465 | item != 0 ; | 465 | item != 0 ; |
466 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 466 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
467 | { | 467 | { |
468 | if ( item->isOn() ) | 468 | if ( item->isOn() ) |
469 | { | 469 | { |
470 | OPackage *package = m_packman.findPackage( item->text() ); | 470 | OPackage *package = m_packman.findPackage( item->text() ); |
471 | if ( package ) | 471 | if ( package ) |
472 | { | 472 | { |
473 | if ( !package->versionInstalled().isNull() ) | 473 | if ( !package->versionInstalled().isNull() ) |
474 | { | 474 | { |
475 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 475 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
476 | { | 476 | { |
477 | // Remove/upgrade package | 477 | // Remove/upgrade package |
478 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), | 478 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), |
479 | tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), | 479 | tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), |
480 | tr( "Remove" ), tr( "Upgrade" ), this ); | 480 | tr( "Remove" ), tr( "Upgrade" ), this ); |
481 | if ( answer == 1 ) // Remove | 481 | if ( answer == 1 ) // Remove |
482 | { | 482 | { |
483 | removeList.append( item->text() ); | 483 | removeList.append( item->text() ); |
484 | } | 484 | } |
485 | else if ( answer == 2 ) // Upgrade | 485 | else if ( answer == 2 ) // Upgrade |
486 | { | 486 | { |
487 | upgradeList.append( item->text() ); | 487 | upgradeList.append( item->text() ); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | else | 490 | else |
491 | { | 491 | { |
492 | // Remove/reinstall package | 492 | // Remove/reinstall package |
493 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), | 493 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), |
494 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), | 494 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), |
495 | tr( "Remove" ), tr( "Reinstall" ), this ); | 495 | tr( "Remove" ), tr( "Reinstall" ), this ); |
496 | if ( answer == 1 ) // Remove | 496 | if ( answer == 1 ) // Remove |
497 | { | 497 | { |
498 | removeList.append( item->text() ); | 498 | removeList.append( item->text() ); |
499 | } | 499 | } |
500 | else if ( answer == 2 ) // Reinstall | 500 | else if ( answer == 2 ) // Reinstall |
501 | { | 501 | { |
502 | installList.append( item->text() ); | 502 | installList.append( item->text() ); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | } | 505 | } |
506 | else | 506 | else |
507 | { | 507 | { |
508 | // Install package | 508 | // Install package |
509 | installList.append( item->text() ); | 509 | installList.append( item->text() ); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | } | 512 | } |
513 | } | 513 | } |
514 | 514 | ||
515 | // If nothing is selected, display message and exit | 515 | // If nothing is selected, display message and exit |
516 | if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) | 516 | if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) |
517 | { | 517 | { |
518 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 518 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
519 | return; | 519 | return; |
520 | } | 520 | } |
521 | 521 | ||
522 | // Send command only if there are packages to process | 522 | // Send command only if there are packages to process |
523 | OPackage::Command removeCmd = OPackage::NotDefined; | 523 | OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove |
524 | if ( !removeList.isEmpty() ) | 524 | : OPackage::NotDefined; |
525 | removeCmd = OPackage::Remove; | 525 | OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install |
526 | OPackage::Command installCmd = OPackage::NotDefined; | 526 | : OPackage::NotDefined; |
527 | if ( !installList.isEmpty() ) | 527 | OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade |
528 | installCmd = OPackage::Install; | 528 | : OPackage::NotDefined; |
529 | OPackage::Command upgradeCmd = OPackage::NotDefined; | ||
530 | if ( !upgradeList.isEmpty() ) | ||
531 | upgradeCmd = OPackage::Upgrade; | ||
532 | 529 | ||
533 | // Create package manager output widget | 530 | // Create package manager output widget |
534 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), !installList.isEmpty(), | 531 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), |
535 | removeCmd, removeList, | 532 | removeCmd, removeList, |
536 | installCmd, installList, | 533 | installCmd, installList, |
537 | upgradeCmd, upgradeList ); | 534 | upgradeCmd, upgradeList ); |
538 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 535 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
539 | 536 | ||
540 | // Display widget | 537 | // Display widget |
541 | m_widgetStack.addWidget( dlg, 3 ); | 538 | m_widgetStack.addWidget( dlg, 3 ); |
542 | m_widgetStack.raiseWidget( dlg ); | 539 | m_widgetStack.raiseWidget( dlg ); |
543 | } | 540 | } |
544 | 541 | ||
545 | void MainWindow::slotInstallLocal() | 542 | void MainWindow::slotInstallLocal() |
546 | { | 543 | { |
547 | // Display file open dialog with only package files | 544 | // Display file open dialog with only package files |
548 | MimeTypes type; | 545 | MimeTypes type; |
549 | QStringList packages; | 546 | QStringList packages; |
550 | packages << "application/ipkg"; | 547 | packages << "application/ipkg"; |
551 | type.insert( tr( "Application Packages" ), packages ); | 548 | type.insert( tr( "Application Packages" ), packages ); |
552 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, | 549 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, |
553 | "/", QString::null, type ); | 550 | "/", QString::null, type ); |
554 | if ( !package.isNull() ) | 551 | if ( !package.isNull() ) |
555 | installLocalPackage( package ); | 552 | installLocalPackage( package ); |
556 | } | 553 | } |
557 | 554 | ||
558 | void MainWindow::slotCloseDlg() | 555 | void MainWindow::slotCloseDlg() |
559 | { | 556 | { |
560 | // Close install dialog | 557 | // Close install dialog |
561 | delete m_widgetStack.visibleWidget(); | 558 | delete m_widgetStack.visibleWidget(); |
562 | 559 | ||
563 | // Reload package list | 560 | // Reload package list |
564 | initPackageInfo(); | 561 | initPackageInfo(); |
565 | 562 | ||
566 | // Update Opie launcher links | 563 | // Update Opie launcher links |
567 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 564 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
568 | QString lf = QString::null; | 565 | QString lf = QString::null; |
569 | e << lf; | 566 | e << lf; |
570 | 567 | ||
571 | // Reapply any filters previously set | 568 | // Reapply any filters previously set |
572 | if ( m_actionShowNotInstalled->isOn() ) | 569 | if ( m_actionShowNotInstalled->isOn() ) |
573 | slotShowNotInstalled(); | 570 | slotShowNotInstalled(); |
574 | else if ( m_actionShowInstalled->isOn() ) | 571 | else if ( m_actionShowInstalled->isOn() ) |
575 | slotShowInstalled(); | 572 | slotShowInstalled(); |
576 | else if ( m_actionShowUpdated->isOn() ) | 573 | else if ( m_actionShowUpdated->isOn() ) |
577 | slotShowUpdated(); | 574 | slotShowUpdated(); |
578 | else if ( m_actionFilter->isOn() ) | 575 | else if ( m_actionFilter->isOn() ) |
579 | slotFilter( true ); | 576 | slotFilter( true ); |
580 | } | 577 | } |
581 | 578 | ||
582 | void MainWindow::slotConfigure() | 579 | void MainWindow::slotConfigure() |
583 | { | 580 | { |
584 | if ( m_packman.configureDlg( false ) ) | 581 | if ( m_packman.configureDlg( false ) ) |
585 | { | 582 | { |
586 | if ( PromptDlg::ask( tr( "Config updated" ), | 583 | if ( PromptDlg::ask( tr( "Config updated" ), |
587 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), | 584 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), |
588 | tr( "Yes" ), tr( "No" ), this ) == 1 ) | 585 | tr( "Yes" ), tr( "No" ), this ) == 1 ) |
589 | { | 586 | { |
590 | // Update package list and reload package info | 587 | // Update package list and reload package info |
591 | slotUpdate(); | 588 | slotUpdate(); |
592 | } | 589 | } |
593 | } | 590 | } |
594 | } | 591 | } |
595 | 592 | ||
596 | void MainWindow::slotShowNotInstalled() | 593 | void MainWindow::slotShowNotInstalled() |
597 | { | 594 | { |
598 | OPackageList *packageList; | 595 | OPackageList *packageList; |
599 | if ( m_actionShowNotInstalled->isOn() ) | 596 | if ( m_actionShowNotInstalled->isOn() ) |
600 | { | 597 | { |
601 | m_actionShowInstalled->setOn( false ); | 598 | m_actionShowInstalled->setOn( false ); |
602 | m_actionShowUpdated->setOn( false ); | 599 | m_actionShowUpdated->setOn( false ); |
603 | m_actionFilter->setOn( false ); | 600 | m_actionFilter->setOn( false ); |
604 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 601 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
605 | OPackageManager::NotInstalled, QString::null ); | 602 | OPackageManager::NotInstalled, QString::null ); |
606 | } | 603 | } |
607 | else | 604 | else |
608 | packageList = m_packman.packages(); | 605 | packageList = m_packman.packages(); |
609 | 606 | ||
610 | if ( packageList ) | 607 | if ( packageList ) |
611 | { | 608 | { |
612 | loadPackageList( packageList, true ); | 609 | loadPackageList( packageList, true ); |
613 | delete packageList; | 610 | delete packageList; |
614 | } | 611 | } |
615 | } | 612 | } |
616 | 613 | ||
617 | void MainWindow::slotShowInstalled() | 614 | void MainWindow::slotShowInstalled() |
618 | { | 615 | { |
619 | OPackageList *packageList; | 616 | OPackageList *packageList; |
620 | if ( m_actionShowInstalled->isOn() ) | 617 | if ( m_actionShowInstalled->isOn() ) |
621 | { | 618 | { |
622 | m_actionShowNotInstalled->setOn( false ); | 619 | m_actionShowNotInstalled->setOn( false ); |
623 | m_actionShowUpdated->setOn( false ); | 620 | m_actionShowUpdated->setOn( false ); |
624 | m_actionFilter->setOn( false ); | 621 | m_actionFilter->setOn( false ); |
625 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 622 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
626 | OPackageManager::Installed, QString::null ); | 623 | OPackageManager::Installed, QString::null ); |
627 | } | 624 | } |
628 | else | 625 | else |
629 | packageList = m_packman.packages(); | 626 | packageList = m_packman.packages(); |
630 | 627 | ||
631 | if ( packageList ) | 628 | if ( packageList ) |
632 | { | 629 | { |
633 | loadPackageList( packageList, true ); | 630 | loadPackageList( packageList, true ); |
634 | delete packageList; | 631 | delete packageList; |
635 | } | 632 | } |
636 | } | 633 | } |
637 | 634 | ||
638 | void MainWindow::slotShowUpdated() | 635 | void MainWindow::slotShowUpdated() |
639 | { | 636 | { |
640 | OPackageList *packageList; | 637 | OPackageList *packageList; |
641 | if ( m_actionShowUpdated->isOn() ) | 638 | if ( m_actionShowUpdated->isOn() ) |
642 | { | 639 | { |
643 | m_actionShowInstalled->setOn( false ); | 640 | m_actionShowInstalled->setOn( false ); |
644 | m_actionShowNotInstalled->setOn( false ); | 641 | m_actionShowNotInstalled->setOn( false ); |
645 | m_actionFilter->setOn( false ); | 642 | m_actionFilter->setOn( false ); |
646 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 643 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
647 | OPackageManager::Updated, QString::null ); | 644 | OPackageManager::Updated, QString::null ); |
648 | } | 645 | } |
649 | else | 646 | else |
650 | packageList = m_packman.packages(); | 647 | packageList = m_packman.packages(); |
651 | 648 | ||
652 | if ( packageList ) | 649 | if ( packageList ) |
653 | { | 650 | { |
654 | loadPackageList( packageList, true ); | 651 | loadPackageList( packageList, true ); |
655 | delete packageList; | 652 | delete packageList; |
656 | } | 653 | } |
657 | } | 654 | } |
658 | 655 | ||
659 | void MainWindow::slotFilterChange() | 656 | void MainWindow::slotFilterChange() |
660 | { | 657 | { |
661 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 658 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
662 | m_filterCategory ); | 659 | m_filterCategory ); |
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control index 5385ea5..aacd0ca 100644 --- a/noncore/settings/packagemanager/opie-packagemanager.control +++ b/noncore/settings/packagemanager/opie-packagemanager.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-packagemanager | 1 | Package: opie-packagemanager |
2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop | 2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120) | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120), ipkg-link |
6 | Replaces: packagemanager | 6 | Replaces: packagemanager |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Dan Williams (drw@handhelds.org) | 8 | Maintainer: Dan Williams (drw@handhelds.org) |
9 | Description: Opie package management client | 9 | Description: Opie package management client |
10 | Version: 0.4.0$EXTRAVERSION | 10 | Version: 0.5.0$EXTRAVERSION |