author | tille <tille> | 2002-04-27 13:06:45 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 13:06:45 (UTC) |
commit | db90999f6298c1107888f062f2c25cb8817b528a (patch) (unidiff) | |
tree | 020ebe65beb9286f3c63e4329fc3a0f298d34460 /noncore/unsupported/oipkg/mainwindow.cpp | |
parent | e2f3288d468508f2cf7c0a327044963ca4b1b54a (diff) | |
download | opie-db90999f6298c1107888f062f2c25cb8817b528a.zip opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.gz opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.bz2 |
added popup menu to choose inst dest (and more...)
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 87 |
1 files changed, 74 insertions, 13 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index c803ca0..25ca889 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,103 +1,114 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | ||
10 | #include <qaction.h> | 11 | #include <qaction.h> |
11 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
12 | #include <qpopupmenu.h> | 13 | #include <qpopupmenu.h> |
13 | #include <qtoolbutton.h> | 14 | #include <qtoolbutton.h> |
14 | #include <qstring.h> | 15 | #include <qstring.h> |
15 | #include <qlabel.h> | 16 | #include <qlabel.h> |
16 | #include <qlistview.h> | 17 | #include <qlistview.h> |
17 | #include <qtextview.h> | 18 | #include <qtextview.h> |
18 | #include <qlineedit.h> | 19 | #include <qlineedit.h> |
19 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
20 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
21 | #include <qlayout.h> | 22 | #include <qlayout.h> |
22 | 23 | ||
23 | #include "pksettingsbase.h" | 24 | #include "pksettingsbase.h" |
24 | #include "packagelistitem.h" | 25 | #include "packagelistitem.h" |
25 | 26 | ||
26 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 27 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
27 | QMainWindow( parent, name, f ) | 28 | QMainWindow( parent, name, f ) |
28 | { | 29 | { |
29 | setCaption( tr("Package Manager") ); | 30 | setCaption( tr("Package Manager") ); |
30 | 31 | ||
31 | listViewPackages = new QListView( this,0,0 ); | 32 | listViewPackages = new QListView( this,0,0 ); |
33 | listViewPackages->setSelectionMode(QListView::NoSelection); | ||
32 | setCentralWidget( listViewPackages ); | 34 | setCentralWidget( listViewPackages ); |
33 | 35 | ||
34 | makeMenu(); | 36 | makeMenu(); |
35 | 37 | #ifdef NEWLAYOUT | |
38 | listViewPackages->addColumn( tr("Package") ); | ||
39 | listViewPackages->setRootIsDecorated( true ); | ||
40 | #endif | ||
41 | #ifndef NEWLAYOUT | ||
36 | QFontMetrics fm = fontMetrics(); | 42 | QFontMetrics fm = fontMetrics(); |
37 | int wlw = width()*2; | 43 | int wlw = width()*2; |
38 | int w0 = fm.width(tr("Package"))+30; | 44 | int w0 = fm.width(tr("Package"))+30; |
39 | // int w0 = fm.width(tr("Package"))+30; | 45 | // int w0 = fm.width(tr("Package"))+30; |
40 | int w2 = fm.width("00000")+4; | 46 | int w2 = fm.width("00000")+4; |
41 | int w1 = wlw-w2-w0-20; | 47 | int w1 = wlw-w2-w0-24; |
42 | listViewPackages->addColumn( tr("Package"), w0 ); | 48 | listViewPackages->addColumn( tr("Package"), w0 ); |
43 | listViewPackages->addColumn( tr("Description"), w1 ); | 49 | listViewPackages->addColumn( tr("Description"), w1 ); |
44 | listViewPackages->addColumn( tr("Size"), w2 ); | 50 | listViewPackages->addColumn( tr("Size"), w2 ); |
45 | listViewPackages->setColumnWidthMode(0,QListView::Manual); | 51 | listViewPackages->setColumnWidthMode(0,QListView::Manual); |
46 | listViewPackages->setColumnWidthMode(1,QListView::Manual); | 52 | listViewPackages->setColumnWidthMode(1,QListView::Manual); |
47 | listViewPackages->setColumnWidthMode(2,QListView::Manual); | 53 | listViewPackages->setColumnWidthMode(2,QListView::Manual); |
48 | listViewPackages->setSelectionMode( QListView::Multi ); | 54 | listViewPackages->setSelectionMode( QListView::Multi ); |
49 | 55 | #endif | |
50 | connect( section, SIGNAL( activated(int) ), | 56 | connect( section, SIGNAL( activated(int) ), |
51 | this, SLOT( sectionChanged() ) ); | 57 | this, SLOT( sectionChanged() ) ); |
52 | connect( subsection, SIGNAL(activated(int) ), | 58 | connect( subsection, SIGNAL(activated(int) ), |
53 | this, SLOT( subSectionChanged() ) ); | 59 | this, SLOT( subSectionChanged() ) ); |
54 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), | 60 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), |
55 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 61 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
62 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), | ||
63 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
64 | |||
65 | popupMenu = new QPopupMenu( this ); | ||
56 | 66 | ||
57 | settings = new PackageManagerSettings(this,0,TRUE); | 67 | settings = new PackageManagerSettings(this,0,TRUE); |
58 | 68 | ||
59 | ipkg = new PmIpkg( settings, this ); | 69 | ipkg = new PmIpkg( settings, this ); |
60 | packageList.setSettings( settings ); | 70 | packageList.setSettings( settings ); |
61 | getList(); | 71 | getList(); |
62 | setSections(); | 72 | setSections(); |
63 | setSubSections(); | 73 | setSubSections(); |
64 | displayList(); | 74 | displayList(); |
65 | } | 75 | } |
66 | 76 | ||
67 | void MainWindow::makeMenu() | 77 | void MainWindow::makeMenu() |
68 | { | 78 | { |
69 | 79 | ||
70 | QPEToolBar *toolBar = new QPEToolBar( this ); | 80 | QPEToolBar *toolBar = new QPEToolBar( this ); |
71 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 81 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
72 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 82 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 83 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 84 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 85 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
76 | 86 | ||
77 | popupMenu = new QPopupMenu( this ); | 87 | popupMenu = new QPopupMenu( this ); |
78 | 88 | destsMenu = new QPopupMenu( popupMenu ); | |
79 | contextMenu = new QPopupMenu( this ); | 89 | popupTimer = new QTimer( this ); |
90 | connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); | ||
80 | 91 | ||
81 | setToolBarsMovable( false ); | 92 | setToolBarsMovable( false ); |
82 | toolBar->setHorizontalStretchable( true ); | 93 | toolBar->setHorizontalStretchable( true ); |
83 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 94 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
84 | menuBar->insertItem( tr( "View" ), viewMenu ); | 95 | menuBar->insertItem( tr( "View" ), viewMenu ); |
85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 96 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 97 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
87 | 98 | ||
88 | QLabel *spacer = new QLabel( "", toolBar ); | 99 | QLabel *spacer = new QLabel( "", toolBar ); |
89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 100 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
90 | toolBar->setStretchableWidget( spacer ); | 101 | toolBar->setStretchableWidget( spacer ); |
91 | 102 | ||
92 | 103 | ||
93 | runAction = new QAction( tr( "Apply" ), | 104 | runAction = new QAction( tr( "Apply" ), |
94 | Resource::loadPixmap( "oipkg/install" ), | 105 | Resource::loadPixmap( "oipkg/install" ), |
95 | QString::null, 0, this, 0 ); | 106 | QString::null, 0, this, 0 ); |
96 | connect( runAction, SIGNAL( activated() ), | 107 | connect( runAction, SIGNAL( activated() ), |
97 | this, SLOT( runIpkg() ) ); | 108 | this, SLOT( runIpkg() ) ); |
98 | runAction->addTo( toolBar ); | 109 | runAction->addTo( toolBar ); |
99 | runAction->addTo( srvMenu ); | 110 | runAction->addTo( srvMenu ); |
100 | 111 | ||
101 | srvMenu->insertSeparator (); | 112 | srvMenu->insertSeparator (); |
102 | 113 | ||
103 | updateAction = new QAction( tr( "Update" ), | 114 | updateAction = new QAction( tr( "Update" ), |
@@ -159,93 +170,106 @@ void MainWindow::makeMenu() | |||
159 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 170 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
160 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 171 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
161 | sectionAction->setToggleAction( true ); | 172 | sectionAction->setToggleAction( true ); |
162 | sectionAction->setOn( true ); | 173 | sectionAction->setOn( true ); |
163 | sectionAction->addTo( viewMenu ); | 174 | sectionAction->addTo( viewMenu ); |
164 | 175 | ||
165 | findBar = new QPEToolBar(this); | 176 | findBar = new QPEToolBar(this); |
166 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 177 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
167 | label = new QLabel( tr("Filter: "), findBar ); | 178 | label = new QLabel( tr("Filter: "), findBar ); |
168 | label->setBackgroundColor( findBar->backgroundColor() ); | 179 | label->setBackgroundColor( findBar->backgroundColor() ); |
169 | findBar->setHorizontalStretchable( TRUE ); | 180 | findBar->setHorizontalStretchable( TRUE ); |
170 | findEdit = new QLineEdit( findBar, "findEdit" ); | 181 | findEdit = new QLineEdit( findBar, "findEdit" ); |
171 | findBar->setStretchableWidget( findEdit ); | 182 | findBar->setStretchableWidget( findEdit ); |
172 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 183 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
173 | this, SLOT( displayList() ) ); | 184 | this, SLOT( displayList() ) ); |
174 | 185 | ||
175 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 186 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
176 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 187 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
177 | a->addTo( findBar ); | 188 | a->addTo( findBar ); |
178 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 189 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); |
179 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 190 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
180 | findAction->setToggleAction( true ); | 191 | findAction->setToggleAction( true ); |
181 | findAction->setOn( true ); | 192 | findAction->setOn( true ); |
182 | findAction->addTo( viewMenu ); | 193 | findAction->addTo( viewMenu ); |
194 | |||
195 | #ifdef NEW | ||
196 | Config cfg( "oipkg", Config::User ); | ||
197 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | ||
198 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | ||
199 | findShow(bool b) | ||
200 | sectionShow(bool b) | ||
201 | #endif | ||
183 | } | 202 | } |
184 | 203 | ||
185 | MainWindow::~MainWindow() | 204 | MainWindow::~MainWindow() |
186 | { | 205 | { |
187 | } | 206 | } |
188 | 207 | ||
189 | void MainWindow::runIpkg() | 208 | void MainWindow::runIpkg() |
190 | { | 209 | { |
191 | ipkg->commit( packageList ); | 210 | ipkg->commit( packageList ); |
192 | // updateList(); //to remove | 211 | // ##### If we looked in the list of files, we could send out accurate |
212 | // ##### messages. But we don't bother yet, and just do an "all". | ||
213 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
214 | QString lf = QString::null; | ||
215 | e << lf; | ||
216 | displayList(); | ||
193 | } | 217 | } |
194 | 218 | ||
195 | void MainWindow::updateList() | 219 | void MainWindow::updateList() |
196 | { | 220 | { |
197 | QTimer *t = new QTimer( this ); | 221 | QTimer *t = new QTimer( this ); |
198 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 222 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
199 | t->start( 0, false ); | 223 | t->start( 0, false ); |
200 | packageList.clear(); | 224 | packageList.clear(); |
201 | ipkg->update(); | 225 | ipkg->update(); |
202 | getList(); | 226 | getList(); |
203 | t->stop(); | 227 | t->stop(); |
204 | } | 228 | } |
205 | 229 | ||
206 | void MainWindow::getList() | 230 | void MainWindow::getList() |
207 | { | 231 | { |
208 | packageList.update(); | 232 | packageList.update(); |
209 | displayList(); | 233 | displayList(); |
210 | } | 234 | } |
211 | 235 | ||
212 | void MainWindow::filterList() | 236 | void MainWindow::filterList() |
213 | { | 237 | { |
214 | QString f = ""; | 238 | QString f = ""; |
215 | if ( findAction->isOn() ) f = findEdit->text(); | 239 | if ( findAction->isOn() ) f = findEdit->text(); |
216 | packageList.filterPackages( f ); | 240 | packageList.filterPackages( f ); |
217 | } | 241 | } |
218 | 242 | ||
219 | void MainWindow::displayList() | 243 | void MainWindow::displayList() |
220 | { | 244 | { |
221 | filterList(); | 245 | filterList(); |
222 | listViewPackages->clear(); | 246 | listViewPackages->clear(); |
223 | Package *pack = packageList.first(); | 247 | Package *pack = packageList.first(); |
224 | while( pack ) | 248 | while( pack ) |
225 | { | 249 | { |
226 | if ( pack && (pack->name() != "") ) | 250 | if ( pack && (pack->name() != "") ) |
227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); | 251 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); |
228 | pack = packageList.next(); | 252 | pack = packageList.next(); |
229 | } | 253 | } |
230 | } | 254 | } |
231 | 255 | ||
232 | void MainWindow::sectionChanged() | 256 | void MainWindow::sectionChanged() |
233 | { | 257 | { |
234 | disconnect( section, SIGNAL( activated(int) ), | 258 | disconnect( section, SIGNAL( activated(int) ), |
235 | this, SLOT( sectionChanged() ) ); | 259 | this, SLOT( sectionChanged() ) ); |
236 | disconnect( subsection, SIGNAL(activated(int) ), | 260 | disconnect( subsection, SIGNAL(activated(int) ), |
237 | this, SLOT( subSectionChanged() ) ); | 261 | this, SLOT( subSectionChanged() ) ); |
238 | subsection->clear(); | 262 | subsection->clear(); |
239 | packageList.setSection( section->currentText() ); | 263 | packageList.setSection( section->currentText() ); |
240 | setSubSections(); | 264 | setSubSections(); |
241 | connect( section, SIGNAL( activated(int) ), | 265 | connect( section, SIGNAL( activated(int) ), |
242 | this, SLOT( sectionChanged() ) ); | 266 | this, SLOT( sectionChanged() ) ); |
243 | connect( subsection, SIGNAL(activated(int) ), | 267 | connect( subsection, SIGNAL(activated(int) ), |
244 | this, SLOT( subSectionChanged() ) ); | 268 | this, SLOT( subSectionChanged() ) ); |
245 | displayList(); | 269 | displayList(); |
246 | } | 270 | } |
247 | 271 | ||
248 | void MainWindow::subSectionChanged() | 272 | void MainWindow::subSectionChanged() |
249 | { | 273 | { |
250 | disconnect( section, SIGNAL( activated(int) ), | 274 | disconnect( section, SIGNAL( activated(int) ), |
251 | this, SLOT( sectionChanged() ) ); | 275 | this, SLOT( sectionChanged() ) ); |
@@ -270,88 +294,125 @@ void MainWindow::setSubSections() | |||
270 | subsection->clear(); | 294 | subsection->clear(); |
271 | subsection->insertStringList( packageList.getSubSections() ); | 295 | subsection->insertStringList( packageList.getSubSections() ); |
272 | } | 296 | } |
273 | 297 | ||
274 | 298 | ||
275 | void MainWindow::showSettings() | 299 | void MainWindow::showSettings() |
276 | { | 300 | { |
277 | if ( settings->showDialog( 0 ) ) | 301 | if ( settings->showDialog( 0 ) ) |
278 | updateList(); | 302 | updateList(); |
279 | } | 303 | } |
280 | void MainWindow::showSettingsSrv() | 304 | void MainWindow::showSettingsSrv() |
281 | { | 305 | { |
282 | if ( settings->showDialog( 1 ) ) | 306 | if ( settings->showDialog( 1 ) ) |
283 | updateList(); | 307 | updateList(); |
284 | } | 308 | } |
285 | void MainWindow::showSettingsDst() | 309 | void MainWindow::showSettingsDst() |
286 | { | 310 | { |
287 | if ( settings->showDialog( 2 ) ) | 311 | if ( settings->showDialog( 2 ) ) |
288 | updateList(); | 312 | updateList(); |
289 | } | 313 | } |
290 | 314 | ||
291 | 315 | ||
292 | void MainWindow::showDetails() | 316 | void MainWindow::showDetails() |
293 | { | 317 | { |
294 | if ( activePackage ) return; | ||
295 | if ( details ) | 318 | if ( details ) |
296 | { | 319 | { |
297 | details = new PackageDetails( this ); | 320 | details = new PackageDetails( this ); |
298 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 321 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
299 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 322 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
300 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); | 323 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); |
301 | details->description->setTextFormat(RichText); | 324 | details->description->setTextFormat(RichText); |
302 | } | 325 | } |
303 | 326 | if ( !activePackage ) | |
327 | { | ||
328 | details->description->setText(tr("no package selected")); | ||
329 | details->description->setText(tr("errmm...<br>...not working?")); | ||
330 | }else{ | ||
304 | details->setCaption("Package: " + activePackage->name()); | 331 | details->setCaption("Package: " + activePackage->name()); |
305 | details->description->setText(activePackage->details() ); | 332 | details->description->setText(activePackage->details() ); |
306 | details->install->setEnabled(!activePackage->installed()); | 333 | details->install->setEnabled(!activePackage->installed()); |
307 | details->remove->setEnabled(activePackage->installed()); | 334 | details->remove->setEnabled(activePackage->installed()); |
335 | } | ||
308 | details->showMaximized(); | 336 | details->showMaximized(); |
309 | } | 337 | } |
310 | 338 | ||
311 | void MainWindow::toggleActivePackage() | 339 | void MainWindow::toggleActivePackage() |
312 | { | 340 | { |
313 | activePackage->toggleProcess(); | 341 | activePackage->toggleProcess(); |
314 | if ( details ) details->close(); | 342 | if ( details ) details->close(); |
315 | } | 343 | } |
316 | 344 | ||
317 | void MainWindow::setCurrent( QListViewItem* p ) | 345 | void MainWindow::setCurrent( QListViewItem* p ) |
318 | { | 346 | { |
319 | pvDebug(2, "MainWindow::setCurrent "); | 347 | if ( !p ) return; |
320 | return; | 348 | activePackageListItem = (PackageListItem*)p; |
321 | pvDebug(2, "name "+((Package*)p)->name()); | 349 | activePackage = activePackageListItem->getPackage(); |
322 | activePackage = (Package*)p; | 350 | pvDebug(5, "start timer"); |
351 | popupTimer->start( 750, true ); | ||
323 | } | 352 | } |
324 | 353 | ||
325 | void MainWindow::sectionShow(bool b) | 354 | void MainWindow::sectionShow(bool b) |
326 | { | 355 | { |
327 | if (b) sectionBar->show(); | 356 | if (b) sectionBar->show(); |
328 | else sectionBar->hide(); | 357 | else sectionBar->hide(); |
329 | sectionAction->setOn( b ); | 358 | sectionAction->setOn( b ); |
330 | } | 359 | } |
331 | 360 | ||
332 | void MainWindow::sectionClose() | 361 | void MainWindow::sectionClose() |
333 | { | 362 | { |
334 | sectionAction->setOn( false ); | 363 | sectionAction->setOn( false ); |
335 | } | 364 | } |
336 | 365 | ||
337 | void MainWindow::findShow(bool b) | 366 | void MainWindow::findShow(bool b) |
338 | { | 367 | { |
339 | if (b) findBar->show(); | 368 | if (b) findBar->show(); |
340 | else findBar->hide(); | 369 | else findBar->hide(); |
341 | findAction->setOn( b ); | 370 | findAction->setOn( b ); |
342 | } | 371 | } |
343 | 372 | ||
344 | void MainWindow::findClose() | 373 | void MainWindow::findClose() |
345 | { | 374 | { |
346 | findAction->setOn( false ); | 375 | findAction->setOn( false ); |
347 | } | 376 | } |
348 | 377 | ||
349 | void MainWindow::rotateUpdateIcon() | 378 | void MainWindow::rotateUpdateIcon() |
350 | { | 379 | { |
351 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 380 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
352 | if ( updateIcon ) | 381 | if ( updateIcon ) |
353 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 382 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
354 | else | 383 | else |
355 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 384 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
356 | updateIcon = !updateIcon; | 385 | updateIcon = !updateIcon; |
357 | } | 386 | } |
387 | |||
388 | void MainWindow::showPopup() | ||
389 | { | ||
390 | popupMenu->clear(); | ||
391 | destsMenu->clear(); | ||
392 | |||
393 | QAction *popupAction; | ||
394 | popupMenu->insertItem( tr("Install to"), destsMenu ); | ||
395 | QStringList dests = settings->getDestinationNames(); | ||
396 | for (uint i = 0; i < dests.count(); i++ ) | ||
397 | { | ||
398 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | ||
399 | popupAction->addTo( destsMenu ); | ||
400 | } | ||
401 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
402 | this, SLOT( changePackageDest( int ) ) ); | ||
403 | popupMenu->popup( QCursor::pos() ); | ||
404 | } | ||
405 | |||
406 | void MainWindow::changePackageDest( int i ) | ||
407 | { | ||
408 | activePackage->setDest( destsMenu->text(i) ); | ||
409 | activePackage->setOn(); | ||
410 | activePackage->setLink( settings->createLinks() ); | ||
411 | activePackageListItem->displayDetails(); | ||
412 | } | ||
413 | |||
414 | void MainWindow::stopTimer( QListViewItem* ) | ||
415 | { | ||
416 | pvDebug( 5, "stop timer" ); | ||
417 | popupTimer->stop(); | ||
418 | } | ||