summaryrefslogtreecommitdiff
authorandyq <andyq>2002-11-09 15:39:15 (UTC)
committer andyq <andyq>2002-11-09 15:39:15 (UTC)
commit5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9 (patch) (side-by-side diff)
tree3a43ab203aa57960151ba11a091aefaebbf1a566
parenta121ae6e8e6f16ba355e8c86eba2b98792c93091 (diff)
downloadopie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.zip
opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.tar.gz
opie-5ab7af2bb5d98aef639cbc2ca14f630813fd4fe9.tar.bz2
Added filter menu - contains 3 filters - show uninstalled packages,
show installed packages and show upgraded packages
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp89
-rw-r--r--noncore/settings/aqpkg/mainwin.h13
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp45
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h7
4 files changed, 141 insertions, 13 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 3c72f2b..4e9cc12 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -37,22 +37,27 @@ MainWindow :: MainWindow( QWidget *p, char *name )
setCaption( "AQPkg - Package Manager" );
// Create our menu
- QPopupMenu *help = new QPopupMenu( this );
-
- help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H );
+ help = new QPopupMenu( this );
+ help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G );
help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
- QPopupMenu *settings = new QPopupMenu( this );
+ settings = new QPopupMenu( this );
settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
- QPopupMenu *edit = new QPopupMenu( this );
- edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F );
- edit->insertItem( "&Find Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_R );
+ edit = new QPopupMenu( this );
+ edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I );
+ edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N );
+
+ filter = new QPopupMenu( this );
+ mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U );
+ mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S );
+ mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P );
// Create the main menu
- QMenuBar *menu = menuBar(); //new QMenuBar( this );
+ menu = menuBar(); //new QMenuBar( this );
menu->insertItem( "&Settings", settings );
menu->insertItem( "&Edit", edit );
+ menu->insertItem( "&Filter", filter );
menu->insertItem( "&Help", help );
mgr = new DataManager();
@@ -109,3 +114,71 @@ void MainWindow :: displayAbout()
{
QMessageBox::about( this, "About AQPkg", VERSION_TEXT );
}
+
+
+void MainWindow :: filterUninstalledPackages()
+{
+ bool val;
+ if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) )
+ {
+ val = false;
+ filter->setItemChecked( mnuShowUninstalledPkgsId, false );
+ }
+ else
+ {
+ val = true;
+ filter->setItemChecked( mnuShowUninstalledPkgsId, true );
+ }
+
+ filter->setItemChecked( mnuShowInstalledPkgsId, false );
+ networkPkgWindow->showOnlyInstalledPackages( false );
+ filter->setItemChecked( mnuShowUpgradedPkgsId, false );
+ networkPkgWindow->showUpgradedPackages( false );
+
+ networkPkgWindow->showOnlyUninstalledPackages( val );
+
+}
+
+void MainWindow :: filterInstalledPackages()
+{
+ bool val;
+ if ( filter->isItemChecked( mnuShowInstalledPkgsId ) )
+ {
+ val = false;
+ filter->setItemChecked( mnuShowInstalledPkgsId, false );
+ }
+ else
+ {
+ val = true;
+ filter->setItemChecked( mnuShowInstalledPkgsId, true );
+ }
+
+ filter->setItemChecked( mnuShowUninstalledPkgsId, false );
+ networkPkgWindow->showOnlyUninstalledPackages( false );
+ filter->setItemChecked( mnuShowUpgradedPkgsId, false );
+ networkPkgWindow->showUpgradedPackages( false );
+
+ networkPkgWindow->showOnlyInstalledPackages( val );
+}
+
+void MainWindow :: filterUpgradedPackages()
+{
+ bool val;
+ if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) )
+ {
+ val = false;
+ filter->setItemChecked( mnuShowUpgradedPkgsId, false );
+ }
+ else
+ {
+ val = true;
+ filter->setItemChecked( mnuShowUpgradedPkgsId, true );
+ }
+
+ filter->setItemChecked( mnuShowUninstalledPkgsId, false );
+ networkPkgWindow->showOnlyUninstalledPackages( false );
+ filter->setItemChecked( mnuShowInstalledPkgsId, false );
+ networkPkgWindow->showOnlyInstalledPackages( false );
+
+ networkPkgWindow->showUpgradedPackages( val );
+}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 267233f..7b6e0ba 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -36,9 +36,19 @@ public:
private:
DataManager *mgr;
+ QMenuBar *menu;
+ QPopupMenu *help;
+ QPopupMenu *settings;
+ QPopupMenu *edit;
+ QPopupMenu *filter;
QWidgetStack *stack;
+
NetworkPackageManager *networkPkgWindow;
+ int mnuShowUninstalledPkgsId;
+ int mnuShowInstalledPkgsId;
+ int mnuShowUpgradedPkgsId;
+
public slots:
void setDocument( const QString &doc );
void displayHelp();
@@ -46,5 +56,8 @@ public slots:
void repeatSearchForPackage();
void displayAbout();
void displaySettings();
+ void filterUninstalledPackages();
+ void filterInstalledPackages();
+ void filterUpgradedPackages();
};
#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 76c7a9c..d43c6ac 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -56,15 +56,18 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
+
#endif
+ showUninstalledPkgs = false;
+ showInstalledPkgs = false;
+ showUpgradedPkgs = false;
+
initGui();
setupConnections();
updateData();
-// progressDlg = 0;
-// timerId = startTimer( 100 );
}
NetworkPackageManager::~NetworkPackageManager()
@@ -75,11 +78,8 @@ void NetworkPackageManager :: timerEvent ( QTimerEvent * )
{
killTimer( timerId );
-// showProgressDialog();
// Add server names to listbox
updateData();
-
-// progressDlg->hide();
}
void NetworkPackageManager :: updateData()
@@ -223,10 +223,27 @@ void NetworkPackageManager :: serverSelected( int )
QString text = "";
+ // Apply show only uninstalled packages filter
+ if ( showUninstalledPkgs && it->isInstalled() )
+ continue;
+
+ // Apply show only installed packages filter
+ if ( showInstalledPkgs && !it->isInstalled() )
+ continue;
+
+ // Apply show only new installed packages filter
+ if ( showUpgradedPkgs )
+ {
+ if ( !it->isInstalled() ||
+ compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
+ continue;
+ }
+
// If the local server, only display installed packages
if ( serverName == LOCAL_SERVER && !it->isInstalled() )
continue;
+
text += it->getPackageName();
if ( it->isInstalled() )
{
@@ -769,3 +786,21 @@ void NetworkPackageManager :: searchForPackage( bool findNext )
}
}
}
+
+void NetworkPackageManager :: showOnlyUninstalledPackages( bool val )
+{
+ showUninstalledPkgs = val;
+ serverSelected( -1 );
+}
+
+void NetworkPackageManager :: showOnlyInstalledPackages( bool val )
+{
+ showInstalledPkgs = val;
+ serverSelected( -1 );
+}
+
+void NetworkPackageManager :: showUpgradedPackages( bool val )
+{
+ showUpgradedPkgs = val;
+ serverSelected( -1 );
+}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 66a8903..937c9b4 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -41,6 +41,10 @@ public:
void selectLocalPackage( const QString &pkg );
void updateData();
void searchForPackage( bool findNext );
+ void showOnlyUninstalledPackages( bool val );
+ void showOnlyInstalledPackages( bool val );
+ void showUpgradedPackages( bool val );
+
private:
DataManager *dataMgr;
@@ -56,6 +60,9 @@ private:
QString lastSearchText;
bool showJumpTo;
+ bool showUninstalledPkgs;
+ bool showInstalledPkgs;
+ bool showUpgradedPkgs;
int timerId;
void timerEvent ( QTimerEvent * );