-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 @@ -93,3 +93,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) // Initialize package information - QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); + QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) ); } @@ -311,2 +311,24 @@ void MainWindow::searchForPackage( const QString &text ) +void MainWindow::installLocalPackage( const QString &ipkFile ) +{ + // Install selected file + InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, + OPackage::Install, new QStringList( ipkFile ) ); + connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); + + // Display widget + m_widgetStack.addWidget( dlg, 3 ); + m_widgetStack.raiseWidget( dlg ); +} + +void MainWindow::setDocument( const QString &ipkFile ) +{ + QString file = ipkFile; + DocLnk lnk( ipkFile ); + if ( lnk.isValid() ) + file = lnk.file(); + + installLocalPackage( file ); +} + void MainWindow::initPackageInfo() @@ -326,3 +348,6 @@ void MainWindow::initPackageInfo() - m_widgetStack.raiseWidget( &m_packageList ); + QWidget *widget = m_widgetStack.widget( 3 ); + if ( !widget ) + widget = &m_packageList; + m_widgetStack.raiseWidget( widget ); } @@ -539,12 +564,3 @@ void MainWindow::slotInstallLocal() if ( !package.isNull() ) - { - // Install selected file - InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Install local package" ), true, - OPackage::Install, new QStringList( package ) ); - connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); - - // Display widget - m_widgetStack.addWidget( dlg, 3 ); - m_widgetStack.raiseWidget( dlg ); - } + installLocalPackage( package ); } 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 @@ -103,4 +103,7 @@ private: void searchForPackage( const QString &text ); + void installLocalPackage( const QString &ipkFile ); private slots: + void setDocument( const QString &ipkFile ); + void initPackageInfo(); |