author | drw <drw> | 2004-04-21 17:43:18 (UTC) |
---|---|---|
committer | drw <drw> | 2004-04-21 17:43:18 (UTC) |
commit | d10e9746089964b7a1be59903c43b4f3364a9ee2 (patch) (unidiff) | |
tree | d146e4509d23a399fab47759f42fd891812f9d07 | |
parent | 8d6f6d769e945eac05c7089964d1e2c764f0ee7a (diff) | |
download | opie-d10e9746089964b7a1be59903c43b4f3364a9ee2.zip opie-d10e9746089964b7a1be59903c43b4f3364a9ee2.tar.gz opie-d10e9746089964b7a1be59903c43b4f3364a9ee2.tar.bz2 |
Added/fixed QWhatsThis and fixed a few labels in the config dialog
-rw-r--r-- | noncore/settings/packagemanager/filterdlg.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 28 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 41 |
3 files changed, 64 insertions, 21 deletions
diff --git a/noncore/settings/packagemanager/filterdlg.cpp b/noncore/settings/packagemanager/filterdlg.cpp index eeed398..70875bd 100644 --- a/noncore/settings/packagemanager/filterdlg.cpp +++ b/noncore/settings/packagemanager/filterdlg.cpp | |||
@@ -1,179 +1,189 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the OPIE Project | 2 | � � � � � � � � This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | � � � � � � �.=l. | 5 | � � � � � � �.=l. |
6 | � � � � � �.>+-= | 6 | � � � � � �.>+-= |
7 | �_;:, � � .> � �:=|. This file is free software; you can | 7 | �_;:, � � .> � �:=|. This file is free software; you can |
8 | .> <`_, � > �. � <= redistribute it and/or modify it under | 8 | .> <`_, � > �. � <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- � : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- � : the terms of the GNU General Public |
10 | .="- .-=="i, � � .._ License as published by the Free Software | 10 | .="- .-=="i, � � .._ License as published by the Free Software |
11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
12 | � � �._= =} � � � : or (at your option) any later version. | 12 | � � �._= =} � � � : or (at your option) any later version. |
13 | � � .%`+i> � � � _;_. | 13 | � � .%`+i> � � � _;_. |
14 | � � .i_,=:_. � � �-<s. This file is distributed in the hope that | 14 | � � .i_,=:_. � � �-<s. This file is distributed in the hope that |
15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
16 | � � : .. � �.:, � � . . . without even the implied warranty of | 16 | � � : .. � �.:, � � . . . without even the implied warranty of |
17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU General | 18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= � � � = � � � ; Public License for more details. | 19 | ..}^=.= � � � = � � � ; Public License for more details. |
20 | ++= � -. � � .` � � .: | 20 | ++= � -. � � .` � � .: |
21 | �: � � = �...= . :.=- You should have received a copy of the GNU | 21 | �: � � = �...= . :.=- You should have received a copy of the GNU |
22 | �-. � .:....=;==+<; General Public License along with this file; | 22 | �-. � .:....=;==+<; General Public License along with this file; |
23 | � -_. . . � )=. �= see the file COPYING. If not, write to the | 23 | � -_. . . � )=. �= see the file COPYING. If not, write to the |
24 | � � -- � � � �:-=` Free Software Foundation, Inc., | 24 | � � -- � � � �:-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "filterdlg.h" | 30 | #include "filterdlg.h" |
31 | 31 | ||
32 | #include <qwhatsthis.h> | ||
33 | |||
32 | FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, | 34 | FilterDlg::FilterDlg( QWidget *parent, OPackageManager *pm, const QString &name, |
33 | const QString &server, const QString &destination, | 35 | const QString &server, const QString &destination, |
34 | OPackageManager::Status status, const QString &category ) | 36 | OPackageManager::Status status, const QString &category ) |
35 | : QDialog( parent, QString::null, true ) | 37 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
36 | { | 38 | { |
37 | setCaption( tr( "Filter packages" ) ); | 39 | setCaption( tr( "Filter packages" ) ); |
38 | 40 | ||
39 | QVBoxLayout *layout = new QVBoxLayout( this ); | 41 | QVBoxLayout *layout = new QVBoxLayout( this ); |
40 | QScrollView *sv = new QScrollView( this ); | 42 | QScrollView *sv = new QScrollView( this ); |
41 | layout->addWidget( sv, 0, 0 ); | 43 | layout->addWidget( sv, 0, 0 ); |
42 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 44 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
43 | sv->setFrameStyle( QFrame::NoFrame ); | 45 | sv->setFrameStyle( QFrame::NoFrame ); |
44 | QWidget *container = new QWidget( sv->viewport() ); | 46 | QWidget *container = new QWidget( sv->viewport() ); |
45 | sv->addChild( container ); | 47 | sv->addChild( container ); |
46 | layout = new QVBoxLayout( container, 4, 4 ); | 48 | layout = new QVBoxLayout( container, 4, 4 ); |
47 | 49 | ||
48 | // Category | 50 | // Category |
49 | m_categoryCB = new QCheckBox( tr( "Category:" ), container ); | 51 | m_categoryCB = new QCheckBox( tr( "Category:" ), container ); |
52 | QWhatsThis::add( m_categoryCB, tr( "Tap here to filter package list by application category." ) ); | ||
50 | connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); | 53 | connect( m_categoryCB, SIGNAL(toggled(bool)), this, SLOT(slotCategorySelected(bool)) ); |
51 | m_category = new QComboBox( container ); | 54 | m_category = new QComboBox( container ); |
55 | QWhatsThis::add( m_category, tr( "Select the application category to filter by here." ) ); | ||
52 | m_category->insertStringList( pm->categories() ); | 56 | m_category->insertStringList( pm->categories() ); |
53 | initItem( m_category, m_categoryCB, category ); | 57 | initItem( m_category, m_categoryCB, category ); |
54 | layout->addWidget( m_categoryCB ); | 58 | layout->addWidget( m_categoryCB ); |
55 | layout->addWidget( m_category ); | 59 | layout->addWidget( m_category ); |
56 | 60 | ||
57 | // Package name | 61 | // Package name |
58 | m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); | 62 | m_nameCB = new QCheckBox( tr( "Names containing:" ), container ); |
63 | QWhatsThis::add( m_nameCB, tr( "Tap here to filter package list by package name." ) ); | ||
59 | connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); | 64 | connect( m_nameCB, SIGNAL(toggled(bool)), this, SLOT(slotNameSelected(bool)) ); |
60 | m_name = new QLineEdit( name, container ); | 65 | m_name = new QLineEdit( name, container ); |
66 | QWhatsThis::add( m_name, tr( "Enter the package name to filter by here." ) ); | ||
61 | if ( !name.isNull() ) | 67 | if ( !name.isNull() ) |
62 | m_nameCB->setChecked( true ); | 68 | m_nameCB->setChecked( true ); |
63 | m_name->setEnabled( !name.isNull() ); | 69 | m_name->setEnabled( !name.isNull() ); |
64 | layout->addWidget( m_nameCB ); | 70 | layout->addWidget( m_nameCB ); |
65 | layout->addWidget( m_name ); | 71 | layout->addWidget( m_name ); |
66 | 72 | ||
67 | // Status | 73 | // Status |
68 | m_statusCB = new QCheckBox( tr( "With the status:" ), container ); | 74 | m_statusCB = new QCheckBox( tr( "With the status:" ), container ); |
75 | QWhatsThis::add( m_statusCB, tr( "Tap here to filter package list by the package status." ) ); | ||
69 | connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); | 76 | connect( m_statusCB, SIGNAL(toggled(bool)), this, SLOT(slotStatusSelected(bool)) ); |
70 | m_status = new QComboBox( container ); | 77 | m_status = new QComboBox( container ); |
78 | QWhatsThis::add( m_status, tr( "Select the package status to filter by here." ) ); | ||
71 | connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) ); | 79 | connect( m_status, SIGNAL(activated(const QString&)), this, SLOT(slotStatusChanged(const QString&)) ); |
72 | QString currStatus; | 80 | QString currStatus; |
73 | switch ( status ) | 81 | switch ( status ) |
74 | { | 82 | { |
75 | case OPackageManager::All : currStatus = tr( "All" ); | 83 | case OPackageManager::All : currStatus = tr( "All" ); |
76 | break; | 84 | break; |
77 | case OPackageManager::Installed : currStatus = tr( "Installed" ); | 85 | case OPackageManager::Installed : currStatus = tr( "Installed" ); |
78 | break; | 86 | break; |
79 | case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); | 87 | case OPackageManager::NotInstalled : currStatus = tr( "Not installed" ); |
80 | break; | 88 | break; |
81 | case OPackageManager::Updated : currStatus = tr( "Updated" ); | 89 | case OPackageManager::Updated : currStatus = tr( "Updated" ); |
82 | break; | 90 | break; |
83 | default : currStatus = QString::null; | 91 | default : currStatus = QString::null; |
84 | }; | 92 | }; |
85 | m_status->insertItem( tr( "All" ) ); | 93 | m_status->insertItem( tr( "All" ) ); |
86 | m_status->insertItem( tr( "Installed" ) ); | 94 | m_status->insertItem( tr( "Installed" ) ); |
87 | m_status->insertItem( tr( "Not installed" ) ); | 95 | m_status->insertItem( tr( "Not installed" ) ); |
88 | m_status->insertItem( tr( "Updated" ) ); | 96 | m_status->insertItem( tr( "Updated" ) ); |
89 | initItem( m_status, m_statusCB, currStatus ); | 97 | initItem( m_status, m_statusCB, currStatus ); |
90 | layout->addWidget( m_statusCB ); | 98 | layout->addWidget( m_statusCB ); |
91 | layout->addWidget( m_status ); | 99 | layout->addWidget( m_status ); |
92 | 100 | ||
93 | // Server | 101 | // Server |
94 | m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); | 102 | m_serverCB = new QCheckBox( tr( "Available from the following server:" ), container ); |
103 | QWhatsThis::add( m_serverCB, tr( "Tap here to filter package list by source server." ) ); | ||
95 | connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); | 104 | connect( m_serverCB, SIGNAL(toggled(bool)), this, SLOT(slotServerSelected(bool)) ); |
96 | m_server = new QComboBox( container ); | 105 | m_server = new QComboBox( container ); |
106 | QWhatsThis::add( m_server, tr( "Select the source server to filter by here." ) ); | ||
97 | m_server->insertStringList( *(pm->servers()) ); | 107 | m_server->insertStringList( *(pm->servers()) ); |
98 | initItem( m_server, m_serverCB, server ); | 108 | initItem( m_server, m_serverCB, server ); |
99 | layout->addWidget( m_serverCB ); | 109 | layout->addWidget( m_serverCB ); |
100 | layout->addWidget( m_server ); | 110 | layout->addWidget( m_server ); |
101 | 111 | ||
102 | // Destination | 112 | // Destination |
103 | m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); | 113 | m_destCB = new QCheckBox( tr( "Installed on device at:" ), container ); |
114 | QWhatsThis::add( m_destCB, tr( "Tap here to filter package list by destination where the package is installed to on this device." ) ); | ||
104 | connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); | 115 | connect( m_destCB, SIGNAL(toggled(bool)), this, SLOT(slotDestSelected(bool)) ); |
105 | m_destination = new QComboBox( container ); | 116 | m_destination = new QComboBox( container ); |
117 | QWhatsThis::add( m_destination, tr( "Select the destination location to filter by here." ) ); | ||
106 | m_destination->insertStringList( *(pm->destinations()) ); | 118 | m_destination->insertStringList( *(pm->destinations()) ); |
107 | initItem( m_destination, m_destCB, destination ); | 119 | initItem( m_destination, m_destCB, destination ); |
108 | layout->addWidget( m_destCB ); | 120 | layout->addWidget( m_destCB ); |
109 | layout->addWidget( m_destination ); | 121 | layout->addWidget( m_destination ); |
110 | |||
111 | //showMaximized(); | ||
112 | } | 122 | } |
113 | 123 | ||
114 | void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) | 124 | void FilterDlg::initItem( QComboBox *comboBox, QCheckBox *checkBox, const QString &selection ) |
115 | { | 125 | { |
116 | if ( !selection.isNull() ) | 126 | if ( !selection.isNull() ) |
117 | { | 127 | { |
118 | checkBox->setChecked( true ); | 128 | checkBox->setChecked( true ); |
119 | 129 | ||
120 | for ( int i = 0; i < comboBox->count(); i++ ) | 130 | for ( int i = 0; i < comboBox->count(); i++ ) |
121 | { | 131 | { |
122 | if ( comboBox->text( i ) == selection ) | 132 | if ( comboBox->text( i ) == selection ) |
123 | { | 133 | { |
124 | comboBox->setCurrentItem( i ); | 134 | comboBox->setCurrentItem( i ); |
125 | return; | 135 | return; |
126 | } | 136 | } |
127 | } | 137 | } |
128 | } | 138 | } |
129 | comboBox->setEnabled( !selection.isNull() ); | 139 | comboBox->setEnabled( !selection.isNull() ); |
130 | } | 140 | } |
131 | 141 | ||
132 | void FilterDlg::slotNameSelected( bool selected ) | 142 | void FilterDlg::slotNameSelected( bool selected ) |
133 | { | 143 | { |
134 | m_name->setEnabled( selected ); | 144 | m_name->setEnabled( selected ); |
135 | } | 145 | } |
136 | 146 | ||
137 | void FilterDlg::slotServerSelected( bool selected ) | 147 | void FilterDlg::slotServerSelected( bool selected ) |
138 | { | 148 | { |
139 | m_server->setEnabled( selected ); | 149 | m_server->setEnabled( selected ); |
140 | } | 150 | } |
141 | 151 | ||
142 | void FilterDlg::slotDestSelected( bool selected ) | 152 | void FilterDlg::slotDestSelected( bool selected ) |
143 | { | 153 | { |
144 | m_destination->setEnabled( selected ); | 154 | m_destination->setEnabled( selected ); |
145 | } | 155 | } |
146 | 156 | ||
147 | void FilterDlg::slotStatusSelected( bool selected ) | 157 | void FilterDlg::slotStatusSelected( bool selected ) |
148 | { | 158 | { |
149 | m_status->setEnabled( selected ); | 159 | m_status->setEnabled( selected ); |
150 | 160 | ||
151 | if ( !selected && !m_destCB->isEnabled() ) | 161 | if ( !selected && !m_destCB->isEnabled() ) |
152 | { | 162 | { |
153 | // If status check box has been deselected and destination option was previously deselected | 163 | // If status check box has been deselected and destination option was previously deselected |
154 | // (because status == "Not installed"), re-enable destination option | 164 | // (because status == "Not installed"), re-enable destination option |
155 | m_destCB->setEnabled( true ); | 165 | m_destCB->setEnabled( true ); |
156 | m_destination->setEnabled( true ); | 166 | m_destination->setEnabled( true ); |
157 | } | 167 | } |
158 | else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) ) | 168 | else if ( selected && m_destCB->isEnabled() && m_status->currentText() == tr( "Not installed" ) ) |
159 | { | 169 | { |
160 | // If status check box has been selected and status == "Not installed", disable destination option | 170 | // If status check box has been selected and status == "Not installed", disable destination option |
161 | m_destCB->setEnabled( false ); | 171 | m_destCB->setEnabled( false ); |
162 | m_destCB->setChecked( false ); | 172 | m_destCB->setChecked( false ); |
163 | m_destination->setEnabled( false ); | 173 | m_destination->setEnabled( false ); |
164 | } | 174 | } |
165 | } | 175 | } |
166 | 176 | ||
167 | void FilterDlg::slotStatusChanged( const QString &category ) | 177 | void FilterDlg::slotStatusChanged( const QString &category ) |
168 | { | 178 | { |
169 | bool notInstalled = ( category == tr( "Not installed" ) ); | 179 | bool notInstalled = ( category == tr( "Not installed" ) ); |
170 | m_destCB->setEnabled( !notInstalled ); | 180 | m_destCB->setEnabled( !notInstalled ); |
171 | m_destination->setEnabled( !notInstalled ); | 181 | m_destination->setEnabled( !notInstalled ); |
172 | if ( notInstalled ) | 182 | if ( notInstalled ) |
173 | m_destCB->setChecked( false ); | 183 | m_destCB->setChecked( false ); |
174 | } | 184 | } |
175 | 185 | ||
176 | void FilterDlg::slotCategorySelected( bool selected ) | 186 | void FilterDlg::slotCategorySelected( bool selected ) |
177 | { | 187 | { |
178 | m_category->setEnabled( selected ); | 188 | m_category->setEnabled( selected ); |
179 | } | 189 | } |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index b334bca..810046f 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -1,719 +1,719 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the OPIE Project | 2 | � � � � � � � � This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | � � � � � � �.=l. | 5 | � � � � � � �.=l. |
6 | � � � � � �.>+-= | 6 | � � � � � �.>+-= |
7 | �_;:, � � .> � �:=|. This file is free software; you can | 7 | �_;:, � � .> � �:=|. This file is free software; you can |
8 | .> <`_, � > �. � <= redistribute it and/or modify it under | 8 | .> <`_, � > �. � <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- � : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- � : the terms of the GNU General Public |
10 | .="- .-=="i, � � .._ License as published by the Free Software | 10 | .="- .-=="i, � � .._ License as published by the Free Software |
11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
12 | � � �._= =} � � � : or (at your option) any later version. | 12 | � � �._= =} � � � : or (at your option) any later version. |
13 | � � .%`+i> � � � _;_. | 13 | � � .%`+i> � � � _;_. |
14 | � � .i_,=:_. � � �-<s. This file is distributed in the hope that | 14 | � � .i_,=:_. � � �-<s. This file is distributed in the hope that |
15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
16 | � � : .. � �.:, � � . . . without even the implied warranty of | 16 | � � : .. � �.:, � � . . . without even the implied warranty of |
17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU General | 18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= � � � = � � � ; Public License for more details. | 19 | ..}^=.= � � � = � � � ; Public License for more details. |
20 | ++= � -. � � .` � � .: | 20 | ++= � -. � � .` � � .: |
21 | �: � � = �...= . :.=- You should have received a copy of the GNU | 21 | �: � � = �...= . :.=- You should have received a copy of the GNU |
22 | �-. � .:....=;==+<; General Public License along with this file; | 22 | �-. � .:....=;==+<; General Public License along with this file; |
23 | � -_. . . � )=. �= see the file COPYING. If not, write to the | 23 | � -_. . . � )=. �= see the file COPYING. If not, write to the |
24 | � � -- � � � �:-=` Free Software Foundation, Inc., | 24 | � � -- � � � �:-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
39 | #include <qwhatsthis.h> | 39 | #include <qwhatsthis.h> |
40 | 40 | ||
41 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
42 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
43 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
44 | 44 | ||
45 | #include "mainwindow.h" | 45 | #include "mainwindow.h" |
46 | #include "installdlg.h" | 46 | #include "installdlg.h" |
47 | #include "filterdlg.h" | 47 | #include "filterdlg.h" |
48 | #include "promptdlg.h" | 48 | #include "promptdlg.h" |
49 | #include "entrydlg.h" | 49 | #include "entrydlg.h" |
50 | #include "packageinfodlg.h" | 50 | #include "packageinfodlg.h" |
51 | 51 | ||
52 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) | 52 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) |
53 | : QMainWindow( parent, name, WStyle_ContextHelp ) | 53 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
54 | , m_config( "packman" ) | 54 | , m_config( "packman" ) |
55 | , m_packman( &m_config, this ) | 55 | , m_packman( &m_config, this ) |
56 | , m_menuBar( this ) | 56 | , m_menuBar( this ) |
57 | , m_toolBar( this ) | 57 | , m_toolBar( this ) |
58 | , m_findBar( this ) | 58 | , m_findBar( this ) |
59 | , m_widgetStack( this ) | 59 | , m_widgetStack( this ) |
60 | , m_packageList( this ) | 60 | , m_packageList( this ) |
61 | , m_statusWidget( this ) | 61 | , m_statusWidget( this ) |
62 | , m_statusText( &m_statusWidget ) | 62 | , m_statusText( &m_statusWidget ) |
63 | , m_statusBar( &m_statusWidget ) | 63 | , m_statusBar( &m_statusWidget ) |
64 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) | 64 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) |
65 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) | 65 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) |
66 | , m_iconNull( m_iconUpdated.size() ) | 66 | , m_iconNull( m_iconUpdated.size() ) |
67 | , m_filterName( QString::null ) | 67 | , m_filterName( QString::null ) |
68 | , m_filterServer( QString::null ) | 68 | , m_filterServer( QString::null ) |
69 | , m_filterDest( QString::null ) | 69 | , m_filterDest( QString::null ) |
70 | , m_filterStatus( OPackageManager::NotDefined ) | 70 | , m_filterStatus( OPackageManager::NotDefined ) |
71 | , m_filterCategory( QString::null ) | 71 | , m_filterCategory( QString::null ) |
72 | 72 | ||
73 | { | 73 | { |
74 | // setCaption( tr( "Package Manager" ) ); | 74 | // setCaption( tr( "Package Manager" ) ); |
75 | 75 | ||
76 | m_iconNull.fill( colorGroup().base() ); | 76 | m_iconNull.fill( colorGroup().base() ); |
77 | 77 | ||
78 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); | 78 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); |
79 | 79 | ||
80 | // Initialize widget stack, package list and status widget | 80 | // Initialize widget stack, package list and status widget |
81 | initStatusWidget(); | 81 | initStatusWidget(); |
82 | initPackageList(); | 82 | initPackageList(); |
83 | 83 | ||
84 | m_widgetStack.addWidget( &m_statusWidget, 2 ); | 84 | m_widgetStack.addWidget( &m_statusWidget, 2 ); |
85 | m_widgetStack.addWidget( &m_packageList, 1 ); | 85 | m_widgetStack.addWidget( &m_packageList, 1 ); |
86 | setCentralWidget( &m_widgetStack ); | 86 | setCentralWidget( &m_widgetStack ); |
87 | 87 | ||
88 | // Initialize remaining user interface items | 88 | // Initialize remaining user interface items |
89 | initUI(); | 89 | initUI(); |
90 | 90 | ||
91 | // Initialize package information | 91 | // Initialize package information |
92 | QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); | 92 | QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); |
93 | } | 93 | } |
94 | 94 | ||
95 | void MainWindow::closeEvent( QCloseEvent *event ) | 95 | void MainWindow::closeEvent( QCloseEvent *event ) |
96 | { | 96 | { |
97 | // Close app only if either the package or status widgets are currently active | 97 | // Close app only if either the package or status widgets are currently active |
98 | bool close = m_widgetStack.visibleWidget() == &m_packageList || | 98 | bool close = m_widgetStack.visibleWidget() == &m_packageList || |
99 | m_widgetStack.visibleWidget() == &m_statusWidget; | 99 | m_widgetStack.visibleWidget() == &m_statusWidget; |
100 | if ( close ) | 100 | if ( close ) |
101 | { | 101 | { |
102 | // TODO - write out application configuration settings | 102 | // TODO - write out application configuration settings |
103 | 103 | ||
104 | // Write out package manager configuration settings | 104 | // Write out package manager configuration settings |
105 | m_packman.saveSettings(); | 105 | m_packman.saveSettings(); |
106 | event->accept(); | 106 | event->accept(); |
107 | } | 107 | } |
108 | else | 108 | else |
109 | { | 109 | { |
110 | delete m_widgetStack.visibleWidget(); | 110 | delete m_widgetStack.visibleWidget(); |
111 | m_widgetStack.raiseWidget( &m_packageList ); | 111 | m_widgetStack.raiseWidget( &m_packageList ); |
112 | event->ignore(); | 112 | event->ignore(); |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | void MainWindow::initPackageList() | 116 | void MainWindow::initPackageList() |
117 | { | 117 | { |
118 | m_packageList.addColumn( tr( "Packages" ) ); | 118 | m_packageList.addColumn( tr( "Packages" ) ); |
119 | QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 119 | QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nTap inside the box at the left to select a package. Tap and hold to view package details." ) ); |
120 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); | 120 | QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); |
121 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), | 121 | connect( &m_packageList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), |
122 | this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); | 122 | this, SLOT(slotDisplayPackageInfo(QListViewItem*)) ); |
123 | } | 123 | } |
124 | 124 | ||
125 | void MainWindow::initStatusWidget() | 125 | void MainWindow::initStatusWidget() |
126 | { | 126 | { |
127 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); | 127 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); |
128 | 128 | ||
129 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 129 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
130 | layout->addWidget( &m_statusText ); | 130 | layout->addWidget( &m_statusText ); |
131 | 131 | ||
132 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); | 132 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); |
133 | connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); | 133 | connect( &m_packman, SIGNAL(statusText(const QString&)), this, SLOT(slotStatusText(const QString&)) ); |
134 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); | 134 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); |
135 | 135 | ||
136 | layout->addWidget( &m_statusBar ); | 136 | layout->addWidget( &m_statusBar ); |
137 | } | 137 | } |
138 | 138 | ||
139 | void MainWindow::initUI() | 139 | void MainWindow::initUI() |
140 | { | 140 | { |
141 | // Build menu and tool bars | 141 | // Build menu and tool bars |
142 | setToolBarsMovable( false ); | 142 | setToolBarsMovable( false ); |
143 | 143 | ||
144 | m_menuBar.setHorizontalStretchable( true ); | 144 | m_menuBar.setHorizontalStretchable( true ); |
145 | QMenuBar *mb = new QMenuBar( &m_menuBar ); | 145 | QMenuBar *mb = new QMenuBar( &m_menuBar ); |
146 | mb->setMargin( 0 ); | 146 | mb->setMargin( 0 ); |
147 | 147 | ||
148 | // Find toolbar | 148 | // Find toolbar |
149 | addToolBar( &m_findBar, QMainWindow::Top, true ); | 149 | addToolBar( &m_findBar, QMainWindow::Top, true ); |
150 | m_findBar.setHorizontalStretchable( true ); | 150 | m_findBar.setHorizontalStretchable( true ); |
151 | m_findEdit = new QLineEdit( &m_findBar ); | 151 | m_findEdit = new QLineEdit( &m_findBar ); |
152 | QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); | 152 | QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); |
153 | m_findBar.setStretchableWidget( m_findEdit ); | 153 | m_findBar.setStretchableWidget( m_findEdit ); |
154 | connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); | 154 | connect( m_findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(slotFindChanged(const QString&)) ); |
155 | 155 | ||
156 | // Packages menu | 156 | // Packages menu |
157 | QPopupMenu *popup = new QPopupMenu( this ); | 157 | QPopupMenu *popup = new QPopupMenu( this ); |
158 | 158 | ||
159 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); | 159 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); |
160 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 160 | a->setWhatsThis( tr( "Tap here to update package lists from servers." ) ); |
161 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); | 161 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); |
162 | a->addTo( popup ); | 162 | a->addTo( popup ); |
163 | a->addTo( &m_toolBar ); | 163 | a->addTo( &m_toolBar ); |
164 | 164 | ||
165 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); | 165 | QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); |
166 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 166 | actionUpgrade->setWhatsThis( tr( "Tap here to upgrade all installed packages if a newer version is available." ) ); |
167 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); | 167 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); |
168 | actionUpgrade->addTo( popup ); | 168 | actionUpgrade->addTo( popup ); |
169 | actionUpgrade->addTo( &m_toolBar ); | 169 | actionUpgrade->addTo( &m_toolBar ); |
170 | 170 | ||
171 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 171 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); |
172 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 172 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); |
173 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 173 | QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
174 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 174 | actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); |
175 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 175 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
176 | actionDownload->addTo( popup ); | 176 | actionDownload->addTo( popup ); |
177 | actionDownload->addTo( &m_toolBar ); | 177 | actionDownload->addTo( &m_toolBar ); |
178 | 178 | ||
179 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); | 179 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); |
180 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 180 | a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); |
181 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); | 181 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); |
182 | a->addTo( popup ); | 182 | a->addTo( popup ); |
183 | a->addTo( &m_toolBar ); | 183 | a->addTo( &m_toolBar ); |
184 | 184 | ||
185 | popup->insertSeparator(); | 185 | popup->insertSeparator(); |
186 | 186 | ||
187 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 187 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
188 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 188 | a->setWhatsThis( tr( "Tap here to configure this application." ) ); |
189 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 189 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
190 | a->addTo( popup ); | 190 | a->addTo( popup ); |
191 | mb->insertItem( tr( "Actions" ), popup ); | 191 | mb->insertItem( tr( "Actions" ), popup ); |
192 | 192 | ||
193 | // View menu | 193 | // View menu |
194 | popup = new QPopupMenu( this ); | 194 | popup = new QPopupMenu( this ); |
195 | 195 | ||
196 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 196 | m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
197 | m_actionShowNotInstalled->setToggleAction( true ); | 197 | m_actionShowNotInstalled->setToggleAction( true ); |
198 | m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 198 | m_actionShowNotInstalled->setWhatsThis( tr( "Tap here to show packages available which have not been installed." ) ); |
199 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); | 199 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); |
200 | m_actionShowNotInstalled->addTo( popup ); | 200 | m_actionShowNotInstalled->addTo( popup ); |
201 | 201 | ||
202 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 202 | m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
203 | m_actionShowInstalled->setToggleAction( true ); | 203 | m_actionShowInstalled->setToggleAction( true ); |
204 | m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 204 | m_actionShowInstalled->setWhatsThis( tr( "Tap here to show packages currently installed on this device." ) ); |
205 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); | 205 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); |
206 | m_actionShowInstalled->addTo( popup ); | 206 | m_actionShowInstalled->addTo( popup ); |
207 | 207 | ||
208 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 208 | m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
209 | m_actionShowUpdated->setToggleAction( true ); | 209 | m_actionShowUpdated->setToggleAction( true ); |
210 | m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 210 | m_actionShowUpdated->setWhatsThis( tr( "Tap here to show packages currently installed on this device which have a newer version available." ) ); |
211 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); | 211 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); |
212 | m_actionShowUpdated->addTo( popup ); | 212 | m_actionShowUpdated->addTo( popup ); |
213 | 213 | ||
214 | popup->insertSeparator(); | 214 | popup->insertSeparator(); |
215 | 215 | ||
216 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 216 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), |
217 | QString::null, 0, this, 0 ); | 217 | QString::null, 0, this, 0 ); |
218 | m_actionFilter->setToggleAction( true ); | 218 | m_actionFilter->setToggleAction( true ); |
219 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); | 219 | m_actionFilter->setWhatsThis( tr( "Tap here to apply current filter." ) ); |
220 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 220 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
221 | m_actionFilter->addTo( popup ); | 221 | m_actionFilter->addTo( popup ); |
222 | 222 | ||
223 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); | 223 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); |
224 | a->setWhatsThis( tr( "Click here to change the package filter criteria." ) ); | 224 | a->setWhatsThis( tr( "Tap here to change the package filter criteria." ) ); |
225 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | 225 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); |
226 | a->addTo( popup ); | 226 | a->addTo( popup ); |
227 | 227 | ||
228 | popup->insertSeparator(); | 228 | popup->insertSeparator(); |
229 | 229 | ||
230 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 230 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
231 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 231 | a->setWhatsThis( tr( "Tap here to search for text in package names." ) ); |
232 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); | 232 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); |
233 | a->addTo( popup ); | 233 | a->addTo( popup ); |
234 | 234 | ||
235 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 235 | m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
236 | m_actionFindNext->setEnabled( false ); | 236 | m_actionFindNext->setEnabled( false ); |
237 | m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 237 | m_actionFindNext->setWhatsThis( tr( "Tap here to find the next package name containing the text you are searching for." ) ); |
238 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); | 238 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); |
239 | m_actionFindNext->addTo( popup ); | 239 | m_actionFindNext->addTo( popup ); |
240 | m_actionFindNext->addTo( &m_findBar ); | 240 | m_actionFindNext->addTo( &m_findBar ); |
241 | 241 | ||
242 | mb->insertItem( tr( "View" ), popup ); | 242 | mb->insertItem( tr( "View" ), popup ); |
243 | 243 | ||
244 | // Finish find toolbar creation | 244 | // Finish find toolbar creation |
245 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 245 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
246 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 246 | a->setWhatsThis( tr( "Tap here to hide the find toolbar." ) ); |
247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); | 247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); |
248 | a->addTo( &m_findBar ); | 248 | a->addTo( &m_findBar ); |
249 | m_findBar.hide(); | 249 | m_findBar.hide(); |
250 | } | 250 | } |
251 | 251 | ||
252 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | 252 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) |
253 | { | 253 | { |
254 | if ( clearList ) | 254 | if ( clearList ) |
255 | m_packageList.clear(); | 255 | m_packageList.clear(); |
256 | 256 | ||
257 | if ( packages ) | 257 | if ( packages ) |
258 | { | 258 | { |
259 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) | 259 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) |
260 | { | 260 | { |
261 | OPackage *package = packageIt.current(); | 261 | OPackage *package = packageIt.current(); |
262 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), | 262 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), |
263 | QCheckListItem::CheckBox ); | 263 | QCheckListItem::CheckBox ); |
264 | m_packageList.insertItem( item ); | 264 | m_packageList.insertItem( item ); |
265 | 265 | ||
266 | // If a different version of package is available, show update available icon | 266 | // If a different version of package is available, show update available icon |
267 | // Otherwise, show installed icon | 267 | // Otherwise, show installed icon |
268 | if ( !package->versionInstalled().isNull() ) | 268 | if ( !package->versionInstalled().isNull() ) |
269 | { | 269 | { |
270 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 270 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
271 | item->setPixmap( 0, m_iconUpdated ); | 271 | item->setPixmap( 0, m_iconUpdated ); |
272 | else | 272 | else |
273 | item->setPixmap( 0, m_iconInstalled ); | 273 | item->setPixmap( 0, m_iconInstalled ); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | item->setPixmap( 0, m_iconNull ); | 276 | item->setPixmap( 0, m_iconNull ); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | void MainWindow::searchForPackage( const QString &text ) | 281 | void MainWindow::searchForPackage( const QString &text ) |
282 | { | 282 | { |
283 | if ( !text.isEmpty() ) | 283 | if ( !text.isEmpty() ) |
284 | { | 284 | { |
285 | // look through package list for text startng at current position | 285 | // look through package list for text startng at current position |
286 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); | 286 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); |
287 | if ( start == 0 ) | 287 | if ( start == 0 ) |
288 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 288 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
289 | 289 | ||
290 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; | 290 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; |
291 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; | 291 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; |
292 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 292 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
293 | { | 293 | { |
294 | if ( item->text().lower().find( text ) != -1 ) | 294 | if ( item->text().lower().find( text ) != -1 ) |
295 | { | 295 | { |
296 | m_packageList.ensureItemVisible( item ); | 296 | m_packageList.ensureItemVisible( item ); |
297 | m_packageList.setCurrentItem( item ); | 297 | m_packageList.setCurrentItem( item ); |
298 | break; | 298 | break; |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | } | 302 | } |
303 | 303 | ||
304 | void MainWindow::initPackageInfo() | 304 | void MainWindow::initPackageInfo() |
305 | { | 305 | { |
306 | m_widgetStack.raiseWidget( &m_statusWidget ); | 306 | m_widgetStack.raiseWidget( &m_statusWidget ); |
307 | 307 | ||
308 | // Load package list | 308 | // Load package list |
309 | m_packman.loadAvailablePackages(); | 309 | m_packman.loadAvailablePackages(); |
310 | m_packman.loadInstalledPackages(); | 310 | m_packman.loadInstalledPackages(); |
311 | 311 | ||
312 | OPackageList *packageList = m_packman.packages(); | 312 | OPackageList *packageList = m_packman.packages(); |
313 | if ( packageList ) | 313 | if ( packageList ) |
314 | { | 314 | { |
315 | loadPackageList( packageList, true ); | 315 | loadPackageList( packageList, true ); |
316 | delete packageList; | 316 | delete packageList; |
317 | } | 317 | } |
318 | 318 | ||
319 | m_widgetStack.raiseWidget( &m_packageList ); | 319 | m_widgetStack.raiseWidget( &m_packageList ); |
320 | } | 320 | } |
321 | 321 | ||
322 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 322 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
323 | { | 323 | { |
324 | if ( widget == &m_packageList ) | 324 | if ( widget == &m_packageList ) |
325 | { | 325 | { |
326 | setCaption( tr( "Package Manager" ) ); | 326 | setCaption( tr( "Package Manager" ) ); |
327 | 327 | ||
328 | m_menuBar.show(); | 328 | m_menuBar.show(); |
329 | m_toolBar.show(); | 329 | m_toolBar.show(); |
330 | } | 330 | } |
331 | else | 331 | else |
332 | { | 332 | { |
333 | m_menuBar.hide(); | 333 | m_menuBar.hide(); |
334 | m_toolBar.hide(); | 334 | m_toolBar.hide(); |
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
338 | void MainWindow::slotInitStatusBar( int numSteps ) | 338 | void MainWindow::slotInitStatusBar( int numSteps ) |
339 | { | 339 | { |
340 | m_statusBar.setTotalSteps( numSteps ); | 340 | m_statusBar.setTotalSteps( numSteps ); |
341 | } | 341 | } |
342 | 342 | ||
343 | void MainWindow::slotStatusText( const QString &status ) | 343 | void MainWindow::slotStatusText( const QString &status ) |
344 | { | 344 | { |
345 | m_statusText.setText( status ); | 345 | m_statusText.setText( status ); |
346 | } | 346 | } |
347 | 347 | ||
348 | void MainWindow::slotStatusBar( int currStep ) | 348 | void MainWindow::slotStatusBar( int currStep ) |
349 | { | 349 | { |
350 | m_statusBar.setProgress( currStep ); | 350 | m_statusBar.setProgress( currStep ); |
351 | } | 351 | } |
352 | 352 | ||
353 | void MainWindow::slotUpdate() | 353 | void MainWindow::slotUpdate() |
354 | { | 354 | { |
355 | // Create package manager output widget | 355 | // Create package manager output widget |
356 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, | 356 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, |
357 | OPackage::Update ); | 357 | OPackage::Update ); |
358 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 358 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
359 | 359 | ||
360 | // Display widget | 360 | // Display widget |
361 | m_widgetStack.addWidget( dlg, 3 ); | 361 | m_widgetStack.addWidget( dlg, 3 ); |
362 | m_widgetStack.raiseWidget( dlg ); | 362 | m_widgetStack.raiseWidget( dlg ); |
363 | } | 363 | } |
364 | 364 | ||
365 | void MainWindow::slotUpgrade() | 365 | void MainWindow::slotUpgrade() |
366 | { | 366 | { |
367 | // Create package manager output widget | 367 | // Create package manager output widget |
368 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, | 368 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, |
369 | OPackage::Upgrade ); | 369 | OPackage::Upgrade ); |
370 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 370 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
371 | 371 | ||
372 | // Display widget | 372 | // Display widget |
373 | m_widgetStack.addWidget( dlg, 3 ); | 373 | m_widgetStack.addWidget( dlg, 3 ); |
374 | m_widgetStack.raiseWidget( dlg ); | 374 | m_widgetStack.raiseWidget( dlg ); |
375 | } | 375 | } |
376 | 376 | ||
377 | void MainWindow::slotDownload() | 377 | void MainWindow::slotDownload() |
378 | { | 378 | { |
379 | // Retrieve list of packages selected for download (if any) | 379 | // Retrieve list of packages selected for download (if any) |
380 | QStringList *workingPackages = new QStringList(); | 380 | QStringList *workingPackages = new QStringList(); |
381 | 381 | ||
382 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 382 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
383 | item != 0 ; | 383 | item != 0 ; |
384 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 384 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
385 | { | 385 | { |
386 | if ( item->isOn() ) | 386 | if ( item->isOn() ) |
387 | workingPackages->append( item->text() ); | 387 | workingPackages->append( item->text() ); |
388 | } | 388 | } |
389 | 389 | ||
390 | if ( workingPackages->isEmpty() ) | 390 | if ( workingPackages->isEmpty() ) |
391 | { | 391 | { |
392 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 392 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
393 | return; | 393 | return; |
394 | } | 394 | } |
395 | else | 395 | else |
396 | { | 396 | { |
397 | // Download selected packages | 397 | // Download selected packages |
398 | m_config.setGroup( "settings" ); | 398 | m_config.setGroup( "settings" ); |
399 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); | 399 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); |
400 | 400 | ||
401 | bool ok = false; | 401 | bool ok = false; |
402 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); | 402 | QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this ); |
403 | if ( ok && !text.isEmpty() ) | 403 | if ( ok && !text.isEmpty() ) |
404 | workingDir = text; // user entered something and pressed ok | 404 | workingDir = text; // user entered something and pressed ok |
405 | else | 405 | else |
406 | return; // user entered nothing or pressed cancel | 406 | return; // user entered nothing or pressed cancel |
407 | 407 | ||
408 | // Store download directory in config file | 408 | // Store download directory in config file |
409 | m_config.writeEntry( "DownloadDir", workingDir ); | 409 | m_config.writeEntry( "DownloadDir", workingDir ); |
410 | 410 | ||
411 | // Get starting directory | 411 | // Get starting directory |
412 | QDir::setCurrent( workingDir ); | 412 | QDir::setCurrent( workingDir ); |
413 | 413 | ||
414 | // Create package manager output widget | 414 | // Create package manager output widget |
415 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, | 415 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, |
416 | OPackage::Download, workingPackages ); | 416 | OPackage::Download, workingPackages ); |
417 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 417 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
418 | 418 | ||
419 | // Display widget | 419 | // Display widget |
420 | m_widgetStack.addWidget( dlg, 3 ); | 420 | m_widgetStack.addWidget( dlg, 3 ); |
421 | m_widgetStack.raiseWidget( dlg ); | 421 | m_widgetStack.raiseWidget( dlg ); |
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | void MainWindow::slotApply() | 425 | void MainWindow::slotApply() |
426 | { | 426 | { |
427 | QStringList *removeList = 0x0; | 427 | QStringList *removeList = 0x0; |
428 | QStringList *installList = 0x0; | 428 | QStringList *installList = 0x0; |
429 | QStringList *upgradeList = 0x0; | 429 | QStringList *upgradeList = 0x0; |
430 | 430 | ||
431 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 431 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
432 | item != 0 ; | 432 | item != 0 ; |
433 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 433 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
434 | { | 434 | { |
435 | if ( item->isOn() ) | 435 | if ( item->isOn() ) |
436 | { | 436 | { |
437 | OPackage *package = m_packman.findPackage( item->text() ); | 437 | OPackage *package = m_packman.findPackage( item->text() ); |
438 | if ( package ) | 438 | if ( package ) |
439 | { | 439 | { |
440 | if ( !package->versionInstalled().isNull() ) | 440 | if ( !package->versionInstalled().isNull() ) |
441 | { | 441 | { |
442 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 442 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
443 | { | 443 | { |
444 | // Remove/upgrade package | 444 | // Remove/upgrade package |
445 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), | 445 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), |
446 | tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), | 446 | tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), |
447 | tr( "Remove" ), tr( "Upgrade" ), this ); | 447 | tr( "Remove" ), tr( "Upgrade" ), this ); |
448 | if ( answer == 1 ) // Remove | 448 | if ( answer == 1 ) // Remove |
449 | { | 449 | { |
450 | if ( !removeList ) | 450 | if ( !removeList ) |
451 | removeList = new QStringList(); | 451 | removeList = new QStringList(); |
452 | removeList->append( item->text() ); | 452 | removeList->append( item->text() ); |
453 | } | 453 | } |
454 | else if ( answer == 2 ) // Upgrade | 454 | else if ( answer == 2 ) // Upgrade |
455 | { | 455 | { |
456 | if ( !upgradeList ) | 456 | if ( !upgradeList ) |
457 | upgradeList = new QStringList(); | 457 | upgradeList = new QStringList(); |
458 | upgradeList->append( item->text() ); | 458 | upgradeList->append( item->text() ); |
459 | } | 459 | } |
460 | } | 460 | } |
461 | else | 461 | else |
462 | { | 462 | { |
463 | // Remove/reinstall package | 463 | // Remove/reinstall package |
464 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), | 464 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), |
465 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), | 465 | tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), |
466 | tr( "Remove" ), tr( "Reinstall" ), this ); | 466 | tr( "Remove" ), tr( "Reinstall" ), this ); |
467 | if ( answer == 1 ) // Remove | 467 | if ( answer == 1 ) // Remove |
468 | { | 468 | { |
469 | if ( !removeList ) | 469 | if ( !removeList ) |
470 | removeList = new QStringList(); | 470 | removeList = new QStringList(); |
471 | removeList->append( item->text() ); | 471 | removeList->append( item->text() ); |
472 | } | 472 | } |
473 | else if ( answer == 2 ) // Reinstall | 473 | else if ( answer == 2 ) // Reinstall |
474 | { | 474 | { |
475 | if ( !installList ) | 475 | if ( !installList ) |
476 | installList = new QStringList(); | 476 | installList = new QStringList(); |
477 | installList->append( item->text() ); | 477 | installList->append( item->text() ); |
478 | } | 478 | } |
479 | } | 479 | } |
480 | } | 480 | } |
481 | else | 481 | else |
482 | { | 482 | { |
483 | // Install package | 483 | // Install package |
484 | if ( !installList ) | 484 | if ( !installList ) |
485 | installList = new QStringList(); | 485 | installList = new QStringList(); |
486 | installList->append( item->text() ); | 486 | installList->append( item->text() ); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | // If nothing is selected, display message and exit | 492 | // If nothing is selected, display message and exit |
493 | if ( !removeList && !installList && !upgradeList ) | 493 | if ( !removeList && !installList && !upgradeList ) |
494 | { | 494 | { |
495 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); | 495 | QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); |
496 | return; | 496 | return; |
497 | } | 497 | } |
498 | 498 | ||
499 | // Send command only if there are packages to process | 499 | // Send command only if there are packages to process |
500 | OPackage::Command removeCmd = OPackage::NotDefined; | 500 | OPackage::Command removeCmd = OPackage::NotDefined; |
501 | if ( removeList && !removeList->isEmpty() ) | 501 | if ( removeList && !removeList->isEmpty() ) |
502 | removeCmd = OPackage::Remove; | 502 | removeCmd = OPackage::Remove; |
503 | OPackage::Command installCmd = OPackage::NotDefined; | 503 | OPackage::Command installCmd = OPackage::NotDefined; |
504 | if ( installList && !installList->isEmpty() ) | 504 | if ( installList && !installList->isEmpty() ) |
505 | installCmd = OPackage::Install; | 505 | installCmd = OPackage::Install; |
506 | OPackage::Command upgradeCmd = OPackage::NotDefined; | 506 | OPackage::Command upgradeCmd = OPackage::NotDefined; |
507 | if ( upgradeList && !upgradeList->isEmpty() ) | 507 | if ( upgradeList && !upgradeList->isEmpty() ) |
508 | upgradeCmd = OPackage::Upgrade; | 508 | upgradeCmd = OPackage::Upgrade; |
509 | 509 | ||
510 | // Create package manager output widget | 510 | // Create package manager output widget |
511 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, | 511 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, |
512 | removeCmd, removeList, | 512 | removeCmd, removeList, |
513 | installCmd, installList, | 513 | installCmd, installList, |
514 | upgradeCmd, upgradeList ); | 514 | upgradeCmd, upgradeList ); |
515 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | 515 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
516 | 516 | ||
517 | // Display widget | 517 | // Display widget |
518 | m_widgetStack.addWidget( dlg, 3 ); | 518 | m_widgetStack.addWidget( dlg, 3 ); |
519 | m_widgetStack.raiseWidget( dlg ); | 519 | m_widgetStack.raiseWidget( dlg ); |
520 | } | 520 | } |
521 | 521 | ||
522 | void MainWindow::slotCloseDlg() | 522 | void MainWindow::slotCloseDlg() |
523 | { | 523 | { |
524 | // Close install dialog | 524 | // Close install dialog |
525 | delete m_widgetStack.visibleWidget(); | 525 | delete m_widgetStack.visibleWidget(); |
526 | 526 | ||
527 | // Reload package list | 527 | // Reload package list |
528 | initPackageInfo(); | 528 | initPackageInfo(); |
529 | 529 | ||
530 | // Update Opie launcher links | 530 | // Update Opie launcher links |
531 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 531 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
532 | QString lf = QString::null; | 532 | QString lf = QString::null; |
533 | e << lf; | 533 | e << lf; |
534 | } | 534 | } |
535 | 535 | ||
536 | void MainWindow::slotConfigure() | 536 | void MainWindow::slotConfigure() |
537 | { | 537 | { |
538 | if ( m_packman.configureDlg( false ) ) | 538 | if ( m_packman.configureDlg( false ) ) |
539 | { | 539 | { |
540 | if ( PromptDlg::ask( tr( "Config updated" ), | 540 | if ( PromptDlg::ask( tr( "Config updated" ), |
541 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), | 541 | tr( "The configuration has been updated. Do you want to update server and package information now?" ), |
542 | tr( "Yes" ), tr( "No" ), this ) == 1 ) | 542 | tr( "Yes" ), tr( "No" ), this ) == 1 ) |
543 | { | 543 | { |
544 | // Update package list and reload package info | 544 | // Update package list and reload package info |
545 | slotUpdate(); | 545 | slotUpdate(); |
546 | } | 546 | } |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
550 | void MainWindow::slotShowNotInstalled() | 550 | void MainWindow::slotShowNotInstalled() |
551 | { | 551 | { |
552 | OPackageList *packageList; | 552 | OPackageList *packageList; |
553 | if ( m_actionShowNotInstalled->isOn() ) | 553 | if ( m_actionShowNotInstalled->isOn() ) |
554 | { | 554 | { |
555 | m_actionShowInstalled->setOn( false ); | 555 | m_actionShowInstalled->setOn( false ); |
556 | m_actionShowUpdated->setOn( false ); | 556 | m_actionShowUpdated->setOn( false ); |
557 | m_actionFilter->setOn( false ); | 557 | m_actionFilter->setOn( false ); |
558 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 558 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
559 | OPackageManager::NotInstalled, QString::null ); | 559 | OPackageManager::NotInstalled, QString::null ); |
560 | } | 560 | } |
561 | else | 561 | else |
562 | packageList = m_packman.packages(); | 562 | packageList = m_packman.packages(); |
563 | 563 | ||
564 | if ( packageList ) | 564 | if ( packageList ) |
565 | { | 565 | { |
566 | loadPackageList( packageList, true ); | 566 | loadPackageList( packageList, true ); |
567 | delete packageList; | 567 | delete packageList; |
568 | } | 568 | } |
569 | } | 569 | } |
570 | 570 | ||
571 | void MainWindow::slotShowInstalled() | 571 | void MainWindow::slotShowInstalled() |
572 | { | 572 | { |
573 | OPackageList *packageList; | 573 | OPackageList *packageList; |
574 | if ( m_actionShowInstalled->isOn() ) | 574 | if ( m_actionShowInstalled->isOn() ) |
575 | { | 575 | { |
576 | m_actionShowNotInstalled->setOn( false ); | 576 | m_actionShowNotInstalled->setOn( false ); |
577 | m_actionShowUpdated->setOn( false ); | 577 | m_actionShowUpdated->setOn( false ); |
578 | m_actionFilter->setOn( false ); | 578 | m_actionFilter->setOn( false ); |
579 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 579 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
580 | OPackageManager::Installed, QString::null ); | 580 | OPackageManager::Installed, QString::null ); |
581 | } | 581 | } |
582 | else | 582 | else |
583 | packageList = m_packman.packages(); | 583 | packageList = m_packman.packages(); |
584 | 584 | ||
585 | if ( packageList ) | 585 | if ( packageList ) |
586 | { | 586 | { |
587 | loadPackageList( packageList, true ); | 587 | loadPackageList( packageList, true ); |
588 | delete packageList; | 588 | delete packageList; |
589 | } | 589 | } |
590 | } | 590 | } |
591 | 591 | ||
592 | void MainWindow::slotShowUpdated() | 592 | void MainWindow::slotShowUpdated() |
593 | { | 593 | { |
594 | OPackageList *packageList; | 594 | OPackageList *packageList; |
595 | if ( m_actionShowUpdated->isOn() ) | 595 | if ( m_actionShowUpdated->isOn() ) |
596 | { | 596 | { |
597 | m_actionShowInstalled->setOn( false ); | 597 | m_actionShowInstalled->setOn( false ); |
598 | m_actionShowNotInstalled->setOn( false ); | 598 | m_actionShowNotInstalled->setOn( false ); |
599 | m_actionFilter->setOn( false ); | 599 | m_actionFilter->setOn( false ); |
600 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 600 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
601 | OPackageManager::Updated, QString::null ); | 601 | OPackageManager::Updated, QString::null ); |
602 | } | 602 | } |
603 | else | 603 | else |
604 | packageList = m_packman.packages(); | 604 | packageList = m_packman.packages(); |
605 | 605 | ||
606 | if ( packageList ) | 606 | if ( packageList ) |
607 | { | 607 | { |
608 | loadPackageList( packageList, true ); | 608 | loadPackageList( packageList, true ); |
609 | delete packageList; | 609 | delete packageList; |
610 | } | 610 | } |
611 | } | 611 | } |
612 | 612 | ||
613 | void MainWindow::slotFilterChange() | 613 | void MainWindow::slotFilterChange() |
614 | { | 614 | { |
615 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 615 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
616 | m_filterCategory ); | 616 | m_filterCategory ); |
617 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 617 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
618 | { | 618 | { |
619 | m_filterName = dlg.name(); | 619 | m_filterName = dlg.name(); |
620 | m_filterServer = dlg.server(); | 620 | m_filterServer = dlg.server(); |
621 | m_filterDest = dlg.destination(); | 621 | m_filterDest = dlg.destination(); |
622 | m_filterStatus = dlg.status(); | 622 | m_filterStatus = dlg.status(); |
623 | m_filterCategory = dlg.category(); | 623 | m_filterCategory = dlg.category(); |
624 | m_actionFilter->setOn( true ); | 624 | m_actionFilter->setOn( true ); |
625 | slotFilter( true ); | 625 | slotFilter( true ); |
626 | } | 626 | } |
627 | else | 627 | else |
628 | { | 628 | { |
629 | m_actionFilter->setOn( false ); | 629 | m_actionFilter->setOn( false ); |
630 | slotFilter( false ); | 630 | slotFilter( false ); |
631 | } | 631 | } |
632 | } | 632 | } |
633 | 633 | ||
634 | void MainWindow::slotFilter( bool isOn ) | 634 | void MainWindow::slotFilter( bool isOn ) |
635 | { | 635 | { |
636 | OPackageList *packageList; | 636 | OPackageList *packageList; |
637 | if ( isOn ) | 637 | if ( isOn ) |
638 | { | 638 | { |
639 | // Turn off other filtering options | 639 | // Turn off other filtering options |
640 | m_actionShowNotInstalled->setOn( false ); | 640 | m_actionShowNotInstalled->setOn( false ); |
641 | m_actionShowInstalled->setOn( false ); | 641 | m_actionShowInstalled->setOn( false ); |
642 | m_actionShowUpdated->setOn( false ); | 642 | m_actionShowUpdated->setOn( false ); |
643 | 643 | ||
644 | // If the filter settings have not been set yet, display filter dialog | 644 | // If the filter settings have not been set yet, display filter dialog |
645 | if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && | 645 | if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && |
646 | m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) | 646 | m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) |
647 | { | 647 | { |
648 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 648 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
649 | m_filterCategory ); | 649 | m_filterCategory ); |
650 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 650 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
651 | { | 651 | { |
652 | m_filterName = dlg.name(); | 652 | m_filterName = dlg.name(); |
653 | m_filterServer = dlg.server(); | 653 | m_filterServer = dlg.server(); |
654 | m_filterDest = dlg.destination(); | 654 | m_filterDest = dlg.destination(); |
655 | m_filterStatus = dlg.status(); | 655 | m_filterStatus = dlg.status(); |
656 | m_filterCategory = dlg.category(); | 656 | m_filterCategory = dlg.category(); |
657 | m_actionFilter->setOn( true ); | 657 | m_actionFilter->setOn( true ); |
658 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 658 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, |
659 | m_filterStatus, m_filterCategory ); | 659 | m_filterStatus, m_filterCategory ); |
660 | } | 660 | } |
661 | else | 661 | else |
662 | { | 662 | { |
663 | m_actionFilter->setOn( false ); | 663 | m_actionFilter->setOn( false ); |
664 | packageList = m_packman.packages(); | 664 | packageList = m_packman.packages(); |
665 | } | 665 | } |
666 | } | 666 | } |
667 | else | 667 | else |
668 | { | 668 | { |
669 | m_actionFilter->setOn( true ); | 669 | m_actionFilter->setOn( true ); |
670 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 670 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, |
671 | m_filterStatus, m_filterCategory ); | 671 | m_filterStatus, m_filterCategory ); |
672 | } | 672 | } |
673 | 673 | ||
674 | 674 | ||
675 | } | 675 | } |
676 | else | 676 | else |
677 | packageList = m_packman.packages(); | 677 | packageList = m_packman.packages(); |
678 | 678 | ||
679 | if ( packageList ) | 679 | if ( packageList ) |
680 | { | 680 | { |
681 | loadPackageList( packageList, true ); | 681 | loadPackageList( packageList, true ); |
682 | delete packageList; | 682 | delete packageList; |
683 | } | 683 | } |
684 | } | 684 | } |
685 | 685 | ||
686 | void MainWindow::slotFindShowToolbar() | 686 | void MainWindow::slotFindShowToolbar() |
687 | { | 687 | { |
688 | m_findBar.show(); | 688 | m_findBar.show(); |
689 | m_findEdit->setFocus(); | 689 | m_findEdit->setFocus(); |
690 | } | 690 | } |
691 | 691 | ||
692 | void MainWindow::slotFindHideToolbar() | 692 | void MainWindow::slotFindHideToolbar() |
693 | { | 693 | { |
694 | m_findBar.hide(); | 694 | m_findBar.hide(); |
695 | } | 695 | } |
696 | 696 | ||
697 | void MainWindow::slotFindChanged( const QString &findText ) | 697 | void MainWindow::slotFindChanged( const QString &findText ) |
698 | { | 698 | { |
699 | 699 | ||
700 | m_actionFindNext->setEnabled( !findText.isEmpty() ); | 700 | m_actionFindNext->setEnabled( !findText.isEmpty() ); |
701 | searchForPackage( findText ); | 701 | searchForPackage( findText ); |
702 | } | 702 | } |
703 | 703 | ||
704 | void MainWindow::slotFindNext() | 704 | void MainWindow::slotFindNext() |
705 | { | 705 | { |
706 | searchForPackage( m_findEdit->text() ); | 706 | searchForPackage( m_findEdit->text() ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | 709 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) |
710 | { | 710 | { |
711 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); | 711 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); |
712 | 712 | ||
713 | // Create package manager output widget | 713 | // Create package manager output widget |
714 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); | 714 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); |
715 | 715 | ||
716 | // Display widget | 716 | // Display widget |
717 | m_widgetStack.addWidget( dlg, 3 ); | 717 | m_widgetStack.addWidget( dlg, 3 ); |
718 | m_widgetStack.raiseWidget( dlg ); | 718 | m_widgetStack.raiseWidget( dlg ); |
719 | } | 719 | } |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 74e7137..d134651 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -1,596 +1,629 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | ||
4 | � � � � � � � Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | � � � � � � � Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | � � � � � �.>+-= | 7 | � � � � � �.>+-= |
8 | �_;:, � � .> � �:=|. This program is free software; you can | 8 | �_;:, � � .> � �:=|. This program is free software; you can |
9 | .> <`_, � > �. � <= redistribute it and/or modify it under | 9 | .> <`_, � > �. � <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
11 | .="- .-=="i, � � .._ License as published by the Free Software | 11 | .="- .-=="i, � � .._ License as published by the Free Software |
12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
13 | � � �._= =} � � � : or (at your option) any later version. | 13 | � � �._= =} � � � : or (at your option) any later version. |
14 | � � .%`+i> � � � _;_. | 14 | � � .%`+i> � � � _;_. |
15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that | 15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
17 | � � : .. � �.:, � � . . . without even the implied warranty of | 17 | � � : .. � �.:, � � . . . without even the implied warranty of |
18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU | 19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= � � � = � � � ; Library General Public License for more | 20 | ..}^=.= � � � = � � � ; Library General Public License for more |
21 | ++= � -. � � .` � � .: details. | 21 | ++= � -. � � .` � � .: details. |
22 | �: � � = �...= . :.=- | 22 | �: � � = �...= . :.=- |
23 | �-. � .:....=;==+<; You should have received a copy of the GNU | 23 | �-. � .:....=;==+<; You should have received a copy of the GNU |
24 | � -_. . . � )=. �= Library General Public License along with | 24 | � -_. . . � )=. �= Library General Public License along with |
25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. | 25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkgconfigdlg.h" | 32 | #include "oipkgconfigdlg.h" |
33 | 33 | ||
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qcombobox.h> | 35 | #include <qcombobox.h> |
36 | #include <qgroupbox.h> | 36 | #include <qgroupbox.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
39 | #include <qlistbox.h> | 39 | #include <qlistbox.h> |
40 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
41 | #include <qscrollview.h> | 41 | #include <qscrollview.h> |
42 | #include <qwhatsthis.h> | ||
42 | 43 | ||
43 | #include <qpe/resource.h> | 44 | #include <qpe/resource.h> |
44 | 45 | ||
45 | using namespace Opie::Ui; | 46 | using namespace Opie::Ui; |
46 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) | 47 | OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *parent ) |
47 | : QDialog( parent, QString::null, true ) | 48 | : QDialog( parent, QString::null, true, WStyle_ContextHelp ) |
48 | , m_ipkg( ipkg ) | 49 | , m_ipkg( ipkg ) |
49 | , m_configs( 0x0 ) | 50 | , m_configs( 0x0 ) |
50 | , m_installOptions( installOptions ) | 51 | , m_installOptions( installOptions ) |
51 | , m_serverNew( false ) | 52 | , m_serverNew( false ) |
52 | , m_serverCurrent( -1 ) | 53 | , m_serverCurrent( -1 ) |
53 | , m_destNew( false ) | 54 | , m_destNew( false ) |
54 | , m_destCurrent( -1 ) | 55 | , m_destCurrent( -1 ) |
55 | , m_layout( this, 2, 4 ) | 56 | , m_layout( this, 2, 4 ) |
56 | , m_tabWidget( this ) | 57 | , m_tabWidget( this ) |
57 | { | 58 | { |
58 | setCaption( tr( "Configuration" ) ); | 59 | setCaption( tr( "Configuration" ) ); |
59 | 60 | ||
60 | // Initialize configuration widgets | 61 | // Initialize configuration widgets |
61 | if ( !installOptions ) | 62 | if ( !installOptions ) |
62 | { | 63 | { |
63 | initServerWidget(); | 64 | initServerWidget(); |
64 | initDestinationWidget(); | 65 | initDestinationWidget(); |
65 | initProxyWidget(); | 66 | initProxyWidget(); |
66 | } | 67 | } |
67 | initOptionsWidget(); | 68 | initOptionsWidget(); |
68 | 69 | ||
69 | // Load configuration information | 70 | // Load configuration information |
70 | initData(); | 71 | initData(); |
71 | 72 | ||
72 | // Setup tabs for all info | 73 | // Setup tabs for all info |
73 | m_layout.addWidget( &m_tabWidget ); | 74 | m_layout.addWidget( &m_tabWidget ); |
74 | if ( !m_installOptions ) | 75 | if ( !m_installOptions ) |
75 | { | 76 | { |
76 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); | 77 | m_tabWidget.addTab( m_serverWidget, "packagemanager/servertab", tr( "Servers" ) ); |
77 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); | 78 | m_tabWidget.addTab( m_destWidget, "packagemanager/desttab", tr( "Destinations" ) ); |
78 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); | 79 | m_tabWidget.addTab( m_proxyWidget, "packagemanager/proxytab", tr( "Proxies" ) ); |
79 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 80 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
80 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); | 81 | m_tabWidget.setCurrentTab( tr( "Servers" ) ); |
81 | } | 82 | } |
82 | else | 83 | else |
83 | { | 84 | { |
84 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); | 85 | m_tabWidget.addTab( m_optionsWidget, "exec", tr( "Options" ) ); |
85 | } | 86 | } |
86 | 87 | ||
87 | //showMaximized(); | 88 | //showMaximized(); |
88 | } | 89 | } |
89 | 90 | ||
90 | void OIpkgConfigDlg::accept() | 91 | void OIpkgConfigDlg::accept() |
91 | { | 92 | { |
92 | // Save server, destination and proxy configuration | 93 | // Save server, destination and proxy configuration |
93 | if ( !m_installOptions ) | 94 | if ( !m_installOptions ) |
94 | { | 95 | { |
95 | // Update proxy information before saving settings | 96 | // Update proxy information before saving settings |
96 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); | 97 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); |
97 | if ( confItem ) | 98 | if ( confItem ) |
98 | { | 99 | { |
99 | confItem->setValue( m_proxyHttpServer->text() ); | 100 | confItem->setValue( m_proxyHttpServer->text() ); |
100 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 101 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
101 | } | 102 | } |
102 | else | 103 | else |
103 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "http_proxy", | 104 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "http_proxy", |
104 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); | 105 | m_proxyHttpServer->text(), m_proxyHttpActive->isChecked() ) ); |
105 | 106 | ||
106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | 107 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 108 | if ( confItem ) |
108 | { | 109 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 110 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 111 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 112 | } |
112 | else | 113 | else |
113 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "ftp_proxy", | 114 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); | 115 | m_proxyFtpServer->text(), m_proxyFtpActive->isChecked() ) ); |
115 | 116 | ||
116 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | 117 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); |
117 | if ( confItem ) | 118 | if ( confItem ) |
118 | confItem->setValue( m_proxyUsername->text() ); | 119 | confItem->setValue( m_proxyUsername->text() ); |
119 | else | 120 | else |
120 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_username", | 121 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_username", |
121 | m_proxyUsername->text() ) ); | 122 | m_proxyUsername->text() ) ); |
122 | 123 | ||
123 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); | 124 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); |
124 | if ( confItem ) | 125 | if ( confItem ) |
125 | confItem->setValue( m_proxyPassword->text() ); | 126 | confItem->setValue( m_proxyPassword->text() ); |
126 | else | 127 | else |
127 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_password", | 128 | m_configs->append( new OConfItem( QString::null, OConfItem::Option, "proxy_password", |
128 | m_proxyPassword->text() ) ); | 129 | m_proxyPassword->text() ) ); |
129 | 130 | ||
130 | m_ipkg->setConfigItems( m_configs ); | 131 | m_ipkg->setConfigItems( m_configs ); |
131 | } | 132 | } |
132 | 133 | ||
133 | // Save options configuration | 134 | // Save options configuration |
134 | int options = 0; | 135 | int options = 0; |
135 | if ( m_optForceDepends->isChecked() ) | 136 | if ( m_optForceDepends->isChecked() ) |
136 | options |= FORCE_DEPENDS; | 137 | options |= FORCE_DEPENDS; |
137 | if ( m_optForceReinstall->isChecked() ) | 138 | if ( m_optForceReinstall->isChecked() ) |
138 | options |= FORCE_REINSTALL; | 139 | options |= FORCE_REINSTALL; |
139 | if ( m_optForceRemove->isChecked() ) | 140 | if ( m_optForceRemove->isChecked() ) |
140 | options |= FORCE_REMOVE; | 141 | options |= FORCE_REMOVE; |
141 | if ( m_optForceOverwrite->isChecked() ) | 142 | if ( m_optForceOverwrite->isChecked() ) |
142 | options |= FORCE_OVERWRITE; | 143 | options |= FORCE_OVERWRITE; |
143 | m_ipkg->setIpkgExecOptions( options ); | 144 | m_ipkg->setIpkgExecOptions( options ); |
144 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); | 145 | m_ipkg->setIpkgExecVerbosity( m_optVerboseIpkg->currentItem() ); |
145 | 146 | ||
146 | QDialog::accept(); | 147 | QDialog::accept(); |
147 | } | 148 | } |
148 | 149 | ||
149 | void OIpkgConfigDlg::reject() | 150 | void OIpkgConfigDlg::reject() |
150 | { | 151 | { |
151 | if ( m_configs ) | 152 | if ( m_configs ) |
152 | delete m_configs; | 153 | delete m_configs; |
153 | } | 154 | } |
154 | 155 | ||
155 | void OIpkgConfigDlg::initServerWidget() | 156 | void OIpkgConfigDlg::initServerWidget() |
156 | { | 157 | { |
157 | m_serverWidget = new QWidget( this ); | 158 | m_serverWidget = new QWidget( this ); |
158 | 159 | ||
159 | // Initialize UI | 160 | // Initialize UI |
160 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); | 161 | QVBoxLayout *vb = new QVBoxLayout( m_serverWidget ); |
161 | QScrollView *sv = new QScrollView( m_serverWidget ); | 162 | QScrollView *sv = new QScrollView( m_serverWidget ); |
162 | vb->addWidget( sv, 0, 0 ); | 163 | vb->addWidget( sv, 0, 0 ); |
163 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 164 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
164 | sv->setFrameStyle( QFrame::NoFrame ); | 165 | sv->setFrameStyle( QFrame::NoFrame ); |
165 | QWidget *container = new QWidget( sv->viewport() ); | 166 | QWidget *container = new QWidget( sv->viewport() ); |
166 | sv->addChild( container ); | 167 | sv->addChild( container ); |
167 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); | 168 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); |
168 | 169 | ||
169 | m_serverList = new QListBox( container ); | 170 | m_serverList = new QListBox( container ); |
171 | QWhatsThis::add( m_serverList, tr( "This is a list of all servers configured. Select one here to edit or delete, or add a new one below." ) ); | ||
170 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 172 | m_serverList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
171 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) ); | 173 | connect( m_serverList, SIGNAL(highlighted(int)), this, SLOT(slotServerEdit(int)) ); |
172 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); | 174 | layout->addMultiCellWidget( m_serverList, 0, 0, 0, 1 ); |
173 | 175 | ||
174 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 176 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
177 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | ||
175 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); | 178 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerNew()) ); |
176 | layout->addWidget( btn, 1, 0 ); | 179 | layout->addWidget( btn, 1, 0 ); |
177 | 180 | ||
178 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 181 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
182 | QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); | ||
179 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); | 183 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerDelete()) ); |
180 | layout->addWidget( btn, 1, 1 ); | 184 | layout->addWidget( btn, 1, 1 ); |
181 | 185 | ||
182 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 186 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); |
183 | grpbox->layout()->setSpacing( 2 ); | 187 | grpbox->layout()->setSpacing( 2 ); |
184 | grpbox->layout()->setMargin( 4 ); | 188 | grpbox->layout()->setMargin( 4 ); |
185 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 189 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
186 | 190 | ||
187 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 191 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
188 | 192 | ||
189 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 193 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
194 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | ||
190 | grplayout->addWidget( label, 0, 0 ); | 195 | grplayout->addWidget( label, 0, 0 ); |
191 | m_serverName = new QLineEdit( grpbox ); | 196 | m_serverName = new QLineEdit( grpbox ); |
197 | QWhatsThis::add( m_serverName, tr( "Enter the name of this entry here." ) ); | ||
192 | grplayout->addWidget( m_serverName, 0, 1 ); | 198 | grplayout->addWidget( m_serverName, 0, 1 ); |
193 | 199 | ||
194 | label = new QLabel( tr( "Address:" ), grpbox ); | 200 | label = new QLabel( tr( "Address:" ), grpbox ); |
201 | QWhatsThis::add( label, tr( "Enter the URL address of this entry here." ) ); | ||
195 | grplayout->addWidget( label, 1, 0 ); | 202 | grplayout->addWidget( label, 1, 0 ); |
196 | m_serverLocation = new QLineEdit( grpbox ); | 203 | m_serverLocation = new QLineEdit( grpbox ); |
204 | QWhatsThis::add( m_serverLocation, tr( "Enter the URL address of this entry here." ) ); | ||
197 | grplayout->addWidget( m_serverLocation, 1, 1 ); | 205 | grplayout->addWidget( m_serverLocation, 1, 1 ); |
198 | 206 | ||
199 | m_serverActive = new QCheckBox( tr( "Active Server" ), grpbox ); | 207 | m_serverActive = new QCheckBox( tr( "Active" ), grpbox ); |
208 | QWhatsThis::add( m_serverActive, tr( "Tap here to indicate whether this entry is active or not." ) ); | ||
200 | grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 ); | 209 | grplayout->addMultiCellWidget( m_serverActive, 2, 2, 0, 1 ); |
201 | 210 | ||
202 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 211 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
212 | QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); | ||
203 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) ); | 213 | connect( btn, SIGNAL(clicked()), this, SLOT(slotServerUpdate()) ); |
204 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 214 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
205 | } | 215 | } |
206 | 216 | ||
207 | void OIpkgConfigDlg::initDestinationWidget() | 217 | void OIpkgConfigDlg::initDestinationWidget() |
208 | { | 218 | { |
209 | m_destWidget = new QWidget( this ); | 219 | m_destWidget = new QWidget( this ); |
210 | 220 | ||
211 | // Initialize UI | 221 | // Initialize UI |
212 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); | 222 | QVBoxLayout *vb = new QVBoxLayout( m_destWidget ); |
213 | QScrollView *sv = new QScrollView( m_destWidget ); | 223 | QScrollView *sv = new QScrollView( m_destWidget ); |
214 | vb->addWidget( sv, 0, 0 ); | 224 | vb->addWidget( sv, 0, 0 ); |
215 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 225 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
216 | sv->setFrameStyle( QFrame::NoFrame ); | 226 | sv->setFrameStyle( QFrame::NoFrame ); |
217 | QWidget *container = new QWidget( sv->viewport() ); | 227 | QWidget *container = new QWidget( sv->viewport() ); |
218 | sv->addChild( container ); | 228 | sv->addChild( container ); |
219 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); | 229 | QGridLayout *layout = new QGridLayout( container, 3, 2, 2, 4 ); |
220 | 230 | ||
221 | m_destList = new QListBox( container ); | 231 | m_destList = new QListBox( container ); |
232 | 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." ) ); | ||
222 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); | 233 | m_destList->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); |
223 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestEdit(int)) ); | 234 | connect( m_destList, SIGNAL(highlighted(int)), this, SLOT(slotDestEdit(int)) ); |
224 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 1 ); | 235 | layout->addMultiCellWidget( m_destList, 0, 0, 0, 1 ); |
225 | 236 | ||
226 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); | 237 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); |
238 | QWhatsThis::add( btn, tr( "Tap here to create a new entry. Fill in the fields below and then tap on Update." ) ); | ||
227 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); | 239 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestNew()) ); |
228 | layout->addWidget( btn, 1, 0 ); | 240 | layout->addWidget( btn, 1, 0 ); |
229 | 241 | ||
230 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); | 242 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); |
243 | QWhatsThis::add( btn, tr( "Tap here to delete the entry selected above." ) ); | ||
231 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); | 244 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestDelete()) ); |
232 | layout->addWidget( btn, 1, 1 ); | 245 | layout->addWidget( btn, 1, 1 ); |
233 | 246 | ||
234 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); | 247 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); |
235 | grpbox->layout()->setSpacing( 2 ); | 248 | grpbox->layout()->setSpacing( 2 ); |
236 | grpbox->layout()->setMargin( 4 ); | 249 | grpbox->layout()->setMargin( 4 ); |
237 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); | 250 | layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); |
238 | 251 | ||
239 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); | 252 | QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); |
240 | 253 | ||
241 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); | 254 | QLabel *label = new QLabel( tr( "Name:" ), grpbox ); |
255 | QWhatsThis::add( label, tr( "Enter the name of this entry here." ) ); | ||
242 | grplayout->addWidget( label, 0, 0 ); | 256 | grplayout->addWidget( label, 0, 0 ); |
243 | m_destName = new QLineEdit( grpbox ); | 257 | m_destName = new QLineEdit( grpbox ); |
258 | QWhatsThis::add( m_destName, tr( "Enter the name of this entry here." ) ); | ||
244 | grplayout->addWidget( m_destName, 0, 1 ); | 259 | grplayout->addWidget( m_destName, 0, 1 ); |
245 | 260 | ||
246 | label = new QLabel( tr( "Address:" ), grpbox ); | 261 | label = new QLabel( tr( "Location:" ), grpbox ); |
262 | QWhatsThis::add( label, tr( "Enter the absolute directory path of this entry here." ) ); | ||
247 | grplayout->addWidget( label, 1, 0 ); | 263 | grplayout->addWidget( label, 1, 0 ); |
248 | m_destLocation = new QLineEdit( grpbox ); | 264 | m_destLocation = new QLineEdit( grpbox ); |
265 | QWhatsThis::add( m_destLocation, tr( "Enter the absolute directory path of this entry here." ) ); | ||
249 | grplayout->addWidget( m_destLocation, 1, 1 ); | 266 | grplayout->addWidget( m_destLocation, 1, 1 ); |
250 | 267 | ||
251 | m_destActive = new QCheckBox( tr( "Active Server" ), grpbox ); | 268 | m_destActive = new QCheckBox( tr( "Active" ), grpbox ); |
269 | QWhatsThis::add( m_destActive, tr( "Tap here to indicate whether this entry is active or not." ) ); | ||
252 | grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 1 ); | 270 | grplayout->addMultiCellWidget( m_destActive, 2, 2, 0, 1 ); |
253 | 271 | ||
254 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); | 272 | btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); |
273 | QWhatsThis::add( btn, tr( "Tap here to update the entry's information." ) ); | ||
255 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestUpdate()) ); | 274 | connect( btn, SIGNAL(clicked()), this, SLOT(slotDestUpdate()) ); |
256 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); | 275 | grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); |
257 | } | 276 | } |
258 | 277 | ||
259 | void OIpkgConfigDlg::initProxyWidget() | 278 | void OIpkgConfigDlg::initProxyWidget() |
260 | { | 279 | { |
261 | m_proxyWidget = new QWidget( this ); | 280 | m_proxyWidget = new QWidget( this ); |
262 | 281 | ||
263 | // Initialize UI | 282 | // Initialize UI |
264 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); | 283 | QVBoxLayout *vb = new QVBoxLayout( m_proxyWidget ); |
265 | QScrollView *sv = new QScrollView( m_proxyWidget ); | 284 | QScrollView *sv = new QScrollView( m_proxyWidget ); |
266 | vb->addWidget( sv, 0, 0 ); | 285 | vb->addWidget( sv, 0, 0 ); |
267 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 286 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
268 | sv->setFrameStyle( QFrame::NoFrame ); | 287 | sv->setFrameStyle( QFrame::NoFrame ); |
269 | QWidget *container = new QWidget( sv->viewport() ); | 288 | QWidget *container = new QWidget( sv->viewport() ); |
270 | sv->addChild( container ); | 289 | sv->addChild( container ); |
271 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); | 290 | QGridLayout *layout = new QGridLayout( container, 4, 2, 2, 4 ); |
272 | 291 | ||
273 | // HTTP proxy server configuration | 292 | // HTTP proxy server configuration |
274 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); | 293 | QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); |
275 | grpbox->layout()->setSpacing( 2 ); | 294 | grpbox->layout()->setSpacing( 2 ); |
276 | grpbox->layout()->setMargin( 4 ); | 295 | grpbox->layout()->setMargin( 4 ); |
277 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); | 296 | layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); |
278 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); | 297 | QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); |
279 | m_proxyHttpServer = new QLineEdit( grpbox ); | 298 | m_proxyHttpServer = new QLineEdit( grpbox ); |
299 | QWhatsThis::add( m_proxyHttpServer, tr( "Enter the URL address of the HTTP proxy server here." ) ); | ||
280 | grplayout->addWidget( m_proxyHttpServer ); | 300 | grplayout->addWidget( m_proxyHttpServer ); |
281 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 301 | m_proxyHttpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
302 | QWhatsThis::add( m_proxyHttpActive, tr( "Tap here to enable or disable the HTTP proxy server." ) ); | ||
282 | grplayout->addWidget( m_proxyHttpActive ); | 303 | grplayout->addWidget( m_proxyHttpActive ); |
283 | 304 | ||
284 | // FTP proxy server configuration | 305 | // FTP proxy server configuration |
285 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); | 306 | grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); |
286 | grpbox->layout()->setSpacing( 2 ); | 307 | grpbox->layout()->setSpacing( 2 ); |
287 | grpbox->layout()->setMargin( 4 ); | 308 | grpbox->layout()->setMargin( 4 ); |
288 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); | 309 | layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); |
289 | grplayout = new QVBoxLayout( grpbox->layout() ); | 310 | grplayout = new QVBoxLayout( grpbox->layout() ); |
290 | m_proxyFtpServer = new QLineEdit( grpbox ); | 311 | m_proxyFtpServer = new QLineEdit( grpbox ); |
312 | QWhatsThis::add( m_proxyFtpServer, tr( "Enter the URL address of the FTP proxy server here." ) ); | ||
291 | grplayout->addWidget( m_proxyFtpServer ); | 313 | grplayout->addWidget( m_proxyFtpServer ); |
292 | m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); | 314 | m_proxyFtpActive = new QCheckBox( tr( "Enabled" ), grpbox ); |
315 | QWhatsThis::add( m_proxyFtpActive, tr( "Tap here to enable or disable the FTP proxy server." ) ); | ||
293 | grplayout->addWidget( m_proxyFtpActive ); | 316 | grplayout->addWidget( m_proxyFtpActive ); |
294 | 317 | ||
295 | // Proxy server username and password configuration | 318 | // Proxy server username and password configuration |
296 | QLabel *label = new QLabel( tr( "Username:" ), container ); | 319 | QLabel *label = new QLabel( tr( "Username:" ), container ); |
320 | QWhatsThis::add( label, tr( "Enter the username for the proxy servers here." ) ); | ||
297 | layout->addWidget( label, 2, 0 ); | 321 | layout->addWidget( label, 2, 0 ); |
298 | m_proxyUsername = new QLineEdit( container ); | 322 | m_proxyUsername = new QLineEdit( container ); |
323 | QWhatsThis::add( m_proxyUsername, tr( "Enter the username for the proxy servers here." ) ); | ||
299 | layout->addWidget( m_proxyUsername, 2, 1 ); | 324 | layout->addWidget( m_proxyUsername, 2, 1 ); |
300 | 325 | ||
301 | label = new QLabel( tr( "Password:" ), container ); | 326 | label = new QLabel( tr( "Password:" ), container ); |
327 | QWhatsThis::add( label, tr( "Enter the password for the proxy servers here." ) ); | ||
302 | layout->addWidget( label, 3, 0 ); | 328 | layout->addWidget( label, 3, 0 ); |
303 | m_proxyPassword = new QLineEdit( container ); | 329 | m_proxyPassword = new QLineEdit( container ); |
330 | QWhatsThis::add( m_proxyPassword, tr( "Enter the password for the proxy servers here." ) ); | ||
304 | layout->addWidget( m_proxyPassword, 3, 1 ); | 331 | layout->addWidget( m_proxyPassword, 3, 1 ); |
305 | } | 332 | } |
306 | 333 | ||
307 | void OIpkgConfigDlg::initOptionsWidget() | 334 | void OIpkgConfigDlg::initOptionsWidget() |
308 | { | 335 | { |
309 | m_optionsWidget = new QWidget( this ); | 336 | m_optionsWidget = new QWidget( this ); |
310 | 337 | ||
311 | // Initialize UI | 338 | // Initialize UI |
312 | QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); | 339 | QVBoxLayout *vb = new QVBoxLayout( m_optionsWidget ); |
313 | QScrollView *sv = new QScrollView( m_optionsWidget ); | 340 | QScrollView *sv = new QScrollView( m_optionsWidget ); |
314 | vb->addWidget( sv, 0, 0 ); | 341 | vb->addWidget( sv, 0, 0 ); |
315 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 342 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
316 | sv->setFrameStyle( QFrame::NoFrame ); | 343 | sv->setFrameStyle( QFrame::NoFrame ); |
317 | QWidget *container = new QWidget( sv->viewport() ); | 344 | QWidget *container = new QWidget( sv->viewport() ); |
318 | sv->addChild( container ); | 345 | sv->addChild( container ); |
319 | QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 ); | 346 | QVBoxLayout *layout = new QVBoxLayout( container, 2, 4 ); |
320 | 347 | ||
321 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); | 348 | m_optForceDepends = new QCheckBox( tr( "Force Depends" ), container ); |
349 | QWhatsThis::add( m_optForceDepends, tr( "Tap here to enable or disable the '-force-depends' option for Ipkg." ) ); | ||
322 | layout->addWidget( m_optForceDepends ); | 350 | layout->addWidget( m_optForceDepends ); |
323 | 351 | ||
324 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); | 352 | m_optForceReinstall = new QCheckBox( tr( "Force Reinstall" ), container ); |
353 | QWhatsThis::add( m_optForceReinstall, tr( "Tap here to enable or disable the '-force-reinstall' option for Ipkg." ) ); | ||
325 | layout->addWidget( m_optForceReinstall ); | 354 | layout->addWidget( m_optForceReinstall ); |
326 | 355 | ||
327 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); | 356 | m_optForceRemove = new QCheckBox( tr( "Force Remove" ), container ); |
357 | QWhatsThis::add( m_optForceRemove, tr( "Tap here to enable or disable the '-force-removal-of-dependent-packages' option for Ipkg." ) ); | ||
328 | layout->addWidget( m_optForceRemove ); | 358 | layout->addWidget( m_optForceRemove ); |
329 | 359 | ||
330 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); | 360 | m_optForceOverwrite = new QCheckBox( tr( "Force Overwrite" ), container ); |
361 | QWhatsThis::add( m_optForceOverwrite, tr( "Tap here to enable or disable the '-force-overwrite' option for Ipkg." ) ); | ||
331 | layout->addWidget( m_optForceOverwrite ); | 362 | layout->addWidget( m_optForceOverwrite ); |
332 | 363 | ||
333 | QLabel *l = new QLabel( tr( "Information Level" ), container ); | 364 | QLabel *l = new QLabel( tr( "Information Level" ), container ); |
365 | QWhatsThis::add( l, tr( "Select information level for Ipkg." ) ); | ||
334 | layout->addWidget( l ); | 366 | layout->addWidget( l ); |
335 | 367 | ||
336 | m_optVerboseIpkg = new QComboBox( container ); | 368 | m_optVerboseIpkg = new QComboBox( container ); |
369 | QWhatsThis::add( m_optVerboseIpkg, tr( "Select information level for Ipkg." ) ); | ||
337 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); | 370 | m_optVerboseIpkg->insertItem( tr( "Errors only" ) ); |
338 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); | 371 | m_optVerboseIpkg->insertItem( tr( "Normal messages" ) ); |
339 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); | 372 | m_optVerboseIpkg->insertItem( tr( "Informative messages" ) ); |
340 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); | 373 | m_optVerboseIpkg->insertItem( tr( "Troubleshooting output" ) ); |
341 | layout->addWidget( m_optVerboseIpkg ); | 374 | layout->addWidget( m_optVerboseIpkg ); |
342 | 375 | ||
343 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); | 376 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); |
344 | } | 377 | } |
345 | 378 | ||
346 | void OIpkgConfigDlg::initData() | 379 | void OIpkgConfigDlg::initData() |
347 | { | 380 | { |
348 | // Read ipkg configuration (server/destination/proxy) information | 381 | // Read ipkg configuration (server/destination/proxy) information |
349 | if ( m_ipkg && !m_installOptions ) | 382 | if ( m_ipkg && !m_installOptions ) |
350 | { | 383 | { |
351 | m_configs = m_ipkg->configItems(); | 384 | m_configs = m_ipkg->configItems(); |
352 | if ( m_configs ) | 385 | if ( m_configs ) |
353 | { | 386 | { |
354 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) | 387 | for ( OConfItemListIterator configIt( *m_configs ); configIt.current(); ++configIt ) |
355 | { | 388 | { |
356 | OConfItem *config = configIt.current(); | 389 | OConfItem *config = configIt.current(); |
357 | 390 | ||
358 | // Add configuration item to the appropriate dialog controls | 391 | // Add configuration item to the appropriate dialog controls |
359 | if ( config ) | 392 | if ( config ) |
360 | { | 393 | { |
361 | if ( config->type() == OConfItem::Source ) | 394 | if ( config->type() == OConfItem::Source ) |
362 | { | 395 | { |
363 | m_serverList->insertItem( config->name() ); | 396 | m_serverList->insertItem( config->name() ); |
364 | } | 397 | } |
365 | else if ( config->type() == OConfItem::Destination ) | 398 | else if ( config->type() == OConfItem::Destination ) |
366 | { | 399 | { |
367 | m_destList->insertItem( config->name() ); | 400 | m_destList->insertItem( config->name() ); |
368 | } | 401 | } |
369 | else if ( config->type() == OConfItem::Option ) | 402 | else if ( config->type() == OConfItem::Option ) |
370 | { | 403 | { |
371 | if ( config->name() == "http_proxy" ) | 404 | if ( config->name() == "http_proxy" ) |
372 | { | 405 | { |
373 | m_proxyHttpServer->setText( config->value() ); | 406 | m_proxyHttpServer->setText( config->value() ); |
374 | m_proxyHttpActive->setChecked( config->active() ); | 407 | m_proxyHttpActive->setChecked( config->active() ); |
375 | } | 408 | } |
376 | else if ( config->name() == "ftp_proxy" ) | 409 | else if ( config->name() == "ftp_proxy" ) |
377 | { | 410 | { |
378 | m_proxyFtpServer->setText( config->value() ); | 411 | m_proxyFtpServer->setText( config->value() ); |
379 | m_proxyFtpActive->setChecked( config->active() ); | 412 | m_proxyFtpActive->setChecked( config->active() ); |
380 | } | 413 | } |
381 | else if ( config->name() == "proxy_username" ) | 414 | else if ( config->name() == "proxy_username" ) |
382 | { | 415 | { |
383 | m_proxyUsername->setText( config->value() ); | 416 | m_proxyUsername->setText( config->value() ); |
384 | } | 417 | } |
385 | else if ( config->name() == "proxy_password" ) | 418 | else if ( config->name() == "proxy_password" ) |
386 | { | 419 | { |
387 | m_proxyPassword->setText( config->value() ); | 420 | m_proxyPassword->setText( config->value() ); |
388 | } | 421 | } |
389 | } | 422 | } |
390 | } | 423 | } |
391 | } | 424 | } |
392 | } | 425 | } |
393 | } | 426 | } |
394 | 427 | ||
395 | // Get Ipkg execution options | 428 | // Get Ipkg execution options |
396 | int options = m_ipkg->ipkgExecOptions(); | 429 | int options = m_ipkg->ipkgExecOptions(); |
397 | if ( options & FORCE_DEPENDS ) | 430 | if ( options & FORCE_DEPENDS ) |
398 | m_optForceDepends->setChecked( true ); | 431 | m_optForceDepends->setChecked( true ); |
399 | if ( options & FORCE_REINSTALL ) | 432 | if ( options & FORCE_REINSTALL ) |
400 | m_optForceReinstall->setChecked( true ); | 433 | m_optForceReinstall->setChecked( true ); |
401 | if ( options & FORCE_REMOVE ) | 434 | if ( options & FORCE_REMOVE ) |
402 | m_optForceRemove->setChecked( true ); | 435 | m_optForceRemove->setChecked( true ); |
403 | if ( options & FORCE_OVERWRITE ) | 436 | if ( options & FORCE_OVERWRITE ) |
404 | m_optForceOverwrite->setChecked( true ); | 437 | m_optForceOverwrite->setChecked( true ); |
405 | 438 | ||
406 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 439 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
407 | } | 440 | } |
408 | 441 | ||
409 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) | 442 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) |
410 | { | 443 | { |
411 | // Find selected server in list | 444 | // Find selected server in list |
412 | OConfItemListIterator configIt( *m_configs ); | 445 | OConfItemListIterator configIt( *m_configs ); |
413 | OConfItem *config = 0x0; | 446 | OConfItem *config = 0x0; |
414 | for ( ; configIt.current(); ++configIt ) | 447 | for ( ; configIt.current(); ++configIt ) |
415 | { | 448 | { |
416 | config = configIt.current(); | 449 | config = configIt.current(); |
417 | if ( config->type() == type && config->name() == name ) | 450 | if ( config->type() == type && config->name() == name ) |
418 | break; | 451 | break; |
419 | } | 452 | } |
420 | 453 | ||
421 | if ( config && config->type() == type && config->name() == name ) | 454 | if ( config && config->type() == type && config->name() == name ) |
422 | return config; | 455 | return config; |
423 | 456 | ||
424 | return 0x0; | 457 | return 0x0; |
425 | } | 458 | } |
426 | 459 | ||
427 | void OIpkgConfigDlg::slotServerEdit( int index ) | 460 | void OIpkgConfigDlg::slotServerEdit( int index ) |
428 | { | 461 | { |
429 | m_serverNew = false; | 462 | m_serverNew = false; |
430 | m_serverCurrent = index; | 463 | m_serverCurrent = index; |
431 | 464 | ||
432 | // Find selected server in list | 465 | // Find selected server in list |
433 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 466 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); |
434 | 467 | ||
435 | // Display server details | 468 | // Display server details |
436 | if ( server ) | 469 | if ( server ) |
437 | { | 470 | { |
438 | m_serverCurrName = server->name(); | 471 | m_serverCurrName = server->name(); |
439 | m_serverName->setText( server->name() ); | 472 | m_serverName->setText( server->name() ); |
440 | m_serverLocation->setText( server->value() ); | 473 | m_serverLocation->setText( server->value() ); |
441 | m_serverActive->setChecked( server->active() ); | 474 | m_serverActive->setChecked( server->active() ); |
442 | m_serverName->setFocus(); | 475 | m_serverName->setFocus(); |
443 | } | 476 | } |
444 | } | 477 | } |
445 | 478 | ||
446 | void OIpkgConfigDlg::slotServerNew() | 479 | void OIpkgConfigDlg::slotServerNew() |
447 | { | 480 | { |
448 | m_serverNew = true; | 481 | m_serverNew = true; |
449 | 482 | ||
450 | m_serverName->setText( QString::null ); | 483 | m_serverName->setText( QString::null ); |
451 | m_serverLocation->setText( QString::null ); | 484 | m_serverLocation->setText( QString::null ); |
452 | m_serverActive->setChecked( true ); | 485 | m_serverActive->setChecked( true ); |
453 | m_serverName->setFocus(); | 486 | m_serverName->setFocus(); |
454 | } | 487 | } |
455 | 488 | ||
456 | void OIpkgConfigDlg::slotServerDelete() | 489 | void OIpkgConfigDlg::slotServerDelete() |
457 | { | 490 | { |
458 | // Find selected server in list | 491 | // Find selected server in list |
459 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 492 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); |
460 | 493 | ||
461 | // Delete server | 494 | // Delete server |
462 | if ( server ) | 495 | if ( server ) |
463 | { | 496 | { |
464 | m_configs->removeRef( server ); | 497 | m_configs->removeRef( server ); |
465 | m_serverList->removeItem( m_serverCurrent ); | 498 | m_serverList->removeItem( m_serverCurrent ); |
466 | } | 499 | } |
467 | } | 500 | } |
468 | 501 | ||
469 | void OIpkgConfigDlg::slotServerUpdate() | 502 | void OIpkgConfigDlg::slotServerUpdate() |
470 | { | 503 | { |
471 | QString newName = m_serverName->text(); | 504 | QString newName = m_serverName->text(); |
472 | 505 | ||
473 | // Convert any spaces to underscores | 506 | // Convert any spaces to underscores |
474 | newName.replace( QRegExp( " " ), "_" ); | 507 | newName.replace( QRegExp( " " ), "_" ); |
475 | 508 | ||
476 | if ( !m_serverNew ) | 509 | if ( !m_serverNew ) |
477 | { | 510 | { |
478 | // Find selected server in list | 511 | // Find selected server in list |
479 | OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); | 512 | OConfItem *server = findConfItem( OConfItem::Source, m_serverCurrName ); |
480 | 513 | ||
481 | // Delete server | 514 | // Delete server |
482 | if ( server ) | 515 | if ( server ) |
483 | { | 516 | { |
484 | // Update url | 517 | // Update url |
485 | server->setValue( m_serverLocation->text() ); | 518 | server->setValue( m_serverLocation->text() ); |
486 | server->setActive( m_serverActive->isChecked() ); | 519 | server->setActive( m_serverActive->isChecked() ); |
487 | 520 | ||
488 | // Check if server name has changed, if it has then we need to replace the key in the map | 521 | // Check if server name has changed, if it has then we need to replace the key in the map |
489 | if ( m_serverCurrName != newName ) | 522 | if ( m_serverCurrName != newName ) |
490 | { | 523 | { |
491 | // Update server name | 524 | // Update server name |
492 | server->setName( newName ); | 525 | server->setName( newName ); |
493 | 526 | ||
494 | // Update list box | 527 | // Update list box |
495 | m_serverList->changeItem( newName, m_serverCurrent ); | 528 | m_serverList->changeItem( newName, m_serverCurrent ); |
496 | } | 529 | } |
497 | } | 530 | } |
498 | } | 531 | } |
499 | else | 532 | else |
500 | { | 533 | { |
501 | // Add new destination to configuration list | 534 | // Add new destination to configuration list |
502 | m_configs->append( new OConfItem( QString::null, OConfItem::Source, newName, | 535 | m_configs->append( new OConfItem( QString::null, OConfItem::Source, newName, |
503 | m_serverLocation->text(), m_serverActive->isChecked() ) ); | 536 | m_serverLocation->text(), m_serverActive->isChecked() ) ); |
504 | m_configs->sort(); | 537 | m_configs->sort(); |
505 | 538 | ||
506 | m_serverList->insertItem( newName ); | 539 | m_serverList->insertItem( newName ); |
507 | m_serverList->setCurrentItem( m_serverList->count() ); | 540 | m_serverList->setCurrentItem( m_serverList->count() ); |
508 | m_serverNew = false; | 541 | m_serverNew = false; |
509 | m_serverList->insertItem( newName ); | 542 | m_serverList->insertItem( newName ); |
510 | } | 543 | } |
511 | } | 544 | } |
512 | 545 | ||
513 | void OIpkgConfigDlg::slotDestEdit( int index ) | 546 | void OIpkgConfigDlg::slotDestEdit( int index ) |
514 | { | 547 | { |
515 | m_destNew = false; | 548 | m_destNew = false; |
516 | m_destCurrent = index; | 549 | m_destCurrent = index; |
517 | 550 | ||
518 | // Find selected destination in list | 551 | // Find selected destination in list |
519 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 552 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
520 | 553 | ||
521 | // Display destination details | 554 | // Display destination details |
522 | if ( destination ) | 555 | if ( destination ) |
523 | { | 556 | { |
524 | m_destCurrName = destination->name(); | 557 | m_destCurrName = destination->name(); |
525 | m_destName->setText( destination->name() ); | 558 | m_destName->setText( destination->name() ); |
526 | m_destLocation->setText( destination->value() ); | 559 | m_destLocation->setText( destination->value() ); |
527 | m_destActive->setChecked( destination->active() ); | 560 | m_destActive->setChecked( destination->active() ); |
528 | m_destName->setFocus(); | 561 | m_destName->setFocus(); |
529 | } | 562 | } |
530 | } | 563 | } |
531 | 564 | ||
532 | void OIpkgConfigDlg::slotDestNew() | 565 | void OIpkgConfigDlg::slotDestNew() |
533 | { | 566 | { |
534 | m_destNew = true; | 567 | m_destNew = true; |
535 | 568 | ||
536 | m_destName->setText( QString::null ); | 569 | m_destName->setText( QString::null ); |
537 | m_destLocation->setText( QString::null ); | 570 | m_destLocation->setText( QString::null ); |
538 | m_destActive->setChecked( true ); | 571 | m_destActive->setChecked( true ); |
539 | m_destName->setFocus(); | 572 | m_destName->setFocus(); |
540 | } | 573 | } |
541 | 574 | ||
542 | void OIpkgConfigDlg::slotDestDelete() | 575 | void OIpkgConfigDlg::slotDestDelete() |
543 | { | 576 | { |
544 | // Find selected destination in list | 577 | // Find selected destination in list |
545 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 578 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); |
546 | 579 | ||
547 | // Delete destination | 580 | // Delete destination |
548 | if ( destination ) | 581 | if ( destination ) |
549 | { | 582 | { |
550 | m_configs->removeRef( destination ); | 583 | m_configs->removeRef( destination ); |
551 | m_destList->removeItem( m_destCurrent ); | 584 | m_destList->removeItem( m_destCurrent ); |
552 | } | 585 | } |
553 | } | 586 | } |
554 | 587 | ||
555 | void OIpkgConfigDlg::slotDestUpdate() | 588 | void OIpkgConfigDlg::slotDestUpdate() |
556 | { | 589 | { |
557 | QString newName = m_destName->text(); | 590 | QString newName = m_destName->text(); |
558 | 591 | ||
559 | // Convert any spaces to underscores | 592 | // Convert any spaces to underscores |
560 | newName.replace( QRegExp( " " ), "_" ); | 593 | newName.replace( QRegExp( " " ), "_" ); |
561 | 594 | ||
562 | if ( !m_destNew ) | 595 | if ( !m_destNew ) |
563 | { | 596 | { |
564 | // Find selected destination in list | 597 | // Find selected destination in list |
565 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); | 598 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destCurrName ); |
566 | 599 | ||
567 | // Display destination details | 600 | // Display destination details |
568 | if ( destination ) | 601 | if ( destination ) |
569 | { | 602 | { |
570 | // Update url | 603 | // Update url |
571 | destination->setValue( m_destLocation->text() ); | 604 | destination->setValue( m_destLocation->text() ); |
572 | destination->setActive( m_destActive->isChecked() ); | 605 | destination->setActive( m_destActive->isChecked() ); |
573 | 606 | ||
574 | // Check if destination name has changed, if it has then we need to replace the key in the map | 607 | // Check if destination name has changed, if it has then we need to replace the key in the map |
575 | if ( m_destCurrName != newName ) | 608 | if ( m_destCurrName != newName ) |
576 | { | 609 | { |
577 | // Update destination name | 610 | // Update destination name |
578 | destination->setName( newName ); | 611 | destination->setName( newName ); |
579 | 612 | ||
580 | // Update list box | 613 | // Update list box |
581 | m_destList->changeItem( newName, m_destCurrent ); | 614 | m_destList->changeItem( newName, m_destCurrent ); |
582 | } | 615 | } |
583 | } | 616 | } |
584 | } | 617 | } |
585 | else | 618 | else |
586 | { | 619 | { |
587 | // Add new destination to configuration list | 620 | // Add new destination to configuration list |
588 | m_configs->append( new OConfItem( QString::null, OConfItem::Destination, newName, | 621 | m_configs->append( new OConfItem( QString::null, OConfItem::Destination, newName, |
589 | m_destLocation->text(), m_destActive->isChecked() ) ); | 622 | m_destLocation->text(), m_destActive->isChecked() ) ); |
590 | m_configs->sort(); | 623 | m_configs->sort(); |
591 | 624 | ||
592 | m_destList->insertItem( newName ); | 625 | m_destList->insertItem( newName ); |
593 | m_destList->setCurrentItem( m_destList->count() ); | 626 | m_destList->setCurrentItem( m_destList->count() ); |
594 | m_destNew = false; | 627 | m_destNew = false; |
595 | } | 628 | } |
596 | } | 629 | } |