summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -78,33 +78,33 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
m_iconNull.fill( colorGroup().base() );
connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
// Initialize widget stack, package list and status widget
initStatusWidget();
initPackageList();
m_widgetStack.addWidget( &m_statusWidget, 2 );
m_widgetStack.addWidget( &m_packageList, 1 );
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 ||
m_widgetStack.visibleWidget() == &m_statusWidget;
if ( close )
{
// TODO - write out application configuration settings
// Write out package manager configuration settings
m_packman.saveSettings();
event->accept();
}
else
@@ -296,48 +296,73 @@ void MainWindow::searchForPackage( const QString &text )
start = static_cast<QCheckListItem *>(m_packageList.firstChild());
// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ;
for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ;
item = static_cast<QCheckListItem *>(item->nextSibling()) )
{
if ( item->text().lower().find( text ) != -1 )
{
m_packageList.ensureItemVisible( item );
m_packageList.setCurrentItem( item );
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();
m_packman.loadInstalledPackages();
OPackageList *packageList = m_packman.packages();
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 )
{
setCaption( tr( "Package Manager" ) );
m_menuBar.show();
m_toolBar.show();
}
else
{
m_menuBar.hide();
m_toolBar.hide();
}
@@ -524,42 +549,33 @@ 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 );
- }
+ installLocalPackage( package );
}
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;
// Reapply any filters previously set
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
@@ -88,34 +88,37 @@ private:
QAction *m_actionFilter; // Action to filter packages
QAction *m_actionFindNext; // Action to find next match
// Cached filter settings
QString m_filterName; // Cached name filter value
QString m_filterServer; // Cached server name filter value
QString m_filterDest; // Cached destination name filter value
OPackageManager::Status m_filterStatus; // Cached status filter value
QString m_filterCategory; // Cached category filter value
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 );
void slotStatusBar( int currStep );
// Actions menu action slots
void slotUpdate();
void slotUpgrade();
void slotDownload();
void slotApply();
void slotInstallLocal();
void slotCloseDlg();
void slotConfigure();