author | drw <drw> | 2004-02-13 15:14:22 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-13 15:14:22 (UTC) |
commit | f3cf623e76060c8f4ee7c2eef241de02d63a2614 (patch) (unidiff) | |
tree | 949651c743a703448e4109e8189c78a1db7143ea | |
parent | 97bdea970b2fb017eef7d3b03d7a316eb216266b (diff) | |
download | opie-f3cf623e76060c8f4ee7c2eef241de02d63a2614.zip opie-f3cf623e76060c8f4ee7c2eef241de02d63a2614.tar.gz opie-f3cf623e76060c8f4ee7c2eef241de02d63a2614.tar.bz2 |
Fix handling of filtering options in View menu
-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 51 |
2 files changed, 48 insertions, 7 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index 744122f..6ad724f 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,21 +1,25 @@ | |||
1 | 2004-02-13 Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Fix handling of filtering options in View menu | ||
4 | |||
1 | 2004-02-12 Dan Williams <drw@handhelds.org> | 5 | 2004-02-12 Dan Williams <drw@handhelds.org> |
2 | 6 | ||
3 | * Package information dialog implemented | 7 | * Package information dialog implemented |
4 | * What's This app icon enabled | 8 | * What's This app icon enabled |
5 | * Changed all QDialog::exec() occurences to QPEApplication::execDialog() | 9 | * Changed all QDialog::exec() occurences to QPEApplication::execDialog() |
6 | 10 | ||
7 | 2004-01-23 Dan Williams <drw@handhelds.org> | 11 | 2004-01-23 Dan Williams <drw@handhelds.org> |
8 | 12 | ||
9 | * Added package download functionality | 13 | * Added package download functionality |
10 | * Have Opie update links after install/removal so that apps | 14 | * Have Opie update links after install/removal so that apps |
11 | will display properly in Launcher | 15 | will display properly in Launcher |
12 | 16 | ||
13 | 2004-01-20 Dan Williams <drw@handhelds.org> | 17 | 2004-01-20 Dan Williams <drw@handhelds.org> |
14 | 18 | ||
15 | * Released version 0.2.0 | 19 | * Released version 0.2.0 |
16 | * Converted to use libipkg in place of spawning ipkg process | 20 | * Converted to use libipkg in place of spawning ipkg process |
17 | 21 | ||
18 | 2004-01-13 Dan Williams <drw@handhelds.org> | 22 | 2004-01-13 Dan Williams <drw@handhelds.org> |
19 | 23 | ||
20 | * Released version 0.1.0 | 24 | * Released version 0.1.0 |
21 | * Initial check-in of new package management client to eventually replace AQPkg | 25 | * Initial check-in of new package management client to eventually replace AQPkg |
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 2cb11ba..8fd960f 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -1,682 +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\nClick inside the box at the left to select a package." ) ); |
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( "Click 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( "Click 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( "Click 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( "Click 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( "Click 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( "Click 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( "Click 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( "Click 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 | a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); | ||
217 | a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); | ||
218 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | ||
219 | a->addTo( popup ); | ||
220 | |||
221 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), | 216 | m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), |
222 | QString::null, 0, this, 0 ); | 217 | QString::null, 0, this, 0 ); |
223 | m_actionFilter->setToggleAction( true ); | 218 | m_actionFilter->setToggleAction( true ); |
224 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); | 219 | m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); |
225 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); | 220 | connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); |
226 | m_actionFilter->addTo( popup ); | 221 | m_actionFilter->addTo( popup ); |
227 | 222 | ||
223 | a = new QAction( tr( "Filter settings" ), QString::null, 0, this, 0 ); | ||
224 | a->setWhatsThis( tr( "Click here to change the package filter criteria." ) ); | ||
225 | connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); | ||
226 | a->addTo( popup ); | ||
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( "Click 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( "Click 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( "Click 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 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 558 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
558 | OPackageManager::NotInstalled, QString::null ); | 559 | OPackageManager::NotInstalled, QString::null ); |
559 | } | 560 | } |
560 | else | 561 | else |
561 | packageList = m_packman.packages(); | 562 | packageList = m_packman.packages(); |
562 | 563 | ||
563 | if ( packageList ) | 564 | if ( packageList ) |
564 | { | 565 | { |
565 | loadPackageList( packageList, true ); | 566 | loadPackageList( packageList, true ); |
566 | delete packageList; | 567 | delete packageList; |
567 | } | 568 | } |
568 | } | 569 | } |
569 | 570 | ||
570 | void MainWindow::slotShowInstalled() | 571 | void MainWindow::slotShowInstalled() |
571 | { | 572 | { |
572 | OPackageList *packageList; | 573 | OPackageList *packageList; |
573 | if ( m_actionShowInstalled->isOn() ) | 574 | if ( m_actionShowInstalled->isOn() ) |
574 | { | 575 | { |
575 | m_actionShowNotInstalled->setOn( false ); | 576 | m_actionShowNotInstalled->setOn( false ); |
576 | m_actionShowUpdated->setOn( false ); | 577 | m_actionShowUpdated->setOn( false ); |
578 | m_actionFilter->setOn( false ); | ||
577 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 579 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
578 | OPackageManager::Installed, QString::null ); | 580 | OPackageManager::Installed, QString::null ); |
579 | } | 581 | } |
580 | else | 582 | else |
581 | packageList = m_packman.packages(); | 583 | packageList = m_packman.packages(); |
582 | 584 | ||
583 | if ( packageList ) | 585 | if ( packageList ) |
584 | { | 586 | { |
585 | loadPackageList( packageList, true ); | 587 | loadPackageList( packageList, true ); |
586 | delete packageList; | 588 | delete packageList; |
587 | } | 589 | } |
588 | } | 590 | } |
589 | 591 | ||
590 | void MainWindow::slotShowUpdated() | 592 | void MainWindow::slotShowUpdated() |
591 | { | 593 | { |
592 | OPackageList *packageList; | 594 | OPackageList *packageList; |
593 | if ( m_actionShowUpdated->isOn() ) | 595 | if ( m_actionShowUpdated->isOn() ) |
594 | { | 596 | { |
595 | m_actionShowInstalled->setOn( false ); | 597 | m_actionShowInstalled->setOn( false ); |
596 | m_actionShowNotInstalled->setOn( false ); | 598 | m_actionShowNotInstalled->setOn( false ); |
599 | m_actionFilter->setOn( false ); | ||
597 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, | 600 | packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, |
598 | OPackageManager::Updated, QString::null ); | 601 | OPackageManager::Updated, QString::null ); |
599 | } | 602 | } |
600 | else | 603 | else |
601 | packageList = m_packman.packages(); | 604 | packageList = m_packman.packages(); |
602 | 605 | ||
603 | if ( packageList ) | 606 | if ( packageList ) |
604 | { | 607 | { |
605 | loadPackageList( packageList, true ); | 608 | loadPackageList( packageList, true ); |
606 | delete packageList; | 609 | delete packageList; |
607 | } | 610 | } |
608 | } | 611 | } |
609 | 612 | ||
610 | void MainWindow::slotFilterChange() | 613 | void MainWindow::slotFilterChange() |
611 | { | 614 | { |
612 | 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, |
613 | m_filterCategory ); | 616 | m_filterCategory ); |
614 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 617 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
615 | { | 618 | { |
616 | m_filterName = dlg.name(); | 619 | m_filterName = dlg.name(); |
617 | m_filterServer = dlg.server(); | 620 | m_filterServer = dlg.server(); |
618 | m_filterDest = dlg.destination(); | 621 | m_filterDest = dlg.destination(); |
619 | m_filterStatus = dlg.status(); | 622 | m_filterStatus = dlg.status(); |
620 | m_filterCategory = dlg.category(); | 623 | m_filterCategory = dlg.category(); |
621 | m_actionFilter->setOn( true ); | 624 | m_actionFilter->setOn( true ); |
622 | slotFilter( true ); | 625 | slotFilter( true ); |
623 | } | 626 | } |
624 | else | 627 | else |
625 | { | 628 | { |
626 | m_actionFilter->setOn( false ); | 629 | m_actionFilter->setOn( false ); |
627 | slotFilter( false ); | 630 | slotFilter( false ); |
628 | } | 631 | } |
629 | } | 632 | } |
630 | 633 | ||
631 | void MainWindow::slotFilter( bool isOn ) | 634 | void MainWindow::slotFilter( bool isOn ) |
632 | { | 635 | { |
633 | OPackageList *packageList; | 636 | OPackageList *packageList; |
634 | if ( isOn ) | 637 | if ( isOn ) |
635 | { | 638 | { |
636 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | 639 | // Turn off other filtering options |
637 | m_filterStatus, m_filterCategory ); | 640 | m_actionShowNotInstalled->setOn( false ); |
641 | m_actionShowInstalled->setOn( false ); | ||
642 | m_actionShowUpdated->setOn( false ); | ||
643 | |||
644 | // If the filter settings have not been set yet, display filter dialog | ||
645 | if ( m_filterName.isNull() && m_filterServer.isNull() && m_filterDest.isNull() && | ||
646 | m_filterStatus == OPackageManager::NotDefined && m_filterCategory.isNull() ) | ||
647 | { | ||
648 | FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, | ||
649 | m_filterCategory ); | ||
650 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | ||
651 | { | ||
652 | m_filterName = dlg.name(); | ||
653 | m_filterServer = dlg.server(); | ||
654 | m_filterDest = dlg.destination(); | ||
655 | m_filterStatus = dlg.status(); | ||
656 | m_filterCategory = dlg.category(); | ||
657 | m_actionFilter->setOn( true ); | ||
658 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | ||
659 | m_filterStatus, m_filterCategory ); | ||
660 | } | ||
661 | else | ||
662 | { | ||
663 | m_actionFilter->setOn( false ); | ||
664 | packageList = m_packman.packages(); | ||
665 | } | ||
666 | } | ||
667 | else | ||
668 | { | ||
669 | m_actionFilter->setOn( true ); | ||
670 | packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, | ||
671 | m_filterStatus, m_filterCategory ); | ||
672 | } | ||
673 | |||
674 | |||
638 | } | 675 | } |
639 | else | 676 | else |
640 | packageList = m_packman.packages(); | 677 | packageList = m_packman.packages(); |
641 | 678 | ||
642 | if ( packageList ) | 679 | if ( packageList ) |
643 | { | 680 | { |
644 | loadPackageList( packageList, true ); | 681 | loadPackageList( packageList, true ); |
645 | delete packageList; | 682 | delete packageList; |
646 | } | 683 | } |
647 | } | 684 | } |
648 | 685 | ||
649 | void MainWindow::slotFindShowToolbar() | 686 | void MainWindow::slotFindShowToolbar() |
650 | { | 687 | { |
651 | m_findBar.show(); | 688 | m_findBar.show(); |
652 | m_findEdit->setFocus(); | 689 | m_findEdit->setFocus(); |
653 | } | 690 | } |
654 | 691 | ||
655 | void MainWindow::slotFindHideToolbar() | 692 | void MainWindow::slotFindHideToolbar() |
656 | { | 693 | { |
657 | m_findBar.hide(); | 694 | m_findBar.hide(); |
658 | } | 695 | } |
659 | 696 | ||
660 | void MainWindow::slotFindChanged( const QString &findText ) | 697 | void MainWindow::slotFindChanged( const QString &findText ) |
661 | { | 698 | { |
662 | 699 | ||
663 | m_actionFindNext->setEnabled( !findText.isEmpty() ); | 700 | m_actionFindNext->setEnabled( !findText.isEmpty() ); |
664 | searchForPackage( findText ); | 701 | searchForPackage( findText ); |
665 | } | 702 | } |
666 | 703 | ||
667 | void MainWindow::slotFindNext() | 704 | void MainWindow::slotFindNext() |
668 | { | 705 | { |
669 | searchForPackage( m_findEdit->text() ); | 706 | searchForPackage( m_findEdit->text() ); |
670 | } | 707 | } |
671 | 708 | ||
672 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | 709 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) |
673 | { | 710 | { |
674 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); | 711 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); |
675 | 712 | ||
676 | // Create package manager output widget | 713 | // Create package manager output widget |
677 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); | 714 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); |
678 | 715 | ||
679 | // Display widget | 716 | // Display widget |
680 | m_widgetStack.addWidget( dlg, 3 ); | 717 | m_widgetStack.addWidget( dlg, 3 ); |
681 | m_widgetStack.raiseWidget( dlg ); | 718 | m_widgetStack.raiseWidget( dlg ); |
682 | } | 719 | } |