summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp51
-rw-r--r--noncore/settings/packagemanager/entrydlg.h51
-rw-r--r--noncore/settings/packagemanager/filterdlg.cpp51
-rw-r--r--noncore/settings/packagemanager/filterdlg.h49
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp51
-rw-r--r--noncore/settings/packagemanager/installdlg.h49
-rw-r--r--noncore/settings/packagemanager/main.cpp49
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp51
-rw-r--r--noncore/settings/packagemanager/mainwindow.h51
-rw-r--r--noncore/settings/packagemanager/oconfitem.cpp43
-rw-r--r--noncore/settings/packagemanager/oconfitem.h43
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp43
-rw-r--r--noncore/settings/packagemanager/oipkg.h43
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp43
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.h44
-rw-r--r--noncore/settings/packagemanager/opackage.cpp43
-rw-r--r--noncore/settings/packagemanager/opackage.h43
-rw-r--r--noncore/settings/packagemanager/opackagemanager.cpp43
-rw-r--r--noncore/settings/packagemanager/opackagemanager.h43
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.cpp51
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.h49
-rw-r--r--noncore/settings/packagemanager/promptdlg.cpp51
-rw-r--r--noncore/settings/packagemanager/promptdlg.h51
23 files changed, 544 insertions, 542 deletions
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
index 3b794b4..5d61342 100644
--- a/noncore/settings/packagemanager/entrydlg.cpp
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -1,107 +1,108 @@
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, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "entrydlg.h" 31#include "entrydlg.h"
31 32
32#include <opie2/ofiledialog.h> 33#include <opie2/ofiledialog.h>
33 34
34#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 36#include <qpe/resource.h>
36 37
37#include <qlabel.h> 38#include <qlabel.h>
38#include <qlayout.h> 39#include <qlayout.h>
39#include <qlineedit.h> 40#include <qlineedit.h>
40#include <qpushbutton.h> 41#include <qpushbutton.h>
41 42
42EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) 43EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
43 : QDialog( parent, name, modal ) 44 : QDialog( parent, name, modal )
44{ 45{
45 QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 ); 46 QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 );
46 47
47 QLabel *l = new QLabel( label, this ); 48 QLabel *l = new QLabel( label, this );
48 l->setAlignment( AlignLeft | AlignTop | WordBreak ); 49 l->setAlignment( AlignLeft | AlignTop | WordBreak );
49 layout->addMultiCellWidget( l, 0, 0, 0, 1 ); 50 layout->addMultiCellWidget( l, 0, 0, 0, 1 );
50 51
51 m_entry = new QLineEdit( this ); 52 m_entry = new QLineEdit( this );
52 layout->addWidget( m_entry, 1, 0 ); 53 layout->addWidget( m_entry, 1, 0 );
53 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) ); 54 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) );
54 55
55 QPixmap pic; 56 QPixmap pic;
56 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 57 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
57 QPushButton *btn = new QPushButton( pic, QString::null, this ); 58 QPushButton *btn = new QPushButton( pic, QString::null, this );
58 btn->setMaximumWidth( btn->height() ); 59 btn->setMaximumWidth( btn->height() );
59 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); 60 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) );
60 layout->addWidget( btn, 1, 1 ); 61 layout->addWidget( btn, 1, 1 );
61 62
62 layout->setRowStretch( 2, 10 ); 63 layout->setRowStretch( 2, 10 );
63 64
64 resize( width(), l->height() + btn->height() + 8 ); 65 resize( width(), l->height() + btn->height() + 8 );
65} 66}
66 67
67void EntryDlg::setText( const QString &text ) 68void EntryDlg::setText( const QString &text )
68{ 69{
69 m_entry->setText( text ); 70 m_entry->setText( text );
70 m_entry->selectAll(); 71 m_entry->selectAll();
71} 72}
72 73
73QString EntryDlg::getText() 74QString EntryDlg::getText()
74{ 75{
75 return m_entry->text(); 76 return m_entry->text();
76} 77}
77 78
78QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok, 79QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
79 QWidget *parent, const char *name ) 80 QWidget *parent, const char *name )
80{ 81{
81 EntryDlg *dlg = new EntryDlg( label, parent, name, true ); 82 EntryDlg *dlg = new EntryDlg( label, parent, name, true );
82 dlg->setCaption( caption ); 83 dlg->setCaption( caption );
83 dlg->setText( text ); 84 dlg->setText( text );
84 85
85 QString result; 86 QString result;
86 87
87 *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted ); 88 *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted );
88 if ( *ok ) 89 if ( *ok )
89 result = dlg->getText(); 90 result = dlg->getText();
90 91
91 delete dlg; 92 delete dlg;
92 return result; 93 return result;
93} 94}
94void EntryDlg::slotTryAccept() 95void EntryDlg::slotTryAccept()
95{ 96{
96 if ( !m_entry->text().isEmpty() ) 97 if ( !m_entry->text().isEmpty() )
97 accept(); 98 accept();
98} 99}
99 100
100void EntryDlg::slotSelectPath() 101void EntryDlg::slotSelectPath()
101{ 102{
102 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() ); 103 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() );
103 if ( path.at( path.length() - 1 ) == '/' ) 104 if ( path.at( path.length() - 1 ) == '/' )
104 path.truncate( path.length() - 1 ); 105 path.truncate( path.length() - 1 );
105 if ( !path.isNull() ) 106 if ( !path.isNull() )
106 m_entry->setText( path ); 107 m_entry->setText( path );
107} 108}
diff --git a/noncore/settings/packagemanager/entrydlg.h b/noncore/settings/packagemanager/entrydlg.h
index 012589b..3f897ae 100644
--- a/noncore/settings/packagemanager/entrydlg.h
+++ b/noncore/settings/packagemanager/entrydlg.h
@@ -1,58 +1,59 @@
1/* 1/*
2 This file is part of the OPIE Project 2                 This file is part of the Opie Project
3 3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> 4 Copyright (C)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#ifndef ENTRYDLG_H 31#ifndef ENTRYDLG_H
31#define ENTRYDLG_H 32#define ENTRYDLG_H
32 33
33#include <qdialog.h> 34#include <qdialog.h>
34 35
35class QLineEdit; 36class QLineEdit;
36 37
37class EntryDlg : public QDialog 38class EntryDlg : public QDialog
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40 41
41public: 42public:
42 static QString getText( const QString &caption, const QString &label, const QString &text = QString::null, 43 static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
43 bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); 44 bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
44 45
45 EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true ); 46 EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true );
46 47
47 void setText( const QString &text ); 48 void setText( const QString &text );
48 QString getText(); 49 QString getText();
49 50
50private slots: 51private slots:
51 void slotTryAccept(); 52 void slotTryAccept();
52 void slotSelectPath(); 53 void slotSelectPath();
53 54
54private: 55private:
55 QLineEdit *m_entry; 56 QLineEdit *m_entry;
56}; 57};
57 58
58#endif // EntryDlg_H 59#endif // EntryDlg_H
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp
index e69b6eb..4924972 100644
--- a/noncore/settings/packagemanager/filterdlg.cpp
+++ b/noncore/settings/packagemanager/filterdlg.cpp
@@ -1,194 +1,195 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "filterdlg.h" 31#include "filterdlg.h"
31 32
32#include <qwhatsthis.h> 33#include <qwhatsthis.h>
33 34
34FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, 35FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name,
35 const QString &server, const QString &destination, 36 const QString &server, const QString &destination,
36 OPackageManager::Status status, const QString &category ) 37 OPackageManager::Status status, const QString &category )
37 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 38 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
38{ 39{
39 setCaption( tr( "Filter packages" ) ); 40 setCaption( tr( "Filter packages" ) );
40 41
41 QVBoxLayout *layout = new QVBoxLayout( this ); 42 QVBoxLayout *layout = new QVBoxLayout( this );
42 QScrollView *sv = new QScrollView( this ); 43 QScrollView *sv = new QScrollView( this );
43 layout->addWidget( sv, 0, 0 ); 44 layout->addWidget( sv, 0, 0 );
44 sv->setResizePolicy( QScrollView::AutoOneFit ); 45 sv->setResizePolicy( QScrollView::AutoOneFit );
45 sv->setFrameStyle( QFrame::NoFrame ); 46 sv->setFrameStyle( QFrame::NoFrame );
46 QWidget *container = new QWidget( sv->viewport() ); 47 QWidget *container = new QWidget( sv->viewport() );
47 sv->addChild( container ); 48 sv->addChild( container );
48 layout = new QVBoxLayout( container, 4, 4 ); 49 layout = new QVBoxLayout( container, 4, 4 );
49 50
50 // Category 51 // Category
51 m_categoryCB = new QCheckBox( tr( "Category:" ), container ); 52 m_categoryCB = new QCheckBox( tr( "Category:" ), container );
52 QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) ); 53 QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) );
53 connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); 54 connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) );
54 m_category = new QComboBox( container ); 55 m_category = new QComboBox( container );
55 QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) ); 56 QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) );
56 m_category->insertStringList( pm->categories() ); 57 m_category->insertStringList( pm->categories() );
57 initItem( m_category, m_categoryCB, category ); 58 initItem( m_category, m_categoryCB, category );
58 layout->addWidget( m_categoryCB ); 59 layout->addWidget( m_categoryCB );
59 layout->addWidget( m_category ); 60 layout->addWidget( m_category );
60 61
61 // Package name 62 // Package name
62 m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); 63 m_nameCB = new QCheckBox( tr( "Names containing:" ), container );
63 QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) ); 64 QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) );
64 connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); 65 connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) );
65 m_name = new QLineEdit( name, container ); 66 m_name = new QLineEdit( name, container );
66 QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) ); 67 QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) );
67 if ( !name.isNull() ) 68 if ( !name.isNull() )
68 m_nameCB->setChecked( true ); 69 m_nameCB->setChecked( true );
69 m_name->setEnabled( !name.isNull() ); 70 m_name->setEnabled( !name.isNull() );
70 layout->addWidget( m_nameCB ); 71 layout->addWidget( m_nameCB );
71 layout->addWidget( m_name ); 72 layout->addWidget( m_name );
72 73
73 // Status 74 // Status
74 m_statusCB = new QCheckBox( tr( "With the status:" ), container ); 75 m_statusCB = new QCheckBox( tr( "With the status:" ), container );
75 QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) ); 76 QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) );
76 connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); 77 connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) );
77 m_status = new QComboBox( container ); 78 m_status = new QComboBox( container );
78 QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) ); 79 QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) );
79 connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) ); 80 connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) );
80 QString currStatus; 81 QString currStatus;
81 switch ( status ) 82 switch ( status )
82 { 83 {
83 case OPackageManager::All : currStatus = tr( "All" ); 84 case OPackageManager::All : currStatus = tr( "All" );
84 break; 85 break;
85 case OPackageManager::Installed : currStatus = tr( "Installed" ); 86 case OPackageManager::Installed : currStatus = tr( "Installed" );
86 break; 87 break;
87 case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); 88 case OPackageManager::NotInstalled : currStatus = tr( "Not installed" );
88 break; 89 break;
89 case OPackageManager::Updated : currStatus = tr( "Updated" ); 90 case OPackageManager::Updated : currStatus = tr( "Updated" );
90 break; 91 break;
91 default : currStatus = QString::null; 92 default : currStatus = QString::null;
92 }; 93 };
93 m_status->insertItem( tr( "All" ) ); 94 m_status->insertItem( tr( "All" ) );
94 m_status->insertItem( tr( "Installed" ) ); 95 m_status->insertItem( tr( "Installed" ) );
95 m_status->insertItem( tr( "Not installed" ) ); 96 m_status->insertItem( tr( "Not installed" ) );
96 m_status->insertItem( tr( "Updated" ) ); 97 m_status->insertItem( tr( "Updated" ) );
97 initItem( m_status, m_statusCB, currStatus ); 98 initItem( m_status, m_statusCB, currStatus );
98 layout->addWidget( m_statusCB ); 99 layout->addWidget( m_statusCB );
99 layout->addWidget( m_status ); 100 layout->addWidget( m_status );
100 101
101 // Server 102 // Server
102 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); 103 m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container );
103 QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) ); 104 QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) );
104 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); 105 connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) );
105 m_server = new QComboBox( container ); 106 m_server = new QComboBox( container );
106 QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) ); 107 QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) );
107 m_server->insertStringList( pm->servers() ); 108 m_server->insertStringList( pm->servers() );
108 initItem( m_server, m_serverCB, server ); 109 initItem( m_server, m_serverCB, server );
109 layout->addWidget( m_serverCB ); 110 layout->addWidget( m_serverCB );
110 layout->addWidget( m_server ); 111 layout->addWidget( m_server );
111 112
112 // Destination 113 // Destination
113 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); 114 m_destCB = new QCheckBox( tr( "Installed on device at:" ), container );
114 QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) ); 115 QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) );
115 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); 116 connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) );
116 m_destination = new QComboBox( container ); 117 m_destination = new QComboBox( container );
117 QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) ); 118 QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) );
118 m_destination->insertStringList( pm->destinations() ); 119 m_destination->insertStringList( pm->destinations() );
119 initItem( m_destination, m_destCB, destination ); 120 initItem( m_destination, m_destCB, destination );
120 layout->addWidget( m_destCB ); 121 layout->addWidget( m_destCB );
121 layout->addWidget( m_destination ); 122 layout->addWidget( m_destination );
122} 123}
123 124
124void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) 125void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection )
125{ 126{
126 if ( !selection.isNull() ) 127 if ( !selection.isNull() )
127 { 128 {
128 checkBox->setChecked( true ); 129 checkBox->setChecked( true );
129 130
130 for ( int i = 0; i < comboBox->count(); i++ ) 131 for ( int i = 0; i < comboBox->count(); i++ )
131 { 132 {
132 if ( comboBox->text( i ) == selection ) 133 if ( comboBox->text( i ) == selection )
133 { 134 {
134 comboBox->setCurrentItem( i ); 135 comboBox->setCurrentItem( i );
135 return; 136 return;
136 } 137 }
137 } 138 }
138 } 139 }
139 comboBox->setEnabled( !selection.isNull() ); 140 comboBox->setEnabled( !selection.isNull() );
140} 141}
141 142
142void FilterDlg::slotNameSelected( bool selected ) 143void FilterDlg::slotNameSelected( bool selected )
143{ 144{
144 m_name->setEnabled( selected ); 145 m_name->setEnabled( selected );
145 m_name->setFocus(); 146 m_name->setFocus();
146} 147}
147 148
148void FilterDlg::slotServerSelected( bool selected ) 149void FilterDlg::slotServerSelected( bool selected )
149{ 150{
150 m_server->setEnabled( selected ); 151 m_server->setEnabled( selected );
151 m_server->setFocus(); 152 m_server->setFocus();
152} 153}
153 154
154void FilterDlg::slotDestSelected( bool selected ) 155void FilterDlg::slotDestSelected( bool selected )
155{ 156{
156 m_destination->setEnabled( selected ); 157 m_destination->setEnabled( selected );
157 m_destination->setFocus(); 158 m_destination->setFocus();
158} 159}
159 160
160void FilterDlg::slotStatusSelected( bool selected ) 161void FilterDlg::slotStatusSelected( bool selected )
161{ 162{
162 m_status->setEnabled( selected ); 163 m_status->setEnabled( selected );
163 m_status->setFocus(); 164 m_status->setFocus();
164 165
165 if ( !selected && !m_destCB->isEnabled() ) 166 if ( !selected && !m_destCB->isEnabled() )
166 { 167 {
167 // If status check box has been deselected and destination option was previously deselected 168 // If status check box has been deselected and destination option was previously deselected
168 // (because status == "Not installed"), re-enable destination option 169 // (because status == "Not installed"), re-enable destination option
169 m_destCB->setEnabled( true ); 170 m_destCB->setEnabled( true );
170 m_destination->setEnabled( true ); 171 m_destination->setEnabled( true );
171 } 172 }
172 else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) ) 173 else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) )
173 { 174 {
174 // If status check box has been selected and status == "Not installed", disable destination option 175 // If status check box has been selected and status == "Not installed", disable destination option
175 m_destCB->setEnabled( false ); 176 m_destCB->setEnabled( false );
176 m_destCB->setChecked( false ); 177 m_destCB->setChecked( false );
177 m_destination->setEnabled( false ); 178 m_destination->setEnabled( false );
178 } 179 }
179} 180}
180 181
181void FilterDlg::slotStatusChanged( const QString &category ) 182void FilterDlg::slotStatusChanged( const QString &category )
182{ 183{
183 bool notInstalled = ( category == tr( "Not installed" ) ); 184 bool notInstalled = ( category == tr( "Not installed" ) );
184 m_destCB->setEnabled( !notInstalled ); 185 m_destCB->setEnabled( !notInstalled );
185 m_destination->setEnabled( !notInstalled ); 186 m_destination->setEnabled( !notInstalled );
186 if ( notInstalled ) 187 if ( notInstalled )
187 m_destCB->setChecked( false ); 188 m_destCB->setChecked( false );
188} 189}
189 190
190void FilterDlg::slotCategorySelected( bool selected ) 191void FilterDlg::slotCategorySelected( bool selected )
191{ 192{
192 m_category->setEnabled( selected ); 193 m_category->setEnabled( selected );
193 m_category->setFocus(); 194 m_category->setFocus();
194} 195}
diff --git a/noncore/settings/packagemanager/filterdlg.h b/noncore/settings/packagemanager/filterdlg.h
index bd89b42..6f39464 100644
--- a/noncore/settings/packagemanager/filterdlg.h
+++ b/noncore/settings/packagemanager/filterdlg.h
@@ -1,101 +1,102 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5             .=l. 5 =.
6           .>+-= 6 .=l.
7 _;:,     .>    :=|. This file is free software; you can 7           .>+-=
8.> <`_,   >  .   <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i,     .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12     ._= =}       : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .%`+i>       _;_. 13     ._= =}       : or (at your option) any later version.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    : ..    .:,     . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.=       =       ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++=   -.     .`     .: 20..}^=.=       =       ; Library General Public License for more
21 :     =  ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22 -.   .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24    --        :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#ifndef FILTERDLG_H 31#ifndef FILTERDLG_H
31#define FILTERDLG_H 32#define FILTERDLG_H
32 33
33#include "opackagemanager.h" 34#include "opackagemanager.h"
34 35
35#include <qcheckbox.h> 36#include <qcheckbox.h>
36#include <qdialog.h> 37#include <qdialog.h>
37#include <qcombobox.h> 38#include <qcombobox.h>
38#include <qlayout.h> 39#include <qlayout.h>
39#include <qlineedit.h> 40#include <qlineedit.h>
40#include <qscrollview.h> 41#include <qscrollview.h>
41 42
42class FilterDlg : public QDialog 43class FilterDlg : public QDialog
43{ 44{
44 Q_OBJECT 45 Q_OBJECT
45 46
46public: 47public:
47 FilterDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &name = 0x0, 48 FilterDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &name = 0x0,
48 const QString &server = 0x0, const QString &destination = 0x0, 49 const QString &server = 0x0, const QString &destination = 0x0,
49 OPackageManager::Status status = OPackageManager::All, 50 OPackageManager::Status status = OPackageManager::All,
50 const QString &category = 0x0 ); 51 const QString &category = 0x0 );
51 52
52 QString name() 53 QString name()
53 { return m_nameCB->isChecked() ? m_name->text() : QString::null; }; 54 { return m_nameCB->isChecked() ? m_name->text() : QString::null; };
54 QString server() 55 QString server()
55 { return m_serverCB->isChecked() ? m_server->currentText() : QString::null; }; 56 { return m_serverCB->isChecked() ? m_server->currentText() : QString::null; };
56 QString destination() 57 QString destination()
57 { return m_destCB->isChecked() ? m_destination->currentText() : QString::null; }; 58 { return m_destCB->isChecked() ? m_destination->currentText() : QString::null; };
58 OPackageManager::Status status() 59 OPackageManager::Status status()
59 { 60 {
60 if ( m_statusCB->isChecked() ) 61 if ( m_statusCB->isChecked() )
61 { 62 {
62 if ( m_status->currentText() == tr( "All" ) ) 63 if ( m_status->currentText() == tr( "All" ) )
63 return OPackageManager::All; 64 return OPackageManager::All;
64 else if ( m_status->currentText() == tr( "Installed" ) ) 65 else if ( m_status->currentText() == tr( "Installed" ) )
65 return OPackageManager::Installed; 66 return OPackageManager::Installed;
66 else if ( m_status->currentText() == tr( "Not installed" ) ) 67 else if ( m_status->currentText() == tr( "Not installed" ) )
67 return OPackageManager::NotInstalled; 68 return OPackageManager::NotInstalled;
68 else if ( m_status->currentText() == tr( "Updated" ) ) 69 else if ( m_status->currentText() == tr( "Updated" ) )
69 return OPackageManager::Updated; 70 return OPackageManager::Updated;
70 } 71 }
71 72
72 return OPackageManager::NotDefined; 73 return OPackageManager::NotDefined;
73 }; 74 };
74 QString category() 75 QString category()
75 { return m_categoryCB->isChecked() ? m_category->currentText() : QString::null; }; 76 { return m_categoryCB->isChecked() ? m_category->currentText() : QString::null; };
76 77
77private: 78private:
78 QCheckBox *m_nameCB; 79 QCheckBox *m_nameCB;
79 QCheckBox *m_serverCB; 80 QCheckBox *m_serverCB;
80 QCheckBox *m_destCB; 81 QCheckBox *m_destCB;
81 QCheckBox *m_statusCB; 82 QCheckBox *m_statusCB;
82 QCheckBox *m_categoryCB; 83 QCheckBox *m_categoryCB;
83 84
84 QLineEdit *m_name; 85 QLineEdit *m_name;
85 QComboBox *m_server; 86 QComboBox *m_server;
86 QComboBox *m_destination; 87 QComboBox *m_destination;
87 QComboBox *m_status; 88 QComboBox *m_status;
88 QComboBox *m_category; 89 QComboBox *m_category;
89 90
90 void initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ); 91 void initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection );
91 92
92private slots: 93private slots:
93 void slotNameSelected( bool ); 94 void slotNameSelected( bool );
94 void slotServerSelected( bool ); 95 void slotServerSelected( bool );
95 void slotDestSelected( bool ); 96 void slotDestSelected( bool );
96 void slotStatusSelected( bool ); 97 void slotStatusSelected( bool );
97 void slotStatusChanged( const QString & ); 98 void slotStatusChanged( const QString & );
98 void slotCategorySelected( bool ); 99 void slotCategorySelected( bool );
99}; 100};
100 101
101#endif 102#endif
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 8aed10d..205d7ed 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -1,323 +1,324 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "installdlg.h" 31#include "installdlg.h"
31 32
32#include <opie2/ofiledialog.h> 33#include <opie2/ofiledialog.h>
33 34
34#include <qpe/fileselector.h> 35#include <qpe/fileselector.h>
35#include <qpe/resource.h> 36#include <qpe/resource.h>
36#include <qpe/storage.h> 37#include <qpe/storage.h>
37 38
38#include <qapplication.h> 39#include <qapplication.h>
39#include <qcombobox.h> 40#include <qcombobox.h>
40#include <qfileinfo.h> 41#include <qfileinfo.h>
41#include <qgroupbox.h> 42#include <qgroupbox.h>
42#include <qlabel.h> 43#include <qlabel.h>
43#include <qlayout.h> 44#include <qlayout.h>
44#include <qmap.h> 45#include <qmap.h>
45#include <qmultilineedit.h> 46#include <qmultilineedit.h>
46#include <qpushbutton.h> 47#include <qpushbutton.h>
47 48
48#include <sys/vfs.h> 49#include <sys/vfs.h>
49 50
50#include "opackagemanager.h" 51#include "opackagemanager.h"
51 52
52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, 53InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption,
53 OPackage::Command command1, const QStringList &packages1, 54 OPackage::Command command1, const QStringList &packages1,
54 OPackage::Command command2, const QStringList &packages2, 55 OPackage::Command command2, const QStringList &packages2,
55 OPackage::Command command3, const QStringList &packages3 ) 56 OPackage::Command command3, const QStringList &packages3 )
56 : QWidget( 0l ) 57 : QWidget( 0l )
57 , m_packman( pm ) 58 , m_packman( pm )
58 , m_installFound( false ) 59 , m_installFound( false )
59 , m_numCommands( 0 ) 60 , m_numCommands( 0 )
60 , m_currCommand( 0 ) 61 , m_currCommand( 0 )
61 , m_destItem( 0l ) 62 , m_destItem( 0l )
62{ 63{
63 // Save command/package list information 64 // Save command/package list information
64 if ( command1 != OPackage::NotDefined ) 65 if ( command1 != OPackage::NotDefined )
65 { 66 {
66 m_command[ m_numCommands ] = command1; 67 m_command[ m_numCommands ] = command1;
67 m_packages[ m_numCommands ] = packages1; 68 m_packages[ m_numCommands ] = packages1;
68 ++m_numCommands; 69 ++m_numCommands;
69 70
70 if ( command1 == OPackage::Install ) 71 if ( command1 == OPackage::Install )
71 m_installFound = true; 72 m_installFound = true;
72 } 73 }
73 if ( command2 != OPackage::NotDefined ) 74 if ( command2 != OPackage::NotDefined )
74 { 75 {
75 m_command[ m_numCommands ] = command2; 76 m_command[ m_numCommands ] = command2;
76 m_packages[ m_numCommands ] = packages2; 77 m_packages[ m_numCommands ] = packages2;
77 ++m_numCommands; 78 ++m_numCommands;
78 79
79 if ( command2 == OPackage::Install ) 80 if ( command2 == OPackage::Install )
80 m_installFound = true; 81 m_installFound = true;
81 } 82 }
82 if ( command3 != OPackage::NotDefined ) 83 if ( command3 != OPackage::NotDefined )
83 { 84 {
84 m_command[ m_numCommands ] = command3; 85 m_command[ m_numCommands ] = command3;
85 m_packages[ m_numCommands ] = packages3; 86 m_packages[ m_numCommands ] = packages3;
86 ++m_numCommands; 87 ++m_numCommands;
87 88
88 if ( command3 == OPackage::Install ) 89 if ( command3 == OPackage::Install )
89 m_installFound = true; 90 m_installFound = true;
90 } 91 }
91 92
92 // Initialize UI 93 // Initialize UI
93 if ( parent ) 94 if ( parent )
94 parent->setCaption( caption ); 95 parent->setCaption( caption );
95 96
96 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); 97 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 );
97 98
98 if ( m_installFound ) 99 if ( m_installFound )
99 { 100 {
100 QLabel *label = new QLabel( tr( "Destination" ), this ); 101 QLabel *label = new QLabel( tr( "Destination" ), this );
101 layout->addWidget( label, 0, 0 ); 102 layout->addWidget( label, 0, 0 );
102 m_destination = new QComboBox( this ); 103 m_destination = new QComboBox( this );
103 m_destination->insertStringList( m_packman->destinations() ); 104 m_destination->insertStringList( m_packman->destinations() );
104 layout->addWidget( m_destination, 0, 1 ); 105 layout->addWidget( m_destination, 0, 1 );
105 connect( m_destination, SIGNAL(highlighted(const QString&)), 106 connect( m_destination, SIGNAL(highlighted(const QString&)),
106 this, SLOT(slotDisplayAvailSpace(const QString&)) ); 107 this, SLOT(slotDisplayAvailSpace(const QString&)) );
107 108
108 label = new QLabel( tr( "Space Avail" ), this ); 109 label = new QLabel( tr( "Space Avail" ), this );
109 layout->addWidget( label, 1, 0 ); 110 layout->addWidget( label, 1, 0 );
110 m_availSpace = new QLabel( this ); 111 m_availSpace = new QLabel( this );
111 layout->addWidget( m_availSpace, 1, 1 ); 112 layout->addWidget( m_availSpace, 1, 1 );
112 113
113 // TODO - select correct destination 114 // TODO - select correct destination
114 slotDisplayAvailSpace( m_destination->currentText() ); 115 slotDisplayAvailSpace( m_destination->currentText() );
115 } 116 }
116 else 117 else
117 { 118 {
118 m_destination = 0l; 119 m_destination = 0l;
119 m_availSpace = 0l; 120 m_availSpace = 0l;
120 } 121 }
121 122
122 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 123 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
123 groupBox->layout()->setSpacing( 0 ); 124 groupBox->layout()->setSpacing( 0 );
124 groupBox->layout()->setMargin( 4 ); 125 groupBox->layout()->setMargin( 4 );
125 126
126 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); 127 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() );
127 m_output = new QMultiLineEdit( groupBox ); 128 m_output = new QMultiLineEdit( groupBox );
128 m_output->setReadOnly( true ); 129 m_output->setReadOnly( true );
129 groupBoxLayout->addWidget( m_output ); 130 groupBoxLayout->addWidget( m_output );
130 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); 131 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 );
131 132
132 QPixmap pic; 133 QPixmap pic;
133 pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 134 pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
134 m_btnStart = new QPushButton( pic, tr( "Start" ), this ); 135 m_btnStart = new QPushButton( pic, tr( "Start" ), this );
135 m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); 136 m_btnStart->setMinimumHeight( AppLnk::smallIconSize() );
136 layout->addWidget( m_btnStart, 3, 0 ); 137 layout->addWidget( m_btnStart, 3, 0 );
137 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); 138 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) );
138 139
139 pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 140 pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
140 m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); 141 m_btnOptions = new QPushButton( pic, tr( "Options" ), this );
141 m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); 142 m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() );
142 layout->addWidget( m_btnOptions, 3, 1 ); 143 layout->addWidget( m_btnOptions, 3, 1 );
143 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); 144 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) );
144 145
145 // Display packages being acted upon in output widget 146 // Display packages being acted upon in output widget
146 for( int i = 0; i < m_numCommands; i++ ) 147 for( int i = 0; i < m_numCommands; i++ )
147 { 148 {
148 if ( !m_packages[ i ].isEmpty() ) 149 if ( !m_packages[ i ].isEmpty() )
149 { 150 {
150 QString lineStr = tr( "Packages to " ); 151 QString lineStr = tr( "Packages to " );
151 152
152 switch( m_command[ i ] ) 153 switch( m_command[ i ] )
153 { 154 {
154 case OPackage::Install : lineStr.append( tr( "install" ) ); 155 case OPackage::Install : lineStr.append( tr( "install" ) );
155 break; 156 break;
156 case OPackage::Remove : lineStr.append( tr( "remove" ) ); 157 case OPackage::Remove : lineStr.append( tr( "remove" ) );
157 break; 158 break;
158 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); 159 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
159 break; 160 break;
160 case OPackage::Download : lineStr.append( tr( "download" ) ); 161 case OPackage::Download : lineStr.append( tr( "download" ) );
161 break; 162 break;
162 default : 163 default :
163 break; 164 break;
164 }; 165 };
165 lineStr.append( ":\n" ); 166 lineStr.append( ":\n" );
166 167
167 QStringList tmpPackage = m_packages[ i ]; 168 QStringList tmpPackage = m_packages[ i ];
168 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) 169 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it )
169 { 170 {
170 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 171 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
171 } 172 }
172 173
173 m_output->append( lineStr ); 174 m_output->append( lineStr );
174 } 175 }
175 } 176 }
176 177
177 m_output->append( tr( "Press the start button to begin.\n" ) ); 178 m_output->append( tr( "Press the start button to begin.\n" ) );
178 m_output->setCursorPosition( m_output->numLines(), 0 ); 179 m_output->setCursorPosition( m_output->numLines(), 0 );
179 180
180} 181}
181 182
182void InstallDlg::slotDisplayAvailSpace( const QString &destination ) 183void InstallDlg::slotDisplayAvailSpace( const QString &destination )
183{ 184{
184 // If available space is not displayed, exit 185 // If available space is not displayed, exit
185 if ( !m_availSpace ) 186 if ( !m_availSpace )
186 return; 187 return;
187 188
188 QString space = tr( "Unknown" ); 189 QString space = tr( "Unknown" );
189 190
190 // Get destination 191 // Get destination
191 if ( !destination.isNull() ) 192 if ( !destination.isNull() )
192 m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); 193 m_destItem = m_packman->findConfItem( OConfItem::Destination, destination );
193 194
194 if ( m_destItem ) 195 if ( m_destItem )
195 { 196 {
196 // Calculate available space 197 // Calculate available space
197 struct statfs fs; 198 struct statfs fs;
198 if ( !statfs( m_destItem->value(), &fs ) ) 199 if ( !statfs( m_destItem->value(), &fs ) )
199 { 200 {
200 long mult = fs.f_bsize / 1024; 201 long mult = fs.f_bsize / 1024;
201 long div = 1024 / fs.f_bsize; 202 long div = 1024 / fs.f_bsize;
202 203
203 if ( !mult ) mult = 1; 204 if ( !mult ) mult = 1;
204 if ( !div ) div = 1; 205 if ( !div ) div = 1;
205 long avail = fs.f_bavail * mult / div; 206 long avail = fs.f_bavail * mult / div;
206 207
207 space = tr( "%1 Kb" ).arg( avail ); 208 space = tr( "%1 Kb" ).arg( avail );
208 } 209 }
209 } 210 }
210 211
211 // Display available space 212 // Display available space
212 m_availSpace->setText( space ); 213 m_availSpace->setText( space );
213} 214}
214 215
215void InstallDlg::slotBtnStart() 216void InstallDlg::slotBtnStart()
216{ 217{
217 QString btnText = m_btnStart->text(); 218 QString btnText = m_btnStart->text();
218 if ( btnText == tr( "Abort" ) ) 219 if ( btnText == tr( "Abort" ) )
219 { 220 {
220 // Prevent unexecuted commands from executing 221 // Prevent unexecuted commands from executing
221 m_currCommand = 999; 222 m_currCommand = 999;
222 223
223 // Allow user to close dialog 224 // Allow user to close dialog
224 m_btnStart->setText( tr( "Close" ) ); 225 m_btnStart->setText( tr( "Close" ) );
225 QPixmap pic; 226 QPixmap pic;
226 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 227 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
227 m_btnStart->setIconSet( pic ); 228 m_btnStart->setIconSet( pic );
228 return; 229 return;
229 } 230 }
230 else if ( btnText == tr( "Close" ) ) 231 else if ( btnText == tr( "Close" ) )
231 { 232 {
232 // TODO - force reload of package data 233 // TODO - force reload of package data
233 emit closeInstallDlg(); 234 emit closeInstallDlg();
234 return; 235 return;
235 } 236 }
236 237
237 // Start was clicked, start executing 238 // Start was clicked, start executing
238 QString dest; 239 QString dest;
239 if ( m_installFound ) 240 if ( m_installFound )
240 { 241 {
241 dest = m_destination->currentText(); 242 dest = m_destination->currentText();
242 m_destination->setEnabled( false ); 243 m_destination->setEnabled( false );
243 } 244 }
244 245
245 m_btnOptions->setEnabled( false ); 246 m_btnOptions->setEnabled( false );
246 if ( m_numCommands > 1 ) 247 if ( m_numCommands > 1 )
247 { 248 {
248 m_btnStart->setText( tr( "Abort" ) ); 249 m_btnStart->setText( tr( "Abort" ) );
249 QPixmap pic; 250 QPixmap pic;
250 pic.convertFromImage( Resource::loadImage( "reset" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 251 pic.convertFromImage( Resource::loadImage( "reset" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
251 m_btnStart->setIconSet( pic ); 252 m_btnStart->setIconSet( pic );
252 } 253 }
253 else 254 else
254 { 255 {
255 m_btnStart->setEnabled( false ); 256 m_btnStart->setEnabled( false );
256 } 257 }
257 258
258 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) 259 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
259 { 260 {
260 // Execute next command 261 // Execute next command
261 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, 262 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
262 this, SLOT(slotOutput(const QString &)), true ); 263 this, SLOT(slotOutput(const QString &)), true );
263 } 264 }
264 265
265 // All commands executed, allow user to close dialog 266 // All commands executed, allow user to close dialog
266 m_btnStart->setEnabled( true ); 267 m_btnStart->setEnabled( true );
267 m_btnStart->setText( tr( "Close" ) ); 268 m_btnStart->setText( tr( "Close" ) );
268 QPixmap pic; 269 QPixmap pic;
269 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 270 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
270 m_btnStart->setIconSet( pic ); 271 m_btnStart->setIconSet( pic );
271 272
272 m_btnOptions->setEnabled( true ); 273 m_btnOptions->setEnabled( true );
273 m_btnOptions->setText( tr( "Save output" ) ); 274 m_btnOptions->setText( tr( "Save output" ) );
274 pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 275 pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
275 m_btnOptions->setIconSet( pic ); 276 m_btnOptions->setIconSet( pic );
276} 277}
277 278
278void InstallDlg::slotBtnOptions() 279void InstallDlg::slotBtnOptions()
279{ 280{
280 QString btnText = m_btnOptions->text(); 281 QString btnText = m_btnOptions->text();
281 if ( btnText == tr( "Options" ) ) 282 if ( btnText == tr( "Options" ) )
282 { 283 {
283 // Display configuration dialog (only options tab is enabled) 284 // Display configuration dialog (only options tab is enabled)
284 m_packman->configureDlg( true ); 285 m_packman->configureDlg( true );
285 return; 286 return;
286 } 287 }
287 288
288 // Save output was clicked 289 // Save output was clicked
289 QMap<QString, QStringList> map; 290 QMap<QString, QStringList> map;
290 map.insert( tr( "All" ), QStringList() ); 291 map.insert( tr( "All" ), QStringList() );
291 QStringList text; 292 QStringList text;
292 text << "text/*"; 293 text << "text/*";
293 map.insert(tr( "Text" ), text ); 294 map.insert(tr( "Text" ), text );
294 text << "*"; 295 text << "*";
295 map.insert( tr( "All" ), text ); 296 map.insert( tr( "All" ), text );
296 297
297 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 298 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
298 if( !filename.isEmpty() ) 299 if( !filename.isEmpty() )
299 { 300 {
300 QString currentFileName = QFileInfo( filename ).fileName(); 301 QString currentFileName = QFileInfo( filename ).fileName();
301 DocLnk doc; 302 DocLnk doc;
302 doc.setType( "text/plain" ); 303 doc.setType( "text/plain" );
303 doc.setFile( filename ); 304 doc.setFile( filename );
304 doc.setName( currentFileName ); 305 doc.setName( currentFileName );
305 FileManager fm; 306 FileManager fm;
306 fm.saveFile( doc, m_output->text() ); 307 fm.saveFile( doc, m_output->text() );
307 } 308 }
308} 309}
309 310
310void InstallDlg::slotOutput( const QString &msg ) 311void InstallDlg::slotOutput( const QString &msg )
311{ 312{
312 // Allow processing of other events 313 // Allow processing of other events
313 qApp->processEvents(); 314 qApp->processEvents();
314 315
315 QString lineStr = msg; 316 QString lineStr = msg;
316 if ( lineStr[lineStr.length()-1] == '\n' ) 317 if ( lineStr[lineStr.length()-1] == '\n' )
317 lineStr.truncate( lineStr.length() - 1 ); 318 lineStr.truncate( lineStr.length() - 1 );
318 m_output->append( lineStr ); 319 m_output->append( lineStr );
319 m_output->setCursorPosition( m_output->numLines(), 0 ); 320 m_output->setCursorPosition( m_output->numLines(), 0 );
320 321
321 // Update available space 322 // Update available space
322 slotDisplayAvailSpace( QString::null ); 323 slotDisplayAvailSpace( QString::null );
323} 324}
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h
index e633809..a41a38f 100644
--- a/noncore/settings/packagemanager/installdlg.h
+++ b/noncore/settings/packagemanager/installdlg.h
@@ -1,92 +1,93 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#ifndef INSTALLDLG_H 31#ifndef INSTALLDLG_H
31#define INSTALLDLG_H 32#define INSTALLDLG_H
32 33
33#include <qwidget.h> 34#include <qwidget.h>
34 35
35#include "opackage.h" 36#include "opackage.h"
36 37
37class QComboBox; 38class QComboBox;
38class QLabel; 39class QLabel;
39class QMultiLineEdit; 40class QMultiLineEdit;
40class QPushButton; 41class QPushButton;
41 42
42class OConfItem; 43class OConfItem;
43class OPackageManager; 44class OPackageManager;
44 45
45class InstallDlg : public QWidget 46class InstallDlg : public QWidget
46{ 47{
47 Q_OBJECT 48 Q_OBJECT
48 49
49public: 50public:
50 InstallDlg( QWidget *parent = 0l, OPackageManager *pm = 0l, 51 InstallDlg( QWidget *parent = 0l, OPackageManager *pm = 0l,
51 const QString &caption = QString::null, 52 const QString &caption = QString::null,
52 OPackage::Command command1 = OPackage::NotDefined, 53 OPackage::Command command1 = OPackage::NotDefined,
53 const QStringList &packages1 = QStringList(), 54 const QStringList &packages1 = QStringList(),
54 OPackage::Command command2 = OPackage::NotDefined, 55 OPackage::Command command2 = OPackage::NotDefined,
55 const QStringList &packages2 = QStringList(), 56 const QStringList &packages2 = QStringList(),
56 OPackage::Command command3 = OPackage::NotDefined, 57 OPackage::Command command3 = OPackage::NotDefined,
57 const QStringList &packages3 = QStringList() ); 58 const QStringList &packages3 = QStringList() );
58 59
59private: 60private:
60 OPackageManager *m_packman; // Pointer to application instance of package manager 61 OPackageManager *m_packman; // Pointer to application instance of package manager
61 62
62 bool m_installFound; // Indicates if an install is being done, controls display of 63 bool m_installFound; // Indicates if an install is being done, controls display of
63 // destination selection, available space 64 // destination selection, available space
64 65
65 // UI controls 66 // UI controls
66 QComboBox *m_destination; // Destination selection list 67 QComboBox *m_destination; // Destination selection list
67 QLabel *m_availSpace; // Text label to display available space on selected destination 68 QLabel *m_availSpace; // Text label to display available space on selected destination
68 QMultiLineEdit *m_output; // Multi-line edit to display status 69 QMultiLineEdit *m_output; // Multi-line edit to display status
69 QPushButton *m_btnStart; // Start/abort/close button 70 QPushButton *m_btnStart; // Start/abort/close button
70 QPushButton *m_btnOptions; // Installation options button 71 QPushButton *m_btnOptions; // Installation options button
71 72
72 // Commands and packages to execute 73 // Commands and packages to execute
73 int m_numCommands; // Number of commands to be executed 74 int m_numCommands; // Number of commands to be executed
74 int m_currCommand; // Number of currently executing command 75 int m_currCommand; // Number of currently executing command
75 OPackage::Command m_command[3]; // List of commands to be executed 76 OPackage::Command m_command[3]; // List of commands to be executed
76 QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) 77 QStringList m_packages[3]; // Lists of package names associated to commands (m_command[])
77 OConfItem *m_destItem; // Pointer to destination for package installation 78 OConfItem *m_destItem; // Pointer to destination for package installation
78 79
79private slots: 80private slots:
80 // UI control slots 81 // UI control slots
81 void slotDisplayAvailSpace( const QString &destination ); 82 void slotDisplayAvailSpace( const QString &destination );
82 void slotBtnStart(); 83 void slotBtnStart();
83 void slotBtnOptions(); 84 void slotBtnOptions();
84 85
85 // Execution slots 86 // Execution slots
86 void slotOutput( const QString &msg ); 87 void slotOutput( const QString &msg );
87 88
88signals: 89signals:
89 void closeInstallDlg(); 90 void closeInstallDlg();
90}; 91};
91 92
92#endif 93#endif
diff --git a/noncore/settings/packagemanager/main.cpp b/noncore/settings/packagemanager/main.cpp
index 3792881..5863662 100644
--- a/noncore/settings/packagemanager/main.cpp
+++ b/noncore/settings/packagemanager/main.cpp
@@ -1,34 +1,35 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5             .=l. 5 =.
6           .>+-= 6 .=l.
7 _;:,     .>    :=|. This file is free software; you can 7           .>+-=
8.> <`_,   >  .   <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i,     .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12     ._= =}       : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .%`+i>       _;_. 13     ._= =}       : or (at your option) any later version.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    : ..    .:,     . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.=       =       ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++=   -.     .`     .: 20..}^=.=       =       ; Library General Public License for more
21 :     =  ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22 -.   .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24    --        :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "mainwindow.h" 31#include "mainwindow.h"
31 32
32#include <opie2/oapplicationfactory.h> 33#include <opie2/oapplicationfactory.h>
33 34
34OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ) 35OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> )
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 8a5b90c..0e40c01 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,539 +1,540 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "mainwindow.h" 31#include "mainwindow.h"
31#include "installdlg.h" 32#include "installdlg.h"
32#include "filterdlg.h" 33#include "filterdlg.h"
33#include "promptdlg.h" 34#include "promptdlg.h"
34#include "entrydlg.h" 35#include "entrydlg.h"
35#include "packageinfodlg.h" 36#include "packageinfodlg.h"
36 37
37#include <opie2/ofiledialog.h> 38#include <opie2/ofiledialog.h>
38 39
39#include <qpe/qcopenvelope_qws.h> 40#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpeapplication.h> 41#include <qpe/qpeapplication.h>
41#include <qpe/resource.h> 42#include <qpe/resource.h>
42 43
43#include <qaction.h> 44#include <qaction.h>
44#include <qdir.h> 45#include <qdir.h>
45#include <qlayout.h> 46#include <qlayout.h>
46#include <qlineedit.h> 47#include <qlineedit.h>
47#include <qmenubar.h> 48#include <qmenubar.h>
48#include <qmessagebox.h> 49#include <qmessagebox.h>
49#include <qpopupmenu.h> 50#include <qpopupmenu.h>
50#include <qtimer.h> 51#include <qtimer.h>
51#include <qtoolbar.h> 52#include <qtoolbar.h>
52#include <qwhatsthis.h> 53#include <qwhatsthis.h>
53 54
54MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) 55MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
55 : QMainWindow( parent, name, WStyle_ContextHelp ) 56 : QMainWindow( parent, name, WStyle_ContextHelp )
56 , m_config( "packman" ) 57 , m_config( "packman" )
57 , m_packman( &m_config, this ) 58 , m_packman( &m_config, this )
58 , m_menuBar( this ) 59 , m_menuBar( this )
59 , m_toolBar( this ) 60 , m_toolBar( this )
60 , m_findBar( this ) 61 , m_findBar( this )
61 , m_widgetStack( this ) 62 , m_widgetStack( this )
62 , m_packageList( this ) 63 , m_packageList( this )
63 , m_statusWidget( this ) 64 , m_statusWidget( this )
64 , m_statusText( &m_statusWidget ) 65 , m_statusText( &m_statusWidget )
65 , m_statusBar( &m_statusWidget ) 66 , m_statusBar( &m_statusWidget )
66 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 67 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
67 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 68 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
68 , m_iconNull( m_iconUpdated.size() ) 69 , m_iconNull( m_iconUpdated.size() )
69 , m_filterName( QString::null ) 70 , m_filterName( QString::null )
70 , m_filterServer( QString::null ) 71 , m_filterServer( QString::null )
71 , m_filterDest( QString::null ) 72 , m_filterDest( QString::null )
72 , m_filterStatus( OPackageManager::NotDefined ) 73 , m_filterStatus( OPackageManager::NotDefined )
73 , m_filterCategory( QString::null ) 74 , m_filterCategory( QString::null )
74 75
75{ 76{
76// setCaption( tr( "Package Manager" ) ); 77// setCaption( tr( "Package Manager" ) );
77 78
78 m_iconNull.fill( colorGroup().base() ); 79 m_iconNull.fill( colorGroup().base() );
79 80
80 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); 81 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
81 82
82 // Initialize widget stack, package list and status widget 83 // Initialize widget stack, package list and status widget
83 initStatusWidget(); 84 initStatusWidget();
84 initPackageList(); 85 initPackageList();
85 86
86 m_widgetStack.addWidget( &m_statusWidget, 2 ); 87 m_widgetStack.addWidget( &m_statusWidget, 2 );
87 m_widgetStack.addWidget( &m_packageList, 1 ); 88 m_widgetStack.addWidget( &m_packageList, 1 );
88 setCentralWidget( &m_widgetStack ); 89 setCentralWidget( &m_widgetStack );
89 90
90 // Initialize remaining user interface items 91 // Initialize remaining user interface items
91 initUI(); 92 initUI();
92 93
93 // Initialize package information 94 // Initialize package information
94 QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) ); 95 QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) );
95} 96}
96 97
97void MainWindow::closeEvent( QCloseEvent *event ) 98void MainWindow::closeEvent( QCloseEvent *event )
98{ 99{
99 // Close app only if either the package or status widgets are currently active 100 // Close app only if either the package or status widgets are currently active
100 bool close = m_widgetStack.visibleWidget() == &m_packageList || 101 bool close = m_widgetStack.visibleWidget() == &m_packageList ||
101 m_widgetStack.visibleWidget() == &m_statusWidget; 102 m_widgetStack.visibleWidget() == &m_statusWidget;
102 if ( close ) 103 if ( close )
103 { 104 {
104 // TODO - write out application configuration settings 105 // TODO - write out application configuration settings
105 106
106 // Write out package manager configuration settings 107 // Write out package manager configuration settings
107 m_packman.saveSettings(); 108 m_packman.saveSettings();
108 event->accept(); 109 event->accept();
109 } 110 }
110 else 111 else
111 { 112 {
112 delete m_widgetStack.visibleWidget(); 113 delete m_widgetStack.visibleWidget();
113 m_widgetStack.raiseWidget( &m_packageList ); 114 m_widgetStack.raiseWidget( &m_packageList );
114 event->ignore(); 115 event->ignore();
115 } 116 }
116} 117}
117 118
118void MainWindow::initPackageList() 119void MainWindow::initPackageList()
119{ 120{
120 m_packageList.addColumn( tr( "Packages" ) ); 121 m_packageList.addColumn( tr( "Packages" ) );
121 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." ) ); 122 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." ) );
122 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); 123 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
123 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), 124 connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
124 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); 125 this, SLOT(slotDisplayPackageInfo(QListViewItem*)) );
125} 126}
126 127
127void MainWindow::initStatusWidget() 128void MainWindow::initStatusWidget()
128{ 129{
129 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); 130 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
130 131
131 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 132 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
132 layout->addWidget( &m_statusText ); 133 layout->addWidget( &m_statusText );
133 134
134 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); 135 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
135 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); 136 connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) );
136 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); 137 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
137 138
138 layout->addWidget( &m_statusBar ); 139 layout->addWidget( &m_statusBar );
139} 140}
140 141
141void MainWindow::initUI() 142void MainWindow::initUI()
142{ 143{
143 // Build menu and tool bars 144 // Build menu and tool bars
144 setToolBarsMovable( false ); 145 setToolBarsMovable( false );
145 146
146 m_menuBar.setHorizontalStretchable( true ); 147 m_menuBar.setHorizontalStretchable( true );
147 QMenuBar *mb = new QMenuBar( &m_menuBar ); 148 QMenuBar *mb = new QMenuBar( &m_menuBar );
148 mb->setMargin( 0 ); 149 mb->setMargin( 0 );
149 150
150 // Find toolbar 151 // Find toolbar
151 addToolBar( &m_findBar, QMainWindow::Top, true ); 152 addToolBar( &m_findBar, QMainWindow::Top, true );
152 m_findBar.setHorizontalStretchable( true ); 153 m_findBar.setHorizontalStretchable( true );
153 m_findEdit = new QLineEdit( &m_findBar ); 154 m_findEdit = new QLineEdit( &m_findBar );
154 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); 155 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
155 m_findBar.setStretchableWidget( m_findEdit ); 156 m_findBar.setStretchableWidget( m_findEdit );
156 connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); 157 connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) );
157 158
158 // Packages menu 159 // Packages menu
159 QPopupMenu *popup = new QPopupMenu( this ); 160 QPopupMenu *popup = new QPopupMenu( this );
160 161
161 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); 162 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 );
162 a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); 163 a->setWhatsThis( tr( "Tap here to update package lists from servers." ) );
163 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); 164 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
164 a->addTo( popup ); 165 a->addTo( popup );
165 a->addTo( &m_toolBar ); 166 a->addTo( &m_toolBar );
166 167
167 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); 168 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 );
168 actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); 169 actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) );
169 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); 170 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
170 actionUpgrade->addTo( popup ); 171 actionUpgrade->addTo( popup );
171 actionUpgrade->addTo( &m_toolBar ); 172 actionUpgrade->addTo( &m_toolBar );
172 173
173 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); 174 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
174 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); 175 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
175 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 176 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
176 actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); 177 actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) );
177 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); 178 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
178 actionDownload->addTo( popup ); 179 actionDownload->addTo( popup );
179 actionDownload->addTo( &m_toolBar ); 180 actionDownload->addTo( &m_toolBar );
180 181
181 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); 182 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
182 a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); 183 a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) );
183 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); 184 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
184 a->addTo( popup ); 185 a->addTo( popup );
185 a->addTo( &m_toolBar ); 186 a->addTo( &m_toolBar );
186 187
187 a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); 188 a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 );
188 a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); 189 a->setWhatsThis( tr( "Tap here to install a package file located on device." ) );
189 connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); 190 connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) );
190 a->addTo( popup ); 191 a->addTo( popup );
191 //a->addTo( &m_toolBar ); 192 //a->addTo( &m_toolBar );
192 193
193 popup->insertSeparator(); 194 popup->insertSeparator();
194 195
195 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 196 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
196 a->setWhatsThis( tr( "Tap here to configure this application." ) ); 197 a->setWhatsThis( tr( "Tap here to configure this application." ) );
197 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); 198 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
198 a->addTo( popup ); 199 a->addTo( popup );
199 mb->insertItem( tr( "Actions" ), popup ); 200 mb->insertItem( tr( "Actions" ), popup );
200 201
201 // View menu 202 // View menu
202 popup = new QPopupMenu( this ); 203 popup = new QPopupMenu( this );
203 204
204 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 205 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
205 m_actionShowNotInstalled->setToggleAction( true ); 206 m_actionShowNotInstalled->setToggleAction( true );
206 m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); 207 m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) );
207 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); 208 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
208 m_actionShowNotInstalled->addTo( popup ); 209 m_actionShowNotInstalled->addTo( popup );
209 210
210 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 211 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
211 m_actionShowInstalled->setToggleAction( true ); 212 m_actionShowInstalled->setToggleAction( true );
212 m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); 213 m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) );
213 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); 214 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
214 m_actionShowInstalled->addTo( popup ); 215 m_actionShowInstalled->addTo( popup );
215 216
216 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 217 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
217 m_actionShowUpdated->setToggleAction( true ); 218 m_actionShowUpdated->setToggleAction( true );
218 m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); 219 m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) );
219 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); 220 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
220 m_actionShowUpdated->addTo( popup ); 221 m_actionShowUpdated->addTo( popup );
221 222
222 popup->insertSeparator(); 223 popup->insertSeparator();
223 224
224 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), 225 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ),
225 QString::null, 0, this, 0 ); 226 QString::null, 0, this, 0 );
226 m_actionFilter->setToggleAction( true ); 227 m_actionFilter->setToggleAction( true );
227 m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); 228 m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) );
228 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); 229 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
229 m_actionFilter->addTo( popup ); 230 m_actionFilter->addTo( popup );
230 231
231 a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); 232 a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 );
232 a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); 233 a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) );
233 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); 234 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
234 a->addTo( popup ); 235 a->addTo( popup );
235 236
236 popup->insertSeparator(); 237 popup->insertSeparator();
237 238
238 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 239 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
239 a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); 240 a->setWhatsThis( tr( "Tap here to search for text in package names." ) );
240 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); 241 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
241 a->addTo( popup ); 242 a->addTo( popup );
242 243
243 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 244 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
244 m_actionFindNext->setEnabled( false ); 245 m_actionFindNext->setEnabled( false );
245 m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); 246 m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) );
246 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); 247 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
247 m_actionFindNext->addTo( popup ); 248 m_actionFindNext->addTo( popup );
248 m_actionFindNext->addTo( &m_findBar ); 249 m_actionFindNext->addTo( &m_findBar );
249 250
250 mb->insertItem( tr( "View" ), popup ); 251 mb->insertItem( tr( "View" ), popup );
251 252
252 // Finish find toolbar creation 253 // Finish find toolbar creation
253 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 254 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
254 a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); 255 a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) );
255 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); 256 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
256 a->addTo( &m_findBar ); 257 a->addTo( &m_findBar );
257 m_findBar.hide(); 258 m_findBar.hide();
258} 259}
259 260
260void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) 261void MainWindow::loadPackageList( OPackageList *packages, bool clearList )
261{ 262{
262 if ( clearList ) 263 if ( clearList )
263 m_packageList.clear(); 264 m_packageList.clear();
264 265
265 if ( packages ) 266 if ( packages )
266 { 267 {
267 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) 268 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt )
268 { 269 {
269 OPackage *package = packageIt.current(); 270 OPackage *package = packageIt.current();
270 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), 271 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(),
271 QCheckListItem::CheckBox ); 272 QCheckListItem::CheckBox );
272 m_packageList.insertItem( item ); 273 m_packageList.insertItem( item );
273 274
274 // If a different version of package is available, show update available icon 275 // If a different version of package is available, show update available icon
275 // Otherwise, show installed icon 276 // Otherwise, show installed icon
276 if ( !package->versionInstalled().isNull() ) 277 if ( !package->versionInstalled().isNull() )
277 { 278 {
278 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 279 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
279 item->setPixmap( 0, m_iconUpdated ); 280 item->setPixmap( 0, m_iconUpdated );
280 else 281 else
281 item->setPixmap( 0, m_iconInstalled ); 282 item->setPixmap( 0, m_iconInstalled );
282 } 283 }
283 else 284 else
284 item->setPixmap( 0, m_iconNull ); 285 item->setPixmap( 0, m_iconNull );
285 } 286 }
286 } 287 }
287} 288}
288 289
289void MainWindow::searchForPackage( const QString &text ) 290void MainWindow::searchForPackage( const QString &text )
290{ 291{
291 if ( !text.isEmpty() ) 292 if ( !text.isEmpty() )
292 { 293 {
293 // look through package list for text startng at current position 294 // look through package list for text startng at current position
294 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); 295 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem());
295 if ( start == 0 ) 296 if ( start == 0 )
296 start = static_cast<QCheckListItem *>(m_packageList.firstChild()); 297 start = static_cast<QCheckListItem *>(m_packageList.firstChild());
297 298
298// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; 299// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ;
299 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; 300 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ;
300 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 301 item = static_cast<QCheckListItem *>(item->nextSibling()) )
301 { 302 {
302 if ( item->text().lower().find( text ) != -1 ) 303 if ( item->text().lower().find( text ) != -1 )
303 { 304 {
304 m_packageList.ensureItemVisible( item ); 305 m_packageList.ensureItemVisible( item );
305 m_packageList.setCurrentItem( item ); 306 m_packageList.setCurrentItem( item );
306 break; 307 break;
307 } 308 }
308 } 309 }
309 } 310 }
310} 311}
311 312
312void MainWindow::installLocalPackage( const QString &ipkFile ) 313void MainWindow::installLocalPackage( const QString &ipkFile )
313{ 314{
314 // Install selected file 315 // Install selected file
315 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), 316 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ),
316 OPackage::Install, ipkFile ); 317 OPackage::Install, ipkFile );
317 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 318 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
318 319
319 // Display widget 320 // Display widget
320 m_widgetStack.addWidget( dlg, 3 ); 321 m_widgetStack.addWidget( dlg, 3 );
321 m_widgetStack.raiseWidget( dlg ); 322 m_widgetStack.raiseWidget( dlg );
322} 323}
323 324
324void MainWindow::setDocument( const QString &ipkFile ) 325void MainWindow::setDocument( const QString &ipkFile )
325{ 326{
326 QString file = ipkFile; 327 QString file = ipkFile;
327 DocLnk lnk( ipkFile ); 328 DocLnk lnk( ipkFile );
328 if ( lnk.isValid() ) 329 if ( lnk.isValid() )
329 file = lnk.file(); 330 file = lnk.file();
330 331
331 installLocalPackage( file ); 332 installLocalPackage( file );
332} 333}
333 334
334void MainWindow::initPackageInfo() 335void MainWindow::initPackageInfo()
335{ 336{
336 m_widgetStack.raiseWidget( &m_statusWidget ); 337 m_widgetStack.raiseWidget( &m_statusWidget );
337 338
338 // Load package list 339 // Load package list
339 m_packman.loadAvailablePackages(); 340 m_packman.loadAvailablePackages();
340 m_packman.loadInstalledPackages(); 341 m_packman.loadInstalledPackages();
341 342
342 OPackageList *packageList = m_packman.packages(); 343 OPackageList *packageList = m_packman.packages();
343 if ( packageList ) 344 if ( packageList )
344 { 345 {
345 loadPackageList( packageList, true ); 346 loadPackageList( packageList, true );
346 delete packageList; 347 delete packageList;
347 } 348 }
348 349
349 QWidget *widget = m_widgetStack.widget( 3 ); 350 QWidget *widget = m_widgetStack.widget( 3 );
350 if ( !widget ) 351 if ( !widget )
351 widget = &m_packageList; 352 widget = &m_packageList;
352 m_widgetStack.raiseWidget( widget ); 353 m_widgetStack.raiseWidget( widget );
353} 354}
354 355
355void MainWindow::slotWidgetStackShow( QWidget *widget ) 356void MainWindow::slotWidgetStackShow( QWidget *widget )
356{ 357{
357 if ( widget == &m_packageList ) 358 if ( widget == &m_packageList )
358 { 359 {
359 setCaption( tr( "Package Manager" ) ); 360 setCaption( tr( "Package Manager" ) );
360 361
361 m_menuBar.show(); 362 m_menuBar.show();
362 m_toolBar.show(); 363 m_toolBar.show();
363 } 364 }
364 else 365 else
365 { 366 {
366 m_menuBar.hide(); 367 m_menuBar.hide();
367 m_toolBar.hide(); 368 m_toolBar.hide();
368 } 369 }
369} 370}
370 371
371void MainWindow::slotInitStatusBar( int numSteps ) 372void MainWindow::slotInitStatusBar( int numSteps )
372{ 373{
373 m_statusBar.setTotalSteps( numSteps ); 374 m_statusBar.setTotalSteps( numSteps );
374} 375}
375 376
376void MainWindow::slotStatusText( const QString &status ) 377void MainWindow::slotStatusText( const QString &status )
377{ 378{
378 m_statusText.setText( status ); 379 m_statusText.setText( status );
379} 380}
380 381
381void MainWindow::slotStatusBar( int currStep ) 382void MainWindow::slotStatusBar( int currStep )
382{ 383{
383 m_statusBar.setProgress( currStep ); 384 m_statusBar.setProgress( currStep );
384} 385}
385 386
386void MainWindow::slotUpdate() 387void MainWindow::slotUpdate()
387{ 388{
388 // Create package manager output widget 389 // Create package manager output widget
389 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), 390 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ),
390 OPackage::Update ); 391 OPackage::Update );
391 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 392 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
392 393
393 // Display widget 394 // Display widget
394 m_widgetStack.addWidget( dlg, 3 ); 395 m_widgetStack.addWidget( dlg, 3 );
395 m_widgetStack.raiseWidget( dlg ); 396 m_widgetStack.raiseWidget( dlg );
396} 397}
397 398
398void MainWindow::slotUpgrade() 399void MainWindow::slotUpgrade()
399{ 400{
400 // Create package manager output widget 401 // Create package manager output widget
401 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), 402 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ),
402 OPackage::Upgrade ); 403 OPackage::Upgrade );
403 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 404 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
404 405
405 // Display widget 406 // Display widget
406 m_widgetStack.addWidget( dlg, 3 ); 407 m_widgetStack.addWidget( dlg, 3 );
407 m_widgetStack.raiseWidget( dlg ); 408 m_widgetStack.raiseWidget( dlg );
408} 409}
409 410
410void MainWindow::slotDownload() 411void MainWindow::slotDownload()
411{ 412{
412 // Retrieve list of packages selected for download (if any) 413 // Retrieve list of packages selected for download (if any)
413 QStringList workingPackages; 414 QStringList workingPackages;
414 415
415 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 416 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
416 item != 0 ; 417 item != 0 ;
417 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 418 item = static_cast<QCheckListItem *>(item->nextSibling()) )
418 { 419 {
419 if ( item->isOn() ) 420 if ( item->isOn() )
420 workingPackages.append( item->text() ); 421 workingPackages.append( item->text() );
421 } 422 }
422 423
423 if ( workingPackages.isEmpty() ) 424 if ( workingPackages.isEmpty() )
424 { 425 {
425 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 426 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
426 return; 427 return;
427 } 428 }
428 else 429 else
429 { 430 {
430 // Download selected packages 431 // Download selected packages
431 m_config.setGroup( "settings" ); 432 m_config.setGroup( "settings" );
432 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); 433 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );
433 434
434 bool ok = false; 435 bool ok = false;
435 QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); 436 QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this );
436 if ( ok && !text.isEmpty() ) 437 if ( ok && !text.isEmpty() )
437 workingDir = text; // user entered something and pressed ok 438 workingDir = text; // user entered something and pressed ok
438 else 439 else
439 return; // user entered nothing or pressed cancel 440 return; // user entered nothing or pressed cancel
440 441
441 // Store download directory in config file 442 // Store download directory in config file
442 m_config.writeEntry( "DownloadDir", workingDir ); 443 m_config.writeEntry( "DownloadDir", workingDir );
443 444
444 // Get starting directory 445 // Get starting directory
445 QDir::setCurrent( workingDir ); 446 QDir::setCurrent( workingDir );
446 447
447 // Create package manager output widget 448 // Create package manager output widget
448 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), 449 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ),
449 OPackage::Download, workingPackages ); 450 OPackage::Download, workingPackages );
450 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 451 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
451 452
452 // Display widget 453 // Display widget
453 m_widgetStack.addWidget( dlg, 3 ); 454 m_widgetStack.addWidget( dlg, 3 );
454 m_widgetStack.raiseWidget( dlg ); 455 m_widgetStack.raiseWidget( dlg );
455 } 456 }
456} 457}
457 458
458void MainWindow::slotApply() 459void MainWindow::slotApply()
459{ 460{
460 QStringList removeList; 461 QStringList removeList;
461 QStringList installList; 462 QStringList installList;
462 QStringList upgradeList; 463 QStringList upgradeList;
463 464
464 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 465 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
465 item != 0 ; 466 item != 0 ;
466 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 467 item = static_cast<QCheckListItem *>(item->nextSibling()) )
467 { 468 {
468 if ( item->isOn() ) 469 if ( item->isOn() )
469 { 470 {
470 OPackage *package = m_packman.findPackage( item->text() ); 471 OPackage *package = m_packman.findPackage( item->text() );
471 if ( package ) 472 if ( package )
472 { 473 {
473 if ( !package->versionInstalled().isNull() ) 474 if ( !package->versionInstalled().isNull() )
474 { 475 {
475 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 476 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
476 { 477 {
477 // Remove/upgrade package 478 // Remove/upgrade package
478 int answer = PromptDlg::ask( tr( "Remove or upgrade" ), 479 int answer = PromptDlg::ask( tr( "Remove or upgrade" ),
479 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), 480 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ),
480 tr( "Remove" ), tr( "Upgrade" ), this ); 481 tr( "Remove" ), tr( "Upgrade" ), this );
481 if ( answer == 1 ) // Remove 482 if ( answer == 1 ) // Remove
482 { 483 {
483 removeList.append( item->text() ); 484 removeList.append( item->text() );
484 } 485 }
485 else if ( answer == 2 ) // Upgrade 486 else if ( answer == 2 ) // Upgrade
486 { 487 {
487 upgradeList.append( item->text() ); 488 upgradeList.append( item->text() );
488 } 489 }
489 } 490 }
490 else 491 else
491 { 492 {
492 // Remove/reinstall package 493 // Remove/reinstall package
493 int answer = PromptDlg::ask( tr( "Remove or reinstall" ), 494 int answer = PromptDlg::ask( tr( "Remove or reinstall" ),
494 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), 495 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ),
495 tr( "Remove" ), tr( "Reinstall" ), this ); 496 tr( "Remove" ), tr( "Reinstall" ), this );
496 if ( answer == 1 ) // Remove 497 if ( answer == 1 ) // Remove
497 { 498 {
498 removeList.append( item->text() ); 499 removeList.append( item->text() );
499 } 500 }
500 else if ( answer == 2 ) // Reinstall 501 else if ( answer == 2 ) // Reinstall
501 { 502 {
502 installList.append( item->text() ); 503 installList.append( item->text() );
503 } 504 }
504 } 505 }
505 } 506 }
506 else 507 else
507 { 508 {
508 // Install package 509 // Install package
509 installList.append( item->text() ); 510 installList.append( item->text() );
510 } 511 }
511 } 512 }
512 } 513 }
513 } 514 }
514 515
515 // If nothing is selected, display message and exit 516 // If nothing is selected, display message and exit
516 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) 517 if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() )
517 { 518 {
518 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 519 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
519 return; 520 return;
520 } 521 }
521 522
522 // Send command only if there are packages to process 523 // Send command only if there are packages to process
523 OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove 524 OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove
524 : OPackage::NotDefined; 525 : OPackage::NotDefined;
525 OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install 526 OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install
526 : OPackage::NotDefined; 527 : OPackage::NotDefined;
527 OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade 528 OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade
528 : OPackage::NotDefined; 529 : OPackage::NotDefined;
529 530
530 // Create package manager output widget 531 // Create package manager output widget
531 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), 532 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ),
532 removeCmd, removeList, 533 removeCmd, removeList,
533 installCmd, installList, 534 installCmd, installList,
534 upgradeCmd, upgradeList ); 535 upgradeCmd, upgradeList );
535 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); 536 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );
536 537
537 // Display widget 538 // Display widget
538 m_widgetStack.addWidget( dlg, 3 ); 539 m_widgetStack.addWidget( dlg, 3 );
539 m_widgetStack.raiseWidget( dlg ); 540 m_widgetStack.raiseWidget( dlg );
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h
index f00e344..e7003e4 100644
--- a/noncore/settings/packagemanager/mainwindow.h
+++ b/noncore/settings/packagemanager/mainwindow.h
@@ -1,143 +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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#ifndef MAINWINDOW_H 31#ifndef MAINWINDOW_H
31#define MAINWINDOW_H 32#define MAINWINDOW_H
32 33
33#include "opackagemanager.h" 34#include "opackagemanager.h"
34 35
35#include <qpe/config.h> 36#include <qpe/config.h>
36 37
37#include <qlabel.h> 38#include <qlabel.h>
38#include <qlistview.h> 39#include <qlistview.h>
39#include <qmainwindow.h> 40#include <qmainwindow.h>
40#include <qpixmap.h> 41#include <qpixmap.h>
41#include <qprogressbar.h> 42#include <qprogressbar.h>
42#include <qtoolbar.h> 43#include <qtoolbar.h>
43#include <qwidgetstack.h> 44#include <qwidgetstack.h>
44 45
45class QAction; 46class QAction;
46class QLineEdit; 47class QLineEdit;
47 48
48class MainWindow :public QMainWindow 49class MainWindow :public QMainWindow
49{ 50{
50 Q_OBJECT 51 Q_OBJECT
51 52
52public: 53public:
53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); 54 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 );
54 static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); }; 55 static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); };
55 56
56protected: 57protected:
57 void closeEvent( QCloseEvent *event ); 58 void closeEvent( QCloseEvent *event );
58 59
59private: 60private:
60 Config m_config; // Configuration file 61 Config m_config; // Configuration file
61 62
62 OPackageManager m_packman; // Package manager 63 OPackageManager m_packman; // Package manager
63 64
64 // Toolbars 65 // Toolbars
65 QToolBar m_menuBar; // Main toolbar containing menu 66 QToolBar m_menuBar; // Main toolbar containing menu
66 QToolBar m_toolBar; // Main toolbar 67 QToolBar m_toolBar; // Main toolbar
67 QToolBar m_findBar; // Find toolbar 68 QToolBar m_findBar; // Find toolbar
68 69
69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget 70 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget
70 QListView m_packageList; // Main list view of all packages 71 QListView m_packageList; // Main list view of all packages
71 72
72 QLineEdit *m_findEdit; // Line edit box used for find toolbar 73 QLineEdit *m_findEdit; // Line edit box used for find toolbar
73 74
74 // Status widget controls 75 // Status widget controls
75 QWidget m_statusWidget; // Widget to display status during long operations 76 QWidget m_statusWidget; // Widget to display status during long operations
76 QLabel m_statusText; // Text status message 77 QLabel m_statusText; // Text status message
77 QProgressBar m_statusBar; // Progress bar showing % completed 78 QProgressBar m_statusBar; // Progress bar showing % completed
78 79
79 // Icon pixmaps 80 // Icon pixmaps
80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated 81 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated
81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed 82 QPixmap m_iconInstalled; // Cached icon which shows when package is installed
82 QPixmap m_iconNull; // Cached icon which shows when package is not installed 83 QPixmap m_iconNull; // Cached icon which shows when package is not installed
83 84
84 // Menu/tool bar actions 85 // Menu/tool bar actions
85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed 86 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed
86 QAction *m_actionShowInstalled; // Action to show pakages currently installed 87 QAction *m_actionShowInstalled; // Action to show pakages currently installed
87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available 88 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available
88 QAction *m_actionFilter; // Action to filter packages 89 QAction *m_actionFilter; // Action to filter packages
89 QAction *m_actionFindNext; // Action to find next match 90 QAction *m_actionFindNext; // Action to find next match
90 91
91 // Cached filter settings 92 // Cached filter settings
92 QString m_filterName; // Cached name filter value 93 QString m_filterName; // Cached name filter value
93 QString m_filterServer; // Cached server name filter value 94 QString m_filterServer; // Cached server name filter value
94 QString m_filterDest; // Cached destination name filter value 95 QString m_filterDest; // Cached destination name filter value
95 OPackageManager::Status m_filterStatus; // Cached status filter value 96 OPackageManager::Status m_filterStatus; // Cached status filter value
96 QString m_filterCategory; // Cached category filter value 97 QString m_filterCategory; // Cached category filter value
97 98
98 void initPackageList(); 99 void initPackageList();
99 void initStatusWidget(); 100 void initStatusWidget();
100 void initUI(); 101 void initUI();
101 102
102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); 103 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true );
103 void searchForPackage( const QString &text ); 104 void searchForPackage( const QString &text );
104 void installLocalPackage( const QString &ipkFile ); 105 void installLocalPackage( const QString &ipkFile );
105 106
106private slots: 107private slots:
107 void setDocument( const QString &ipkFile ); 108 void setDocument( const QString &ipkFile );
108 109
109 void initPackageInfo(); 110 void initPackageInfo();
110 void slotWidgetStackShow( QWidget *widget ); 111 void slotWidgetStackShow( QWidget *widget );
111 112
112 // Status widget slots 113 // Status widget slots
113 void slotInitStatusBar( int numSteps ); 114 void slotInitStatusBar( int numSteps );
114 void slotStatusText( const QString &status ); 115 void slotStatusText( const QString &status );
115 void slotStatusBar( int currStep ); 116 void slotStatusBar( int currStep );
116 117
117 // Actions menu action slots 118 // Actions menu action slots
118 void slotUpdate(); 119 void slotUpdate();
119 void slotUpgrade(); 120 void slotUpgrade();
120 void slotDownload(); 121 void slotDownload();
121 void slotApply(); 122 void slotApply();
122 void slotInstallLocal(); 123 void slotInstallLocal();
123 void slotCloseDlg(); 124 void slotCloseDlg();
124 void slotConfigure(); 125 void slotConfigure();
125 126
126 // View menu action slots 127 // View menu action slots
127 void slotShowNotInstalled(); 128 void slotShowNotInstalled();
128 void slotShowInstalled(); 129 void slotShowInstalled();
129 void slotShowUpdated(); 130 void slotShowUpdated();
130 void slotFilterChange(); 131 void slotFilterChange();
131 void slotFilter( bool isOn ); 132 void slotFilter( bool isOn );
132 133
133 // Find action slots 134 // Find action slots
134 void slotFindShowToolbar(); 135 void slotFindShowToolbar();
135 void slotFindHideToolbar(); 136 void slotFindHideToolbar();
136 void slotFindChanged( const QString &findText ); 137 void slotFindChanged( const QString &findText );
137 void slotFindNext(); 138 void slotFindNext();
138 139
139 // Other slots 140 // Other slots
140 void slotDisplayPackageInfo( QListViewItem * ); 141 void slotDisplayPackageInfo( QListViewItem * );
141}; 142};
142 143
143#endif 144#endif
diff --git a/noncore/settings/packagemanager/oconfitem.cpp b/noncore/settings/packagemanager/oconfitem.cpp
index ffa936e..76c8c65 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)2004, 2005 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
30*/ 29*/
31 30
32#include "oconfitem.h" 31#include "oconfitem.h"
33 32
34OConfItem::OConfItem( Type type, const QString &name, const QString &value, 33OConfItem::OConfItem( Type type, const QString &name, const QString &value,
35 const QString &features, bool active ) 34 const QString &features, bool active )
36 : m_type( type ) 35 : m_type( type )
37 , m_name( name ) 36 , m_name( name )
38 , m_value( value ) 37 , m_value( value )
39 , m_features( features ) 38 , m_features( features )
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 b306e93..c95039e 100644
--- a/noncore/settings/packagemanager/oconfitem.h
+++ b/noncore/settings/packagemanager/oconfitem.h
@@ -1,96 +1,95 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#ifndef OCONFITEM_H 31#ifndef OCONFITEM_H
33#define OCONFITEM_H 32#define OCONFITEM_H
34 33
35#include <qlist.h> 34#include <qlist.h>
36#include <qstring.h> 35#include <qstring.h>
37 36
38class OConfItem 37class OConfItem
39{ 38{
40public: 39public:
41 enum Type { Source, Destination, Option, Arch, Other, NotDefined }; 40 enum Type { Source, Destination, Option, Arch, Other, NotDefined };
42 41
43 OConfItem( Type type = NotDefined, const QString &name = QString::null, 42 OConfItem( Type type = NotDefined, const QString &name = QString::null,
44 const QString &value = QString::null, const QString &features = QString::null, 43 const QString &value = QString::null, const QString &features = QString::null,
45 bool active = true ); 44 bool active = true );
46 45
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 const QString &features() { return m_features; } 49 const QString &features() { return m_features; }
51 bool active() { return m_active; } 50 bool active() { return m_active; }
52 51
53 void setType( Type type ) { m_type = type; } 52 void setType( Type type ) { m_type = type; }
54 void setName( const QString &name ) { m_name = name; } 53 void setName( const QString &name ) { m_name = name; }
55 void setValue( const QString &value ) { m_value = value; } 54 void setValue( const QString &value ) { m_value = value; }
56 void setFeatures( const QString &features ) { m_features = features; } 55 void setFeatures( const QString &features ) { m_features = features; }
57 void setActive( bool active ) { m_active = active; } 56 void setActive( bool active ) { m_active = active; }
58 57
59private: 58private:
60 Type m_type; // Type of configuration item 59 Type m_type; // Type of configuration item
61 QString m_name; // Name of item 60 QString m_name; // Name of item
62 QString m_value; // Value of item 61 QString m_value; // Value of item
63 QString m_features; // Comma-deliminated list of features this item supports 62 QString m_features; // Comma-deliminated list of features this item supports
64 bool m_active; // Indicates whether item is currently active 63 bool m_active; // Indicates whether item is currently active
65}; 64};
66 65
67class OConfItemList : public QList<OConfItem> 66class OConfItemList : public QList<OConfItem>
68{ 67{
69private: 68private:
70 69
71 int compareItems( QCollection::Item item1, QCollection::Item item2 ) 70 int compareItems( QCollection::Item item1, QCollection::Item item2 )
72 { 71 {
73 // Sort by OConfItem location then by type 72 // Sort by OConfItem location then by type
74 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type(); 73 OConfItem::Type type1 = reinterpret_cast<OConfItem*>(item1)->type();
75 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type(); 74 OConfItem::Type type2 = reinterpret_cast<OConfItem*>(item2)->type();
76 if ( type1 < type2 ) 75 if ( type1 < type2 )
77 return -1; 76 return -1;
78 else if ( type1 == type2 ) 77 else if ( type1 == type2 )
79 { 78 {
80 QString name1 = reinterpret_cast<OConfItem*>(item1)->name(); 79 QString name1 = reinterpret_cast<OConfItem*>(item1)->name();
81 QString name2 = reinterpret_cast<OConfItem*>(item2)->name(); 80 QString name2 = reinterpret_cast<OConfItem*>(item2)->name();
82 if ( name1 < name2 ) 81 if ( name1 < name2 )
83 return -1; 82 return -1;
84 else if ( name1 == name2 ) 83 else if ( name1 == name2 )
85 return 0; 84 return 0;
86 else /*if ( name1 > name2 )*/ 85 else /*if ( name1 > name2 )*/
87 return 1; 86 return 1;
88 } 87 }
89 else /*if ( type1 > type2 )*/ 88 else /*if ( type1 > type2 )*/
90 return 1; 89 return 1;
91 } 90 }
92}; 91};
93 92
94typedef QListIterator<OConfItem> OConfItemListIterator; 93typedef QListIterator<OConfItem> OConfItemListIterator;
95 94
96#endif 95#endif
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 7bc2040..ffb3687 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -1,541 +1,540 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#include "oipkg.h" 31#include "oipkg.h"
33 32
34#include <qdir.h> 33#include <qdir.h>
35#include <qfile.h> 34#include <qfile.h>
36#include <qtextstream.h> 35#include <qtextstream.h>
37 36
38#include <stdlib.h> 37#include <stdlib.h>
39#include <unistd.h> 38#include <unistd.h>
40 39
41extern "C" { 40extern "C" {
42#include <libipkg.h> 41#include <libipkg.h>
43}; 42};
44args_t m_ipkgArgs; // libipkg configuration arguments 43args_t m_ipkgArgs; // libipkg configuration arguments
45 44
46const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file 45const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file
47const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files 46const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files
48const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists 47const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists
49const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location 48const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location
50const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location 49const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location
51 50
52OIpkg *oipkg; 51OIpkg *oipkg;
53 52
54// Ipkg callback functions 53// Ipkg callback functions
55 54
56int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) 55int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg )
57{ 56{
58 // Display message only if it is below the message level threshold 57 // Display message only if it is below the message level threshold
59 if ( conf && ( conf->verbosity < level ) ) 58 if ( conf && ( conf->verbosity < level ) )
60 return 0; 59 return 0;
61 else 60 else
62 oipkg->ipkgMessage( msg ); 61 oipkg->ipkgMessage( msg );
63 62
64 return 0; 63 return 0;
65} 64}
66 65
67char *fIpkgResponse( char */*question*/ ) 66char *fIpkgResponse( char */*question*/ )
68{ 67{
69 return 0l; 68 return 0l;
70} 69}
71 70
72int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) 71int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ )
73{ 72{
74 oipkg->ipkgStatus( desc ); 73 oipkg->ipkgStatus( desc );
75 return 0; 74 return 0;
76} 75}
77 76
78int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, 77int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/,
79 void */*userdata*/ ) 78 void */*userdata*/ )
80{ 79{
81 oipkg->ipkgList( desc ); 80 oipkg->ipkgList( desc );
82 return 0; 81 return 0;
83} 82}
84 83
85OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) 84OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
86 : QObject( parent, name ) 85 : QObject( parent, name )
87 , m_config( config ) 86 , m_config( config )
88 , m_confInfo( NULL ) 87 , m_confInfo( NULL )
89 , m_ipkgExecOptions( 0 ) 88 , m_ipkgExecOptions( 0 )
90 , m_ipkgExecVerbosity( 1 ) 89 , m_ipkgExecVerbosity( 1 )
91{ 90{
92 // Keep pointer to self for the Ipkg callback functions 91 // Keep pointer to self for the Ipkg callback functions
93 oipkg = this; 92 oipkg = this;
94 93
95 // Initialize libipkg 94 // Initialize libipkg
96 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); 95 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs );
97 96
98 // Default ipkg run-time arguments 97 // Default ipkg run-time arguments
99 m_ipkgArgs.noaction = false; 98 m_ipkgArgs.noaction = false;
100 m_ipkgArgs.force_defaults = true; 99 m_ipkgArgs.force_defaults = true;
101} 100}
102 101
103OIpkg::~OIpkg() 102OIpkg::~OIpkg()
104{ 103{
105 // Upon destruction, ensure that items in config list are deleted with list 104 // Upon destruction, ensure that items in config list are deleted with list
106 if ( m_confInfo ) 105 if ( m_confInfo )
107 m_confInfo->setAutoDelete( true ); 106 m_confInfo->setAutoDelete( true );
108 107
109 // Free up libipkg resources 108 // Free up libipkg resources
110 ipkg_deinit( &m_ipkgArgs ); 109 ipkg_deinit( &m_ipkgArgs );
111} 110}
112 111
113OConfItemList *OIpkg::configItems() 112OConfItemList *OIpkg::configItems()
114{ 113{
115 // Retrieve all configuration items 114 // Retrieve all configuration items
116 return filterConfItems(); 115 return filterConfItems();
117} 116}
118 117
119OConfItemList *OIpkg::servers() 118OConfItemList *OIpkg::servers()
120{ 119{
121 // Retrieve only servers 120 // Retrieve only servers
122 return filterConfItems( OConfItem::Source ); 121 return filterConfItems( OConfItem::Source );
123} 122}
124 123
125OConfItemList *OIpkg::destinations() 124OConfItemList *OIpkg::destinations()
126{ 125{
127 // Retrieve only destinations 126 // Retrieve only destinations
128 return filterConfItems( OConfItem::Destination ); 127 return filterConfItems( OConfItem::Destination );
129} 128}
130 129
131OConfItemList *OIpkg::options() 130OConfItemList *OIpkg::options()
132{ 131{
133 // Retrieve only destinations 132 // Retrieve only destinations
134 return filterConfItems( OConfItem::Option ); 133 return filterConfItems( OConfItem::Option );
135} 134}
136 135
137void OIpkg::setConfigItems( OConfItemList *configList ) 136void OIpkg::setConfigItems( OConfItemList *configList )
138{ 137{
139 if ( m_confInfo ) 138 if ( m_confInfo )
140 delete m_confInfo; 139 delete m_confInfo;
141 140
142 m_confInfo = configList; 141 m_confInfo = configList;
143 142
144 // Write out new /etc/ipkg.conf 143 // Write out new /etc/ipkg.conf
145 QFile confFile( IPKG_CONF ); 144 QFile confFile( IPKG_CONF );
146 if ( confFile.open( IO_WriteOnly ) ) 145 if ( confFile.open( IO_WriteOnly ) )
147 { 146 {
148 QTextStream confStream( &confFile ); 147 QTextStream confStream( &confFile );
149 confStream << "# Generated by Opie Package Manager\n\n"; 148 confStream << "# Generated by Opie Package Manager\n\n";
150 149
151 OConfItemListIterator it( *m_confInfo ); 150 OConfItemListIterator it( *m_confInfo );
152 for ( ; it.current(); ++it ) 151 for ( ; it.current(); ++it )
153 { 152 {
154 OConfItem *item = it.current(); 153 OConfItem *item = it.current();
155 154
156 // Only write out valid conf items 155 // Only write out valid conf items
157 if ( item->type() != OConfItem::NotDefined ) 156 if ( item->type() != OConfItem::NotDefined )
158 { 157 {
159 QString confLine; 158 QString confLine;
160 QString name = item->name(); 159 QString name = item->name();
161 if ( !item->active() ) 160 if ( !item->active() )
162 confLine = "#"; 161 confLine = "#";
163 162
164 switch ( item->type() ) 163 switch ( item->type() )
165 { 164 {
166 case OConfItem::Source : 165 case OConfItem::Source :
167 { 166 {
168 if ( item->features().contains( "Compressed" ) ) 167 if ( item->features().contains( "Compressed" ) )
169 confLine.append( "src/gz" ); 168 confLine.append( "src/gz" );
170 else 169 else
171 confLine.append( "src" ); 170 confLine.append( "src" );
172 } 171 }
173 break; 172 break;
174 case OConfItem::Destination : confLine.append( "dest" ); break; 173 case OConfItem::Destination : confLine.append( "dest" ); break;
175 case OConfItem::Option : confLine.append( "option" ); break; 174 case OConfItem::Option : confLine.append( "option" ); break;
176 case OConfItem::Arch : confLine.append( "arch" ); break; 175 case OConfItem::Arch : confLine.append( "arch" ); break;
177 case OConfItem::Other : 176 case OConfItem::Other :
178 { 177 {
179 // For options w/type = Other, the mapping is as follows: 178 // For options w/type = Other, the mapping is as follows:
180 // name = typeStr (e.g. "lists_dir") 179 // name = typeStr (e.g. "lists_dir")
181 // value = value 180 // value = value
182 // features = name (from configuration file) 181 // features = name (from configuration file)
183 confLine.append( item->name() ); 182 confLine.append( item->name() );
184 name = item->features(); 183 name = item->features();
185 } 184 }
186 break; 185 break;
187 default : break; 186 default : break;
188 }; 187 };
189 188
190 confStream << confLine << " " << name << " " << item->value() << "\n"; 189 confStream << confLine << " " << name << " " << item->value() << "\n";
191 } 190 }
192 } 191 }
193 192
194 confFile.close(); 193 confFile.close();
195 } 194 }
196 else 195 else
197 { 196 {
198 // Problem writing to /etc/ipkg.conf, exit before removing other conf files 197 // Problem writing to /etc/ipkg.conf, exit before removing other conf files
199 return; 198 return;
200 } 199 }
201 200
202 // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings 201 // Delete /etc/ipkg/*.conf files (/etc/ipkg.conf should now have all settings
203 QStringList confFiles; 202 QStringList confFiles;
204 QDir confDir( IPKG_CONF_DIR ); 203 QDir confDir( IPKG_CONF_DIR );
205 if ( confDir.exists() ) 204 if ( confDir.exists() )
206 { 205 {
207 confDir.setNameFilter( "*.conf" ); 206 confDir.setNameFilter( "*.conf" );
208 confDir.setFilter( QDir::Files ); 207 confDir.setFilter( QDir::Files );
209 confFiles = confDir.entryList( "*.conf", QDir::Files ); 208 confFiles = confDir.entryList( "*.conf", QDir::Files );
210 209
211 QStringList::Iterator lastFile = confFiles.end(); 210 QStringList::Iterator lastFile = confFiles.end();
212 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it ) 211 for ( QStringList::Iterator it = confFiles.begin(); it != lastFile; ++it )
213 { 212 {
214 // Create absolute file path if necessary 213 // Create absolute file path if necessary
215 QString absFile = (*it); 214 QString absFile = (*it);
216 if ( !absFile.startsWith( "/" ) ) 215 if ( !absFile.startsWith( "/" ) )
217 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 216 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
218 217
219 // Delete file 218 // Delete file
220 QFile::remove( absFile ); 219 QFile::remove( absFile );
221 } 220 }
222 } 221 }
223 222
224 // Reinitialize libipkg to pick up new configuration 223 // Reinitialize libipkg to pick up new configuration
225 ipkg_deinit( &m_ipkgArgs ); 224 ipkg_deinit( &m_ipkgArgs );
226 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); 225 ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs );
227 m_ipkgArgs.noaction = false; 226 m_ipkgArgs.noaction = false;
228 m_ipkgArgs.force_defaults = true; 227 m_ipkgArgs.force_defaults = true;
229} 228}
230 229
231void OIpkg::saveSettings() 230void OIpkg::saveSettings()
232{ 231{
233 // Save Ipkg execution options to application configuration file 232 // Save Ipkg execution options to application configuration file
234 if ( m_config ) 233 if ( m_config )
235 { 234 {
236 m_config->setGroup( "Ipkg" ); 235 m_config->setGroup( "Ipkg" );
237 m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); 236 m_config->writeEntry( "ExecOptions", m_ipkgExecOptions );
238 m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); 237 m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity );
239 } 238 }
240} 239}
241 240
242OPackageList *OIpkg::availablePackages( const QString &server ) 241OPackageList *OIpkg::availablePackages( const QString &server )
243{ 242{
244 // Load Ipkg configuration info if not already cached 243 // Load Ipkg configuration info if not already cached
245 if ( !m_confInfo ) 244 if ( !m_confInfo )
246 loadConfiguration(); 245 loadConfiguration();
247 246
248 // Build new server list (caller is responsible for deleting) 247 // Build new server list (caller is responsible for deleting)
249 OPackageList *pl = new OPackageList; 248 OPackageList *pl = new OPackageList;
250 249
251 // Get directory where server lists are located 250 // Get directory where server lists are located
252 QString listsDir; 251 QString listsDir;
253 OConfItem *confItem = findConfItem( OConfItem::Other, "lists_dir" ); 252 OConfItem *confItem = findConfItem( OConfItem::Other, "lists_dir" );
254 if ( confItem ) 253 if ( confItem )
255 listsDir = confItem->value(); 254 listsDir = confItem->value();
256 else 255 else
257 listsDir = IPKG_PKG_PATH; 256 listsDir = IPKG_PKG_PATH;
258 257
259 // Open package list file 258 // Open package list file
260 QFile f( listsDir + "/" + server ); 259 QFile f( listsDir + "/" + server );
261 if ( !f.open( IO_ReadOnly ) ) 260 if ( !f.open( IO_ReadOnly ) )
262 return NULL; 261 return NULL;
263 QTextStream t( &f ); 262 QTextStream t( &f );
264 263
265 // Process all information in package list file 264 // Process all information in package list file
266 OPackage *package = NULL; 265 OPackage *package = NULL;
267 QString line = t.readLine(); 266 QString line = t.readLine();
268 while ( !t.eof() ) 267 while ( !t.eof() )
269 { 268 {
270 // Determine key/value pair 269 // Determine key/value pair
271 int pos = line.find( ':', 0 ); 270 int pos = line.find( ':', 0 );
272 QString key; 271 QString key;
273 if ( pos > -1 ) 272 if ( pos > -1 )
274 key = line.mid( 0, pos ); 273 key = line.mid( 0, pos );
275 else 274 else
276 key = QString::null; 275 key = QString::null;
277 QString value = line.mid( pos+2, line.length()-pos ); 276 QString value = line.mid( pos+2, line.length()-pos );
278 277
279 // Allocate new package and insert into list 278 // Allocate new package and insert into list
280 if ( package == NULL && !key.isEmpty() ) 279 if ( package == NULL && !key.isEmpty() )
281 { 280 {
282 package = new OPackage( value ); 281 package = new OPackage( value );
283 package->setSource( server ); 282 package->setSource( server );
284 pl->append( package ); 283 pl->append( package );
285 } 284 }
286 285
287 // Update package data 286 // Update package data
288 if ( key == "Package" ) 287 if ( key == "Package" )
289 package->setName( value ); 288 package->setName( value );
290 else if ( key == "Version" ) 289 else if ( key == "Version" )
291 package->setVersion( value ); 290 package->setVersion( value );
292 else if ( key == "Section" ) 291 else if ( key == "Section" )
293 package->setCategory( value ); 292 package->setCategory( value );
294 //DataManager::setAvailableCategories( value ); 293 //DataManager::setAvailableCategories( value );
295 else if ( key.isEmpty() && value.isEmpty() ) 294 else if ( key.isEmpty() && value.isEmpty() )
296 package = NULL; 295 package = NULL;
297 296
298 // Skip past all description lines 297 // Skip past all description lines
299 if ( key == "Description" ) 298 if ( key == "Description" )
300 { 299 {
301 line = t.readLine(); 300 line = t.readLine();
302 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 301 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
303 line = t.readLine(); 302 line = t.readLine();
304 } 303 }
305 else 304 else
306 line = t.readLine(); 305 line = t.readLine();
307 } 306 }
308 307
309 f.close(); 308 f.close();
310 309
311 return pl; 310 return pl;
312} 311}
313 312
314OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) 313OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath )
315{ 314{
316 // Load Ipkg configuration info if not already cached 315 // Load Ipkg configuration info if not already cached
317 if ( !m_confInfo ) 316 if ( !m_confInfo )
318 loadConfiguration(); 317 loadConfiguration();
319 318
320 // Build new server list (caller is responsible for deleting) 319 // Build new server list (caller is responsible for deleting)
321 OPackageList *pl = new OPackageList; 320 OPackageList *pl = new OPackageList;
322 321
323 // Open status file 322 // Open status file
324 QString path = destPath; 323 QString path = destPath;
325 if ( path.right( 1 ) != "/" ) 324 if ( path.right( 1 ) != "/" )
326 path.append( "/" ); 325 path.append( "/" );
327 path.append( IPKG_STATUS_PATH ); 326 path.append( IPKG_STATUS_PATH );
328 327
329 QFile f( path ); 328 QFile f( path );
330 if ( !f.open( IO_ReadOnly ) ) 329 if ( !f.open( IO_ReadOnly ) )
331 return NULL; 330 return NULL;
332 QTextStream t( &f ); 331 QTextStream t( &f );
333 332
334 // Process all information in status file 333 // Process all information in status file
335 bool newPackage = false; 334 bool newPackage = false;
336 QString line = t.readLine(); 335 QString line = t.readLine();
337 QString name; 336 QString name;
338 QString version; 337 QString version;
339 QString status; 338 QString status;
340 339
341 while ( !t.eof() ) 340 while ( !t.eof() )
342 { 341 {
343 // Determine key/value pair 342 // Determine key/value pair
344 int pos = line.find( ':', 0 ); 343 int pos = line.find( ':', 0 );
345 QString key; 344 QString key;
346 if ( pos > -1 ) 345 if ( pos > -1 )
347 key = line.mid( 0, pos ); 346 key = line.mid( 0, pos );
348 else 347 else
349 key = QString::null; 348 key = QString::null;
350 QString value = line.mid( pos+2, line.length()-pos ); 349 QString value = line.mid( pos+2, line.length()-pos );
351 350
352 // Allocate new package and insert into list 351 // Allocate new package and insert into list
353 if ( newPackage && !key.isEmpty() ) 352 if ( newPackage && !key.isEmpty() )
354 { 353 {
355 // Add to list only if it has a valid name and is installed 354 // Add to list only if it has a valid name and is installed
356 if ( !name.isNull() && status.contains( " installed" ) ) 355 if ( !name.isNull() && status.contains( " installed" ) )
357 { 356 {
358 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 357 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
359 name = QString::null; 358 name = QString::null;
360 version = QString::null; 359 version = QString::null;
361 status = QString::null; 360 status = QString::null;
362 361
363 newPackage = false; 362 newPackage = false;
364 } 363 }
365 } 364 }
366 365
367 // Update package data 366 // Update package data
368 if ( key == "Package" ) 367 if ( key == "Package" )
369 name = value; 368 name = value;
370 else if ( key == "Version" ) 369 else if ( key == "Version" )
371 version = value; 370 version = value;
372 else if ( key == "Status" ) 371 else if ( key == "Status" )
373 status = value; 372 status = value;
374 else if ( key.isEmpty() && value.isEmpty() ) 373 else if ( key.isEmpty() && value.isEmpty() )
375 newPackage = true; 374 newPackage = true;
376 375
377 // Skip past all description lines 376 // Skip past all description lines
378 if ( key == "Description" ) 377 if ( key == "Description" )
379 { 378 {
380 line = t.readLine(); 379 line = t.readLine();
381 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 380 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
382 line = t.readLine(); 381 line = t.readLine();
383 } 382 }
384 else 383 else
385 line = t.readLine(); 384 line = t.readLine();
386 } 385 }
387 386
388 f.close(); 387 f.close();
389 388
390 // Make sure to add to list last entry 389 // Make sure to add to list last entry
391 if ( !name.isNull() && status.contains( " installed" ) ) 390 if ( !name.isNull() && status.contains( " installed" ) )
392 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 391 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
393 392
394 return pl; 393 return pl;
395} 394}
396 395
397OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name ) 396OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name )
398{ 397{
399 // Find configuration item in list 398 // Find configuration item in list
400 OConfItemListIterator configIt( *m_confInfo ); 399 OConfItemListIterator configIt( *m_confInfo );
401 OConfItem *config = 0l; 400 OConfItem *config = 0l;
402 for ( ; configIt.current(); ++configIt ) 401 for ( ; configIt.current(); ++configIt )
403 { 402 {
404 config = configIt.current(); 403 config = configIt.current();
405 if ( config->type() == type && config->name() == name ) 404 if ( config->type() == type && config->name() == name )
406 break; 405 break;
407 } 406 }
408 407
409 if ( config && config->type() == type && config->name() == name ) 408 if ( config && config->type() == type && config->name() == name )
410 return config; 409 return config;
411 410
412 return 0l; 411 return 0l;
413} 412}
414 413
415bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parameters, const QString &destination, 414bool OIpkg::executeCommand( OPackage::Command command, const QStringList &parameters, const QString &destination,
416 const QObject *receiver, const char *slotOutput, bool rawOutput ) 415 const QObject *receiver, const char *slotOutput, bool rawOutput )
417{ 416{
418 if ( command == OPackage::NotDefined ) 417 if ( command == OPackage::NotDefined )
419 return false; 418 return false;
420 419
421 // Set ipkg run-time options/arguments 420 // Set ipkg run-time options/arguments
422 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); 421 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
423 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); 422 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
424 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); 423 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
425 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); 424 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
426 m_ipkgArgs.verbosity = m_ipkgExecVerbosity; 425 m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
427 if ( m_ipkgArgs.dest ) 426 if ( m_ipkgArgs.dest )
428 free( m_ipkgArgs.dest ); 427 free( m_ipkgArgs.dest );
429 if ( !destination.isNull() ) 428 if ( !destination.isNull() )
430 { 429 {
431 int len = destination.length() + 1; 430 int len = destination.length() + 1;
432 m_ipkgArgs.dest = (char *)malloc( len ); 431 m_ipkgArgs.dest = (char *)malloc( len );
433 strncpy( m_ipkgArgs.dest, destination, destination.length() ); 432 strncpy( m_ipkgArgs.dest, destination, destination.length() );
434 m_ipkgArgs.dest[ len - 1 ] = '\0'; 433 m_ipkgArgs.dest[ len - 1 ] = '\0';
435 } 434 }
436 else 435 else
437 m_ipkgArgs.dest = 0l; 436 m_ipkgArgs.dest = 0l;
438 437
439 // Connect output signal to widget 438 // Connect output signal to widget
440 439
441 if ( !rawOutput ) 440 if ( !rawOutput )
442 { 441 {
443 // TODO - connect to local slot and parse output before emitting signalIpkgMessage 442 // TODO - connect to local slot and parse output before emitting signalIpkgMessage
444 } 443 }
445 444
446 switch( command ) 445 switch( command )
447 { 446 {
448 case OPackage::Update : { 447 case OPackage::Update : {
449 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 448 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
450 ipkg_lists_update( &m_ipkgArgs ); 449 ipkg_lists_update( &m_ipkgArgs );
451 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); 450 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 );
452 }; 451 };
453 break; 452 break;
454 case OPackage::Upgrade : { 453 case OPackage::Upgrade : {
455 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 454 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
456 ipkg_packages_upgrade( &m_ipkgArgs ); 455 ipkg_packages_upgrade( &m_ipkgArgs );
457 456
458 // Re-link non-root destinations to make sure everything is in sync 457 // Re-link non-root destinations to make sure everything is in sync
459 OConfItemList *destList = destinations(); 458 OConfItemList *destList = destinations();
460 OConfItemListIterator it( *destList ); 459 OConfItemListIterator it( *destList );
461 for ( ; it.current(); ++it ) 460 for ( ; it.current(); ++it )
462 { 461 {
463 OConfItem *dest = it.current(); 462 OConfItem *dest = it.current();
464 if ( dest->name() != "root" ) 463 if ( dest->name() != "root" )
465 linkPackageDir( dest->name() ); 464 linkPackageDir( dest->name() );
466 } 465 }
467 delete destList; 466 delete destList;
468 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); 467 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 );
469 }; 468 };
470 break; 469 break;
471 case OPackage::Install : { 470 case OPackage::Install : {
472 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 471 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
473 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 472 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
474 { 473 {
475 ipkg_packages_install( &m_ipkgArgs, (*it) ); 474 ipkg_packages_install( &m_ipkgArgs, (*it) );
476 } 475 }
477 if ( destination != "root" ) 476 if ( destination != "root" )
478 linkPackageDir( destination ); 477 linkPackageDir( destination );
479 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); 478 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 );
480 }; 479 };
481 break; 480 break;
482 case OPackage::Remove : { 481 case OPackage::Remove : {
483 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 482 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
484 483
485 // Get list of destinations for unlinking of packages not installed to root 484 // Get list of destinations for unlinking of packages not installed to root
486 OConfItemList *destList = destinations(); 485 OConfItemList *destList = destinations();
487 486
488 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 487 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
489 { 488 {
490 unlinkPackage( (*it), destList ); 489 unlinkPackage( (*it), destList );
491 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 490 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
492 } 491 }
493 492
494 delete destList; 493 delete destList;
495 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); 494 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 );
496 }; 495 };
497 break; 496 break;
498 case OPackage::Download : { 497 case OPackage::Download : {
499 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); 498 connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput );
500 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) 499 for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it )
501 { 500 {
502 ipkg_packages_download( &m_ipkgArgs, (*it) ); 501 ipkg_packages_download( &m_ipkgArgs, (*it) );
503 } 502 }
504 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 ); 503 disconnect( this, SIGNAL(signalIpkgMessage(const QString &)), 0, 0 );
505 }; 504 };
506 break; 505 break;
507 case OPackage::Info : { 506 case OPackage::Info : {
508 connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput ); 507 connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput );
509 ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); 508 ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l );
510 disconnect( this, SIGNAL(signalIpkgStatus(const QString &)), 0, 0 ); 509 disconnect( this, SIGNAL(signalIpkgStatus(const QString &)), 0, 0 );
511 }; 510 };
512 break; 511 break;
513 case OPackage::Files : { 512 case OPackage::Files : {
514 connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput ); 513 connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput );
515 ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); 514 ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l );
516 disconnect( this, SIGNAL(signalIpkgList(const QString &)), 0, 0 ); 515 disconnect( this, SIGNAL(signalIpkgList(const QString &)), 0, 0 );
517 }; 516 };
518 break; 517 break;
519 default : break; 518 default : break;
520 }; 519 };
521 520
522 return true; 521 return true;
523} 522}
524 523
525void OIpkg::ipkgMessage( char *msg ) 524void OIpkg::ipkgMessage( char *msg )
526{ 525{
527 emit signalIpkgMessage( msg ); 526 emit signalIpkgMessage( msg );
528} 527}
529 528
530void OIpkg::ipkgStatus( char *status ) 529void OIpkg::ipkgStatus( char *status )
531{ 530{
532 emit signalIpkgStatus( status ); 531 emit signalIpkgStatus( status );
533} 532}
534 533
535void OIpkg::ipkgList( char *filelist ) 534void OIpkg::ipkgList( char *filelist )
536{ 535{
537 emit signalIpkgList( filelist ); 536 emit signalIpkgList( filelist );
538} 537}
539 538
540void OIpkg::loadConfiguration() 539void OIpkg::loadConfiguration()
541{ 540{
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h
index 4e390fa..9a7802c 100644
--- a/noncore/settings/packagemanager/oipkg.h
+++ b/noncore/settings/packagemanager/oipkg.h
@@ -1,111 +1,110 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#ifndef OIPKG_H 31#ifndef OIPKG_H
33#define OIPKG_H 32#define OIPKG_H
34 33
35#include "oconfitem.h" 34#include "oconfitem.h"
36#include "opackage.h" 35#include "opackage.h"
37 36
38#include <qpe/config.h> 37#include <qpe/config.h>
39 38
40#include <qobject.h> 39#include <qobject.h>
41 40
42// Ipkg execution options (m_ipkgExecOptions) 41// Ipkg execution options (m_ipkgExecOptions)
43#define FORCE_DEPENDS 0x0001 42#define FORCE_DEPENDS 0x0001
44#define FORCE_REMOVE 0x0002 43#define FORCE_REMOVE 0x0002
45#define FORCE_REINSTALL 0x0004 44#define FORCE_REINSTALL 0x0004
46#define FORCE_OVERWRITE 0x0008 45#define FORCE_OVERWRITE 0x0008
47 46
48class OConfItemList; 47class OConfItemList;
49 48
50class OIpkg : public QObject 49class OIpkg : public QObject
51{ 50{
52 Q_OBJECT 51 Q_OBJECT
53 52
54public: 53public:
55 OIpkg( Config *config = 0l, QObject *parent = 0l, const char *name = 0l ); 54 OIpkg( Config *config = 0l, QObject *parent = 0l, const char *name = 0l );
56 ~OIpkg(); 55 ~OIpkg();
57 56
58 OConfItemList *configItems(); 57 OConfItemList *configItems();
59 OConfItemList *servers(); 58 OConfItemList *servers();
60 OConfItemList *destinations(); 59 OConfItemList *destinations();
61 OConfItemList *options(); 60 OConfItemList *options();
62 61
63 int ipkgExecOptions() { return m_ipkgExecOptions; } 62 int ipkgExecOptions() { return m_ipkgExecOptions; }
64 int ipkgExecVerbosity() { return m_ipkgExecVerbosity; } 63 int ipkgExecVerbosity() { return m_ipkgExecVerbosity; }
65 64
66 void setConfigItems( OConfItemList *configList ); 65 void setConfigItems( OConfItemList *configList );
67 void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } 66 void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; }
68 void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } 67 void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; }
69 68
70 void saveSettings(); 69 void saveSettings();
71 70
72 OPackageList *availablePackages( const QString &server = QString::null ); 71 OPackageList *availablePackages( const QString &server = QString::null );
73 OPackageList *installedPackages( const QString &destName = QString::null, 72 OPackageList *installedPackages( const QString &destName = QString::null,
74 const QString &destPath = QString::null ); 73 const QString &destPath = QString::null );
75 74
76 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, 75 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
77 const QString &name = QString::null ); 76 const QString &name = QString::null );
78 77
79 bool executeCommand( OPackage::Command command = OPackage::NotDefined, 78 bool executeCommand( OPackage::Command command = OPackage::NotDefined,
80 const QStringList &parameters = QStringList(), 79 const QStringList &parameters = QStringList(),
81 const QString &destination = QString::null, 80 const QString &destination = QString::null,
82 const QObject *receiver = 0l, 81 const QObject *receiver = 0l,
83 const char *slotOutput = 0l, 82 const char *slotOutput = 0l,
84 bool rawOutput = true ); 83 bool rawOutput = true );
85 void abortCommand(); 84 void abortCommand();
86 85
87 void ipkgMessage( char *msg ); 86 void ipkgMessage( char *msg );
88 void ipkgStatus( char *status ); 87 void ipkgStatus( char *status );
89 void ipkgList( char *filelist ); 88 void ipkgList( char *filelist );
90 89
91private: 90private:
92 Config *m_config; // Pointer to application configuration file 91 Config *m_config; // Pointer to application configuration file
93 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files 92 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files
94 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options 93 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options
95 int m_ipkgExecVerbosity; // Ipkg execution verbosity level 94 int m_ipkgExecVerbosity; // Ipkg execution verbosity level
96 QString m_rootPath; // Directory path where the 'root' destination is located 95 QString m_rootPath; // Directory path where the 'root' destination is located
97 96
98 void loadConfiguration(); 97 void loadConfiguration();
99 OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); 98 OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined );
100 const QString &rootPath(); 99 const QString &rootPath();
101 void linkPackageDir( const QString &dest = QString::null ); 100 void linkPackageDir( const QString &dest = QString::null );
102 void unlinkPackage( const QString &package = QString::null, 101 void unlinkPackage( const QString &package = QString::null,
103 OConfItemList *destList = 0l ); 102 OConfItemList *destList = 0l );
104 103
105signals: 104signals:
106 void signalIpkgMessage( const QString &msg ); 105 void signalIpkgMessage( const QString &msg );
107 void signalIpkgStatus( const QString &status ); 106 void signalIpkgStatus( const QString &status );
108 void signalIpkgList( const QString &filelist ); 107 void signalIpkgList( const QString &filelist );
109}; 108};
110 109
111#endif 110#endif
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index 0ad1c82..945571f 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -1,541 +1,540 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#include "oipkgconfigdlg.h" 31#include "oipkgconfigdlg.h"
33 32
34#include <opie2/ofiledialog.h> 33#include <opie2/ofiledialog.h>
35 34
36#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
37#include <qpe/resource.h> 36#include <qpe/resource.h>
38 37
39#include <qcheckbox.h> 38#include <qcheckbox.h>
40#include <qcombobox.h> 39#include <qcombobox.h>
41#include <qgroupbox.h> 40#include <qgroupbox.h>
42#include <qlabel.h> 41#include <qlabel.h>
43#include <qlineedit.h> 42#include <qlineedit.h>
44#include <qlistbox.h> 43#include <qlistbox.h>
45#include <qpushbutton.h> 44#include <qpushbutton.h>
46#include <qscrollview.h> 45#include <qscrollview.h>
47#include <qwhatsthis.h> 46#include <qwhatsthis.h>
48 47
49OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) 48OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent )
50 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 49 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
51 , m_ipkg( ipkg ) 50 , m_ipkg( ipkg )
52 , m_configs( 0l ) 51 , m_configs( 0l )
53 , m_installOptions( installOptions ) 52 , m_installOptions( installOptions )
54 , m_serverCurrent( -1 ) 53 , m_serverCurrent( -1 )
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 87
89void OIpkgConfigDlg::accept() 88void OIpkgConfigDlg::accept()
90{ 89{
91 // Save server, destination and proxy configuration 90 // Save server, destination and proxy configuration
92 if ( !m_installOptions ) 91 if ( !m_installOptions )
93 { 92 {
94 // Update proxy information before saving settings 93 // Update proxy information before saving settings
95 OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); 94 OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" );
96 if ( confItem ) 95 if ( confItem )
97 { 96 {
98 confItem->setValue( m_proxyHttpServer->text() ); 97 confItem->setValue( m_proxyHttpServer->text() );
99 confItem->setActive( m_proxyHttpActive->isChecked() ); 98 confItem->setActive( m_proxyHttpActive->isChecked() );
100 } 99 }
101 else 100 else
102 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", 101 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy",
103 m_proxyHttpServer->text(), QString::null, 102 m_proxyHttpServer->text(), QString::null,
104 m_proxyHttpActive->isChecked() ) ); 103 m_proxyHttpActive->isChecked() ) );
105 104
106 confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); 105 confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" );
107 if ( confItem ) 106 if ( confItem )
108 { 107 {
109 confItem->setValue( m_proxyFtpServer->text() ); 108 confItem->setValue( m_proxyFtpServer->text() );
110 confItem->setActive( m_proxyFtpActive->isChecked() ); 109 confItem->setActive( m_proxyFtpActive->isChecked() );
111 } 110 }
112 else 111 else
113 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", 112 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy",
114 m_proxyFtpServer->text(), QString::null, 113 m_proxyFtpServer->text(), QString::null,
115 m_proxyFtpActive->isChecked() ) ); 114 m_proxyFtpActive->isChecked() ) );
116 115
117 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); 116 confItem = m_ipkg->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( 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 = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); 123 confItem = m_ipkg->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( 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 QString listsDir = m_optSourceLists->text(); 130 QString listsDir = m_optSourceLists->text();
132 if ( listsDir == QString::null || listsDir == "" ) 131 if ( listsDir == QString::null || listsDir == "" )
133 listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define 132 listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define
134 confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); 133 confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" );
135 if ( confItem ) 134 if ( confItem )
136 confItem->setValue( listsDir ); 135 confItem->setValue( listsDir );
137 else 136 else
138 m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", 137 m_configs->append( new OConfItem( OConfItem::Other, "lists_dir",
139 listsDir, "name" ) ); 138 listsDir, "name" ) );
140 139
141 m_ipkg->setConfigItems( m_configs ); 140 m_ipkg->setConfigItems( m_configs );
142 } 141 }
143 142
144 // Save options configuration 143 // Save options configuration
145 int options = 0; 144 int options = 0;
146 if ( m_optForceDepends->isChecked() ) 145 if ( m_optForceDepends->isChecked() )
147 options |= FORCE_DEPENDS; 146 options |= FORCE_DEPENDS;
148 if ( m_optForceReinstall->isChecked() ) 147 if ( m_optForceReinstall->isChecked() )
149 options |= FORCE_REINSTALL; 148 options |= FORCE_REINSTALL;
150 if ( m_optForceRemove->isChecked() ) 149 if ( m_optForceRemove->isChecked() )
151 options |= FORCE_REMOVE; 150 options |= FORCE_REMOVE;
152 if ( m_optForceOverwrite->isChecked() ) 151 if ( m_optForceOverwrite->isChecked() )
153 options |= FORCE_OVERWRITE; 152 options |= FORCE_OVERWRITE;
154 m_ipkg->setIpkgExecOptions( options ); 153 m_ipkg->setIpkgExecOptions( options );
155 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); 154 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
156 155
157 QDialog::accept(); 156 QDialog::accept();
158} 157}
159 158
160void OIpkgConfigDlg::reject() 159void OIpkgConfigDlg::reject()
161{ 160{
162 if ( m_configs ) 161 if ( m_configs )
163 delete m_configs; 162 delete m_configs;
164} 163}
165 164
166void OIpkgConfigDlg::initServerWidget() 165void OIpkgConfigDlg::initServerWidget()
167{ 166{
168 m_serverWidget = new QWidget( this ); 167 m_serverWidget = new QWidget( this );
169 168
170 // Initialize UI 169 // Initialize UI
171 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); 170 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget );
172 QScrollView *sv = new QScrollView( m_serverWidget ); 171 QScrollView *sv = new QScrollView( m_serverWidget );
173 vb->addWidget( sv, 0, 0 ); 172 vb->addWidget( sv, 0, 0 );
174 sv->setResizePolicy( QScrollView::AutoOneFit ); 173 sv->setResizePolicy( QScrollView::AutoOneFit );
175 sv->setFrameStyle( QFrame::NoFrame ); 174 sv->setFrameStyle( QFrame::NoFrame );
176 QWidget *container = new QWidget( sv->viewport() ); 175 QWidget *container = new QWidget( sv->viewport() );
177 sv->addChild( container ); 176 sv->addChild( container );
178 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); 177 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 );
179 178
180 m_serverList = new QListBox( container ); 179 m_serverList = new QListBox( container );
181 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." ) ); 180 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." ) );
182 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 181 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
183 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); 182 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) );
184 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); 183 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 );
185 184
186 QPixmap pic; 185 QPixmap pic;
187 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 186 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
188 QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); 187 QPushButton *btn = new QPushButton( pic, tr( "New" ), container );
189 btn->setMinimumHeight( AppLnk::smallIconSize() ); 188 btn->setMinimumHeight( AppLnk::smallIconSize() );
190 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 189 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
191 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); 190 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) );
192 layout->addWidget( btn, 1, 0 ); 191 layout->addWidget( btn, 1, 0 );
193 192
194 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 193 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
195 m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); 194 m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container );
196 m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); 195 m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() );
197 m_serverEditBtn->setEnabled( false ); 196 m_serverEditBtn->setEnabled( false );
198 QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); 197 QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) );
199 connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); 198 connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) );
200 layout->addWidget( m_serverEditBtn, 1, 1 ); 199 layout->addWidget( m_serverEditBtn, 1, 1 );
201 200
202 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 201 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
203 m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); 202 m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container );
204 m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); 203 m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() );
205 m_serverDeleteBtn->setEnabled( false ); 204 m_serverDeleteBtn->setEnabled( false );
206 QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); 205 QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) );
207 connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); 206 connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) );
208 layout->addWidget( m_serverDeleteBtn, 1, 2 ); 207 layout->addWidget( m_serverDeleteBtn, 1, 2 );
209} 208}
210 209
211void OIpkgConfigDlg::initDestinationWidget() 210void OIpkgConfigDlg::initDestinationWidget()
212{ 211{
213 m_destWidget = new QWidget( this ); 212 m_destWidget = new QWidget( this );
214 213
215 // Initialize UI 214 // Initialize UI
216 QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); 215 QVBoxLayout *vb = new QVBoxLayout( m_destWidget );
217 QScrollView *sv = new QScrollView( m_destWidget ); 216 QScrollView *sv = new QScrollView( m_destWidget );
218 vb->addWidget( sv, 0, 0 ); 217 vb->addWidget( sv, 0, 0 );
219 sv->setResizePolicy( QScrollView::AutoOneFit ); 218 sv->setResizePolicy( QScrollView::AutoOneFit );
220 sv->setFrameStyle( QFrame::NoFrame ); 219 sv->setFrameStyle( QFrame::NoFrame );
221 QWidget *container = new QWidget( sv->viewport() ); 220 QWidget *container = new QWidget( sv->viewport() );
222 sv->addChild( container ); 221 sv->addChild( container );
223 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); 222 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 );
224 223
225 m_destList = new QListBox( container ); 224 m_destList = new QListBox( container );
226 QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) ); 225 QWhatsThis::add( m_destList, tr( "This is a list of all destinations configured for this device. Select one here to edit or delete, or add a new one below." ) );
227 m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 226 m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
228 connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); 227 connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) );
229 layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); 228 layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 );
230 229
231 QPixmap pic; 230 QPixmap pic;
232 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 231 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
233 QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); 232 QPushButton *btn = new QPushButton( pic, tr( "New" ), container );
234 btn->setMinimumHeight( AppLnk::smallIconSize() ); 233 btn->setMinimumHeight( AppLnk::smallIconSize() );
235 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 234 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
236 connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); 235 connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) );
237 layout->addWidget( btn, 1, 0 ); 236 layout->addWidget( btn, 1, 0 );
238 237
239 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 238 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
240 m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container ); 239 m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container );
241 m_destEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); 240 m_destEditBtn->setMinimumHeight( AppLnk::smallIconSize() );
242 m_destEditBtn->setEnabled( false ); 241 m_destEditBtn->setEnabled( false );
243 QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); 242 QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) );
244 connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); 243 connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) );
245 layout->addWidget( m_destEditBtn, 1, 1 ); 244 layout->addWidget( m_destEditBtn, 1, 1 );
246 245
247 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 246 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
248 m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); 247 m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container );
249 m_destDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); 248 m_destDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() );
250 m_destDeleteBtn->setEnabled( false ); 249 m_destDeleteBtn->setEnabled( false );
251 QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); 250 QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) );
252 connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); 251 connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) );
253 layout->addWidget( m_destDeleteBtn, 1, 2 ); 252 layout->addWidget( m_destDeleteBtn, 1, 2 );
254} 253}
255 254
256void OIpkgConfigDlg::initProxyWidget() 255void OIpkgConfigDlg::initProxyWidget()
257{ 256{
258 m_proxyWidget = new QWidget( this ); 257 m_proxyWidget = new QWidget( this );
259 258
260 // Initialize UI 259 // Initialize UI
261 QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); 260 QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget );
262 QScrollView *sv = new QScrollView( m_proxyWidget ); 261 QScrollView *sv = new QScrollView( m_proxyWidget );
263 vb->addWidget( sv, 0, 0 ); 262 vb->addWidget( sv, 0, 0 );
264 sv->setResizePolicy( QScrollView::AutoOneFit ); 263 sv->setResizePolicy( QScrollView::AutoOneFit );
265 sv->setFrameStyle( QFrame::NoFrame ); 264 sv->setFrameStyle( QFrame::NoFrame );
266 QWidget *container = new QWidget( sv->viewport() ); 265 QWidget *container = new QWidget( sv->viewport() );
267 sv->addChild( container ); 266 sv->addChild( container );
268 QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); 267 QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 );
269 268
270 // HTTP proxy server configuration 269 // HTTP proxy server configuration
271 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 270 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
272 grpbox->layout()->setSpacing( 2 ); 271 grpbox->layout()->setSpacing( 2 );
273 grpbox->layout()->setMargin( 4 ); 272 grpbox->layout()->setMargin( 4 );
274 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 273 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
275 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 274 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
276 m_proxyHttpServer = new QLineEdit( grpbox ); 275 m_proxyHttpServer = new QLineEdit( grpbox );
277 QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); 276 QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) );
278 grplayout->addWidget( m_proxyHttpServer ); 277 grplayout->addWidget( m_proxyHttpServer );
279 m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 278 m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox );
280 QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); 279 QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) );
281 grplayout->addWidget( m_proxyHttpActive ); 280 grplayout->addWidget( m_proxyHttpActive );
282 281
283 // FTP proxy server configuration 282 // FTP proxy server configuration
284 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 283 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
285 grpbox->layout()->setSpacing( 2 ); 284 grpbox->layout()->setSpacing( 2 );
286 grpbox->layout()->setMargin( 4 ); 285 grpbox->layout()->setMargin( 4 );
287 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 286 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
288 grplayout = new QVBoxLayout( grpbox->layout() ); 287 grplayout = new QVBoxLayout( grpbox->layout() );
289 m_proxyFtpServer = new QLineEdit( grpbox ); 288 m_proxyFtpServer = new QLineEdit( grpbox );
290 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); 289 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) );
291 grplayout->addWidget( m_proxyFtpServer ); 290 grplayout->addWidget( m_proxyFtpServer );
292 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 291 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox );
293 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); 292 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) );
294 grplayout->addWidget( m_proxyFtpActive ); 293 grplayout->addWidget( m_proxyFtpActive );
295 294
296 // Proxy server username and password configuration 295 // Proxy server username and password configuration
297 QLabel *label = new QLabel( tr( "Username:" ), container ); 296 QLabel *label = new QLabel( tr( "Username:" ), container );
298 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); 297 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) );
299 layout->addWidget( label, 2, 0 ); 298 layout->addWidget( label, 2, 0 );
300 m_proxyUsername = new QLineEdit( container ); 299 m_proxyUsername = new QLineEdit( container );
301 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); 300 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) );
302 layout->addWidget( m_proxyUsername, 2, 1 ); 301 layout->addWidget( m_proxyUsername, 2, 1 );
303 302
304 label = new QLabel( tr( "Password:" ), container ); 303 label = new QLabel( tr( "Password:" ), container );
305 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); 304 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) );
306 layout->addWidget( label, 3, 0 ); 305 layout->addWidget( label, 3, 0 );
307 m_proxyPassword = new QLineEdit( container ); 306 m_proxyPassword = new QLineEdit( container );
308 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); 307 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) );
309 layout->addWidget( m_proxyPassword, 3, 1 ); 308 layout->addWidget( m_proxyPassword, 3, 1 );
310} 309}
311 310
312void OIpkgConfigDlg::initOptionsWidget() 311void OIpkgConfigDlg::initOptionsWidget()
313{ 312{
314 m_optionsWidget = new QWidget( this ); 313 m_optionsWidget = new QWidget( this );
315 314
316 // Initialize UI 315 // Initialize UI
317 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); 316 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget );
318 QScrollView *sv = new QScrollView( m_optionsWidget ); 317 QScrollView *sv = new QScrollView( m_optionsWidget );
319 vb->addWidget( sv, 0, 0 ); 318 vb->addWidget( sv, 0, 0 );
320 sv->setResizePolicy( QScrollView::AutoOneFit ); 319 sv->setResizePolicy( QScrollView::AutoOneFit );
321 sv->setFrameStyle( QFrame::NoFrame ); 320 sv->setFrameStyle( QFrame::NoFrame );
322 QWidget *container = new QWidget( sv->viewport() ); 321 QWidget *container = new QWidget( sv->viewport() );
323 sv->addChild( container ); 322 sv->addChild( container );
324 QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); 323 QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 );
325 324
326 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); 325 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container );
327 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); 326 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) );
328 layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); 327 layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 );
329 328
330 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); 329 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container );
331 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); 330 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) );
332 layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); 331 layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 );
333 332
334 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); 333 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container );
335 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); 334 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) );
336 layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); 335 layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 );
337 336
338 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); 337 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container );
339 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); 338 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) );
340 layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); 339 layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 );
341 340
342 QLabel *l = new QLabel( tr( "Information level:" ), container ); 341 QLabel *l = new QLabel( tr( "Information level:" ), container );
343 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); 342 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) );
344 layout->addMultiCellWidget( l, 4, 4, 0, 1 ); 343 layout->addMultiCellWidget( l, 4, 4, 0, 1 );
345 344
346 m_optVerboseIpkg = new QComboBox( container ); 345 m_optVerboseIpkg = new QComboBox( container );
347 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); 346 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) );
348 m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); 347 m_optVerboseIpkg->insertItem( tr( "Errors only" ) );
349 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); 348 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) );
350 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); 349 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) );
351 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); 350 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) );
352 layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); 351 layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 );
353 352
354 l = new QLabel( tr( "Package source lists directory:" ), container ); 353 l = new QLabel( tr( "Package source lists directory:" ), container );
355 QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); 354 QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) );
356 layout->addMultiCellWidget( l, 6, 6, 0, 1 ); 355 layout->addMultiCellWidget( l, 6, 6, 0, 1 );
357 356
358 m_optSourceLists = new QLineEdit( container ); 357 m_optSourceLists = new QLineEdit( container );
359 QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); 358 QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) );
360 layout->addWidget( m_optSourceLists, 7, 0 ); 359 layout->addWidget( m_optSourceLists, 7, 0 );
361 QPixmap pic; 360 QPixmap pic;
362 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 361 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
363 QPushButton *btn = new QPushButton( pic, QString::null, container ); 362 QPushButton *btn = new QPushButton( pic, QString::null, container );
364 btn->setMaximumWidth( btn->height() ); 363 btn->setMaximumWidth( btn->height() );
365 QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); 364 QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) );
366 connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); 365 connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) );
367 layout->addWidget( btn, 7, 1 ); 366 layout->addWidget( btn, 7, 1 );
368 367
369 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 368 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
370} 369}
371 370
372void OIpkgConfigDlg::initData() 371void OIpkgConfigDlg::initData()
373{ 372{
374 // Read ipkg configuration (server/destination/proxy) information 373 // Read ipkg configuration (server/destination/proxy) information
375 if ( m_ipkg && !m_installOptions ) 374 if ( m_ipkg && !m_installOptions )
376 { 375 {
377 m_configs = m_ipkg->configItems(); 376 m_configs = m_ipkg->configItems();
378 if ( m_configs ) 377 if ( m_configs )
379 { 378 {
380 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) 379 for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt )
381 { 380 {
382 OConfItem *config = configIt.current(); 381 OConfItem *config = configIt.current();
383 382
384 // Add configuration item to the appropriate dialog controls 383 // Add configuration item to the appropriate dialog controls
385 if ( config ) 384 if ( config )
386 { 385 {
387 switch ( config->type() ) 386 switch ( config->type() )
388 { 387 {
389 case OConfItem::Source : m_serverList->insertItem( config->name() ); break; 388 case OConfItem::Source : m_serverList->insertItem( config->name() ); break;
390 case OConfItem::Destination : m_destList->insertItem( config->name() ); break; 389 case OConfItem::Destination : m_destList->insertItem( config->name() ); break;
391 case OConfItem::Option : 390 case OConfItem::Option :
392 { 391 {
393 if ( config->name() == "http_proxy" ) 392 if ( config->name() == "http_proxy" )
394 { 393 {
395 m_proxyHttpServer->setText( config->value() ); 394 m_proxyHttpServer->setText( config->value() );
396 m_proxyHttpActive->setChecked( config->active() ); 395 m_proxyHttpActive->setChecked( config->active() );
397 } 396 }
398 else if ( config->name() == "ftp_proxy" ) 397 else if ( config->name() == "ftp_proxy" )
399 { 398 {
400 m_proxyFtpServer->setText( config->value() ); 399 m_proxyFtpServer->setText( config->value() );
401 m_proxyFtpActive->setChecked( config->active() ); 400 m_proxyFtpActive->setChecked( config->active() );
402 } 401 }
403 else if ( config->name() == "proxy_username" ) 402 else if ( config->name() == "proxy_username" )
404 { 403 {
405 m_proxyUsername->setText( config->value() ); 404 m_proxyUsername->setText( config->value() );
406 } 405 }
407 else if ( config->name() == "proxy_password" ) 406 else if ( config->name() == "proxy_password" )
408 { 407 {
409 m_proxyPassword->setText( config->value() ); 408 m_proxyPassword->setText( config->value() );
410 } 409 }
411 } 410 }
412 break; 411 break;
413 case OConfItem::Other : 412 case OConfItem::Other :
414 { 413 {
415 if ( config->name() == "lists_dir" ) 414 if ( config->name() == "lists_dir" )
416 m_optSourceLists->setText( config->value() ); 415 m_optSourceLists->setText( config->value() );
417 else // TODO - use proper libipkg define 416 else // TODO - use proper libipkg define
418 m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); 417 m_optSourceLists->setText( "/usr/lib/ipkg/lists" );
419 } 418 }
420 break; 419 break;
421 default : break; 420 default : break;
422 }; 421 };
423 } 422 }
424 } 423 }
425 } 424 }
426 } 425 }
427 426
428 // Get Ipkg execution options 427 // Get Ipkg execution options
429 int options = m_ipkg->ipkgExecOptions(); 428 int options = m_ipkg->ipkgExecOptions();
430 if ( options & FORCE_DEPENDS ) 429 if ( options & FORCE_DEPENDS )
431 m_optForceDepends->setChecked( true ); 430 m_optForceDepends->setChecked( true );
432 if ( options & FORCE_REINSTALL ) 431 if ( options & FORCE_REINSTALL )
433 m_optForceReinstall->setChecked( true ); 432 m_optForceReinstall->setChecked( true );
434 if ( options & FORCE_REMOVE ) 433 if ( options & FORCE_REMOVE )
435 m_optForceRemove->setChecked( true ); 434 m_optForceRemove->setChecked( true );
436 if ( options & FORCE_OVERWRITE ) 435 if ( options & FORCE_OVERWRITE )
437 m_optForceOverwrite->setChecked( true ); 436 m_optForceOverwrite->setChecked( true );
438 437
439 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); 438 m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() );
440} 439}
441 440
442void OIpkgConfigDlg::slotServerSelected( int index ) 441void OIpkgConfigDlg::slotServerSelected( int index )
443{ 442{
444 m_serverCurrent = index; 443 m_serverCurrent = index;
445 444
446 // Enable Edit and Delete buttons 445 // Enable Edit and Delete buttons
447 m_serverEditBtn->setEnabled( true ); 446 m_serverEditBtn->setEnabled( true );
448 m_serverDeleteBtn->setEnabled( true ); 447 m_serverDeleteBtn->setEnabled( true );
449} 448}
450 449
451void OIpkgConfigDlg::slotServerNew() 450void OIpkgConfigDlg::slotServerNew()
452{ 451{
453 OConfItem *server = new OConfItem( OConfItem::Source ); 452 OConfItem *server = new OConfItem( OConfItem::Source );
454 453
455 OIpkgServerDlg dlg( server, this ); 454 OIpkgServerDlg dlg( server, this );
456 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 455 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
457 { 456 {
458 // Add to configuration option list 457 // Add to configuration option list
459 m_configs->append( server ); 458 m_configs->append( server );
460 m_configs->sort(); 459 m_configs->sort();
461 460
462 // Add to server list 461 // Add to server list
463 m_serverList->insertItem( server->name() ); 462 m_serverList->insertItem( server->name() );
464 m_serverList->setCurrentItem( m_serverList->count() ); 463 m_serverList->setCurrentItem( m_serverList->count() );
465 } 464 }
466 else 465 else
467 delete server; 466 delete server;
468} 467}
469 468
470void OIpkgConfigDlg::slotServerEdit() 469void OIpkgConfigDlg::slotServerEdit()
471{ 470{
472 // Find selected server in list 471 // Find selected server in list
473 OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); 472 OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() );
474 473
475 // Edit server 474 // Edit server
476 if ( server ) 475 if ( server )
477 { 476 {
478 QString origName = server->name(); 477 QString origName = server->name();
479 OIpkgServerDlg dlg( server, this ); 478 OIpkgServerDlg dlg( server, this );
480 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 479 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
481 { 480 {
482 // Check to see if name has changed, if so update the server list 481 // Check to see if name has changed, if so update the server list
483 if ( server->name() != origName ) 482 if ( server->name() != origName )
484 m_serverList->changeItem( server->name(), m_serverCurrent ); 483 m_serverList->changeItem( server->name(), m_serverCurrent );
485 } 484 }
486 } 485 }
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 = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); 491 OConfItem *server = m_ipkg->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::slotDestSelected( int index ) 501void OIpkgConfigDlg::slotDestSelected( int index )
503{ 502{
504 m_destCurrent = index; 503 m_destCurrent = index;
505 504
506 // Enable Edit and Delete buttons 505 // Enable Edit and Delete buttons
507 m_destEditBtn->setEnabled( true ); 506 m_destEditBtn->setEnabled( true );
508 m_destDeleteBtn->setEnabled( true ); 507 m_destDeleteBtn->setEnabled( true );
509} 508}
510 509
511void OIpkgConfigDlg::slotDestNew() 510void OIpkgConfigDlg::slotDestNew()
512{ 511{
513 OConfItem *dest = new OConfItem( OConfItem::Destination ); 512 OConfItem *dest = new OConfItem( OConfItem::Destination );
514 513
515 OIpkgDestDlg dlg( dest, this ); 514 OIpkgDestDlg dlg( dest, this );
516 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 515 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
517 { 516 {
518 // Add to configuration option list 517 // Add to configuration option list
519 m_configs->append( dest ); 518 m_configs->append( dest );
520 m_configs->sort(); 519 m_configs->sort();
521 520
522 // Add to destination list 521 // Add to destination list
523 m_destList->insertItem( dest->name() ); 522 m_destList->insertItem( dest->name() );
524 m_destList->setCurrentItem( m_destList->count() ); 523 m_destList->setCurrentItem( m_destList->count() );
525 } 524 }
526 else 525 else
527 delete dest; 526 delete dest;
528} 527}
529 528
530void OIpkgConfigDlg::slotDestEdit() 529void OIpkgConfigDlg::slotDestEdit()
531{ 530{
532 // Find selected destination in list 531 // Find selected destination in list
533 OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); 532 OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() );
534 533
535 // Edit destination 534 // Edit destination
536 if ( dest ) 535 if ( dest )
537 { 536 {
538 QString origName = dest->name(); 537 QString origName = dest->name();
539 OIpkgDestDlg dlg( dest, this ); 538 OIpkgDestDlg dlg( dest, this );
540 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 539 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
541 { 540 {
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h
index 9e23b62..88381ab 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.h
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.h
@@ -1,167 +1,165 @@
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)2004, 2005 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
30*/ 29*/
31 30
32
33#ifndef OIPKGCONFIGDLG_H 31#ifndef OIPKGCONFIGDLG_H
34#define OIPKGCONFIGDLG_H 32#define OIPKGCONFIGDLG_H
35 33
36#include <opie2/otabwidget.h> 34#include <opie2/otabwidget.h>
37 35
38#include <qdialog.h> 36#include <qdialog.h>
39#include <qlayout.h> 37#include <qlayout.h>
40 38
41#include "oipkg.h" 39#include "oipkg.h"
42 40
43class QCheckBox; 41class QCheckBox;
44class QComboBox; 42class QComboBox;
45class QLineEdit; 43class QLineEdit;
46class QListBox; 44class QListBox;
47class QPushButton; 45class QPushButton;
48 46
49class OIpkgConfigDlg : public QDialog 47class OIpkgConfigDlg : public QDialog
50{ 48{
51 Q_OBJECT 49 Q_OBJECT
52 50
53public: 51public:
54 OIpkgConfigDlg( OIpkg *ipkg = 0l, bool installOptions = false, QWidget *parent = 0l ); 52 OIpkgConfigDlg( OIpkg *ipkg = 0l, bool installOptions = false, QWidget *parent = 0l );
55 53
56protected slots: 54protected slots:
57 void accept(); 55 void accept();
58 void reject(); 56 void reject();
59 57
60private: 58private:
61 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options 59 OIpkg *m_ipkg; // Pointer to Ipkg class for retrieving/saving configuration options
62 OConfItemList *m_configs; // Local list of configuration items 60 OConfItemList *m_configs; // Local list of configuration items
63 61
64 bool m_installOptions; // If true, will only display the Options tab 62 bool m_installOptions; // If true, will only display the Options tab
65 63
66 // Server/Destination cached information 64 // Server/Destination cached information
67 int m_serverCurrent; // Index of currently selected server in m_serverList 65 int m_serverCurrent; // Index of currently selected server in m_serverList
68 int m_destCurrent; // Index of currently selected destination in m_destList 66 int m_destCurrent; // Index of currently selected destination in m_destList
69 67
70 // UI controls 68 // UI controls
71 QVBoxLayout m_layout; // Main dialog layout control 69 QVBoxLayout m_layout; // Main dialog layout control
72 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control 70 Opie::Ui::OTabWidget m_tabWidget; // Main tab widget control
73 QWidget *m_serverWidget; // Widget containing server configuration controls 71 QWidget *m_serverWidget; // Widget containing server configuration controls
74 QWidget *m_destWidget; // Widget containing destination configuration controls 72 QWidget *m_destWidget; // Widget containing destination configuration controls
75 QWidget *m_proxyWidget; // Widget containing proxy configuration controls 73 QWidget *m_proxyWidget; // Widget containing proxy configuration controls
76 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls 74 QWidget *m_optionsWidget; // Widget containing ipkg execution configuration controls
77 75
78 // Server configuration UI controls 76 // Server configuration UI controls
79 QListBox *m_serverList; // Server list selection 77 QListBox *m_serverList; // Server list selection
80 QPushButton *m_serverEditBtn; // Server edit button 78 QPushButton *m_serverEditBtn; // Server edit button
81 QPushButton *m_serverDeleteBtn; // Server edit button 79 QPushButton *m_serverDeleteBtn; // Server edit button
82 80
83 // Destination configuration UI controls 81 // Destination configuration UI controls
84 QListBox *m_destList; // Destination list selection 82 QListBox *m_destList; // Destination list selection
85 QPushButton *m_destEditBtn; // Destination edit button 83 QPushButton *m_destEditBtn; // Destination edit button
86 QPushButton *m_destDeleteBtn; // Destination edit button 84 QPushButton *m_destDeleteBtn; // Destination edit button
87 85
88 // Proxy server configuration UI controls 86 // Proxy server configuration UI controls
89 QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box 87 QLineEdit *m_proxyHttpServer; // HTTP proxy server URL edit box
90 QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box 88 QCheckBox *m_proxyHttpActive; // Activate HTTP proxy check box
91 QLineEdit *m_proxyFtpServer; // FTP proxy server edit box 89 QLineEdit *m_proxyFtpServer; // FTP proxy server edit box
92 QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box 90 QCheckBox *m_proxyFtpActive; // Activate FTP proxy check box
93 QLineEdit *m_proxyUsername; // Proxy server username edit box 91 QLineEdit *m_proxyUsername; // Proxy server username edit box
94 QLineEdit *m_proxyPassword; // Proxy server password edit box 92 QLineEdit *m_proxyPassword; // Proxy server password edit box
95 93
96 // Options configuration UI controls 94 // Options configuration UI controls
97 QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox 95 QCheckBox *m_optForceDepends; // Force depends ipkg option checkbox
98 QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox 96 QCheckBox *m_optForceReinstall; // Force reinstall ipkg option checkbox
99 QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox 97 QCheckBox *m_optForceRemove; // Force remove ipkg option checkbox
100 QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox 98 QCheckBox *m_optForceOverwrite; // Force overwrite ipkg option checkbox
101 QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection 99 QComboBox *m_optVerboseIpkg; // Ipkg verbosity option selection
102 QLineEdit *m_optSourceLists; // Ipkg source lists destination directory 100 QLineEdit *m_optSourceLists; // Ipkg source lists destination directory
103 101
104 void initServerWidget(); 102 void initServerWidget();
105 void initDestinationWidget(); 103 void initDestinationWidget();
106 void initProxyWidget(); 104 void initProxyWidget();
107 void initOptionsWidget(); 105 void initOptionsWidget();
108 106
109 void initData(); 107 void initData();
110 108
111private slots: 109private slots:
112 void slotServerSelected( int index ); 110 void slotServerSelected( int index );
113 void slotServerNew(); 111 void slotServerNew();
114 void slotServerEdit(); 112 void slotServerEdit();
115 void slotServerDelete(); 113 void slotServerDelete();
116 114
117 void slotDestSelected( int index ); 115 void slotDestSelected( int index );
118 void slotDestNew(); 116 void slotDestNew();
119 void slotDestEdit(); 117 void slotDestEdit();
120 void slotDestDelete(); 118 void slotDestDelete();
121 119
122 void slotOptSelectSourceListsPath(); 120 void slotOptSelectSourceListsPath();
123}; 121};
124 122
125class OIpkgServerDlg : public QDialog 123class OIpkgServerDlg : public QDialog
126{ 124{
127 Q_OBJECT 125 Q_OBJECT
128 126
129public: 127public:
130 OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l ); 128 OIpkgServerDlg( OConfItem *server = 0l, QWidget *parent = 0l );
131 129
132protected slots: 130protected slots:
133 void accept(); 131 void accept();
134 132
135private: 133private:
136 OConfItem *m_server; 134 OConfItem *m_server;
137 135
138 // UI controls 136 // UI controls
139 QLineEdit *m_name; // Server name edit box 137 QLineEdit *m_name; // Server name edit box
140 QLineEdit *m_location; // Server location URL edit box 138 QLineEdit *m_location; // Server location URL edit box
141 QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed 139 QCheckBox *m_compressed; // Indicates whether the server is a 'src/gz' feed
142 QCheckBox *m_active; // Indicates whether the server is activated 140 QCheckBox *m_active; // Indicates whether the server is activated
143}; 141};
144 142
145class OIpkgDestDlg : public QDialog 143class OIpkgDestDlg : public QDialog
146{ 144{
147 Q_OBJECT 145 Q_OBJECT
148 146
149public: 147public:
150 OIpkgDestDlg( OConfItem *dest = 0l, QWidget *parent = 0l ); 148 OIpkgDestDlg( OConfItem *dest = 0l, QWidget *parent = 0l );
151 149
152protected slots: 150protected slots:
153 void accept(); 151 void accept();
154 152
155private: 153private:
156 OConfItem *m_dest; 154 OConfItem *m_dest;
157 155
158 // UI controls 156 // UI controls
159 QLineEdit *m_name; // Destination name edit box 157 QLineEdit *m_name; // Destination name edit box
160 QLineEdit *m_location; // Destination location URL edit box 158 QLineEdit *m_location; // Destination location URL edit box
161 QCheckBox *m_active; // Indicates whether the destination is activated 159 QCheckBox *m_active; // Indicates whether the destination is activated
162 160
163private slots: 161private slots:
164 void slotSelectPath(); 162 void slotSelectPath();
165}; 163};
166 164
167#endif 165#endif
diff --git a/noncore/settings/packagemanager/opackage.cpp b/noncore/settings/packagemanager/opackage.cpp
index 37963fa..f3c2024 100644
--- a/noncore/settings/packagemanager/opackage.cpp
+++ b/noncore/settings/packagemanager/opackage.cpp
@@ -1,46 +1,45 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#include "opackage.h" 31#include "opackage.h"
33 32
34OPackage::OPackage( const QString &name, const QString &version, const QString &versionInstalled, 33OPackage::OPackage( const QString &name, const QString &version, const QString &versionInstalled,
35 const QString &source, const QString &destination, const QString &category, 34 const QString &source, const QString &destination, const QString &category,
36 const QString &information, const QString &files ) 35 const QString &information, const QString &files )
37 : m_name( name ) 36 : m_name( name )
38 , m_version( version ) 37 , m_version( version )
39 , m_versionInstalled( versionInstalled ) 38 , m_versionInstalled( versionInstalled )
40 , m_source( source ) 39 , m_source( source )
41 , m_destination( destination ) 40 , m_destination( destination )
42 , m_category( category ) 41 , m_category( category )
43 , m_information( information ) 42 , m_information( information )
44 , m_files( files ) 43 , m_files( files )
45{ 44{
46} 45}
diff --git a/noncore/settings/packagemanager/opackage.h b/noncore/settings/packagemanager/opackage.h
index fbd9ec0..4da5a2b 100644
--- a/noncore/settings/packagemanager/opackage.h
+++ b/noncore/settings/packagemanager/opackage.h
@@ -1,81 +1,80 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#ifndef OPACKAGE_H 31#ifndef OPACKAGE_H
33#define OPACKAGE_H 32#define OPACKAGE_H
34 33
35#include <qlist.h> 34#include <qlist.h>
36#include <qstring.h> 35#include <qstring.h>
37 36
38class OPackage 37class OPackage
39{ 38{
40public: 39public:
41 enum Command { Install, Remove, Update, Upgrade, Download, Info, Files, Version, NotDefined }; 40 enum Command { Install, Remove, Update, Upgrade, Download, Info, Files, Version, NotDefined };
42 41
43 OPackage( const QString &name= QString::null, 42 OPackage( const QString &name= QString::null,
44 const QString &version= QString::null, const QString &versionInstalled= QString::null, 43 const QString &version= QString::null, const QString &versionInstalled= QString::null,
45 const QString &source= QString::null, const QString &destination= QString::null, 44 const QString &source= QString::null, const QString &destination= QString::null,
46 const QString &category = "misc", const QString &information = QString::null, 45 const QString &category = "misc", const QString &information = QString::null,
47 const QString &files = QString::null ); 46 const QString &files = QString::null );
48 47
49 const QString &name() { return m_name; } 48 const QString &name() { return m_name; }
50 const QString &version() { return m_version; } 49 const QString &version() { return m_version; }
51 const QString &versionInstalled() { return m_versionInstalled; } 50 const QString &versionInstalled() { return m_versionInstalled; }
52 const QString &source() { return m_source; } 51 const QString &source() { return m_source; }
53 const QString &destination() { return m_destination; } 52 const QString &destination() { return m_destination; }
54 const QString &category() { return m_category; } 53 const QString &category() { return m_category; }
55 const QString &information() { return m_information; } 54 const QString &information() { return m_information; }
56 const QString &files() { return m_files; } 55 const QString &files() { return m_files; }
57 56
58 void setName( const QString &name ) { m_name = name; } 57 void setName( const QString &name ) { m_name = name; }
59 void setVersion( const QString &version ) { m_version = version; } 58 void setVersion( const QString &version ) { m_version = version; }
60 void setVersionInstalled( const QString &version ) { m_versionInstalled = version; } 59 void setVersionInstalled( const QString &version ) { m_versionInstalled = version; }
61 void setSource( const QString &source ) { m_source = source; } 60 void setSource( const QString &source ) { m_source = source; }
62 void setDestination( const QString &destination ) { m_destination = destination; } 61 void setDestination( const QString &destination ) { m_destination = destination; }
63 void setCategory( const QString &category ) { m_category = category; } 62 void setCategory( const QString &category ) { m_category = category; }
64 void setInformation( const QString &information ) { m_information = information; } 63 void setInformation( const QString &information ) { m_information = information; }
65 void setFiles( const QString &files ) { m_files = files; } 64 void setFiles( const QString &files ) { m_files = files; }
66 65
67private: 66private:
68 QString m_name; // Name of item 67 QString m_name; // Name of item
69 QString m_version; // Available version number of item 68 QString m_version; // Available version number of item
70 QString m_versionInstalled; // Installed version number of item, null if not installed 69 QString m_versionInstalled; // Installed version number of item, null if not installed
71 QString m_source; // Source feed of available version 70 QString m_source; // Source feed of available version
72 QString m_destination; // Location item is installed to, null if not installed 71 QString m_destination; // Location item is installed to, null if not installed
73 QString m_category; // Item category 72 QString m_category; // Item category
74 QString m_information; // Package information 73 QString m_information; // Package information
75 QString m_files; // File list information 74 QString m_files; // File list information
76}; 75};
77 76
78typedef QList<OPackage> OPackageList; 77typedef QList<OPackage> OPackageList;
79typedef QListIterator<OPackage> OPackageListIterator; 78typedef QListIterator<OPackage> OPackageListIterator;
80 79
81#endif 80#endif
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp
index c9fdec1..abd8852 100644
--- a/noncore/settings/packagemanager/opackagemanager.cpp
+++ b/noncore/settings/packagemanager/opackagemanager.cpp
@@ -1,394 +1,393 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#include "opackagemanager.h" 31#include "opackagemanager.h"
33#include "oipkgconfigdlg.h" 32#include "oipkgconfigdlg.h"
34 33
35#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
36 35
37#include <ctype.h> 36#include <ctype.h>
38 37
39OPackageManager::OPackageManager( Config *config, QObject *parent, const char *name ) 38OPackageManager::OPackageManager( Config *config, QObject *parent, const char *name )
40 : QObject( parent, name ) 39 : QObject( parent, name )
41 , m_config( config ) 40 , m_config( config )
42 , m_ipkg( m_config, this ) 41 , m_ipkg( m_config, this )
43 , m_packages( 9973 ) 42 , m_packages( 9973 )
44 , m_categories() 43 , m_categories()
45{ 44{
46 m_packages.setAutoDelete( true ); 45 m_packages.setAutoDelete( true );
47} 46}
48 47
49void OPackageManager::loadAvailablePackages() 48void OPackageManager::loadAvailablePackages()
50{ 49{
51 m_packages.clear(); 50 m_packages.clear();
52 51
53 OConfItemList *serverList = m_ipkg.servers(); 52 OConfItemList *serverList = m_ipkg.servers();
54 53
55 if ( serverList ) 54 if ( serverList )
56 { 55 {
57 // Initialize status messaging 56 // Initialize status messaging
58 emit initStatus( serverList->count() ); 57 emit initStatus( serverList->count() );
59 int serverCount = 0; 58 int serverCount = 0;
60 59
61 bool categoryAdded = false; 60 bool categoryAdded = false;
62 61
63 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt ) 62 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt )
64 { 63 {
65 OConfItem *server = serverIt.current(); 64 OConfItem *server = serverIt.current();
66 65
67 // Process server only if it is active 66 // Process server only if it is active
68 if ( server->active() ) 67 if ( server->active() )
69 { 68 {
70 // Update status 69 // Update status
71 QString status = tr( "Reading available packages:\n\t" ); 70 QString status = tr( "Reading available packages:\n\t" );
72 status.append( server->name() ); 71 status.append( server->name() );
73 emit statusText( status ); 72 emit statusText( status );
74 ++serverCount; 73 ++serverCount;
75 emit statusBar( serverCount ); 74 emit statusBar( serverCount );
76 qApp->processEvents(); 75 qApp->processEvents();
77 76
78 OPackageList *packageList = m_ipkg.availablePackages( server->name() ); 77 OPackageList *packageList = m_ipkg.availablePackages( server->name() );
79 if ( packageList ) 78 if ( packageList )
80 { 79 {
81 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 80 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
82 { 81 {
83 OPackage *package = packageIt.current(); 82 OPackage *package = packageIt.current();
84 83
85 // Load package info 84 // Load package info
86 if ( !m_packages.find( package->name() ) ) 85 if ( !m_packages.find( package->name() ) )
87 m_packages.insert( package->name(), package ); 86 m_packages.insert( package->name(), package );
88 else 87 else
89 { 88 {
90 // If new package is newer version, replace existing package 89 // If new package is newer version, replace existing package
91 OPackage *currPackage = m_packages[package->name()]; 90 OPackage *currPackage = m_packages[package->name()];
92 if ( compareVersions( package->version(), currPackage->version() ) == 1 ) 91 if ( compareVersions( package->version(), currPackage->version() ) == 1 )
93 m_packages.replace( package->name(), package ); 92 m_packages.replace( package->name(), package );
94 } 93 }
95 94
96 // Add category to list if it doesn't already exist 95 // Add category to list if it doesn't already exist
97 if ( m_categories.grep( package->category() ).isEmpty() ) 96 if ( m_categories.grep( package->category() ).isEmpty() )
98 { 97 {
99 m_categories << package->category(); 98 m_categories << package->category();
100 categoryAdded = true; 99 categoryAdded = true;
101 } 100 }
102 } 101 }
103 } 102 }
104 } 103 }
105 } 104 }
106 delete serverList; 105 delete serverList;
107 106
108 // Sort category list if categories were added 107 // Sort category list if categories were added
109 if ( categoryAdded ) 108 if ( categoryAdded )
110 m_categories.sort(); 109 m_categories.sort();
111 } 110 }
112} 111}
113 112
114void OPackageManager::loadInstalledPackages() 113void OPackageManager::loadInstalledPackages()
115{ 114{
116 OConfItemList *destList = m_ipkg.destinations(); 115 OConfItemList *destList = m_ipkg.destinations();
117 116
118 if ( destList ) 117 if ( destList )
119 { 118 {
120 // Initialize status messaging 119 // Initialize status messaging
121 emit initStatus( destList->count() ); 120 emit initStatus( destList->count() );
122 int destCount = 0; 121 int destCount = 0;
123 122
124 bool categoryAdded = false; 123 bool categoryAdded = false;
125 124
126 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 125 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
127 { 126 {
128 OConfItem *destination = destIt.current(); 127 OConfItem *destination = destIt.current();
129 128
130 // Process destination only if it is active 129 // Process destination only if it is active
131 if ( destination->active() ) 130 if ( destination->active() )
132 { 131 {
133 // Update status 132 // Update status
134 QString status = tr( "Reading installed packages:\n\t" ); 133 QString status = tr( "Reading installed packages:\n\t" );
135 status.append( destination->name() ); 134 status.append( destination->name() );
136 emit statusText( status ); 135 emit statusText( status );
137 ++destCount; 136 ++destCount;
138 emit statusBar( destCount ); 137 emit statusBar( destCount );
139 qApp->processEvents(); 138 qApp->processEvents();
140 139
141 OPackageList *packageList = m_ipkg.installedPackages( destination->name(), 140 OPackageList *packageList = m_ipkg.installedPackages( destination->name(),
142 destination->value() ); 141 destination->value() );
143 if ( packageList ) 142 if ( packageList )
144 { 143 {
145 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 144 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
146 { 145 {
147 OPackage *package = packageIt.current(); 146 OPackage *package = packageIt.current();
148 OPackage *currPackage = m_packages[package->name()]; 147 OPackage *currPackage = m_packages[package->name()];
149 if ( currPackage ) 148 if ( currPackage )
150 { 149 {
151 // Package is in a current feed, update installed version, destination 150 // Package is in a current feed, update installed version, destination
152 currPackage->setVersionInstalled( package->versionInstalled() ); 151 currPackage->setVersionInstalled( package->versionInstalled() );
153 currPackage->setDestination( package->destination() ); 152 currPackage->setDestination( package->destination() );
154 153
155 delete package; 154 delete package;
156 } 155 }
157 else 156 else
158 { 157 {
159 // Package isn't in a current feed, add to list 158 // Package isn't in a current feed, add to list
160 m_packages.insert( package->name(), package ); 159 m_packages.insert( package->name(), package );
161 160
162 // Add category to list if it doesn't already exist 161 // Add category to list if it doesn't already exist
163 if ( m_categories.grep( package->category() ).isEmpty() ) 162 if ( m_categories.grep( package->category() ).isEmpty() )
164 { 163 {
165 m_categories << package->category(); 164 m_categories << package->category();
166 categoryAdded = true; 165 categoryAdded = true;
167 } 166 }
168 } 167 }
169 } 168 }
170 } 169 }
171 } 170 }
172 } 171 }
173 delete destList; 172 delete destList;
174 173
175 // Sort category list if categories were added 174 // Sort category list if categories were added
176 if ( categoryAdded ) 175 if ( categoryAdded )
177 m_categories.sort(); 176 m_categories.sort();
178 } 177 }
179} 178}
180 179
181OPackageList *OPackageManager::packages() 180OPackageList *OPackageManager::packages()
182{ 181{
183 // TODO - look to see if list is loaded, if not, load available & installed 182 // TODO - look to see if list is loaded, if not, load available & installed
184 183
185 OPackageList *pl = new OPackageList; 184 OPackageList *pl = new OPackageList;
186 185
187 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt ) 186 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt )
188 pl->append( packageIt.current() ); 187 pl->append( packageIt.current() );
189 188
190 return pl; 189 return pl;
191} 190}
192 191
193OPackageList *OPackageManager::filterPackages( const QString &name,const QString &server, 192OPackageList *OPackageManager::filterPackages( const QString &name,const QString &server,
194 const QString &destination, Status status, const QString &category ) 193 const QString &destination, Status status, const QString &category )
195{ 194{
196 // TODO - look to see if list is loaded, if not, load available & installed 195 // TODO - look to see if list is loaded, if not, load available & installed
197 196
198 OPackageList *pl = new OPackageList; 197 OPackageList *pl = new OPackageList;
199 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt ) 198 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt )
200 { 199 {
201 OPackage *package = packageIt.current(); 200 OPackage *package = packageIt.current();
202 201
203 bool nameMatch = ( name.isNull() || package->name().contains( name ) ); 202 bool nameMatch = ( name.isNull() || package->name().contains( name ) );
204 bool serverMatch = ( server.isNull() || package->source() == server ); 203 bool serverMatch = ( server.isNull() || package->source() == server );
205 bool destinationMatch = ( destination.isNull() || package->destination() == destination ); 204 bool destinationMatch = ( destination.isNull() || package->destination() == destination );
206 bool statusMatch; 205 bool statusMatch;
207 switch ( status ) 206 switch ( status )
208 { 207 {
209 case All : statusMatch = true; 208 case All : statusMatch = true;
210 break; 209 break;
211 case NotInstalled : statusMatch = package->versionInstalled().isNull(); 210 case NotInstalled : statusMatch = package->versionInstalled().isNull();
212 break; 211 break;
213 case Installed : statusMatch = !package->versionInstalled().isNull(); 212 case Installed : statusMatch = !package->versionInstalled().isNull();
214 break; 213 break;
215 case Updated : statusMatch = ( !package->versionInstalled().isNull() && 214 case Updated : statusMatch = ( !package->versionInstalled().isNull() &&
216 compareVersions( package->version(), package->versionInstalled() ) == 1 ); 215 compareVersions( package->version(), package->versionInstalled() ) == 1 );
217 break; 216 break;
218 default : statusMatch = true; 217 default : statusMatch = true;
219 break; 218 break;
220 }; 219 };
221 bool categoryMatch = ( category.isNull() || package->category() == category ); 220 bool categoryMatch = ( category.isNull() || package->category() == category );
222 221
223 if ( nameMatch && serverMatch && destinationMatch && statusMatch && categoryMatch ) 222 if ( nameMatch && serverMatch && destinationMatch && statusMatch && categoryMatch )
224 pl->append( packageIt.current() ); 223 pl->append( packageIt.current() );
225 } 224 }
226 225
227 return pl; 226 return pl;
228} 227}
229 228
230QStringList OPackageManager::servers() 229QStringList OPackageManager::servers()
231{ 230{
232 QStringList sl; 231 QStringList sl;
233 232
234 OConfItemList *serverList = m_ipkg.servers(); 233 OConfItemList *serverList = m_ipkg.servers();
235 if ( serverList ) 234 if ( serverList )
236 { 235 {
237 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt ) 236 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt )
238 { 237 {
239 OConfItem *server = serverIt.current(); 238 OConfItem *server = serverIt.current();
240 239
241 // Add only active servers 240 // Add only active servers
242 if ( server->active() ) 241 if ( server->active() )
243 sl << server->name(); 242 sl << server->name();
244 } 243 }
245 } 244 }
246 245
247 return sl; 246 return sl;
248} 247}
249 248
250QStringList OPackageManager::destinations() 249QStringList OPackageManager::destinations()
251{ 250{
252 QStringList dl; 251 QStringList dl;
253 252
254 OConfItemList *destList = m_ipkg.destinations(); 253 OConfItemList *destList = m_ipkg.destinations();
255 if ( destList ) 254 if ( destList )
256 { 255 {
257 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 256 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
258 { 257 {
259 OConfItem *destination = destIt.current(); 258 OConfItem *destination = destIt.current();
260 259
261 // Add only active destinations 260 // Add only active destinations
262 if ( destination->active() ) 261 if ( destination->active() )
263 dl << destination->name(); 262 dl << destination->name();
264 } 263 }
265 } 264 }
266 265
267 return dl; 266 return dl;
268} 267}
269 268
270OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name ) 269OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name )
271{ 270{
272 return m_ipkg.findConfItem( type, name ); 271 return m_ipkg.findConfItem( type, name );
273} 272}
274 273
275OPackage *OPackageManager::findPackage( const QString &name ) 274OPackage *OPackageManager::findPackage( const QString &name )
276{ 275{
277 return m_packages[ name ]; 276 return m_packages[ name ];
278} 277}
279 278
280int OPackageManager::compareVersions( const QString &ver1, const QString &ver2 ) 279int OPackageManager::compareVersions( const QString &ver1, const QString &ver2 )
281{ 280{
282 // TODO - should this be in OIpkg??? 281 // TODO - should this be in OIpkg???
283 282
284 int epoch1, epoch2; 283 int epoch1, epoch2;
285 QString version1, revision1; 284 QString version1, revision1;
286 QString version2, revision2; 285 QString version2, revision2;
287 286
288 parseVersion( ver1, &epoch1, &version1, &revision1 ); 287 parseVersion( ver1, &epoch1, &version1, &revision1 );
289 parseVersion( ver2, &epoch2, &version2, &revision2 ); 288 parseVersion( ver2, &epoch2, &version2, &revision2 );
290 289
291 if ( epoch1 > epoch2 ) 290 if ( epoch1 > epoch2 )
292 return 1; 291 return 1;
293 else if ( epoch1 < epoch2 ) 292 else if ( epoch1 < epoch2 )
294 return -1; 293 return -1;
295 294
296 int r = verrevcmp( version1.latin1(), version2.latin1() ); 295 int r = verrevcmp( version1.latin1(), version2.latin1() );
297 if (r) 296 if (r)
298 return r; 297 return r;
299 298
300 r = verrevcmp( revision1.latin1(), revision2.latin1() ); 299 r = verrevcmp( revision1.latin1(), revision2.latin1() );
301 return r; 300 return r;
302} 301}
303 302
304bool OPackageManager::configureDlg( bool installOptions ) 303bool OPackageManager::configureDlg( bool installOptions )
305{ 304{
306 OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) ); 305 OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) );
307 return ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); 306 return ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted );
308} 307}
309 308
310void OPackageManager::saveSettings() 309void OPackageManager::saveSettings()
311{ 310{
312 m_ipkg.saveSettings(); 311 m_ipkg.saveSettings();
313} 312}
314 313
315bool OPackageManager::executeCommand( OPackage::Command command, const QStringList &packages, 314bool OPackageManager::executeCommand( OPackage::Command command, const QStringList &packages,
316 const QString &destination, const QObject *receiver, 315 const QString &destination, const QObject *receiver,
317 const char *slotOutput, bool rawOutput ) 316 const char *slotOutput, bool rawOutput )
318{ 317{
319 return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput ); 318 return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput );
320} 319}
321 320
322void OPackageManager::parseVersion( const QString &verstr, int *epoch, QString *version, 321void OPackageManager::parseVersion( const QString &verstr, int *epoch, QString *version,
323 QString *revision ) 322 QString *revision )
324{ 323{
325 *epoch = 0; 324 *epoch = 0;
326 *revision = QString::null; 325 *revision = QString::null;
327 326
328 // Version string is in the format "ee:vv-rv", where ee=epoch, vv=version, rv=revision 327 // Version string is in the format "ee:vv-rv", where ee=epoch, vv=version, rv=revision
329 328
330 // Get epoch 329 // Get epoch
331 int colonpos = verstr.find( ':' ); 330 int colonpos = verstr.find( ':' );
332 if ( colonpos > -1 ) 331 if ( colonpos > -1 )
333 { 332 {
334 *epoch = verstr.left( colonpos ).toInt(); 333 *epoch = verstr.left( colonpos ).toInt();
335 } 334 }
336 335
337 // Get version and revision 336 // Get version and revision
338 int hyphenpos = verstr.find( '-', colonpos + 1 ); 337 int hyphenpos = verstr.find( '-', colonpos + 1 );
339 int verlen = verstr.length(); 338 int verlen = verstr.length();
340 if ( hyphenpos > -1 ) 339 if ( hyphenpos > -1 )
341 { 340 {
342 *version = verstr.mid( colonpos + 1, hyphenpos - colonpos - 1 ); 341 *version = verstr.mid( colonpos + 1, hyphenpos - colonpos - 1 );
343 *revision = verstr.right( verlen - hyphenpos - 1 ); 342 *revision = verstr.right( verlen - hyphenpos - 1 );
344 } 343 }
345 else 344 else
346 { 345 {
347 *version = verstr.right( verlen - colonpos ); 346 *version = verstr.right( verlen - colonpos );
348 } 347 }
349} 348}
350 349
351/* 350/*
352 * libdpkg - Debian packaging suite library routines 351 * libdpkg - Debian packaging suite library routines
353 * vercmp.c - comparison of version numbers 352 * vercmp.c - comparison of version numbers
354 * 353 *
355 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk> 354 * Copyright (C) 1995 Ian Jackson <iwj10@cus.cam.ac.uk>
356 */ 355 */
357int OPackageManager::verrevcmp( const char *val, const char *ref ) 356int OPackageManager::verrevcmp( const char *val, const char *ref )
358{ 357{
359 int vc, rc; 358 int vc, rc;
360 long vl, rl; 359 long vl, rl;
361 const char *vp, *rp; 360 const char *vp, *rp;
362 const char *vsep, *rsep; 361 const char *vsep, *rsep;
363 362
364 if (!val) val= ""; 363 if (!val) val= "";
365 if (!ref) ref= ""; 364 if (!ref) ref= "";
366 for (;;) { 365 for (;;) {
367 vp= val; while (*vp && !isdigit(*vp)) vp++; 366 vp= val; while (*vp && !isdigit(*vp)) vp++;
368 rp= ref; while (*rp && !isdigit(*rp)) rp++; 367 rp= ref; while (*rp && !isdigit(*rp)) rp++;
369 for (;;) { 368 for (;;) {
370 vc= (val == vp) ? 0 : *val++; 369 vc= (val == vp) ? 0 : *val++;
371 rc= (ref == rp) ? 0 : *ref++; 370 rc= (ref == rp) ? 0 : *ref++;
372 if (!rc && !vc) break; 371 if (!rc && !vc) break;
373 if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */ 372 if (vc && !isalpha(vc)) vc += 256; /* assumes ASCII character set */
374 if (rc && !isalpha(rc)) rc += 256; 373 if (rc && !isalpha(rc)) rc += 256;
375 if (vc != rc) return vc - rc; 374 if (vc != rc) return vc - rc;
376 } 375 }
377 val= vp; 376 val= vp;
378 ref= rp; 377 ref= rp;
379 vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10); 378 vl=0; if (isdigit(*vp)) vl= strtol(val,(char**)&val,10);
380 rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10); 379 rl=0; if (isdigit(*rp)) rl= strtol(ref,(char**)&ref,10);
381 if (vl != rl) return vl - rl; 380 if (vl != rl) return vl - rl;
382 381
383 vc = *val; 382 vc = *val;
384 rc = *ref; 383 rc = *ref;
385 vsep = strchr(".-", vc); 384 vsep = strchr(".-", vc);
386 rsep = strchr(".-", rc); 385 rsep = strchr(".-", rc);
387 if (vsep && !rsep) return -1; 386 if (vsep && !rsep) return -1;
388 if (!vsep && rsep) return +1; 387 if (!vsep && rsep) return +1;
389 388
390 if (!*val && !*ref) return 0; 389 if (!*val && !*ref) return 0;
391 if (!*val) return -1; 390 if (!*val) return -1;
392 if (!*ref) return +1; 391 if (!*ref) return +1;
393 } 392 }
394} 393}
diff --git a/noncore/settings/packagemanager/opackagemanager.h b/noncore/settings/packagemanager/opackagemanager.h
index bc394e8..60c1643 100644
--- a/noncore/settings/packagemanager/opackagemanager.h
+++ b/noncore/settings/packagemanager/opackagemanager.h
@@ -1,95 +1,94 @@
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)2004, 2005 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
30*/ 29*/
31 30
32#ifndef OPACKAGEMANAGER_H 31#ifndef OPACKAGEMANAGER_H
33#define OPACKAGEMANAGER_H 32#define OPACKAGEMANAGER_H
34 33
35#include "oipkg.h" 34#include "oipkg.h"
36 35
37#include <qpe/config.h> 36#include <qpe/config.h>
38 37
39#include <qdict.h> 38#include <qdict.h>
40#include <qobject.h> 39#include <qobject.h>
41#include <qstringlist.h> 40#include <qstringlist.h>
42 41
43class OPackageManager : public QObject 42class OPackageManager : public QObject
44{ 43{
45 Q_OBJECT 44 Q_OBJECT
46 45
47public: 46public:
48 OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); 47 OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 );
49 48
50 void loadAvailablePackages(); 49 void loadAvailablePackages();
51 void loadInstalledPackages(); 50 void loadInstalledPackages();
52 51
53 enum Status { All, NotInstalled, Installed, Updated, NotDefined }; 52 enum Status { All, NotInstalled, Installed, Updated, NotDefined };
54 53
55 OPackageList *packages(); 54 OPackageList *packages();
56 OPackageList *filterPackages( const QString &name = QString::null, 55 OPackageList *filterPackages( const QString &name = QString::null,
57 const QString &server = QString::null, 56 const QString &server = QString::null,
58 const QString &destination = QString::null, 57 const QString &destination = QString::null,
59 Status status = NotDefined, 58 Status status = NotDefined,
60 const QString &category = QString::null ); 59 const QString &category = QString::null );
61 60
62 const QStringList &categories() { return m_categories; } 61 const QStringList &categories() { return m_categories; }
63 QStringList servers(); 62 QStringList servers();
64 QStringList destinations(); 63 QStringList destinations();
65 64
66 int compareVersions( const QString &version1, const QString &version2 ); 65 int compareVersions( const QString &version1, const QString &version2 );
67 66
68 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, 67 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
69 const QString &name = QString::null ); 68 const QString &name = QString::null );
70 OPackage *findPackage( const QString &name = QString::null ); 69 OPackage *findPackage( const QString &name = QString::null );
71 70
72 bool configureDlg( bool installOptions = false ); 71 bool configureDlg( bool installOptions = false );
73 void saveSettings(); 72 void saveSettings();
74 73
75 bool executeCommand( OPackage::Command command = OPackage::NotDefined, 74 bool executeCommand( OPackage::Command command = OPackage::NotDefined,
76 const QStringList &parameters = QStringList(), 75 const QStringList &parameters = QStringList(),
77 const QString &destination = QString::null, const QObject *receiver = 0x0, 76 const QString &destination = QString::null, const QObject *receiver = 0x0,
78 const char *slotOutput = 0x0, bool rawOutput = true ); 77 const char *slotOutput = 0x0, bool rawOutput = true );
79 78
80private: 79private:
81 Config *m_config; // Pointer to application configuration file 80 Config *m_config; // Pointer to application configuration file
82 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information 81 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information
83 QDict<OPackage> m_packages; // Global list of available packages 82 QDict<OPackage> m_packages; // Global list of available packages
84 QStringList m_categories; // List of all categories 83 QStringList m_categories; // List of all categories
85 84
86 void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision ); 85 void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision );
87 int verrevcmp( const char *val, const char *ref ); 86 int verrevcmp( const char *val, const char *ref );
88 87
89signals: 88signals:
90 void initStatus( int numSteps ); 89 void initStatus( int numSteps );
91 void statusText( const QString &status ); 90 void statusText( const QString &status );
92 void statusBar( int currStep ); 91 void statusBar( int currStep );
93}; 92};
94 93
95#endif 94#endif
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp
index 3eef939..e034f34 100644
--- a/noncore/settings/packagemanager/packageinfodlg.cpp
+++ b/noncore/settings/packagemanager/packageinfodlg.cpp
@@ -1,153 +1,154 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "packageinfodlg.h" 31#include "packageinfodlg.h"
31#include "opackage.h" 32#include "opackage.h"
32#include "opackagemanager.h" 33#include "opackagemanager.h"
33 34
34#include <opie2/otabwidget.h> 35#include <opie2/otabwidget.h>
35 36
36#include <qpe/resource.h> 37#include <qpe/resource.h>
37 38
38#include <qlayout.h> 39#include <qlayout.h>
39#include <qpushbutton.h> 40#include <qpushbutton.h>
40#include <qwhatsthis.h> 41#include <qwhatsthis.h>
41 42
42PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) 43PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package )
43 : QWidget( 0l ) 44 : QWidget( 0l )
44 , m_packman( pm ) 45 , m_packman( pm )
45 , m_information( this ) 46 , m_information( this )
46 , m_files( this ) 47 , m_files( this )
47 , m_retrieveFiles( 0l ) 48 , m_retrieveFiles( 0l )
48{ 49{
49 // Initialize UI 50 // Initialize UI
50 if ( parent ) 51 if ( parent )
51 parent->setCaption( package ); 52 parent->setCaption( package );
52 53
53 QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); 54 QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 );
54 55
55 Opie::Ui::OTabWidget *tabWidget = new Opie::Ui::OTabWidget( this ); 56 Opie::Ui::OTabWidget *tabWidget = new Opie::Ui::OTabWidget( this );
56 layout->addWidget( tabWidget ); 57 layout->addWidget( tabWidget );
57 58
58 // Information tab 59 // Information tab
59 QWhatsThis::add( &m_information, tr( "This area contains information about the package." ) ); 60 QWhatsThis::add( &m_information, tr( "This area contains information about the package." ) );
60 m_information.reparent( tabWidget, QPoint( 0, 0 ) ); 61 m_information.reparent( tabWidget, QPoint( 0, 0 ) );
61 m_information.setReadOnly( true ); 62 m_information.setReadOnly( true );
62 tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); 63 tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) );
63 64
64 // Retrive package information 65 // Retrive package information
65 m_package = m_packman->findPackage( package ); 66 m_package = m_packman->findPackage( package );
66 if ( !m_package ) 67 if ( !m_package )
67 { 68 {
68 m_information.setText( tr( "Unable to retrieve package information." ) ); 69 m_information.setText( tr( "Unable to retrieve package information." ) );
69 return; 70 return;
70 } 71 }
71 72
72 // Display package information 73 // Display package information
73 if ( !m_package->information().isNull() ) 74 if ( !m_package->information().isNull() )
74 m_information.setText( m_package->information() ); 75 m_information.setText( m_package->information() );
75 else 76 else
76 { 77 {
77 // Package information is not cached, retrieve it 78 // Package information is not cached, retrieve it
78 QStringList list( package ); 79 QStringList list( package );
79 m_packman->executeCommand( OPackage::Info, list, QString::null, 80 m_packman->executeCommand( OPackage::Info, list, QString::null,
80 this, SLOT(slotInfo(const QString &)), true ); 81 this, SLOT(slotInfo(const QString &)), true );
81 } 82 }
82 83
83 // Files tab (display only if package is installed) 84 // Files tab (display only if package is installed)
84 if ( !m_package->versionInstalled().isNull() ) 85 if ( !m_package->versionInstalled().isNull() )
85 { 86 {
86 QWidget *filesWidget = new QWidget( tabWidget ); 87 QWidget *filesWidget = new QWidget( tabWidget );
87 QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); 88 QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 );
88 QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) ); 89 QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) );
89 m_files.reparent( filesWidget, QPoint( 0, 0 ) ); 90 m_files.reparent( filesWidget, QPoint( 0, 0 ) );
90 m_files.setReadOnly( true ); 91 m_files.setReadOnly( true );
91 filesLayout->addWidget( &m_files ); 92 filesLayout->addWidget( &m_files );
92 93
93 // If file list is already cached, display 94 // If file list is already cached, display
94 if ( !m_package->files().isNull() ) 95 if ( !m_package->files().isNull() )
95 m_files.setText( m_package->files() ); 96 m_files.setText( m_package->files() );
96 else 97 else
97 { 98 {
98 m_retrieveFiles = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), 99 m_retrieveFiles = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ),
99 tr( "Retrieve file list" ), filesWidget ); 100 tr( "Retrieve file list" ), filesWidget );
100 QWhatsThis::add( m_retrieveFiles, tr( "Tap here to retrieve list of files contained in this package." ) ); 101 QWhatsThis::add( m_retrieveFiles, tr( "Tap here to retrieve list of files contained in this package." ) );
101 filesLayout->addWidget( m_retrieveFiles ); 102 filesLayout->addWidget( m_retrieveFiles );
102 connect( m_retrieveFiles, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); 103 connect( m_retrieveFiles, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) );
103 } 104 }
104 105
105 tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); 106 tabWidget->addTab( filesWidget, "binary", tr( "File list" ) );
106 tabWidget->setCurrentTab( tr( "Information" ) ); 107 tabWidget->setCurrentTab( tr( "Information" ) );
107 108
108 } 109 }
109 else 110 else
110 m_files.hide(); 111 m_files.hide();
111} 112}
112 113
113PackageInfoDlg::~PackageInfoDlg() 114PackageInfoDlg::~PackageInfoDlg()
114{ 115{
115 if ( !m_package ) 116 if ( !m_package )
116 return; 117 return;
117 118
118 // Cache package information 119 // Cache package information
119 if ( !m_information.text().isNull() ) 120 if ( !m_information.text().isNull() )
120 m_package->setInformation( m_information.text() ); 121 m_package->setInformation( m_information.text() );
121 122
122 // Cache package file list 123 // Cache package file list
123 if ( !m_files.text().isEmpty() ) 124 if ( !m_files.text().isEmpty() )
124 m_package->setFiles( m_files.text() ); 125 m_package->setFiles( m_files.text() );
125} 126}
126 127
127void PackageInfoDlg::slotBtnFileScan() 128void PackageInfoDlg::slotBtnFileScan()
128{ 129{
129 m_files.clear(); 130 m_files.clear();
130 131
131 QStringList list( m_package->name() ); 132 QStringList list( m_package->name() );
132 m_packman->executeCommand( OPackage::Files, list, QString::null, 133 m_packman->executeCommand( OPackage::Files, list, QString::null,
133 this, SLOT(slotFiles(const QString &)), true ); 134 this, SLOT(slotFiles(const QString &)), true );
134 135
135 if ( m_retrieveFiles ) 136 if ( m_retrieveFiles )
136 m_retrieveFiles->hide(); 137 m_retrieveFiles->hide();
137} 138}
138 139
139void PackageInfoDlg::slotInfo( const QString &info ) 140void PackageInfoDlg::slotInfo( const QString &info )
140{ 141{
141 m_information.append( info ); 142 m_information.append( info );
142} 143}
143 144
144void PackageInfoDlg::slotFiles( const QString &filelist ) 145void PackageInfoDlg::slotFiles( const QString &filelist )
145{ 146{
146 QString str = filelist; 147 QString str = filelist;
147 148
148 // Skip first line of output ("Package xxx is installed...") 149 // Skip first line of output ("Package xxx is installed...")
149 if ( str.startsWith( "Package " ) ) 150 if ( str.startsWith( "Package " ) )
150 str = str.right( str.length() - str.find( '\n' ) - 1 ); 151 str = str.right( str.length() - str.find( '\n' ) - 1 );
151 152
152 m_files.append( str ); 153 m_files.append( str );
153} 154}
diff --git a/noncore/settings/packagemanager/packageinfodlg.h b/noncore/settings/packagemanager/packageinfodlg.h
index 2962f9a..e4c6bba 100644
--- a/noncore/settings/packagemanager/packageinfodlg.h
+++ b/noncore/settings/packagemanager/packageinfodlg.h
@@ -1,66 +1,67 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#ifndef PACKAGEINFODLG_H 31#ifndef PACKAGEINFODLG_H
31#define PACKAGEINFODLG_H 32#define PACKAGEINFODLG_H
32 33
33#include "opackage.h" 34#include "opackage.h"
34 35
35#include <qmultilineedit.h> 36#include <qmultilineedit.h>
36#include <qwidget.h> 37#include <qwidget.h>
37 38
38class QPushButton; 39class QPushButton;
39 40
40class OPackage; 41class OPackage;
41class OPackageManager; 42class OPackageManager;
42 43
43class PackageInfoDlg : public QWidget 44class PackageInfoDlg : public QWidget
44{ 45{
45 Q_OBJECT 46 Q_OBJECT
46 47
47public: 48public:
48 PackageInfoDlg( QWidget *parent = 0l, OPackageManager *pm = 0l, const QString &package = QString::null ); 49 PackageInfoDlg( QWidget *parent = 0l, OPackageManager *pm = 0l, const QString &package = QString::null );
49 ~PackageInfoDlg(); 50 ~PackageInfoDlg();
50 51
51private: 52private:
52 OPackageManager *m_packman; // Pointer to application instance of package manager 53 OPackageManager *m_packman; // Pointer to application instance of package manager
53 OPackage *m_package; // Pointer to package to display information for 54 OPackage *m_package; // Pointer to package to display information for
54 55
55 // UI controls 56 // UI controls
56 QMultiLineEdit m_information; // Multi-line edit to display package information 57 QMultiLineEdit m_information; // Multi-line edit to display package information
57 QMultiLineEdit m_files; // Multi-line edit to display package file list 58 QMultiLineEdit m_files; // Multi-line edit to display package file list
58 QPushButton *m_retrieveFiles; // Push button to retrieve file list 59 QPushButton *m_retrieveFiles; // Push button to retrieve file list
59 60
60private slots: 61private slots:
61 void slotBtnFileScan(); 62 void slotBtnFileScan();
62 void slotInfo( const QString &info ); 63 void slotInfo( const QString &info );
63 void slotFiles( const QString &filelist ); 64 void slotFiles( const QString &filelist );
64}; 65};
65 66
66#endif 67#endif
diff --git a/noncore/settings/packagemanager/promptdlg.cpp b/noncore/settings/packagemanager/promptdlg.cpp
index 841b98e..5053caa 100644
--- a/noncore/settings/packagemanager/promptdlg.cpp
+++ b/noncore/settings/packagemanager/promptdlg.cpp
@@ -1,140 +1,141 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5             .=l. 5 =.
6           .>+-= 6 .=l.
7 _;:,     .>    :=|. This file is free software; you can 7           .>+-=
8.> <`_,   >  .   <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i,     .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12     ._= =}       : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13    .%`+i>       _;_. 13     ._= =}       : or (at your option) any later version.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16    : ..    .:,     . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.=       =       ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++=   -.     .`     .: 20..}^=.=       =       ; Library General Public License for more
21 :     =  ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22 -.   .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24    --        :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#include "promptdlg.h" 31#include "promptdlg.h"
31 32
32#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
33 34
34#include <qlabel.h> 35#include <qlabel.h>
35#include <qlayout.h> 36#include <qlayout.h>
36#include <qpushbutton.h> 37#include <qpushbutton.h>
37#include <qwidgetlist.h> 38#include <qwidgetlist.h>
38 39
39PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2, 40PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
40 QWidget *parent ) 41 QWidget *parent )
41 : QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog ) 42 : QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog )
42 , m_btnClicked( -1 ) 43 , m_btnClicked( -1 )
43{ 44{
44 setCaption( caption ); 45 setCaption( caption );
45 46
46 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 ); 47 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 );
47 QLabel *label = new QLabel( text, this ); 48 QLabel *label = new QLabel( text, this );
48 label->setAlignment( AlignCenter | WordBreak ); 49 label->setAlignment( AlignCenter | WordBreak );
49 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 50 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
50 51
51 QPushButton *btn = new QPushButton( btn1, this ); 52 QPushButton *btn = new QPushButton( btn1, this );
52 layout->addWidget( btn, 1, 0 ); 53 layout->addWidget( btn, 1, 0 );
53 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) ); 54 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) );
54 55
55 btn = new QPushButton( btn2, this ); 56 btn = new QPushButton( btn2, this );
56 layout->addWidget( btn, 1, 1 ); 57 layout->addWidget( btn, 1, 1 );
57 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) ); 58 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) );
58} 59}
59 60
60int PromptDlg::display() 61int PromptDlg::display()
61{ 62{
62 // Determine position of dialog. Derived from QT's QDialog::show() method. 63 // Determine position of dialog. Derived from QT's QDialog::show() method.
63 QWidget *w = parentWidget(); 64 QWidget *w = parentWidget();
64 QPoint p( 0, 0 ); 65 QPoint p( 0, 0 );
65 int extraw = 0, extrah = 0; 66 int extraw = 0, extrah = 0;
66 QWidget * desk = QApplication::desktop(); 67 QWidget * desk = QApplication::desktop();
67 if ( w ) 68 if ( w )
68 w = w->topLevelWidget(); 69 w = w->topLevelWidget();
69 70
70 QWidgetList *list = QApplication::topLevelWidgets(); 71 QWidgetList *list = QApplication::topLevelWidgets();
71 QWidgetListIt it( *list ); 72 QWidgetListIt it( *list );
72 while ( (extraw == 0 || extrah == 0) && it.current() != 0 ) 73 while ( (extraw == 0 || extrah == 0) && it.current() != 0 )
73 { 74 {
74 int w, h; 75 int w, h;
75 QWidget * current = it.current(); 76 QWidget * current = it.current();
76 ++it; 77 ++it;
77 w = current->geometry().x() - current->x(); 78 w = current->geometry().x() - current->x();
78 h = current->geometry().y() - current->y(); 79 h = current->geometry().y() - current->y();
79 80
80 extraw = QMAX( extraw, w ); 81 extraw = QMAX( extraw, w );
81 extrah = QMAX( extrah, h ); 82 extrah = QMAX( extrah, h );
82 } 83 }
83 delete list; 84 delete list;
84 85
85 // sanity check for decoration frames. With embedding, we 86 // sanity check for decoration frames. With embedding, we
86 // might get extraordinary values 87 // might get extraordinary values
87 if ( extraw >= 10 || extrah >= 40 ) 88 if ( extraw >= 10 || extrah >= 40 )
88 extraw = extrah = 0; 89 extraw = extrah = 0;
89 90
90 if ( w ) 91 if ( w )
91 { 92 {
92 // Use mapToGlobal rather than geometry() in case w might 93 // Use mapToGlobal rather than geometry() in case w might
93 // be embedded in another application 94 // be embedded in another application
94 QPoint pp = w->mapToGlobal( QPoint(0,0) ); 95 QPoint pp = w->mapToGlobal( QPoint(0,0) );
95 p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 ); 96 p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 );
96 } 97 }
97 else 98 else
98 p = QPoint( desk->width()/2, desk->height()/2 ); 99 p = QPoint( desk->width()/2, desk->height()/2 );
99 100
100 p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah ); 101 p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah );
101 102
102 if ( p.x() + extraw + width() > desk->width() ) 103 if ( p.x() + extraw + width() > desk->width() )
103 p.setX( desk->width() - width() - extraw ); 104 p.setX( desk->width() - width() - extraw );
104 if ( p.x() < 0 ) 105 if ( p.x() < 0 )
105 p.setX( 0 ); 106 p.setX( 0 );
106 107
107 if ( p.y() + extrah + height() > desk->height() ) 108 if ( p.y() + extrah + height() > desk->height() )
108 p.setY( desk->height() - height() - extrah ); 109 p.setY( desk->height() - height() - extrah );
109 if ( p.y() < 0 ) 110 if ( p.y() < 0 )
110 p.setY( 0 ); 111 p.setY( 0 );
111 112
112 move( p ); 113 move( p );
113 show(); 114 show();
114 115
115 // Enter event loop for modality 116 // Enter event loop for modality
116 qApp->enter_loop(); 117 qApp->enter_loop();
117 118
118 return m_btnClicked; 119 return m_btnClicked;
119} 120}
120 121
121int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2, 122int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
122 QWidget *parent ) 123 QWidget *parent )
123{ 124{
124 PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent ); 125 PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent );
125 int rc = dlg->display(); 126 int rc = dlg->display();
126 delete dlg; 127 delete dlg;
127 return rc; 128 return rc;
128} 129}
129 130
130void PromptDlg::slotBtn1Clicked() 131void PromptDlg::slotBtn1Clicked()
131{ 132{
132 m_btnClicked = 1; 133 m_btnClicked = 1;
133 qApp->exit_loop(); 134 qApp->exit_loop();
134} 135}
135 136
136void PromptDlg::slotBtn2Clicked() 137void PromptDlg::slotBtn2Clicked()
137{ 138{
138 m_btnClicked = 2; 139 m_btnClicked = 2;
139 qApp->exit_loop(); 140 qApp->exit_loop();
140} 141}
diff --git a/noncore/settings/packagemanager/promptdlg.h b/noncore/settings/packagemanager/promptdlg.h
index f7bc0c0..9f870fa 100644
--- a/noncore/settings/packagemanager/promptdlg.h
+++ b/noncore/settings/packagemanager/promptdlg.h
@@ -1,59 +1,60 @@
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)2004, 2005 Dan Williams <drw@handhelds.org>
5 .=l. 5 =.
6 .>+-= 6 .=l.
7_;:, .> :=|. This file is free software; you can 7           .>+-=
8.> <`_, > . <= redistribute it and/or modify it under 8 _;:,     .>    :=|. This program is free software; you can
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9.> <`_,   >  .   <= redistribute it and/or modify it under
10.="- .-=="i, .._ License as published by the Free Software 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11- . .-<_> .<> Foundation; either version 2 of the License, 11.="- .-=="i,     .._ License as published by the Free Software
12 ._= =} : or (at your option) any later version. 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13 .%`+i> _;_. 13     ._= =}       : or (at your option) any later version.
14 .i_,=:_. -<s. This file is distributed in the hope that 14    .%`+i>       _;_.
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15    .i_,=:_.      -<s. This program is distributed in the hope that
16 : .. .:, . . . without even the implied warranty of 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 : ..    .:,     . . . without even the implied warranty of
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19..}^=.= = ; Public License for more details. 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20++= -. .` .: 20..}^=.=       =       ; Library General Public License for more
21: = ...= . :.=- You should have received a copy of the GNU 21++=   -.     .`     .: details.
22-. .:....=;==+<; General Public License along with this file; 22:     =  ...= . :.=-
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -.   .:....=;==+<; You should have received a copy of the GNU
24 -- :-=` Free Software Foundation, Inc., 24  -_. . .   )=.  = Library General Public License along with
25 59 Temple Place - Suite 330, 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
27
28*/ 29*/
29 30
30#ifndef PROMPTDLG_H 31#ifndef PROMPTDLG_H
31#define PROMPTDLG_H 32#define PROMPTDLG_H
32 33
33#include <qwidget.h> 34#include <qwidget.h>
34 35
35class PromptDlg : public QWidget 36class PromptDlg : public QWidget
36{ 37{
37 Q_OBJECT 38 Q_OBJECT
38 39
39public: 40public:
40 PromptDlg( const QString &caption = QString::null, const QString &text = QString::null, 41 PromptDlg( const QString &caption = QString::null, const QString &text = QString::null,
41 const QString &btn1 = QString::null, const QString &btn2 = QString::null, 42 const QString &btn1 = QString::null, const QString &btn2 = QString::null,
42 QWidget *parent = 0x0 ); 43 QWidget *parent = 0x0 );
43 44
44 int display(); 45 int display();
45 int btnPressed() { return m_btnClicked; } 46 int btnPressed() { return m_btnClicked; }
46 47
47 static int ask( const QString &caption = QString::null, const QString &text = QString::null, 48 static int ask( const QString &caption = QString::null, const QString &text = QString::null,
48 const QString &btn1 = QString::null, const QString &btn2 = QString::null, 49 const QString &btn1 = QString::null, const QString &btn2 = QString::null,
49 QWidget *parent = 0x0 ); 50 QWidget *parent = 0x0 );
50 51
51private: 52private:
52 int m_btnClicked; // Indicator for which button was pressed 53 int m_btnClicked; // Indicator for which button was pressed
53 54
54private slots: 55private slots:
55 void slotBtn1Clicked(); 56 void slotBtn1Clicked();
56 void slotBtn2Clicked(); 57 void slotBtn2Clicked();
57}; 58};
58 59
59#endif 60#endif