author | drw <drw> | 2004-11-16 19:06:12 (UTC) |
---|---|---|
committer | drw <drw> | 2004-11-16 19:06:12 (UTC) |
commit | 1c6f490e8541626f68422e0a3a7c7281d7f5b7d3 (patch) (side-by-side diff) | |
tree | cba3bc50c1611088ff1c15ebb0f79d7a3e1f454d | |
parent | 64dabf8fbdc8593611b3438e6c9f5d3d7c40016f (diff) | |
download | opie-1c6f490e8541626f68422e0a3a7c7281d7f5b7d3.zip opie-1c6f490e8541626f68422e0a3a7c7281d7f5b7d3.tar.gz opie-1c6f490e8541626f68422e0a3a7c7281d7f5b7d3.tar.bz2 |
Add ability to install local ipkg files
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 30 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.h | 43 |
2 files changed, 52 insertions, 21 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 @@ -25,24 +25,26 @@ _;:, .> :=|. This file is free software; you can 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mainwindow.h" #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> #include <qlayout.h> #include <qlineedit.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpopupmenu.h> #include <qtimer.h> @@ -173,24 +175,30 @@ void MainWindow::initUI() QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); actionDownload->setWhatsThis( tr( "Tap here to download the currently selected package(s)." ) ); connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); actionDownload->addTo( popup ); actionDownload->addTo( &m_toolBar ); 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 ); mb->insertItem( tr( "Actions" ), popup ); // View menu popup = new QPopupMenu( this ); m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); @@ -510,24 +518,46 @@ void MainWindow::slotApply() // Create package manager output widget InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, removeCmd, removeList, installCmd, installList, upgradeCmd, upgradeList ); connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) ); // 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 initPackageInfo(); // Update Opie launcher links QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h index 632effb..7968614 100644 --- a/noncore/settings/packagemanager/mainwindow.h +++ b/noncore/settings/packagemanager/mainwindow.h @@ -1,36 +1,36 @@ /* - This file is part of the OPIE Project + This file is part of the OPIE Project =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> - .=l. - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General -..}^=.= = ; Public License for more details. -++= -. .` .: - : = ...= . :.=- You should have received a copy of the GNU - -. .:....=;==+<; General Public License along with this file; - -_. . . )=. = see the file COPYING. If not, write to the - -- :-=` Free Software Foundation, Inc., + .=l. + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; Public License for more details. +++= -. .` .: +: = ...= . :.=- You should have received a copy of the GNU +-. .:....=;==+<; General Public License along with this file; + -_. . . )=. = see the file COPYING. If not, write to the + -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include "opackagemanager.h" #include <qpe/config.h> @@ -107,24 +107,25 @@ private slots: void slotWidgetStackShow( QWidget *widget ); // Status widget slots void slotInitStatusBar( int numSteps ); void slotStatusText( const QString &status ); void slotStatusBar( int currStep ); // Actions menu action slots void slotUpdate(); void slotUpgrade(); void slotDownload(); void slotApply(); + void slotInstallLocal(); void slotCloseDlg(); void slotConfigure(); // View menu action slots void slotShowNotInstalled(); void slotShowInstalled(); void slotShowUpdated(); void slotFilterChange(); void slotFilter( bool isOn ); // Find action slots void slotFindShowToolbar(); |