summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp89
-rw-r--r--noncore/settings/aqpkg/mainwin.h15
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp51
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h7
4 files changed, 145 insertions, 17 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
@@ -36,24 +36,29 @@ 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();
mgr->loadServers();
@@ -108,4 +113,72 @@ void MainWindow :: repeatSearchForPackage()
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
@@ -35,16 +35,29 @@ public:
private:
DataManager *mgr;
+ QMenuBar *menu;
+ QPopupMenu *help;
+ QPopupMenu *settings;
+ QPopupMenu *edit;
+ QPopupMenu *filter;
QWidgetStack *stack;
- NetworkPackageManager *networkPkgWindow;
+
+ NetworkPackageManager *networkPkgWindow;
+
+ int mnuShowUninstalledPkgsId;
+ int mnuShowInstalledPkgsId;
+ int mnuShowUpgradedPkgsId;
public slots:
void setDocument( const QString &doc );
void displayHelp();
void searchForPackage();
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
@@ -55,17 +55,20 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
Config cfg( "aqpkg" );
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()
{
@@ -74,13 +77,10 @@ NetworkPackageManager::~NetworkPackageManager()
void NetworkPackageManager :: timerEvent ( QTimerEvent * )
{
killTimer( timerId );
-// showProgressDialog();
// Add server names to listbox
updateData();
-
-// progressDlg->hide();
}
void NetworkPackageManager :: updateData()
{
@@ -222,11 +222,28 @@ void NetworkPackageManager :: serverSelected( int )
{
QString text = "";
- // If the local server, only display installed packages
- if ( serverName == LOCAL_SERVER && !it->isInstalled() )
- continue;
+ // 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() )
{
@@ -768,4 +785,22 @@ 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
@@ -40,8 +40,12 @@ 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;
QComboBox *serversList;
@@ -55,8 +59,11 @@ private:
QString currentlySelectedServer;
QString lastSearchText;
bool showJumpTo;
+ bool showUninstalledPkgs;
+ bool showInstalledPkgs;
+ bool showUpgradedPkgs;
int timerId;
void timerEvent ( QTimerEvent * );