summaryrefslogtreecommitdiff
authordrw <drw>2004-04-21 18:20:31 (UTC)
committer drw <drw>2004-04-21 18:20:31 (UTC)
commitac414fa3802b471857bc84ecdd0d37200541b0a7 (patch) (unidiff)
treeb3557b5f67444c891f98fd3153a30d2cbd765636
parenta3c0ad0bddfdfd2a2ed476229df1ef8032a93871 (diff)
downloadopie-ac414fa3802b471857bc84ecdd0d37200541b0a7.zip
opie-ac414fa3802b471857bc84ecdd0d37200541b0a7.tar.gz
opie-ac414fa3802b471857bc84ecdd0d37200541b0a7.tar.bz2
Added some missed QWhatsThis, removed OConfItem location as it is not used/needed, reordered includes to follow conventions, removed all using namespaces occurrances and updated documentation
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog9
-rw-r--r--noncore/settings/packagemanager/README2
-rw-r--r--noncore/settings/packagemanager/TODO9
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp4
-rw-r--r--noncore/settings/packagemanager/filterdlg.h4
-rw-r--r--noncore/settings/packagemanager/global.h37
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp15
-rw-r--r--noncore/settings/packagemanager/main.cpp3
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp22
-rw-r--r--noncore/settings/packagemanager/mainwindow.h8
-rw-r--r--noncore/settings/packagemanager/oconfitem.cpp5
-rw-r--r--noncore/settings/packagemanager/oconfitem.h35
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp7
-rw-r--r--noncore/settings/packagemanager/oipkg.h14
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp17
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.h16
-rw-r--r--noncore/settings/packagemanager/opackagemanager.cpp6
-rw-r--r--noncore/settings/packagemanager/opackagemanager.h8
-rw-r--r--noncore/settings/packagemanager/opie-packagemanager.control2
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.cpp13
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.h4
-rw-r--r--noncore/settings/packagemanager/promptdlg.cpp4
22 files changed, 105 insertions, 139 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index d53a2b3..c9e33c4 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,28 +1,37 @@
12004-04-21 Dan Williams <drw@handhelds.org>
2
3 * Released version 0.4.0
4 * Added saving of ipkg configuration information
5 * Re-initialize ipkg when configuration information changes
6 * Added QWhatsThis for all UI controls
7 * Remove Location from OConfItem as it is not used/needed
8 * Re-ordered includes to follow Opie standards
9
12004-02-13 Dan Williams <drw@handhelds.org> 102004-02-13 Dan Williams <drw@handhelds.org>
2 11
3 * Released version 0.3.0 12 * Released version 0.3.0
4 * Fix handling of filtering options in View menu 13 * Fix handling of filtering options in View menu
5 * Do proper version string comparison 14 * Do proper version string comparison
6 * Fix string alignment code in PromptDlg to eliminate QT warning messages 15 * Fix string alignment code in PromptDlg to eliminate QT warning messages
7 16
82004-02-12 Dan Williams <drw@handhelds.org> 172004-02-12 Dan Williams <drw@handhelds.org>
9 18
10 * Package information dialog implemented 19 * Package information dialog implemented
11 * What's This app icon enabled 20 * What's This app icon enabled
12 * Changed all QDialog::exec() occurences to QPEApplication::execDialog() 21 * Changed all QDialog::exec() occurences to QPEApplication::execDialog()
13 22
142004-01-23 Dan Williams <drw@handhelds.org> 232004-01-23 Dan Williams <drw@handhelds.org>
15 24
16 * Added package download functionality 25 * Added package download functionality
17 * Have Opie update links after install/removal so that apps 26 * Have Opie update links after install/removal so that apps
18 will display properly in Launcher 27 will display properly in Launcher
19 28
202004-01-20 Dan Williams <drw@handhelds.org> 292004-01-20 Dan Williams <drw@handhelds.org>
21 30
22 * Released version 0.2.0 31 * Released version 0.2.0
23 * Converted to use libipkg in place of spawning ipkg process 32 * Converted to use libipkg in place of spawning ipkg process
24 33
252004-01-13 Dan Williams <drw@handhelds.org> 342004-01-13 Dan Williams <drw@handhelds.org>
26 35
27 * Released version 0.1.0 36 * Released version 0.1.0
28 * Initial check-in of new package management client to eventually replace AQPkg 37 * Initial check-in of new package management client to eventually replace AQPkg
diff --git a/noncore/settings/packagemanager/README b/noncore/settings/packagemanager/README
index 9324f9c..bf93c98 100644
--- a/noncore/settings/packagemanager/README
+++ b/noncore/settings/packagemanager/README
@@ -1,55 +1,55 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Package Manager 3/* Opie - Package Manager
4/* ======================== 4/* ========================
5/* Version 0.3.0 5/* Version 0.4.0
6/* 6/*
7/* A package management client for Opie 7/* A package management client for Opie
8/* 8/*
9/************************************************************************ 9/************************************************************************
10 10
11------------------------------------------------------- 11-------------------------------------------------------
12 Release Notes for Opie-PackageManager - January, 2004 12 Release Notes for Opie-PackageManager - January, 2004
13------------------------------------------------------- 13-------------------------------------------------------
14 14
15====================== 15======================
16= To-do = 16= To-do =
17====================== 17======================
18 18
19- See $OPIEDIR/noncore/settings/packagemanager/TODO for more info. 19- See $OPIEDIR/noncore/settings/packagemanager/TODO for more info.
20 20
21====================== 21======================
22= Build = 22= Build =
23====================== 23======================
24 24
25In order to build opie-packagemanager, libipkg needs to be present on 25In order to build opie-packagemanager, libipkg needs to be present on
26the build system along with the appropriate headers. 26the build system along with the appropriate headers.
27 27
28- libipkg source (best to use version 109 or greater): 28- libipkg source (best to use version 109 or greater):
29 - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C') 29 - Familiar CVS directory: familiar/dist/ipkg/C (e.g. 'cvs co familiar/dist/ipkg/C')
30 - FTP: ftp://handhelds.org/linux/packages/ipkg 30 - FTP: ftp://handhelds.org/linux/packages/ipkg
31 31
32- before building opie-packagemanager, define the environmental variable 32- before building opie-packagemanager, define the environmental variable
33 IPKGDIR to point to the directory containing the ipkg source code 33 IPKGDIR to point to the directory containing the ipkg source code
34 - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C' 34 - e.g. 'export IPKGDIR=$HOME/familiar/dist/ipkg/C'
35 35
36====================== 36======================
37= Run = 37= Run =
38====================== 38======================
39 39
40- In order to use opie-packagemanager, libipkg must be installed 40- In order to use opie-packagemanager, libipkg must be installed
41 on the system. 41 on the system.
42 42
43====================== 43======================
44= Credits = 44= Credits =
45====================== 45======================
46 46
47- Opie-PackageManager is (C) 2003-2004 Dan Williams 47- Opie-PackageManager is (C) 2003-2004 Dan Williams
48 48
49====================== 49======================
50= Links = 50= Links =
51====================== 51======================
52 52
53- Opie Project: http://opie.handhelds.org 53- Opie Project: http://opie.handhelds.org
54- OpenZaurus Project: http://openzaurus.org 54- OpenZaurus Project: http://openzaurus.org
55- Familiar Project: http://familiar.handhelds.org 55- Familiar Project: http://familiar.handhelds.org
diff --git a/noncore/settings/packagemanager/TODO b/noncore/settings/packagemanager/TODO
index 448ade3..633c589 100644
--- a/noncore/settings/packagemanager/TODO
+++ b/noncore/settings/packagemanager/TODO
@@ -1,28 +1,27 @@
1/************************************************************************ 1/************************************************************************
2/* 2/*
3/* Opie - Package Manager 3/* Opie - Package Manager
4/* ======================== 4/* ========================
5/* Version 0.3.0 5/* Version 0.4.0
6/* 6/*
7/* A package management client for Opie 7/* A package management client for Opie
8/* 8/*
9/************************************************************************ 9/************************************************************************
10 10
11--------------------------------------------- 11---------------------------------------------
12 To-do for Opie-PackageManager - April, 2004 12 To-do for Opie-PackageManager - April, 2004
13--------------------------------------------- 13---------------------------------------------
14 14
15====================== 15======================
16= Current release = 16= Current release =
17====================== 17======================
18 18
191. Save configuration information (i.e. /etc/ipkg.conf) 191. Link non-root destination apps
202. Link non-root destination apps 202. Implement QCOP interface for installing, removing, etc.
213. Implement QCOP interface for installing, removing, etc. 213. Redesign configuration dialog
224. Redesign configuration dialog
23 22
24====================== 23======================
25= Future releases = 24= Future releases =
26====================== 25======================
27 26
281. ??? \ No newline at end of file 271. ??? \ No newline at end of file
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
index 663abd2..fd275e1 100644
--- a/noncore/settings/packagemanager/entrydlg.cpp
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -1,85 +1,85 @@
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) 2004 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2004 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 "entrydlg.h" 30#include "entrydlg.h"
31 31
32#include <qpe/qpeapplication.h>
33
32#include <qlabel.h> 34#include <qlabel.h>
33#include <qlayout.h> 35#include <qlayout.h>
34#include <qlineedit.h> 36#include <qlineedit.h>
35#include <qpushbutton.h> 37#include <qpushbutton.h>
36 38
37#include <qpe/qpeapplication.h>
38
39EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) 39EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
40 : QDialog( parent, name, modal ) 40 : QDialog( parent, name, modal )
41{ 41{
42 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); 42 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
43 43
44 QLabel *l = new QLabel( label, this ); 44 QLabel *l = new QLabel( label, this );
45 l->setAlignment( AlignLeft | AlignTop | WordBreak ); 45 l->setAlignment( AlignLeft | AlignTop | WordBreak );
46 vbox->addWidget( l ); 46 vbox->addWidget( l );
47 47
48 m_entry = new QLineEdit( this ); 48 m_entry = new QLineEdit( this );
49 vbox->addWidget( m_entry ); 49 vbox->addWidget( m_entry );
50 50
51 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) ); 51 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) );
52} 52}
53 53
54void EntryDlg::setText( const QString &text ) 54void EntryDlg::setText( const QString &text )
55{ 55{
56 m_entry->setText( text ); 56 m_entry->setText( text );
57 m_entry->selectAll(); 57 m_entry->selectAll();
58} 58}
59 59
60QString EntryDlg::getText() 60QString EntryDlg::getText()
61{ 61{
62 return m_entry->text(); 62 return m_entry->text();
63} 63}
64 64
65QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok, 65QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
66 QWidget *parent, const char *name ) 66 QWidget *parent, const char *name )
67{ 67{
68 EntryDlg *dlg = new EntryDlg( label, parent, name, true ); 68 EntryDlg *dlg = new EntryDlg( label, parent, name, true );
69 dlg->setCaption( caption ); 69 dlg->setCaption( caption );
70 dlg->setText( text ); 70 dlg->setText( text );
71 71
72 QString result; 72 QString result;
73 73
74 *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted ); 74 *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted );
75 if ( *ok ) 75 if ( *ok )
76 result = dlg->getText(); 76 result = dlg->getText();
77 77
78 delete dlg; 78 delete dlg;
79 return result; 79 return result;
80} 80}
81void EntryDlg::tryAccept() 81void EntryDlg::tryAccept()
82{ 82{
83 if ( !m_entry->text().isEmpty() ) 83 if ( !m_entry->text().isEmpty() )
84 accept(); 84 accept();
85} 85}
diff --git a/noncore/settings/packagemanager/filterdlg.h b/noncore/settings/packagemanager/filterdlg.h
index de9ea80..bd89b42 100644
--- a/noncore/settings/packagemanager/filterdlg.h
+++ b/noncore/settings/packagemanager/filterdlg.h
@@ -1,101 +1,101 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5             .=l. 5             .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#ifndef FILTERDLG_H 30#ifndef FILTERDLG_H
31#define FILTERDLG_H 31#define FILTERDLG_H
32 32
33#include "opackagemanager.h"
34
33#include <qcheckbox.h> 35#include <qcheckbox.h>
34#include <qdialog.h> 36#include <qdialog.h>
35#include <qcombobox.h> 37#include <qcombobox.h>
36#include <qlayout.h> 38#include <qlayout.h>
37#include <qlineedit.h> 39#include <qlineedit.h>
38#include <qscrollview.h> 40#include <qscrollview.h>
39 41
40#include "opackagemanager.h"
41
42class FilterDlg : public QDialog 42class FilterDlg : public QDialog
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 45
46public: 46public:
47 FilterDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &name = 0x0, 47 FilterDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &name = 0x0,
48 const QString &server = 0x0, const QString &destination = 0x0, 48 const QString &server = 0x0, const QString &destination = 0x0,
49 OPackageManager::Status status = OPackageManager::All, 49 OPackageManager::Status status = OPackageManager::All,
50 const QString &category = 0x0 ); 50 const QString &category = 0x0 );
51 51
52 QString name() 52 QString name()
53 { return m_nameCB->isChecked() ? m_name->text() : QString::null; }; 53 { return m_nameCB->isChecked() ? m_name->text() : QString::null; };
54 QString server() 54 QString server()
55 { return m_serverCB->isChecked() ? m_server->currentText() : QString::null; }; 55 { return m_serverCB->isChecked() ? m_server->currentText() : QString::null; };
56 QString destination() 56 QString destination()
57 { return m_destCB->isChecked() ? m_destination->currentText() : QString::null; }; 57 { return m_destCB->isChecked() ? m_destination->currentText() : QString::null; };
58 OPackageManager::Status status() 58 OPackageManager::Status status()
59 { 59 {
60 if ( m_statusCB->isChecked() ) 60 if ( m_statusCB->isChecked() )
61 { 61 {
62 if ( m_status->currentText() == tr( "All" ) ) 62 if ( m_status->currentText() == tr( "All" ) )
63 return OPackageManager::All; 63 return OPackageManager::All;
64 else if ( m_status->currentText() == tr( "Installed" ) ) 64 else if ( m_status->currentText() == tr( "Installed" ) )
65 return OPackageManager::Installed; 65 return OPackageManager::Installed;
66 else if ( m_status->currentText() == tr( "Not installed" ) ) 66 else if ( m_status->currentText() == tr( "Not installed" ) )
67 return OPackageManager::NotInstalled; 67 return OPackageManager::NotInstalled;
68 else if ( m_status->currentText() == tr( "Updated" ) ) 68 else if ( m_status->currentText() == tr( "Updated" ) )
69 return OPackageManager::Updated; 69 return OPackageManager::Updated;
70 } 70 }
71 71
72 return OPackageManager::NotDefined; 72 return OPackageManager::NotDefined;
73 }; 73 };
74 QString category() 74 QString category()
75 { return m_categoryCB->isChecked() ? m_category->currentText() : QString::null; }; 75 { return m_categoryCB->isChecked() ? m_category->currentText() : QString::null; };
76 76
77private: 77private:
78 QCheckBox *m_nameCB; 78 QCheckBox *m_nameCB;
79 QCheckBox *m_serverCB; 79 QCheckBox *m_serverCB;
80 QCheckBox *m_destCB; 80 QCheckBox *m_destCB;
81 QCheckBox *m_statusCB; 81 QCheckBox *m_statusCB;
82 QCheckBox *m_categoryCB; 82 QCheckBox *m_categoryCB;
83 83
84 QLineEdit *m_name; 84 QLineEdit *m_name;
85 QComboBox *m_server; 85 QComboBox *m_server;
86 QComboBox *m_destination; 86 QComboBox *m_destination;
87 QComboBox *m_status; 87 QComboBox *m_status;
88 QComboBox *m_category; 88 QComboBox *m_category;
89 89
90 void initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ); 90 void initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection );
91 91
92private slots: 92private slots:
93 void slotNameSelected( bool ); 93 void slotNameSelected( bool );
94 void slotServerSelected( bool ); 94 void slotServerSelected( bool );
95 void slotDestSelected( bool ); 95 void slotDestSelected( bool );
96 void slotStatusSelected( bool ); 96 void slotStatusSelected( bool );
97 void slotStatusChanged( const QString & ); 97 void slotStatusChanged( const QString & );
98 void slotCategorySelected( bool ); 98 void slotCategorySelected( bool );
99}; 99};
100 100
101#endif 101#endif
diff --git a/noncore/settings/packagemanager/global.h b/noncore/settings/packagemanager/global.h
deleted file mode 100644
index 0fe5b85..0000000
--- a/noncore/settings/packagemanager/global.h
+++ b/dev/null
@@ -1,37 +0,0 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2003 Dan Williams <drw@handhelds.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#ifndef GLOBAL_H
33#define GLOBAL_H
34
35#define VERSION "0.0.0"
36
37#endif \ No newline at end of file
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 4a55c10..0cb30e2 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -1,148 +1,147 @@
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 <sys/vfs.h> 32#include <opie2/ofiledialog.h>
33
34#include <qpe/fileselector.h>
35#include <qpe/resource.h>
36#include <qpe/storage.h>
33 37
34#include <qapplication.h> 38#include <qapplication.h>
35#include <qcombobox.h> 39#include <qcombobox.h>
36#include <qfileinfo.h> 40#include <qfileinfo.h>
37#include <qgroupbox.h> 41#include <qgroupbox.h>
38#include <qlabel.h> 42#include <qlabel.h>
39#include <qlayout.h> 43#include <qlayout.h>
40#include <qmap.h> 44#include <qmap.h>
41#include <qmultilineedit.h> 45#include <qmultilineedit.h>
42#include <qpushbutton.h> 46#include <qpushbutton.h>
43 47
44#include <qpe/fileselector.h> 48#include <sys/vfs.h>
45#include <qpe/resource.h>
46#include <qpe/storage.h>
47
48#include <opie2/ofiledialog.h>
49 49
50#include "opackagemanager.h" 50#include "opackagemanager.h"
51 51
52using namespace Opie::Ui;
53InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, 52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo,
54 OPackage::Command command1, QStringList *packages1, 53 OPackage::Command command1, QStringList *packages1,
55 OPackage::Command command2, QStringList *packages2, 54 OPackage::Command command2, QStringList *packages2,
56 OPackage::Command command3, QStringList *packages3 ) 55 OPackage::Command command3, QStringList *packages3 )
57 : QWidget( 0x0 ) 56 : QWidget( 0x0 )
58 , m_packman( pm ) 57 , m_packman( pm )
59 , m_numCommands( 0 ) 58 , m_numCommands( 0 )
60 , m_currCommand( 0 ) 59 , m_currCommand( 0 )
61{ 60{
62 // Save command/package list information 61 // Save command/package list information
63 if ( command1 != OPackage::NotDefined ) 62 if ( command1 != OPackage::NotDefined )
64 { 63 {
65 m_command[ m_numCommands ] = command1; 64 m_command[ m_numCommands ] = command1;
66 m_packages[ m_numCommands ] = packages1; 65 m_packages[ m_numCommands ] = packages1;
67 ++m_numCommands; 66 ++m_numCommands;
68 } 67 }
69 if ( command2 != OPackage::NotDefined ) 68 if ( command2 != OPackage::NotDefined )
70 { 69 {
71 m_command[ m_numCommands ] = command2; 70 m_command[ m_numCommands ] = command2;
72 m_packages[ m_numCommands ] = packages2; 71 m_packages[ m_numCommands ] = packages2;
73 ++m_numCommands; 72 ++m_numCommands;
74 } 73 }
75 if ( command3 != OPackage::NotDefined ) 74 if ( command3 != OPackage::NotDefined )
76 { 75 {
77 m_command[ m_numCommands ] = command3; 76 m_command[ m_numCommands ] = command3;
78 m_packages[ m_numCommands ] = packages3; 77 m_packages[ m_numCommands ] = packages3;
79 ++m_numCommands; 78 ++m_numCommands;
80 } 79 }
81 80
82 // Initialize UI 81 // Initialize UI
83 if ( parent ) 82 if ( parent )
84 parent->setCaption( caption ); 83 parent->setCaption( caption );
85 84
86 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); 85 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 );
87 86
88 if ( showDestInfo ) 87 if ( showDestInfo )
89 { 88 {
90 QLabel *label = new QLabel( tr( "Destination" ), this ); 89 QLabel *label = new QLabel( tr( "Destination" ), this );
91 layout->addWidget( label, 0, 0 ); 90 layout->addWidget( label, 0, 0 );
92 m_destination = new QComboBox( this ); 91 m_destination = new QComboBox( this );
93 m_destination->insertStringList( *(m_packman->destinations()) ); 92 m_destination->insertStringList( *(m_packman->destinations()) );
94 layout->addWidget( m_destination, 0, 1 ); 93 layout->addWidget( m_destination, 0, 1 );
95 connect( m_destination, SIGNAL(highlighted(const QString&)), 94 connect( m_destination, SIGNAL(highlighted(const QString&)),
96 this, SLOT(slotDisplayAvailSpace(const QString&)) ); 95 this, SLOT(slotDisplayAvailSpace(const QString&)) );
97 96
98 label = new QLabel( tr( "Space Avail" ), this ); 97 label = new QLabel( tr( "Space Avail" ), this );
99 layout->addWidget( label, 1, 0 ); 98 layout->addWidget( label, 1, 0 );
100 m_availSpace = new QLabel( this ); 99 m_availSpace = new QLabel( this );
101 layout->addWidget( m_availSpace, 1, 1 ); 100 layout->addWidget( m_availSpace, 1, 1 );
102 101
103 // TODO - select correct destination 102 // TODO - select correct destination
104 slotDisplayAvailSpace( m_destination->currentText() ); 103 slotDisplayAvailSpace( m_destination->currentText() );
105 } 104 }
106 else 105 else
107 { 106 {
108 m_destination = 0x0; 107 m_destination = 0x0;
109 m_availSpace = 0x0; 108 m_availSpace = 0x0;
110 } 109 }
111 110
112 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 111 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
113 groupBox->layout()->setSpacing( 0 ); 112 groupBox->layout()->setSpacing( 0 );
114 groupBox->layout()->setMargin( 4 ); 113 groupBox->layout()->setMargin( 4 );
115 114
116 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); 115 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() );
117 m_output = new QMultiLineEdit( groupBox ); 116 m_output = new QMultiLineEdit( groupBox );
118 m_output->setReadOnly( true ); 117 m_output->setReadOnly( true );
119 groupBoxLayout->addWidget( m_output ); 118 groupBoxLayout->addWidget( m_output );
120 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); 119 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 );
121 120
122 m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); 121 m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this );
123 layout->addWidget( m_btnStart, 3, 0 ); 122 layout->addWidget( m_btnStart, 3, 0 );
124 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); 123 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) );
125 124
126 m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 125 m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
127 layout->addWidget( m_btnOptions, 3, 1 ); 126 layout->addWidget( m_btnOptions, 3, 1 );
128 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); 127 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) );
129 128
130 // Display packages being acted upon in output widget 129 // Display packages being acted upon in output widget
131 for( int i = 0; i < m_numCommands; i++ ) 130 for( int i = 0; i < m_numCommands; i++ )
132 { 131 {
133 if ( m_packages[ i ] ) 132 if ( m_packages[ i ] )
134 { 133 {
135 QString lineStr = tr( "Packages to " ); 134 QString lineStr = tr( "Packages to " );
136 135
137 switch( m_command[ i ] ) 136 switch( m_command[ i ] )
138 { 137 {
139 case OPackage::Install : lineStr.append( tr( "install" ) ); 138 case OPackage::Install : lineStr.append( tr( "install" ) );
140 break; 139 break;
141 case OPackage::Remove : lineStr.append( tr( "remove" ) ); 140 case OPackage::Remove : lineStr.append( tr( "remove" ) );
142 break; 141 break;
143 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); 142 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
144 break; 143 break;
145 case OPackage::Download : lineStr.append( tr( "download" ) ); 144 case OPackage::Download : lineStr.append( tr( "download" ) );
146 break; 145 break;
147 default : 146 default :
148 break; 147 break;
@@ -183,120 +182,120 @@ void InstallDlg::slotDisplayAvailSpace( const QString &destination )
183 // Get destination 182 // Get destination
184 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination ); 183 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination );
185 184
186 if ( dest ) 185 if ( dest )
187 { 186 {
188 // Calculate available space 187 // Calculate available space
189 struct statfs fs; 188 struct statfs fs;
190 if ( !statfs( dest->value(), &fs ) ) 189 if ( !statfs( dest->value(), &fs ) )
191 { 190 {
192 long mult = fs.f_bsize / 1024; 191 long mult = fs.f_bsize / 1024;
193 long div = 1024 / fs.f_bsize; 192 long div = 1024 / fs.f_bsize;
194 193
195 if ( !mult ) mult = 1; 194 if ( !mult ) mult = 1;
196 if ( !div ) div = 1; 195 if ( !div ) div = 1;
197 long avail = fs.f_bavail * mult / div; 196 long avail = fs.f_bavail * mult / div;
198 197
199 space = tr( "%1 Kb" ).arg( avail ); 198 space = tr( "%1 Kb" ).arg( avail );
200 } 199 }
201 } 200 }
202 201
203 // Display available space 202 // Display available space
204 m_availSpace->setText( space ); 203 m_availSpace->setText( space );
205} 204}
206 205
207void InstallDlg::slotBtnStart() 206void InstallDlg::slotBtnStart()
208{ 207{
209 QString btnText = m_btnStart->text(); 208 QString btnText = m_btnStart->text();
210 if ( btnText == tr( "Abort" ) ) 209 if ( btnText == tr( "Abort" ) )
211 { 210 {
212 // Prevent unexecuted commands from executing 211 // Prevent unexecuted commands from executing
213 m_currCommand = 999; 212 m_currCommand = 999;
214 213
215 // Allow user to close dialog 214 // Allow user to close dialog
216 m_btnStart->setText( tr( "Close" ) ); 215 m_btnStart->setText( tr( "Close" ) );
217 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 216 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
218 return; 217 return;
219 } 218 }
220 else if ( btnText == tr( "Close" ) ) 219 else if ( btnText == tr( "Close" ) )
221 { 220 {
222 // TODO - force reload of package data 221 // TODO - force reload of package data
223 emit closeInstallDlg(); 222 emit closeInstallDlg();
224 return; 223 return;
225 } 224 }
226 225
227 // Start was clicked, start executing 226 // Start was clicked, start executing
228 m_btnOptions->setEnabled( false ); 227 m_btnOptions->setEnabled( false );
229 if ( m_numCommands > 1 ) 228 if ( m_numCommands > 1 )
230 { 229 {
231 m_btnStart->setText( tr( "Abort" ) ); 230 m_btnStart->setText( tr( "Abort" ) );
232 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); 231 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) );
233 } 232 }
234 else 233 else
235 { 234 {
236 m_btnStart->setEnabled( false ); 235 m_btnStart->setEnabled( false );
237 } 236 }
238 237
239 QString dest; 238 QString dest;
240 if ( m_destination ) 239 if ( m_destination )
241 dest = m_destination->currentText(); 240 dest = m_destination->currentText();
242 241
243 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) 242 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
244 { 243 {
245 // Execute next command 244 // Execute next command
246 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, 245 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
247 this, SLOT(slotOutput(char*)), true ); 246 this, SLOT(slotOutput(char*)), true );
248 } 247 }
249 248
250 // All commands executed, allow user to close dialog 249 // All commands executed, allow user to close dialog
251 m_btnStart->setEnabled( true ); 250 m_btnStart->setEnabled( true );
252 m_btnStart->setText( tr( "Close" ) ); 251 m_btnStart->setText( tr( "Close" ) );
253 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 252 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
254 253
255 m_btnOptions->setEnabled( true ); 254 m_btnOptions->setEnabled( true );
256 m_btnOptions->setText( tr( "Save output" ) ); 255 m_btnOptions->setText( tr( "Save output" ) );
257 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); 256 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
258} 257}
259 258
260void InstallDlg::slotBtnOptions() 259void InstallDlg::slotBtnOptions()
261{ 260{
262 QString btnText = m_btnOptions->text(); 261 QString btnText = m_btnOptions->text();
263 if ( btnText == tr( "Options" ) ) 262 if ( btnText == tr( "Options" ) )
264 { 263 {
265 // Display configuration dialog (only options tab is enabled) 264 // Display configuration dialog (only options tab is enabled)
266 m_packman->configureDlg( true ); 265 m_packman->configureDlg( true );
267 return; 266 return;
268 } 267 }
269 268
270 // Save output was clicked 269 // Save output was clicked
271 QMap<QString, QStringList> map; 270 QMap<QString, QStringList> map;
272 map.insert( tr( "All" ), QStringList() ); 271 map.insert( tr( "All" ), QStringList() );
273 QStringList text; 272 QStringList text;
274 text << "text/*"; 273 text << "text/*";
275 map.insert(tr( "Text" ), text ); 274 map.insert(tr( "Text" ), text );
276 text << "*"; 275 text << "*";
277 map.insert( tr( "All" ), text ); 276 map.insert( tr( "All" ), text );
278 277
279 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 278 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
280 if( !filename.isEmpty() ) 279 if( !filename.isEmpty() )
281 { 280 {
282 QString currentFileName = QFileInfo( filename ).fileName(); 281 QString currentFileName = QFileInfo( filename ).fileName();
283 DocLnk doc; 282 DocLnk doc;
284 doc.setType( "text/plain" ); 283 doc.setType( "text/plain" );
285 doc.setFile( filename ); 284 doc.setFile( filename );
286 doc.setName( currentFileName ); 285 doc.setName( currentFileName );
287 FileManager fm; 286 FileManager fm;
288 fm.saveFile( doc, m_output->text() ); 287 fm.saveFile( doc, m_output->text() );
289 } 288 }
290} 289}
291 290
292void InstallDlg::slotOutput( char *msg ) 291void InstallDlg::slotOutput( char *msg )
293{ 292{
294 // Allow processing of other events 293 // Allow processing of other events
295 qApp->processEvents(); 294 qApp->processEvents();
296 295
297 QString lineStr = msg; 296 QString lineStr = msg;
298 if ( lineStr[lineStr.length()-1] == '\n' ) 297 if ( lineStr[lineStr.length()-1] == '\n' )
299 lineStr.truncate( lineStr.length() - 1 ); 298 lineStr.truncate( lineStr.length() - 1 );
300 m_output->append( lineStr ); 299 m_output->append( lineStr );
301 m_output->setCursorPosition( m_output->numLines(), 0 ); 300 m_output->setCursorPosition( m_output->numLines(), 0 );
302} 301}
diff --git a/noncore/settings/packagemanager/main.cpp b/noncore/settings/packagemanager/main.cpp
index c050e1a..3792881 100644
--- a/noncore/settings/packagemanager/main.cpp
+++ b/noncore/settings/packagemanager/main.cpp
@@ -1,35 +1,34 @@
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 "mainwindow.h" 30#include "mainwindow.h"
31 31
32#include <opie2/oapplicationfactory.h> 32#include <opie2/oapplicationfactory.h>
33 33
34using namespace Opie::Core; 34OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> )
35OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 810046f..991cc81 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,147 +1,147 @@
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 "mainwindow.h"
31#include "installdlg.h"
32#include "filterdlg.h"
33#include "promptdlg.h"
34#include "entrydlg.h"
35#include "packageinfodlg.h"
36
37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h>
39#include <qpe/resource.h>
40
30#include <qaction.h> 41#include <qaction.h>
31#include <qdir.h> 42#include <qdir.h>
32#include <qlayout.h> 43#include <qlayout.h>
33#include <qlineedit.h> 44#include <qlineedit.h>
34#include <qmenubar.h> 45#include <qmenubar.h>
35#include <qmessagebox.h> 46#include <qmessagebox.h>
36#include <qpopupmenu.h> 47#include <qpopupmenu.h>
37#include <qtimer.h> 48#include <qtimer.h>
38#include <qtoolbar.h> 49#include <qtoolbar.h>
39#include <qwhatsthis.h> 50#include <qwhatsthis.h>
40 51
41#include <qpe/qcopenvelope_qws.h>
42#include <qpe/qpeapplication.h>
43#include <qpe/resource.h>
44
45#include "mainwindow.h"
46#include "installdlg.h"
47#include "filterdlg.h"
48#include "promptdlg.h"
49#include "entrydlg.h"
50#include "packageinfodlg.h"
51
52MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) 52MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
53 : QMainWindow( parent, name, WStyle_ContextHelp ) 53 : QMainWindow( parent, name, WStyle_ContextHelp )
54 , m_config( "packman" ) 54 , m_config( "packman" )
55 , m_packman( &m_config, this ) 55 , m_packman( &m_config, this )
56 , m_menuBar( this ) 56 , m_menuBar( this )
57 , m_toolBar( this ) 57 , m_toolBar( this )
58 , m_findBar( this ) 58 , m_findBar( this )
59 , m_widgetStack( this ) 59 , m_widgetStack( this )
60 , m_packageList( this ) 60 , m_packageList( this )
61 , m_statusWidget( this ) 61 , m_statusWidget( this )
62 , m_statusText( &m_statusWidget ) 62 , m_statusText( &m_statusWidget )
63 , m_statusBar( &m_statusWidget ) 63 , m_statusBar( &m_statusWidget )
64 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 64 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
65 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 65 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
66 , m_iconNull( m_iconUpdated.size() ) 66 , m_iconNull( m_iconUpdated.size() )
67 , m_filterName( QString::null ) 67 , m_filterName( QString::null )
68 , m_filterServer( QString::null ) 68 , m_filterServer( QString::null )
69 , m_filterDest( QString::null ) 69 , m_filterDest( QString::null )
70 , m_filterStatus( OPackageManager::NotDefined ) 70 , m_filterStatus( OPackageManager::NotDefined )
71 , m_filterCategory( QString::null ) 71 , m_filterCategory( QString::null )
72 72
73{ 73{
74// setCaption( tr( "Package Manager" ) ); 74// setCaption( tr( "Package Manager" ) );
75 75
76 m_iconNull.fill( colorGroup().base() ); 76 m_iconNull.fill( colorGroup().base() );
77 77
78 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); 78 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
79 79
80 // Initialize widget stack, package list and status widget 80 // Initialize widget stack, package list and status widget
81 initStatusWidget(); 81 initStatusWidget();
82 initPackageList(); 82 initPackageList();
83 83
84 m_widgetStack.addWidget( &m_statusWidget, 2 ); 84 m_widgetStack.addWidget( &m_statusWidget, 2 );
85 m_widgetStack.addWidget( &m_packageList, 1 ); 85 m_widgetStack.addWidget( &m_packageList, 1 );
86 setCentralWidget( &m_widgetStack ); 86 setCentralWidget( &m_widgetStack );
87 87
88 // Initialize remaining user interface items 88 // Initialize remaining user interface items
89 initUI(); 89 initUI();
90 90
91 // Initialize package information 91 // Initialize package information
92 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); 92 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) );
93} 93}
94 94
95void MainWindow::closeEvent( QCloseEvent *event ) 95void MainWindow::closeEvent( QCloseEvent *event )
96{ 96{
97 // Close app only if either the package or status widgets are currently active 97 // Close app only if either the package or status widgets are currently active
98 bool close = m_widgetStack.visibleWidget() == &m_packageList || 98 bool close = m_widgetStack.visibleWidget() == &m_packageList ||
99 m_widgetStack.visibleWidget() == &m_statusWidget; 99 m_widgetStack.visibleWidget() == &m_statusWidget;
100 if ( close ) 100 if ( close )
101 { 101 {
102 // TODO - write out application configuration settings 102 // TODO - write out application configuration settings
103 103
104 // Write out package manager configuration settings 104 // Write out package manager configuration settings
105 m_packman.saveSettings(); 105 m_packman.saveSettings();
106 event->accept(); 106 event->accept();
107 } 107 }
108 else 108 else
109 { 109 {
110 delete m_widgetStack.visibleWidget(); 110 delete m_widgetStack.visibleWidget();
111 m_widgetStack.raiseWidget( &m_packageList ); 111 m_widgetStack.raiseWidget( &m_packageList );
112 event->ignore(); 112 event->ignore();
113 } 113 }
114} 114}
115 115
116void MainWindow::initPackageList() 116void MainWindow::initPackageList()
117{ 117{
118 m_packageList.addColumn( tr( "Packages" ) ); 118 m_packageList.addColumn( tr( "Packages" ) );
119 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nTap inside the box at the left to select a package. Tap and hold to view package details." ) ); 119 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nTap inside the box at the left to select a package. Tap and hold to view package details." ) );
120 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); 120 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
121 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), 121 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
122 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); 122 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) );
123} 123}
124 124
125void MainWindow::initStatusWidget() 125void MainWindow::initStatusWidget()
126{ 126{
127 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); 127 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
128 128
129 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 129 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
130 layout->addWidget( &m_statusText ); 130 layout->addWidget( &m_statusText );
131 131
132 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); 132 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
133 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); 133 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) );
134 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); 134 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
135 135
136 layout->addWidget( &m_statusBar ); 136 layout->addWidget( &m_statusBar );
137} 137}
138 138
139void MainWindow::initUI() 139void MainWindow::initUI()
140{ 140{
141 // Build menu and tool bars 141 // Build menu and tool bars
142 setToolBarsMovable( false ); 142 setToolBarsMovable( false );
143 143
144 m_menuBar.setHorizontalStretchable( true ); 144 m_menuBar.setHorizontalStretchable( true );
145 QMenuBar *mb = new QMenuBar( &m_menuBar ); 145 QMenuBar *mb = new QMenuBar( &m_menuBar );
146 mb->setMargin( 0 ); 146 mb->setMargin( 0 );
147 147
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h
index fb555c5..632effb 100644
--- a/noncore/settings/packagemanager/mainwindow.h
+++ b/noncore/settings/packagemanager/mainwindow.h
@@ -1,139 +1,139 @@
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 MAINWINDOW_H 30#ifndef MAINWINDOW_H
31#define MAINWINDOW_H 31#define MAINWINDOW_H
32 32
33#include "opackagemanager.h"
34
35#include <qpe/config.h>
36
33#include <qlabel.h> 37#include <qlabel.h>
34#include <qlistview.h> 38#include <qlistview.h>
35#include <qmainwindow.h> 39#include <qmainwindow.h>
36#include <qpixmap.h> 40#include <qpixmap.h>
37#include <qprogressbar.h> 41#include <qprogressbar.h>
38#include <qtoolbar.h> 42#include <qtoolbar.h>
39#include <qwidgetstack.h> 43#include <qwidgetstack.h>
40 44
41#include <qpe/config.h>
42
43#include "opackagemanager.h"
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( "packagemanager" ); };
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
67 QToolBar m_findBar; // Find toolbar 67 QToolBar m_findBar; // Find toolbar
68 68
69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget 69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget
70 QListView m_packageList; // Main list view of all packages 70 QListView m_packageList; // Main list view of all packages
71 71
72 QLineEdit *m_findEdit; // Line edit box used for find toolbar 72 QLineEdit *m_findEdit; // Line edit box used for find toolbar
73 73
74 // Status widget controls 74 // Status widget controls
75 QWidget m_statusWidget; // Widget to display status during long operations 75 QWidget m_statusWidget; // Widget to display status during long operations
76 QLabel m_statusText; // Text status message 76 QLabel m_statusText; // Text status message
77 QProgressBar m_statusBar; // Progress bar showing % completed 77 QProgressBar m_statusBar; // Progress bar showing % completed
78 78
79 // Icon pixmaps 79 // Icon pixmaps
80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated 80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated
81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed 81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed
82 QPixmap m_iconNull; // Cached icon which shows when package is not installed 82 QPixmap m_iconNull; // Cached icon which shows when package is not installed
83 83
84 // Menu/tool bar actions 84 // Menu/tool bar actions
85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed 85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed
86 QAction *m_actionShowInstalled; // Action to show pakages currently installed 86 QAction *m_actionShowInstalled; // Action to show pakages currently installed
87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available 87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available
88 QAction *m_actionFilter; // Action to filter packages 88 QAction *m_actionFilter; // Action to filter packages
89 QAction *m_actionFindNext; // Action to find next match 89 QAction *m_actionFindNext; // Action to find next match
90 90
91 // Cached filter settings 91 // Cached filter settings
92 QString m_filterName; // Cached name filter value 92 QString m_filterName; // Cached name filter value
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 slotCloseDlg(); 119 void slotCloseDlg();
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 // Other slots 135 // Other slots
136 void slotDisplayPackageInfo( QListViewItem * ); 136 void slotDisplayPackageInfo( QListViewItem * );
137}; 137};
138 138
139#endif 139#endif
diff --git a/noncore/settings/packagemanager/oconfitem.cpp b/noncore/settings/packagemanager/oconfitem.cpp
index 940a6de..a90730c 100644
--- a/noncore/settings/packagemanager/oconfitem.cpp
+++ b/noncore/settings/packagemanager/oconfitem.cpp
@@ -1,42 +1,41 @@
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 "oconfitem.h" 32#include "oconfitem.h"
33 33
34OConfItem::OConfItem( const QString &location, Type type, const QString &name, 34OConfItem::OConfItem( Type type, const QString &name,
35 const QString &value, bool active ) 35 const QString &value, bool active )
36 : m_location( location ) 36 : m_type( type )
37 , m_type( type )
38 , m_name( name ) 37 , m_name( name )
39 , m_value( value ) 38 , m_value( value )
40 , m_active( active ) 39 , m_active( active )
41{ 40{
42} 41}
diff --git a/noncore/settings/packagemanager/oconfitem.h b/noncore/settings/packagemanager/oconfitem.h
index aeee511..db77980 100644
--- a/noncore/settings/packagemanager/oconfitem.h
+++ b/noncore/settings/packagemanager/oconfitem.h
@@ -1,95 +1,92 @@
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( const QString &location = 0x0, Type type = NotDefined, const QString &name = 0x0, 43 OConfItem( Type type = NotDefined, const QString &name = 0x0, const QString &value = 0x0,
44 const QString &value = 0x0, bool active = true ); 44 bool active = true );
45 45
46 const QString &location() { return m_location; }
47 Type type() { return m_type; } 46 Type type() { return m_type; }
48 const QString &name() { return m_name; } 47 const QString &name() { return m_name; }
49 const QString &value() { return m_value; } 48 const QString &value() { return m_value; }
50 bool active() { return m_active; } 49 bool active() { return m_active; }
51 50
52 void setLocation( const QString &location ) { m_location = location; } 51 void setType( Type type ) { m_type = type; }
53 void setType( Type type ) { m_type = type; } 52 void setName( const QString &name ) { m_name = name; }
54 void setName( const QString &name ) { m_name = name; } 53 void setValue( const QString &value ) { m_value = value; }
55 void setValue( const QString &value ) { m_value = value; } 54 void setActive( bool active ) { m_active = active; }
56 void setActive( bool active ) { m_active = active; }
57 55
58private: 56private:
59 QString m_location; // Configuration file where item is located
60 Type m_type; // Type of configuration item 57 Type m_type; // Type of configuration item
61 QString m_name; // Name of item 58 QString m_name; // Name of item
62 QString m_value; // Value of item 59 QString m_value; // Value of item
63 bool m_active; // Indicates whether item is currently active 60 bool m_active; // Indicates whether item is currently active
64}; 61};
65 62
66class OConfItemList : public QList<OConfItem> 63class OConfItemList : public QList<OConfItem>
67{ 64{
68private: 65private:
69 66
70 int compareItems( QCollection::Item item1, QCollection::Item item2 ) 67 int compareItems( QCollection::Item item1, QCollection::Item item2 )
71 { 68 {
72 // Sort by OConfItem location then by type 69 // Sort by OConfItem location then by type
73 QString loc1 = reinterpret_cast<OConfItem*>(item1)->location(); 70 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type();
74 QString loc2 = reinterpret_cast<OConfItem*>(item2)->location(); 71 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type();
75 if ( loc1 < loc2 ) 72 if ( type1 < type2 )
76 return -1; 73 return -1;
77 else if ( loc1 == loc2 ) 74 else if ( type1 == type2 )
78 { 75 {
79 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type(); 76 QString name1 = reinterpret_cast<OConfItem*>(item1)->name();
80 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type(); 77 QString name2 = reinterpret_cast<OConfItem*>(item2)->name();
81 if ( type1 < type2 ) 78 if ( name1 < name2 )
82 return -1; 79 return -1;
83 else if ( type1 == type2 ) 80 else if ( name1 == name2 )
84 return 0; 81 return 0;
85 else /*if ( type1 > type2 )*/ 82 else /*if ( name1 > name2 )*/
86 return 1; 83 return 1;
87 } 84 }
88 else /*if ( loc1 > loc2 )*/ 85 else /*if ( type1 > type2 )*/
89 return 1; 86 return 1;
90 } 87 }
91}; 88};
92 89
93typedef QListIterator<OConfItem> OConfItemListIterator; 90typedef QListIterator<OConfItem> OConfItemListIterator;
94 91
95#endif 92#endif
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 696a64a..87a30bb 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -1,136 +1,135 @@
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 <stdlib.h>
35#include <string.h>
36
37#include <qdir.h> 34#include <qdir.h>
38#include <qfile.h> 35#include <qfile.h>
39#include <qtextstream.h> 36#include <qtextstream.h>
40 37
38#include <stdlib.h>
39
41const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file 40const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file
42const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files 41const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files
43const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists 42const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists
44const 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
45 44
46OIpkg *oipkg; 45OIpkg *oipkg;
47 46
48// Ipkg callback functions 47// Ipkg callback functions
49 48
50int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) 49int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg )
51{ 50{
52 oipkg->ipkgMessage( msg ); 51 oipkg->ipkgMessage( msg );
53 return 0; 52 return 0;
54} 53}
55 54
56char *fIpkgResponse( char */*question*/ ) 55char *fIpkgResponse( char */*question*/ )
57{ 56{
58 return 0x0; 57 return 0x0;
59} 58}
60 59
61int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) 60int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ )
62{ 61{
63 oipkg->ipkgStatus( desc ); 62 oipkg->ipkgStatus( desc );
64 return 0; 63 return 0;
65} 64}
66 65
67int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, 66int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/,
68 void */*userdata*/ ) 67 void */*userdata*/ )
69{ 68{
70 oipkg->ipkgList( desc ); 69 oipkg->ipkgList( desc );
71 return 0; 70 return 0;
72} 71}
73 72
74OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) 73OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
75 : QObject( parent, name ) 74 : QObject( parent, name )
76 , m_config( config ) 75 , m_config( config )
77 , m_confInfo( NULL ) 76 , m_confInfo( NULL )
78 , m_ipkgExecOptions( 0 ) 77 , m_ipkgExecOptions( 0 )
79 , m_ipkgExecVerbosity( 1 ) 78 , m_ipkgExecVerbosity( 1 )
80{ 79{
81 oipkg = this; 80 oipkg = this;
82 81
83 // Initialize libipkg 82 // Initialize libipkg
84 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); 83 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs );
85 84
86 // Default ipkg run-time arguments 85 // Default ipkg run-time arguments
87 m_ipkgArgs.noaction = false; 86 m_ipkgArgs.noaction = false;
88 m_ipkgArgs.force_defaults = true; 87 m_ipkgArgs.force_defaults = true;
89} 88}
90 89
91OIpkg::~OIpkg() 90OIpkg::~OIpkg()
92{ 91{
93 // Upon destruction, ensure that items in config list are deleted with list 92 // Upon destruction, ensure that items in config list are deleted with list
94 if ( m_confInfo ) 93 if ( m_confInfo )
95 m_confInfo->setAutoDelete( true ); 94 m_confInfo->setAutoDelete( true );
96 95
97 // Free up libipkg resources 96 // Free up libipkg resources
98 ipkg_deinit( &m_ipkgArgs ); 97 ipkg_deinit( &m_ipkgArgs );
99} 98}
100 99
101OConfItemList *OIpkg::configItems() 100OConfItemList *OIpkg::configItems()
102{ 101{
103 // Retrieve all configuration items 102 // Retrieve all configuration items
104 return filterConfItems(); 103 return filterConfItems();
105} 104}
106 105
107OConfItemList *OIpkg::servers() 106OConfItemList *OIpkg::servers()
108{ 107{
109 // Retrieve only servers 108 // Retrieve only servers
110 return filterConfItems( OConfItem::Source ); 109 return filterConfItems( OConfItem::Source );
111} 110}
112 111
113OConfItemList *OIpkg::destinations() 112OConfItemList *OIpkg::destinations()
114{ 113{
115 // Retrieve only destinations 114 // Retrieve only destinations
116 return filterConfItems( OConfItem::Destination ); 115 return filterConfItems( OConfItem::Destination );
117} 116}
118 117
119OConfItemList *OIpkg::options() 118OConfItemList *OIpkg::options()
120{ 119{
121 // Retrieve only destinations 120 // Retrieve only destinations
122 return filterConfItems( OConfItem::Option ); 121 return filterConfItems( OConfItem::Option );
123} 122}
124 123
125void OIpkg::setConfigItems( OConfItemList *configList ) 124void OIpkg::setConfigItems( OConfItemList *configList )
126{ 125{
127 if ( m_confInfo ) 126 if ( m_confInfo )
128 delete m_confInfo; 127 delete m_confInfo;
129 128
130 m_confInfo = configList; 129 m_confInfo = configList;
131 130
132 // Write out new /etc/ipkg.conf 131 // Write out new /etc/ipkg.conf
133 QFile confFile( IPKG_CONF ); 132 QFile confFile( IPKG_CONF );
134 if ( confFile.open( IO_WriteOnly ) ) 133 if ( confFile.open( IO_WriteOnly ) )
135 { 134 {
136 QTextStream confStream( &confFile ); 135 QTextStream confStream( &confFile );
@@ -436,140 +435,140 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
436 break; 435 break;
437 default : break; 436 default : break;
438 }; 437 };
439 438
440 return true; 439 return true;
441} 440}
442 441
443void OIpkg::ipkgMessage( char *msg ) 442void OIpkg::ipkgMessage( char *msg )
444{ 443{
445 emit signalIpkgMessage( msg ); 444 emit signalIpkgMessage( msg );
446} 445}
447 446
448void OIpkg::ipkgStatus( char *status ) 447void OIpkg::ipkgStatus( char *status )
449{ 448{
450 emit signalIpkgStatus( status ); 449 emit signalIpkgStatus( status );
451} 450}
452 451
453void OIpkg::ipkgList( char *filelist ) 452void OIpkg::ipkgList( char *filelist )
454{ 453{
455 emit signalIpkgList( filelist ); 454 emit signalIpkgList( filelist );
456} 455}
457 456
458void OIpkg::loadConfiguration() 457void OIpkg::loadConfiguration()
459{ 458{
460 if ( m_confInfo ) 459 if ( m_confInfo )
461 delete m_confInfo; 460 delete m_confInfo;
462 461
463 // Load configuration item list 462 // Load configuration item list
464 m_confInfo = new OConfItemList(); 463 m_confInfo = new OConfItemList();
465 464
466 QStringList confFiles; 465 QStringList confFiles;
467 QDir confDir( IPKG_CONF_DIR ); 466 QDir confDir( IPKG_CONF_DIR );
468 if ( confDir.exists() ) 467 if ( confDir.exists() )
469 { 468 {
470 confDir.setNameFilter( "*.conf" ); 469 confDir.setNameFilter( "*.conf" );
471 confDir.setFilter( QDir::Files ); 470 confDir.setFilter( QDir::Files );
472 confFiles = confDir.entryList( "*.conf", QDir::Files ); 471 confFiles = confDir.entryList( "*.conf", QDir::Files );
473 confFiles << IPKG_CONF; 472 confFiles << IPKG_CONF;
474 473
475 QStringList::Iterator lastFile = confFiles.end(); 474 QStringList::Iterator lastFile = confFiles.end();
476 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) 475 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it )
477 { 476 {
478 // Create absolute file path if necessary 477 // Create absolute file path if necessary
479 QString absFile = (*it); 478 QString absFile = (*it);
480 if ( !absFile.startsWith( "/" ) ) 479 if ( !absFile.startsWith( "/" ) )
481 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 480 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
482 481
483 // Read in file 482 // Read in file
484 QFile f( absFile ); 483 QFile f( absFile );
485 if ( f.open( IO_ReadOnly ) ) 484 if ( f.open( IO_ReadOnly ) )
486 { 485 {
487 QTextStream s( &f ); 486 QTextStream s( &f );
488 while ( !s.eof() ) 487 while ( !s.eof() )
489 { 488 {
490 489
491 QString line = s.readLine().simplifyWhiteSpace(); 490 QString line = s.readLine().simplifyWhiteSpace();
492 491
493 // Parse line and save info to the conf options list 492 // Parse line and save info to the conf options list
494 if ( !line.isEmpty() ) 493 if ( !line.isEmpty() )
495 { 494 {
496 if ( !line.startsWith( "#" ) || 495 if ( !line.startsWith( "#" ) ||
497 line.startsWith( "#src" ) || 496 line.startsWith( "#src" ) ||
498 line.startsWith( "#dest" ) || 497 line.startsWith( "#dest" ) ||
499 line.startsWith( "#arch" ) || 498 line.startsWith( "#arch" ) ||
500 line.startsWith( "#option" ) ) 499 line.startsWith( "#option" ) )
501 { 500 {
502 int pos = line.find( ' ', 1 ); 501 int pos = line.find( ' ', 1 );
503 502
504 // Type 503 // Type
505 QString typeStr = line.left( pos ); 504 QString typeStr = line.left( pos );
506 OConfItem::Type type; 505 OConfItem::Type type;
507 if ( typeStr == "src" || typeStr == "#src" ) 506 if ( typeStr == "src" || typeStr == "#src" )
508 type = OConfItem::Source; 507 type = OConfItem::Source;
509 else if ( typeStr == "dest" || typeStr == "#dest" ) 508 else if ( typeStr == "dest" || typeStr == "#dest" )
510 type = OConfItem::Destination; 509 type = OConfItem::Destination;
511 else if ( typeStr == "option" || typeStr == "#option" ) 510 else if ( typeStr == "option" || typeStr == "#option" )
512 type = OConfItem::Option; 511 type = OConfItem::Option;
513 else if ( typeStr == "arch" || typeStr == "#arch" ) 512 else if ( typeStr == "arch" || typeStr == "#arch" )
514 type = OConfItem::Arch; 513 type = OConfItem::Arch;
515 else 514 else
516 type = OConfItem::NotDefined; 515 type = OConfItem::NotDefined;
517 ++pos; 516 ++pos;
518 int endpos = line.find( ' ', pos ); 517 int endpos = line.find( ' ', pos );
519 518
520 // Name 519 // Name
521 QString name = line.mid( pos, endpos - pos ); 520 QString name = line.mid( pos, endpos - pos );
522 521
523 // Value 522 // Value
524 QString value = ""; 523 QString value = "";
525 if ( endpos > -1 ) 524 if ( endpos > -1 )
526 value = line.right( line.length() - endpos - 1 ); 525 value = line.right( line.length() - endpos - 1 );
527 526
528 // Active 527 // Active
529 bool active = !line.startsWith( "#" ); 528 bool active = !line.startsWith( "#" );
530 529
531 // Add to list 530 // Add to list
532 m_confInfo->append( new OConfItem( absFile, type, name, value, active ) ); 531 m_confInfo->append( new OConfItem( type, name, value, active ) );
533 } 532 }
534 } 533 }
535 } 534 }
536 535
537 f.close(); 536 f.close();
538 } 537 }
539 } 538 }
540 } 539 }
541 540
542 // Load Ipkg execution options from application configuration file 541 // Load Ipkg execution options from application configuration file
543 if ( m_config ) 542 if ( m_config )
544 { 543 {
545 m_config->setGroup( "Ipkg" ); 544 m_config->setGroup( "Ipkg" );
546 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); 545 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions );
547 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); 546 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity );
548 } 547 }
549} 548}
550 549
551OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) 550OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
552{ 551{
553 // Load Ipkg configuration info if not already cached 552 // Load Ipkg configuration info if not already cached
554 if ( !m_confInfo ) 553 if ( !m_confInfo )
555 loadConfiguration(); 554 loadConfiguration();
556 555
557 // Build new server list (caller is responsible for deleting) 556 // Build new server list (caller is responsible for deleting)
558 OConfItemList *sl = new OConfItemList; 557 OConfItemList *sl = new OConfItemList;
559 558
560 // If typefilter is empty, retrieve all items 559 // If typefilter is empty, retrieve all items
561 bool retrieveAll = ( typefilter == OConfItem::NotDefined ); 560 bool retrieveAll = ( typefilter == OConfItem::NotDefined );
562 561
563 // Parse configuration info for servers 562 // Parse configuration info for servers
564 OConfItemListIterator it( *m_confInfo ); 563 OConfItemListIterator it( *m_confInfo );
565 for ( ; it.current(); ++it ) 564 for ( ; it.current(); ++it )
566 { 565 {
567 OConfItem *item = it.current(); 566 OConfItem *item = it.current();
568 if ( retrieveAll || item->type() == typefilter ) 567 if ( retrieveAll || item->type() == typefilter )
569 { 568 {
570 sl->append( item ); 569 sl->append( item );
571 } 570 }
572 } 571 }
573 572
574 return sl; 573 return sl;
575} 574}
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h
index ea126cf..b8a859a 100644
--- a/noncore/settings/packagemanager/oipkg.h
+++ b/noncore/settings/packagemanager/oipkg.h
@@ -1,105 +1,105 @@
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
35extern "C" { 35#include "oconfitem.h"
36#include <libipkg.h> 36#include "opackage.h"
37};
38
39#include <qobject.h>
40 37
41#include <qpe/config.h> 38#include <qpe/config.h>
42 39
43#include "oconfitem.h" 40#include <qobject.h>
44#include "opackage.h" 41
42extern "C" {
43#include <libipkg.h>
44};
45 45
46// Ipkg execution options (m_ipkgExecOptions) 46// Ipkg execution options (m_ipkgExecOptions)
47#define FORCE_DEPENDS 0x0001 47#define FORCE_DEPENDS 0x0001
48#define FORCE_REMOVE 0x0002 48#define FORCE_REMOVE 0x0002
49#define FORCE_REINSTALL 0x0004 49#define FORCE_REINSTALL 0x0004
50#define FORCE_OVERWRITE 0x0008 50#define FORCE_OVERWRITE 0x0008
51 51
52class OConfItemList; 52class OConfItemList;
53 53
54class OIpkg : public QObject 54class OIpkg : public QObject
55{ 55{
56 Q_OBJECT 56 Q_OBJECT
57 57
58public: 58public:
59 OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); 59 OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 );
60 ~OIpkg(); 60 ~OIpkg();
61 61
62 OConfItemList *configItems(); 62 OConfItemList *configItems();
63 OConfItemList *servers(); 63 OConfItemList *servers();
64 OConfItemList *destinations(); 64 OConfItemList *destinations();
65 OConfItemList *options(); 65 OConfItemList *options();
66 66
67 int ipkgExecOptions() { return m_ipkgExecOptions; } 67 int ipkgExecOptions() { return m_ipkgExecOptions; }
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, QStringList *parameters = 0x0,
81 const QString &destination = QString::null, const QObject *receiver = 0x0, 81 const QString &destination = QString::null, const QObject *receiver = 0x0,
82 const char *slotOutput = 0x0, bool rawOutput = true ); 82 const char *slotOutput = 0x0, bool rawOutput = true );
83 void abortCommand(); 83 void abortCommand();
84 84
85 void ipkgMessage( char *msg ); 85 void ipkgMessage( char *msg );
86 void ipkgStatus( char *status ); 86 void ipkgStatus( char *status );
87 void ipkgList( char *filelist ); 87 void ipkgList( char *filelist );
88 88
89private: 89private:
90 Config *m_config; // Pointer to application configuration file 90 Config *m_config; // Pointer to application configuration file
91 args_t m_ipkgArgs; // libipkg configuration arguments 91 args_t m_ipkgArgs; // libipkg configuration arguments
92 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files 92 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files
93 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options 93 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options
94 int m_ipkgExecVerbosity; // Ipkg execution verbosity level 94 int m_ipkgExecVerbosity; // Ipkg execution verbosity level
95 95
96 void loadConfiguration(); 96 void loadConfiguration();
97 OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); 97 OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined );
98 98
99signals: 99signals:
100 void signalIpkgMessage( char *msg ); 100 void signalIpkgMessage( char *msg );
101 void signalIpkgStatus( char *status ); 101 void signalIpkgStatus( char *status );
102 void signalIpkgList( char *filelist ); 102 void signalIpkgList( char *filelist );
103}; 103};
104 104
105#endif 105#endif
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index d134651..7941ab8 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -1,224 +1,223 @@
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 "oipkgconfigdlg.h" 32#include "oipkgconfigdlg.h"
33 33
34#include <qpe/resource.h>
35
34#include <qcheckbox.h> 36#include <qcheckbox.h>
35#include <qcombobox.h> 37#include <qcombobox.h>
36#include <qgroupbox.h> 38#include <qgroupbox.h>
37#include <qlabel.h> 39#include <qlabel.h>
38#include <qlineedit.h> 40#include <qlineedit.h>
39#include <qlistbox.h> 41#include <qlistbox.h>
40#include <qpushbutton.h> 42#include <qpushbutton.h>
41#include <qscrollview.h> 43#include <qscrollview.h>
42#include <qwhatsthis.h> 44#include <qwhatsthis.h>
43 45
44#include <qpe/resource.h>
45
46using namespace Opie::Ui;
47OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) 46OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent )
48 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 47 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
49 , m_ipkg( ipkg ) 48 , m_ipkg( ipkg )
50 , m_configs( 0x0 ) 49 , m_configs( 0x0 )
51 , m_installOptions( installOptions ) 50 , m_installOptions( installOptions )
52 , m_serverNew( false ) 51 , m_serverNew( false )
53 , m_serverCurrent( -1 ) 52 , m_serverCurrent( -1 )
54 , m_destNew( false ) 53 , m_destNew( false )
55 , m_destCurrent( -1 ) 54 , m_destCurrent( -1 )
56 , m_layout( this, 2, 4 ) 55 , m_layout( this, 2, 4 )
57 , m_tabWidget( this ) 56 , m_tabWidget( this )
58{ 57{
59 setCaption( tr( "Configuration" ) ); 58 setCaption( tr( "Configuration" ) );
60 59
61 // Initialize configuration widgets 60 // Initialize configuration widgets
62 if ( !installOptions ) 61 if ( !installOptions )
63 { 62 {
64 initServerWidget(); 63 initServerWidget();
65 initDestinationWidget(); 64 initDestinationWidget();
66 initProxyWidget(); 65 initProxyWidget();
67 } 66 }
68 initOptionsWidget(); 67 initOptionsWidget();
69 68
70 // Load configuration information 69 // Load configuration information
71 initData(); 70 initData();
72 71
73 // Setup tabs for all info 72 // Setup tabs for all info
74 m_layout.addWidget( &m_tabWidget ); 73 m_layout.addWidget( &m_tabWidget );
75 if ( !m_installOptions ) 74 if ( !m_installOptions )
76 { 75 {
77 m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); 76 m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) );
78 m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); 77 m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) );
79 m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); 78 m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) );
80 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); 79 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
81 m_tabWidget.setCurrentTab( tr( "Servers" ) ); 80 m_tabWidget.setCurrentTab( tr( "Servers" ) );
82 } 81 }
83 else 82 else
84 { 83 {
85 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); 84 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
86 } 85 }
87 86
88 //showMaximized(); 87 //showMaximized();
89} 88}
90 89
91void OIpkgConfigDlg::accept() 90void OIpkgConfigDlg::accept()
92{ 91{
93 // Save server, destination and proxy configuration 92 // Save server, destination and proxy configuration
94 if ( !m_installOptions ) 93 if ( !m_installOptions )
95 { 94 {
96 // Update proxy information before saving settings 95 // Update proxy information before saving settings
97 OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); 96 OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" );
98 if ( confItem ) 97 if ( confItem )
99 { 98 {
100 confItem->setValue( m_proxyHttpServer->text() ); 99 confItem->setValue( m_proxyHttpServer->text() );
101 confItem->setActive( m_proxyHttpActive->isChecked() ); 100 confItem->setActive( m_proxyHttpActive->isChecked() );
102 } 101 }
103 else 102 else
104 m_configs->append( new OConfItem( QString::null, OConfItem::Option, "http_proxy", 103 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy",
105 m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); 104 m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) );
106 105
107 confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); 106 confItem = findConfItem( OConfItem::Option, "ftp_proxy" );
108 if ( confItem ) 107 if ( confItem )
109 { 108 {
110 confItem->setValue( m_proxyFtpServer->text() ); 109 confItem->setValue( m_proxyFtpServer->text() );
111 confItem->setActive( m_proxyFtpActive->isChecked() ); 110 confItem->setActive( m_proxyFtpActive->isChecked() );
112 } 111 }
113 else 112 else
114 m_configs->append( new OConfItem( QString::null, OConfItem::Option, "ftp_proxy", 113 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy",
115 m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); 114 m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) );
116 115
117 confItem = findConfItem( OConfItem::Option, "proxy_username" ); 116 confItem = findConfItem( OConfItem::Option, "proxy_username" );
118 if ( confItem ) 117 if ( confItem )
119 confItem->setValue( m_proxyUsername->text() ); 118 confItem->setValue( m_proxyUsername->text() );
120 else 119 else
121 m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_username", 120 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username",
122 m_proxyUsername->text() ) ); 121 m_proxyUsername->text() ) );
123 122
124 confItem = findConfItem( OConfItem::Option, "proxy_password" ); 123 confItem = findConfItem( OConfItem::Option, "proxy_password" );
125 if ( confItem ) 124 if ( confItem )
126 confItem->setValue( m_proxyPassword->text() ); 125 confItem->setValue( m_proxyPassword->text() );
127 else 126 else
128 m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_password", 127 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password",
129 m_proxyPassword->text() ) ); 128 m_proxyPassword->text() ) );
130 129
131 m_ipkg->setConfigItems( m_configs ); 130 m_ipkg->setConfigItems( m_configs );
132 } 131 }
133 132
134 // Save options configuration 133 // Save options configuration
135 int options = 0; 134 int options = 0;
136 if ( m_optForceDepends->isChecked() ) 135 if ( m_optForceDepends->isChecked() )
137 options |= FORCE_DEPENDS; 136 options |= FORCE_DEPENDS;
138 if ( m_optForceReinstall->isChecked() ) 137 if ( m_optForceReinstall->isChecked() )
139 options |= FORCE_REINSTALL; 138 options |= FORCE_REINSTALL;
140 if ( m_optForceRemove->isChecked() ) 139 if ( m_optForceRemove->isChecked() )
141 options |= FORCE_REMOVE; 140 options |= FORCE_REMOVE;
142 if ( m_optForceOverwrite->isChecked() ) 141 if ( m_optForceOverwrite->isChecked() )
143 options |= FORCE_OVERWRITE; 142 options |= FORCE_OVERWRITE;
144 m_ipkg->setIpkgExecOptions( options ); 143 m_ipkg->setIpkgExecOptions( options );
145 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); 144 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
146 145
147 QDialog::accept(); 146 QDialog::accept();
148} 147}
149 148
150void OIpkgConfigDlg::reject() 149void OIpkgConfigDlg::reject()
151{ 150{
152 if ( m_configs ) 151 if ( m_configs )
153 delete m_configs; 152 delete m_configs;
154} 153}
155 154
156void OIpkgConfigDlg::initServerWidget() 155void OIpkgConfigDlg::initServerWidget()
157{ 156{
158 m_serverWidget = new QWidget( this ); 157 m_serverWidget = new QWidget( this );
159 158
160 // Initialize UI 159 // Initialize UI
161 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); 160 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget );
162 QScrollView *sv = new QScrollView( m_serverWidget ); 161 QScrollView *sv = new QScrollView( m_serverWidget );
163 vb->addWidget( sv, 0, 0 ); 162 vb->addWidget( sv, 0, 0 );
164 sv->setResizePolicy( QScrollView::AutoOneFit ); 163 sv->setResizePolicy( QScrollView::AutoOneFit );
165 sv->setFrameStyle( QFrame::NoFrame ); 164 sv->setFrameStyle( QFrame::NoFrame );
166 QWidget *container = new QWidget( sv->viewport() ); 165 QWidget *container = new QWidget( sv->viewport() );
167 sv->addChild( container ); 166 sv->addChild( container );
168 QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); 167 QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 );
169 168
170 m_serverList = new QListBox( container ); 169 m_serverList = new QListBox( container );
171 QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); 170 QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) );
172 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 171 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
173 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) ); 172 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) );
174 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); 173 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 );
175 174
176 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
177 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 176 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
178 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); 177 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) );
179 layout->addWidget( btn, 1, 0 ); 178 layout->addWidget( btn, 1, 0 );
180 179
181 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 180 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
182 QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); 181 QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) );
183 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); 182 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) );
184 layout->addWidget( btn, 1, 1 ); 183 layout->addWidget( btn, 1, 1 );
185 184
186 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 185 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
187 grpbox->layout()->setSpacing( 2 ); 186 grpbox->layout()->setSpacing( 2 );
188 grpbox->layout()->setMargin( 4 ); 187 grpbox->layout()->setMargin( 4 );
189 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 188 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
190 189
191 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 190 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
192 191
193 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 192 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
194 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); 193 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) );
195 grplayout->addWidget( label, 0, 0 ); 194 grplayout->addWidget( label, 0, 0 );
196 m_serverName = new QLineEdit( grpbox ); 195 m_serverName = new QLineEdit( grpbox );
197 QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) ); 196 QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) );
198 grplayout->addWidget( m_serverName, 0, 1 ); 197 grplayout->addWidget( m_serverName, 0, 1 );
199 198
200 label = new QLabel( tr( "Address:" ), grpbox ); 199 label = new QLabel( tr( "Address:" ), grpbox );
201 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); 200 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) );
202 grplayout->addWidget( label, 1, 0 ); 201 grplayout->addWidget( label, 1, 0 );
203 m_serverLocation = new QLineEdit( grpbox ); 202 m_serverLocation = new QLineEdit( grpbox );
204 QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) ); 203 QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) );
205 grplayout->addWidget( m_serverLocation, 1, 1 ); 204 grplayout->addWidget( m_serverLocation, 1, 1 );
206 205
207 m_serverActive = new QCheckBox( tr( "Active" ), grpbox ); 206 m_serverActive = new QCheckBox( tr( "Active" ), grpbox );
208 QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) ); 207 QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) );
209 grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 ); 208 grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 );
210 209
211 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 210 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
212 QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); 211 QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) );
213 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) ); 212 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) );
214 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 213 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
215} 214}
216 215
217void OIpkgConfigDlg::initDestinationWidget() 216void OIpkgConfigDlg::initDestinationWidget()
218{ 217{
219 m_destWidget = new QWidget( this ); 218 m_destWidget = new QWidget( this );
220 219
221 // Initialize UI 220 // Initialize UI
222 QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); 221 QVBoxLayout *vb = new QVBoxLayout( m_destWidget );
223 QScrollView *sv = new QScrollView( m_destWidget ); 222 QScrollView *sv = new QScrollView( m_destWidget );
224 vb->addWidget( sv, 0, 0 ); 223 vb->addWidget( sv, 0, 0 );
@@ -439,191 +438,191 @@ void OIpkgConfigDlg::initData()
439 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); 438 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() );
440} 439}
441 440
442OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) 441OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name )
443{ 442{
444 // Find selected server in list 443 // Find selected server in list
445 OConfItemListIterator configIt( *m_configs ); 444 OConfItemListIterator configIt( *m_configs );
446 OConfItem *config = 0x0; 445 OConfItem *config = 0x0;
447 for ( ; configIt.current(); ++configIt ) 446 for ( ; configIt.current(); ++configIt )
448 { 447 {
449 config = configIt.current(); 448 config = configIt.current();
450 if ( config->type() == type && config->name() == name ) 449 if ( config->type() == type && config->name() == name )
451 break; 450 break;
452 } 451 }
453 452
454 if ( config && config->type() == type && config->name() == name ) 453 if ( config && config->type() == type && config->name() == name )
455 return config; 454 return config;
456 455
457 return 0x0; 456 return 0x0;
458} 457}
459 458
460void OIpkgConfigDlg::slotServerEdit( int index ) 459void OIpkgConfigDlg::slotServerEdit( int index )
461{ 460{
462 m_serverNew = false; 461 m_serverNew = false;
463 m_serverCurrent = index; 462 m_serverCurrent = index;
464 463
465 // Find selected server in list 464 // Find selected server in list
466 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); 465 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() );
467 466
468 // Display server details 467 // Display server details
469 if ( server ) 468 if ( server )
470 { 469 {
471 m_serverCurrName = server->name(); 470 m_serverCurrName = server->name();
472 m_serverName->setText( server->name() ); 471 m_serverName->setText( server->name() );
473 m_serverLocation->setText( server->value() ); 472 m_serverLocation->setText( server->value() );
474 m_serverActive->setChecked( server->active() ); 473 m_serverActive->setChecked( server->active() );
475 m_serverName->setFocus(); 474 m_serverName->setFocus();
476 } 475 }
477} 476}
478 477
479void OIpkgConfigDlg::slotServerNew() 478void OIpkgConfigDlg::slotServerNew()
480{ 479{
481 m_serverNew = true; 480 m_serverNew = true;
482 481
483 m_serverName->setText( QString::null ); 482 m_serverName->setText( QString::null );
484 m_serverLocation->setText( QString::null ); 483 m_serverLocation->setText( QString::null );
485 m_serverActive->setChecked( true ); 484 m_serverActive->setChecked( true );
486 m_serverName->setFocus(); 485 m_serverName->setFocus();
487} 486}
488 487
489void OIpkgConfigDlg::slotServerDelete() 488void OIpkgConfigDlg::slotServerDelete()
490{ 489{
491 // Find selected server in list 490 // Find selected server in list
492 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); 491 OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() );
493 492
494 // Delete server 493 // Delete server
495 if ( server ) 494 if ( server )
496 { 495 {
497 m_configs->removeRef( server ); 496 m_configs->removeRef( server );
498 m_serverList->removeItem( m_serverCurrent ); 497 m_serverList->removeItem( m_serverCurrent );
499 } 498 }
500} 499}
501 500
502void OIpkgConfigDlg::slotServerUpdate() 501void OIpkgConfigDlg::slotServerUpdate()
503{ 502{
504 QString newName = m_serverName->text(); 503 QString newName = m_serverName->text();
505 504
506 // Convert any spaces to underscores 505 // Convert any spaces to underscores
507 newName.replace( QRegExp( " " ), "_" ); 506 newName.replace( QRegExp( " " ), "_" );
508 507
509 if ( !m_serverNew ) 508 if ( !m_serverNew )
510 { 509 {
511 // Find selected server in list 510 // Find selected server in list
512 OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); 511 OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName );
513 512
514 // Delete server 513 // Delete server
515 if ( server ) 514 if ( server )
516 { 515 {
517 // Update url 516 // Update url
518 server->setValue( m_serverLocation->text() ); 517 server->setValue( m_serverLocation->text() );
519 server->setActive( m_serverActive->isChecked() ); 518 server->setActive( m_serverActive->isChecked() );
520 519
521 // Check if server name has changed, if it has then we need to replace the key in the map 520 // Check if server name has changed, if it has then we need to replace the key in the map
522 if ( m_serverCurrName != newName ) 521 if ( m_serverCurrName != newName )
523 { 522 {
524 // Update server name 523 // Update server name
525 server->setName( newName ); 524 server->setName( newName );
526 525
527 // Update list box 526 // Update list box
528 m_serverList->changeItem( newName, m_serverCurrent ); 527 m_serverList->changeItem( newName, m_serverCurrent );
529 } 528 }
530 } 529 }
531 } 530 }
532 else 531 else
533 { 532 {
534 // Add new destination to configuration list 533 // Add new destination to configuration list
535 m_configs->append( new OConfItem( QString::null, OConfItem::Source, newName, 534 m_configs->append( new OConfItem( OConfItem::Source, newName,
536 m_serverLocation->text(), m_serverActive->isChecked() ) ); 535 m_serverLocation->text(), m_serverActive->isChecked() ) );
537 m_configs->sort(); 536 m_configs->sort();
538 537
539 m_serverList->insertItem( newName ); 538 m_serverList->insertItem( newName );
540 m_serverList->setCurrentItem( m_serverList->count() ); 539 m_serverList->setCurrentItem( m_serverList->count() );
541 m_serverNew = false; 540 m_serverNew = false;
542 m_serverList->insertItem( newName ); 541 m_serverList->insertItem( newName );
543 } 542 }
544} 543}
545 544
546void OIpkgConfigDlg::slotDestEdit( int index ) 545void OIpkgConfigDlg::slotDestEdit( int index )
547{ 546{
548 m_destNew = false; 547 m_destNew = false;
549 m_destCurrent = index; 548 m_destCurrent = index;
550 549
551 // Find selected destination in list 550 // Find selected destination in list
552 OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); 551 OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() );
553 552
554 // Display destination details 553 // Display destination details
555 if ( destination ) 554 if ( destination )
556 { 555 {
557 m_destCurrName = destination->name(); 556 m_destCurrName = destination->name();
558 m_destName->setText( destination->name() ); 557 m_destName->setText( destination->name() );
559 m_destLocation->setText( destination->value() ); 558 m_destLocation->setText( destination->value() );
560 m_destActive->setChecked( destination->active() ); 559 m_destActive->setChecked( destination->active() );
561 m_destName->setFocus(); 560 m_destName->setFocus();
562 } 561 }
563} 562}
564 563
565void OIpkgConfigDlg::slotDestNew() 564void OIpkgConfigDlg::slotDestNew()
566{ 565{
567 m_destNew = true; 566 m_destNew = true;
568 567
569 m_destName->setText( QString::null ); 568 m_destName->setText( QString::null );
570 m_destLocation->setText( QString::null ); 569 m_destLocation->setText( QString::null );
571 m_destActive->setChecked( true ); 570 m_destActive->setChecked( true );
572 m_destName->setFocus(); 571 m_destName->setFocus();
573} 572}
574 573
575void OIpkgConfigDlg::slotDestDelete() 574void OIpkgConfigDlg::slotDestDelete()
576{ 575{
577 // Find selected destination in list 576 // Find selected destination in list
578 OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); 577 OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() );
579 578
580 // Delete destination 579 // Delete destination
581 if ( destination ) 580 if ( destination )
582 { 581 {
583 m_configs->removeRef( destination ); 582 m_configs->removeRef( destination );
584 m_destList->removeItem( m_destCurrent ); 583 m_destList->removeItem( m_destCurrent );
585 } 584 }
586} 585}
587 586
588void OIpkgConfigDlg::slotDestUpdate() 587void OIpkgConfigDlg::slotDestUpdate()
589{ 588{
590 QString newName = m_destName->text(); 589 QString newName = m_destName->text();
591 590
592 // Convert any spaces to underscores 591 // Convert any spaces to underscores
593 newName.replace( QRegExp( " " ), "_" ); 592 newName.replace( QRegExp( " " ), "_" );
594 593
595 if ( !m_destNew ) 594 if ( !m_destNew )
596 { 595 {
597 // Find selected destination in list 596 // Find selected destination in list
598 OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); 597 OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName );
599 598
600 // Display destination details 599 // Display destination details
601 if ( destination ) 600 if ( destination )
602 { 601 {
603 // Update url 602 // Update url
604 destination->setValue( m_destLocation->text() ); 603 destination->setValue( m_destLocation->text() );
605 destination->setActive( m_destActive->isChecked() ); 604 destination->setActive( m_destActive->isChecked() );
606 605
607 // Check if destination name has changed, if it has then we need to replace the key in the map 606 // Check if destination name has changed, if it has then we need to replace the key in the map
608 if ( m_destCurrName != newName ) 607 if ( m_destCurrName != newName )
609 { 608 {
610 // Update destination name 609 // Update destination name
611 destination->setName( newName ); 610 destination->setName( newName );
612 611
613 // Update list box 612 // Update list box
614 m_destList->changeItem( newName, m_destCurrent ); 613 m_destList->changeItem( newName, m_destCurrent );
615 } 614 }
616 } 615 }
617 } 616 }
618 else 617 else
619 { 618 {
620 // Add new destination to configuration list 619 // Add new destination to configuration list
621 m_configs->append( new OConfItem( QString::null, OConfItem::Destination, newName, 620 m_configs->append( new OConfItem( OConfItem::Destination, newName,
622 m_destLocation->text(), m_destActive->isChecked() ) ); 621 m_destLocation->text(), m_destActive->isChecked() ) );
623 m_configs->sort(); 622 m_configs->sort();
624 623
625 m_destList->insertItem( newName ); 624 m_destList->insertItem( newName );
626 m_destList->setCurrentItem( m_destList->count() ); 625 m_destList->setCurrentItem( m_destList->count() );
627 m_destNew = false; 626 m_destNew = false;
628 } 627 }
629} 628}
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h
index 0aba898..800d94a 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.h
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.h
@@ -1,131 +1,131 @@
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 32
33#ifndef OIPKGCONFIGDLG_H 33#ifndef OIPKGCONFIGDLG_H
34#define OIPKGCONFIGDLG_H 34#define OIPKGCONFIGDLG_H
35 35
36#include <opie2/otabwidget.h>
37
36#include <qdialog.h> 38#include <qdialog.h>
37#include <qlayout.h> 39#include <qlayout.h>
38 40
39#include <opie2/otabwidget.h>
40
41#include "oipkg.h" 41#include "oipkg.h"
42 42
43class QCheckBox; 43class QCheckBox;
44class QComboBox; 44class QComboBox;
45class QLineEdit; 45class QLineEdit;
46class QListBox; 46class QListBox;
47 47
48class OIpkgConfigDlg : public QDialog 48class OIpkgConfigDlg : public QDialog
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 ); 53 OIpkgConfigDlg( OIpkg *ipkg = 0x0, bool installOptions = false, QWidget *parent = 0x0 );
54 54
55protected slots: 55protected slots:
56 void accept(); 56 void accept();
57 void reject(); 57 void reject();
58 58
59private: 59private:
60 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options 60 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options
61 OConfItemList *m_configs; // Local list of configuration items 61 OConfItemList *m_configs; // Local list of configuration items
62 62
63 bool m_installOptions; // If true, will only display the Options tab 63 bool m_installOptions; // If true, will only display the Options tab
64 64
65 // Server cached information 65 // Server cached information
66 bool m_serverNew; // Indicates if server information is for a new server 66 bool m_serverNew; // Indicates if server information is for a new server
67 int m_serverCurrent; // Index of currently selected server in m_serverList 67 int m_serverCurrent; // Index of currently selected server in m_serverList
68 QString m_serverCurrName; // Name of currently selected server in m_serverList 68 QString m_serverCurrName; // Name of currently selected server in m_serverList
69 69
70 // Destination cached information 70 // Destination cached information
71 bool m_destNew; // Indicates if destination information is for a new destination 71 bool m_destNew; // Indicates if destination information is for a new destination
72 int m_destCurrent; // Index of currently selected destination in m_destList 72 int m_destCurrent; // Index of currently selected destination in m_destList
73 QString m_destCurrName; // Name of currently selected destination in m_destList 73 QString m_destCurrName; // Name of currently selected destination in m_destList
74 74
75 // UI controls 75 // UI controls
76 QVBoxLayout m_layout; // Main dialog layout control 76 QVBoxLayout m_layout; // Main dialog layout control
77 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control 77 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control
78 QWidget *m_serverWidget; // Widget containing server configuration controls 78 QWidget *m_serverWidget; // Widget containing server configuration controls
79 QWidget *m_destWidget; // Widget containing destination configuration controls 79 QWidget *m_destWidget; // Widget containing destination configuration controls
80 QWidget *m_proxyWidget; // Widget containing proxy configuration controls 80 QWidget *m_proxyWidget; // Widget containing proxy configuration controls
81 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls 81 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls
82 82
83 // Server configuration UI controls 83 // Server configuration UI controls
84 QListBox *m_serverList; // Server list selection 84 QListBox *m_serverList; // Server list selection
85 QLineEdit *m_serverName; // Server name edit box 85 QLineEdit *m_serverName; // Server name edit box
86 QLineEdit *m_serverLocation; // Server location URL edit box 86 QLineEdit *m_serverLocation; // Server location URL edit box
87 QCheckBox *m_serverActive; // Activate server check box 87 QCheckBox *m_serverActive; // Activate server check box
88 88
89 // Destination configuration UI controls 89 // Destination configuration UI controls
90 QListBox *m_destList; // Destination list selection 90 QListBox *m_destList; // Destination list selection
91 QLineEdit *m_destName; // Destination name edit box 91 QLineEdit *m_destName; // Destination name edit box
92 QLineEdit *m_destLocation; // Destination location URL edit box 92 QLineEdit *m_destLocation; // Destination location URL edit box
93 QCheckBox *m_destActive; // Activate destination check box 93 QCheckBox *m_destActive; // Activate destination check box
94 94
95 // Proxy server configuration UI controls 95 // Proxy server configuration UI controls
96 QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box 96 QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box
97 QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box 97 QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box
98 QLineEdit *m_proxyFtpServer; // FTP proxy server edit box 98 QLineEdit *m_proxyFtpServer; // FTP proxy server edit box
99 QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box 99 QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box
100 QLineEdit *m_proxyUsername; // Proxy server username edit box 100 QLineEdit *m_proxyUsername; // Proxy server username edit box
101 QLineEdit *m_proxyPassword; // Proxy server password edit box 101 QLineEdit *m_proxyPassword; // Proxy server password edit box
102 102
103 // Options configuration UI controls 103 // Options configuration UI controls
104 QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox 104 QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox
105 QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox 105 QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox
106 QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox 106 QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox
107 QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox 107 QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox
108 QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection 108 QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection
109 109
110 void initServerWidget(); 110 void initServerWidget();
111 void initDestinationWidget(); 111 void initDestinationWidget();
112 void initProxyWidget(); 112 void initProxyWidget();
113 void initOptionsWidget(); 113 void initOptionsWidget();
114 114
115 void initData(); 115 void initData();
116 116
117 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, const QString &name = 0x0 ); 117 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, const QString &name = 0x0 );
118 118
119private slots: 119private slots:
120 void slotServerEdit( int index ); 120 void slotServerEdit( int index );
121 void slotServerNew(); 121 void slotServerNew();
122 void slotServerDelete(); 122 void slotServerDelete();
123 void slotServerUpdate(); 123 void slotServerUpdate();
124 124
125 void slotDestEdit( int index ); 125 void slotDestEdit( int index );
126 void slotDestNew(); 126 void slotDestNew();
127 void slotDestDelete(); 127 void slotDestDelete();
128 void slotDestUpdate(); 128 void slotDestUpdate();
129}; 129};
130 130
131#endif 131#endif
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp
index 3633e05..f75d3b3 100644
--- a/noncore/settings/packagemanager/opackagemanager.cpp
+++ b/noncore/settings/packagemanager/opackagemanager.cpp
@@ -1,133 +1,133 @@
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 <ctype.h> 32#include "opackagemanager.h"
33#include "oipkgconfigdlg.h"
33 34
34#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
35 36
36#include "opackagemanager.h" 37#include <ctype.h>
37#include "oipkgconfigdlg.h"
38 38
39OPackageManager::OPackageManager( Config *config, QObject *parent, const char *name ) 39OPackageManager::OPackageManager( Config *config, QObject *parent, const char *name )
40 : QObject( parent, name ) 40 : QObject( parent, name )
41 , m_config( config ) 41 , m_config( config )
42 , m_ipkg( m_config, this ) 42 , m_ipkg( m_config, this )
43 , m_packages( 9973 ) 43 , m_packages( 9973 )
44 , m_categories() 44 , m_categories()
45{ 45{
46 m_packages.setAutoDelete( true ); 46 m_packages.setAutoDelete( true );
47} 47}
48 48
49void OPackageManager::loadAvailablePackages() 49void OPackageManager::loadAvailablePackages()
50{ 50{
51 m_packages.clear(); 51 m_packages.clear();
52 52
53 OConfItemList *serverList = m_ipkg.servers(); 53 OConfItemList *serverList = m_ipkg.servers();
54 54
55 if ( serverList ) 55 if ( serverList )
56 { 56 {
57 // Initialize status messaging 57 // Initialize status messaging
58 emit initStatus( serverList->count() ); 58 emit initStatus( serverList->count() );
59 int serverCount = 0; 59 int serverCount = 0;
60 60
61 bool categoryAdded = false; 61 bool categoryAdded = false;
62 62
63 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt ) 63 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt )
64 { 64 {
65 OConfItem *server = serverIt.current(); 65 OConfItem *server = serverIt.current();
66 66
67 // Process server only if it is active 67 // Process server only if it is active
68 if ( server->active() ) 68 if ( server->active() )
69 { 69 {
70 // Update status 70 // Update status
71 QString status = tr( "Reading available packages:\n\t" ); 71 QString status = tr( "Reading available packages:\n\t" );
72 status.append( server->name() ); 72 status.append( server->name() );
73 emit statusText( status ); 73 emit statusText( status );
74 ++serverCount; 74 ++serverCount;
75 emit statusBar( serverCount ); 75 emit statusBar( serverCount );
76 qApp->processEvents(); 76 qApp->processEvents();
77 77
78 OPackageList *packageList = m_ipkg.availablePackages( server->name() ); 78 OPackageList *packageList = m_ipkg.availablePackages( server->name() );
79 if ( packageList ) 79 if ( packageList )
80 { 80 {
81 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 81 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
82 { 82 {
83 OPackage *package = packageIt.current(); 83 OPackage *package = packageIt.current();
84 84
85 // Load package info 85 // Load package info
86 if ( !m_packages.find( package->name() ) ) 86 if ( !m_packages.find( package->name() ) )
87 m_packages.insert( package->name(), package ); 87 m_packages.insert( package->name(), package );
88 else 88 else
89 { 89 {
90 // If new package is newer version, replace existing package 90 // If new package is newer version, replace existing package
91 OPackage *currPackage = m_packages[package->name()]; 91 OPackage *currPackage = m_packages[package->name()];
92 if ( compareVersions( package->version(), currPackage->version() ) == 1 ) 92 if ( compareVersions( package->version(), currPackage->version() ) == 1 )
93 m_packages.replace( package->name(), package ); 93 m_packages.replace( package->name(), package );
94 } 94 }
95 95
96 // Add category to list if it doesn't already exist 96 // Add category to list if it doesn't already exist
97 if ( m_categories.grep( package->category() ).isEmpty() ) 97 if ( m_categories.grep( package->category() ).isEmpty() )
98 { 98 {
99 m_categories << package->category(); 99 m_categories << package->category();
100 categoryAdded = true; 100 categoryAdded = true;
101 } 101 }
102 } 102 }
103 } 103 }
104 } 104 }
105 } 105 }
106 delete serverList; 106 delete serverList;
107 107
108 // Sort category list if categories were added 108 // Sort category list if categories were added
109 if ( categoryAdded ) 109 if ( categoryAdded )
110 m_categories.sort(); 110 m_categories.sort();
111 } 111 }
112} 112}
113 113
114void OPackageManager::loadInstalledPackages() 114void OPackageManager::loadInstalledPackages()
115{ 115{
116 OConfItemList *destList = m_ipkg.destinations(); 116 OConfItemList *destList = m_ipkg.destinations();
117 117
118 if ( destList ) 118 if ( destList )
119 { 119 {
120 // Initialize status messaging 120 // Initialize status messaging
121 emit initStatus( destList->count() ); 121 emit initStatus( destList->count() );
122 int destCount = 0; 122 int destCount = 0;
123 123
124 bool categoryAdded = false; 124 bool categoryAdded = false;
125 125
126 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 126 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
127 { 127 {
128 OConfItem *destination = destIt.current(); 128 OConfItem *destination = destIt.current();
129 129
130 // Process destination only if it is active 130 // Process destination only if it is active
131 if ( destination->active() ) 131 if ( destination->active() )
132 { 132 {
133 // Update status 133 // Update status
diff --git a/noncore/settings/packagemanager/opackagemanager.h b/noncore/settings/packagemanager/opackagemanager.h
index b710a51..58e597b 100644
--- a/noncore/settings/packagemanager/opackagemanager.h
+++ b/noncore/settings/packagemanager/opackagemanager.h
@@ -1,92 +1,92 @@
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 <qdict.h> 35#include "oipkg.h"
36#include <qobject.h>
37#include <qstringlist.h>
38 36
39#include <qpe/config.h> 37#include <qpe/config.h>
40 38
41#include "oipkg.h" 39#include <qdict.h>
40#include <qobject.h>
41#include <qstringlist.h>
42 42
43class OPackageManager : public QObject 43class 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 = 0x0,const QString &server = 0x0,
57 const QString &destination = 0x0, Status status = NotDefined, 57 const QString &destination = 0x0, Status status = NotDefined,
58 const QString &category = 0x0 ); 58 const QString &category = 0x0 );
59 59
60 const QStringList &categories() { return m_categories; } 60 const QStringList &categories() { return m_categories; }
61 QStringList *servers(); 61 QStringList *servers();
62 QStringList *destinations(); 62 QStringList *destinations();
63 63
64 int compareVersions( const QString &version1, const QString &version2 ); 64 int compareVersions( const QString &version1, const QString &version2 );
65 65
66 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, 66 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
67 const QString &name = QString::null ); 67 const QString &name = QString::null );
68 OPackage *findPackage( const QString &name = QString::null ); 68 OPackage *findPackage( const QString &name = QString::null );
69 69
70 bool configureDlg( bool installOptions = false ); 70 bool configureDlg( bool installOptions = false );
71 void saveSettings(); 71 void saveSettings();
72 72
73 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, 73 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0,
74 const QString &destination = QString::null, const QObject *receiver = 0x0, 74 const QString &destination = QString::null, const QObject *receiver = 0x0,
75 const char *slotOutput = 0x0, bool rawOutput = true ); 75 const char *slotOutput = 0x0, bool rawOutput = true );
76 76
77private: 77private:
78 Config *m_config; // Pointer to application configuration file 78 Config *m_config; // Pointer to application configuration file
79 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information 79 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information
80 QDict<OPackage> m_packages; // Global list of available packages 80 QDict<OPackage> m_packages; // Global list of available packages
81 QStringList m_categories; // List of all categories 81 QStringList m_categories; // List of all categories
82 82
83 void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision ); 83 void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision );
84 int verrevcmp( const char *val, const char *ref ); 84 int verrevcmp( const char *val, const char *ref );
85 85
86signals: 86signals:
87 void initStatus( int numSteps ); 87 void initStatus( int numSteps );
88 void statusText( const QString &status ); 88 void statusText( const QString &status );
89 void statusBar( int currStep ); 89 void statusBar( int currStep );
90}; 90};
91 91
92#endif 92#endif
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control
index aff8866..09bb18b 100644
--- a/noncore/settings/packagemanager/opie-packagemanager.control
+++ b/noncore/settings/packagemanager/opie-packagemanager.control
@@ -1,10 +1,10 @@
1Package: opie-packagemanager 1Package: opie-packagemanager
2Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop 2Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg 5Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg
6Replaces: packagemanager 6Replaces: packagemanager
7Architecture: arm 7Architecture: arm
8Maintainer: Dan Williams (drw@handhelds.org) 8Maintainer: Dan Williams (drw@handhelds.org)
9Description: Opie package management client 9Description: Opie package management client
10Version: 0.3.0$EXTRAVERSION 10Version: 0.4.0$EXTRAVERSION
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp
index 73d3de7..d27eacb 100644
--- a/noncore/settings/packagemanager/packageinfodlg.cpp
+++ b/noncore/settings/packagemanager/packageinfodlg.cpp
@@ -1,141 +1,144 @@
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 <qlayout.h> 34#include <opie2/otabwidget.h>
35#include <qpushbutton.h>
36 35
37#include <qpe/resource.h> 36#include <qpe/resource.h>
38 37
39#include <opie2/otabwidget.h> 38#include <qlayout.h>
39#include <qpushbutton.h>
40#include <qwhatsthis.h>
40 41
41using namespace Opie::Ui;
42PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) 42PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package )
43 : QWidget( 0x0 ) 43 : QWidget( 0x0 )
44 , m_packman( pm ) 44 , m_packman( pm )
45 , m_information( this ) 45 , m_information( this )
46 , m_files( this ) 46 , m_files( this )
47{ 47{
48 // Initialize UI 48 // Initialize UI
49 if ( parent ) 49 if ( parent )
50 parent->setCaption( package ); 50 parent->setCaption( package );
51 51
52 QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); 52 QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 );
53 53
54 OTabWidget *tabWidget = new OTabWidget( this ); 54 Opie::Ui::OTabWidget *tabWidget = new Opie::Ui::OTabWidget( this );
55 layout->addWidget( tabWidget ); 55 layout->addWidget( tabWidget );
56 56
57 // Information tab 57 // Information tab
58 QWhatsThis::add( &m_information, tr( "This area contains information about the package." ) );
58 m_information.reparent( tabWidget, QPoint( 0, 0 ) ); 59 m_information.reparent( tabWidget, QPoint( 0, 0 ) );
59 m_information.setReadOnly( true ); 60 m_information.setReadOnly( true );
60 tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); 61 tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) );
61 62
62 // Retrive package information 63 // Retrive package information
63 m_package = m_packman->findPackage( package ); 64 m_package = m_packman->findPackage( package );
64 if ( !m_package ) 65 if ( !m_package )
65 { 66 {
66 m_information.setText( tr( "Unable to retrieve package information." ) ); 67 m_information.setText( tr( "Unable to retrieve package information." ) );
67 return; 68 return;
68 } 69 }
69 70
70 // Display package information 71 // Display package information
71 if ( !m_package->information().isNull() ) 72 if ( !m_package->information().isNull() )
72 m_information.setText( m_package->information() ); 73 m_information.setText( m_package->information() );
73 else 74 else
74 { 75 {
75 // Package information is not cached, retrieve it 76 // Package information is not cached, retrieve it
76 QStringList list( package ); 77 QStringList list( package );
77 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 );
78 } 79 }
79 80
80 // Files tab (display only if package is installed) 81 // Files tab (display only if package is installed)
81 if ( !m_package->versionInstalled().isNull() ) 82 if ( !m_package->versionInstalled().isNull() )
82 { 83 {
83 QWidget *filesWidget = new QWidget( tabWidget ); 84 QWidget *filesWidget = new QWidget( tabWidget );
84 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." ) );
85 m_files.reparent( filesWidget, QPoint( 0, 0 ) ); 87 m_files.reparent( filesWidget, QPoint( 0, 0 ) );
86 m_files.setReadOnly( true ); 88 m_files.setReadOnly( true );
87 filesLayout->addWidget( &m_files ); 89 filesLayout->addWidget( &m_files );
88 90
89 QPushButton *btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), 91 QPushButton *btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ),
90 tr( "Retrieve file list" ), filesWidget ); 92 tr( "Retrieve file list" ), filesWidget );
93 QWhatsThis::add( btn, tr( "Tap here to retrieve list of files contained in this package." ) );
91 filesLayout->addWidget( btn ); 94 filesLayout->addWidget( btn );
92 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); 95 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) );
93 tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); 96 tabWidget->addTab( filesWidget, "binary", tr( "File list" ) );
94 97
95 tabWidget->setCurrentTab( tr( "Information" ) ); 98 tabWidget->setCurrentTab( tr( "Information" ) );
96 99
97 // If file list is already cached, display 100 // If file list is already cached, display
98 if ( !m_package->files().isNull() ) 101 if ( !m_package->files().isNull() )
99 m_files.setText( m_package->files() ); 102 m_files.setText( m_package->files() );
100 } 103 }
101 else 104 else
102 m_files.hide(); 105 m_files.hide();
103} 106}
104 107
105PackageInfoDlg::~PackageInfoDlg() 108PackageInfoDlg::~PackageInfoDlg()
106{ 109{
107 if ( !m_package ) 110 if ( !m_package )
108 return; 111 return;
109 112
110 // Cache package information 113 // Cache package information
111 if ( !m_information.text().isNull() ) 114 if ( !m_information.text().isNull() )
112 m_package->setInformation( m_information.text() ); 115 m_package->setInformation( m_information.text() );
113 116
114 // Cache package file list 117 // Cache package file list
115 if ( !m_files.text().isNull() ) 118 if ( !m_files.text().isNull() )
116 m_package->setFiles( m_files.text() ); 119 m_package->setFiles( m_files.text() );
117} 120}
118 121
119void PackageInfoDlg::slotBtnFileScan() 122void PackageInfoDlg::slotBtnFileScan()
120{ 123{
121 m_files.clear(); 124 m_files.clear();
122 125
123 QStringList list( m_package->name() ); 126 QStringList list( m_package->name() );
124 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 );
125} 128}
126 129
127void PackageInfoDlg::slotInfo( char *info ) 130void PackageInfoDlg::slotInfo( char *info )
128{ 131{
129 m_information.append( info ); 132 m_information.append( info );
130} 133}
131 134
132void PackageInfoDlg::slotFiles( char *filelist ) 135void PackageInfoDlg::slotFiles( char *filelist )
133{ 136{
134 QString str = filelist; 137 QString str = filelist;
135 138
136 // Skip first line of output ("Package xxx is installed...") 139 // Skip first line of output ("Package xxx is installed...")
137 if ( str.startsWith( "Package " ) ) 140 if ( str.startsWith( "Package " ) )
138 str = str.right( str.length() - str.find( '\n' ) - 1 ); 141 str = str.right( str.length() - str.find( '\n' ) - 1 );
139 142
140 m_files.append( str ); 143 m_files.append( str );
141} 144}
diff --git a/noncore/settings/packagemanager/packageinfodlg.h b/noncore/settings/packagemanager/packageinfodlg.h
index 7ed9f0a..ec031e1 100644
--- a/noncore/settings/packagemanager/packageinfodlg.h
+++ b/noncore/settings/packagemanager/packageinfodlg.h
@@ -1,65 +1,65 @@
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 PACKAGEINFODLG_H 30#ifndef PACKAGEINFODLG_H
31#define PACKAGEINFODLG_H 31#define PACKAGEINFODLG_H
32 32
33#include "opackage.h"
34
33#include <qmultilineedit.h> 35#include <qmultilineedit.h>
34#include <qwidget.h> 36#include <qwidget.h>
35 37
36#include "opackage.h"
37
38class QPushButton; 38class QPushButton;
39 39
40class OPackage; 40class OPackage;
41class OPackageManager; 41class OPackageManager;
42 42
43class PackageInfoDlg : public QWidget 43class PackageInfoDlg : public QWidget
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 46
47public: 47public:
48 PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null ); 48 PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null );
49 ~PackageInfoDlg(); 49 ~PackageInfoDlg();
50 50
51private: 51private:
52 OPackageManager *m_packman; // Pointer to application instance of package manager 52 OPackageManager *m_packman; // Pointer to application instance of package manager
53 OPackage *m_package; // Pointer to package to display information for 53 OPackage *m_package; // Pointer to package to display information for
54 54
55 // UI controls 55 // UI controls
56 QMultiLineEdit m_information; // Multi-line edit to display package information 56 QMultiLineEdit m_information; // Multi-line edit to display package information
57 QMultiLineEdit m_files; // Multi-line edit to display package file list 57 QMultiLineEdit m_files; // Multi-line edit to display package file list
58 58
59private slots: 59private slots:
60 void slotBtnFileScan(); 60 void slotBtnFileScan();
61 void slotInfo( char *info ); 61 void slotInfo( char *info );
62 void slotFiles( char *filelist ); 62 void slotFiles( char *filelist );
63}; 63};
64 64
65#endif 65#endif
diff --git a/noncore/settings/packagemanager/promptdlg.cpp b/noncore/settings/packagemanager/promptdlg.cpp
index 4e82ba9..841b98e 100644
--- a/noncore/settings/packagemanager/promptdlg.cpp
+++ b/noncore/settings/packagemanager/promptdlg.cpp
@@ -1,134 +1,134 @@
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 "promptdlg.h" 30#include "promptdlg.h"
31 31
32#include <qpe/qpeapplication.h>
33
32#include <qlabel.h> 34#include <qlabel.h>
33#include <qlayout.h> 35#include <qlayout.h>
34#include <qpushbutton.h> 36#include <qpushbutton.h>
35#include <qwidgetlist.h> 37#include <qwidgetlist.h>
36 38
37#include <qpe/qpeapplication.h>
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 | 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::display() 60int PromptDlg::display()
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 )
73 { 73 {
74 int w, h; 74 int w, h;
75 QWidget * current = it.current(); 75 QWidget * current = it.current();
76 ++it; 76 ++it;
77 w = current->geometry().x() - current->x(); 77 w = current->geometry().x() - current->x();
78 h = current->geometry().y() - current->y(); 78 h = current->geometry().y() - current->y();
79 79
80 extraw = QMAX( extraw, w ); 80 extraw = QMAX( extraw, w );
81 extrah = QMAX( extrah, h ); 81 extrah = QMAX( extrah, h );
82 } 82 }
83 delete list; 83 delete list;
84 84
85 // sanity check for decoration frames. With embedding, we 85 // sanity check for decoration frames. With embedding, we
86 // might get extraordinary values 86 // might get extraordinary values
87 if ( extraw >= 10 || extrah >= 40 ) 87 if ( extraw >= 10 || extrah >= 40 )
88 extraw = extrah = 0; 88 extraw = extrah = 0;
89 89
90 if ( w ) 90 if ( w )
91 { 91 {
92 // Use mapToGlobal rather than geometry() in case w might 92 // Use mapToGlobal rather than geometry() in case w might
93 // be embedded in another application 93 // be embedded in another application
94 QPoint pp = w->mapToGlobal( QPoint(0,0) ); 94 QPoint pp = w->mapToGlobal( QPoint(0,0) );
95 p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 ); 95 p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 );
96 } 96 }
97 else 97 else
98 p = QPoint( desk->width()/2, desk->height()/2 ); 98 p = QPoint( desk->width()/2, desk->height()/2 );
99 99
100 p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah ); 100 p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah );
101 101
102 if ( p.x() + extraw + width() > desk->width() ) 102 if ( p.x() + extraw + width() > desk->width() )
103 p.setX( desk->width() - width() - extraw ); 103 p.setX( desk->width() - width() - extraw );
104 if ( p.x() < 0 ) 104 if ( p.x() < 0 )
105 p.setX( 0 ); 105 p.setX( 0 );
106 106
107 if ( p.y() + extrah + height() > desk->height() ) 107 if ( p.y() + extrah + height() > desk->height() )
108 p.setY( desk->height() - height() - extrah ); 108 p.setY( desk->height() - height() - extrah );
109 if ( p.y() < 0 ) 109 if ( p.y() < 0 )
110 p.setY( 0 ); 110 p.setY( 0 );
111 111
112 move( p ); 112 move( p );
113 show(); 113 show();
114 114
115 // Enter event loop for modality 115 // Enter event loop for modality
116 qApp->enter_loop(); 116 qApp->enter_loop();
117 117
118 return m_btnClicked; 118 return m_btnClicked;
119} 119}
120 120
121int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2, 121int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
122 QWidget *parent ) 122 QWidget *parent )
123{ 123{
124 PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent ); 124 PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent );
125 int rc = dlg->display(); 125 int rc = dlg->display();
126 delete dlg; 126 delete dlg;
127 return rc; 127 return rc;
128} 128}
129 129
130void PromptDlg::slotBtn1Clicked() 130void PromptDlg::slotBtn1Clicked()
131{ 131{
132 m_btnClicked = 1; 132 m_btnClicked = 1;
133 qApp->exit_loop(); 133 qApp->exit_loop();
134} 134}