Diffstat (limited to 'noncore/settings/packagemanager/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp index 807bddd..5a942a1 100644 --- a/noncore/settings/packagemanager/mainwindow.cpp +++ b/noncore/settings/packagemanager/mainwindow.cpp @@ -31,12 +31,14 @@ _;:, .> :=|. This file is free software; you can #include "installdlg.h" #include "filterdlg.h" #include "promptdlg.h" #include "entrydlg.h" #include "packageinfodlg.h" +#include <opie2/ofiledialog.h> + #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qaction.h> #include <qdir.h> @@ -179,12 +181,18 @@ void MainWindow::initUI() a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to install, remove or upgrade currently selected package(s)." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); a->addTo( popup ); a->addTo( &m_toolBar ); + a = new QAction( tr( "Install local package" ), Resource::loadPixmap( "folder" ), QString::null, 0, this, 0 ); + a->setWhatsThis( tr( "Tap here to install a package file located on device." ) ); + connect( a, SIGNAL(activated()), this, SLOT(slotInstallLocal()) ); + a->addTo( popup ); + //a->addTo( &m_toolBar ); + popup->insertSeparator(); a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Tap here to configure this application." ) ); connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); a->addTo( popup ); @@ -516,12 +524,34 @@ void MainWindow::slotApply() // Display widget m_widgetStack.addWidget( dlg, 3 ); m_widgetStack.raiseWidget( dlg ); } +void MainWindow::slotInstallLocal() +{ + // Display file open dialog with only package files + MimeTypes type; + QStringList packages; + packages << "application/ipkg"; + type.insert( tr( "Application Packages" ), packages ); + QString package = Opie::Ui::OFileDialog::getOpenFileName( Opie::Ui::OFileSelector::NORMAL, + "/", QString::null, type ); + 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 ); + } +} + void MainWindow::slotCloseDlg() { // Close install dialog delete m_widgetStack.visibleWidget(); // Reload package list |