-rw-r--r-- | noncore/settings/packagemanager/entrydlg.cpp | 8 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 38 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 52 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.cpp | 8 |
5 files changed, 65 insertions, 67 deletions
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp index 5d61342..1e87e64 100644 --- a/noncore/settings/packagemanager/entrydlg.cpp +++ b/noncore/settings/packagemanager/entrydlg.cpp | |||
@@ -1,108 +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, 2005 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 | */ | 29 | */ |
30 | 30 | ||
31 | #include "entrydlg.h" | 31 | #include "entrydlg.h" |
32 | 32 | ||
33 | #include <opie2/ofiledialog.h> | 33 | #include <opie2/ofiledialog.h> |
34 | #include <opie2/oresource.h> | ||
34 | 35 | ||
35 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/resource.h> | ||
37 | 37 | ||
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | 42 | ||
43 | EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) | 43 | EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal ) |
44 | : QDialog( parent, name, modal ) | 44 | : QDialog( parent, name, modal ) |
45 | { | 45 | { |
46 | QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 ); | 46 | QGridLayout *layout = new QGridLayout( this, 3, 2, 2, 4 ); |
47 | 47 | ||
48 | QLabel *l = new QLabel( label, this ); | 48 | QLabel *l = new QLabel( label, this ); |
49 | l->setAlignment( AlignLeft | AlignTop | WordBreak ); | 49 | l->setAlignment( AlignLeft | AlignTop | WordBreak ); |
50 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); | 50 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); |
51 | 51 | ||
52 | m_entry = new QLineEdit( this ); | 52 | m_entry = new QLineEdit( this ); |
53 | layout->addWidget( m_entry, 1, 0 ); | 53 | layout->addWidget( m_entry, 1, 0 ); |
54 | connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) ); | 54 | connect( m_entry, SIGNAL(returnPressed()), this, SLOT(slotTryAccept()) ); |
55 | 55 | ||
56 | QPixmap pic; | 56 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), |
57 | pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 57 | QString::null, this ); |
58 | QPushButton *btn = new QPushButton( pic, QString::null, this ); | 58 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
59 | btn->setMaximumWidth( btn->height() ); | 59 | btn->setMaximumWidth( btn->height() ); |
60 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); | 60 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); |
61 | layout->addWidget( btn, 1, 1 ); | 61 | layout->addWidget( btn, 1, 1 ); |
62 | 62 | ||
63 | layout->setRowStretch( 2, 10 ); | 63 | layout->setRowStretch( 2, 10 ); |
64 | 64 | ||
65 | resize( width(), l->height() + btn->height() + 8 ); | 65 | resize( width(), l->height() + btn->height() + 8 ); |
66 | } | 66 | } |
67 | 67 | ||
68 | void EntryDlg::setText( const QString &text ) | 68 | void EntryDlg::setText( const QString &text ) |
69 | { | 69 | { |
70 | m_entry->setText( text ); | 70 | m_entry->setText( text ); |
71 | m_entry->selectAll(); | 71 | m_entry->selectAll(); |
72 | } | 72 | } |
73 | 73 | ||
74 | QString EntryDlg::getText() | 74 | QString EntryDlg::getText() |
75 | { | 75 | { |
76 | return m_entry->text(); | 76 | return m_entry->text(); |
77 | } | 77 | } |
78 | 78 | ||
79 | QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok, | 79 | QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok, |
80 | QWidget *parent, const char *name ) | 80 | QWidget *parent, const char *name ) |
81 | { | 81 | { |
82 | EntryDlg *dlg = new EntryDlg( label, parent, name, true ); | 82 | EntryDlg *dlg = new EntryDlg( label, parent, name, true ); |
83 | dlg->setCaption( caption ); | 83 | dlg->setCaption( caption ); |
84 | dlg->setText( text ); | 84 | dlg->setText( text ); |
85 | 85 | ||
86 | QString result; | 86 | QString result; |
87 | 87 | ||
88 | *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted ); | 88 | *ok = ( QPEApplication::execDialog( dlg ) == QDialog::Accepted ); |
89 | if ( *ok ) | 89 | if ( *ok ) |
90 | result = dlg->getText(); | 90 | result = dlg->getText(); |
91 | 91 | ||
92 | delete dlg; | 92 | delete dlg; |
93 | return result; | 93 | return result; |
94 | } | 94 | } |
95 | void EntryDlg::slotTryAccept() | 95 | void EntryDlg::slotTryAccept() |
96 | { | 96 | { |
97 | if ( !m_entry->text().isEmpty() ) | 97 | if ( !m_entry->text().isEmpty() ) |
98 | accept(); | 98 | accept(); |
99 | } | 99 | } |
100 | 100 | ||
101 | void EntryDlg::slotSelectPath() | 101 | void EntryDlg::slotSelectPath() |
102 | { | 102 | { |
103 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() ); | 103 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_entry->text() ); |
104 | if ( path.at( path.length() - 1 ) == '/' ) | 104 | if ( path.at( path.length() - 1 ) == '/' ) |
105 | path.truncate( path.length() - 1 ); | 105 | path.truncate( path.length() - 1 ); |
106 | if ( !path.isNull() ) | 106 | if ( !path.isNull() ) |
107 | m_entry->setText( path ); | 107 | m_entry->setText( path ); |
108 | } | 108 | } |
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 205d7ed..15d88ad 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -1,324 +1,316 @@ | |||
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, 2005 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 | */ | 29 | */ |
30 | 30 | ||
31 | #include "installdlg.h" | 31 | #include "installdlg.h" |
32 | 32 | ||
33 | #include <opie2/ofiledialog.h> | 33 | #include <opie2/ofiledialog.h> |
34 | #include <opie2/oresource.h> | ||
34 | 35 | ||
35 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
36 | #include <qpe/resource.h> | ||
37 | #include <qpe/storage.h> | 37 | #include <qpe/storage.h> |
38 | 38 | ||
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qfileinfo.h> | 41 | #include <qfileinfo.h> |
42 | #include <qgroupbox.h> | 42 | #include <qgroupbox.h> |
43 | #include <qlabel.h> | 43 | #include <qlabel.h> |
44 | #include <qlayout.h> | 44 | #include <qlayout.h> |
45 | #include <qmap.h> | 45 | #include <qmap.h> |
46 | #include <qmultilineedit.h> | 46 | #include <qmultilineedit.h> |
47 | #include <qpushbutton.h> | 47 | #include <qpushbutton.h> |
48 | 48 | ||
49 | #include <sys/vfs.h> | 49 | #include <sys/vfs.h> |
50 | 50 | ||
51 | #include "opackagemanager.h" | 51 | #include "opackagemanager.h" |
52 | 52 | ||
53 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, | 53 | InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, |
54 | OPackage::Command command1, const QStringList &packages1, | 54 | OPackage::Command command1, const QStringList &packages1, |
55 | OPackage::Command command2, const QStringList &packages2, | 55 | OPackage::Command command2, const QStringList &packages2, |
56 | OPackage::Command command3, const QStringList &packages3 ) | 56 | OPackage::Command command3, const QStringList &packages3 ) |
57 | : QWidget( 0l ) | 57 | : QWidget( 0l ) |
58 | , m_packman( pm ) | 58 | , m_packman( pm ) |
59 | , m_installFound( false ) | 59 | , m_installFound( false ) |
60 | , m_numCommands( 0 ) | 60 | , m_numCommands( 0 ) |
61 | , m_currCommand( 0 ) | 61 | , m_currCommand( 0 ) |
62 | , m_destItem( 0l ) | 62 | , m_destItem( 0l ) |
63 | { | 63 | { |
64 | // Save command/package list information | 64 | // Save command/package list information |
65 | if ( command1 != OPackage::NotDefined ) | 65 | if ( command1 != OPackage::NotDefined ) |
66 | { | 66 | { |
67 | m_command[ m_numCommands ] = command1; | 67 | m_command[ m_numCommands ] = command1; |
68 | m_packages[ m_numCommands ] = packages1; | 68 | m_packages[ m_numCommands ] = packages1; |
69 | ++m_numCommands; | 69 | ++m_numCommands; |
70 | 70 | ||
71 | if ( command1 == OPackage::Install ) | 71 | if ( command1 == OPackage::Install ) |
72 | m_installFound = true; | 72 | m_installFound = true; |
73 | } | 73 | } |
74 | if ( command2 != OPackage::NotDefined ) | 74 | if ( command2 != OPackage::NotDefined ) |
75 | { | 75 | { |
76 | m_command[ m_numCommands ] = command2; | 76 | m_command[ m_numCommands ] = command2; |
77 | m_packages[ m_numCommands ] = packages2; | 77 | m_packages[ m_numCommands ] = packages2; |
78 | ++m_numCommands; | 78 | ++m_numCommands; |
79 | 79 | ||
80 | if ( command2 == OPackage::Install ) | 80 | if ( command2 == OPackage::Install ) |
81 | m_installFound = true; | 81 | m_installFound = true; |
82 | } | 82 | } |
83 | if ( command3 != OPackage::NotDefined ) | 83 | if ( command3 != OPackage::NotDefined ) |
84 | { | 84 | { |
85 | m_command[ m_numCommands ] = command3; | 85 | m_command[ m_numCommands ] = command3; |
86 | m_packages[ m_numCommands ] = packages3; | 86 | m_packages[ m_numCommands ] = packages3; |
87 | ++m_numCommands; | 87 | ++m_numCommands; |
88 | 88 | ||
89 | if ( command3 == OPackage::Install ) | 89 | if ( command3 == OPackage::Install ) |
90 | m_installFound = true; | 90 | m_installFound = true; |
91 | } | 91 | } |
92 | 92 | ||
93 | // Initialize UI | 93 | // Initialize UI |
94 | if ( parent ) | 94 | if ( parent ) |
95 | parent->setCaption( caption ); | 95 | parent->setCaption( caption ); |
96 | 96 | ||
97 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); | 97 | QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); |
98 | 98 | ||
99 | if ( m_installFound ) | 99 | if ( m_installFound ) |
100 | { | 100 | { |
101 | QLabel *label = new QLabel( tr( "Destination" ), this ); | 101 | QLabel *label = new QLabel( tr( "Destination" ), this ); |
102 | layout->addWidget( label, 0, 0 ); | 102 | layout->addWidget( label, 0, 0 ); |
103 | m_destination = new QComboBox( this ); | 103 | m_destination = new QComboBox( this ); |
104 | m_destination->insertStringList( m_packman->destinations() ); | 104 | m_destination->insertStringList( m_packman->destinations() ); |
105 | layout->addWidget( m_destination, 0, 1 ); | 105 | layout->addWidget( m_destination, 0, 1 ); |
106 | connect( m_destination, SIGNAL(highlighted(const QString&)), | 106 | connect( m_destination, SIGNAL(highlighted(const QString&)), |
107 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); | 107 | this, SLOT(slotDisplayAvailSpace(const QString&)) ); |
108 | 108 | ||
109 | label = new QLabel( tr( "Space Avail" ), this ); | 109 | label = new QLabel( tr( "Space Avail" ), this ); |
110 | layout->addWidget( label, 1, 0 ); | 110 | layout->addWidget( label, 1, 0 ); |
111 | m_availSpace = new QLabel( this ); | 111 | m_availSpace = new QLabel( this ); |
112 | layout->addWidget( m_availSpace, 1, 1 ); | 112 | layout->addWidget( m_availSpace, 1, 1 ); |
113 | 113 | ||
114 | // TODO - select correct destination | 114 | // TODO - select correct destination |
115 | slotDisplayAvailSpace( m_destination->currentText() ); | 115 | slotDisplayAvailSpace( m_destination->currentText() ); |
116 | } | 116 | } |
117 | else | 117 | else |
118 | { | 118 | { |
119 | m_destination = 0l; | 119 | m_destination = 0l; |
120 | m_availSpace = 0l; | 120 | m_availSpace = 0l; |
121 | } | 121 | } |
122 | 122 | ||
123 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); | 123 | QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); |
124 | groupBox->layout()->setSpacing( 0 ); | 124 | groupBox->layout()->setSpacing( 0 ); |
125 | groupBox->layout()->setMargin( 4 ); | 125 | groupBox->layout()->setMargin( 4 ); |
126 | 126 | ||
127 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); | 127 | QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); |
128 | m_output = new QMultiLineEdit( groupBox ); | 128 | m_output = new QMultiLineEdit( groupBox ); |
129 | m_output->setReadOnly( true ); | 129 | m_output->setReadOnly( true ); |
130 | groupBoxLayout->addWidget( m_output ); | 130 | groupBoxLayout->addWidget( m_output ); |
131 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); | 131 | layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); |
132 | 132 | ||
133 | QPixmap pic; | 133 | m_btnStart = new QPushButton( Opie::Core::OResource::loadPixmap( "packagemanager/apply", |
134 | pic.convertFromImage( Resource::loadImage( "packagemanager/apply" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 134 | Opie::Core::OResource::SmallIcon ), tr( "Start" ), this ); |
135 | m_btnStart = new QPushButton( pic, tr( "Start" ), this ); | ||
136 | m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); | 135 | m_btnStart->setMinimumHeight( AppLnk::smallIconSize() ); |
137 | layout->addWidget( m_btnStart, 3, 0 ); | 136 | layout->addWidget( m_btnStart, 3, 0 ); |
138 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); | 137 | connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); |
139 | 138 | ||
140 | pic.convertFromImage( Resource::loadImage( "SettingsIcon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 139 | m_btnOptions = new QPushButton( Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
141 | m_btnOptions = new QPushButton( pic, tr( "Options" ), this ); | 140 | tr( "Options" ), this ); |
142 | m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); | 141 | m_btnOptions->setMinimumHeight( AppLnk::smallIconSize() ); |
143 | layout->addWidget( m_btnOptions, 3, 1 ); | 142 | layout->addWidget( m_btnOptions, 3, 1 ); |
144 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); | 143 | connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); |
145 | 144 | ||
146 | // Display packages being acted upon in output widget | 145 | // Display packages being acted upon in output widget |
147 | for( int i = 0; i < m_numCommands; i++ ) | 146 | for( int i = 0; i < m_numCommands; i++ ) |
148 | { | 147 | { |
149 | if ( !m_packages[ i ].isEmpty() ) | 148 | if ( !m_packages[ i ].isEmpty() ) |
150 | { | 149 | { |
151 | QString lineStr = tr( "Packages to " ); | 150 | QString lineStr = tr( "Packages to " ); |
152 | 151 | ||
153 | switch( m_command[ i ] ) | 152 | switch( m_command[ i ] ) |
154 | { | 153 | { |
155 | case OPackage::Install : lineStr.append( tr( "install" ) ); | 154 | case OPackage::Install : lineStr.append( tr( "install" ) ); |
156 | break; | 155 | break; |
157 | case OPackage::Remove : lineStr.append( tr( "remove" ) ); | 156 | case OPackage::Remove : lineStr.append( tr( "remove" ) ); |
158 | break; | 157 | break; |
159 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); | 158 | case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); |
160 | break; | 159 | break; |
161 | case OPackage::Download : lineStr.append( tr( "download" ) ); | 160 | case OPackage::Download : lineStr.append( tr( "download" ) ); |
162 | break; | 161 | break; |
163 | default : | 162 | default : |
164 | break; | 163 | break; |
165 | }; | 164 | }; |
166 | lineStr.append( ":\n" ); | 165 | lineStr.append( ":\n" ); |
167 | 166 | ||
168 | QStringList tmpPackage = m_packages[ i ]; | 167 | QStringList tmpPackage = m_packages[ i ]; |
169 | for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) | 168 | for ( QStringList::Iterator it = tmpPackage.begin(); it != tmpPackage.end(); ++it ) |
170 | { | 169 | { |
171 | lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); | 170 | lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); |
172 | } | 171 | } |
173 | 172 | ||
174 | m_output->append( lineStr ); | 173 | m_output->append( lineStr ); |
175 | } | 174 | } |
176 | } | 175 | } |
177 | 176 | ||
178 | m_output->append( tr( "Press the start button to begin.\n" ) ); | 177 | m_output->append( tr( "Press the start button to begin.\n" ) ); |
179 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 178 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
180 | 179 | ||
181 | } | 180 | } |
182 | 181 | ||
183 | void InstallDlg::slotDisplayAvailSpace( const QString &destination ) | 182 | void InstallDlg::slotDisplayAvailSpace( const QString &destination ) |
184 | { | 183 | { |
185 | // If available space is not displayed, exit | 184 | // If available space is not displayed, exit |
186 | if ( !m_availSpace ) | 185 | if ( !m_availSpace ) |
187 | return; | 186 | return; |
188 | 187 | ||
189 | QString space = tr( "Unknown" ); | 188 | QString space = tr( "Unknown" ); |
190 | 189 | ||
191 | // Get destination | 190 | // Get destination |
192 | if ( !destination.isNull() ) | 191 | if ( !destination.isNull() ) |
193 | m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); | 192 | m_destItem = m_packman->findConfItem( OConfItem::Destination, destination ); |
194 | 193 | ||
195 | if ( m_destItem ) | 194 | if ( m_destItem ) |
196 | { | 195 | { |
197 | // Calculate available space | 196 | // Calculate available space |
198 | struct statfs fs; | 197 | struct statfs fs; |
199 | if ( !statfs( m_destItem->value(), &fs ) ) | 198 | if ( !statfs( m_destItem->value(), &fs ) ) |
200 | { | 199 | { |
201 | long mult = fs.f_bsize / 1024; | 200 | long mult = fs.f_bsize / 1024; |
202 | long div = 1024 / fs.f_bsize; | 201 | long div = 1024 / fs.f_bsize; |
203 | 202 | ||
204 | if ( !mult ) mult = 1; | 203 | if ( !mult ) mult = 1; |
205 | if ( !div ) div = 1; | 204 | if ( !div ) div = 1; |
206 | long avail = fs.f_bavail * mult / div; | 205 | long avail = fs.f_bavail * mult / div; |
207 | 206 | ||
208 | space = tr( "%1 Kb" ).arg( avail ); | 207 | space = tr( "%1 Kb" ).arg( avail ); |
209 | } | 208 | } |
210 | } | 209 | } |
211 | 210 | ||
212 | // Display available space | 211 | // Display available space |
213 | m_availSpace->setText( space ); | 212 | m_availSpace->setText( space ); |
214 | } | 213 | } |
215 | 214 | ||
216 | void InstallDlg::slotBtnStart() | 215 | void InstallDlg::slotBtnStart() |
217 | { | 216 | { |
218 | QString btnText = m_btnStart->text(); | 217 | QString btnText = m_btnStart->text(); |
219 | if ( btnText == tr( "Abort" ) ) | 218 | if ( btnText == tr( "Abort" ) ) |
220 | { | 219 | { |
221 | // Prevent unexecuted commands from executing | 220 | // Prevent unexecuted commands from executing |
222 | m_currCommand = 999; | 221 | m_currCommand = 999; |
223 | 222 | ||
224 | // Allow user to close dialog | 223 | // Allow user to close dialog |
225 | m_btnStart->setText( tr( "Close" ) ); | 224 | m_btnStart->setText( tr( "Close" ) ); |
226 | QPixmap pic; | 225 | m_btnStart->setIconSet( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); |
227 | pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
228 | m_btnStart->setIconSet( pic ); | ||
229 | return; | 226 | return; |
230 | } | 227 | } |
231 | else if ( btnText == tr( "Close" ) ) | 228 | else if ( btnText == tr( "Close" ) ) |
232 | { | 229 | { |
233 | // TODO - force reload of package data | 230 | // TODO - force reload of package data |
234 | emit closeInstallDlg(); | 231 | emit closeInstallDlg(); |
235 | return; | 232 | return; |
236 | } | 233 | } |
237 | 234 | ||
238 | // Start was clicked, start executing | 235 | // Start was clicked, start executing |
239 | QString dest; | 236 | QString dest; |
240 | if ( m_installFound ) | 237 | if ( m_installFound ) |
241 | { | 238 | { |
242 | dest = m_destination->currentText(); | 239 | dest = m_destination->currentText(); |
243 | m_destination->setEnabled( false ); | 240 | m_destination->setEnabled( false ); |
244 | } | 241 | } |
245 | 242 | ||
246 | m_btnOptions->setEnabled( false ); | 243 | m_btnOptions->setEnabled( false ); |
247 | if ( m_numCommands > 1 ) | 244 | if ( m_numCommands > 1 ) |
248 | { | 245 | { |
249 | m_btnStart->setText( tr( "Abort" ) ); | 246 | m_btnStart->setText( tr( "Abort" ) ); |
250 | QPixmap pic; | 247 | m_btnStart->setIconSet( Opie::Core::OResource::loadPixmap( "reset", Opie::Core::OResource::SmallIcon ) ); |
251 | pic.convertFromImage( Resource::loadImage( "reset" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
252 | m_btnStart->setIconSet( pic ); | ||
253 | } | 248 | } |
254 | else | 249 | else |
255 | { | 250 | { |
256 | m_btnStart->setEnabled( false ); | 251 | m_btnStart->setEnabled( false ); |
257 | } | 252 | } |
258 | 253 | ||
259 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 254 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
260 | { | 255 | { |
261 | // Execute next command | 256 | // Execute next command |
262 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | 257 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, |
263 | this, SLOT(slotOutput(const QString &)), true ); | 258 | this, SLOT(slotOutput(const QString &)), true ); |
264 | } | 259 | } |
265 | 260 | ||
266 | // All commands executed, allow user to close dialog | 261 | // All commands executed, allow user to close dialog |
267 | m_btnStart->setEnabled( true ); | 262 | m_btnStart->setEnabled( true ); |
268 | m_btnStart->setText( tr( "Close" ) ); | 263 | m_btnStart->setText( tr( "Close" ) ); |
269 | QPixmap pic; | 264 | m_btnStart->setIconSet( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) ); |
270 | pic.convertFromImage( Resource::loadImage( "close" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
271 | m_btnStart->setIconSet( pic ); | ||
272 | 265 | ||
273 | m_btnOptions->setEnabled( true ); | 266 | m_btnOptions->setEnabled( true ); |
274 | m_btnOptions->setText( tr( "Save output" ) ); | 267 | m_btnOptions->setText( tr( "Save output" ) ); |
275 | pic.convertFromImage( Resource::loadImage( "save" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 268 | m_btnOptions->setIconSet( Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ) ); |
276 | m_btnOptions->setIconSet( pic ); | ||
277 | } | 269 | } |
278 | 270 | ||
279 | void InstallDlg::slotBtnOptions() | 271 | void InstallDlg::slotBtnOptions() |
280 | { | 272 | { |
281 | QString btnText = m_btnOptions->text(); | 273 | QString btnText = m_btnOptions->text(); |
282 | if ( btnText == tr( "Options" ) ) | 274 | if ( btnText == tr( "Options" ) ) |
283 | { | 275 | { |
284 | // Display configuration dialog (only options tab is enabled) | 276 | // Display configuration dialog (only options tab is enabled) |
285 | m_packman->configureDlg( true ); | 277 | m_packman->configureDlg( true ); |
286 | return; | 278 | return; |
287 | } | 279 | } |
288 | 280 | ||
289 | // Save output was clicked | 281 | // Save output was clicked |
290 | QMap<QString, QStringList> map; | 282 | QMap<QString, QStringList> map; |
291 | map.insert( tr( "All" ), QStringList() ); | 283 | map.insert( tr( "All" ), QStringList() ); |
292 | QStringList text; | 284 | QStringList text; |
293 | text << "text/*"; | 285 | text << "text/*"; |
294 | map.insert(tr( "Text" ), text ); | 286 | map.insert(tr( "Text" ), text ); |
295 | text << "*"; | 287 | text << "*"; |
296 | map.insert( tr( "All" ), text ); | 288 | map.insert( tr( "All" ), text ); |
297 | 289 | ||
298 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); | 290 | QString filename = Opie::Ui::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); |
299 | if( !filename.isEmpty() ) | 291 | if( !filename.isEmpty() ) |
300 | { | 292 | { |
301 | QString currentFileName = QFileInfo( filename ).fileName(); | 293 | QString currentFileName = QFileInfo( filename ).fileName(); |
302 | DocLnk doc; | 294 | DocLnk doc; |
303 | doc.setType( "text/plain" ); | 295 | doc.setType( "text/plain" ); |
304 | doc.setFile( filename ); | 296 | doc.setFile( filename ); |
305 | doc.setName( currentFileName ); | 297 | doc.setName( currentFileName ); |
306 | FileManager fm; | 298 | FileManager fm; |
307 | fm.saveFile( doc, m_output->text() ); | 299 | fm.saveFile( doc, m_output->text() ); |
308 | } | 300 | } |
309 | } | 301 | } |
310 | 302 | ||
311 | void InstallDlg::slotOutput( const QString &msg ) | 303 | void InstallDlg::slotOutput( const QString &msg ) |
312 | { | 304 | { |
313 | // Allow processing of other events | 305 | // Allow processing of other events |
314 | qApp->processEvents(); | 306 | qApp->processEvents(); |
315 | 307 | ||
316 | QString lineStr = msg; | 308 | QString lineStr = msg; |
317 | if ( lineStr[lineStr.length()-1] == '\n' ) | 309 | if ( lineStr[lineStr.length()-1] == '\n' ) |
318 | lineStr.truncate( lineStr.length() - 1 ); | 310 | lineStr.truncate( lineStr.length() - 1 ); |
319 | m_output->append( lineStr ); | 311 | m_output->append( lineStr ); |
320 | m_output->setCursorPosition( m_output->numLines(), 0 ); | 312 | m_output->setCursorPosition( m_output->numLines(), 0 ); |
321 | 313 | ||
322 | // Update available space | 314 | // Update available space |
323 | slotDisplayAvailSpace( QString::null ); | 315 | slotDisplayAvailSpace( QString::null ); |
324 | } | 316 | } |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 0e40c01..e0e5e04 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -1,763 +1,771 @@ | |||
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, 2005 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 | */ | 29 | */ |
30 | 30 | ||
31 | #include "mainwindow.h" | 31 | #include "mainwindow.h" |
32 | #include "installdlg.h" | 32 | #include "installdlg.h" |
33 | #include "filterdlg.h" | 33 | #include "filterdlg.h" |
34 | #include "promptdlg.h" | 34 | #include "promptdlg.h" |
35 | #include "entrydlg.h" | 35 | #include "entrydlg.h" |
36 | #include "packageinfodlg.h" | 36 | #include "packageinfodlg.h" |
37 | 37 | ||
38 | #include <opie2/ofiledialog.h> | 38 | #include <opie2/ofiledialog.h> |
39 | #include <opie2/oresource.h> | ||
39 | 40 | ||
40 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
41 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
42 | #include <qpe/resource.h> | ||
43 | 43 | ||
44 | #include <qaction.h> | 44 | #include <qaction.h> |
45 | #include <qdir.h> | 45 | #include <qdir.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
48 | #include <qmenubar.h> | 48 | #include <qmenubar.h> |
49 | #include <qmessagebox.h> | 49 | #include <qmessagebox.h> |
50 | #include <qpopupmenu.h> | 50 | #include <qpopupmenu.h> |
51 | #include <qtimer.h> | 51 | #include <qtimer.h> |
52 | #include <qtoolbar.h> | 52 | #include <qtoolbar.h> |
53 | #include <qwhatsthis.h> | 53 | #include <qwhatsthis.h> |
54 | 54 | ||
55 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) | 55 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) |
56 | : QMainWindow( parent, name, WStyle_ContextHelp ) | 56 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
57 | , m_config( "packman" ) | 57 | , m_config( "packman" ) |
58 | , m_packman( &m_config, this ) | 58 | , m_packman( &m_config, this ) |
59 | , m_menuBar( this ) | 59 | , m_menuBar( this ) |
60 | , m_toolBar( this ) | 60 | , m_toolBar( this ) |
61 | , m_findBar( this ) | 61 | , m_findBar( this ) |
62 | , m_widgetStack( this ) | 62 | , m_widgetStack( this ) |
63 | , m_packageList( this ) | 63 | , m_packageList( this ) |
64 | , m_statusWidget( this ) | 64 | , m_statusWidget( this ) |
65 | , m_statusText( &m_statusWidget ) | 65 | , m_statusText( &m_statusWidget ) |
66 | , m_statusBar( &m_statusWidget ) | 66 | , m_statusBar( &m_statusWidget ) |
67 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) | 67 | , m_iconUpdated( Opie::Core::OResource::loadPixmap( "packagemanager/updated" ) ) |
68 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) | 68 | , m_iconInstalled( Opie::Core::OResource::loadPixmap( "installed" ) ) |
69 | , m_iconNull( m_iconUpdated.size() ) | 69 | , m_iconNull( m_iconUpdated.size() ) |
70 | , m_filterName( QString::null ) | 70 | , m_filterName( QString::null ) |
71 | , m_filterServer( QString::null ) | 71 | , m_filterServer( QString::null ) |
72 | , m_filterDest( QString::null ) | 72 | , m_filterDest( QString::null ) |
73 | , m_filterStatus( OPackageManager::NotDefined ) | 73 | , m_filterStatus( OPackageManager::NotDefined ) |
74 | , m_filterCategory( QString::null ) | 74 | , m_filterCategory( QString::null ) |
75 | 75 | ||
76 | { | 76 | { |
77 | // setCaption( tr( "Package Manager" ) ); | 77 | // setCaption( tr( "Package Manager" ) ); |
78 | 78 | ||
79 | m_iconNull.fill( colorGroup().base() ); | 79 | m_iconNull.fill( colorGroup().base() ); |
80 | 80 | ||
81 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); | 81 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); |
82 | 82 | ||
83 | // Initialize widget stack, package list and status widget | 83 | // Initialize widget stack, package list and status widget |
84 | initStatusWidget(); | 84 | initStatusWidget(); |
85 | initPackageList(); | 85 | initPackageList(); |
86 | 86 | ||
87 | m_widgetStack.addWidget( &m_statusWidget, 2 ); | 87 | m_widgetStack.addWidget( &m_statusWidget, 2 ); |
88 | m_widgetStack.addWidget( &m_packageList, 1 ); | 88 | m_widgetStack.addWidget( &m_packageList, 1 ); |
89 | setCentralWidget( &m_widgetStack ); | 89 | setCentralWidget( &m_widgetStack ); |
90 | 90 | ||
91 | // Initialize remaining user interface items | 91 | // Initialize remaining user interface items |
92 | initUI(); | 92 | initUI(); |
93 | 93 | ||
94 | // Initialize package information | 94 | // Initialize package information |
95 | QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) ); | 95 | QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) ); |
96 | } | 96 | } |
97 | 97 | ||
98 | void MainWindow::closeEvent( QCloseEvent *event ) | 98 | void MainWindow::closeEvent( QCloseEvent *event ) |
99 | { | 99 | { |
100 | // 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 |
101 | bool close = m_widgetStack.visibleWidget() == &m_packageList || | 101 | bool close = m_widgetStack.visibleWidget() == &m_packageList || |
102 | m_widgetStack.visibleWidget() == &m_statusWidget; | 102 | m_widgetStack.visibleWidget() == &m_statusWidget; |
103 | if ( close ) | 103 | if ( close ) |
104 | { | 104 | { |
105 | // TODO - write out application configuration settings | 105 | // TODO - write out application configuration settings |
106 | 106 | ||
107 | // Write out package manager configuration settings | 107 | // Write out package manager configuration settings |
108 | m_packman.saveSettings(); | 108 | m_packman.saveSettings(); |
109 | event->accept(); | 109 | event->accept(); |
110 | } | 110 | } |
111 | else | 111 | else |
112 | { | 112 | { |
113 | delete m_widgetStack.visibleWidget(); | 113 | delete m_widgetStack.visibleWidget(); |
114 | m_widgetStack.raiseWidget( &m_packageList ); | 114 | m_widgetStack.raiseWidget( &m_packageList ); |
115 | event->ignore(); | 115 | event->ignore(); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | void MainWindow::initPackageList() | 119 | void MainWindow::initPackageList() |
120 | { | 120 | { |
121 | m_packageList.addColumn( tr( "Packages" ) ); | 121 | m_packageList.addColumn( tr( "Packages" ) ); |
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 | 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." ) ); |
123 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); | 123 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); |
124 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), | 124 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), |
125 | this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); | 125 | this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void MainWindow::initStatusWidget() | 128 | void MainWindow::initStatusWidget() |
129 | { | 129 | { |
130 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); | 130 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); |
131 | 131 | ||
132 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 132 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
133 | layout->addWidget( &m_statusText ); | 133 | layout->addWidget( &m_statusText ); |
134 | 134 | ||
135 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); | 135 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); |
136 | 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&)) ); |
137 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); | 137 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); |
138 | 138 | ||
139 | layout->addWidget( &m_statusBar ); | 139 | layout->addWidget( &m_statusBar ); |
140 | } | 140 | } |
141 | 141 | ||
142 | void MainWindow::initUI() | 142 | void MainWindow::initUI() |
143 | { | 143 | { |
144 | // Build menu and tool bars | 144 | // Build menu and tool bars |
145 | setToolBarsMovable( false ); | 145 | setToolBarsMovable( false ); |
146 | 146 | ||
147 | m_menuBar.setHorizontalStretchable( true ); | 147 | m_menuBar.setHorizontalStretchable( true ); |
148 | QMenuBar *mb = new QMenuBar( &m_menuBar ); | 148 | QMenuBar *mb = new QMenuBar( &m_menuBar ); |
149 | mb->setMargin( 0 ); | 149 | mb->setMargin( 0 ); |
150 | 150 | ||
151 | // Find toolbar | 151 | // Find toolbar |
152 | addToolBar( &m_findBar, QMainWindow::Top, true ); | 152 | addToolBar( &m_findBar, QMainWindow::Top, true ); |
153 | m_findBar.setHorizontalStretchable( true ); | 153 | m_findBar.setHorizontalStretchable( true ); |
154 | m_findEdit = new QLineEdit( &m_findBar ); | 154 | m_findEdit = new QLineEdit( &m_findBar ); |
155 | 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." ) ); |
156 | m_findBar.setStretchableWidget( m_findEdit ); | 156 | m_findBar.setStretchableWidget( m_findEdit ); |
157 | 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&)) ); |
158 | 158 | ||
159 | // Packages menu | 159 | // Packages menu |
160 | QPopupMenu *popup = new QPopupMenu( this ); | 160 | QPopupMenu *popup = new QPopupMenu( this ); |
161 | 161 | ||
162 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); | 162 | QAction *a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "packagemanager/update", |
163 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
163 | a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); | 164 | a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); |
164 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); | 165 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); |
165 | a->addTo( popup ); | 166 | a->addTo( popup ); |
166 | a->addTo( &m_toolBar ); | 167 | a->addTo( &m_toolBar ); |
167 | 168 | ||
168 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); | 169 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "packagemanager/upgrade", |
170 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
169 | actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); | 171 | actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); |
170 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); | 172 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); |
171 | actionUpgrade->addTo( popup ); | 173 | actionUpgrade->addTo( popup ); |
172 | actionUpgrade->addTo( &m_toolBar ); | 174 | actionUpgrade->addTo( &m_toolBar ); |
173 | 175 | ||
174 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 176 | QPixmap iconDownload = Opie::Core::OResource::loadPixmap( "packagemanager/download", Opie::Core::OResource::SmallIcon ); |
175 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 177 | QPixmap iconRemove = Opie::Core::OResource::loadPixmap( "packagemanager/remove", Opie::Core::OResource::SmallIcon ); |
176 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 178 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
177 | actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); | 179 | actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); |
178 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 180 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
179 | actionDownload->addTo( popup ); | 181 | actionDownload->addTo( popup ); |
180 | actionDownload->addTo( &m_toolBar ); | 182 | actionDownload->addTo( &m_toolBar ); |
181 | 183 | ||
182 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 184 | a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "packagemanager/apply", |
185 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
183 | a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); | 186 | a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); |
184 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); | 187 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); |
185 | a->addTo( popup ); | 188 | a->addTo( popup ); |
186 | a->addTo( &m_toolBar ); | 189 | a->addTo( &m_toolBar ); |
187 | 190 | ||
188 | a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); | 191 | a = new QAction( tr( "Install local package" ), Opie::Core::OResource::loadPixmap( "folder", |
192 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
189 | a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); | 193 | a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); |
190 | connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); | 194 | connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); |
191 | a->addTo( popup ); | 195 | a->addTo( popup ); |
192 | //a->addTo( &m_toolBar ); | 196 | //a->addTo( &m_toolBar ); |
193 | 197 | ||
194 | popup->insertSeparator(); | 198 | popup->insertSeparator(); |
195 | 199 | ||
196 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 200 | a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", |
201 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
197 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); | 202 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); |
198 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 203 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
199 | a->addTo( popup ); | 204 | a->addTo( popup ); |
200 | mb->insertItem( tr( "Actions" ), popup ); | 205 | mb->insertItem( tr( "Actions" ), popup ); |
201 | 206 | ||
202 | // View menu | 207 | // View menu |
203 | popup = new QPopupMenu( this ); | 208 | popup = new QPopupMenu( this ); |
204 | 209 | ||
205 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 210 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
206 | m_actionShowNotInstalled->setToggleAction( true ); | 211 | m_actionShowNotInstalled->setToggleAction( true ); |
207 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); | 212 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); |
208 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); | 213 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); |
209 | m_actionShowNotInstalled->addTo( popup ); | 214 | m_actionShowNotInstalled->addTo( popup ); |
210 | 215 | ||
211 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 216 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
212 | m_actionShowInstalled->setToggleAction( true ); | 217 | m_actionShowInstalled->setToggleAction( true ); |
213 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); | 218 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); |
214 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); | 219 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); |
215 | m_actionShowInstalled->addTo( popup ); | 220 | m_actionShowInstalled->addTo( popup ); |
216 | 221 | ||
217 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 222 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
218 | m_actionShowUpdated->setToggleAction( true ); | 223 | m_actionShowUpdated->setToggleAction( true ); |
219 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); | 224 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); |
220 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); | 225 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); |
221 | m_actionShowUpdated->addTo( popup ); | 226 | m_actionShowUpdated->addTo( popup ); |
222 | 227 | ||
223 | popup->insertSeparator(); | 228 | popup->insertSeparator(); |
224 | 229 | ||
225 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 230 | m_actionFilter = new QAction( tr( "Filter" ), Opie::Core::OResource::loadPixmap( "packagemanager/filter", |
226 | QString::null, 0, this, 0 ); | 231 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); |
227 | m_actionFilter->setToggleAction( true ); | 232 | m_actionFilter->setToggleAction( true ); |
228 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); | 233 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); |
229 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 234 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
230 | m_actionFilter->addTo( popup ); | 235 | m_actionFilter->addTo( popup ); |
231 | 236 | ||
232 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); | 237 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); |
233 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); | 238 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); |
234 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | 239 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); |
235 | a->addTo( popup ); | 240 | a->addTo( popup ); |
236 | 241 | ||
237 | popup->insertSeparator(); | 242 | popup->insertSeparator(); |
238 | 243 | ||
239 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 244 | a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), |
245 | QString::null, 0, this, 0 ); | ||
240 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); | 246 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); |
241 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); | 247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); |
242 | a->addTo( popup ); | 248 | a->addTo( popup ); |
243 | 249 | ||
244 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 250 | m_actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next", |
251 | Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); | ||
245 | m_actionFindNext->setEnabled( false ); | 252 | m_actionFindNext->setEnabled( false ); |
246 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); | 253 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); |
247 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); | 254 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); |
248 | m_actionFindNext->addTo( popup ); | 255 | m_actionFindNext->addTo( popup ); |
249 | m_actionFindNext->addTo( &m_findBar ); | 256 | m_actionFindNext->addTo( &m_findBar ); |
250 | 257 | ||
251 | mb->insertItem( tr( "View" ), popup ); | 258 | mb->insertItem( tr( "View" ), popup ); |
252 | 259 | ||
253 | // Finish find toolbar creation | 260 | // Finish find toolbar creation |
254 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 261 | a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ), |
262 | QString::null, 0, this, 0 ); | ||
255 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); | 263 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); |
256 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); | 264 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); |
257 | a->addTo( &m_findBar ); | 265 | a->addTo( &m_findBar ); |
258 | m_findBar.hide(); | 266 | m_findBar.hide(); |
259 | } | 267 | } |
260 | 268 | ||
261 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | 269 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) |
262 | { | 270 | { |
263 | if ( clearList ) | 271 | if ( clearList ) |
264 | m_packageList.clear(); | 272 | m_packageList.clear(); |
265 | 273 | ||
266 | if ( packages ) | 274 | if ( packages ) |
267 | { | 275 | { |
268 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) | 276 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) |
269 | { | 277 | { |
270 | OPackage *package = packageIt.current(); | 278 | OPackage *package = packageIt.current(); |
271 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), | 279 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), |
272 | QCheckListItem::CheckBox ); | 280 | QCheckListItem::CheckBox ); |
273 | m_packageList.insertItem( item ); | 281 | m_packageList.insertItem( item ); |
274 | 282 | ||
275 | // If a different version of package is available, show update available icon | 283 | // If a different version of package is available, show update available icon |
276 | // Otherwise, show installed icon | 284 | // Otherwise, show installed icon |
277 | if ( !package->versionInstalled().isNull() ) | 285 | if ( !package->versionInstalled().isNull() ) |
278 | { | 286 | { |
279 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 287 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
280 | item->setPixmap( 0, m_iconUpdated ); | 288 | item->setPixmap( 0, m_iconUpdated ); |
281 | else | 289 | else |
282 | item->setPixmap( 0, m_iconInstalled ); | 290 | item->setPixmap( 0, m_iconInstalled ); |
283 | } | 291 | } |
284 | else | 292 | else |
285 | item->setPixmap( 0, m_iconNull ); | 293 | item->setPixmap( 0, m_iconNull ); |
286 | } | 294 | } |
287 | } | 295 | } |
288 | } | 296 | } |
289 | 297 | ||
290 | void MainWindow::searchForPackage( const QString &text ) | 298 | void MainWindow::searchForPackage( const QString &text ) |
291 | { | 299 | { |
292 | if ( !text.isEmpty() ) | 300 | if ( !text.isEmpty() ) |
293 | { | 301 | { |
294 | // look through package list for text startng at current position | 302 | // look through package list for text startng at current position |
295 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); | 303 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); |
296 | if ( start == 0 ) | 304 | if ( start == 0 ) |
297 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 305 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
298 | 306 | ||
299 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; | 307 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; |
300 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; | 308 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; |
301 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 309 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
302 | { | 310 | { |
303 | if ( item->text().lower().find( text ) != -1 ) | 311 | if ( item->text().lower().find( text ) != -1 ) |
304 | { | 312 | { |
305 | m_packageList.ensureItemVisible( item ); | 313 | m_packageList.ensureItemVisible( item ); |
306 | m_packageList.setCurrentItem( item ); | 314 | m_packageList.setCurrentItem( item ); |
307 | break; | 315 | break; |
308 | } | 316 | } |
309 | } | 317 | } |
310 | } | 318 | } |
311 | } | 319 | } |
312 | 320 | ||
313 | void MainWindow::installLocalPackage( const QString &ipkFile ) | 321 | void MainWindow::installLocalPackage( const QString &ipkFile ) |
314 | { | 322 | { |
315 | // Install selected file | 323 | // Install selected file |
316 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), | 324 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), |
317 | OPackage::Install, ipkFile ); | 325 | OPackage::Install, ipkFile ); |
318 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 326 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
319 | 327 | ||
320 | // Display widget | 328 | // Display widget |
321 | m_widgetStack.addWidget( dlg, 3 ); | 329 | m_widgetStack.addWidget( dlg, 3 ); |
322 | m_widgetStack.raiseWidget( dlg ); | 330 | m_widgetStack.raiseWidget( dlg ); |
323 | } | 331 | } |
324 | 332 | ||
325 | void MainWindow::setDocument( const QString &ipkFile ) | 333 | void MainWindow::setDocument( const QString &ipkFile ) |
326 | { | 334 | { |
327 | QString file = ipkFile; | 335 | QString file = ipkFile; |
328 | DocLnk lnk( ipkFile ); | 336 | DocLnk lnk( ipkFile ); |
329 | if ( lnk.isValid() ) | 337 | if ( lnk.isValid() ) |
330 | file = lnk.file(); | 338 | file = lnk.file(); |
331 | 339 | ||
332 | installLocalPackage( file ); | 340 | installLocalPackage( file ); |
333 | } | 341 | } |
334 | 342 | ||
335 | void MainWindow::initPackageInfo() | 343 | void MainWindow::initPackageInfo() |
336 | { | 344 | { |
337 | m_widgetStack.raiseWidget( &m_statusWidget ); | 345 | m_widgetStack.raiseWidget( &m_statusWidget ); |
338 | 346 | ||
339 | // Load package list | 347 | // Load package list |
340 | m_packman.loadAvailablePackages(); | 348 | m_packman.loadAvailablePackages(); |
341 | m_packman.loadInstalledPackages(); | 349 | m_packman.loadInstalledPackages(); |
342 | 350 | ||
343 | OPackageList *packageList = m_packman.packages(); | 351 | OPackageList *packageList = m_packman.packages(); |
344 | if ( packageList ) | 352 | if ( packageList ) |
345 | { | 353 | { |
346 | loadPackageList( packageList, true ); | 354 | loadPackageList( packageList, true ); |
347 | delete packageList; | 355 | delete packageList; |
348 | } | 356 | } |
349 | 357 | ||
350 | QWidget *widget = m_widgetStack.widget( 3 ); | 358 | QWidget *widget = m_widgetStack.widget( 3 ); |
351 | if ( !widget ) | 359 | if ( !widget ) |
352 | widget = &m_packageList; | 360 | widget = &m_packageList; |
353 | m_widgetStack.raiseWidget( widget ); | 361 | m_widgetStack.raiseWidget( widget ); |
354 | } | 362 | } |
355 | 363 | ||
356 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 364 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
357 | { | 365 | { |
358 | if ( widget == &m_packageList ) | 366 | if ( widget == &m_packageList ) |
359 | { | 367 | { |
360 | setCaption( tr( "Package Manager" ) ); | 368 | setCaption( tr( "Package Manager" ) ); |
361 | 369 | ||
362 | m_menuBar.show(); | 370 | m_menuBar.show(); |
363 | m_toolBar.show(); | 371 | m_toolBar.show(); |
364 | } | 372 | } |
365 | else | 373 | else |
366 | { | 374 | { |
367 | m_menuBar.hide(); | 375 | m_menuBar.hide(); |
368 | m_toolBar.hide(); | 376 | m_toolBar.hide(); |
369 | } | 377 | } |
370 | } | 378 | } |
371 | 379 | ||
372 | void MainWindow::slotInitStatusBar( int numSteps ) | 380 | void MainWindow::slotInitStatusBar( int numSteps ) |
373 | { | 381 | { |
374 | m_statusBar.setTotalSteps( numSteps ); | 382 | m_statusBar.setTotalSteps( numSteps ); |
375 | } | 383 | } |
376 | 384 | ||
377 | void MainWindow::slotStatusText( const QString &status ) | 385 | void MainWindow::slotStatusText( const QString &status ) |
378 | { | 386 | { |
379 | m_statusText.setText( status ); | 387 | m_statusText.setText( status ); |
380 | } | 388 | } |
381 | 389 | ||
382 | void MainWindow::slotStatusBar( int currStep ) | 390 | void MainWindow::slotStatusBar( int currStep ) |
383 | { | 391 | { |
384 | m_statusBar.setProgress( currStep ); | 392 | m_statusBar.setProgress( currStep ); |
385 | } | 393 | } |
386 | 394 | ||
387 | void MainWindow::slotUpdate() | 395 | void MainWindow::slotUpdate() |
388 | { | 396 | { |
389 | // Create package manager output widget | 397 | // Create package manager output widget |
390 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), | 398 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), |
391 | OPackage::Update ); | 399 | OPackage::Update ); |
392 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 400 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
393 | 401 | ||
394 | // Display widget | 402 | // Display widget |
395 | m_widgetStack.addWidget( dlg, 3 ); | 403 | m_widgetStack.addWidget( dlg, 3 ); |
396 | m_widgetStack.raiseWidget( dlg ); | 404 | m_widgetStack.raiseWidget( dlg ); |
397 | } | 405 | } |
398 | 406 | ||
399 | void MainWindow::slotUpgrade() | 407 | void MainWindow::slotUpgrade() |
400 | { | 408 | { |
401 | // Create package manager output widget | 409 | // Create package manager output widget |
402 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), | 410 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), |
403 | OPackage::Upgrade ); | 411 | OPackage::Upgrade ); |
404 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 412 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
405 | 413 | ||
406 | // Display widget | 414 | // Display widget |
407 | m_widgetStack.addWidget( dlg, 3 ); | 415 | m_widgetStack.addWidget( dlg, 3 ); |
408 | m_widgetStack.raiseWidget( dlg ); | 416 | m_widgetStack.raiseWidget( dlg ); |
409 | } | 417 | } |
410 | 418 | ||
411 | void MainWindow::slotDownload() | 419 | void MainWindow::slotDownload() |
412 | { | 420 | { |
413 | // Retrieve list of packages selected for download (if any) | 421 | // Retrieve list of packages selected for download (if any) |
414 | QStringList workingPackages; | 422 | QStringList workingPackages; |
415 | 423 | ||
416 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 424 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
417 | item != 0 ; | 425 | item != 0 ; |
418 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 426 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
419 | { | 427 | { |
420 | if ( item->isOn() ) | 428 | if ( item->isOn() ) |
421 | workingPackages.append( item->text() ); | 429 | workingPackages.append( item->text() ); |
422 | } | 430 | } |
423 | 431 | ||
424 | if ( workingPackages.isEmpty() ) | 432 | if ( workingPackages.isEmpty() ) |
425 | { | 433 | { |
426 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 434 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
427 | return; | 435 | return; |
428 | } | 436 | } |
429 | else | 437 | else |
430 | { | 438 | { |
431 | // Download selected packages | 439 | // Download selected packages |
432 | m_config.setGroup( "settings" ); | 440 | m_config.setGroup( "settings" ); |
433 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); | 441 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); |
434 | 442 | ||
435 | bool ok = false; | 443 | bool ok = false; |
436 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); | 444 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); |
437 | if ( ok && !text.isEmpty() ) | 445 | if ( ok && !text.isEmpty() ) |
438 | workingDir = text; // user entered something and pressed ok | 446 | workingDir = text; // user entered something and pressed ok |
439 | else | 447 | else |
440 | return; // user entered nothing or pressed cancel | 448 | return; // user entered nothing or pressed cancel |
441 | 449 | ||
442 | // Store download directory in config file | 450 | // Store download directory in config file |
443 | m_config.writeEntry( "DownloadDir", workingDir ); | 451 | m_config.writeEntry( "DownloadDir", workingDir ); |
444 | 452 | ||
445 | // Get starting directory | 453 | // Get starting directory |
446 | QDir::setCurrent( workingDir ); | 454 | QDir::setCurrent( workingDir ); |
447 | 455 | ||
448 | // Create package manager output widget | 456 | // Create package manager output widget |
449 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), | 457 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), |
450 | OPackage::Download, workingPackages ); | 458 | OPackage::Download, workingPackages ); |
451 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 459 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
452 | 460 | ||
453 | // Display widget | 461 | // Display widget |
454 | m_widgetStack.addWidget( dlg, 3 ); | 462 | m_widgetStack.addWidget( dlg, 3 ); |
455 | m_widgetStack.raiseWidget( dlg ); | 463 | m_widgetStack.raiseWidget( dlg ); |
456 | } | 464 | } |
457 | } | 465 | } |
458 | 466 | ||
459 | void MainWindow::slotApply() | 467 | void MainWindow::slotApply() |
460 | { | 468 | { |
461 | QStringList removeList; | 469 | QStringList removeList; |
462 | QStringList installList; | 470 | QStringList installList; |
463 | QStringList upgradeList; | 471 | QStringList upgradeList; |
464 | 472 | ||
465 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 473 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
466 | item != 0 ; | 474 | item != 0 ; |
467 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 475 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
468 | { | 476 | { |
469 | if ( item->isOn() ) | 477 | if ( item->isOn() ) |
470 | { | 478 | { |
471 | OPackage *package = m_packman.findPackage( item->text() ); | 479 | OPackage *package = m_packman.findPackage( item->text() ); |
472 | if ( package ) | 480 | if ( package ) |
473 | { | 481 | { |
474 | if ( !package->versionInstalled().isNull() ) | 482 | if ( !package->versionInstalled().isNull() ) |
475 | { | 483 | { |
476 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 484 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
477 | { | 485 | { |
478 | // Remove/upgrade package | 486 | // Remove/upgrade package |
479 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), | 487 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), |
480 | tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), | 488 | tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), |
481 | tr( "Remove" ), tr( "Upgrade" ), this ); | 489 | tr( "Remove" ), tr( "Upgrade" ), this ); |
482 | if ( answer == 1 ) // Remove | 490 | if ( answer == 1 ) // Remove |
483 | { | 491 | { |
484 | removeList.append( item->text() ); | 492 | removeList.append( item->text() ); |
485 | } | 493 | } |
486 | else if ( answer == 2 ) // Upgrade | 494 | else if ( answer == 2 ) // Upgrade |
487 | { | 495 | { |
488 | upgradeList.append( item->text() ); | 496 | upgradeList.append( item->text() ); |
489 | } | 497 | } |
490 | } | 498 | } |
491 | else | 499 | else |
492 | { | 500 | { |
493 | // Remove/reinstall package | 501 | // Remove/reinstall package |
494 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), | 502 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), |
495 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), | 503 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), |
496 | tr( "Remove" ), tr( "Reinstall" ), this ); | 504 | tr( "Remove" ), tr( "Reinstall" ), this ); |
497 | if ( answer == 1 ) // Remove | 505 | if ( answer == 1 ) // Remove |
498 | { | 506 | { |
499 | removeList.append( item->text() ); | 507 | removeList.append( item->text() ); |
500 | } | 508 | } |
501 | else if ( answer == 2 ) // Reinstall | 509 | else if ( answer == 2 ) // Reinstall |
502 | { | 510 | { |
503 | installList.append( item->text() ); | 511 | installList.append( item->text() ); |
504 | } | 512 | } |
505 | } | 513 | } |
506 | } | 514 | } |
507 | else | 515 | else |
508 | { | 516 | { |
509 | // Install package | 517 | // Install package |
510 | installList.append( item->text() ); | 518 | installList.append( item->text() ); |
511 | } | 519 | } |
512 | } | 520 | } |
513 | } | 521 | } |
514 | } | 522 | } |
515 | 523 | ||
516 | // If nothing is selected, display message and exit | 524 | // If nothing is selected, display message and exit |
517 | if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) | 525 | if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() ) |
518 | { | 526 | { |
519 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 527 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
520 | return; | 528 | return; |
521 | } | 529 | } |
522 | 530 | ||
523 | // Send command only if there are packages to process | 531 | // Send command only if there are packages to process |
524 | OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove | 532 | OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove |
525 | : OPackage::NotDefined; | 533 | : OPackage::NotDefined; |
526 | OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install | 534 | OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install |
527 | : OPackage::NotDefined; | 535 | : OPackage::NotDefined; |
528 | OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade | 536 | OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade |
529 | : OPackage::NotDefined; | 537 | : OPackage::NotDefined; |
530 | 538 | ||
531 | // Create package manager output widget | 539 | // Create package manager output widget |
532 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), | 540 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), |
533 | removeCmd, removeList, | 541 | removeCmd, removeList, |
534 | installCmd, installList, | 542 | installCmd, installList, |
535 | upgradeCmd, upgradeList ); | 543 | upgradeCmd, upgradeList ); |
536 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 544 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
537 | 545 | ||
538 | // Display widget | 546 | // Display widget |
539 | m_widgetStack.addWidget( dlg, 3 ); | 547 | m_widgetStack.addWidget( dlg, 3 ); |
540 | m_widgetStack.raiseWidget( dlg ); | 548 | m_widgetStack.raiseWidget( dlg ); |
541 | } | 549 | } |
542 | 550 | ||
543 | void MainWindow::slotInstallLocal() | 551 | void MainWindow::slotInstallLocal() |
544 | { | 552 | { |
545 | // Display file open dialog with only package files | 553 | // Display file open dialog with only package files |
546 | MimeTypes type; | 554 | MimeTypes type; |
547 | QStringList packages; | 555 | QStringList packages; |
548 | packages << "application/ipkg"; | 556 | packages << "application/ipkg"; |
549 | type.insert( tr( "Application Packages" ), packages ); | 557 | type.insert( tr( "Application Packages" ), packages ); |
550 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, | 558 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, |
551 | "/", QString::null, type ); | 559 | "/", QString::null, type ); |
552 | if ( !package.isNull() ) | 560 | if ( !package.isNull() ) |
553 | installLocalPackage( package ); | 561 | installLocalPackage( package ); |
554 | } | 562 | } |
555 | 563 | ||
556 | void MainWindow::slotCloseDlg() | 564 | void MainWindow::slotCloseDlg() |
557 | { | 565 | { |
558 | // Close install dialog | 566 | // Close install dialog |
559 | delete m_widgetStack.visibleWidget(); | 567 | delete m_widgetStack.visibleWidget(); |
560 | 568 | ||
561 | // Reload package list | 569 | // Reload package list |
562 | initPackageInfo(); | 570 | initPackageInfo(); |
563 | 571 | ||
564 | // Update Opie launcher links | 572 | // Update Opie launcher links |
565 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 573 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
566 | QString lf = QString::null; | 574 | QString lf = QString::null; |
567 | e << lf; | 575 | e << lf; |
568 | 576 | ||
569 | // Reapply any filters previously set | 577 | // Reapply any filters previously set |
570 | if ( m_actionShowNotInstalled->isOn() ) | 578 | if ( m_actionShowNotInstalled->isOn() ) |
571 | slotShowNotInstalled(); | 579 | slotShowNotInstalled(); |
572 | else if ( m_actionShowInstalled->isOn() ) | 580 | else if ( m_actionShowInstalled->isOn() ) |
573 | slotShowInstalled(); | 581 | slotShowInstalled(); |
574 | else if ( m_actionShowUpdated->isOn() ) | 582 | else if ( m_actionShowUpdated->isOn() ) |
575 | slotShowUpdated(); | 583 | slotShowUpdated(); |
576 | else if ( m_actionFilter->isOn() ) | 584 | else if ( m_actionFilter->isOn() ) |
577 | slotFilter( true ); | 585 | slotFilter( true ); |
578 | } | 586 | } |
579 | 587 | ||
580 | void MainWindow::slotConfigure() | 588 | void MainWindow::slotConfigure() |
581 | { | 589 | { |
582 | if ( m_packman.configureDlg( false ) ) | 590 | if ( m_packman.configureDlg( false ) ) |
583 | { | 591 | { |
584 | if ( PromptDlg::ask( tr( "Config updated" ), | 592 | if ( PromptDlg::ask( tr( "Config updated" ), |
585 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), | 593 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), |
586 | tr( "Yes" ), tr( "No" ), this ) == 1 ) | 594 | tr( "Yes" ), tr( "No" ), this ) == 1 ) |
587 | { | 595 | { |
588 | // Update package list and reload package info | 596 | // Update package list and reload package info |
589 | slotUpdate(); | 597 | slotUpdate(); |
590 | } | 598 | } |
591 | } | 599 | } |
592 | } | 600 | } |
593 | 601 | ||
594 | void MainWindow::slotShowNotInstalled() | 602 | void MainWindow::slotShowNotInstalled() |
595 | { | 603 | { |
596 | OPackageList *packageList; | 604 | OPackageList *packageList; |
597 | if ( m_actionShowNotInstalled->isOn() ) | 605 | if ( m_actionShowNotInstalled->isOn() ) |
598 | { | 606 | { |
599 | m_actionShowInstalled->setOn( false ); | 607 | m_actionShowInstalled->setOn( false ); |
600 | m_actionShowUpdated->setOn( false ); | 608 | m_actionShowUpdated->setOn( false ); |
601 | m_actionFilter->setOn( false ); | 609 | m_actionFilter->setOn( false ); |
602 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 610 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
603 | OPackageManager::NotInstalled, QString::null ); | 611 | OPackageManager::NotInstalled, QString::null ); |
604 | } | 612 | } |
605 | else | 613 | else |
606 | packageList = m_packman.packages(); | 614 | packageList = m_packman.packages(); |
607 | 615 | ||
608 | if ( packageList ) | 616 | if ( packageList ) |
609 | { | 617 | { |
610 | loadPackageList( packageList, true ); | 618 | loadPackageList( packageList, true ); |
611 | delete packageList; | 619 | delete packageList; |
612 | } | 620 | } |
613 | } | 621 | } |
614 | 622 | ||
615 | void MainWindow::slotShowInstalled() | 623 | void MainWindow::slotShowInstalled() |
616 | { | 624 | { |
617 | OPackageList *packageList; | 625 | OPackageList *packageList; |
618 | if ( m_actionShowInstalled->isOn() ) | 626 | if ( m_actionShowInstalled->isOn() ) |
619 | { | 627 | { |
620 | m_actionShowNotInstalled->setOn( false ); | 628 | m_actionShowNotInstalled->setOn( false ); |
621 | m_actionShowUpdated->setOn( false ); | 629 | m_actionShowUpdated->setOn( false ); |
622 | m_actionFilter->setOn( false ); | 630 | m_actionFilter->setOn( false ); |
623 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 631 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
624 | OPackageManager::Installed, QString::null ); | 632 | OPackageManager::Installed, QString::null ); |
625 | } | 633 | } |
626 | else | 634 | else |
627 | packageList = m_packman.packages(); | 635 | packageList = m_packman.packages(); |
628 | 636 | ||
629 | if ( packageList ) | 637 | if ( packageList ) |
630 | { | 638 | { |
631 | loadPackageList( packageList, true ); | 639 | loadPackageList( packageList, true ); |
632 | delete packageList; | 640 | delete packageList; |
633 | } | 641 | } |
634 | } | 642 | } |
635 | 643 | ||
636 | void MainWindow::slotShowUpdated() | 644 | void MainWindow::slotShowUpdated() |
637 | { | 645 | { |
638 | OPackageList *packageList; | 646 | OPackageList *packageList; |
639 | if ( m_actionShowUpdated->isOn() ) | 647 | if ( m_actionShowUpdated->isOn() ) |
640 | { | 648 | { |
641 | m_actionShowInstalled->setOn( false ); | 649 | m_actionShowInstalled->setOn( false ); |
642 | m_actionShowNotInstalled->setOn( false ); | 650 | m_actionShowNotInstalled->setOn( false ); |
643 | m_actionFilter->setOn( false ); | 651 | m_actionFilter->setOn( false ); |
644 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 652 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
645 | OPackageManager::Updated, QString::null ); | 653 | OPackageManager::Updated, QString::null ); |
646 | } | 654 | } |
647 | else | 655 | else |
648 | packageList = m_packman.packages(); | 656 | packageList = m_packman.packages(); |
649 | 657 | ||
650 | if ( packageList ) | 658 | if ( packageList ) |
651 | { | 659 | { |
652 | loadPackageList( packageList, true ); | 660 | loadPackageList( packageList, true ); |
653 | delete packageList; | 661 | delete packageList; |
654 | } | 662 | } |
655 | } | 663 | } |
656 | 664 | ||
657 | void MainWindow::slotFilterChange() | 665 | void MainWindow::slotFilterChange() |
658 | { | 666 | { |
659 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 667 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
660 | m_filterCategory ); | 668 | m_filterCategory ); |
661 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 669 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
662 | { | 670 | { |
663 | m_filterName = dlg.name(); | 671 | m_filterName = dlg.name(); |
664 | m_filterServer = dlg.server(); | 672 | m_filterServer = dlg.server(); |
665 | m_filterDest = dlg.destination(); | 673 | m_filterDest = dlg.destination(); |
666 | m_filterStatus = dlg.status(); | 674 | m_filterStatus = dlg.status(); |
667 | m_filterCategory = dlg.category(); | 675 | m_filterCategory = dlg.category(); |
668 | m_actionFilter->setOn( true ); | 676 | m_actionFilter->setOn( true ); |
669 | slotFilter( true ); | 677 | slotFilter( true ); |
670 | } | 678 | } |
671 | else | 679 | else |
672 | { | 680 | { |
673 | m_actionFilter->setOn( false ); | 681 | m_actionFilter->setOn( false ); |
674 | slotFilter( false ); | 682 | slotFilter( false ); |
675 | } | 683 | } |
676 | } | 684 | } |
677 | 685 | ||
678 | void MainWindow::slotFilter( bool isOn ) | 686 | void MainWindow::slotFilter( bool isOn ) |
679 | { | 687 | { |
680 | OPackageList *packageList; | 688 | OPackageList *packageList; |
681 | if ( isOn ) | 689 | if ( isOn ) |
682 | { | 690 | { |
683 | // Turn off other filtering options | 691 | // Turn off other filtering options |
684 | m_actionShowNotInstalled->setOn( false ); | 692 | m_actionShowNotInstalled->setOn( false ); |
685 | m_actionShowInstalled->setOn( false ); | 693 | m_actionShowInstalled->setOn( false ); |
686 | m_actionShowUpdated->setOn( false ); | 694 | m_actionShowUpdated->setOn( false ); |
687 | 695 | ||
688 | // If the filter settings have not been set yet, display filter dialog | 696 | // If the filter settings have not been set yet, display filter dialog |
689 | if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && | 697 | if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && |
690 | m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) | 698 | m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) |
691 | { | 699 | { |
692 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 700 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
693 | m_filterCategory ); | 701 | m_filterCategory ); |
694 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 702 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
695 | { | 703 | { |
696 | m_filterName = dlg.name(); | 704 | m_filterName = dlg.name(); |
697 | m_filterServer = dlg.server(); | 705 | m_filterServer = dlg.server(); |
698 | m_filterDest = dlg.destination(); | 706 | m_filterDest = dlg.destination(); |
699 | m_filterStatus = dlg.status(); | 707 | m_filterStatus = dlg.status(); |
700 | m_filterCategory = dlg.category(); | 708 | m_filterCategory = dlg.category(); |
701 | m_actionFilter->setOn( true ); | 709 | m_actionFilter->setOn( true ); |
702 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 710 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, |
703 | m_filterStatus, m_filterCategory ); | 711 | m_filterStatus, m_filterCategory ); |
704 | } | 712 | } |
705 | else | 713 | else |
706 | { | 714 | { |
707 | m_actionFilter->setOn( false ); | 715 | m_actionFilter->setOn( false ); |
708 | packageList = m_packman.packages(); | 716 | packageList = m_packman.packages(); |
709 | } | 717 | } |
710 | } | 718 | } |
711 | else | 719 | else |
712 | { | 720 | { |
713 | m_actionFilter->setOn( true ); | 721 | m_actionFilter->setOn( true ); |
714 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 722 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, |
715 | m_filterStatus, m_filterCategory ); | 723 | m_filterStatus, m_filterCategory ); |
716 | } | 724 | } |
717 | 725 | ||
718 | 726 | ||
719 | } | 727 | } |
720 | else | 728 | else |
721 | packageList = m_packman.packages(); | 729 | packageList = m_packman.packages(); |
722 | 730 | ||
723 | if ( packageList ) | 731 | if ( packageList ) |
724 | { | 732 | { |
725 | loadPackageList( packageList, true ); | 733 | loadPackageList( packageList, true ); |
726 | delete packageList; | 734 | delete packageList; |
727 | } | 735 | } |
728 | } | 736 | } |
729 | 737 | ||
730 | void MainWindow::slotFindShowToolbar() | 738 | void MainWindow::slotFindShowToolbar() |
731 | { | 739 | { |
732 | m_findBar.show(); | 740 | m_findBar.show(); |
733 | m_findEdit->setFocus(); | 741 | m_findEdit->setFocus(); |
734 | } | 742 | } |
735 | 743 | ||
736 | void MainWindow::slotFindHideToolbar() | 744 | void MainWindow::slotFindHideToolbar() |
737 | { | 745 | { |
738 | m_findBar.hide(); | 746 | m_findBar.hide(); |
739 | } | 747 | } |
740 | 748 | ||
741 | void MainWindow::slotFindChanged( const QString &findText ) | 749 | void MainWindow::slotFindChanged( const QString &findText ) |
742 | { | 750 | { |
743 | 751 | ||
744 | m_actionFindNext->setEnabled( !findText.isEmpty() ); | 752 | m_actionFindNext->setEnabled( !findText.isEmpty() ); |
745 | searchForPackage( findText ); | 753 | searchForPackage( findText ); |
746 | } | 754 | } |
747 | 755 | ||
748 | void MainWindow::slotFindNext() | 756 | void MainWindow::slotFindNext() |
749 | { | 757 | { |
750 | searchForPackage( m_findEdit->text() ); | 758 | searchForPackage( m_findEdit->text() ); |
751 | } | 759 | } |
752 | 760 | ||
753 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | 761 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) |
754 | { | 762 | { |
755 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); | 763 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); |
756 | 764 | ||
757 | // Create package manager output widget | 765 | // Create package manager output widget |
758 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); | 766 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); |
759 | 767 | ||
760 | // Display widget | 768 | // Display widget |
761 | m_widgetStack.addWidget( dlg, 3 ); | 769 | m_widgetStack.addWidget( dlg, 3 ); |
762 | m_widgetStack.raiseWidget( dlg ); | 770 | m_widgetStack.raiseWidget( dlg ); |
763 | } | 771 | } |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 945571f..58c572b 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -1,702 +1,700 @@ | |||
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, 2005 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 | */ | 29 | */ |
30 | 30 | ||
31 | #include "oipkgconfigdlg.h" | 31 | #include "oipkgconfigdlg.h" |
32 | 32 | ||
33 | #include <opie2/ofiledialog.h> | 33 | #include <opie2/ofiledialog.h> |
34 | #include <opie2/oresource.h> | ||
34 | 35 | ||
35 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
36 | #include <qpe/resource.h> | ||
37 | 37 | ||
38 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
39 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
40 | #include <qgroupbox.h> | 40 | #include <qgroupbox.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
43 | #include <qlistbox.h> | 43 | #include <qlistbox.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qscrollview.h> | 45 | #include <qscrollview.h> |
46 | #include <qwhatsthis.h> | 46 | #include <qwhatsthis.h> |
47 | 47 | ||
48 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 48 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
49 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 49 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
50 | , m_ipkg( ipkg ) | 50 | , m_ipkg( ipkg ) |
51 | , m_configs( 0l ) | 51 | , m_configs( 0l ) |
52 | , m_installOptions( installOptions ) | 52 | , m_installOptions( installOptions ) |
53 | , m_serverCurrent( -1 ) | 53 | , m_serverCurrent( -1 ) |
54 | , m_destCurrent( -1 ) | 54 | , m_destCurrent( -1 ) |
55 | , m_layout( this, 2, 4 ) | 55 | , m_layout( this, 2, 4 ) |
56 | , m_tabWidget( this ) | 56 | , m_tabWidget( this ) |
57 | { | 57 | { |
58 | setCaption( tr( "Configuration" ) ); | 58 | setCaption( tr( "Configuration" ) ); |
59 | 59 | ||
60 | // Initialize configuration widgets | 60 | // Initialize configuration widgets |
61 | if ( !installOptions ) | 61 | if ( !installOptions ) |
62 | { | 62 | { |
63 | initServerWidget(); | 63 | initServerWidget(); |
64 | initDestinationWidget(); | 64 | initDestinationWidget(); |
65 | initProxyWidget(); | 65 | initProxyWidget(); |
66 | } | 66 | } |
67 | initOptionsWidget(); | 67 | initOptionsWidget(); |
68 | 68 | ||
69 | // Load configuration information | 69 | // Load configuration information |
70 | initData(); | 70 | initData(); |
71 | 71 | ||
72 | // Setup tabs for all info | 72 | // Setup tabs for all info |
73 | m_layout.addWidget( &m_tabWidget ); | 73 | m_layout.addWidget( &m_tabWidget ); |
74 | if ( !m_installOptions ) | 74 | if ( !m_installOptions ) |
75 | { | 75 | { |
76 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 76 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
77 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 77 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
78 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 78 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
79 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 79 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
80 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 80 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
81 | } | 81 | } |
82 | else | 82 | else |
83 | { | 83 | { |
84 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 84 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | 87 | ||
88 | void OIpkgConfigDlg::accept() | 88 | void OIpkgConfigDlg::accept() |
89 | { | 89 | { |
90 | // Save server, destination and proxy configuration | 90 | // Save server, destination and proxy configuration |
91 | if ( !m_installOptions ) | 91 | if ( !m_installOptions ) |
92 | { | 92 | { |
93 | // Update proxy information before saving settings | 93 | // Update proxy information before saving settings |
94 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); | 94 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); |
95 | if ( confItem ) | 95 | if ( confItem ) |
96 | { | 96 | { |
97 | confItem->setValue( m_proxyHttpServer->text() ); | 97 | confItem->setValue( m_proxyHttpServer->text() ); |
98 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 98 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
99 | } | 99 | } |
100 | else | 100 | else |
101 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 101 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
102 | m_proxyHttpServer->text(), QString::null, | 102 | m_proxyHttpServer->text(), QString::null, |
103 | m_proxyHttpActive->isChecked() ) ); | 103 | m_proxyHttpActive->isChecked() ) ); |
104 | 104 | ||
105 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); | 105 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); |
106 | if ( confItem ) | 106 | if ( confItem ) |
107 | { | 107 | { |
108 | confItem->setValue( m_proxyFtpServer->text() ); | 108 | confItem->setValue( m_proxyFtpServer->text() ); |
109 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 109 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
110 | } | 110 | } |
111 | else | 111 | else |
112 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 112 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
113 | m_proxyFtpServer->text(), QString::null, | 113 | m_proxyFtpServer->text(), QString::null, |
114 | m_proxyFtpActive->isChecked() ) ); | 114 | m_proxyFtpActive->isChecked() ) ); |
115 | 115 | ||
116 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); | 116 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); |
117 | if ( confItem ) | 117 | if ( confItem ) |
118 | confItem->setValue( m_proxyUsername->text() ); | 118 | confItem->setValue( m_proxyUsername->text() ); |
119 | else | 119 | else |
120 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", | 120 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
121 | m_proxyUsername->text() ) ); | 121 | m_proxyUsername->text() ) ); |
122 | 122 | ||
123 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); | 123 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); |
124 | if ( confItem ) | 124 | if ( confItem ) |
125 | confItem->setValue( m_proxyPassword->text() ); | 125 | confItem->setValue( m_proxyPassword->text() ); |
126 | else | 126 | else |
127 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", | 127 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", |
128 | m_proxyPassword->text() ) ); | 128 | m_proxyPassword->text() ) ); |
129 | 129 | ||
130 | QString listsDir = m_optSourceLists->text(); | 130 | QString listsDir = m_optSourceLists->text(); |
131 | if ( listsDir == QString::null || listsDir == "" ) | 131 | if ( listsDir == QString::null || listsDir == "" ) |
132 | listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define | 132 | listsDir = "/usr/lib/ipkg/lists"; // TODO - use proper libipkg define |
133 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); | 133 | confItem = m_ipkg->findConfItem( OConfItem::Other, "lists_dir" ); |
134 | if ( confItem ) | 134 | if ( confItem ) |
135 | confItem->setValue( listsDir ); | 135 | confItem->setValue( listsDir ); |
136 | else | 136 | else |
137 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", | 137 | m_configs->append( new OConfItem( OConfItem::Other, "lists_dir", |
138 | listsDir, "name" ) ); | 138 | listsDir, "name" ) ); |
139 | 139 | ||
140 | m_ipkg->setConfigItems( m_configs ); | 140 | m_ipkg->setConfigItems( m_configs ); |
141 | } | 141 | } |
142 | 142 | ||
143 | // Save options configuration | 143 | // Save options configuration |
144 | int options = 0; | 144 | int options = 0; |
145 | if ( m_optForceDepends->isChecked() ) | 145 | if ( m_optForceDepends->isChecked() ) |
146 | options |= FORCE_DEPENDS; | 146 | options |= FORCE_DEPENDS; |
147 | if ( m_optForceReinstall->isChecked() ) | 147 | if ( m_optForceReinstall->isChecked() ) |
148 | options |= FORCE_REINSTALL; | 148 | options |= FORCE_REINSTALL; |
149 | if ( m_optForceRemove->isChecked() ) | 149 | if ( m_optForceRemove->isChecked() ) |
150 | options |= FORCE_REMOVE; | 150 | options |= FORCE_REMOVE; |
151 | if ( m_optForceOverwrite->isChecked() ) | 151 | if ( m_optForceOverwrite->isChecked() ) |
152 | options |= FORCE_OVERWRITE; | 152 | options |= FORCE_OVERWRITE; |
153 | m_ipkg->setIpkgExecOptions( options ); | 153 | m_ipkg->setIpkgExecOptions( options ); |
154 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 154 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |
155 | 155 | ||
156 | QDialog::accept(); | 156 | QDialog::accept(); |
157 | } | 157 | } |
158 | 158 | ||
159 | void OIpkgConfigDlg::reject() | 159 | void OIpkgConfigDlg::reject() |
160 | { | 160 | { |
161 | if ( m_configs ) | 161 | if ( m_configs ) |
162 | delete m_configs; | 162 | delete m_configs; |
163 | } | 163 | } |
164 | 164 | ||
165 | void OIpkgConfigDlg::initServerWidget() | 165 | void OIpkgConfigDlg::initServerWidget() |
166 | { | 166 | { |
167 | m_serverWidget = new QWidget( this ); | 167 | m_serverWidget = new QWidget( this ); |
168 | 168 | ||
169 | // Initialize UI | 169 | // Initialize UI |
170 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 170 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
171 | QScrollView *sv = new QScrollView( m_serverWidget ); | 171 | QScrollView *sv = new QScrollView( m_serverWidget ); |
172 | vb->addWidget( sv, 0, 0 ); | 172 | vb->addWidget( sv, 0, 0 ); |
173 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 173 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
174 | sv->setFrameStyle( QFrame::NoFrame ); | 174 | sv->setFrameStyle( QFrame::NoFrame ); |
175 | QWidget *container = new QWidget( sv->viewport() ); | 175 | QWidget *container = new QWidget( sv->viewport() ); |
176 | sv->addChild( container ); | 176 | sv->addChild( container ); |
177 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 177 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
178 | 178 | ||
179 | m_serverList = new QListBox( container ); | 179 | m_serverList = new QListBox( container ); |
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." ) ); | 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." ) ); |
181 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 181 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
182 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); | 182 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerSelected(int)) ); |
183 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); | 183 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 2 ); |
184 | 184 | ||
185 | QPixmap pic; | 185 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
186 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 186 | tr( "New" ), container ); |
187 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); | 187 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
188 | btn->setMinimumHeight( AppLnk::smallIconSize() ); | ||
189 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | 188 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); |
190 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); | 189 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); |
191 | layout->addWidget( btn, 1, 0 ); | 190 | layout->addWidget( btn, 1, 0 ); |
192 | 191 | ||
193 | pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 192 | m_serverEditBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
194 | m_serverEditBtn = new QPushButton( pic, tr( "Edit" ), container ); | 193 | tr( "Edit" ), container ); |
195 | m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); | 194 | m_serverEditBtn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
196 | m_serverEditBtn->setEnabled( false ); | 195 | m_serverEditBtn->setEnabled( false ); |
197 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); | 196 | QWhatsThis::add( m_serverEditBtn, tr( "Tap here to edit the entry selected above." ) ); |
198 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); | 197 | connect( m_serverEditBtn, SIGNAL(clicked()), this, SLOT(slotServerEdit()) ); |
199 | layout->addWidget( m_serverEditBtn, 1, 1 ); | 198 | layout->addWidget( m_serverEditBtn, 1, 1 ); |
200 | 199 | ||
201 | pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 200 | m_serverDeleteBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
202 | m_serverDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); | 201 | tr( "Delete" ), container ); |
203 | m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); | 202 | m_serverDeleteBtn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
204 | m_serverDeleteBtn->setEnabled( false ); | 203 | m_serverDeleteBtn->setEnabled( false ); |
205 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); | 204 | QWhatsThis::add( m_serverDeleteBtn, tr( "Tap here to delete the entry selected above." ) ); |
206 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); | 205 | connect( m_serverDeleteBtn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); |
207 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); | 206 | layout->addWidget( m_serverDeleteBtn, 1, 2 ); |
208 | } | 207 | } |
209 | 208 | ||
210 | void OIpkgConfigDlg::initDestinationWidget() | 209 | void OIpkgConfigDlg::initDestinationWidget() |
211 | { | 210 | { |
212 | m_destWidget = new QWidget( this ); | 211 | m_destWidget = new QWidget( this ); |
213 | 212 | ||
214 | // Initialize UI | 213 | // Initialize UI |
215 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); | 214 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); |
216 | QScrollView *sv = new QScrollView( m_destWidget ); | 215 | QScrollView *sv = new QScrollView( m_destWidget ); |
217 | vb->addWidget( sv, 0, 0 ); | 216 | vb->addWidget( sv, 0, 0 ); |
218 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 217 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
219 | sv->setFrameStyle( QFrame::NoFrame ); | 218 | sv->setFrameStyle( QFrame::NoFrame ); |
220 | QWidget *container = new QWidget( sv->viewport() ); | 219 | QWidget *container = new QWidget( sv->viewport() ); |
221 | sv->addChild( container ); | 220 | sv->addChild( container ); |
222 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); | 221 | QGridLayout *layout = new QGridLayout( container, 2, 3, 2, 4 ); |
223 | 222 | ||
224 | m_destList = new QListBox( container ); | 223 | m_destList = new QListBox( container ); |
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." ) ); | 224 | 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." ) ); |
226 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 225 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
227 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); | 226 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestSelected(int)) ); |
228 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); | 227 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 2 ); |
229 | 228 | ||
230 | QPixmap pic; | 229 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
231 | pic.convertFromImage( Resource::loadImage( "new" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 230 | tr( "New" ), container ); |
232 | QPushButton *btn = new QPushButton( pic, tr( "New" ), container ); | 231 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
233 | btn->setMinimumHeight( AppLnk::smallIconSize() ); | ||
234 | 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." ) ); |
235 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); | 233 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); |
236 | layout->addWidget( btn, 1, 0 ); | 234 | layout->addWidget( btn, 1, 0 ); |
237 | 235 | ||
238 | pic.convertFromImage( Resource::loadImage( "edit" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 236 | m_destEditBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), |
239 | m_destEditBtn = new QPushButton( pic, tr( "Edit" ), container ); | 237 | tr( "Edit" ), container ); |
240 | m_destEditBtn->setMinimumHeight( AppLnk::smallIconSize() ); | 238 | m_destEditBtn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
241 | m_destEditBtn->setEnabled( false ); | 239 | m_destEditBtn->setEnabled( false ); |
242 | 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." ) ); |
243 | connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); | 241 | connect( m_destEditBtn, SIGNAL(clicked()), this, SLOT(slotDestEdit()) ); |
244 | layout->addWidget( m_destEditBtn, 1, 1 ); | 242 | layout->addWidget( m_destEditBtn, 1, 1 ); |
245 | 243 | ||
246 | pic.convertFromImage( Resource::loadImage( "trash" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 244 | m_destDeleteBtn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), |
247 | m_destDeleteBtn = new QPushButton( pic, tr( "Delete" ), container ); | 245 | tr( "Delete" ), container ); |
248 | m_destDeleteBtn->setMinimumHeight( AppLnk::smallIconSize() ); | 246 | m_destDeleteBtn->setMinimumHeight( AppLnk::smallIconSize()+4 ); |
249 | m_destDeleteBtn->setEnabled( false ); | 247 | m_destDeleteBtn->setEnabled( false ); |
250 | 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." ) ); |
251 | connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); | 249 | connect( m_destDeleteBtn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); |
252 | layout->addWidget( m_destDeleteBtn, 1, 2 ); | 250 | layout->addWidget( m_destDeleteBtn, 1, 2 ); |
253 | } | 251 | } |
254 | 252 | ||
255 | void OIpkgConfigDlg::initProxyWidget() | 253 | void OIpkgConfigDlg::initProxyWidget() |
256 | { | 254 | { |
257 | m_proxyWidget = new QWidget( this ); | 255 | m_proxyWidget = new QWidget( this ); |
258 | 256 | ||
259 | // Initialize UI | 257 | // Initialize UI |
260 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); | 258 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); |
261 | QScrollView *sv = new QScrollView( m_proxyWidget ); | 259 | QScrollView *sv = new QScrollView( m_proxyWidget ); |
262 | vb->addWidget( sv, 0, 0 ); | 260 | vb->addWidget( sv, 0, 0 ); |
263 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 261 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
264 | sv->setFrameStyle( QFrame::NoFrame ); | 262 | sv->setFrameStyle( QFrame::NoFrame ); |
265 | QWidget *container = new QWidget( sv->viewport() ); | 263 | QWidget *container = new QWidget( sv->viewport() ); |
266 | sv->addChild( container ); | 264 | sv->addChild( container ); |
267 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); | 265 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); |
268 | 266 | ||
269 | // HTTP proxy server configuration | 267 | // HTTP proxy server configuration |
270 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 268 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
271 | grpbox->layout()->setSpacing( 2 ); | 269 | grpbox->layout()->setSpacing( 2 ); |
272 | grpbox->layout()->setMargin( 4 ); | 270 | grpbox->layout()->setMargin( 4 ); |
273 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 271 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
274 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 272 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
275 | m_proxyHttpServer = new QLineEdit( grpbox ); | 273 | m_proxyHttpServer = new QLineEdit( grpbox ); |
276 | 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." ) ); |
277 | grplayout->addWidget( m_proxyHttpServer ); | 275 | grplayout->addWidget( m_proxyHttpServer ); |
278 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 276 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
279 | 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." ) ); |
280 | grplayout->addWidget( m_proxyHttpActive ); | 278 | grplayout->addWidget( m_proxyHttpActive ); |
281 | 279 | ||
282 | // FTP proxy server configuration | 280 | // FTP proxy server configuration |
283 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 281 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
284 | grpbox->layout()->setSpacing( 2 ); | 282 | grpbox->layout()->setSpacing( 2 ); |
285 | grpbox->layout()->setMargin( 4 ); | 283 | grpbox->layout()->setMargin( 4 ); |
286 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); | 284 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); |
287 | grplayout = new QVBoxLayout( grpbox->layout() ); | 285 | grplayout = new QVBoxLayout( grpbox->layout() ); |
288 | m_proxyFtpServer = new QLineEdit( grpbox ); | 286 | m_proxyFtpServer = new QLineEdit( grpbox ); |
289 | 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." ) ); |
290 | grplayout->addWidget( m_proxyFtpServer ); | 288 | grplayout->addWidget( m_proxyFtpServer ); |
291 | m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 289 | m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
292 | 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." ) ); |
293 | grplayout->addWidget( m_proxyFtpActive ); | 291 | grplayout->addWidget( m_proxyFtpActive ); |
294 | 292 | ||
295 | // Proxy server username and password configuration | 293 | // Proxy server username and password configuration |
296 | QLabel *label = new QLabel( tr( "Username:" ), container ); | 294 | QLabel *label = new QLabel( tr( "Username:" ), container ); |
297 | 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." ) ); |
298 | layout->addWidget( label, 2, 0 ); | 296 | layout->addWidget( label, 2, 0 ); |
299 | m_proxyUsername = new QLineEdit( container ); | 297 | m_proxyUsername = new QLineEdit( container ); |
300 | 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." ) ); |
301 | layout->addWidget( m_proxyUsername, 2, 1 ); | 299 | layout->addWidget( m_proxyUsername, 2, 1 ); |
302 | 300 | ||
303 | label = new QLabel( tr( "Password:" ), container ); | 301 | label = new QLabel( tr( "Password:" ), container ); |
304 | 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." ) ); |
305 | layout->addWidget( label, 3, 0 ); | 303 | layout->addWidget( label, 3, 0 ); |
306 | m_proxyPassword = new QLineEdit( container ); | 304 | m_proxyPassword = new QLineEdit( container ); |
307 | 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." ) ); |
308 | layout->addWidget( m_proxyPassword, 3, 1 ); | 306 | layout->addWidget( m_proxyPassword, 3, 1 ); |
309 | } | 307 | } |
310 | 308 | ||
311 | void OIpkgConfigDlg::initOptionsWidget() | 309 | void OIpkgConfigDlg::initOptionsWidget() |
312 | { | 310 | { |
313 | m_optionsWidget = new QWidget( this ); | 311 | m_optionsWidget = new QWidget( this ); |
314 | 312 | ||
315 | // Initialize UI | 313 | // Initialize UI |
316 | QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); | 314 | QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); |
317 | QScrollView *sv = new QScrollView( m_optionsWidget ); | 315 | QScrollView *sv = new QScrollView( m_optionsWidget ); |
318 | vb->addWidget( sv, 0, 0 ); | 316 | vb->addWidget( sv, 0, 0 ); |
319 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 317 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
320 | sv->setFrameStyle( QFrame::NoFrame ); | 318 | sv->setFrameStyle( QFrame::NoFrame ); |
321 | QWidget *container = new QWidget( sv->viewport() ); | 319 | QWidget *container = new QWidget( sv->viewport() ); |
322 | sv->addChild( container ); | 320 | sv->addChild( container ); |
323 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); | 321 | QGridLayout *layout = new QGridLayout( container, 8, 2, 2, 4 ); |
324 | 322 | ||
325 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); | 323 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); |
326 | 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." ) ); |
327 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); | 325 | layout->addMultiCellWidget( m_optForceDepends, 0, 0, 0, 1 ); |
328 | 326 | ||
329 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); | 327 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); |
330 | 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." ) ); |
331 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); | 329 | layout->addMultiCellWidget( m_optForceReinstall, 1, 1, 0, 1 ); |
332 | 330 | ||
333 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); | 331 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); |
334 | 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." ) ); |
335 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); | 333 | layout->addMultiCellWidget( m_optForceRemove, 2, 2, 0, 1 ); |
336 | 334 | ||
337 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); | 335 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); |
338 | 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." ) ); |
339 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); | 337 | layout->addMultiCellWidget( m_optForceOverwrite, 3, 3, 0, 1 ); |
340 | 338 | ||
341 | QLabel *l = new QLabel( tr( "Information level:" ), container ); | 339 | QLabel *l = new QLabel( tr( "Information level:" ), container ); |
342 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | 340 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); |
343 | layout->addMultiCellWidget( l, 4, 4, 0, 1 ); | 341 | layout->addMultiCellWidget( l, 4, 4, 0, 1 ); |
344 | 342 | ||
345 | m_optVerboseIpkg = new QComboBox( container ); | 343 | m_optVerboseIpkg = new QComboBox( container ); |
346 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); | 344 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); |
347 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); | 345 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); |
348 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); | 346 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); |
349 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); | 347 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); |
350 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 348 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
351 | layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); | 349 | layout->addMultiCellWidget( m_optVerboseIpkg, 5, 5, 0, 1 ); |
352 | 350 | ||
353 | l = new QLabel( tr( "Package source lists directory:" ), container ); | 351 | l = new QLabel( tr( "Package source lists directory:" ), container ); |
354 | 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." ) ); |
355 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); | 353 | layout->addMultiCellWidget( l, 6, 6, 0, 1 ); |
356 | 354 | ||
357 | m_optSourceLists = new QLineEdit( container ); | 355 | m_optSourceLists = new QLineEdit( container ); |
358 | 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." ) ); |
359 | layout->addWidget( m_optSourceLists, 7, 0 ); | 357 | layout->addWidget( m_optSourceLists, 7, 0 ); |
360 | QPixmap pic; | 358 | |
361 | pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 359 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), |
362 | QPushButton *btn = new QPushButton( pic, QString::null, container ); | 360 | QString::null, container ); |
361 | btn->setMinimumHeight( AppLnk::smallIconSize()+4 ); | ||
363 | btn->setMaximumWidth( btn->height() ); | 362 | btn->setMaximumWidth( btn->height() ); |
364 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); | 363 | QWhatsThis::add( btn, tr( "Tap here to select the directory where package source feed information is stored." ) ); |
365 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); | 364 | connect( btn, SIGNAL(clicked()), this, SLOT(slotOptSelectSourceListsPath()) ); |
366 | layout->addWidget( btn, 7, 1 ); | 365 | layout->addWidget( btn, 7, 1 ); |
367 | 366 | ||
368 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 367 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
369 | } | 368 | } |
370 | 369 | ||
371 | void OIpkgConfigDlg::initData() | 370 | void OIpkgConfigDlg::initData() |
372 | { | 371 | { |
373 | // Read ipkg configuration (server/destination/proxy) information | 372 | // Read ipkg configuration (server/destination/proxy) information |
374 | if ( m_ipkg && !m_installOptions ) | 373 | if ( m_ipkg && !m_installOptions ) |
375 | { | 374 | { |
376 | m_configs = m_ipkg->configItems(); | 375 | m_configs = m_ipkg->configItems(); |
377 | if ( m_configs ) | 376 | if ( m_configs ) |
378 | { | 377 | { |
379 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) | 378 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) |
380 | { | 379 | { |
381 | OConfItem *config = configIt.current(); | 380 | OConfItem *config = configIt.current(); |
382 | 381 | ||
383 | // Add configuration item to the appropriate dialog controls | 382 | // Add configuration item to the appropriate dialog controls |
384 | if ( config ) | 383 | if ( config ) |
385 | { | 384 | { |
386 | switch ( config->type() ) | 385 | switch ( config->type() ) |
387 | { | 386 | { |
388 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; | 387 | case OConfItem::Source : m_serverList->insertItem( config->name() ); break; |
389 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; | 388 | case OConfItem::Destination : m_destList->insertItem( config->name() ); break; |
390 | case OConfItem::Option : | 389 | case OConfItem::Option : |
391 | { | 390 | { |
392 | if ( config->name() == "http_proxy" ) | 391 | if ( config->name() == "http_proxy" ) |
393 | { | 392 | { |
394 | m_proxyHttpServer->setText( config->value() ); | 393 | m_proxyHttpServer->setText( config->value() ); |
395 | m_proxyHttpActive->setChecked( config->active() ); | 394 | m_proxyHttpActive->setChecked( config->active() ); |
396 | } | 395 | } |
397 | else if ( config->name() == "ftp_proxy" ) | 396 | else if ( config->name() == "ftp_proxy" ) |
398 | { | 397 | { |
399 | m_proxyFtpServer->setText( config->value() ); | 398 | m_proxyFtpServer->setText( config->value() ); |
400 | m_proxyFtpActive->setChecked( config->active() ); | 399 | m_proxyFtpActive->setChecked( config->active() ); |
401 | } | 400 | } |
402 | else if ( config->name() == "proxy_username" ) | 401 | else if ( config->name() == "proxy_username" ) |
403 | { | 402 | { |
404 | m_proxyUsername->setText( config->value() ); | 403 | m_proxyUsername->setText( config->value() ); |
405 | } | 404 | } |
406 | else if ( config->name() == "proxy_password" ) | 405 | else if ( config->name() == "proxy_password" ) |
407 | { | 406 | { |
408 | m_proxyPassword->setText( config->value() ); | 407 | m_proxyPassword->setText( config->value() ); |
409 | } | 408 | } |
410 | } | 409 | } |
411 | break; | 410 | break; |
412 | case OConfItem::Other : | 411 | case OConfItem::Other : |
413 | { | 412 | { |
414 | if ( config->name() == "lists_dir" ) | 413 | if ( config->name() == "lists_dir" ) |
415 | m_optSourceLists->setText( config->value() ); | 414 | m_optSourceLists->setText( config->value() ); |
416 | else // TODO - use proper libipkg define | 415 | else // TODO - use proper libipkg define |
417 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); | 416 | m_optSourceLists->setText( "/usr/lib/ipkg/lists" ); |
418 | } | 417 | } |
419 | break; | 418 | break; |
420 | default : break; | 419 | default : break; |
421 | }; | 420 | }; |
422 | } | 421 | } |
423 | } | 422 | } |
424 | } | 423 | } |
425 | } | 424 | } |
426 | 425 | ||
427 | // Get Ipkg execution options | 426 | // Get Ipkg execution options |
428 | int options = m_ipkg->ipkgExecOptions(); | 427 | int options = m_ipkg->ipkgExecOptions(); |
429 | if ( options & FORCE_DEPENDS ) | 428 | if ( options & FORCE_DEPENDS ) |
430 | m_optForceDepends->setChecked( true ); | 429 | m_optForceDepends->setChecked( true ); |
431 | if ( options & FORCE_REINSTALL ) | 430 | if ( options & FORCE_REINSTALL ) |
432 | m_optForceReinstall->setChecked( true ); | 431 | m_optForceReinstall->setChecked( true ); |
433 | if ( options & FORCE_REMOVE ) | 432 | if ( options & FORCE_REMOVE ) |
434 | m_optForceRemove->setChecked( true ); | 433 | m_optForceRemove->setChecked( true ); |
435 | if ( options & FORCE_OVERWRITE ) | 434 | if ( options & FORCE_OVERWRITE ) |
436 | m_optForceOverwrite->setChecked( true ); | 435 | m_optForceOverwrite->setChecked( true ); |
437 | 436 | ||
438 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 437 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
439 | } | 438 | } |
440 | 439 | ||
441 | void OIpkgConfigDlg::slotServerSelected( int index ) | 440 | void OIpkgConfigDlg::slotServerSelected( int index ) |
442 | { | 441 | { |
443 | m_serverCurrent = index; | 442 | m_serverCurrent = index; |
444 | 443 | ||
445 | // Enable Edit and Delete buttons | 444 | // Enable Edit and Delete buttons |
446 | m_serverEditBtn->setEnabled( true ); | 445 | m_serverEditBtn->setEnabled( true ); |
447 | m_serverDeleteBtn->setEnabled( true ); | 446 | m_serverDeleteBtn->setEnabled( true ); |
448 | } | 447 | } |
449 | 448 | ||
450 | void OIpkgConfigDlg::slotServerNew() | 449 | void OIpkgConfigDlg::slotServerNew() |
451 | { | 450 | { |
452 | OConfItem *server = new OConfItem( OConfItem::Source ); | 451 | OConfItem *server = new OConfItem( OConfItem::Source ); |
453 | 452 | ||
454 | OIpkgServerDlg dlg( server, this ); | 453 | OIpkgServerDlg dlg( server, this ); |
455 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 454 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
456 | { | 455 | { |
457 | // Add to configuration option list | 456 | // Add to configuration option list |
458 | m_configs->append( server ); | 457 | m_configs->append( server ); |
459 | m_configs->sort(); | 458 | m_configs->sort(); |
460 | 459 | ||
461 | // Add to server list | 460 | // Add to server list |
462 | m_serverList->insertItem( server->name() ); | 461 | m_serverList->insertItem( server->name() ); |
463 | m_serverList->setCurrentItem( m_serverList->count() ); | 462 | m_serverList->setCurrentItem( m_serverList->count() ); |
464 | } | 463 | } |
465 | else | 464 | else |
466 | delete server; | 465 | delete server; |
467 | } | 466 | } |
468 | 467 | ||
469 | void OIpkgConfigDlg::slotServerEdit() | 468 | void OIpkgConfigDlg::slotServerEdit() |
470 | { | 469 | { |
471 | // Find selected server in list | 470 | // Find selected server in list |
472 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); | 471 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
473 | 472 | ||
474 | // Edit server | 473 | // Edit server |
475 | if ( server ) | 474 | if ( server ) |
476 | { | 475 | { |
477 | QString origName = server->name(); | 476 | QString origName = server->name(); |
478 | OIpkgServerDlg dlg( server, this ); | 477 | OIpkgServerDlg dlg( server, this ); |
479 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 478 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
480 | { | 479 | { |
481 | // Check to see if name has changed, if so update the server list | 480 | // Check to see if name has changed, if so update the server list |
482 | if ( server->name() != origName ) | 481 | if ( server->name() != origName ) |
483 | m_serverList->changeItem( server->name(), m_serverCurrent ); | 482 | m_serverList->changeItem( server->name(), m_serverCurrent ); |
484 | } | 483 | } |
485 | } | 484 | } |
486 | } | 485 | } |
487 | 486 | ||
488 | void OIpkgConfigDlg::slotServerDelete() | 487 | void OIpkgConfigDlg::slotServerDelete() |
489 | { | 488 | { |
490 | // Find selected server in list | 489 | // Find selected server in list |
491 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); | 490 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
492 | 491 | ||
493 | // Delete server | 492 | // Delete server |
494 | if ( server ) | 493 | if ( server ) |
495 | { | 494 | { |
496 | m_configs->removeRef( server ); | 495 | m_configs->removeRef( server ); |
497 | m_serverList->removeItem( m_serverCurrent ); | 496 | m_serverList->removeItem( m_serverCurrent ); |
498 | } | 497 | } |
499 | } | 498 | } |
500 | 499 | ||
501 | void OIpkgConfigDlg::slotDestSelected( int index ) | 500 | void OIpkgConfigDlg::slotDestSelected( int index ) |
502 | { | 501 | { |
503 | m_destCurrent = index; | 502 | m_destCurrent = index; |
504 | 503 | ||
505 | // Enable Edit and Delete buttons | 504 | // Enable Edit and Delete buttons |
506 | m_destEditBtn->setEnabled( true ); | 505 | m_destEditBtn->setEnabled( true ); |
507 | m_destDeleteBtn->setEnabled( true ); | 506 | m_destDeleteBtn->setEnabled( true ); |
508 | } | 507 | } |
509 | 508 | ||
510 | void OIpkgConfigDlg::slotDestNew() | 509 | void OIpkgConfigDlg::slotDestNew() |
511 | { | 510 | { |
512 | OConfItem *dest = new OConfItem( OConfItem::Destination ); | 511 | OConfItem *dest = new OConfItem( OConfItem::Destination ); |
513 | 512 | ||
514 | OIpkgDestDlg dlg( dest, this ); | 513 | OIpkgDestDlg dlg( dest, this ); |
515 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 514 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
516 | { | 515 | { |
517 | // Add to configuration option list | 516 | // Add to configuration option list |
518 | m_configs->append( dest ); | 517 | m_configs->append( dest ); |
519 | m_configs->sort(); | 518 | m_configs->sort(); |
520 | 519 | ||
521 | // Add to destination list | 520 | // Add to destination list |
522 | m_destList->insertItem( dest->name() ); | 521 | m_destList->insertItem( dest->name() ); |
523 | m_destList->setCurrentItem( m_destList->count() ); | 522 | m_destList->setCurrentItem( m_destList->count() ); |
524 | } | 523 | } |
525 | else | 524 | else |
526 | delete dest; | 525 | delete dest; |
527 | } | 526 | } |
528 | 527 | ||
529 | void OIpkgConfigDlg::slotDestEdit() | 528 | void OIpkgConfigDlg::slotDestEdit() |
530 | { | 529 | { |
531 | // Find selected destination in list | 530 | // Find selected destination in list |
532 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); | 531 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
533 | 532 | ||
534 | // Edit destination | 533 | // Edit destination |
535 | if ( dest ) | 534 | if ( dest ) |
536 | { | 535 | { |
537 | QString origName = dest->name(); | 536 | QString origName = dest->name(); |
538 | OIpkgDestDlg dlg( dest, this ); | 537 | OIpkgDestDlg dlg( dest, this ); |
539 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 538 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
540 | { | 539 | { |
541 | // Check to see if name has changed, if so update the dest list | 540 | // Check to see if name has changed, if so update the dest list |
542 | if ( dest->name() != origName ) | 541 | if ( dest->name() != origName ) |
543 | m_destList->changeItem( dest->name(), m_destCurrent ); | 542 | m_destList->changeItem( dest->name(), m_destCurrent ); |
544 | } | 543 | } |
545 | } | 544 | } |
546 | } | 545 | } |
547 | 546 | ||
548 | void OIpkgConfigDlg::slotDestDelete() | 547 | void OIpkgConfigDlg::slotDestDelete() |
549 | { | 548 | { |
550 | // Find selected destination in list | 549 | // Find selected destination in list |
551 | OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); | 550 | OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
552 | 551 | ||
553 | // Delete destination | 552 | // Delete destination |
554 | if ( destination ) | 553 | if ( destination ) |
555 | { | 554 | { |
556 | m_configs->removeRef( destination ); | 555 | m_configs->removeRef( destination ); |
557 | m_destList->removeItem( m_destCurrent ); | 556 | m_destList->removeItem( m_destCurrent ); |
558 | } | 557 | } |
559 | } | 558 | } |
560 | 559 | ||
561 | void OIpkgConfigDlg::slotOptSelectSourceListsPath() | 560 | void OIpkgConfigDlg::slotOptSelectSourceListsPath() |
562 | { | 561 | { |
563 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() ); | 562 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_optSourceLists->text() ); |
564 | if ( path.at( path.length() - 1 ) == '/' ) | 563 | if ( path.at( path.length() - 1 ) == '/' ) |
565 | path.truncate( path.length() - 1 ); | 564 | path.truncate( path.length() - 1 ); |
566 | if ( !path.isNull() ) | 565 | if ( !path.isNull() ) |
567 | m_optSourceLists->setText( path ); | 566 | m_optSourceLists->setText( path ); |
568 | } | 567 | } |
569 | 568 | ||
570 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) | 569 | OIpkgServerDlg::OIpkgServerDlg( OConfItem *server, QWidget *parent ) |
571 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 570 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
572 | , m_server( server ) | 571 | , m_server( server ) |
573 | { | 572 | { |
574 | setCaption( tr( "Edit Server" ) ); | 573 | setCaption( tr( "Edit Server" ) ); |
575 | 574 | ||
576 | // Initialize UI | 575 | // Initialize UI |
577 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 576 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
578 | 577 | ||
579 | m_active = new QCheckBox( tr( "Active" ), this ); | 578 | m_active = new QCheckBox( tr( "Active" ), this ); |
580 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | 579 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); |
581 | layout->addWidget( m_active ); | 580 | layout->addWidget( m_active ); |
582 | 581 | ||
583 | layout->addStretch(); | 582 | layout->addStretch(); |
584 | 583 | ||
585 | QLabel *label = new QLabel( tr( "Name:" ), this ); | 584 | QLabel *label = new QLabel( tr( "Name:" ), this ); |
586 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | 585 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); |
587 | layout->addWidget( label ); | 586 | layout->addWidget( label ); |
588 | m_name = new QLineEdit( this ); | 587 | m_name = new QLineEdit( this ); |
589 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); | 588 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); |
590 | layout->addWidget( m_name ); | 589 | layout->addWidget( m_name ); |
591 | 590 | ||
592 | layout->addStretch(); | 591 | layout->addStretch(); |
593 | 592 | ||
594 | label = new QLabel( tr( "Address:" ), this ); | 593 | label = new QLabel( tr( "Address:" ), this ); |
595 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); | 594 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); |
596 | layout->addWidget( label ); | 595 | layout->addWidget( label ); |
597 | m_location = new QLineEdit( this ); | 596 | m_location = new QLineEdit( this ); |
598 | QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); | 597 | QWhatsThis::add( m_location, tr( "Enter the URL address of this entry here." ) ); |
599 | layout->addWidget( m_location ); | 598 | layout->addWidget( m_location ); |
600 | 599 | ||
601 | layout->addStretch(); | 600 | layout->addStretch(); |
602 | 601 | ||
603 | m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); | 602 | m_compressed = new QCheckBox( tr( "Compressed server feed" ), this ); |
604 | QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); | 603 | QWhatsThis::add( m_compressed, tr( "Tap here to indicate whether the server support compressed archives or not." ) ); |
605 | layout->addWidget( m_compressed ); | 604 | layout->addWidget( m_compressed ); |
606 | 605 | ||
607 | // Populate initial information | 606 | // Populate initial information |
608 | if ( m_server ) | 607 | if ( m_server ) |
609 | { | 608 | { |
610 | m_name->setText( m_server->name() ); | 609 | m_name->setText( m_server->name() ); |
611 | m_location->setText( m_server->value() ); | 610 | m_location->setText( m_server->value() ); |
612 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); | 611 | m_compressed->setChecked( m_server->features().contains( "Compressed" ) ); |
613 | m_active->setChecked( m_server->active() ); | 612 | m_active->setChecked( m_server->active() ); |
614 | } | 613 | } |
615 | } | 614 | } |
616 | 615 | ||
617 | void OIpkgServerDlg::accept() | 616 | void OIpkgServerDlg::accept() |
618 | { | 617 | { |
619 | // Save information entered | 618 | // Save information entered |
620 | QString name = m_name->text(); | 619 | QString name = m_name->text(); |
621 | name.replace( QRegExp( " " ), "_" ); | 620 | name.replace( QRegExp( " " ), "_" ); |
622 | m_server->setName( name ); | 621 | m_server->setName( name ); |
623 | m_server->setValue( m_location->text() ); | 622 | m_server->setValue( m_location->text() ); |
624 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) | 623 | m_compressed->isChecked() ? m_server->setFeatures( "Compressed" ) |
625 | : m_server->setFeatures( QString::null ); | 624 | : m_server->setFeatures( QString::null ); |
626 | m_server->setActive( m_active->isChecked() ); | 625 | m_server->setActive( m_active->isChecked() ); |
627 | 626 | ||
628 | QDialog::accept(); | 627 | QDialog::accept(); |
629 | } | 628 | } |
630 | 629 | ||
631 | OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) | 630 | OIpkgDestDlg::OIpkgDestDlg( OConfItem *dest, QWidget *parent ) |
632 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) | 631 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
633 | , m_dest( dest ) | 632 | , m_dest( dest ) |
634 | { | 633 | { |
635 | setCaption( tr( "Edit Destination" ) ); | 634 | setCaption( tr( "Edit Destination" ) ); |
636 | 635 | ||
637 | // Initialize UI | 636 | // Initialize UI |
638 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); | 637 | QVBoxLayout *layout = new QVBoxLayout( this, 2, 4 ); |
639 | 638 | ||
640 | m_active = new QCheckBox( tr( "Active" ), this ); | 639 | m_active = new QCheckBox( tr( "Active" ), this ); |
641 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); | 640 | QWhatsThis::add( m_active, tr( "Tap here to indicate whether this entry is active or not." ) ); |
642 | layout->addWidget( m_active ); | 641 | layout->addWidget( m_active ); |
643 | 642 | ||
644 | layout->addStretch(); | 643 | layout->addStretch(); |
645 | 644 | ||
646 | QLabel *label = new QLabel( tr( "Name:" ), this ); | 645 | QLabel *label = new QLabel( tr( "Name:" ), this ); |
647 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | 646 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); |
648 | layout->addWidget( label ); | 647 | layout->addWidget( label ); |
649 | m_name = new QLineEdit( this ); | 648 | m_name = new QLineEdit( this ); |
650 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); | 649 | QWhatsThis::add( m_name, tr( "Enter the name of this entry here." ) ); |
651 | layout->addWidget( m_name ); | 650 | layout->addWidget( m_name ); |
652 | 651 | ||
653 | layout->addStretch(); | 652 | layout->addStretch(); |
654 | 653 | ||
655 | label = new QLabel( tr( "Location:" ), this ); | 654 | label = new QLabel( tr( "Location:" ), this ); |
656 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); | 655 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); |
657 | layout->addWidget( label ); | 656 | layout->addWidget( label ); |
658 | 657 | ||
659 | QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); | 658 | QHBoxLayout *layout2 = new QHBoxLayout( this, 2, 4 ); |
660 | layout->addLayout( layout2 ); | 659 | layout->addLayout( layout2 ); |
661 | 660 | ||
662 | m_location = new QLineEdit( this ); | 661 | m_location = new QLineEdit( this ); |
663 | QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); | 662 | QWhatsThis::add( m_location, tr( "Enter the absolute directory path of this entry here." ) ); |
664 | layout2->addWidget( m_location ); | 663 | layout2->addWidget( m_location ); |
665 | QPixmap pic; | 664 | QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "folder", Opie::Core::OResource::SmallIcon ), |
666 | pic.convertFromImage( Resource::loadImage( "folder" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | 665 | QString::null, this ); |
667 | QPushButton *btn = new QPushButton( pic, QString::null, this ); | ||
668 | btn->setMaximumWidth( btn->height() ); | 666 | btn->setMaximumWidth( btn->height() ); |
669 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); | 667 | QWhatsThis::add( btn, tr( "Tap here to select the desired location." ) ); |
670 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); | 668 | connect( btn, SIGNAL(clicked()), this, SLOT(slotSelectPath()) ); |
671 | layout2->addWidget( btn ); | 669 | layout2->addWidget( btn ); |
672 | 670 | ||
673 | // Populate initial information | 671 | // Populate initial information |
674 | if ( m_dest ) | 672 | if ( m_dest ) |
675 | { | 673 | { |
676 | m_name->setText( m_dest->name() ); | 674 | m_name->setText( m_dest->name() ); |
677 | m_location->setText( m_dest->value() ); | 675 | m_location->setText( m_dest->value() ); |
678 | m_active->setChecked( m_dest->active() ); | 676 | m_active->setChecked( m_dest->active() ); |
679 | } | 677 | } |
680 | } | 678 | } |
681 | 679 | ||
682 | void OIpkgDestDlg::accept() | 680 | void OIpkgDestDlg::accept() |
683 | { | 681 | { |
684 | // Save information entered | 682 | // Save information entered |
685 | QString name = m_name->text(); | 683 | QString name = m_name->text(); |
686 | name.replace( QRegExp( " " ), "_" ); | 684 | name.replace( QRegExp( " " ), "_" ); |
687 | m_dest->setName( name ); | 685 | m_dest->setName( name ); |
688 | m_dest->setValue( m_location->text() ); | 686 | m_dest->setValue( m_location->text() ); |
689 | m_dest->setActive( m_active->isChecked() ); | 687 | m_dest->setActive( m_active->isChecked() ); |
690 | 688 | ||
691 | QDialog::accept(); | 689 | QDialog::accept(); |
692 | } | 690 | } |
693 | 691 | ||
694 | void OIpkgDestDlg::slotSelectPath() | 692 | void OIpkgDestDlg::slotSelectPath() |
695 | { | 693 | { |
696 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); | 694 | QString path = Opie::Ui::OFileDialog::getDirectory( 0, m_location->text() ); |
697 | if ( path.at( path.length() - 1 ) == '/' ) | 695 | if ( path.at( path.length() - 1 ) == '/' ) |
698 | path.truncate( path.length() - 1 ); | 696 | path.truncate( path.length() - 1 ); |
699 | if ( !path.isNull() ) | 697 | if ( !path.isNull() ) |
700 | m_location->setText( path ); | 698 | m_location->setText( path ); |
701 | } | 699 | } |
702 | 700 | ||
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp index e034f34..8b1b203 100644 --- a/noncore/settings/packagemanager/packageinfodlg.cpp +++ b/noncore/settings/packagemanager/packageinfodlg.cpp | |||
@@ -1,154 +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)2004, 2005 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 | */ | 29 | */ |
30 | 30 | ||
31 | #include "packageinfodlg.h" | 31 | #include "packageinfodlg.h" |
32 | #include "opackage.h" | 32 | #include "opackage.h" |
33 | #include "opackagemanager.h" | 33 | #include "opackagemanager.h" |
34 | 34 | ||
35 | #include <opie2/oresource.h> | ||
35 | #include <opie2/otabwidget.h> | 36 | #include <opie2/otabwidget.h> |
36 | 37 | ||
37 | #include <qpe/resource.h> | ||
38 | |||
39 | #include <qlayout.h> | 38 | #include <qlayout.h> |
40 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
41 | #include <qwhatsthis.h> | 40 | #include <qwhatsthis.h> |
42 | 41 | ||
43 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) | 42 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) |
44 | : QWidget( 0l ) | 43 | : QWidget( 0l ) |
45 | , m_packman( pm ) | 44 | , m_packman( pm ) |
46 | , m_information( this ) | 45 | , m_information( this ) |
47 | , m_files( this ) | 46 | , m_files( this ) |
48 | , m_retrieveFiles( 0l ) | 47 | , m_retrieveFiles( 0l ) |
49 | { | 48 | { |
50 | // Initialize UI | 49 | // Initialize UI |
51 | if ( parent ) | 50 | if ( parent ) |
52 | parent->setCaption( package ); | 51 | parent->setCaption( package ); |
53 | 52 | ||
54 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); | 53 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); |
55 | 54 | ||
56 | Opie::Ui::OTabWidget *tabWidget = new Opie::Ui::OTabWidget( this ); | 55 | Opie::Ui::OTabWidget *tabWidget = new Opie::Ui::OTabWidget( this ); |
57 | layout->addWidget( tabWidget ); | 56 | layout->addWidget( tabWidget ); |
58 | 57 | ||
59 | // Information tab | 58 | // Information tab |
60 | QWhatsThis::add( &m_information, tr( "This area contains information about the package." ) ); | 59 | QWhatsThis::add( &m_information, tr( "This area contains information about the package." ) ); |
61 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); | 60 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); |
62 | m_information.setReadOnly( true ); | 61 | m_information.setReadOnly( true ); |
63 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); | 62 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); |
64 | 63 | ||
65 | // Retrive package information | 64 | // Retrive package information |
66 | m_package = m_packman->findPackage( package ); | 65 | m_package = m_packman->findPackage( package ); |
67 | if ( !m_package ) | 66 | if ( !m_package ) |
68 | { | 67 | { |
69 | m_information.setText( tr( "Unable to retrieve package information." ) ); | 68 | m_information.setText( tr( "Unable to retrieve package information." ) ); |
70 | return; | 69 | return; |
71 | } | 70 | } |
72 | 71 | ||
73 | // Display package information | 72 | // Display package information |
74 | if ( !m_package->information().isNull() ) | 73 | if ( !m_package->information().isNull() ) |
75 | m_information.setText( m_package->information() ); | 74 | m_information.setText( m_package->information() ); |
76 | else | 75 | else |
77 | { | 76 | { |
78 | // Package information is not cached, retrieve it | 77 | // Package information is not cached, retrieve it |
79 | QStringList list( package ); | 78 | QStringList list( package ); |
80 | m_packman->executeCommand( OPackage::Info, list, QString::null, | 79 | m_packman->executeCommand( OPackage::Info, list, QString::null, |
81 | this, SLOT(slotInfo(const QString &)), true ); | 80 | this, SLOT(slotInfo(const QString &)), true ); |
82 | } | 81 | } |
83 | 82 | ||
84 | // Files tab (display only if package is installed) | 83 | // Files tab (display only if package is installed) |
85 | if ( !m_package->versionInstalled().isNull() ) | 84 | if ( !m_package->versionInstalled().isNull() ) |
86 | { | 85 | { |
87 | QWidget *filesWidget = new QWidget( tabWidget ); | 86 | QWidget *filesWidget = new QWidget( tabWidget ); |
88 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); | 87 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); |
89 | QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) ); | 88 | QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) ); |
90 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); | 89 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); |
91 | m_files.setReadOnly( true ); | 90 | m_files.setReadOnly( true ); |
92 | filesLayout->addWidget( &m_files ); | 91 | filesLayout->addWidget( &m_files ); |
93 | 92 | ||
94 | // If file list is already cached, display | 93 | // If file list is already cached, display |
95 | if ( !m_package->files().isNull() ) | 94 | if ( !m_package->files().isNull() ) |
96 | m_files.setText( m_package->files() ); | 95 | m_files.setText( m_package->files() ); |
97 | else | 96 | else |
98 | { | 97 | { |
99 | m_retrieveFiles = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), | 98 | m_retrieveFiles = new QPushButton( Opie::Core::OResource::loadPixmap( "packagemanager/apply", |
100 | tr( "Retrieve file list" ), filesWidget ); | 99 | Opie::Core::OResource::SmallIcon ), tr( "Retrieve file list" ), |
100 | filesWidget ); | ||
101 | 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." ) ); |
102 | filesLayout->addWidget( m_retrieveFiles ); | 102 | filesLayout->addWidget( m_retrieveFiles ); |
103 | connect( m_retrieveFiles, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); | 103 | connect( m_retrieveFiles, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); |
104 | } | 104 | } |
105 | 105 | ||
106 | tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); | 106 | tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); |
107 | tabWidget->setCurrentTab( tr( "Information" ) ); | 107 | tabWidget->setCurrentTab( tr( "Information" ) ); |
108 | 108 | ||
109 | } | 109 | } |
110 | else | 110 | else |
111 | m_files.hide(); | 111 | m_files.hide(); |
112 | } | 112 | } |
113 | 113 | ||
114 | PackageInfoDlg::~PackageInfoDlg() | 114 | PackageInfoDlg::~PackageInfoDlg() |
115 | { | 115 | { |
116 | if ( !m_package ) | 116 | if ( !m_package ) |
117 | return; | 117 | return; |
118 | 118 | ||
119 | // Cache package information | 119 | // Cache package information |
120 | if ( !m_information.text().isNull() ) | 120 | if ( !m_information.text().isNull() ) |
121 | m_package->setInformation( m_information.text() ); | 121 | m_package->setInformation( m_information.text() ); |
122 | 122 | ||
123 | // Cache package file list | 123 | // Cache package file list |
124 | if ( !m_files.text().isEmpty() ) | 124 | if ( !m_files.text().isEmpty() ) |
125 | m_package->setFiles( m_files.text() ); | 125 | m_package->setFiles( m_files.text() ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void PackageInfoDlg::slotBtnFileScan() | 128 | void PackageInfoDlg::slotBtnFileScan() |
129 | { | 129 | { |
130 | m_files.clear(); | 130 | m_files.clear(); |
131 | 131 | ||
132 | QStringList list( m_package->name() ); | 132 | QStringList list( m_package->name() ); |
133 | m_packman->executeCommand( OPackage::Files, list, QString::null, | 133 | m_packman->executeCommand( OPackage::Files, list, QString::null, |
134 | this, SLOT(slotFiles(const QString &)), true ); | 134 | this, SLOT(slotFiles(const QString &)), true ); |
135 | 135 | ||
136 | if ( m_retrieveFiles ) | 136 | if ( m_retrieveFiles ) |
137 | m_retrieveFiles->hide(); | 137 | m_retrieveFiles->hide(); |
138 | } | 138 | } |
139 | 139 | ||
140 | void PackageInfoDlg::slotInfo( const QString &info ) | 140 | void PackageInfoDlg::slotInfo( const QString &info ) |
141 | { | 141 | { |
142 | m_information.append( info ); | 142 | m_information.append( info ); |
143 | } | 143 | } |
144 | 144 | ||
145 | void PackageInfoDlg::slotFiles( const QString &filelist ) | 145 | void PackageInfoDlg::slotFiles( const QString &filelist ) |
146 | { | 146 | { |
147 | QString str = filelist; | 147 | QString str = filelist; |
148 | 148 | ||
149 | // Skip first line of output ("Package xxx is installed...") | 149 | // Skip first line of output ("Package xxx is installed...") |
150 | if ( str.startsWith( "Package " ) ) | 150 | if ( str.startsWith( "Package " ) ) |
151 | str = str.right( str.length() - str.find( '\n' ) - 1 ); | 151 | str = str.right( str.length() - str.find( '\n' ) - 1 ); |
152 | 152 | ||
153 | m_files.append( str ); | 153 | m_files.append( str ); |
154 | } | 154 | } |