summaryrefslogtreecommitdiff
authordrw <drw>2004-11-16 17:26:28 (UTC)
committer drw <drw>2004-11-16 17:26:28 (UTC)
commit36f98a2f0438edf82e4f326660786207ee46d87d (patch) (side-by-side diff)
treef6413c1a9c281083ba63b952f1ae21c2092d9836
parent43773cc47947f88f48aa7a9f64ff58defff70c83 (diff)
downloadopie-36f98a2f0438edf82e4f326660786207ee46d87d.zip
opie-36f98a2f0438edf82e4f326660786207ee46d87d.tar.gz
opie-36f98a2f0438edf82e4f326660786207ee46d87d.tar.bz2
Fix bug #1464 - correctly reapply filters
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp52
1 files changed, 31 insertions, 21 deletions
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 991cc81..807bddd 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,72 +1,72 @@
/*
-                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.
*/
#include "mainwindow.h"
#include "installdlg.h"
#include "filterdlg.h"
#include "promptdlg.h"
#include "entrydlg.h"
#include "packageinfodlg.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>
#include <qtoolbar.h>
#include <qwhatsthis.h>
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
: QMainWindow( parent, name, WStyle_ContextHelp )
, m_config( "packman" )
, m_packman( &m_config, this )
, m_menuBar( this )
, m_toolBar( this )
, m_findBar( this )
, m_widgetStack( this )
, m_packageList( this )
, m_statusWidget( this )
, m_statusText( &m_statusWidget )
, m_statusBar( &m_statusWidget )
, m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
, m_iconInstalled( Resource::loadPixmap( "installed" ) )
, m_iconNull( m_iconUpdated.size() )
, m_filterName( QString::null )
, m_filterServer( QString::null )
, m_filterDest( QString::null )
, m_filterStatus( OPackageManager::NotDefined )
, m_filterCategory( QString::null )
@@ -486,96 +486,106 @@ void MainWindow::slotApply()
installList->append( item->text() );
}
}
}
}
// If nothing is selected, display message and exit
if ( !removeList && !installList && !upgradeList )
{
QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
return;
}
// Send command only if there are packages to process
OPackage::Command removeCmd = OPackage::NotDefined;
if ( removeList && !removeList->isEmpty() )
removeCmd = OPackage::Remove;
OPackage::Command installCmd = OPackage::NotDefined;
if ( installList && !installList->isEmpty() )
installCmd = OPackage::Install;
OPackage::Command upgradeCmd = OPackage::NotDefined;
if ( upgradeList && !upgradeList->isEmpty() )
upgradeCmd = OPackage::Upgrade;
// 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::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
+ if ( m_actionShowNotInstalled->isOn() )
+ slotShowNotInstalled();
+ else if ( m_actionShowInstalled->isOn() )
+ slotShowInstalled();
+ else if ( m_actionShowUpdated->isOn() )
+ slotShowUpdated();
+ else if ( m_actionFilter->isOn() )
+ slotFilter( true );
}
void MainWindow::slotConfigure()
{
if ( m_packman.configureDlg( false ) )
{
if ( PromptDlg::ask( tr( "Config updated" ),
tr( "The configuration has been updated. Do you want to update server and package information now?" ),
tr( "Yes" ), tr( "No" ), this ) == 1 )
{
// Update package list and reload package info
slotUpdate();
}
}
}
void MainWindow::slotShowNotInstalled()
{
OPackageList *packageList;
if ( m_actionShowNotInstalled->isOn() )
{
m_actionShowInstalled->setOn( false );
m_actionShowUpdated->setOn( false );
m_actionFilter->setOn( false );
packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
OPackageManager::NotInstalled, QString::null );
}
else
packageList = m_packman.packages();
if ( packageList )
{
loadPackageList( packageList, true );
delete packageList;
}
}
void MainWindow::slotShowInstalled()
{
OPackageList *packageList;
if ( m_actionShowInstalled->isOn() )
{
m_actionShowNotInstalled->setOn( false );
m_actionShowUpdated->setOn( false );
m_actionFilter->setOn( false );
packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
OPackageManager::Installed, QString::null );
}