summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog6
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp82
-rw-r--r--noncore/settings/packagemanager/entrydlg.h57
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp38
-rw-r--r--noncore/settings/packagemanager/mainwindow.h2
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp9
-rw-r--r--noncore/settings/packagemanager/packagemanager.pro4
-rw-r--r--noncore/settings/packagemanager/promptdlg.cpp2
9 files changed, 179 insertions, 23 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index 1ba12af..efa75b1 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,9 +1,15 @@
12004-01-23 Dan Williams <drw@handhelds.org>
2
3 * Added package download functionality
4 * Have Opie update links after install/removal so that apps
5 will display properly in Launcher
6
12004-01-20 Dan Williams <drw@handhelds.org> 72004-01-20 Dan Williams <drw@handhelds.org>
2 8
3 * Released version 0.2.0 9 * Released version 0.2.0
4 * Converted to use libipkg in place of spawning ipkg process 10 * Converted to use libipkg in place of spawning ipkg process
5 11
62004-01-13 Dan Williams <drw@handhelds.org> 122004-01-13 Dan Williams <drw@handhelds.org>
7 13
8 * Released version 0.1.0 14 * Released version 0.1.0
9 * Initial check-in of new package management client to eventually replace AQPkg 15 * Initial check-in of new package management client to eventually replace AQPkg
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
new file mode 100644
index 0000000..8deaa37
--- a/dev/null
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -0,0 +1,82 @@
1/*
2                This file is part of the OPIE Project
3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l.
6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29
30#include "entrydlg.h"
31
32#include <qlabel.h>
33#include <qlayout.h>
34#include <qlineedit.h>
35#include <qpushbutton.h>
36
37EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
38 : QDialog( parent, name, modal )
39{
40 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
41
42 QLabel *l = new QLabel( label, this );
43 l->setAlignment( AlignLeft | AlignTop | WordBreak );
44 vbox->addWidget( l );
45
46 m_entry = new QLineEdit( this );
47 vbox->addWidget( m_entry );
48
49 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) );
50}
51
52void EntryDlg::setText( const QString &text )
53{
54 m_entry->setText( text );
55 m_entry->selectAll();
56}
57
58QString EntryDlg::getText()
59{
60 return m_entry->text();
61}
62
63QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
64 QWidget *parent, const char *name )
65{
66 EntryDlg *dlg = new EntryDlg( label, parent, name, true );
67 dlg->setCaption( caption );
68 dlg->setText( text );
69
70 QString result;
71 *ok = ( dlg->exec() == QDialog::Accepted );
72 if ( *ok )
73 result = dlg->getText();
74
75 delete dlg;
76 return result;
77}
78void EntryDlg::tryAccept()
79{
80 if ( !m_entry->text().isEmpty() )
81 accept();
82}
diff --git a/noncore/settings/packagemanager/entrydlg.h b/noncore/settings/packagemanager/entrydlg.h
new file mode 100644
index 0000000..33a7920
--- a/dev/null
+++ b/noncore/settings/packagemanager/entrydlg.h
@@ -0,0 +1,57 @@
1/*
2                This file is part of the OPIE Project
3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l.
6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29
30#ifndef ENTRYDLG_H
31#define ENTRYDLG_H
32
33#include <qdialog.h>
34
35class QLineEdit;
36
37class EntryDlg : public QDialog
38{
39 Q_OBJECT
40
41public:
42 static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
43 bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
44
45 EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true );
46
47 void setText( const QString &text );
48 QString getText();
49
50private slots:
51 void tryAccept();
52
53private:
54 QLineEdit *m_entry;
55};
56
57#endif // EntryDlg_H
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 6a9ccbd..0c2ea78 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -120,48 +120,50 @@ 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 ] )
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" ) );
145 break;
144 default : 146 default :
145 break; 147 break;
146 }; 148 };
147 lineStr.append( ":\n" ); 149 lineStr.append( ":\n" );
148 150
149 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it ) 151 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it )
150 { 152 {
151 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 153 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
152 } 154 }
153 155
154 m_output->append( lineStr ); 156 m_output->append( lineStr );
155 } 157 }
156 } 158 }
157 159
158 m_output->append( tr( "Press the start button to begin.\n" ) ); 160 m_output->append( tr( "Press the start button to begin.\n" ) );
159 m_output->setCursorPosition( m_output->numLines(), 0 ); 161 m_output->setCursorPosition( m_output->numLines(), 0 );
160 162
161} 163}
162 164
163InstallDlg::~InstallDlg() 165InstallDlg::~InstallDlg()
164{ 166{
165 for( int i = 0; i < m_numCommands; i++ ) 167 for( int i = 0; i < m_numCommands; i++ )
166 { 168 {
167 if ( m_packages[ i ] ) 169 if ( m_packages[ i ] )
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 4611404..486561d 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -7,64 +7,67 @@
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 <qaction.h> 30#include <qaction.h>
31#include <qdir.h>
31#include <qlayout.h> 32#include <qlayout.h>
32#include <qlineedit.h> 33#include <qlineedit.h>
33#include <qmenubar.h> 34#include <qmenubar.h>
34#include <qmessagebox.h> 35#include <qmessagebox.h>
35#include <qpopupmenu.h> 36#include <qpopupmenu.h>
36#include <qtimer.h> 37#include <qtimer.h>
37#include <qtoolbar.h> 38#include <qtoolbar.h>
38#include <qwhatsthis.h> 39#include <qwhatsthis.h>
39 40
41#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpeapplication.h> 42#include <qpe/qpeapplication.h>
41#include <qpe/resource.h> 43#include <qpe/resource.h>
42 44
43#include "mainwindow.h" 45#include "mainwindow.h"
44#include "installdlg.h" 46#include "installdlg.h"
45#include "filterdlg.h" 47#include "filterdlg.h"
46#include "promptdlg.h" 48#include "promptdlg.h"
49#include "entrydlg.h"
47 50
48MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) 51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
49 : QMainWindow( parent, name, fl || WStyle_ContextHelp ) 52 : QMainWindow( parent, name, fl || WStyle_ContextHelp )
50 , m_config( "packman" ) 53 , m_config( "packman" )
51 , m_packman( &m_config, this ) 54 , m_packman( &m_config, this )
52 , m_menuBar( this ) 55 , m_menuBar( this )
53 , m_toolBar( this ) 56 , m_toolBar( this )
54 , m_findBar( this ) 57 , m_findBar( this )
55 , m_widgetStack( this ) 58 , m_widgetStack( this )
56 , m_packageList( this ) 59 , m_packageList( this )
57 , m_statusWidget( this ) 60 , m_statusWidget( this )
58 , m_statusText( &m_statusWidget ) 61 , m_statusText( &m_statusWidget )
59 , m_statusBar( &m_statusWidget ) 62 , m_statusBar( &m_statusWidget )
60 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 63 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
61 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 64 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
62 , m_iconNull( m_iconUpdated.size() ) 65 , m_iconNull( m_iconUpdated.size() )
63 , m_filterName( QString::null ) 66 , m_filterName( QString::null )
64 , m_filterServer( QString::null ) 67 , m_filterServer( QString::null )
65 , m_filterDest( QString::null ) 68 , m_filterDest( QString::null )
66 , m_filterStatus( OPackageManager::NotDefined ) 69 , m_filterStatus( OPackageManager::NotDefined )
67 , m_filterCategory( QString::null ) 70 , m_filterCategory( QString::null )
68 71
69{ 72{
70// setCaption( tr( "Package Manager" ) ); 73// setCaption( tr( "Package Manager" ) );
@@ -141,57 +144,55 @@ void MainWindow::initUI()
141 144
142 // Find toolbar 145 // Find toolbar
143 addToolBar( &m_findBar, QMainWindow::Top, true ); 146 addToolBar( &m_findBar, QMainWindow::Top, true );
144 m_findBar.setHorizontalStretchable( true ); 147 m_findBar.setHorizontalStretchable( true );
145 m_findEdit = new QLineEdit( &m_findBar ); 148 m_findEdit = new QLineEdit( &m_findBar );
146 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); 149 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
147 m_findBar.setStretchableWidget( m_findEdit ); 150 m_findBar.setStretchableWidget( m_findEdit );
148 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); 151 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) );
149 152
150 // Packages menu 153 // Packages menu
151 QPopupMenu *popup = new QPopupMenu( this ); 154 QPopupMenu *popup = new QPopupMenu( this );
152 155
153 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); 156 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 );
154 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 157 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
155 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); 158 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
156 a->addTo( popup ); 159 a->addTo( popup );
157 a->addTo( &m_toolBar ); 160 a->addTo( &m_toolBar );
158 161
159 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); 162 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 );
160 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 163 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
161 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); 164 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
162 actionUpgrade->addTo( popup ); 165 actionUpgrade->addTo( popup );
163 actionUpgrade->addTo( &m_toolBar ); 166 actionUpgrade->addTo( &m_toolBar );
164 167
165/*
166 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); 168 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
167 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); 169 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
168 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 170 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
169 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 171 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
170 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); 172 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
171 actionDownload->addTo( popup ); 173 actionDownload->addTo( popup );
172 actionDownload->addTo( &m_toolBar ); 174 actionDownload->addTo( &m_toolBar );
173*/
174 175
175 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); 176 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
176 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 177 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
177 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); 178 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
178 a->addTo( popup ); 179 a->addTo( popup );
179 a->addTo( &m_toolBar ); 180 a->addTo( &m_toolBar );
180 181
181 popup->insertSeparator(); 182 popup->insertSeparator();
182 183
183 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 184 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
184 a->setWhatsThis( tr( "Click here to configure this application." ) ); 185 a->setWhatsThis( tr( "Click here to configure this application." ) );
185 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); 186 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
186 a->addTo( popup ); 187 a->addTo( popup );
187 mb->insertItem( tr( "Actions" ), popup ); 188 mb->insertItem( tr( "Actions" ), popup );
188 189
189 // View menu 190 // View menu
190 popup = new QPopupMenu( this ); 191 popup = new QPopupMenu( this );
191 192
192 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 193 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
193 m_actionShowNotInstalled->setToggleAction( true ); 194 m_actionShowNotInstalled->setToggleAction( true );
194 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 195 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
195 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); 196 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
196 m_actionShowNotInstalled->addTo( popup ); 197 m_actionShowNotInstalled->addTo( popup );
197 198
@@ -349,99 +350,95 @@ void MainWindow::slotStatusBar( int currStep )
349void MainWindow::slotUpdate() 350void MainWindow::slotUpdate()
350{ 351{
351 // Create package manager output widget 352 // Create package manager output widget
352 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, 353 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false,
353 OPackage::Update ); 354 OPackage::Update );
354 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 355 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
355 356
356 // Display widget 357 // Display widget
357 m_widgetStack.addWidget( dlg, 3 ); 358 m_widgetStack.addWidget( dlg, 3 );
358 m_widgetStack.raiseWidget( dlg ); 359 m_widgetStack.raiseWidget( dlg );
359} 360}
360 361
361void MainWindow::slotUpgrade() 362void MainWindow::slotUpgrade()
362{ 363{
363 // Create package manager output widget 364 // Create package manager output widget
364 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, 365 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false,
365 OPackage::Upgrade ); 366 OPackage::Upgrade );
366 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 367 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
367 368
368 // Display widget 369 // Display widget
369 m_widgetStack.addWidget( dlg, 3 ); 370 m_widgetStack.addWidget( dlg, 3 );
370 m_widgetStack.raiseWidget( dlg ); 371 m_widgetStack.raiseWidget( dlg );
371} 372}
372 373
373/*
374void MainWindow::slotDownload() 374void MainWindow::slotDownload()
375{ 375{
376 // Retrieve list of packages selected for download (if any) 376 // Retrieve list of packages selected for download (if any)
377 QStringList *workingPackages = new QStringList(); 377 QStringList *workingPackages = new QStringList();
378 378
379 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 379 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
380 item != 0 ; 380 item != 0 ;
381 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 381 item = static_cast<QCheckListItem *>(item->nextSibling()) )
382 { 382 {
383 if ( item->isOn() ) 383 if ( item->isOn() )
384 workingPackages->append( item->text() ); 384 workingPackages->append( item->text() );
385 } 385 }
386 386
387 if ( workingPackages->isEmpty() ) 387 if ( workingPackages->isEmpty() )
388 { 388 {
389 // No packages were selected, prompt for URL of package to download 389 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
390 return;
390 } 391 }
391 else 392 else
392 { 393 {
393 // Download selected packages 394 // Download selected packages
394 m_config.setGroup( "settings" ); 395 m_config.setGroup( "settings" );
395 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); 396 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );
396 397
397// QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), workingDir, &ok, this ); 398 bool ok = false;
398// if ( ok && !text.isEmpty() ) 399 QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this );
399// workingDir = text; // user entered something and pressed ok 400 if ( ok && !text.isEmpty() )
400// else 401 workingDir = text; // user entered something and pressed ok
401// return; // user entered nothing or pressed cancel 402 else
403 return; // user entered nothing or pressed cancel
402 404
403// // Store download directory in config file 405 // Store download directory in config file
404// m_config.writeEntry( "DownloadDir", workingDir ); 406 m_config.writeEntry( "DownloadDir", workingDir );
405 407
406 // Get starting directory 408 // Get starting directory
407// char initDir[PATH_MAX]; 409 QDir::setCurrent( workingDir );
408// getcwd( initDir, PATH_MAX );
409
410 // Download packages
411
412 }
413 410
414 // Create package manager output widget 411 // Create package manager output widget
415 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, 412 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
416 OPackage::Download, workingPackages ); 413 OPackage::Download, workingPackages );
417 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 414 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
418 415
419 // Display widget 416 // Display widget
420 m_widgetStack.addWidget( dlg, 3 ); 417 m_widgetStack.addWidget( dlg, 3 );
421 m_widgetStack.raiseWidget( dlg ); 418 m_widgetStack.raiseWidget( dlg );
422} 419}
423*/ 420}
424 421
425void MainWindow::slotApply() 422void MainWindow::slotApply()
426{ 423{
427 QStringList *removeList = 0x0; 424 QStringList *removeList = 0x0;
428 QStringList *installList = 0x0; 425 QStringList *installList = 0x0;
429 QStringList *upgradeList = 0x0; 426 QStringList *upgradeList = 0x0;
430 427
431 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 428 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
432 item != 0 ; 429 item != 0 ;
433 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 430 item = static_cast<QCheckListItem *>(item->nextSibling()) )
434 { 431 {
435 if ( item->isOn() ) 432 if ( item->isOn() )
436 { 433 {
437 OPackage *package = m_packman.findPackage( item->text() ); 434 OPackage *package = m_packman.findPackage( item->text() );
438 if ( package ) 435 if ( package )
439 { 436 {
440 if ( !package->versionInstalled().isNull() ) 437 if ( !package->versionInstalled().isNull() )
441 { 438 {
442 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 439 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
443 { 440 {
444 // Remove/upgrade package 441 // Remove/upgrade package
445 int answer = PromptDlg::ask( tr( "Remove or upgrade" ), 442 int answer = PromptDlg::ask( tr( "Remove or upgrade" ),
446 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), 443 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ),
447 tr( "Remove" ), tr( "Upgrade" ), this ); 444 tr( "Remove" ), tr( "Upgrade" ), this );
@@ -505,48 +502,53 @@ void MainWindow::slotApply()
505 installCmd = OPackage::Install; 502 installCmd = OPackage::Install;
506 OPackage::Command upgradeCmd = OPackage::NotDefined; 503 OPackage::Command upgradeCmd = OPackage::NotDefined;
507 if ( upgradeList && !upgradeList->isEmpty() ) 504 if ( upgradeList && !upgradeList->isEmpty() )
508 upgradeCmd = OPackage::Upgrade; 505 upgradeCmd = OPackage::Upgrade;
509 506
510 // Create package manager output widget 507 // Create package manager output widget
511 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 508 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
512 removeCmd, removeList, 509 removeCmd, removeList,
513 installCmd, installList, 510 installCmd, installList,
514 upgradeCmd, upgradeList ); 511 upgradeCmd, upgradeList );
515 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 512 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
516 513
517 // Display widget 514 // Display widget
518 m_widgetStack.addWidget( dlg, 3 ); 515 m_widgetStack.addWidget( dlg, 3 );
519 m_widgetStack.raiseWidget( dlg ); 516 m_widgetStack.raiseWidget( dlg );
520} 517}
521 518
522void MainWindow::slotCloseInstallDlg() 519void MainWindow::slotCloseInstallDlg()
523{ 520{
524 // Close install dialog 521 // Close install dialog
525 delete m_widgetStack.visibleWidget(); 522 delete m_widgetStack.visibleWidget();
526 523
527 // Reload package list 524 // Reload package list
528 initPackageInfo(); 525 initPackageInfo();
526
527 // Update Opie launcher links
528 QCopEnvelope e("QPE/System", "linkChanged(QString)");
529 QString lf = QString::null;
530 e << lf;
529} 531}
530 532
531void MainWindow::slotConfigure() 533void MainWindow::slotConfigure()
532{ 534{
533 if ( m_packman.configureDlg( false ) ) 535 if ( m_packman.configureDlg( false ) )
534 { 536 {
535 if ( PromptDlg::ask( tr( "Config updated" ), 537 if ( PromptDlg::ask( tr( "Config updated" ),
536 tr( "The configuration has been updated. Do you want to update server and package information now?" ), 538 tr( "The configuration has been updated. Do you want to update server and package information now?" ),
537 tr( "Yes" ), tr( "No" ), this ) == 1 ) 539 tr( "Yes" ), tr( "No" ), this ) == 1 )
538 { 540 {
539 // Update package list and reload package info 541 // Update package list and reload package info
540 slotUpdate(); 542 slotUpdate();
541 } 543 }
542 } 544 }
543} 545}
544 546
545void MainWindow::slotShowNotInstalled() 547void MainWindow::slotShowNotInstalled()
546{ 548{
547 OPackageList *packageList; 549 OPackageList *packageList;
548 if ( m_actionShowNotInstalled->isOn() ) 550 if ( m_actionShowNotInstalled->isOn() )
549 { 551 {
550 m_actionShowInstalled->setOn( false ); 552 m_actionShowInstalled->setOn( false );
551 m_actionShowUpdated->setOn( false ); 553 m_actionShowUpdated->setOn( false );
552 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 554 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h
index 49bb66c..285cddf 100644
--- a/noncore/settings/packagemanager/mainwindow.h
+++ b/noncore/settings/packagemanager/mainwindow.h
@@ -93,44 +93,44 @@ private:
93 QString m_filterServer; // Cached server name filter value 93 QString m_filterServer; // Cached server name filter value
94 QString m_filterDest; // Cached destination name filter value 94 QString m_filterDest; // Cached destination name filter value
95 OPackageManager::Status m_filterStatus; // Cached status filter value 95 OPackageManager::Status m_filterStatus; // Cached status filter value
96 QString m_filterCategory; // Cached category filter value 96 QString m_filterCategory; // Cached category filter value
97 97
98 void initPackageList(); 98 void initPackageList();
99 void initStatusWidget(); 99 void initStatusWidget();
100 void initUI(); 100 void initUI();
101 101
102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); 102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true );
103 void searchForPackage( const QString &text ); 103 void searchForPackage( const QString &text );
104 104
105private slots: 105private slots:
106 void initPackageInfo(); 106 void initPackageInfo();
107 void slotWidgetStackShow( QWidget *widget ); 107 void slotWidgetStackShow( QWidget *widget );
108 108
109 // Status widget slots 109 // Status widget slots
110 void slotInitStatusBar( int numSteps ); 110 void slotInitStatusBar( int numSteps );
111 void slotStatusText( const QString &status ); 111 void slotStatusText( const QString &status );
112 void slotStatusBar( int currStep ); 112 void slotStatusBar( int currStep );
113 113
114 // Actions menu action slots 114 // Actions menu action slots
115 void slotUpdate(); 115 void slotUpdate();
116 void slotUpgrade(); 116 void slotUpgrade();
117// void slotDownload(); 117 void slotDownload();
118 void slotApply(); 118 void slotApply();
119 void slotCloseInstallDlg(); 119 void slotCloseInstallDlg();
120 void slotConfigure(); 120 void slotConfigure();
121 121
122 // View menu action slots 122 // View menu action slots
123 void slotShowNotInstalled(); 123 void slotShowNotInstalled();
124 void slotShowInstalled(); 124 void slotShowInstalled();
125 void slotShowUpdated(); 125 void slotShowUpdated();
126 void slotFilterChange(); 126 void slotFilterChange();
127 void slotFilter( bool isOn ); 127 void slotFilter( bool isOn );
128 128
129 // Find action slots 129 // Find action slots
130 void slotFindShowToolbar(); 130 void slotFindShowToolbar();
131 void slotFindHideToolbar(); 131 void slotFindHideToolbar();
132 void slotFindChanged( const QString &findText ); 132 void slotFindChanged( const QString &findText );
133 void slotFindNext(); 133 void slotFindNext();
134}; 134};
135 135
136#endif 136#endif
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index eeb0131..ed9ea10 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -306,50 +306,55 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
306 { 306 {
307 // TODO - connect to local slot and parse output before emitting execOutput 307 // TODO - connect to local slot and parse output before emitting execOutput
308 } 308 }
309 309
310 switch( command ) 310 switch( command )
311 { 311 {
312 case OPackage::Update : ipkg_lists_update( &m_ipkgArgs ); 312 case OPackage::Update : ipkg_lists_update( &m_ipkgArgs );
313 break; 313 break;
314 case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs ); 314 case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs );
315 break; 315 break;
316 case OPackage::Install : { 316 case OPackage::Install : {
317 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 317 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
318 { 318 {
319 ipkg_packages_install( &m_ipkgArgs, (*it) ); 319 ipkg_packages_install( &m_ipkgArgs, (*it) );
320 } 320 }
321 }; 321 };
322 break; 322 break;
323 case OPackage::Remove : { 323 case OPackage::Remove : {
324 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 324 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
325 { 325 {
326 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 326 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
327 } 327 }
328 }; 328 };
329 break; 329 break;
330 //case OPackage::Download : ; 330 case OPackage::Download : {
331 // break; 331 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
332 {
333 ipkg_packages_download( &m_ipkgArgs, (*it) );
334 }
335 };
336 break;
332 default : break; 337 default : break;
333 }; 338 };
334 339
335 return true; 340 return true;
336} 341}
337 342
338void OIpkg::ipkgOutput( char *msg ) 343void OIpkg::ipkgOutput( char *msg )
339{ 344{
340 emit execOutput( msg ); 345 emit execOutput( msg );
341} 346}
342 347
343void OIpkg::loadConfiguration() 348void OIpkg::loadConfiguration()
344{ 349{
345 if ( m_confInfo ) 350 if ( m_confInfo )
346 delete m_confInfo; 351 delete m_confInfo;
347 352
348 // Load configuration item list 353 // Load configuration item list
349 m_confInfo = new OConfItemList(); 354 m_confInfo = new OConfItemList();
350 355
351 QStringList confFiles; 356 QStringList confFiles;
352 QDir confDir( IPKG_CONF_DIR ); 357 QDir confDir( IPKG_CONF_DIR );
353 if ( confDir.exists() ) 358 if ( confDir.exists() )
354 { 359 {
355 confDir.setNameFilter( "*.conf" ); 360 confDir.setNameFilter( "*.conf" );
diff --git a/noncore/settings/packagemanager/packagemanager.pro b/noncore/settings/packagemanager/packagemanager.pro
index 55af13e..9a64322 100644
--- a/noncore/settings/packagemanager/packagemanager.pro
+++ b/noncore/settings/packagemanager/packagemanager.pro
@@ -1,36 +1,38 @@
1CONFIG = qt warn_on release quick-app 1CONFIG = qt warn_on release quick-app
2//TEMPLATE = app 2//TEMPLATE = app
3//CONFIG += qte warn_on debug 3//CONFIG += qte warn_on debug
4//DESTDIR = $(OPIEDIR)/bin 4//DESTDIR = $(OPIEDIR)/bin
5 5
6SOURCES = opackage.cpp \ 6SOURCES = opackage.cpp \
7 oconfitem.cpp \ 7 oconfitem.cpp \
8 oipkg.cpp \ 8 oipkg.cpp \
9 oipkgconfigdlg.cpp \ 9 oipkgconfigdlg.cpp \
10 opackagemanager.cpp \ 10 opackagemanager.cpp \
11 mainwindow.cpp \ 11 mainwindow.cpp \
12 installdlg.cpp \ 12 installdlg.cpp \
13 packageinfodlg.cpp \ 13 packageinfodlg.cpp \
14 filterdlg.cpp \ 14 filterdlg.cpp \
15 promptdlg.cpp \ 15 promptdlg.cpp \
16 entrydlg.cpp \
16 main.cpp 17 main.cpp
17HEADERS = opackage.h \ 18HEADERS = opackage.h \
18 oconfitem.h \ 19 oconfitem.h \
19 oipkg.h \ 20 oipkg.h \
20 oipkgconfigdlg.h \ 21 oipkgconfigdlg.h \
21 opackagemanager.h \ 22 opackagemanager.h \
22 mainwindow.h \ 23 mainwindow.h \
23 installdlg.h \ 24 installdlg.h \
24 packageinfodlg.h \ 25 packageinfodlg.h \
25 filterdlg.h \ 26 filterdlg.h \
26 promptdlg.h 27 promptdlg.h \
28 entrydlg.h
27 29
28DEFINES += IPKG_LIB 30DEFINES += IPKG_LIB
29DEFINES += HAVE_MKDTEMP 31DEFINES += HAVE_MKDTEMP
30TARGET = packagemanager 32TARGET = packagemanager
31INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR) 33INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR)
32DEPENDPATH += $(OPIEDIR)/include 34DEPENDPATH += $(OPIEDIR)/include
33LIBS += -lqpe -lopie -lipkg 35LIBS += -lqpe -lopie -lipkg
34 36
35include ( $(OPIEDIR)/include.pro ) 37include ( $(OPIEDIR)/include.pro )
36 38
diff --git a/noncore/settings/packagemanager/promptdlg.cpp b/noncore/settings/packagemanager/promptdlg.cpp
index 3122699..bb27190 100644
--- a/noncore/settings/packagemanager/promptdlg.cpp
+++ b/noncore/settings/packagemanager/promptdlg.cpp
@@ -24,49 +24,49 @@
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 "promptdlg.h" 30#include "promptdlg.h"
31 31
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qwidgetlist.h> 35#include <qwidgetlist.h>
36 36
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38 38
39PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2, 39PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
40 QWidget *parent ) 40 QWidget *parent )
41 : QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog ) 41 : QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog )
42 , m_btnClicked( -1 ) 42 , m_btnClicked( -1 )
43{ 43{
44 setCaption( caption ); 44 setCaption( caption );
45 45
46 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 ); 46 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 );
47 QLabel *label = new QLabel( text, this ); 47 QLabel *label = new QLabel( text, this );
48 label->setAlignment( AlignCenter | WordBreak ); 48 label->setAlignment( AlignCenter | AlignTop | WordBreak );
49 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 49 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
50 50
51 QPushButton *btn = new QPushButton( btn1, this ); 51 QPushButton *btn = new QPushButton( btn1, this );
52 layout->addWidget( btn, 1, 0 ); 52 layout->addWidget( btn, 1, 0 );
53 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) ); 53 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) );
54 54
55 btn = new QPushButton( btn2, this ); 55 btn = new QPushButton( btn2, this );
56 layout->addWidget( btn, 1, 1 ); 56 layout->addWidget( btn, 1, 1 );
57 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) ); 57 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) );
58} 58}
59 59
60int PromptDlg::exec() 60int PromptDlg::exec()
61{ 61{
62 // Determine position of dialog. Derived from QT's QDialog::show() method. 62 // Determine position of dialog. Derived from QT's QDialog::show() method.
63 QWidget *w = parentWidget(); 63 QWidget *w = parentWidget();
64 QPoint p( 0, 0 ); 64 QPoint p( 0, 0 );
65 int extraw = 0, extrah = 0; 65 int extraw = 0, extrah = 0;
66 QWidget * desk = QApplication::desktop(); 66 QWidget * desk = QApplication::desktop();
67 if ( w ) 67 if ( w )
68 w = w->topLevelWidget(); 68 w = w->topLevelWidget();
69 69
70 QWidgetList *list = QApplication::topLevelWidgets(); 70 QWidgetList *list = QApplication::topLevelWidgets();
71 QWidgetListIt it( *list ); 71 QWidgetListIt it( *list );
72 while ( (extraw == 0 || extrah == 0) && it.current() != 0 ) 72 while ( (extraw == 0 || extrah == 0) && it.current() != 0 )