author | drw <drw> | 2004-11-16 20:50:31 (UTC) |
---|---|---|
committer | drw <drw> | 2004-11-16 20:50:31 (UTC) |
commit | 251511f7cdd1691a7d790ce0473e040d38a6d834 (patch) (unidiff) | |
tree | 23a1eb61e8524afc8458ac0f77abcc4f22041c44 | |
parent | ea3945a9bd8f9830f70b1efa133f9df13b19362f (diff) | |
download | opie-251511f7cdd1691a7d790ce0473e040d38a6d834.zip opie-251511f7cdd1691a7d790ce0473e040d38a6d834.tar.gz opie-251511f7cdd1691a7d790ce0473e040d38a6d834.tar.bz2 |
Implemented setDocument to allow installs by clicking on ipk file
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 40 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.h | 3 |
2 files changed, 31 insertions, 12 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 5a942a1..349094d 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp | |||
@@ -91,7 +91,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) | |||
91 | initUI(); | 91 | initUI(); |
92 | 92 | ||
93 | // Initialize package information | 93 | // Initialize package information |
94 | QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); | 94 | QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) ); |
95 | } | 95 | } |
96 | 96 | ||
97 | void MainWindow::closeEvent( QCloseEvent *event ) | 97 | void MainWindow::closeEvent( QCloseEvent *event ) |
@@ -309,6 +309,28 @@ void MainWindow::searchForPackage( const QString &text ) | |||
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | void MainWindow::installLocalPackage( const QString &ipkFile ) | ||
313 | { | ||
314 | // Install selected file | ||
315 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, | ||
316 | OPackage::Install, new QStringList( ipkFile ) ); | ||
317 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | ||
318 | |||
319 | // Display widget | ||
320 | m_widgetStack.addWidget( dlg, 3 ); | ||
321 | m_widgetStack.raiseWidget( dlg ); | ||
322 | } | ||
323 | |||
324 | void MainWindow::setDocument( const QString &ipkFile ) | ||
325 | { | ||
326 | QString file = ipkFile; | ||
327 | DocLnk lnk( ipkFile ); | ||
328 | if ( lnk.isValid() ) | ||
329 | file = lnk.file(); | ||
330 | |||
331 | installLocalPackage( file ); | ||
332 | } | ||
333 | |||
312 | void MainWindow::initPackageInfo() | 334 | void MainWindow::initPackageInfo() |
313 | { | 335 | { |
314 | m_widgetStack.raiseWidget( &m_statusWidget ); | 336 | m_widgetStack.raiseWidget( &m_statusWidget ); |
@@ -324,7 +346,10 @@ void MainWindow::initPackageInfo() | |||
324 | delete packageList; | 346 | delete packageList; |
325 | } | 347 | } |
326 | 348 | ||
327 | m_widgetStack.raiseWidget( &m_packageList ); | 349 | QWidget *widget = m_widgetStack.widget( 3 ); |
350 | if ( !widget ) | ||
351 | widget = &m_packageList; | ||
352 | m_widgetStack.raiseWidget( widget ); | ||
328 | } | 353 | } |
329 | 354 | ||
330 | void MainWindow::slotWidgetStackShow( QWidget *widget ) | 355 | void MainWindow::slotWidgetStackShow( QWidget *widget ) |
@@ -537,16 +562,7 @@ void MainWindow::slotInstallLocal() | |||
537 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, | 562 | QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, |
538 | "/", QString::null, type ); | 563 | "/", QString::null, type ); |
539 | if ( !package.isNull() ) | 564 | if ( !package.isNull() ) |
540 | { | 565 | installLocalPackage( package ); |
541 | // Install selected file | ||
542 | InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, | ||
543 | OPackage::Install, new QStringList( package ) ); | ||
544 | connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); | ||
545 | |||
546 | // Display widget | ||
547 | m_widgetStack.addWidget( dlg, 3 ); | ||
548 | m_widgetStack.raiseWidget( dlg ); | ||
549 | } | ||
550 | } | 566 | } |
551 | 567 | ||
552 | void MainWindow::slotCloseDlg() | 568 | void MainWindow::slotCloseDlg() |
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h index 7968614..103c664 100644 --- a/noncore/settings/packagemanager/mainwindow.h +++ b/noncore/settings/packagemanager/mainwindow.h | |||
@@ -101,8 +101,11 @@ private: | |||
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 | void installLocalPackage( const QString &ipkFile ); | ||
104 | 105 | ||
105 | private slots: | 106 | private slots: |
107 | void setDocument( const QString &ipkFile ); | ||
108 | |||
106 | void initPackageInfo(); | 109 | void initPackageInfo(); |
107 | void slotWidgetStackShow( QWidget *widget ); | 110 | void slotWidgetStackShow( QWidget *widget ); |
108 | 111 | ||