summaryrefslogtreecommitdiff
authordrw <drw>2004-11-17 00:43:35 (UTC)
committer drw <drw>2004-11-17 00:43:35 (UTC)
commit718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40 (patch) (unidiff)
treea6bf4f10db4141ba7098d76d0444bd4d1dd759c1
parent216434aff5921f3c3c2efc9adb58e653a5d224b3 (diff)
downloadopie-718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40.zip
opie-718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40.tar.gz
opie-718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40.tar.bz2
Some code clean-up items (thanks to zecke)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp4
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp60
-rw-r--r--noncore/settings/packagemanager/installdlg.h59
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp42
-rw-r--r--noncore/settings/packagemanager/mainwindow.h2
-rw-r--r--noncore/settings/packagemanager/oconfitem.h46
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp56
-rw-r--r--noncore/settings/packagemanager/oipkg.h51
-rw-r--r--noncore/settings/packagemanager/opackagemanager.cpp56
-rw-r--r--noncore/settings/packagemanager/opackagemanager.h57
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.cpp46
-rw-r--r--noncore/settings/packagemanager/promptdlg.h52
12 files changed, 265 insertions, 266 deletions
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index 0e1ea52..e69b6eb 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -95,36 +95,36 @@ FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
95 m_status->insertItem( tr( "Not installed" ) ); 95 m_status->insertItem( tr( "Not installed" ) );
96 m_status->insertItem( tr( "Updated" ) ); 96 m_status->insertItem( tr( "Updated" ) );
97 initItem( m_status, m_statusCB, currStatus ); 97 initItem( m_status, m_statusCB, currStatus );
98 layout->addWidget( m_statusCB ); 98 layout->addWidget( m_statusCB );
99 layout->addWidget( m_status ); 99 layout->addWidget( m_status );
100 100
101 // Server 101 // Server
102 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); 102 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
103 QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) ); 103 QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) );
104 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); 104 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
105 m_server = new QComboBox( container ); 105 m_server = new QComboBox( container );
106 QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) ); 106 QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) );
107 m_server->insertStringList( *(pm->servers()) ); 107 m_server->insertStringList( pm->servers() );
108 initItem( m_server, m_serverCB, server ); 108 initItem( m_server, m_serverCB, server );
109 layout->addWidget( m_serverCB ); 109 layout->addWidget( m_serverCB );
110 layout->addWidget( m_server ); 110 layout->addWidget( m_server );
111 111
112 // Destination 112 // Destination
113 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); 113 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
114 QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) ); 114 QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) );
115 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); 115 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
116 m_destination = new QComboBox( container ); 116 m_destination = new QComboBox( container );
117 QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) ); 117 QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) );
118 m_destination->insertStringList( *(pm->destinations()) ); 118 m_destination->insertStringList( pm->destinations() );
119 initItem( m_destination, m_destCB, destination ); 119 initItem( m_destination, m_destCB, destination );
120 layout->addWidget( m_destCB ); 120 layout->addWidget( m_destCB );
121 layout->addWidget( m_destination ); 121 layout->addWidget( m_destination );
122} 122}
123 123
124void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) 124void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection )
125{ 125{
126 if ( !selection.isNull() ) 126 if ( !selection.isNull() )
127 { 127 {
128 checkBox->setChecked( true ); 128 checkBox->setChecked( true );
129 129
130 for ( int i = 0; i < comboBox->count(); i++ ) 130 for ( int i = 0; i < comboBox->count(); i++ )
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 0cb30e2..945dfed 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -1,36 +1,36 @@
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 33
34#include <qpe/fileselector.h> 34#include <qpe/fileselector.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
@@ -41,27 +41,27 @@
41#include <qgroupbox.h> 41#include <qgroupbox.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qmap.h> 44#include <qmap.h>
45#include <qmultilineedit.h> 45#include <qmultilineedit.h>
46#include <qpushbutton.h> 46#include <qpushbutton.h>
47 47
48#include <sys/vfs.h> 48#include <sys/vfs.h>
49 49
50#include "opackagemanager.h" 50#include "opackagemanager.h"
51 51
52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, 52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo,
53 OPackage::Command command1, QStringList *packages1, 53 OPackage::Command command1, const QStringList &packages1,
54 OPackage::Command command2, QStringList *packages2, 54 OPackage::Command command2, const QStringList &packages2,
55 OPackage::Command command3, QStringList *packages3 ) 55 OPackage::Command command3, const QStringList &packages3 )
56 : QWidget( 0x0 ) 56 : QWidget( 0x0 )
57 , m_packman( pm ) 57 , m_packman( pm )
58 , m_numCommands( 0 ) 58 , m_numCommands( 0 )
59 , m_currCommand( 0 ) 59 , m_currCommand( 0 )
60{ 60{
61 // Save command/package list information 61 // Save command/package list information
62 if ( command1 != OPackage::NotDefined ) 62 if ( command1 != OPackage::NotDefined )
63 { 63 {
64 m_command[ m_numCommands ] = command1; 64 m_command[ m_numCommands ] = command1;
65 m_packages[ m_numCommands ] = packages1; 65 m_packages[ m_numCommands ] = packages1;
66 ++m_numCommands; 66 ++m_numCommands;
67 } 67 }
@@ -80,25 +80,25 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
80 80
81 // Initialize UI 81 // Initialize UI
82 if ( parent ) 82 if ( parent )
83 parent->setCaption( caption ); 83 parent->setCaption( caption );
84 84
85 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); 85 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 );
86 86
87 if ( showDestInfo ) 87 if ( showDestInfo )
88 { 88 {
89 QLabel *label = new QLabel( tr( "Destination" ), this ); 89 QLabel *label = new QLabel( tr( "Destination" ), this );
90 layout->addWidget( label, 0, 0 ); 90 layout->addWidget( label, 0, 0 );
91 m_destination = new QComboBox( this ); 91 m_destination = new QComboBox( this );
92 m_destination->insertStringList( *(m_packman->destinations()) ); 92 m_destination->insertStringList( m_packman->destinations() );
93 layout->addWidget( m_destination, 0, 1 ); 93 layout->addWidget( m_destination, 0, 1 );
94 connect( m_destination, SIGNAL(highlighted(const QString&)), 94 connect( m_destination, SIGNAL(highlighted(const QString&)),
95 this, SLOT(slotDisplayAvailSpace(const QString&)) ); 95 this, SLOT(slotDisplayAvailSpace(const QString&)) );
96 96
97 label = new QLabel( tr( "Space Avail" ), this ); 97 label = new QLabel( tr( "Space Avail" ), this );
98 layout->addWidget( label, 1, 0 ); 98 layout->addWidget( label, 1, 0 );
99 m_availSpace = new QLabel( this ); 99 m_availSpace = new QLabel( this );
100 layout->addWidget( m_availSpace, 1, 1 ); 100 layout->addWidget( m_availSpace, 1, 1 );
101 101
102 // TODO - select correct destination 102 // TODO - select correct destination
103 slotDisplayAvailSpace( m_destination->currentText() ); 103 slotDisplayAvailSpace( m_destination->currentText() );
104 } 104 }
@@ -120,64 +120,60 @@ InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &cap
120 120
121 m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); 121 m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this );
122 layout->addWidget( m_btnStart, 3, 0 ); 122 layout->addWidget( m_btnStart, 3, 0 );
123 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); 123 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) );
124 124
125 m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 125 m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
126 layout->addWidget( m_btnOptions, 3, 1 ); 126 layout->addWidget( m_btnOptions, 3, 1 );
127 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); 127 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) );
128 128
129 // Display packages being acted upon in output widget 129 // Display packages being acted upon in output widget
130 for( int i = 0; i < m_numCommands; i++ ) 130 for( int i = 0; i < m_numCommands; i++ )
131 { 131 {
132 if ( m_packages[ i ] ) 132 if ( !m_packages[ i ].isEmpty() )
133 { 133 {
134 QString lineStr = tr( "Packages to " ); 134 QString lineStr = tr( "Packages to " );
135 135
136 switch( m_command[ i ] ) 136 switch( m_command[ i ] )
137 { 137 {
138 case OPackage::Install : lineStr.append( tr( "install" ) ); 138 case OPackage::Install : lineStr.append( tr( "install" ) );
139 break; 139 break;
140 case OPackage::Remove : lineStr.append( tr( "remove" ) ); 140 case OPackage::Remove : lineStr.append( tr( "remove" ) );
141 break; 141 break;
142 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); 142 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
143 break; 143 break;
144 case OPackage::Download : lineStr.append( tr( "download" ) ); 144 case OPackage::Download : lineStr.append( tr( "download" ) );
145 break; 145 break;
146 default : 146 default :
147 break; 147 break;
148 }; 148 };
149 lineStr.append( ":\n" ); 149 lineStr.append( ":\n" );
150 150
151 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it ) 151 QStringList tmpPackage = m_packages[ i ];
152 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it )
152 { 153 {
153 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 154 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
154 } 155 }
155 156
156 m_output->append( lineStr ); 157 m_output->append( lineStr );
157 } 158 }
158 } 159 }
159 160
160 m_output->append( tr( "Press the start button to begin.\n" ) ); 161 m_output->append( tr( "Press the start button to begin.\n" ) );
161 m_output->setCursorPosition( m_output->numLines(), 0 ); 162 m_output->setCursorPosition( m_output->numLines(), 0 );
162 163
163} 164}
164 165
165InstallDlg::~InstallDlg() 166InstallDlg::~InstallDlg()
166{ 167{
167 for( int i = 0; i < m_numCommands; i++ )
168 {
169 if ( m_packages[ i ] )
170 delete m_packages[ i ];
171 }
172} 168}
173 169
174void InstallDlg::slotDisplayAvailSpace( const QString &destination ) 170void InstallDlg::slotDisplayAvailSpace( const QString &destination )
175{ 171{
176 // If available space is not displayed, exit 172 // If available space is not displayed, exit
177 if ( !m_availSpace ) 173 if ( !m_availSpace )
178 return; 174 return;
179 175
180 QString space = tr( "Unknown" ); 176 QString space = tr( "Unknown" );
181 177
182 // Get destination 178 // Get destination
183 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination ); 179 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination );
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h
index 4da9cf6..cddc911 100644
--- a/noncore/settings/packagemanager/installdlg.h
+++ b/noncore/settings/packagemanager/installdlg.h
@@ -1,36 +1,36 @@
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
@@ -39,44 +39,47 @@ class QLabel;
39class QMultiLineEdit; 39class QMultiLineEdit;
40class QPushButton; 40class QPushButton;
41 41
42class OPackageManager; 42class OPackageManager;
43 43
44class InstallDlg : public QWidget 44class InstallDlg : public QWidget
45{ 45{
46 Q_OBJECT 46 Q_OBJECT
47 47
48public: 48public:
49 InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null, 49 InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null,
50 bool showDestInfo = true, 50 bool showDestInfo = true,
51 OPackage::Command command1 = OPackage::NotDefined, QStringList *packages1 = 0x0, 51 OPackage::Command command1 = OPackage::NotDefined,
52 OPackage::Command command2 = OPackage::NotDefined, QStringList *packages2 = 0x0, 52 const QStringList &packages1 = QStringList(),
53 OPackage::Command command3 = OPackage::NotDefined, QStringList *packages3 = 0x0 ); 53 OPackage::Command command2 = OPackage::NotDefined,
54 const QStringList &packages2 = QStringList(),
55 OPackage::Command command3 = OPackage::NotDefined,
56 const QStringList &packages3 = QStringList() );
54 ~InstallDlg(); 57 ~InstallDlg();
55 58
56private: 59private:
57 OPackageManager *m_packman; // Pointer to application instance of package manager 60 OPackageManager *m_packman; // Pointer to application instance of package manager
58 61
59 // UI controls 62 // UI controls
60 QComboBox *m_destination; // Destination selection list 63 QComboBox *m_destination; // Destination selection list
61 QLabel *m_availSpace; // Text label to display available space on selected destination 64 QLabel *m_availSpace; // Text label to display available space on selected destination
62 QMultiLineEdit *m_output; // Multi-line edit to display status 65 QMultiLineEdit *m_output; // Multi-line edit to display status
63 QPushButton *m_btnStart; // Start/abort/close button 66 QPushButton *m_btnStart; // Start/abort/close button
64 QPushButton *m_btnOptions; // Installation options button 67 QPushButton *m_btnOptions; // Installation options button
65 68
66 // Commands and packages to execute 69 // Commands and packages to execute
67 int m_numCommands; // Number of commands to be executed 70 int m_numCommands; // Number of commands to be executed
68 int m_currCommand; // Number of currently executing command 71 int m_currCommand; // Number of currently executing command
69 OPackage::Command m_command[3]; // List of commands to be executed 72 OPackage::Command m_command[3]; // List of commands to be executed
70 QStringList *m_packages[3]; // Lists of package names associated to commands (m_command[]) 73 QStringList m_packages[3]; // Lists of package names associated to commands (m_command[])
71 74
72private slots: 75private slots:
73 // UI control slots 76 // UI control slots
74 void slotDisplayAvailSpace( const QString &destination ); 77 void slotDisplayAvailSpace( const QString &destination );
75 void slotBtnStart(); 78 void slotBtnStart();
76 void slotBtnOptions(); 79 void slotBtnOptions();
77 80
78 // Execution slots 81 // Execution slots
79 void slotOutput( char *msg ); 82 void slotOutput( char *msg );
80 83
81signals: 84signals:
82 void closeInstallDlg(); 85 void closeInstallDlg();
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 349094d..5e15874 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -304,25 +304,25 @@ void MainWindow::searchForPackage( const QString &text )
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
312void MainWindow::installLocalPackage( const QString &ipkFile ) 312void 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" ), true,
316 OPackage::Install, new QStringList( 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
324void MainWindow::setDocument( const QString &ipkFile ) 324void 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() )
@@ -401,35 +401,35 @@ void MainWindow::slotUpgrade()
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" ), false,
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
410void MainWindow::slotDownload() 410void 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 = new QStringList(); 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 );
@@ -448,105 +448,95 @@ void MainWindow::slotDownload()
448 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, 448 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
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
458void MainWindow::slotApply() 458void MainWindow::slotApply()
459{ 459{
460 QStringList *removeList = 0x0; 460 QStringList removeList;
461 QStringList *installList = 0x0; 461 QStringList installList;
462 QStringList *upgradeList = 0x0; 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 if ( !removeList ) 483 removeList.append( item->text() );
484 removeList = new QStringList();
485 removeList->append( item->text() );
486 } 484 }
487 else if ( answer == 2 ) // Upgrade 485 else if ( answer == 2 ) // Upgrade
488 { 486 {
489 if ( !upgradeList ) 487 upgradeList.append( item->text() );
490 upgradeList = new QStringList();
491 upgradeList->append( item->text() );
492 } 488 }
493 } 489 }
494 else 490 else
495 { 491 {
496 // Remove/reinstall package 492 // Remove/reinstall package
497 int answer = PromptDlg::ask( tr( "Remove or reinstall" ), 493 int answer = PromptDlg::ask( tr( "Remove or reinstall" ),
498 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() ) ),
499 tr( "Remove" ), tr( "Reinstall" ), this ); 495 tr( "Remove" ), tr( "Reinstall" ), this );
500 if ( answer == 1 ) // Remove 496 if ( answer == 1 ) // Remove
501 { 497 {
502 if ( !removeList ) 498 removeList.append( item->text() );
503 removeList = new QStringList();
504 removeList->append( item->text() );
505 } 499 }
506 else if ( answer == 2 ) // Reinstall 500 else if ( answer == 2 ) // Reinstall
507 { 501 {
508 if ( !installList ) 502 installList.append( item->text() );
509 installList = new QStringList();
510 installList->append( item->text() );
511 } 503 }
512 } 504 }
513 } 505 }
514 else 506 else
515 { 507 {
516 // Install package 508 // Install package
517 if ( !installList ) 509 installList.append( item->text() );
518 installList = new QStringList();
519 installList->append( item->text() );
520 } 510 }
521 } 511 }
522 } 512 }
523 } 513 }
524 514
525 // If nothing is selected, display message and exit 515 // If nothing is selected, display message and exit
526 if ( !removeList && !installList && !upgradeList ) 516 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() )
527 { 517 {
528 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" ) );
529 return; 519 return;
530 } 520 }
531 521
532 // Send command only if there are packages to process 522 // Send command only if there are packages to process
533 OPackage::Command removeCmd = OPackage::NotDefined; 523 OPackage::Command removeCmd = OPackage::NotDefined;
534 if ( removeList && !removeList->isEmpty() ) 524 if ( !removeList.isEmpty() )
535 removeCmd = OPackage::Remove; 525 removeCmd = OPackage::Remove;
536 OPackage::Command installCmd = OPackage::NotDefined; 526 OPackage::Command installCmd = OPackage::NotDefined;
537 if ( installList && !installList->isEmpty() ) 527 if ( !installList.isEmpty() )
538 installCmd = OPackage::Install; 528 installCmd = OPackage::Install;
539 OPackage::Command upgradeCmd = OPackage::NotDefined; 529 OPackage::Command upgradeCmd = OPackage::NotDefined;
540 if ( upgradeList && !upgradeList->isEmpty() ) 530 if ( !upgradeList.isEmpty() )
541 upgradeCmd = OPackage::Upgrade; 531 upgradeCmd = OPackage::Upgrade;
542 532
543 // Create package manager output widget 533 // Create package manager output widget
544 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 534 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
545 removeCmd, removeList, 535 removeCmd, removeList,
546 installCmd, installList, 536 installCmd, installList,
547 upgradeCmd, upgradeList ); 537 upgradeCmd, upgradeList );
548 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 538 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
549 539
550 // Display widget 540 // Display widget
551 m_widgetStack.addWidget( dlg, 3 ); 541 m_widgetStack.addWidget( dlg, 3 );
552 m_widgetStack.raiseWidget( dlg ); 542 m_widgetStack.raiseWidget( dlg );
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h
index 103c664..f00e344 100644
--- a/noncore/settings/packagemanager/mainwindow.h
+++ b/noncore/settings/packagemanager/mainwindow.h
@@ -42,25 +42,25 @@ _;:, .> :=|. This file is free software; you can
42#include <qtoolbar.h> 42#include <qtoolbar.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44 44
45class QAction; 45class QAction;
46class QLineEdit; 46class QLineEdit;
47 47
48class MainWindow :public QMainWindow 48class MainWindow :public QMainWindow
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); 53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 );
54 static QString appName() { return QString::fromLatin1( "packagemanager" ); }; 54 static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); };
55 55
56protected: 56protected:
57 void closeEvent( QCloseEvent *event ); 57 void closeEvent( QCloseEvent *event );
58 58
59private: 59private:
60 Config m_config; // Configuration file 60 Config m_config; // Configuration file
61 61
62 OPackageManager m_packman; // Package manager 62 OPackageManager m_packman; // Package manager
63 63
64 // Toolbars 64 // Toolbars
65 QToolBar m_menuBar; // Main toolbar containing menu 65 QToolBar m_menuBar; // Main toolbar containing menu
66 QToolBar m_toolBar; // Main toolbar 66 QToolBar m_toolBar; // Main toolbar
diff --git a/noncore/settings/packagemanager/oconfitem.h b/noncore/settings/packagemanager/oconfitem.h
index db77980..7c158c9 100644
--- a/noncore/settings/packagemanager/oconfitem.h
+++ b/noncore/settings/packagemanager/oconfitem.h
@@ -1,56 +1,56 @@
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 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7 .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14    .%`+i>       _;_. 14 .%`+i> _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++=   -.     .`     .: details. 21++= -. .` .: details.
22 :     =  ...= . :.=- 22: = ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#ifndef OCONFITEM_H 32#ifndef OCONFITEM_H
33#define OCONFITEM_H 33#define OCONFITEM_H
34 34
35#include <qlist.h> 35#include <qlist.h>
36#include <qstring.h> 36#include <qstring.h>
37 37
38class OConfItem 38class OConfItem
39{ 39{
40public: 40public:
41 enum Type { Source, Destination, Option, Arch, NotDefined }; 41 enum Type { Source, Destination, Option, Arch, NotDefined };
42 42
43 OConfItem( Type type = NotDefined, const QString &name = 0x0, const QString &value = 0x0, 43 OConfItem( Type type = NotDefined, const QString &name = QString::null,
44 bool active = true ); 44 const QString &value = QString::null, bool active = true );
45 45
46 Type type() { return m_type; } 46 Type type() { return m_type; }
47 const QString &name() { return m_name; } 47 const QString &name() { return m_name; }
48 const QString &value() { return m_value; } 48 const QString &value() { return m_value; }
49 bool active() { return m_active; } 49 bool active() { return m_active; }
50 50
51 void setType( Type type ) { m_type = type; } 51 void setType( Type type ) { m_type = type; }
52 void setName( const QString &name ) { m_name = name; } 52 void setName( const QString &name ) { m_name = name; }
53 void setValue( const QString &value ) { m_value = value; } 53 void setValue( const QString &value ) { m_value = value; }
54 void setActive( bool active ) { m_active = active; } 54 void setActive( bool active ) { m_active = active; }
55 55
56private: 56private:
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 1978ad5..b0cc94d 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -1,37 +1,37 @@
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 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7 .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14    .%`+i>       _;_. 14 .%`+i> _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++=   -.     .`     .: details. 21++= -. .` .: details.
22 :     =  ...= . :.=- 22: = ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "oipkg.h" 32#include "oipkg.h"
33 33
34#include <qdir.h> 34#include <qdir.h>
35#include <qfile.h> 35#include <qfile.h>
36#include <qtextstream.h> 36#include <qtextstream.h>
37 37
@@ -43,24 +43,26 @@ const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing
43const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location 43const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location
44 44
45OIpkg *oipkg; 45OIpkg *oipkg;
46 46
47// Ipkg callback functions 47// Ipkg callback functions
48 48
49int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) 49int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg )
50{ 50{
51 if ( conf && ( conf->verbosity < level ) ) 51 if ( conf && ( conf->verbosity < level ) )
52 return 0; 52 return 0;
53 else 53 else
54 oipkg->ipkgMessage( msg ); 54 oipkg->ipkgMessage( msg );
55
56 return 0;
55} 57}
56 58
57char *fIpkgResponse( char */*question*/ ) 59char *fIpkgResponse( char */*question*/ )
58{ 60{
59 return 0x0; 61 return 0x0;
60} 62}
61 63
62int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) 64int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ )
63{ 65{
64 oipkg->ipkgStatus( desc ); 66 oipkg->ipkgStatus( desc );
65 return 0; 67 return 0;
66} 68}
@@ -344,25 +346,25 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString &
344 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 346 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
345 line = t.readLine(); 347 line = t.readLine();
346 } 348 }
347 else 349 else
348 line = t.readLine(); 350 line = t.readLine();
349 } 351 }
350 352
351 f.close(); 353 f.close();
352 354
353 return pl; 355 return pl;
354} 356}
355 357
356bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, 358bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parameters, const QString &destination,
357 const QObject *receiver, const char *slotOutput, bool rawOutput ) 359 const QObject *receiver, const char *slotOutput, bool rawOutput )
358{ 360{
359 if ( command == OPackage::NotDefined ) 361 if ( command == OPackage::NotDefined )
360 return false; 362 return false;
361 363
362 // Set ipkg run-time options/arguments 364 // Set ipkg run-time options/arguments
363 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); 365 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
364 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); 366 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
365 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); 367 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
366 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); 368 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
367 m_ipkgArgs.verbosity = m_ipkgExecVerbosity; 369 m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
368 if ( m_ipkgArgs.dest ) 370 if ( m_ipkgArgs.dest )
@@ -394,54 +396,54 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
394 case OPackage::Update : { 396 case OPackage::Update : {
395 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); 397 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
396 ipkg_lists_update( &m_ipkgArgs ); 398 ipkg_lists_update( &m_ipkgArgs );
397 }; 399 };
398 break; 400 break;
399 case OPackage::Upgrade : { 401 case OPackage::Upgrade : {
400 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); 402 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
401 ipkg_packages_upgrade( &m_ipkgArgs ); 403 ipkg_packages_upgrade( &m_ipkgArgs );
402 }; 404 };
403 break; 405 break;
404 case OPackage::Install : { 406 case OPackage::Install : {
405 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); 407 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
406 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 408 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
407 { 409 {
408 ipkg_packages_install( &m_ipkgArgs, (*it) ); 410 ipkg_packages_install( &m_ipkgArgs, (*it) );
409 } 411 }
410 }; 412 };
411 break; 413 break;
412 case OPackage::Remove : { 414 case OPackage::Remove : {
413 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); 415 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
414 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 416 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
415 { 417 {
416 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 418 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
417 } 419 }
418 }; 420 };
419 break; 421 break;
420 case OPackage::Download : { 422 case OPackage::Download : {
421 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); 423 connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput );
422 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 424 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
423 { 425 {
424 ipkg_packages_download( &m_ipkgArgs, (*it) ); 426 ipkg_packages_download( &m_ipkgArgs, (*it) );
425 } 427 }
426 }; 428 };
427 break; 429 break;
428 case OPackage::Info : { 430 case OPackage::Info : {
429 connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput ); 431 connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput );
430 ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 ); 432 ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0x0 );
431 }; 433 };
432 break; 434 break;
433 case OPackage::Files : { 435 case OPackage::Files : {
434 connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput ); 436 connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput );
435 ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 ); 437 ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0x0 );
436 }; 438 };
437 break; 439 break;
438 default : break; 440 default : break;
439 }; 441 };
440 442
441 return true; 443 return true;
442} 444}
443 445
444void OIpkg::ipkgMessage( char *msg ) 446void OIpkg::ipkgMessage( char *msg )
445{ 447{
446 emit signalIpkgMessage( msg ); 448 emit signalIpkgMessage( msg );
447} 449}
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h
index b8a859a..3c96200 100644
--- a/noncore/settings/packagemanager/oipkg.h
+++ b/noncore/settings/packagemanager/oipkg.h
@@ -1,37 +1,37 @@
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 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7 .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14    .%`+i>       _;_. 14 .%`+i> _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++=   -.     .`     .: details. 21++= -. .` .: details.
22 :     =  ...= . :.=- 22: = ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#ifndef OIPKG_H 32#ifndef OIPKG_H
33#define OIPKG_H 33#define OIPKG_H
34 34
35#include "oconfitem.h" 35#include "oconfitem.h"
36#include "opackage.h" 36#include "opackage.h"
37 37
@@ -68,27 +68,30 @@ public:
68 int ipkgExecVerbosity() { return m_ipkgExecVerbosity; } 68 int ipkgExecVerbosity() { return m_ipkgExecVerbosity; }
69 69
70 void setConfigItems( OConfItemList *configList ); 70 void setConfigItems( OConfItemList *configList );
71 void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } 71 void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; }
72 void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } 72 void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; }
73 73
74 void saveSettings(); 74 void saveSettings();
75 75
76 OPackageList *availablePackages( const QString &server = QString::null ); 76 OPackageList *availablePackages( const QString &server = QString::null );
77 OPackageList *installedPackages( const QString &destName = QString::null, 77 OPackageList *installedPackages( const QString &destName = QString::null,
78 const QString &destPath = QString::null ); 78 const QString &destPath = QString::null );
79 79
80 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, 80 bool executeCommand( OPackage::Command command = OPackage::NotDefined,
81 const QString &destination = QString::null, const QObject *receiver = 0x0, 81 const QStringList &parameters = QStringList(),
82 const char *slotOutput = 0x0, bool rawOutput = true ); 82 const QString &destination = QString::null,
83 const QObject *receiver = 0x0,
84 const char *slotOutput = 0x0,
85 bool rawOutput = true );
83 void abortCommand(); 86 void abortCommand();
84 87
85 void ipkgMessage( char *msg ); 88 void ipkgMessage( char *msg );
86 void ipkgStatus( char *status ); 89 void ipkgStatus( char *status );
87 void ipkgList( char *filelist ); 90 void ipkgList( char *filelist );
88 91
89private: 92private:
90 Config *m_config; // Pointer to application configuration file 93 Config *m_config; // Pointer to application configuration file
91 args_t m_ipkgArgs; // libipkg configuration arguments 94 args_t m_ipkgArgs; // libipkg configuration arguments
92 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files 95 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files
93 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options 96 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options
94 int m_ipkgExecVerbosity; // Ipkg execution verbosity level 97 int m_ipkgExecVerbosity; // Ipkg execution verbosity level
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp
index f75d3b3..cbddfe7 100644
--- a/noncore/settings/packagemanager/opackagemanager.cpp
+++ b/noncore/settings/packagemanager/opackagemanager.cpp
@@ -1,37 +1,37 @@
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 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7 .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14    .%`+i>       _;_. 14 .%`+i> _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++=   -.     .`     .: details. 21++= -. .` .: details.
22 :     =  ...= . :.=- 22: = ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#include "opackagemanager.h" 32#include "opackagemanager.h"
33#include "oipkgconfigdlg.h" 33#include "oipkgconfigdlg.h"
34 34
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37#include <ctype.h> 37#include <ctype.h>
@@ -218,58 +218,58 @@ OPackageList *OPackageManager::filterPackages( const QString &name,const QString
218 default : statusMatch = true; 218 default : statusMatch = true;
219 break; 219 break;
220 }; 220 };
221 bool categoryMatch = ( category.isNull() || package->category() == category ); 221 bool categoryMatch = ( category.isNull() || package->category() == category );
222 222
223 if ( nameMatch && serverMatch && destinationMatch && statusMatch && categoryMatch ) 223 if ( nameMatch && serverMatch && destinationMatch && statusMatch && categoryMatch )
224 pl->append( packageIt.current() ); 224 pl->append( packageIt.current() );
225 } 225 }
226 226
227 return pl; 227 return pl;
228} 228}
229 229
230QStringList *OPackageManager::servers() 230QStringList OPackageManager::servers()
231{ 231{
232 QStringList *sl = new QStringList(); 232 QStringList sl;
233 233
234 OConfItemList *serverList = m_ipkg.servers(); 234 OConfItemList *serverList = m_ipkg.servers();
235 if ( serverList ) 235 if ( serverList )
236 { 236 {
237 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt ) 237 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt )
238 { 238 {
239 OConfItem *server = serverIt.current(); 239 OConfItem *server = serverIt.current();
240 240
241 // Add only active servers 241 // Add only active servers
242 if ( server->active() ) 242 if ( server->active() )
243 *sl << server->name(); 243 sl << server->name();
244 } 244 }
245 } 245 }
246 246
247 return sl; 247 return sl;
248} 248}
249 249
250QStringList *OPackageManager::destinations() 250QStringList OPackageManager::destinations()
251{ 251{
252 QStringList *dl = new QStringList(); 252 QStringList dl;
253 253
254 OConfItemList *destList = m_ipkg.destinations(); 254 OConfItemList *destList = m_ipkg.destinations();
255 if ( destList ) 255 if ( destList )
256 { 256 {
257 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 257 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
258 { 258 {
259 OConfItem *destination = destIt.current(); 259 OConfItem *destination = destIt.current();
260 260
261 // Add only active destinations 261 // Add only active destinations
262 if ( destination->active() ) 262 if ( destination->active() )
263 *dl << destination->name(); 263 dl << destination->name();
264 } 264 }
265 } 265 }
266 266
267 return dl; 267 return dl;
268} 268}
269 269
270OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name ) 270OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name )
271{ 271{
272 OConfItem *confItem = 0x0; 272 OConfItem *confItem = 0x0;
273 OConfItemList *confList = m_ipkg.configItems(); 273 OConfItemList *confList = m_ipkg.configItems();
274 if ( confList ) 274 if ( confList )
275 { 275 {
@@ -321,25 +321,25 @@ int OPackageManager::compareVersions( const QString &ver1, const QString &ver2 )
321 321
322bool OPackageManager::configureDlg( bool installOptions ) 322bool OPackageManager::configureDlg( bool installOptions )
323{ 323{
324 OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) ); 324 OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) );
325 return ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 325 return ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
326} 326}
327 327
328void OPackageManager::saveSettings() 328void OPackageManager::saveSettings()
329{ 329{
330 m_ipkg.saveSettings(); 330 m_ipkg.saveSettings();
331} 331}
332 332
333bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages, 333bool OPackageManager::executeCommand( OPackage::Command command, const QStringList &packages,
334 const QString &destination, const QObject *receiver, 334 const QString &destination, const QObject *receiver,
335 const char *slotOutput, bool rawOutput ) 335 const char *slotOutput, bool rawOutput )
336{ 336{
337 return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput ); 337 return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput );
338} 338}
339 339
340void OPackageManager::parseVersion( const QString &verstr, int *epoch, QString *version, 340void OPackageManager::parseVersion( const QString &verstr, int *epoch, QString *version,
341 QString *revision ) 341 QString *revision )
342{ 342{
343 *epoch = 0; 343 *epoch = 0;
344 *revision = QString::null; 344 *revision = QString::null;
345 345
diff --git a/noncore/settings/packagemanager/opackagemanager.h b/noncore/settings/packagemanager/opackagemanager.h
index 58e597b..bc394e8 100644
--- a/noncore/settings/packagemanager/opackagemanager.h
+++ b/noncore/settings/packagemanager/opackagemanager.h
@@ -1,37 +1,37 @@
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 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7 .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8_;:, .> :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_, > . <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.-- : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i, .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12- . .-<_> .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13 ._= =} : or (at your option) any later version.
14    .%`+i>       _;_. 14 .%`+i> _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15 .i_,=:_. -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17 : .. .:, . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.= = ; Library General Public License for more
21++=   -.     .`     .: details. 21++= -. .` .: details.
22 :     =  ...= . :.=- 22: = ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23-. .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24 -_. . . )=. = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25 -- :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32#ifndef OPACKAGEMANAGER_H 32#ifndef OPACKAGEMANAGER_H
33#define OPACKAGEMANAGER_H 33#define OPACKAGEMANAGER_H
34 34
35#include "oipkg.h" 35#include "oipkg.h"
36 36
37#include <qpe/config.h> 37#include <qpe/config.h>
@@ -44,42 +44,45 @@ class OPackageManager : public QObject
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 46
47public: 47public:
48 OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); 48 OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 );
49 49
50 void loadAvailablePackages(); 50 void loadAvailablePackages();
51 void loadInstalledPackages(); 51 void loadInstalledPackages();
52 52
53 enum Status { All, NotInstalled, Installed, Updated, NotDefined }; 53 enum Status { All, NotInstalled, Installed, Updated, NotDefined };
54 54
55 OPackageList *packages(); 55 OPackageList *packages();
56 OPackageList *filterPackages( const QString &name = 0x0,const QString &server = 0x0, 56 OPackageList *filterPackages( const QString &name = QString::null,
57 const QString &destination = 0x0, Status status = NotDefined, 57 const QString &server = QString::null,
58 const QString &category = 0x0 ); 58 const QString &destination = QString::null,
59 Status status = NotDefined,
60 const QString &category = QString::null );
59 61
60 const QStringList &categories() { return m_categories; } 62 const QStringList &categories() { return m_categories; }
61 QStringList *servers(); 63 QStringList servers();
62 QStringList *destinations(); 64 QStringList destinations();
63 65
64 int compareVersions( const QString &version1, const QString &version2 ); 66 int compareVersions( const QString &version1, const QString &version2 );
65 67
66 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, 68 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
67 const QString &name = QString::null ); 69 const QString &name = QString::null );
68 OPackage *findPackage( const QString &name = QString::null ); 70 OPackage *findPackage( const QString &name = QString::null );
69 71
70 bool configureDlg( bool installOptions = false ); 72 bool configureDlg( bool installOptions = false );
71 void saveSettings(); 73 void saveSettings();
72 74
73 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, 75 bool executeCommand( OPackage::Command command = OPackage::NotDefined,
76 const QStringList &parameters = QStringList(),
74 const QString &destination = QString::null, const QObject *receiver = 0x0, 77 const QString &destination = QString::null, const QObject *receiver = 0x0,
75 const char *slotOutput = 0x0, bool rawOutput = true ); 78 const char *slotOutput = 0x0, bool rawOutput = true );
76 79
77private: 80private:
78 Config *m_config; // Pointer to application configuration file 81 Config *m_config; // Pointer to application configuration file
79 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information 82 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information
80 QDict<OPackage> m_packages; // Global list of available packages 83 QDict<OPackage> m_packages; // Global list of available packages
81 QStringList m_categories; // List of all categories 84 QStringList m_categories; // List of all categories
82 85
83 void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision ); 86 void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision );
84 int verrevcmp( const char *val, const char *ref ); 87 int verrevcmp( const char *val, const char *ref );
85 88
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp
index d27eacb..c5924fd 100644
--- a/noncore/settings/packagemanager/packageinfodlg.cpp
+++ b/noncore/settings/packagemanager/packageinfodlg.cpp
@@ -1,36 +1,36 @@
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 "packageinfodlg.h" 30#include "packageinfodlg.h"
31#include "opackage.h" 31#include "opackage.h"
32#include "opackagemanager.h" 32#include "opackagemanager.h"
33 33
34#include <opie2/otabwidget.h> 34#include <opie2/otabwidget.h>
35 35
36#include <qpe/resource.h> 36#include <qpe/resource.h>
@@ -66,25 +66,25 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr
66 { 66 {
67 m_information.setText( tr( "Unable to retrieve package information." ) ); 67 m_information.setText( tr( "Unable to retrieve package information." ) );
68 return; 68 return;
69 } 69 }
70 70
71 // Display package information 71 // Display package information
72 if ( !m_package->information().isNull() ) 72 if ( !m_package->information().isNull() )
73 m_information.setText( m_package->information() ); 73 m_information.setText( m_package->information() );
74 else 74 else
75 { 75 {
76 // Package information is not cached, retrieve it 76 // Package information is not cached, retrieve it
77 QStringList list( package ); 77 QStringList list( package );
78 m_packman->executeCommand( OPackage::Info, &list, QString::null, this, SLOT(slotInfo(char*)), true ); 78 m_packman->executeCommand( OPackage::Info, list, QString::null, this, SLOT(slotInfo(char*)), true );
79 } 79 }
80 80
81 // Files tab (display only if package is installed) 81 // Files tab (display only if package is installed)
82 if ( !m_package->versionInstalled().isNull() ) 82 if ( !m_package->versionInstalled().isNull() )
83 { 83 {
84 QWidget *filesWidget = new QWidget( tabWidget ); 84 QWidget *filesWidget = new QWidget( tabWidget );
85 QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); 85 QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 );
86 QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) ); 86 QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) );
87 m_files.reparent( filesWidget, QPoint( 0, 0 ) ); 87 m_files.reparent( filesWidget, QPoint( 0, 0 ) );
88 m_files.setReadOnly( true ); 88 m_files.setReadOnly( true );
89 filesLayout->addWidget( &m_files ); 89 filesLayout->addWidget( &m_files );
90 90
@@ -115,25 +115,25 @@ PackageInfoDlg::~PackageInfoDlg()
115 m_package->setInformation( m_information.text() ); 115 m_package->setInformation( m_information.text() );
116 116
117 // Cache package file list 117 // Cache package file list
118 if ( !m_files.text().isNull() ) 118 if ( !m_files.text().isNull() )
119 m_package->setFiles( m_files.text() ); 119 m_package->setFiles( m_files.text() );
120} 120}
121 121
122void PackageInfoDlg::slotBtnFileScan() 122void PackageInfoDlg::slotBtnFileScan()
123{ 123{
124 m_files.clear(); 124 m_files.clear();
125 125
126 QStringList list( m_package->name() ); 126 QStringList list( m_package->name() );
127 m_packman->executeCommand( OPackage::Files, &list, QString::null, this, SLOT(slotFiles(char*)), true ); 127 m_packman->executeCommand( OPackage::Files, list, QString::null, this, SLOT(slotFiles(char*)), true );
128} 128}
129 129
130void PackageInfoDlg::slotInfo( char *info ) 130void PackageInfoDlg::slotInfo( char *info )
131{ 131{
132 m_information.append( info ); 132 m_information.append( info );
133} 133}
134 134
135void PackageInfoDlg::slotFiles( char *filelist ) 135void PackageInfoDlg::slotFiles( char *filelist )
136{ 136{
137 QString str = filelist; 137 QString str = filelist;
138 138
139 // Skip first line of output ("Package xxx is installed...") 139 // Skip first line of output ("Package xxx is installed...")
diff --git a/noncore/settings/packagemanager/promptdlg.h b/noncore/settings/packagemanager/promptdlg.h
index 790ff4d..f7bc0c0 100644
--- a/noncore/settings/packagemanager/promptdlg.h
+++ b/noncore/settings/packagemanager/promptdlg.h
@@ -1,57 +1,59 @@
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 PROMPTDLG_H 30#ifndef PROMPTDLG_H
31#define PROMPTDLG_H 31#define PROMPTDLG_H
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35class PromptDlg : public QWidget 35class PromptDlg : public QWidget
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 38
39public: 39public:
40 PromptDlg( const QString &caption = 0x0, const QString &text = 0x0, const QString &btn1 = 0x0, 40 PromptDlg( const QString &caption = QString::null, const QString &text = QString::null,
41 const QString &btn2 = 0x0, QWidget *parent = 0x0 ); 41 const QString &btn1 = QString::null, const QString &btn2 = QString::null,
42 QWidget *parent = 0x0 );
42 43
43 int display(); 44 int display();
44 int btnPressed() { return m_btnClicked; } 45 int btnPressed() { return m_btnClicked; }
45 46
46 static int ask( const QString &caption = 0x0, const QString &text = 0x0, const QString &btn1 = 0x0, 47 static int ask( const QString &caption = QString::null, const QString &text = QString::null,
47 const QString &btn2 = 0x0, QWidget *parent = 0x0 ); 48 const QString &btn1 = QString::null, const QString &btn2 = QString::null,
49 QWidget *parent = 0x0 );
48 50
49private: 51private:
50 int m_btnClicked; // Indicator for which button was pressed 52 int m_btnClicked; // Indicator for which button was pressed
51 53
52private slots: 54private slots:
53 void slotBtn1Clicked(); 55 void slotBtn1Clicked();
54 void slotBtn2Clicked(); 56 void slotBtn2Clicked();
55}; 57};
56 58
57#endif 59#endif