author | drw <drw> | 2004-01-24 18:17:58 (UTC) |
---|---|---|
committer | drw <drw> | 2004-01-24 18:17:58 (UTC) |
commit | 88b1045297b464cf1002b021a8981bd1087f8f2d (patch) (unidiff) | |
tree | 0dbbce38d4da253319fc0895ea8f2fdeb2b6940e | |
parent | 5f333c6832ff429a00498e6a36be950525541a2a (diff) | |
download | opie-88b1045297b464cf1002b021a8981bd1087f8f2d.zip opie-88b1045297b464cf1002b021a8981bd1087f8f2d.tar.gz opie-88b1045297b464cf1002b021a8981bd1087f8f2d.tar.bz2 |
Start of package information dialog, UI done, need to retrieve package data yet
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.h | 5 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.h | 9 |
4 files changed, 63 insertions, 11 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 486561d..05f21bc 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -1,667 +1,683 @@ | |||
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 | 51 | ||
51 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) | 52 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) |
52 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) | 53 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) |
53 | , m_config( "packman" ) | 54 | , m_config( "packman" ) |
54 | , m_packman( &m_config, this ) | 55 | , m_packman( &m_config, this ) |
55 | , m_menuBar( this ) | 56 | , m_menuBar( this ) |
56 | , m_toolBar( this ) | 57 | , m_toolBar( this ) |
57 | , m_findBar( this ) | 58 | , m_findBar( this ) |
58 | , m_widgetStack( this ) | 59 | , m_widgetStack( this ) |
59 | , m_packageList( this ) | 60 | , m_packageList( this ) |
60 | , m_statusWidget( this ) | 61 | , m_statusWidget( this ) |
61 | , m_statusText( &m_statusWidget ) | 62 | , m_statusText( &m_statusWidget ) |
62 | , m_statusBar( &m_statusWidget ) | 63 | , m_statusBar( &m_statusWidget ) |
63 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) | 64 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) |
64 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) | 65 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) |
65 | , m_iconNull( m_iconUpdated.size() ) | 66 | , m_iconNull( m_iconUpdated.size() ) |
66 | , m_filterName( QString::null ) | 67 | , m_filterName( QString::null ) |
67 | , m_filterServer( QString::null ) | 68 | , m_filterServer( QString::null ) |
68 | , m_filterDest( QString::null ) | 69 | , m_filterDest( QString::null ) |
69 | , m_filterStatus( OPackageManager::NotDefined ) | 70 | , m_filterStatus( OPackageManager::NotDefined ) |
70 | , m_filterCategory( QString::null ) | 71 | , m_filterCategory( QString::null ) |
71 | 72 | ||
72 | { | 73 | { |
73 | // setCaption( tr( "Package Manager" ) ); | 74 | // setCaption( tr( "Package Manager" ) ); |
74 | 75 | ||
75 | m_iconNull.fill( colorGroup().base() ); | 76 | m_iconNull.fill( colorGroup().base() ); |
76 | 77 | ||
77 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); | 78 | connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); |
78 | 79 | ||
79 | // Initialize widget stack, package list and status widget | 80 | // Initialize widget stack, package list and status widget |
80 | initStatusWidget(); | 81 | initStatusWidget(); |
81 | initPackageList(); | 82 | initPackageList(); |
82 | 83 | ||
83 | m_widgetStack.addWidget( &m_statusWidget, 2 ); | 84 | m_widgetStack.addWidget( &m_statusWidget, 2 ); |
84 | m_widgetStack.addWidget( &m_packageList, 1 ); | 85 | m_widgetStack.addWidget( &m_packageList, 1 ); |
85 | setCentralWidget( &m_widgetStack ); | 86 | setCentralWidget( &m_widgetStack ); |
86 | 87 | ||
87 | // Initialize remaining user interface items | 88 | // Initialize remaining user interface items |
88 | initUI(); | 89 | initUI(); |
89 | 90 | ||
90 | // Initialize package information | 91 | // Initialize package information |
91 | QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); | 92 | QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); |
92 | } | 93 | } |
93 | 94 | ||
94 | void MainWindow::closeEvent( QCloseEvent *event ) | 95 | void MainWindow::closeEvent( QCloseEvent *event ) |
95 | { | 96 | { |
96 | // 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 |
97 | bool close = m_widgetStack.visibleWidget() == &m_packageList || | 98 | bool close = m_widgetStack.visibleWidget() == &m_packageList || |
98 | m_widgetStack.visibleWidget() == &m_statusWidget; | 99 | m_widgetStack.visibleWidget() == &m_statusWidget; |
99 | if ( close ) | 100 | if ( close ) |
100 | { | 101 | { |
101 | // TODO - write out application configuration settings | 102 | // TODO - write out application configuration settings |
102 | 103 | ||
103 | // Write out package manager configuration settings | 104 | // Write out package manager configuration settings |
104 | m_packman.saveSettings(); | 105 | m_packman.saveSettings(); |
105 | event->accept(); | 106 | event->accept(); |
106 | } | 107 | } |
107 | else | 108 | else |
108 | { | 109 | { |
109 | delete m_widgetStack.visibleWidget(); | 110 | delete m_widgetStack.visibleWidget(); |
110 | m_widgetStack.raiseWidget( &m_packageList ); | 111 | m_widgetStack.raiseWidget( &m_packageList ); |
111 | event->ignore(); | 112 | event->ignore(); |
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | void MainWindow::initPackageList() | 116 | void MainWindow::initPackageList() |
116 | { | 117 | { |
117 | m_packageList.addColumn( tr( "Packages" ) ); | 118 | m_packageList.addColumn( tr( "Packages" ) ); |
118 | 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\nClick inside the box at the left to select a package." ) ); |
119 | 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)), | ||
122 | this, SLOT(slotDisplayPackageInfo(QListViewItem *)) ); | ||
120 | } | 123 | } |
121 | 124 | ||
122 | void MainWindow::initStatusWidget() | 125 | void MainWindow::initStatusWidget() |
123 | { | 126 | { |
124 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); | 127 | QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); |
125 | 128 | ||
126 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | 129 | m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); |
127 | layout->addWidget( &m_statusText ); | 130 | layout->addWidget( &m_statusText ); |
128 | 131 | ||
129 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); | 132 | connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); |
130 | 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 &)) ); |
131 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); | 134 | connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); |
132 | 135 | ||
133 | layout->addWidget( &m_statusBar ); | 136 | layout->addWidget( &m_statusBar ); |
134 | } | 137 | } |
135 | 138 | ||
136 | void MainWindow::initUI() | 139 | void MainWindow::initUI() |
137 | { | 140 | { |
138 | // Build menu and tool bars | 141 | // Build menu and tool bars |
139 | setToolBarsMovable( false ); | 142 | setToolBarsMovable( false ); |
140 | 143 | ||
141 | m_menuBar.setHorizontalStretchable( true ); | 144 | m_menuBar.setHorizontalStretchable( true ); |
142 | QMenuBar *mb = new QMenuBar( &m_menuBar ); | 145 | QMenuBar *mb = new QMenuBar( &m_menuBar ); |
143 | mb->setMargin( 0 ); | 146 | mb->setMargin( 0 ); |
144 | 147 | ||
145 | // Find toolbar | 148 | // Find toolbar |
146 | addToolBar( &m_findBar, QMainWindow::Top, true ); | 149 | addToolBar( &m_findBar, QMainWindow::Top, true ); |
147 | m_findBar.setHorizontalStretchable( true ); | 150 | m_findBar.setHorizontalStretchable( true ); |
148 | m_findEdit = new QLineEdit( &m_findBar ); | 151 | m_findEdit = new QLineEdit( &m_findBar ); |
149 | 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." ) ); |
150 | m_findBar.setStretchableWidget( m_findEdit ); | 153 | m_findBar.setStretchableWidget( m_findEdit ); |
151 | 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 &)) ); |
152 | 155 | ||
153 | // Packages menu | 156 | // Packages menu |
154 | QPopupMenu *popup = new QPopupMenu( this ); | 157 | QPopupMenu *popup = new QPopupMenu( this ); |
155 | 158 | ||
156 | 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 ); |
157 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 160 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
158 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); | 161 | connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); |
159 | a->addTo( popup ); | 162 | a->addTo( popup ); |
160 | a->addTo( &m_toolBar ); | 163 | a->addTo( &m_toolBar ); |
161 | 164 | ||
162 | 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 ); |
163 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 166 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
164 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); | 167 | connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); |
165 | actionUpgrade->addTo( popup ); | 168 | actionUpgrade->addTo( popup ); |
166 | actionUpgrade->addTo( &m_toolBar ); | 169 | actionUpgrade->addTo( &m_toolBar ); |
167 | 170 | ||
168 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); | 171 | QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); |
169 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); | 172 | QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); |
170 | 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 ); |
171 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 174 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
172 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); | 175 | connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); |
173 | actionDownload->addTo( popup ); | 176 | actionDownload->addTo( popup ); |
174 | actionDownload->addTo( &m_toolBar ); | 177 | actionDownload->addTo( &m_toolBar ); |
175 | 178 | ||
176 | 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 ); |
177 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 180 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
178 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); | 181 | connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); |
179 | a->addTo( popup ); | 182 | a->addTo( popup ); |
180 | a->addTo( &m_toolBar ); | 183 | a->addTo( &m_toolBar ); |
181 | 184 | ||
182 | popup->insertSeparator(); | 185 | popup->insertSeparator(); |
183 | 186 | ||
184 | 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 ); |
185 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 188 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
186 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); | 189 | connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); |
187 | a->addTo( popup ); | 190 | a->addTo( popup ); |
188 | mb->insertItem( tr( "Actions" ), popup ); | 191 | mb->insertItem( tr( "Actions" ), popup ); |
189 | 192 | ||
190 | // View menu | 193 | // View menu |
191 | popup = new QPopupMenu( this ); | 194 | popup = new QPopupMenu( this ); |
192 | 195 | ||
193 | 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 ); |
194 | m_actionShowNotInstalled->setToggleAction( true ); | 197 | m_actionShowNotInstalled->setToggleAction( true ); |
195 | m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 198 | m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
196 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); | 199 | connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); |
197 | m_actionShowNotInstalled->addTo( popup ); | 200 | m_actionShowNotInstalled->addTo( popup ); |
198 | 201 | ||
199 | 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 ); |
200 | m_actionShowInstalled->setToggleAction( true ); | 203 | m_actionShowInstalled->setToggleAction( true ); |
201 | m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 204 | m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
202 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); | 205 | connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); |
203 | m_actionShowInstalled->addTo( popup ); | 206 | m_actionShowInstalled->addTo( popup ); |
204 | 207 | ||
205 | 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 ); |
206 | m_actionShowUpdated->setToggleAction( true ); | 209 | m_actionShowUpdated->setToggleAction( true ); |
207 | 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( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
208 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); | 211 | connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); |
209 | m_actionShowUpdated->addTo( popup ); | 212 | m_actionShowUpdated->addTo( popup ); |
210 | 213 | ||
211 | popup->insertSeparator(); | 214 | popup->insertSeparator(); |
212 | 215 | ||
213 | a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); | 216 | a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); |
214 | a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); | 217 | a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); |
215 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | 218 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); |
216 | a->addTo( popup ); | 219 | a->addTo( popup ); |
217 | 220 | ||
218 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 221 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), |
219 | QString::null, 0, this, 0 ); | 222 | QString::null, 0, this, 0 ); |
220 | m_actionFilter->setToggleAction( true ); | 223 | m_actionFilter->setToggleAction( true ); |
221 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); | 224 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); |
222 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 225 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
223 | m_actionFilter->addTo( popup ); | 226 | m_actionFilter->addTo( popup ); |
224 | 227 | ||
225 | popup->insertSeparator(); | 228 | popup->insertSeparator(); |
226 | 229 | ||
227 | 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 ); |
228 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | 231 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); |
229 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); | 232 | connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); |
230 | a->addTo( popup ); | 233 | a->addTo( popup ); |
231 | 234 | ||
232 | 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 ); |
233 | m_actionFindNext->setEnabled( false ); | 236 | m_actionFindNext->setEnabled( false ); |
234 | m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 237 | m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
235 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); | 238 | connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); |
236 | m_actionFindNext->addTo( popup ); | 239 | m_actionFindNext->addTo( popup ); |
237 | m_actionFindNext->addTo( &m_findBar ); | 240 | m_actionFindNext->addTo( &m_findBar ); |
238 | 241 | ||
239 | mb->insertItem( tr( "View" ), popup ); | 242 | mb->insertItem( tr( "View" ), popup ); |
240 | 243 | ||
241 | // Finish find toolbar creation | 244 | // Finish find toolbar creation |
242 | 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 ); |
243 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 246 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
244 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); | 247 | connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); |
245 | a->addTo( &m_findBar ); | 248 | a->addTo( &m_findBar ); |
246 | m_findBar.hide(); | 249 | m_findBar.hide(); |
247 | } | 250 | } |
248 | 251 | ||
249 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) | 252 | void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) |
250 | { | 253 | { |
251 | if ( clearList ) | 254 | if ( clearList ) |
252 | m_packageList.clear(); | 255 | m_packageList.clear(); |
253 | 256 | ||
254 | if ( packages ) | 257 | if ( packages ) |
255 | { | 258 | { |
256 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) | 259 | for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) |
257 | { | 260 | { |
258 | OPackage *package = packageIt.current(); | 261 | OPackage *package = packageIt.current(); |
259 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), | 262 | QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), |
260 | QCheckListItem::CheckBox ); | 263 | QCheckListItem::CheckBox ); |
261 | m_packageList.insertItem( item ); | 264 | m_packageList.insertItem( item ); |
262 | 265 | ||
263 | // 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 |
264 | // Otherwise, show installed icon | 267 | // Otherwise, show installed icon |
265 | if ( !package->versionInstalled().isNull() ) | 268 | if ( !package->versionInstalled().isNull() ) |
266 | { | 269 | { |
267 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 270 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
268 | item->setPixmap( 0, m_iconUpdated ); | 271 | item->setPixmap( 0, m_iconUpdated ); |
269 | else | 272 | else |
270 | item->setPixmap( 0, m_iconInstalled ); | 273 | item->setPixmap( 0, m_iconInstalled ); |
271 | } | 274 | } |
272 | else | 275 | else |
273 | item->setPixmap( 0, m_iconNull ); | 276 | item->setPixmap( 0, m_iconNull ); |
274 | } | 277 | } |
275 | } | 278 | } |
276 | } | 279 | } |
277 | 280 | ||
278 | void MainWindow::searchForPackage( const QString &text ) | 281 | void MainWindow::searchForPackage( const QString &text ) |
279 | { | 282 | { |
280 | if ( !text.isEmpty() ) | 283 | if ( !text.isEmpty() ) |
281 | { | 284 | { |
282 | // look through package list for text startng at current position | 285 | // look through package list for text startng at current position |
283 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); | 286 | QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); |
284 | if ( start == 0 ) | 287 | if ( start == 0 ) |
285 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 288 | start = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
286 | 289 | ||
287 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; | 290 | // for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; |
288 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; | 291 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; |
289 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 292 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
290 | { | 293 | { |
291 | if ( item->text().lower().find( text ) != -1 ) | 294 | if ( item->text().lower().find( text ) != -1 ) |
292 | { | 295 | { |
293 | m_packageList.ensureItemVisible( item ); | 296 | m_packageList.ensureItemVisible( item ); |
294 | m_packageList.setCurrentItem( item ); | 297 | m_packageList.setCurrentItem( item ); |
295 | break; | 298 | break; |
296 | } | 299 | } |
297 | } | 300 | } |
298 | } | 301 | } |
299 | } | 302 | } |
300 | 303 | ||
301 | void MainWindow::initPackageInfo() | 304 | void MainWindow::initPackageInfo() |
302 | { | 305 | { |
303 | m_widgetStack.raiseWidget( &m_statusWidget ); | 306 | m_widgetStack.raiseWidget( &m_statusWidget ); |
304 | 307 | ||
305 | // Load package list | 308 | // Load package list |
306 | m_packman.loadAvailablePackages(); | 309 | m_packman.loadAvailablePackages(); |
307 | m_packman.loadInstalledPackages(); | 310 | m_packman.loadInstalledPackages(); |
308 | 311 | ||
309 | OPackageList *packageList = m_packman.packages(); | 312 | OPackageList *packageList = m_packman.packages(); |
310 | if ( packageList ) | 313 | if ( packageList ) |
311 | { | 314 | { |
312 | loadPackageList( packageList, true ); | 315 | loadPackageList( packageList, true ); |
313 | delete packageList; | 316 | delete packageList; |
314 | } | 317 | } |
315 | 318 | ||
316 | m_widgetStack.raiseWidget( &m_packageList ); | 319 | m_widgetStack.raiseWidget( &m_packageList ); |
317 | } | 320 | } |
318 | 321 | ||
319 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 322 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
320 | { | 323 | { |
321 | if ( widget == &m_packageList ) | 324 | if ( widget == &m_packageList ) |
322 | { | 325 | { |
323 | setCaption( tr( "Package Manager" ) ); | 326 | setCaption( tr( "Package Manager" ) ); |
324 | 327 | ||
325 | m_menuBar.show(); | 328 | m_menuBar.show(); |
326 | m_toolBar.show(); | 329 | m_toolBar.show(); |
327 | } | 330 | } |
328 | else | 331 | else |
329 | { | 332 | { |
330 | m_menuBar.hide(); | 333 | m_menuBar.hide(); |
331 | m_toolBar.hide(); | 334 | m_toolBar.hide(); |
332 | } | 335 | } |
333 | } | 336 | } |
334 | 337 | ||
335 | void MainWindow::slotInitStatusBar( int numSteps ) | 338 | void MainWindow::slotInitStatusBar( int numSteps ) |
336 | { | 339 | { |
337 | m_statusBar.setTotalSteps( numSteps ); | 340 | m_statusBar.setTotalSteps( numSteps ); |
338 | } | 341 | } |
339 | 342 | ||
340 | void MainWindow::slotStatusText( const QString &status ) | 343 | void MainWindow::slotStatusText( const QString &status ) |
341 | { | 344 | { |
342 | m_statusText.setText( status ); | 345 | m_statusText.setText( status ); |
343 | } | 346 | } |
344 | 347 | ||
345 | void MainWindow::slotStatusBar( int currStep ) | 348 | void MainWindow::slotStatusBar( int currStep ) |
346 | { | 349 | { |
347 | m_statusBar.setProgress( currStep ); | 350 | m_statusBar.setProgress( currStep ); |
348 | } | 351 | } |
349 | 352 | ||
350 | void MainWindow::slotUpdate() | 353 | void MainWindow::slotUpdate() |
351 | { | 354 | { |
352 | // Create package manager output widget | 355 | // Create package manager output widget |
353 | 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, |
354 | OPackage::Update ); | 357 | OPackage::Update ); |
355 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); | 358 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
356 | 359 | ||
357 | // Display widget | 360 | // Display widget |
358 | m_widgetStack.addWidget( dlg, 3 ); | 361 | m_widgetStack.addWidget( dlg, 3 ); |
359 | m_widgetStack.raiseWidget( dlg ); | 362 | m_widgetStack.raiseWidget( dlg ); |
360 | } | 363 | } |
361 | 364 | ||
362 | void MainWindow::slotUpgrade() | 365 | void MainWindow::slotUpgrade() |
363 | { | 366 | { |
364 | // Create package manager output widget | 367 | // Create package manager output widget |
365 | 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, |
366 | OPackage::Upgrade ); | 369 | OPackage::Upgrade ); |
367 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); | 370 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
368 | 371 | ||
369 | // Display widget | 372 | // Display widget |
370 | m_widgetStack.addWidget( dlg, 3 ); | 373 | m_widgetStack.addWidget( dlg, 3 ); |
371 | m_widgetStack.raiseWidget( dlg ); | 374 | m_widgetStack.raiseWidget( dlg ); |
372 | } | 375 | } |
373 | 376 | ||
374 | void MainWindow::slotDownload() | 377 | void MainWindow::slotDownload() |
375 | { | 378 | { |
376 | // Retrieve list of packages selected for download (if any) | 379 | // Retrieve list of packages selected for download (if any) |
377 | QStringList *workingPackages = new QStringList(); | 380 | QStringList *workingPackages = new QStringList(); |
378 | 381 | ||
379 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 382 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
380 | item != 0 ; | 383 | item != 0 ; |
381 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 384 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
382 | { | 385 | { |
383 | if ( item->isOn() ) | 386 | if ( item->isOn() ) |
384 | workingPackages->append( item->text() ); | 387 | workingPackages->append( item->text() ); |
385 | } | 388 | } |
386 | 389 | ||
387 | if ( workingPackages->isEmpty() ) | 390 | if ( workingPackages->isEmpty() ) |
388 | { | 391 | { |
389 | 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" ) ); |
390 | return; | 393 | return; |
391 | } | 394 | } |
392 | else | 395 | else |
393 | { | 396 | { |
394 | // Download selected packages | 397 | // Download selected packages |
395 | m_config.setGroup( "settings" ); | 398 | m_config.setGroup( "settings" ); |
396 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); | 399 | QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); |
397 | 400 | ||
398 | bool ok = false; | 401 | bool ok = false; |
399 | 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 ); |
400 | if ( ok && !text.isEmpty() ) | 403 | if ( ok && !text.isEmpty() ) |
401 | workingDir = text; // user entered something and pressed ok | 404 | workingDir = text; // user entered something and pressed ok |
402 | else | 405 | else |
403 | return; // user entered nothing or pressed cancel | 406 | return; // user entered nothing or pressed cancel |
404 | 407 | ||
405 | // Store download directory in config file | 408 | // Store download directory in config file |
406 | m_config.writeEntry( "DownloadDir", workingDir ); | 409 | m_config.writeEntry( "DownloadDir", workingDir ); |
407 | 410 | ||
408 | // Get starting directory | 411 | // Get starting directory |
409 | QDir::setCurrent( workingDir ); | 412 | QDir::setCurrent( workingDir ); |
410 | 413 | ||
411 | // Create package manager output widget | 414 | // Create package manager output widget |
412 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, | 415 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, |
413 | OPackage::Download, workingPackages ); | 416 | OPackage::Download, workingPackages ); |
414 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); | 417 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
415 | 418 | ||
416 | // Display widget | 419 | // Display widget |
417 | m_widgetStack.addWidget( dlg, 3 ); | 420 | m_widgetStack.addWidget( dlg, 3 ); |
418 | m_widgetStack.raiseWidget( dlg ); | 421 | m_widgetStack.raiseWidget( dlg ); |
419 | } | 422 | } |
420 | } | 423 | } |
421 | 424 | ||
422 | void MainWindow::slotApply() | 425 | void MainWindow::slotApply() |
423 | { | 426 | { |
424 | QStringList *removeList = 0x0; | 427 | QStringList *removeList = 0x0; |
425 | QStringList *installList = 0x0; | 428 | QStringList *installList = 0x0; |
426 | QStringList *upgradeList = 0x0; | 429 | QStringList *upgradeList = 0x0; |
427 | 430 | ||
428 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); | 431 | for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); |
429 | item != 0 ; | 432 | item != 0 ; |
430 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) | 433 | item = static_cast<QCheckListItem *>(item->nextSibling()) ) |
431 | { | 434 | { |
432 | if ( item->isOn() ) | 435 | if ( item->isOn() ) |
433 | { | 436 | { |
434 | OPackage *package = m_packman.findPackage( item->text() ); | 437 | OPackage *package = m_packman.findPackage( item->text() ); |
435 | if ( package ) | 438 | if ( package ) |
436 | { | 439 | { |
437 | if ( !package->versionInstalled().isNull() ) | 440 | if ( !package->versionInstalled().isNull() ) |
438 | { | 441 | { |
439 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) | 442 | if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) |
440 | { | 443 | { |
441 | // Remove/upgrade package | 444 | // Remove/upgrade package |
442 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), | 445 | int answer = PromptDlg::ask( tr( "Remove or upgrade" ), |
443 | 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() ) ), |
444 | tr( "Remove" ), tr( "Upgrade" ), this ); | 447 | tr( "Remove" ), tr( "Upgrade" ), this ); |
445 | if ( answer == 1 ) // Remove | 448 | if ( answer == 1 ) // Remove |
446 | { | 449 | { |
447 | if ( !removeList ) | 450 | if ( !removeList ) |
448 | removeList = new QStringList(); | 451 | removeList = new QStringList(); |
449 | removeList->append( item->text() ); | 452 | removeList->append( item->text() ); |
450 | } | 453 | } |
451 | else if ( answer == 2 ) // Upgrade | 454 | else if ( answer == 2 ) // Upgrade |
452 | { | 455 | { |
453 | if ( !upgradeList ) | 456 | if ( !upgradeList ) |
454 | upgradeList = new QStringList(); | 457 | upgradeList = new QStringList(); |
455 | upgradeList->append( item->text() ); | 458 | upgradeList->append( item->text() ); |
456 | } | 459 | } |
457 | } | 460 | } |
458 | else | 461 | else |
459 | { | 462 | { |
460 | // Remove/reinstall package | 463 | // Remove/reinstall package |
461 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), | 464 | int answer = PromptDlg::ask( tr( "Remove or reinstall" ), |
462 | 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() ) ), |
463 | tr( "Remove" ), tr( "Reinstall" ), this ); | 466 | tr( "Remove" ), tr( "Reinstall" ), this ); |
464 | if ( answer == 1 ) // Remove | 467 | if ( answer == 1 ) // Remove |
465 | { | 468 | { |
466 | if ( !removeList ) | 469 | if ( !removeList ) |
467 | removeList = new QStringList(); | 470 | removeList = new QStringList(); |
468 | removeList->append( item->text() ); | 471 | removeList->append( item->text() ); |
469 | } | 472 | } |
470 | else if ( answer == 2 ) // Reinstall | 473 | else if ( answer == 2 ) // Reinstall |
471 | { | 474 | { |
472 | if ( !installList ) | 475 | if ( !installList ) |
473 | installList = new QStringList(); | 476 | installList = new QStringList(); |
474 | installList->append( item->text() ); | 477 | installList->append( item->text() ); |
475 | } | 478 | } |
476 | } | 479 | } |
477 | } | 480 | } |
478 | else | 481 | else |
479 | { | 482 | { |
480 | // Install package | 483 | // Install package |
481 | if ( !installList ) | 484 | if ( !installList ) |
482 | installList = new QStringList(); | 485 | installList = new QStringList(); |
483 | installList->append( item->text() ); | 486 | installList->append( item->text() ); |
484 | } | 487 | } |
485 | } | 488 | } |
486 | } | 489 | } |
487 | } | 490 | } |
488 | 491 | ||
489 | // If nothing is selected, display message and exit | 492 | // If nothing is selected, display message and exit |
490 | if ( !removeList && !installList && !upgradeList ) | 493 | if ( !removeList && !installList && !upgradeList ) |
491 | { | 494 | { |
492 | 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" ) ); |
493 | return; | 496 | return; |
494 | } | 497 | } |
495 | 498 | ||
496 | // Send command only if there are packages to process | 499 | // Send command only if there are packages to process |
497 | OPackage::Command removeCmd = OPackage::NotDefined; | 500 | OPackage::Command removeCmd = OPackage::NotDefined; |
498 | if ( removeList && !removeList->isEmpty() ) | 501 | if ( removeList && !removeList->isEmpty() ) |
499 | removeCmd = OPackage::Remove; | 502 | removeCmd = OPackage::Remove; |
500 | OPackage::Command installCmd = OPackage::NotDefined; | 503 | OPackage::Command installCmd = OPackage::NotDefined; |
501 | if ( installList && !installList->isEmpty() ) | 504 | if ( installList && !installList->isEmpty() ) |
502 | installCmd = OPackage::Install; | 505 | installCmd = OPackage::Install; |
503 | OPackage::Command upgradeCmd = OPackage::NotDefined; | 506 | OPackage::Command upgradeCmd = OPackage::NotDefined; |
504 | if ( upgradeList && !upgradeList->isEmpty() ) | 507 | if ( upgradeList && !upgradeList->isEmpty() ) |
505 | upgradeCmd = OPackage::Upgrade; | 508 | upgradeCmd = OPackage::Upgrade; |
506 | 509 | ||
507 | // Create package manager output widget | 510 | // Create package manager output widget |
508 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, | 511 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, |
509 | removeCmd, removeList, | 512 | removeCmd, removeList, |
510 | installCmd, installList, | 513 | installCmd, installList, |
511 | upgradeCmd, upgradeList ); | 514 | upgradeCmd, upgradeList ); |
512 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); | 515 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); |
513 | 516 | ||
514 | // Display widget | 517 | // Display widget |
515 | m_widgetStack.addWidget( dlg, 3 ); | 518 | m_widgetStack.addWidget( dlg, 3 ); |
516 | m_widgetStack.raiseWidget( dlg ); | 519 | m_widgetStack.raiseWidget( dlg ); |
517 | } | 520 | } |
518 | 521 | ||
519 | void MainWindow::slotCloseInstallDlg() | 522 | void MainWindow::slotCloseDlg() |
520 | { | 523 | { |
521 | // Close install dialog | 524 | // Close install dialog |
522 | delete m_widgetStack.visibleWidget(); | 525 | delete m_widgetStack.visibleWidget(); |
523 | 526 | ||
524 | // Reload package list | 527 | // Reload package list |
525 | initPackageInfo(); | 528 | initPackageInfo(); |
526 | 529 | ||
527 | // Update Opie launcher links | 530 | // Update Opie launcher links |
528 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 531 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
529 | QString lf = QString::null; | 532 | QString lf = QString::null; |
530 | e << lf; | 533 | e << lf; |
531 | } | 534 | } |
532 | 535 | ||
533 | void MainWindow::slotConfigure() | 536 | void MainWindow::slotConfigure() |
534 | { | 537 | { |
535 | if ( m_packman.configureDlg( false ) ) | 538 | if ( m_packman.configureDlg( false ) ) |
536 | { | 539 | { |
537 | if ( PromptDlg::ask( tr( "Config updated" ), | 540 | if ( PromptDlg::ask( tr( "Config updated" ), |
538 | 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?" ), |
539 | tr( "Yes" ), tr( "No" ), this ) == 1 ) | 542 | tr( "Yes" ), tr( "No" ), this ) == 1 ) |
540 | { | 543 | { |
541 | // Update package list and reload package info | 544 | // Update package list and reload package info |
542 | slotUpdate(); | 545 | slotUpdate(); |
543 | } | 546 | } |
544 | } | 547 | } |
545 | } | 548 | } |
546 | 549 | ||
547 | void MainWindow::slotShowNotInstalled() | 550 | void MainWindow::slotShowNotInstalled() |
548 | { | 551 | { |
549 | OPackageList *packageList; | 552 | OPackageList *packageList; |
550 | if ( m_actionShowNotInstalled->isOn() ) | 553 | if ( m_actionShowNotInstalled->isOn() ) |
551 | { | 554 | { |
552 | m_actionShowInstalled->setOn( false ); | 555 | m_actionShowInstalled->setOn( false ); |
553 | m_actionShowUpdated->setOn( false ); | 556 | m_actionShowUpdated->setOn( false ); |
554 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 557 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
555 | OPackageManager::NotInstalled, QString::null ); | 558 | OPackageManager::NotInstalled, QString::null ); |
556 | } | 559 | } |
557 | else | 560 | else |
558 | packageList = m_packman.packages(); | 561 | packageList = m_packman.packages(); |
559 | 562 | ||
560 | if ( packageList ) | 563 | if ( packageList ) |
561 | { | 564 | { |
562 | loadPackageList( packageList, true ); | 565 | loadPackageList( packageList, true ); |
563 | delete packageList; | 566 | delete packageList; |
564 | } | 567 | } |
565 | } | 568 | } |
566 | 569 | ||
567 | void MainWindow::slotShowInstalled() | 570 | void MainWindow::slotShowInstalled() |
568 | { | 571 | { |
569 | OPackageList *packageList; | 572 | OPackageList *packageList; |
570 | if ( m_actionShowInstalled->isOn() ) | 573 | if ( m_actionShowInstalled->isOn() ) |
571 | { | 574 | { |
572 | m_actionShowNotInstalled->setOn( false ); | 575 | m_actionShowNotInstalled->setOn( false ); |
573 | m_actionShowUpdated->setOn( false ); | 576 | m_actionShowUpdated->setOn( false ); |
574 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 577 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
575 | OPackageManager::Installed, QString::null ); | 578 | OPackageManager::Installed, QString::null ); |
576 | } | 579 | } |
577 | else | 580 | else |
578 | packageList = m_packman.packages(); | 581 | packageList = m_packman.packages(); |
579 | 582 | ||
580 | if ( packageList ) | 583 | if ( packageList ) |
581 | { | 584 | { |
582 | loadPackageList( packageList, true ); | 585 | loadPackageList( packageList, true ); |
583 | delete packageList; | 586 | delete packageList; |
584 | } | 587 | } |
585 | } | 588 | } |
586 | 589 | ||
587 | void MainWindow::slotShowUpdated() | 590 | void MainWindow::slotShowUpdated() |
588 | { | 591 | { |
589 | OPackageList *packageList; | 592 | OPackageList *packageList; |
590 | if ( m_actionShowUpdated->isOn() ) | 593 | if ( m_actionShowUpdated->isOn() ) |
591 | { | 594 | { |
592 | m_actionShowInstalled->setOn( false ); | 595 | m_actionShowInstalled->setOn( false ); |
593 | m_actionShowNotInstalled->setOn( false ); | 596 | m_actionShowNotInstalled->setOn( false ); |
594 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 597 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
595 | OPackageManager::Updated, QString::null ); | 598 | OPackageManager::Updated, QString::null ); |
596 | } | 599 | } |
597 | else | 600 | else |
598 | packageList = m_packman.packages(); | 601 | packageList = m_packman.packages(); |
599 | 602 | ||
600 | if ( packageList ) | 603 | if ( packageList ) |
601 | { | 604 | { |
602 | loadPackageList( packageList, true ); | 605 | loadPackageList( packageList, true ); |
603 | delete packageList; | 606 | delete packageList; |
604 | } | 607 | } |
605 | } | 608 | } |
606 | 609 | ||
607 | void MainWindow::slotFilterChange() | 610 | void MainWindow::slotFilterChange() |
608 | { | 611 | { |
609 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | 612 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, |
610 | m_filterCategory ); | 613 | m_filterCategory ); |
611 | if ( dlg.exec() == QDialog::Accepted ) | 614 | if ( dlg.exec() == QDialog::Accepted ) |
612 | { | 615 | { |
613 | m_filterName = dlg.name(); | 616 | m_filterName = dlg.name(); |
614 | m_filterServer = dlg.server(); | 617 | m_filterServer = dlg.server(); |
615 | m_filterDest = dlg.destination(); | 618 | m_filterDest = dlg.destination(); |
616 | m_filterStatus = dlg.status(); | 619 | m_filterStatus = dlg.status(); |
617 | m_filterCategory = dlg.category(); | 620 | m_filterCategory = dlg.category(); |
618 | m_actionFilter->setOn( true ); | 621 | m_actionFilter->setOn( true ); |
619 | slotFilter( true ); | 622 | slotFilter( true ); |
620 | } | 623 | } |
621 | else | 624 | else |
622 | { | 625 | { |
623 | m_actionFilter->setOn( false ); | 626 | m_actionFilter->setOn( false ); |
624 | slotFilter( false ); | 627 | slotFilter( false ); |
625 | } | 628 | } |
626 | } | 629 | } |
627 | 630 | ||
628 | void MainWindow::slotFilter( bool isOn ) | 631 | void MainWindow::slotFilter( bool isOn ) |
629 | { | 632 | { |
630 | OPackageList *packageList; | 633 | OPackageList *packageList; |
631 | if ( isOn ) | 634 | if ( isOn ) |
632 | { | 635 | { |
633 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 636 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, |
634 | m_filterStatus, m_filterCategory ); | 637 | m_filterStatus, m_filterCategory ); |
635 | } | 638 | } |
636 | else | 639 | else |
637 | packageList = m_packman.packages(); | 640 | packageList = m_packman.packages(); |
638 | 641 | ||
639 | if ( packageList ) | 642 | if ( packageList ) |
640 | { | 643 | { |
641 | loadPackageList( packageList, true ); | 644 | loadPackageList( packageList, true ); |
642 | delete packageList; | 645 | delete packageList; |
643 | } | 646 | } |
644 | } | 647 | } |
645 | 648 | ||
646 | void MainWindow::slotFindShowToolbar() | 649 | void MainWindow::slotFindShowToolbar() |
647 | { | 650 | { |
648 | m_findBar.show(); | 651 | m_findBar.show(); |
649 | m_findEdit->setFocus(); | 652 | m_findEdit->setFocus(); |
650 | } | 653 | } |
651 | 654 | ||
652 | void MainWindow::slotFindHideToolbar() | 655 | void MainWindow::slotFindHideToolbar() |
653 | { | 656 | { |
654 | m_findBar.hide(); | 657 | m_findBar.hide(); |
655 | } | 658 | } |
656 | 659 | ||
657 | void MainWindow::slotFindChanged( const QString &findText ) | 660 | void MainWindow::slotFindChanged( const QString &findText ) |
658 | { | 661 | { |
659 | 662 | ||
660 | m_actionFindNext->setEnabled( !findText.isEmpty() ); | 663 | m_actionFindNext->setEnabled( !findText.isEmpty() ); |
661 | searchForPackage( findText ); | 664 | searchForPackage( findText ); |
662 | } | 665 | } |
663 | 666 | ||
664 | void MainWindow::slotFindNext() | 667 | void MainWindow::slotFindNext() |
665 | { | 668 | { |
666 | searchForPackage( m_findEdit->text() ); | 669 | searchForPackage( m_findEdit->text() ); |
667 | } | 670 | } |
671 | |||
672 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | ||
673 | { | ||
674 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); | ||
675 | |||
676 | // Create package manager output widget | ||
677 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); | ||
678 | connect( dlg, SIGNAL(closeInfoDlg()), this, SLOT(slotCloseDlg()) ); | ||
679 | |||
680 | // Display widget | ||
681 | m_widgetStack.addWidget( dlg, 3 ); | ||
682 | m_widgetStack.raiseWidget( dlg ); | ||
683 | } | ||
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h index 285cddf..fb555c5 100644 --- a/noncore/settings/packagemanager/mainwindow.h +++ b/noncore/settings/packagemanager/mainwindow.h | |||
@@ -1,136 +1,139 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef MAINWINDOW_H | 30 | #ifndef MAINWINDOW_H |
31 | #define MAINWINDOW_H | 31 | #define MAINWINDOW_H |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlistview.h> | 34 | #include <qlistview.h> |
35 | #include <qmainwindow.h> | 35 | #include <qmainwindow.h> |
36 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
37 | #include <qprogressbar.h> | 37 | #include <qprogressbar.h> |
38 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
39 | #include <qwidgetstack.h> | 39 | #include <qwidgetstack.h> |
40 | 40 | ||
41 | #include <qpe/config.h> | 41 | #include <qpe/config.h> |
42 | 42 | ||
43 | #include "opackagemanager.h" | 43 | #include "opackagemanager.h" |
44 | 44 | ||
45 | class QAction; | 45 | class QAction; |
46 | class QLineEdit; | 46 | class QLineEdit; |
47 | 47 | ||
48 | class MainWindow :public QMainWindow | 48 | class MainWindow :public QMainWindow |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); | 53 | MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); |
54 | static QString appName() { return QString::fromLatin1( "packagemanager" ); }; | 54 | static QString appName() { return QString::fromLatin1( "packagemanager" ); }; |
55 | 55 | ||
56 | protected: | 56 | protected: |
57 | void closeEvent( QCloseEvent *event ); | 57 | void closeEvent( QCloseEvent *event ); |
58 | 58 | ||
59 | private: | 59 | private: |
60 | Config m_config; // Configuration file | 60 | Config m_config; // Configuration file |
61 | 61 | ||
62 | OPackageManager m_packman; // Package manager | 62 | OPackageManager m_packman; // Package manager |
63 | 63 | ||
64 | // Toolbars | 64 | // Toolbars |
65 | QToolBar m_menuBar; // Main toolbar containing menu | 65 | QToolBar m_menuBar; // Main toolbar containing menu |
66 | QToolBar m_toolBar; // Main toolbar | 66 | QToolBar m_toolBar; // Main toolbar |
67 | QToolBar m_findBar; // Find toolbar | 67 | QToolBar m_findBar; // Find toolbar |
68 | 68 | ||
69 | QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget | 69 | QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget |
70 | QListView m_packageList; // Main list view of all packages | 70 | QListView m_packageList; // Main list view of all packages |
71 | 71 | ||
72 | QLineEdit *m_findEdit; // Line edit box used for find toolbar | 72 | QLineEdit *m_findEdit; // Line edit box used for find toolbar |
73 | 73 | ||
74 | // Status widget controls | 74 | // Status widget controls |
75 | QWidget m_statusWidget; // Widget to display status during long operations | 75 | QWidget m_statusWidget; // Widget to display status during long operations |
76 | QLabel m_statusText; // Text status message | 76 | QLabel m_statusText; // Text status message |
77 | QProgressBar m_statusBar; // Progress bar showing % completed | 77 | QProgressBar m_statusBar; // Progress bar showing % completed |
78 | 78 | ||
79 | // Icon pixmaps | 79 | // Icon pixmaps |
80 | QPixmap m_iconUpdated; // Cached icon which shows when package can be updated | 80 | QPixmap m_iconUpdated; // Cached icon which shows when package can be updated |
81 | QPixmap m_iconInstalled; // Cached icon which shows when package is installed | 81 | QPixmap m_iconInstalled; // Cached icon which shows when package is installed |
82 | QPixmap m_iconNull; // Cached icon which shows when package is not installed | 82 | QPixmap m_iconNull; // Cached icon which shows when package is not installed |
83 | 83 | ||
84 | // Menu/tool bar actions | 84 | // Menu/tool bar actions |
85 | QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed | 85 | QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed |
86 | QAction *m_actionShowInstalled; // Action to show pakages currently installed | 86 | QAction *m_actionShowInstalled; // Action to show pakages currently installed |
87 | QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available | 87 | QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available |
88 | QAction *m_actionFilter; // Action to filter packages | 88 | QAction *m_actionFilter; // Action to filter packages |
89 | QAction *m_actionFindNext; // Action to find next match | 89 | QAction *m_actionFindNext; // Action to find next match |
90 | 90 | ||
91 | // Cached filter settings | 91 | // Cached filter settings |
92 | QString m_filterName; // Cached name filter value | 92 | QString m_filterName; // Cached name filter value |
93 | QString m_filterServer; // Cached server name filter value | 93 | QString m_filterServer; // Cached server name filter value |
94 | QString m_filterDest; // Cached destination name filter value | 94 | QString m_filterDest; // Cached destination name filter value |
95 | OPackageManager::Status m_filterStatus; // Cached status filter value | 95 | OPackageManager::Status m_filterStatus; // Cached status filter value |
96 | QString m_filterCategory; // Cached category filter value | 96 | QString m_filterCategory; // Cached category filter value |
97 | 97 | ||
98 | void initPackageList(); | 98 | void initPackageList(); |
99 | void initStatusWidget(); | 99 | void initStatusWidget(); |
100 | void initUI(); | 100 | void initUI(); |
101 | 101 | ||
102 | void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); | 102 | void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); |
103 | void searchForPackage( const QString &text ); | 103 | void searchForPackage( const QString &text ); |
104 | 104 | ||
105 | private slots: | 105 | private slots: |
106 | void initPackageInfo(); | 106 | void initPackageInfo(); |
107 | void slotWidgetStackShow( QWidget *widget ); | 107 | void slotWidgetStackShow( QWidget *widget ); |
108 | 108 | ||
109 | // Status widget slots | 109 | // Status widget slots |
110 | void slotInitStatusBar( int numSteps ); | 110 | void slotInitStatusBar( int numSteps ); |
111 | void slotStatusText( const QString &status ); | 111 | void slotStatusText( const QString &status ); |
112 | void slotStatusBar( int currStep ); | 112 | void slotStatusBar( int currStep ); |
113 | 113 | ||
114 | // Actions menu action slots | 114 | // Actions menu action slots |
115 | void slotUpdate(); | 115 | void slotUpdate(); |
116 | void slotUpgrade(); | 116 | void slotUpgrade(); |
117 | void slotDownload(); | 117 | void slotDownload(); |
118 | void slotApply(); | 118 | void slotApply(); |
119 | void slotCloseInstallDlg(); | 119 | void slotCloseDlg(); |
120 | void slotConfigure(); | 120 | void slotConfigure(); |
121 | 121 | ||
122 | // View menu action slots | 122 | // View menu action slots |
123 | void slotShowNotInstalled(); | 123 | void slotShowNotInstalled(); |
124 | void slotShowInstalled(); | 124 | void slotShowInstalled(); |
125 | void slotShowUpdated(); | 125 | void slotShowUpdated(); |
126 | void slotFilterChange(); | 126 | void slotFilterChange(); |
127 | void slotFilter( bool isOn ); | 127 | void slotFilter( bool isOn ); |
128 | 128 | ||
129 | // Find action slots | 129 | // Find action slots |
130 | void slotFindShowToolbar(); | 130 | void slotFindShowToolbar(); |
131 | void slotFindHideToolbar(); | 131 | void slotFindHideToolbar(); |
132 | void slotFindChanged( const QString &findText ); | 132 | void slotFindChanged( const QString &findText ); |
133 | void slotFindNext(); | 133 | void slotFindNext(); |
134 | |||
135 | // Other slots | ||
136 | void slotDisplayPackageInfo( QListViewItem * ); | ||
134 | }; | 137 | }; |
135 | 138 | ||
136 | #endif | 139 | #endif |
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp index 71f17eb..26356b9 100644 --- a/noncore/settings/packagemanager/packageinfodlg.cpp +++ b/noncore/settings/packagemanager/packageinfodlg.cpp | |||
@@ -1,56 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "packageinfodlg.h" | 30 | #include "packageinfodlg.h" |
31 | 31 | ||
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | 34 | ||
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | #include <opie/otabwidget.h> | ||
38 | |||
37 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) | 39 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) |
38 | : QWidget( 0x0 ) | 40 | : QWidget( 0x0 ) |
39 | , m_packman( pm ) | 41 | , m_packman( pm ) |
40 | , m_output( this ) | 42 | , m_information( this ) |
43 | , m_files( this ) | ||
41 | { | 44 | { |
42 | // Initialize UI | 45 | // Initialize UI |
43 | if ( parent ) | 46 | if ( parent ) |
44 | parent->setCaption( package ); | 47 | parent->setCaption( package ); |
45 | 48 | ||
46 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 0 ); | 49 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 0 ); |
47 | 50 | ||
48 | m_output.setReadOnly( true ); | 51 | OTabWidget *tabWidget = new OTabWidget( this ); |
49 | layout->addWidget( &m_output ); | 52 | layout->addWidget( tabWidget ); |
50 | 53 | ||
51 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); | 54 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); |
52 | layout->addWidget( btn ); | 55 | layout->addWidget( btn ); |
53 | // TODO connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnClose()) ); | 56 | connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnClose()) ); |
57 | |||
58 | // Information tab | ||
59 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); | ||
60 | m_information.setReadOnly( true ); | ||
61 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); | ||
62 | |||
63 | // Files tab | ||
64 | QWidget *filesWidget = new QWidget( tabWidget ); | ||
65 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 4, 0 ); | ||
66 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); | ||
67 | m_files.setReadOnly( true ); | ||
68 | filesLayout->addWidget( &m_files ); | ||
54 | 69 | ||
70 | btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Retrieve file list" ), | ||
71 | filesWidget ); | ||
72 | filesLayout->addWidget( btn ); | ||
73 | // TODO connect( btn, SIGNAL(clicked()), this, SLOT(slotFileScan()) ); | ||
74 | tabWidget->addTab( filesWidget, "binary", tr( "Files" ) ); | ||
55 | 75 | ||
76 | tabWidget->setCurrentTab( tr( "Information" ) ); | ||
77 | } | ||
78 | |||
79 | void PackageInfoDlg::slotBtnClose() | ||
80 | { | ||
81 | emit closeInfoDlg(); | ||
56 | } | 82 | } |
diff --git a/noncore/settings/packagemanager/packageinfodlg.h b/noncore/settings/packagemanager/packageinfodlg.h index 3bb9a7a..09af6f4 100644 --- a/noncore/settings/packagemanager/packageinfodlg.h +++ b/noncore/settings/packagemanager/packageinfodlg.h | |||
@@ -1,58 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef PACKAGEINFODLG_H | 30 | #ifndef PACKAGEINFODLG_H |
31 | #define PACKAGEINFODLG_H | 31 | #define PACKAGEINFODLG_H |
32 | 32 | ||
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | 35 | ||
36 | #include <opie/oprocess.h> | 36 | #include <opie/oprocess.h> |
37 | 37 | ||
38 | #include "opackage.h" | 38 | #include "opackage.h" |
39 | 39 | ||
40 | class QPushButton; | 40 | class QPushButton; |
41 | 41 | ||
42 | class OPackageManager; | 42 | class OPackageManager; |
43 | 43 | ||
44 | class PackageInfoDlg : public QWidget | 44 | class PackageInfoDlg : public QWidget |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null ); | 49 | PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null ); |
50 | 50 | ||
51 | private: | 51 | private: |
52 | OPackageManager *m_packman; // Pointer to application instance of package manager | 52 | OPackageManager *m_packman; // Pointer to application instance of package manager |
53 | 53 | ||
54 | // UI controls | 54 | // UI controls |
55 | QMultiLineEdit m_output; // Multi-line edit to display package information | 55 | QMultiLineEdit m_information; // Multi-line edit to display package information |
56 | QMultiLineEdit m_files; // Multi-line edit to display package file list | ||
57 | |||
58 | private slots: | ||
59 | void slotBtnClose(); | ||
60 | |||
61 | signals: | ||
62 | void closeInfoDlg(); | ||
56 | }; | 63 | }; |
57 | 64 | ||
58 | #endif | 65 | #endif |