summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp74
-rw-r--r--noncore/settings/packagemanager/entrydlg.h45
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp8
-rw-r--r--noncore/settings/packagemanager/oipkgconfigdlg.cpp10
4 files changed, 85 insertions, 52 deletions
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
index fd275e1..3b794b4 100644
--- a/noncore/settings/packagemanager/entrydlg.cpp
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -1,85 +1,107 @@
1/* 1/*
2                This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++=   -.     .`     .: 20++= -. .` .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "entrydlg.h" 30#include "entrydlg.h"
31 31
32#include <opie2/ofiledialog.h>
33
32#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h>
33 36
34#include <qlabel.h> 37#include <qlabel.h>
35#include <qlayout.h> 38#include <qlayout.h>
36#include <qlineedit.h> 39#include <qlineedit.h>
37#include <qpushbutton.h> 40#include <qpushbutton.h>
38 41
39EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) 42EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
40 : QDialog( parent, name, modal ) 43 : QDialog( parent, name, modal )
41{ 44{
42 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); 45 QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 );
43 46
44 QLabel *l = new QLabel( label, this ); 47 QLabel *l = new QLabel( label, this );
45 l->setAlignment( AlignLeft | AlignTop | WordBreak ); 48 l->setAlignment( AlignLeft | AlignTop | WordBreak );
46 vbox->addWidget( l ); 49 layout->addMultiCellWidget( l, 0, 0, 0, 1 );
47 50
48 m_entry = new QLineEdit( this ); 51 m_entry = new QLineEdit( this );
49 vbox->addWidget( m_entry ); 52 layout->addWidget( m_entry, 1, 0 );
53 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) );
54
55 QPixmap pic;
56 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
57 QPushButton *btn = new QPushButton( pic, QString::null, this );
58 btn->setMaximumWidth( btn->height() );
59 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) );
60 layout->addWidget( btn, 1, 1 );
61
62 layout->setRowStretch( 2, 10 );
50 63
51 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) ); 64 resize( width(), l->height() + btn->height() + 8 );
52} 65}
53 66
54void EntryDlg::setText( const QString &text ) 67void EntryDlg::setText( const QString &text )
55{ 68{
56 m_entry->setText( text ); 69 m_entry->setText( text );
57 m_entry->selectAll(); 70 m_entry->selectAll();
58} 71}
59 72
60QString EntryDlg::getText() 73QString EntryDlg::getText()
61{ 74{
62 return m_entry->text(); 75 return m_entry->text();
63} 76}
64 77
65QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok, 78QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
66 QWidget *parent, const char *name ) 79 QWidget *parent, const char *name )
67{ 80{
68 EntryDlg *dlg = new EntryDlg( label, parent, name, true ); 81 EntryDlg *dlg = new EntryDlg( label, parent, name, true );
69 dlg->setCaption( caption ); 82 dlg->setCaption( caption );
70 dlg->setText( text ); 83 dlg->setText( text );
71 84
72 QString result; 85 QString result;
73 86
74 *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted ); 87 *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted );
75 if ( *ok ) 88 if ( *ok )
76 result = dlg->getText(); 89 result = dlg->getText();
77 90
78 delete dlg; 91 delete dlg;
79 return result; 92 return result;
80} 93}
81void EntryDlg::tryAccept() 94void EntryDlg::slotTryAccept()
82{ 95{
83 if ( !m_entry->text().isEmpty() ) 96 if ( !m_entry->text().isEmpty() )
84 accept(); 97 accept();
85} 98}
99
100void EntryDlg::slotSelectPath()
101{
102 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() );
103 if ( path.at( path.length() - 1 ) == '/' )
104 path.truncate( path.length() - 1 );
105 if ( !path.isNull() )
106 m_entry->setText( path );
107}
diff --git a/noncore/settings/packagemanager/entrydlg.h b/noncore/settings/packagemanager/entrydlg.h
index 33a7920..012589b 100644
--- a/noncore/settings/packagemanager/entrydlg.h
+++ b/noncore/settings/packagemanager/entrydlg.h
@@ -1,57 +1,58 @@
1/* 1/*
2                This file is part of the OPIE Project 2 This file is part of the OPIE Project
3 3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org> 4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l. 5 .=l.
6           .>+-= 6 .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13    .%`+i>       _;_. 13 .%`+i> _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++=   -.     .`     .: 20++= -. .` .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#ifndef ENTRYDLG_H 30#ifndef ENTRYDLG_H
31#define ENTRYDLG_H 31#define ENTRYDLG_H
32 32
33#include <qdialog.h> 33#include <qdialog.h>
34 34
35class QLineEdit; 35class QLineEdit;
36 36
37class EntryDlg : public QDialog 37class EntryDlg : public QDialog
38{ 38{
39 Q_OBJECT 39 Q_OBJECT
40 40
41public: 41public:
42 static QString getText( const QString &caption, const QString &label, const QString &text = QString::null, 42 static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
43 bool *ok = 0, QWidget *parent = 0, const char *name = 0 ); 43 bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
44 44
45 EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true ); 45 EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true );
46 46
47 void setText( const QString &text ); 47 void setText( const QString &text );
48 QString getText(); 48 QString getText();
49 49
50private slots: 50private slots:
51 void tryAccept(); 51 void slotTryAccept();
52 void slotSelectPath();
52 53
53private: 54private:
54 QLineEdit *m_entry; 55 QLineEdit *m_entry;
55}; 56};
56 57
57#endif // EntryDlg_H 58#endif // EntryDlg_H
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 36851b0..8aed10d 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -7,315 +7,317 @@
7_;:, .> :=|. This file is free software; you can 7_;:, .> :=|. This file is free software; you can
8.> <`_, > . <= redistribute it and/or modify it under 8.> <`_, > . <= redistribute it and/or modify it under
9:`=1 )Y*s>-.-- : the terms of the GNU General Public 9:`=1 )Y*s>-.-- : the terms of the GNU General Public
10.="- .-=="i, .._ License as published by the Free Software 10.="- .-=="i, .._ License as published by the Free Software
11- . .-<_> .<> Foundation; either version 2 of the License, 11- . .-<_> .<> Foundation; either version 2 of the License,
12 ._= =} : or (at your option) any later version. 12 ._= =} : or (at your option) any later version.
13 .%`+i> _;_. 13 .%`+i> _;_.
14 .i_,=:_. -<s. This file is distributed in the hope that 14 .i_,=:_. -<s. This file is distributed in the hope that
15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 15 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
16 : .. .:, . . . without even the implied warranty of 16 : .. .:, . . . without even the implied warranty of
17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 17 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 18 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.= = ; Public License for more details. 19..}^=.= = ; Public License for more details.
20++= -. .` .: 20++= -. .` .:
21: = ...= . :.=- You should have received a copy of the GNU 21: = ...= . :.=- You should have received a copy of the GNU
22-. .:....=;==+<; General Public License along with this file; 22-. .:....=;==+<; General Public License along with this file;
23 -_. . . )=. = see the file COPYING. If not, write to the 23 -_. . . )=. = see the file COPYING. If not, write to the
24 -- :-=` Free Software Foundation, Inc., 24 -- :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#include "installdlg.h" 30#include "installdlg.h"
31 31
32#include <opie2/ofiledialog.h> 32#include <opie2/ofiledialog.h>
33 33
34#include <qpe/fileselector.h> 34#include <qpe/fileselector.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/storage.h> 36#include <qpe/storage.h>
37 37
38#include <qapplication.h> 38#include <qapplication.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qfileinfo.h> 40#include <qfileinfo.h>
41#include <qgroupbox.h> 41#include <qgroupbox.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qlayout.h> 43#include <qlayout.h>
44#include <qmap.h> 44#include <qmap.h>
45#include <qmultilineedit.h> 45#include <qmultilineedit.h>
46#include <qpushbutton.h> 46#include <qpushbutton.h>
47 47
48#include <sys/vfs.h> 48#include <sys/vfs.h>
49 49
50#include "opackagemanager.h" 50#include "opackagemanager.h"
51 51
52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, 52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption,
53 OPackage::Command command1, const QStringList &packages1, 53 OPackage::Command command1, const QStringList &packages1,
54 OPackage::Command command2, const QStringList &packages2, 54 OPackage::Command command2, const QStringList &packages2,
55 OPackage::Command command3, const QStringList &packages3 ) 55 OPackage::Command command3, const QStringList &packages3 )
56 : QWidget( 0l ) 56 : QWidget( 0l )
57 , m_packman( pm ) 57 , m_packman( pm )
58 , m_installFound( false ) 58 , m_installFound( false )
59 , m_numCommands( 0 ) 59 , m_numCommands( 0 )
60 , m_currCommand( 0 ) 60 , m_currCommand( 0 )
61 , m_destItem( 0l ) 61 , m_destItem( 0l )
62{ 62{
63 // Save command/package list information 63 // Save command/package list information
64 if ( command1 != OPackage::NotDefined ) 64 if ( command1 != OPackage::NotDefined )
65 { 65 {
66 m_command[ m_numCommands ] = command1; 66 m_command[ m_numCommands ] = command1;
67 m_packages[ m_numCommands ] = packages1; 67 m_packages[ m_numCommands ] = packages1;
68 ++m_numCommands; 68 ++m_numCommands;
69 69
70 if ( command1 == OPackage::Install ) 70 if ( command1 == OPackage::Install )
71 m_installFound = true; 71 m_installFound = true;
72 } 72 }
73 if ( command2 != OPackage::NotDefined ) 73 if ( command2 != OPackage::NotDefined )
74 { 74 {
75 m_command[ m_numCommands ] = command2; 75 m_command[ m_numCommands ] = command2;
76 m_packages[ m_numCommands ] = packages2; 76 m_packages[ m_numCommands ] = packages2;
77 ++m_numCommands; 77 ++m_numCommands;
78 78
79 if ( command2 == OPackage::Install ) 79 if ( command2 == OPackage::Install )
80 m_installFound = true; 80 m_installFound = true;
81 } 81 }
82 if ( command3 != OPackage::NotDefined ) 82 if ( command3 != OPackage::NotDefined )
83 { 83 {
84 m_command[ m_numCommands ] = command3; 84 m_command[ m_numCommands ] = command3;
85 m_packages[ m_numCommands ] = packages3; 85 m_packages[ m_numCommands ] = packages3;
86 ++m_numCommands; 86 ++m_numCommands;
87 87
88 if ( command3 == OPackage::Install ) 88 if ( command3 == OPackage::Install )
89 m_installFound = true; 89 m_installFound = true;
90 } 90 }
91 91
92 // Initialize UI 92 // Initialize UI
93 if ( parent ) 93 if ( parent )
94 parent->setCaption( caption ); 94 parent->setCaption( caption );
95 95
96 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); 96 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 );
97 97
98 if ( m_installFound ) 98 if ( m_installFound )
99 { 99 {
100 QLabel *label = new QLabel( tr( "Destination" ), this ); 100 QLabel *label = new QLabel( tr( "Destination" ), this );
101 layout->addWidget( label, 0, 0 ); 101 layout->addWidget( label, 0, 0 );
102 m_destination = new QComboBox( this ); 102 m_destination = new QComboBox( this );
103 m_destination->insertStringList( m_packman->destinations() ); 103 m_destination->insertStringList( m_packman->destinations() );
104 layout->addWidget( m_destination, 0, 1 ); 104 layout->addWidget( m_destination, 0, 1 );
105 connect( m_destination, SIGNAL(highlighted(const QString&)), 105 connect( m_destination, SIGNAL(highlighted(const QString&)),
106 this, SLOT(slotDisplayAvailSpace(const QString&)) ); 106 this, SLOT(slotDisplayAvailSpace(const QString&)) );
107 107
108 label = new QLabel( tr( "Space Avail" ), this ); 108 label = new QLabel( tr( "Space Avail" ), this );
109 layout->addWidget( label, 1, 0 ); 109 layout->addWidget( label, 1, 0 );
110 m_availSpace = new QLabel( this ); 110 m_availSpace = new QLabel( this );
111 layout->addWidget( m_availSpace, 1, 1 ); 111 layout->addWidget( m_availSpace, 1, 1 );
112 112
113 // TODO - select correct destination 113 // TODO - select correct destination
114 slotDisplayAvailSpace( m_destination->currentText() ); 114 slotDisplayAvailSpace( m_destination->currentText() );
115 } 115 }
116 else 116 else
117 { 117 {
118 m_destination = 0l; 118 m_destination = 0l;
119 m_availSpace = 0l; 119 m_availSpace = 0l;
120 } 120 }
121 121
122 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 122 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
123 groupBox->layout()->setSpacing( 0 ); 123 groupBox->layout()->setSpacing( 0 );
124 groupBox->layout()->setMargin( 4 ); 124 groupBox->layout()->setMargin( 4 );
125 125
126 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); 126 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() );
127 m_output = new QMultiLineEdit( groupBox ); 127 m_output = new QMultiLineEdit( groupBox );
128 m_output->setReadOnly( true ); 128 m_output->setReadOnly( true );
129 groupBoxLayout->addWidget( m_output ); 129 groupBoxLayout->addWidget( m_output );
130 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); 130 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 );
131 131
132 QPixmap pic; 132 QPixmap pic;
133 pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 133 pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
134 m_btnStart = new QPushButton( pic, tr( "Start" ), this ); 134 m_btnStart = new QPushButton( pic, tr( "Start" ), this );
135 m_btnStart->setMinimumHeight( AppLnk::smallIconSize() );
135 layout->addWidget( m_btnStart, 3, 0 ); 136 layout->addWidget( m_btnStart, 3, 0 );
136 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); 137 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) );
137 138
138 pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 139 pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
139 m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); 140 m_btnOptions = new QPushButton( pic, tr( "Options" ), this );
141 m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() );
140 layout->addWidget( m_btnOptions, 3, 1 ); 142 layout->addWidget( m_btnOptions, 3, 1 );
141 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); 143 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) );
142 144
143 // Display packages being acted upon in output widget 145 // Display packages being acted upon in output widget
144 for( int i = 0; i < m_numCommands; i++ ) 146 for( int i = 0; i < m_numCommands; i++ )
145 { 147 {
146 if ( !m_packages[ i ].isEmpty() ) 148 if ( !m_packages[ i ].isEmpty() )
147 { 149 {
148 QString lineStr = tr( "Packages to " ); 150 QString lineStr = tr( "Packages to " );
149 151
150 switch( m_command[ i ] ) 152 switch( m_command[ i ] )
151 { 153 {
152 case OPackage::Install : lineStr.append( tr( "install" ) ); 154 case OPackage::Install : lineStr.append( tr( "install" ) );
153 break; 155 break;
154 case OPackage::Remove : lineStr.append( tr( "remove" ) ); 156 case OPackage::Remove : lineStr.append( tr( "remove" ) );
155 break; 157 break;
156 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); 158 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
157 break; 159 break;
158 case OPackage::Download : lineStr.append( tr( "download" ) ); 160 case OPackage::Download : lineStr.append( tr( "download" ) );
159 break; 161 break;
160 default : 162 default :
161 break; 163 break;
162 }; 164 };
163 lineStr.append( ":\n" ); 165 lineStr.append( ":\n" );
164 166
165 QStringList tmpPackage = m_packages[ i ]; 167 QStringList tmpPackage = m_packages[ i ];
166 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) 168 for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it )
167 { 169 {
168 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 170 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
169 } 171 }
170 172
171 m_output->append( lineStr ); 173 m_output->append( lineStr );
172 } 174 }
173 } 175 }
174 176
175 m_output->append( tr( "Press the start button to begin.\n" ) ); 177 m_output->append( tr( "Press the start button to begin.\n" ) );
176 m_output->setCursorPosition( m_output->numLines(), 0 ); 178 m_output->setCursorPosition( m_output->numLines(), 0 );
177 179
178} 180}
179 181
180void InstallDlg::slotDisplayAvailSpace( const QString &destination ) 182void InstallDlg::slotDisplayAvailSpace( const QString &destination )
181{ 183{
182 // If available space is not displayed, exit 184 // If available space is not displayed, exit
183 if ( !m_availSpace ) 185 if ( !m_availSpace )
184 return; 186 return;
185 187
186 QString space = tr( "Unknown" ); 188 QString space = tr( "Unknown" );
187 189
188 // Get destination 190 // Get destination
189 if ( !destination.isNull() ) 191 if ( !destination.isNull() )
190 m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); 192 m_destItem = m_packman->findConfItem( OConfItem::Destination, destination );
191 193
192 if ( m_destItem ) 194 if ( m_destItem )
193 { 195 {
194 // Calculate available space 196 // Calculate available space
195 struct statfs fs; 197 struct statfs fs;
196 if ( !statfs( m_destItem->value(), &fs ) ) 198 if ( !statfs( m_destItem->value(), &fs ) )
197 { 199 {
198 long mult = fs.f_bsize / 1024; 200 long mult = fs.f_bsize / 1024;
199 long div = 1024 / fs.f_bsize; 201 long div = 1024 / fs.f_bsize;
200 202
201 if ( !mult ) mult = 1; 203 if ( !mult ) mult = 1;
202 if ( !div ) div = 1; 204 if ( !div ) div = 1;
203 long avail = fs.f_bavail * mult / div; 205 long avail = fs.f_bavail * mult / div;
204 206
205 space = tr( "%1 Kb" ).arg( avail ); 207 space = tr( "%1 Kb" ).arg( avail );
206 } 208 }
207 } 209 }
208 210
209 // Display available space 211 // Display available space
210 m_availSpace->setText( space ); 212 m_availSpace->setText( space );
211} 213}
212 214
213void InstallDlg::slotBtnStart() 215void InstallDlg::slotBtnStart()
214{ 216{
215 QString btnText = m_btnStart->text(); 217 QString btnText = m_btnStart->text();
216 if ( btnText == tr( "Abort" ) ) 218 if ( btnText == tr( "Abort" ) )
217 { 219 {
218 // Prevent unexecuted commands from executing 220 // Prevent unexecuted commands from executing
219 m_currCommand = 999; 221 m_currCommand = 999;
220 222
221 // Allow user to close dialog 223 // Allow user to close dialog
222 m_btnStart->setText( tr( "Close" ) ); 224 m_btnStart->setText( tr( "Close" ) );
223 QPixmap pic; 225 QPixmap pic;
224 pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 226 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
225 m_btnStart->setIconSet( pic ); 227 m_btnStart->setIconSet( pic );
226 return; 228 return;
227 } 229 }
228 else if ( btnText == tr( "Close" ) ) 230 else if ( btnText == tr( "Close" ) )
229 { 231 {
230 // TODO - force reload of package data 232 // TODO - force reload of package data
231 emit closeInstallDlg(); 233 emit closeInstallDlg();
232 return; 234 return;
233 } 235 }
234 236
235 // Start was clicked, start executing 237 // Start was clicked, start executing
236 QString dest; 238 QString dest;
237 if ( m_installFound ) 239 if ( m_installFound )
238 { 240 {
239 dest = m_destination->currentText(); 241 dest = m_destination->currentText();
240 m_destination->setEnabled( false ); 242 m_destination->setEnabled( false );
241 } 243 }
242 244
243 m_btnOptions->setEnabled( false ); 245 m_btnOptions->setEnabled( false );
244 if ( m_numCommands > 1 ) 246 if ( m_numCommands > 1 )
245 { 247 {
246 m_btnStart->setText( tr( "Abort" ) ); 248 m_btnStart->setText( tr( "Abort" ) );
247 QPixmap pic; 249 QPixmap pic;
248 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 250 pic.convertFromImage( Resource::loadImage( "reset" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
249 m_btnStart->setIconSet( pic ); 251 m_btnStart->setIconSet( pic );
250 } 252 }
251 else 253 else
252 { 254 {
253 m_btnStart->setEnabled( false ); 255 m_btnStart->setEnabled( false );
254 } 256 }
255 257
256 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) 258 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
257 { 259 {
258 // Execute next command 260 // Execute next command
259 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, 261 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
260 this, SLOT(slotOutput(const QString &)), true ); 262 this, SLOT(slotOutput(const QString &)), true );
261 } 263 }
262 264
263 // All commands executed, allow user to close dialog 265 // All commands executed, allow user to close dialog
264 m_btnStart->setEnabled( true ); 266 m_btnStart->setEnabled( true );
265 m_btnStart->setText( tr( "Close" ) ); 267 m_btnStart->setText( tr( "Close" ) );
266 QPixmap pic; 268 QPixmap pic;
267 pic.convertFromImage( Resource::loadImage( "enter" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 269 pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
268 m_btnStart->setIconSet( pic ); 270 m_btnStart->setIconSet( pic );
269 271
270 m_btnOptions->setEnabled( true ); 272 m_btnOptions->setEnabled( true );
271 m_btnOptions->setText( tr( "Save output" ) ); 273 m_btnOptions->setText( tr( "Save output" ) );
272 pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 274 pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
273 m_btnOptions->setIconSet( pic ); 275 m_btnOptions->setIconSet( pic );
274} 276}
275 277
276void InstallDlg::slotBtnOptions() 278void InstallDlg::slotBtnOptions()
277{ 279{
278 QString btnText = m_btnOptions->text(); 280 QString btnText = m_btnOptions->text();
279 if ( btnText == tr( "Options" ) ) 281 if ( btnText == tr( "Options" ) )
280 { 282 {
281 // Display configuration dialog (only options tab is enabled) 283 // Display configuration dialog (only options tab is enabled)
282 m_packman->configureDlg( true ); 284 m_packman->configureDlg( true );
283 return; 285 return;
284 } 286 }
285 287
286 // Save output was clicked 288 // Save output was clicked
287 QMap<QString, QStringList> map; 289 QMap<QString, QStringList> map;
288 map.insert( tr( "All" ), QStringList() ); 290 map.insert( tr( "All" ), QStringList() );
289 QStringList text; 291 QStringList text;
290 text << "text/*"; 292 text << "text/*";
291 map.insert(tr( "Text" ), text ); 293 map.insert(tr( "Text" ), text );
292 text << "*"; 294 text << "*";
293 map.insert( tr( "All" ), text ); 295 map.insert( tr( "All" ), text );
294 296
295 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 297 QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
296 if( !filename.isEmpty() ) 298 if( !filename.isEmpty() )
297 { 299 {
298 QString currentFileName = QFileInfo( filename ).fileName(); 300 QString currentFileName = QFileInfo( filename ).fileName();
299 DocLnk doc; 301 DocLnk doc;
300 doc.setType( "text/plain" ); 302 doc.setType( "text/plain" );
301 doc.setFile( filename ); 303 doc.setFile( filename );
302 doc.setName( currentFileName ); 304 doc.setName( currentFileName );
303 FileManager fm; 305 FileManager fm;
304 fm.saveFile( doc, m_output->text() ); 306 fm.saveFile( doc, m_output->text() );
305 } 307 }
306} 308}
307 309
308void InstallDlg::slotOutput( const QString &msg ) 310void InstallDlg::slotOutput( const QString &msg )
309{ 311{
310 // Allow processing of other events 312 // Allow processing of other events
311 qApp->processEvents(); 313 qApp->processEvents();
312 314
313 QString lineStr = msg; 315 QString lineStr = msg;
314 if ( lineStr[lineStr.length()-1] == '\n' ) 316 if ( lineStr[lineStr.length()-1] == '\n' )
315 lineStr.truncate( lineStr.length() - 1 ); 317 lineStr.truncate( lineStr.length() - 1 );
316 m_output->append( lineStr ); 318 m_output->append( lineStr );
317 m_output->setCursorPosition( m_output->numLines(), 0 ); 319 m_output->setCursorPosition( m_output->numLines(), 0 );
318 320
319 // Update available space 321 // Update available space
320 slotDisplayAvailSpace( QString::null ); 322 slotDisplayAvailSpace( QString::null );
321} 323}
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
index 5f60990..d234251 100644
--- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp
+++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp
@@ -58,311 +58,317 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren
58{ 58{
59 setCaption( tr( "Configuration" ) ); 59 setCaption( tr( "Configuration" ) );
60 60
61 // Initialize configuration widgets 61 // Initialize configuration widgets
62 if ( !installOptions ) 62 if ( !installOptions )
63 { 63 {
64 initServerWidget(); 64 initServerWidget();
65 initDestinationWidget(); 65 initDestinationWidget();
66 initProxyWidget(); 66 initProxyWidget();
67 } 67 }
68 initOptionsWidget(); 68 initOptionsWidget();
69 69
70 // Load configuration information 70 // Load configuration information
71 initData(); 71 initData();
72 72
73 // Setup tabs for all info 73 // Setup tabs for all info
74 m_layout.addWidget( &m_tabWidget ); 74 m_layout.addWidget( &m_tabWidget );
75 if ( !m_installOptions ) 75 if ( !m_installOptions )
76 { 76 {
77 m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); 77 m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) );
78 m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); 78 m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) );
79 m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); 79 m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) );
80 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); 80 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
81 m_tabWidget.setCurrentTab( tr( "Servers" ) ); 81 m_tabWidget.setCurrentTab( tr( "Servers" ) );
82 } 82 }
83 else 83 else
84 { 84 {
85 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); 85 m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) );
86 } 86 }
87} 87}
88 88
89void OIpkgConfigDlg::accept() 89void OIpkgConfigDlg::accept()
90{ 90{
91 // Save server, destination and proxy configuration 91 // Save server, destination and proxy configuration
92 if ( !m_installOptions ) 92 if ( !m_installOptions )
93 { 93 {
94 // Update proxy information before saving settings 94 // Update proxy information before saving settings
95 OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); 95 OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" );
96 if ( confItem ) 96 if ( confItem )
97 { 97 {
98 confItem->setValue( m_proxyHttpServer->text() ); 98 confItem->setValue( m_proxyHttpServer->text() );
99 confItem->setActive( m_proxyHttpActive->isChecked() ); 99 confItem->setActive( m_proxyHttpActive->isChecked() );
100 } 100 }
101 else 101 else
102 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", 102 m_configs->append( new OConfItem( OConfItem::Option, "http_proxy",
103 m_proxyHttpServer->text(), QString::null, 103 m_proxyHttpServer->text(), QString::null,
104 m_proxyHttpActive->isChecked() ) ); 104 m_proxyHttpActive->isChecked() ) );
105 105
106 confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); 106 confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" );
107 if ( confItem ) 107 if ( confItem )
108 { 108 {
109 confItem->setValue( m_proxyFtpServer->text() ); 109 confItem->setValue( m_proxyFtpServer->text() );
110 confItem->setActive( m_proxyFtpActive->isChecked() ); 110 confItem->setActive( m_proxyFtpActive->isChecked() );
111 } 111 }
112 else 112 else
113 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", 113 m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy",
114 m_proxyFtpServer->text(), QString::null, 114 m_proxyFtpServer->text(), QString::null,
115 m_proxyFtpActive->isChecked() ) ); 115 m_proxyFtpActive->isChecked() ) );
116 116
117 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); 117 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" );
118 if ( confItem ) 118 if ( confItem )
119 confItem->setValue( m_proxyUsername->text() ); 119 confItem->setValue( m_proxyUsername->text() );
120 else 120 else
121 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", 121 m_configs->append( new OConfItem( OConfItem::Option, "proxy_username",
122 m_proxyUsername->text() ) ); 122 m_proxyUsername->text() ) );
123 123
124 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); 124 confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" );
125 if ( confItem ) 125 if ( confItem )
126 confItem->setValue( m_proxyPassword->text() ); 126 confItem->setValue( m_proxyPassword->text() );
127 else 127 else
128 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", 128 m_configs->append( new OConfItem( OConfItem::Option, "proxy_password",
129 m_proxyPassword->text() ) ); 129 m_proxyPassword->text() ) );
130 130
131 confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); 131 confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" );
132 if ( confItem ) 132 if ( confItem )
133 confItem->setValue( m_optSourceLists->text() ); 133 confItem->setValue( m_optSourceLists->text() );
134 else 134 else
135 m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", 135 m_configs->append( new OConfItem( OConfItem::Other, "lists_dir",
136 m_optSourceLists->text(), "name" ) ); 136 m_optSourceLists->text(), "name" ) );
137 137
138 m_ipkg->setConfigItems( m_configs ); 138 m_ipkg->setConfigItems( m_configs );
139 } 139 }
140 140
141 // Save options configuration 141 // Save options configuration
142 int options = 0; 142 int options = 0;
143 if ( m_optForceDepends->isChecked() ) 143 if ( m_optForceDepends->isChecked() )
144 options |= FORCE_DEPENDS; 144 options |= FORCE_DEPENDS;
145 if ( m_optForceReinstall->isChecked() ) 145 if ( m_optForceReinstall->isChecked() )
146 options |= FORCE_REINSTALL; 146 options |= FORCE_REINSTALL;
147 if ( m_optForceRemove->isChecked() ) 147 if ( m_optForceRemove->isChecked() )
148 options |= FORCE_REMOVE; 148 options |= FORCE_REMOVE;
149 if ( m_optForceOverwrite->isChecked() ) 149 if ( m_optForceOverwrite->isChecked() )
150 options |= FORCE_OVERWRITE; 150 options |= FORCE_OVERWRITE;
151 m_ipkg->setIpkgExecOptions( options ); 151 m_ipkg->setIpkgExecOptions( options );
152 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); 152 m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() );
153 153
154 QDialog::accept(); 154 QDialog::accept();
155} 155}
156 156
157void OIpkgConfigDlg::reject() 157void OIpkgConfigDlg::reject()
158{ 158{
159 if ( m_configs ) 159 if ( m_configs )
160 delete m_configs; 160 delete m_configs;
161} 161}
162 162
163void OIpkgConfigDlg::initServerWidget() 163void OIpkgConfigDlg::initServerWidget()
164{ 164{
165 m_serverWidget = new QWidget( this ); 165 m_serverWidget = new QWidget( this );
166 166
167 // Initialize UI 167 // Initialize UI
168 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); 168 QVBoxLayout *vb = new QVBoxLayout( m_serverWidget );
169 QScrollView *sv = new QScrollView( m_serverWidget ); 169 QScrollView *sv = new QScrollView( m_serverWidget );
170 vb->addWidget( sv, 0, 0 ); 170 vb->addWidget( sv, 0, 0 );
171 sv->setResizePolicy( QScrollView::AutoOneFit ); 171 sv->setResizePolicy( QScrollView::AutoOneFit );
172 sv->setFrameStyle( QFrame::NoFrame ); 172 sv->setFrameStyle( QFrame::NoFrame );
173 QWidget *container = new QWidget( sv->viewport() ); 173 QWidget *container = new QWidget( sv->viewport() );
174 sv->addChild( container ); 174 sv->addChild( container );
175 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); 175 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 );
176 176
177 m_serverList = new QListBox( container ); 177 m_serverList = new QListBox( container );
178 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." ) ); 178 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." ) );
179 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 179 m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
180 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); 180 connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) );
181 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); 181 layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 );
182 182
183 QPixmap pic; 183 QPixmap pic;
184 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 184 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
185 QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); 185 QPushButton *btn = new QPushButton( pic, tr( "New" ), container );
186 btn->setMinimumHeight( AppLnk::smallIconSize() );
186 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 187 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
187 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); 188 connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) );
188 layout->addWidget( btn, 1, 0 ); 189 layout->addWidget( btn, 1, 0 );
189 190
190 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 191 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
191 m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); 192 m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container );
193 m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() );
192 m_serverEditBtn->setEnabled( false ); 194 m_serverEditBtn->setEnabled( false );
193 QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); 195 QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) );
194 connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); 196 connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) );
195 layout->addWidget( m_serverEditBtn, 1, 1 ); 197 layout->addWidget( m_serverEditBtn, 1, 1 );
196 198
197 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 199 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
198 m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); 200 m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container );
201 m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() );
199 m_serverDeleteBtn->setEnabled( false ); 202 m_serverDeleteBtn->setEnabled( false );
200 QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); 203 QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) );
201 connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); 204 connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) );
202 layout->addWidget( m_serverDeleteBtn, 1, 2 ); 205 layout->addWidget( m_serverDeleteBtn, 1, 2 );
203} 206}
204 207
205void OIpkgConfigDlg::initDestinationWidget() 208void OIpkgConfigDlg::initDestinationWidget()
206{ 209{
207 m_destWidget = new QWidget( this ); 210 m_destWidget = new QWidget( this );
208 211
209 // Initialize UI 212 // Initialize UI
210 QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); 213 QVBoxLayout *vb = new QVBoxLayout( m_destWidget );
211 QScrollView *sv = new QScrollView( m_destWidget ); 214 QScrollView *sv = new QScrollView( m_destWidget );
212 vb->addWidget( sv, 0, 0 ); 215 vb->addWidget( sv, 0, 0 );
213 sv->setResizePolicy( QScrollView::AutoOneFit ); 216 sv->setResizePolicy( QScrollView::AutoOneFit );
214 sv->setFrameStyle( QFrame::NoFrame ); 217 sv->setFrameStyle( QFrame::NoFrame );
215 QWidget *container = new QWidget( sv->viewport() ); 218 QWidget *container = new QWidget( sv->viewport() );
216 sv->addChild( container ); 219 sv->addChild( container );
217 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); 220 QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 );
218 221
219 m_destList = new QListBox( container ); 222 m_destList = new QListBox( container );
220 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." ) ); 223 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." ) );
221 m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 224 m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
222 connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); 225 connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) );
223 layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); 226 layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 );
224 227
225 QPixmap pic; 228 QPixmap pic;
226 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 229 pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
227 QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); 230 QPushButton *btn = new QPushButton( pic, tr( "New" ), container );
231 btn->setMinimumHeight( AppLnk::smallIconSize() );
228 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); 232 QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) );
229 connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); 233 connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) );
230 layout->addWidget( btn, 1, 0 ); 234 layout->addWidget( btn, 1, 0 );
231 235
232 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 236 pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
233 m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container ); 237 m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container );
238 m_destEditBtn->setMinimumHeight( AppLnk::smallIconSize() );
234 m_destEditBtn->setEnabled( false ); 239 m_destEditBtn->setEnabled( false );
235 QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) ); 240 QWhatsThis::add( m_destEditBtn, tr( "Tap here to edit the entry selected above." ) );
236 connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); 241 connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) );
237 layout->addWidget( m_destEditBtn, 1, 1 ); 242 layout->addWidget( m_destEditBtn, 1, 1 );
238 243
239 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 244 pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
240 m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); 245 m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container );
246 m_destDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() );
241 m_destDeleteBtn->setEnabled( false ); 247 m_destDeleteBtn->setEnabled( false );
242 QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); 248 QWhatsThis::add( m_destDeleteBtn, tr( "Tap here to delete the entry selected above." ) );
243 connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); 249 connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) );
244 layout->addWidget( m_destDeleteBtn, 1, 2 ); 250 layout->addWidget( m_destDeleteBtn, 1, 2 );
245} 251}
246 252
247void OIpkgConfigDlg::initProxyWidget() 253void OIpkgConfigDlg::initProxyWidget()
248{ 254{
249 m_proxyWidget = new QWidget( this ); 255 m_proxyWidget = new QWidget( this );
250 256
251 // Initialize UI 257 // Initialize UI
252 QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); 258 QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget );
253 QScrollView *sv = new QScrollView( m_proxyWidget ); 259 QScrollView *sv = new QScrollView( m_proxyWidget );
254 vb->addWidget( sv, 0, 0 ); 260 vb->addWidget( sv, 0, 0 );
255 sv->setResizePolicy( QScrollView::AutoOneFit ); 261 sv->setResizePolicy( QScrollView::AutoOneFit );
256 sv->setFrameStyle( QFrame::NoFrame ); 262 sv->setFrameStyle( QFrame::NoFrame );
257 QWidget *container = new QWidget( sv->viewport() ); 263 QWidget *container = new QWidget( sv->viewport() );
258 sv->addChild( container ); 264 sv->addChild( container );
259 QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); 265 QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 );
260 266
261 // HTTP proxy server configuration 267 // HTTP proxy server configuration
262 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 268 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
263 grpbox->layout()->setSpacing( 2 ); 269 grpbox->layout()->setSpacing( 2 );
264 grpbox->layout()->setMargin( 4 ); 270 grpbox->layout()->setMargin( 4 );
265 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 271 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
266 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 272 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
267 m_proxyHttpServer = new QLineEdit( grpbox ); 273 m_proxyHttpServer = new QLineEdit( grpbox );
268 QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); 274 QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) );
269 grplayout->addWidget( m_proxyHttpServer ); 275 grplayout->addWidget( m_proxyHttpServer );
270 m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 276 m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox );
271 QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); 277 QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) );
272 grplayout->addWidget( m_proxyHttpActive ); 278 grplayout->addWidget( m_proxyHttpActive );
273 279
274 // FTP proxy server configuration 280 // FTP proxy server configuration
275 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 281 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
276 grpbox->layout()->setSpacing( 2 ); 282 grpbox->layout()->setSpacing( 2 );
277 grpbox->layout()->setMargin( 4 ); 283 grpbox->layout()->setMargin( 4 );
278 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 284 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
279 grplayout = new QVBoxLayout( grpbox->layout() ); 285 grplayout = new QVBoxLayout( grpbox->layout() );
280 m_proxyFtpServer = new QLineEdit( grpbox ); 286 m_proxyFtpServer = new QLineEdit( grpbox );
281 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); 287 QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) );
282 grplayout->addWidget( m_proxyFtpServer ); 288 grplayout->addWidget( m_proxyFtpServer );
283 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); 289 m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox );
284 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); 290 QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) );
285 grplayout->addWidget( m_proxyFtpActive ); 291 grplayout->addWidget( m_proxyFtpActive );
286 292
287 // Proxy server username and password configuration 293 // Proxy server username and password configuration
288 QLabel *label = new QLabel( tr( "Username:" ), container ); 294 QLabel *label = new QLabel( tr( "Username:" ), container );
289 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); 295 QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) );
290 layout->addWidget( label, 2, 0 ); 296 layout->addWidget( label, 2, 0 );
291 m_proxyUsername = new QLineEdit( container ); 297 m_proxyUsername = new QLineEdit( container );
292 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); 298 QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) );
293 layout->addWidget( m_proxyUsername, 2, 1 ); 299 layout->addWidget( m_proxyUsername, 2, 1 );
294 300
295 label = new QLabel( tr( "Password:" ), container ); 301 label = new QLabel( tr( "Password:" ), container );
296 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); 302 QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) );
297 layout->addWidget( label, 3, 0 ); 303 layout->addWidget( label, 3, 0 );
298 m_proxyPassword = new QLineEdit( container ); 304 m_proxyPassword = new QLineEdit( container );
299 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); 305 QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) );
300 layout->addWidget( m_proxyPassword, 3, 1 ); 306 layout->addWidget( m_proxyPassword, 3, 1 );
301} 307}
302 308
303void OIpkgConfigDlg::initOptionsWidget() 309void OIpkgConfigDlg::initOptionsWidget()
304{ 310{
305 m_optionsWidget = new QWidget( this ); 311 m_optionsWidget = new QWidget( this );
306 312
307 // Initialize UI 313 // Initialize UI
308 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); 314 QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget );
309 QScrollView *sv = new QScrollView( m_optionsWidget ); 315 QScrollView *sv = new QScrollView( m_optionsWidget );
310 vb->addWidget( sv, 0, 0 ); 316 vb->addWidget( sv, 0, 0 );
311 sv->setResizePolicy( QScrollView::AutoOneFit ); 317 sv->setResizePolicy( QScrollView::AutoOneFit );
312 sv->setFrameStyle( QFrame::NoFrame ); 318 sv->setFrameStyle( QFrame::NoFrame );
313 QWidget *container = new QWidget( sv->viewport() ); 319 QWidget *container = new QWidget( sv->viewport() );
314 sv->addChild( container ); 320 sv->addChild( container );
315 QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); 321 QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 );
316 322
317 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); 323 m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container );
318 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); 324 QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) );
319 layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); 325 layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 );
320 326
321 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); 327 m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container );
322 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); 328 QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) );
323 layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); 329 layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 );
324 330
325 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); 331 m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container );
326 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); 332 QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) );
327 layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); 333 layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 );
328 334
329 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); 335 m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container );
330 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); 336 QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) );
331 layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); 337 layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 );
332 338
333 QLabel *l = new QLabel( tr( "Information level:" ), container ); 339 QLabel *l = new QLabel( tr( "Information level:" ), container );
334 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); 340 QWhatsThis::add( l, tr( "Select information level for Ipkg." ) );
335 layout->addMultiCellWidget( l, 4, 4, 0, 1 ); 341 layout->addMultiCellWidget( l, 4, 4, 0, 1 );
336 342
337 m_optVerboseIpkg = new QComboBox( container ); 343 m_optVerboseIpkg = new QComboBox( container );
338 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); 344 QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) );
339 m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); 345 m_optVerboseIpkg->insertItem( tr( "Errors only" ) );
340 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); 346 m_optVerboseIpkg->insertItem( tr( "Normal messages" ) );
341 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); 347 m_optVerboseIpkg->insertItem( tr( "Informative messages" ) );
342 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); 348 m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) );
343 layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); 349 layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 );
344 350
345 l = new QLabel( tr( "Package source lists directory:" ), container ); 351 l = new QLabel( tr( "Package source lists directory:" ), container );
346 QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) ); 352 QWhatsThis::add( l, tr( "Enter the directory where package source feed information is stored." ) );
347 layout->addMultiCellWidget( l, 6, 6, 0, 1 ); 353 layout->addMultiCellWidget( l, 6, 6, 0, 1 );
348 354
349 m_optSourceLists = new QLineEdit( container ); 355 m_optSourceLists = new QLineEdit( container );
350 QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) ); 356 QWhatsThis::add( m_optSourceLists, tr( "Enter the directory where package source feed information is stored." ) );
351 layout->addWidget( m_optSourceLists, 7, 0 ); 357 layout->addWidget( m_optSourceLists, 7, 0 );
352 QPixmap pic; 358 QPixmap pic;
353 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); 359 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
354 QPushButton *btn = new QPushButton( pic, QString::null, container ); 360 QPushButton *btn = new QPushButton( pic, QString::null, container );
355 btn->setMaximumWidth( btn->height() ); 361 btn->setMaximumWidth( btn->height() );
356 QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); 362 QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) );
357 connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); 363 connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) );
358 layout->addWidget( btn, 7, 1 ); 364 layout->addWidget( btn, 7, 1 );
359 365
360 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); 366 layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
361} 367}
362 368
363void OIpkgConfigDlg::initData() 369void OIpkgConfigDlg::initData()
364{ 370{
365 // Read ipkg configuration (server/destination/proxy) information 371 // Read ipkg configuration (server/destination/proxy) information
366 if ( m_ipkg && !m_installOptions ) 372 if ( m_ipkg && !m_installOptions )
367 { 373 {
368 m_configs = m_ipkg->configItems(); 374 m_configs = m_ipkg->configItems();
@@ -529,164 +535,166 @@ void OIpkgConfigDlg::slotDestEdit()
529 QString origName = dest->name(); 535 QString origName = dest->name();
530 OIpkgDestDlg dlg( dest, this ); 536 OIpkgDestDlg dlg( dest, this );
531 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) 537 if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted )
532 { 538 {
533 // Check to see if name has changed, if so update the dest list 539 // Check to see if name has changed, if so update the dest list
534 if ( dest->name() != origName ) 540 if ( dest->name() != origName )
535 m_destList->changeItem( dest->name(), m_destCurrent ); 541 m_destList->changeItem( dest->name(), m_destCurrent );
536 } 542 }
537 } 543 }
538} 544}
539 545
540void OIpkgConfigDlg::slotDestDelete() 546void OIpkgConfigDlg::slotDestDelete()
541{ 547{
542 // Find selected destination in list 548 // Find selected destination in list
543 OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); 549 OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() );
544 550
545 // Delete destination 551 // Delete destination
546 if ( destination ) 552 if ( destination )
547 { 553 {
548 m_configs->removeRef( destination ); 554 m_configs->removeRef( destination );
549 m_destList->removeItem( m_destCurrent ); 555 m_destList->removeItem( m_destCurrent );
550 } 556 }
551} 557}
552 558
553void OIpkgConfigDlg::slotOptSelectSourceListsPath() 559void OIpkgConfigDlg::slotOptSelectSourceListsPath()
554{ 560{
555 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() ); 561 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() );
556 if ( path.at( path.length() - 1 ) == '/' ) 562 if ( path.at( path.length() - 1 ) == '/' )
557 path.truncate( path.length() - 1 ); 563 path.truncate( path.length() - 1 );
558 if ( !path.isNull() ) 564 if ( !path.isNull() )
559 m_optSourceLists->setText( path ); 565 m_optSourceLists->setText( path );
560} 566}
561 567
562OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) 568OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent )
563 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 569 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
564 , m_server( server ) 570 , m_server( server )
565{ 571{
566 setCaption( tr( "Edit Server" ) ); 572 setCaption( tr( "Edit Server" ) );
567 573
568 // Initialize UI 574 // Initialize UI
569 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); 575 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
570 576
571 m_active = new QCheckBox( tr( "Active" ), this ); 577 m_active = new QCheckBox( tr( "Active" ), this );
572 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); 578 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) );
573 layout->addWidget( m_active ); 579 layout->addWidget( m_active );
574 580
575 layout->addStretch(); 581 layout->addStretch();
576 582
577 QLabel *label = new QLabel( tr( "Name:" ), this ); 583 QLabel *label = new QLabel( tr( "Name:" ), this );
578 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); 584 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) );
579 layout->addWidget( label ); 585 layout->addWidget( label );
580 m_name = new QLineEdit( this ); 586 m_name = new QLineEdit( this );
581 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); 587 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) );
582 layout->addWidget( m_name ); 588 layout->addWidget( m_name );
583 589
584 layout->addStretch(); 590 layout->addStretch();
585 591
586 label = new QLabel( tr( "Address:" ), this ); 592 label = new QLabel( tr( "Address:" ), this );
587 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); 593 QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) );
588 layout->addWidget( label ); 594 layout->addWidget( label );
589 m_location = new QLineEdit( this ); 595 m_location = new QLineEdit( this );
590 QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); 596 QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) );
591 layout->addWidget( m_location ); 597 layout->addWidget( m_location );
592 598
593 layout->addStretch(); 599 layout->addStretch();
594 600
595 m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); 601 m_compressed = new QCheckBox( tr( "Compressed server feed" ), this );
596 QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); 602 QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) );
597 layout->addWidget( m_compressed ); 603 layout->addWidget( m_compressed );
598 604
599 // Populate initial information 605 // Populate initial information
600 if ( m_server ) 606 if ( m_server )
601 { 607 {
602 m_name->setText( m_server->name() ); 608 m_name->setText( m_server->name() );
603 m_location->setText( m_server->value() ); 609 m_location->setText( m_server->value() );
604 m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); 610 m_compressed->setChecked( m_server->features().contains( "Compressed" ) );
605 m_active->setChecked( m_server->active() ); 611 m_active->setChecked( m_server->active() );
606 } 612 }
607} 613}
608 614
609void OIpkgServerDlg::accept() 615void OIpkgServerDlg::accept()
610{ 616{
611 // Save information entered 617 // Save information entered
612 QString name = m_name->text(); 618 QString name = m_name->text();
613 name.replace( QRegExp( " " ), "_" ); 619 name.replace( QRegExp( " " ), "_" );
614 m_server->setName( name ); 620 m_server->setName( name );
615 m_server->setValue( m_location->text() ); 621 m_server->setValue( m_location->text() );
616 m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) 622 m_compressed->isChecked() ? m_server->setFeatures( "Compressed" )
617 : m_server->setFeatures( QString::null ); 623 : m_server->setFeatures( QString::null );
618 m_server->setActive( m_active->isChecked() ); 624 m_server->setActive( m_active->isChecked() );
619 625
620 QDialog::accept(); 626 QDialog::accept();
621} 627}
622 628
623OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) 629OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent )
624 : QDialog( parent, QString::null, true, WStyle_ContextHelp ) 630 : QDialog( parent, QString::null, true, WStyle_ContextHelp )
625 , m_dest( dest ) 631 , m_dest( dest )
626{ 632{
627 setCaption( tr( "Edit Destination" ) ); 633 setCaption( tr( "Edit Destination" ) );
628 634
629 // Initialize UI 635 // Initialize UI
630 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); 636 QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 );
631 637
632 m_active = new QCheckBox( tr( "Active" ), this ); 638 m_active = new QCheckBox( tr( "Active" ), this );
633 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); 639 QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) );
634 layout->addWidget( m_active ); 640 layout->addWidget( m_active );
635 641
636 layout->addStretch(); 642 layout->addStretch();
637 643
638 QLabel *label = new QLabel( tr( "Name:" ), this ); 644 QLabel *label = new QLabel( tr( "Name:" ), this );
639 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); 645 QWhatsThis::add( label, tr( "Enter the name of this entry here." ) );
640 layout->addWidget( label ); 646 layout->addWidget( label );
641 m_name = new QLineEdit( this ); 647 m_name = new QLineEdit( this );
642 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); 648 QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) );
643 layout->addWidget( m_name ); 649 layout->addWidget( m_name );
644 650
645 layout->addStretch(); 651 layout->addStretch();
646 652
647 label = new QLabel( tr( "Location:" ), this ); 653 label = new QLabel( tr( "Location:" ), this );
648 QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); 654 QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) );
649 layout->addWidget( label ); 655 layout->addWidget( label );
650 656
651 QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); 657 QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 );
652 layout->addLayout( layout2 ); 658 layout->addLayout( layout2 );
653 659
654 m_location = new QLineEdit( this ); 660 m_location = new QLineEdit( this );
655 QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); 661 QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) );
656 layout2->addWidget( m_location ); 662 layout2->addWidget( m_location );
657 QPushButton *btn = new QPushButton( Resource::loadPixmap( "folder" ), QString::null, this ); 663 QPixmap pic;
664 pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) );
665 QPushButton *btn = new QPushButton( pic, QString::null, this );
658 btn->setMaximumWidth( btn->height() ); 666 btn->setMaximumWidth( btn->height() );
659 QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); 667 QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) );
660 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); 668 connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) );
661 layout2->addWidget( btn ); 669 layout2->addWidget( btn );
662 670
663 // Populate initial information 671 // Populate initial information
664 if ( m_dest ) 672 if ( m_dest )
665 { 673 {
666 m_name->setText( m_dest->name() ); 674 m_name->setText( m_dest->name() );
667 m_location->setText( m_dest->value() ); 675 m_location->setText( m_dest->value() );
668 m_active->setChecked( m_dest->active() ); 676 m_active->setChecked( m_dest->active() );
669 } 677 }
670} 678}
671 679
672void OIpkgDestDlg::accept() 680void OIpkgDestDlg::accept()
673{ 681{
674 // Save information entered 682 // Save information entered
675 QString name = m_name->text(); 683 QString name = m_name->text();
676 name.replace( QRegExp( " " ), "_" ); 684 name.replace( QRegExp( " " ), "_" );
677 m_dest->setName( name ); 685 m_dest->setName( name );
678 m_dest->setValue( m_location->text() ); 686 m_dest->setValue( m_location->text() );
679 m_dest->setActive( m_active->isChecked() ); 687 m_dest->setActive( m_active->isChecked() );
680 688
681 QDialog::accept(); 689 QDialog::accept();
682} 690}
683 691
684void OIpkgDestDlg::slotSelectPath() 692void OIpkgDestDlg::slotSelectPath()
685{ 693{
686 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); 694 QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() );
687 if ( path.at( path.length() - 1 ) == '/' ) 695 if ( path.at( path.length() - 1 ) == '/' )
688 path.truncate( path.length() - 1 ); 696 path.truncate( path.length() - 1 );
689 if ( !path.isNull() ) 697 if ( !path.isNull() )
690 m_location->setText( path ); 698 m_location->setText( path );
691} 699}
692 700