summaryrefslogtreecommitdiff
authordrw <drw>2004-11-16 20:50:31 (UTC)
committer drw <drw>2004-11-16 20:50:31 (UTC)
commit251511f7cdd1691a7d790ce0473e040d38a6d834 (patch) (side-by-side diff)
tree23a1eb61e8524afc8458ac0f77abcc4f22041c44
parentea3945a9bd8f9830f70b1efa133f9df13b19362f (diff)
downloadopie-251511f7cdd1691a7d790ce0473e040d38a6d834.zip
opie-251511f7cdd1691a7d790ce0473e040d38a6d834.tar.gz
opie-251511f7cdd1691a7d790ce0473e040d38a6d834.tar.bz2
Implemented setDocument to allow installs by clicking on ipk file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp40
-rw-r--r--noncore/settings/packagemanager/mainwindow.h3
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
@@ -88,13 +88,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
setCentralWidget( &m_widgetStack );
// Initialize remaining user interface items
initUI();
// Initialize package information
- QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) );
+ QTimer::singleShot( -1, this, SLOT( initPackageInfo() ) );
}
void MainWindow::closeEvent( QCloseEvent *event )
{
// Close app only if either the package or status widgets are currently active
bool close = m_widgetStack.visibleWidget() == &m_packageList ||
@@ -306,12 +306,34 @@ void MainWindow::searchForPackage( const QString &text )
break;
}
}
}
}
+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()
{
m_widgetStack.raiseWidget( &m_statusWidget );
// Load package list
m_packman.loadAvailablePackages();
@@ -321,13 +343,16 @@ void MainWindow::initPackageInfo()
if ( packageList )
{
loadPackageList( packageList, true );
delete packageList;
}
- m_widgetStack.raiseWidget( &m_packageList );
+ QWidget *widget = m_widgetStack.widget( 3 );
+ if ( !widget )
+ widget = &m_packageList;
+ m_widgetStack.raiseWidget( widget );
}
void MainWindow::slotWidgetStackShow( QWidget *widget )
{
if ( widget == &m_packageList )
{
@@ -534,22 +559,13 @@ void MainWindow::slotInstallLocal()
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 );
- }
+ installLocalPackage( package );
}
void MainWindow::slotCloseDlg()
{
// Close install dialog
delete m_widgetStack.visibleWidget();
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
@@ -98,14 +98,17 @@ private:
void initPackageList();
void initStatusWidget();
void initUI();
void loadPackageList( OPackageList *packages = 0x0, bool clearList = true );
void searchForPackage( const QString &text );
+ void installLocalPackage( const QString &ipkFile );
private slots:
+ void setDocument( const QString &ipkFile );
+
void initPackageInfo();
void slotWidgetStackShow( QWidget *widget );
// Status widget slots
void slotInitStatusBar( int numSteps );
void slotStatusText( const QString &status );