summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro9
-rw-r--r--noncore/settings/aqpkg/categoryfilter.ui118
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.cpp71
-rw-r--r--noncore/settings/aqpkg/categoryfilterimpl.h40
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp10
-rw-r--r--noncore/settings/aqpkg/datamgr.h5
-rw-r--r--noncore/settings/aqpkg/global.h2
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp23
-rw-r--r--noncore/settings/aqpkg/mainwin.h5
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp59
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h4
-rw-r--r--noncore/settings/aqpkg/package.h6
-rw-r--r--noncore/settings/aqpkg/server.cpp19
-rw-r--r--noncore/settings/aqpkg/server.h1
14 files changed, 363 insertions, 9 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index 301f4f2..6cc5a23 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -14,9 +14,10 @@ HEADERS = global.h \
utils.h \
server.h \
helpwindow.h \
letterpushbutton.h \
- inputdlg.h
+ inputdlg.h \
+ categoryfilterimpl.h
SOURCES = mainwin.cpp \
datamgr.cpp \
mem.cpp \
settingsimpl.cpp \
@@ -32,12 +33,14 @@ SOURCES = mainwin.cpp \
server.cpp \
helpwindow.cpp \
letterpushbutton.cpp \
inputdlg.cpp \
- version.cpp
+ version.cpp \
+ categoryfilterimpl.cpp
INTERFACES = settings.ui \
install.ui \
- instoptions.ui
+ instoptions.ui \
+ categoryfilter.ui
TARGET = aqpkg
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lstdc++
diff --git a/noncore/settings/aqpkg/categoryfilter.ui b/noncore/settings/aqpkg/categoryfilter.ui
new file mode 100644
index 0000000..3416243
--- a/dev/null
+++ b/noncore/settings/aqpkg/categoryfilter.ui
@@ -0,0 +1,118 @@
+<!DOCTYPE UI><UI>
+<class>CategoryFilterDlg</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>CategoryFilterDlg</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>215</width>
+ <height>295</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Category Filter</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout4</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnOK</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;OK</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnCancel</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Select groups to show</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lstCategories</cstring>
+ </property>
+ <property stdset="1">
+ <name>selectionMode</name>
+ <enum>Multi</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>btnCancel</sender>
+ <signal>clicked()</signal>
+ <receiver>CategoryFilterDlg</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>btnOK</sender>
+ <signal>clicked()</signal>
+ <receiver>CategoryFilterDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+</UI>
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.cpp b/noncore/settings/aqpkg/categoryfilterimpl.cpp
new file mode 100644
index 0000000..0746da6
--- a/dev/null
+++ b/noncore/settings/aqpkg/categoryfilterimpl.cpp
@@ -0,0 +1,71 @@
+/***************************************************************************
+ categoryfilterimpl.cpp - description
+ -------------------
+ begin : Sun Nov 17 2002
+ copyright : (C) 2002 by Andy Qua
+ email : andy.qua@blueyonder.co.uk
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include <iostream>
+using namespace std;
+
+#include <qlistbox.h>
+#include <qstring.h>
+
+#include "categoryfilterimpl.h"
+
+CategoryFilterImpl :: CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent, const char *name )
+ : CategoryFilterDlg(parent,name, true)
+{
+ // Split up categories and add them to the listbox
+ int start = 1;
+
+ QString item;
+ int end;
+ do
+ {
+ end = categories.find( "#", start );
+ item = categories.mid( start, end - start );
+ if ( item != "" )
+ {
+ lstCategories->insertItem( item );
+
+ if ( selectedCategories.find( "#" + item + "#" ) != -1 )
+ lstCategories->setSelected( lstCategories->count()-1, true );
+ }
+
+ start = end + 1;
+ } while ( start < (int)categories.length() );
+
+ lstCategories->sort( true );
+
+ showMaximized();
+}
+
+CategoryFilterImpl :: ~CategoryFilterImpl()
+{
+}
+
+QString CategoryFilterImpl :: getSelectedFilter()
+{
+ // Grab cetegories from listbox
+ QString ret = "#";
+
+ for ( int i = 0 ; i < (int)lstCategories->count() ; ++i )
+ {
+ if ( lstCategories->isSelected( i ) )
+ ret += lstCategories->text( i ) + "#";
+ }
+
+ if ( ret == "#" )
+ ret = "";
+ return ret;
+}
diff --git a/noncore/settings/aqpkg/categoryfilterimpl.h b/noncore/settings/aqpkg/categoryfilterimpl.h
new file mode 100644
index 0000000..b6b4fd5
--- a/dev/null
+++ b/noncore/settings/aqpkg/categoryfilterimpl.h
@@ -0,0 +1,40 @@
+/***************************************************************************
+ categoryfilterimpl.h - description
+ -------------------
+ begin : Sun Nov 17 2002
+ copyright : (C) 2002 by Andy Qua
+ email : andy.qua@blueyonder.co.uk
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef CATEGORYFILTERIMPL_H
+#define CATEGORYFILTERIMPL_H
+
+#include <qwidget.h>
+#include <qstring.h>
+
+#include "categoryfilter.h"
+
+/**
+ *@author Andy Qua
+ */
+
+class CategoryFilterImpl : public CategoryFilterDlg
+{
+ Q_OBJECT
+public:
+ CategoryFilterImpl(const QString &categories, const QString &selectedCategories, QWidget *parent=0, const char *name=0);
+ ~CategoryFilterImpl();
+
+ QString getSelectedFilter();
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index f342aff..1420242 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -27,11 +27,13 @@ using namespace std;
#include "datamgr.h"
#include "global.h"
+QString DataManager::availableCategories = "";
DataManager::DataManager()
{
activeServer = "";
+ availableCategories = "#";
}
DataManager::~DataManager()
{
@@ -206,4 +208,12 @@ void DataManager :: writeOutIpkgConf()
}
out.close();
}
+
+
+void DataManager :: setAvailableCategories( QString section )
+{
+ section = section.lower();
+ if ( availableCategories.find( "#" + section + "#" ) == -1 )
+ availableCategories += section + "#";
+}
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 8c6fb0d..3a64d92 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -20,8 +20,10 @@
#include <map>
using namespace std;
+#include <qstring.h>
+
#include "server.h"
#include "destination.h"
#define LOCAL_SERVER "Installed Pkgs"
@@ -52,10 +54,13 @@ public:
void reloadServerData( );
void writeOutIpkgConf();
+ static QString getAvailableCategories() { return availableCategories; }
+ static void setAvailableCategories( QString section );
private:
+ static QString availableCategories;
QString activeServer;
vector<Server> serverList;
vector<Destination> destList;
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h
index e65e2a0..609e1e8 100644
--- a/noncore/settings/aqpkg/global.h
+++ b/noncore/settings/aqpkg/global.h
@@ -17,9 +17,9 @@
#ifndef __GLOBAL_H
#define __GLOBAL_H
-#define VERSION_TEXT "AQPkg Version 1.0"
+#define VERSION_TEXT "AQPkg Version 1.1"
// Uncomment the below line to run on a Linux box rather than a Zaurus
// box this allows you to change where root is, and where to load config files from
// #define X86
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 5ccd3c3..0141359 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -53,8 +53,11 @@ MainWindow :: MainWindow( QWidget *p, char *name )
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 );
+ filter->insertSeparator();
+ mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C );
+ mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A );
// Create the main menu
menu = menuBar(); //new QMenuBar( this );
menu->insertItem( "&Settings", settings );
@@ -183,4 +186,24 @@ void MainWindow :: filterUpgradedPackages()
networkPkgWindow->showOnlyInstalledPackages( false );
networkPkgWindow->showUpgradedPackages( val );
}
+
+void MainWindow :: setFilterCategory()
+{
+ if ( networkPkgWindow->setFilterCategory( ) )
+ filter->setItemChecked( mnuFilterByCategory, true );
+}
+
+void MainWindow :: filterCategory()
+{
+ if ( filter->isItemChecked( mnuFilterByCategory ) )
+ {
+ networkPkgWindow->filterByCategory( false );
+ filter->setItemChecked( mnuFilterByCategory, false );
+ }
+ else
+ {
+ if ( networkPkgWindow->filterByCategory( true ) )
+ filter->setItemChecked( mnuFilterByCategory, true );
+ }
+} \ No newline at end of file
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 7b6e0ba..92aba4d 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -47,8 +47,10 @@ private:
int mnuShowUninstalledPkgsId;
int mnuShowInstalledPkgsId;
int mnuShowUpgradedPkgsId;
+ int mnuFilterByCategory;
+ int mnuSetFilterCategory;
public slots:
void setDocument( const QString &doc );
void displayHelp();
@@ -58,6 +60,9 @@ public slots:
void displaySettings();
void filterUninstalledPackages();
void filterInstalledPackages();
void filterUpgradedPackages();
+ void filterCategory();
+ void setFilterCategory();
+
};
#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 188f90d..0814121 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -39,8 +39,9 @@ using namespace std;
#include "installdlgimpl.h"
#include "ipkg.h"
#include "inputdlg.h"
#include "letterpushbutton.h"
+#include "categoryfilterimpl.h"
#include "global.h"
extern int compareVersions( const char *v1, const char *v2 );
@@ -61,9 +62,9 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
showUninstalledPkgs = false;
showInstalledPkgs = false;
showUpgradedPkgs = false;
-
+ categoryFilterEnabled = false;
initGui();
setupConnections();
@@ -238,8 +239,15 @@ void NetworkPackageManager :: serverSelected( int )
compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
continue;
}
+ // Apply the section filter
+ if ( categoryFilterEnabled && categoryFilter != "" )
+ {
+ if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
+ continue;
+ }
+
// If the local server, only display installed packages
if ( serverName == LOCAL_SERVER && !it->isInstalled() )
continue;
@@ -294,8 +302,11 @@ void NetworkPackageManager :: serverSelected( int )
if ( it->isInstalled() )
new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
}
}
+
+ new QCheckListItem( item, QString( "Size - " ) + it->getPackageSize() );
+ new QCheckListItem( item, QString( "Section - " ) + it->getSection() );
packagesList->insertItem( item );
}
// If the local server or the local ipkgs server disable the download button
@@ -324,12 +335,8 @@ void NetworkPackageManager :: updateServer()
QString serverName = serversList->currentText();
// Update the current server
// Display dialog
-// ProgressDlg *progDlg = new ProgressDlg( this );
-// QString status = "Updating package lists...";
-// progDlg->show();
-// progDlg->setText( status );
// Disable buttons to stop silly people clicking lots on them :)
// First, write out ipkg_conf file so that ipkg can use it
@@ -803,4 +810,46 @@ void NetworkPackageManager :: showUpgradedPackages( bool val )
{
showUpgradedPkgs = val;
serverSelected( -1 );
}
+
+bool NetworkPackageManager :: filterByCategory( bool val )
+{
+ if ( val )
+ {
+ if ( categoryFilter == "" )
+ {
+ if ( !setFilterCategory() )
+ return false;
+ }
+
+ categoryFilterEnabled = true;
+ serverSelected( -1 );
+ return true;
+ }
+ else
+ {
+ // Turn off filter
+ categoryFilterEnabled = false;
+ serverSelected( -1 );
+ return false;
+ }
+}
+
+bool NetworkPackageManager :: setFilterCategory( )
+{
+ // Get categories;
+ CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this );
+ if ( dlg.exec() == QDialog::Accepted )
+ {
+ categoryFilter = dlg.getSelectedFilter();
+
+ if ( categoryFilter == "" )
+ return false;
+
+ categoryFilterEnabled = true;
+ serverSelected( -1 );
+ return true;
+ }
+
+ return false;
+}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 937c9b4..46919d7 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -43,8 +43,10 @@ public:
void searchForPackage( bool findNext );
void showOnlyUninstalledPackages( bool val );
void showOnlyInstalledPackages( bool val );
void showUpgradedPackages( bool val );
+ bool filterByCategory( bool val );
+ bool setFilterCategory();
private:
DataManager *dataMgr;
@@ -57,9 +59,11 @@ private:
ProgressDlg *progressDlg;
QString currentlySelectedServer;
QString lastSearchText;
+ QString categoryFilter;
+ bool categoryFilterEnabled;
bool showJumpTo;
bool showUninstalledPkgs;
bool showInstalledPkgs;
bool showUpgradedPkgs;
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h
index 56ef874..7545818 100644
--- a/noncore/settings/aqpkg/package.h
+++ b/noncore/settings/aqpkg/package.h
@@ -43,16 +43,20 @@ public:
void setPackageStoredLocally( bool local ) { packageStoredLocally = local; }
void setInstalledToRoot( bool root ) { installedToRoot = root; }
void setInstalledTo( Destination *d ) { installedTo = d; }
void setDependancies( QString &deps ) { dependancies = deps; }
+ void setPackageSize( QString size ) { packageSize = size; }
+ void setSection( QString sect) { section = sect; }
Package *getLocalPackage() { return localPackage; }
QString getPackageName() { return packageName; }
QString getVersion() { return version; }
QString getStatus() { return status; }
QString getDescription() { return description; }
QString getFilename() { return filename; }
QString getDependancies() { return dependancies; }
+ QString getPackageSize() { return packageSize; }
+ QString getSection() { return section; }
bool isInstalled();
bool isPackageStoredLocally() { return packageStoredLocally; }
bool isInstalledToRoot() { return installedToRoot; }
@@ -75,8 +79,10 @@ private:
bool installedToRoot;
bool installed;
bool differentVersionAvailable;
QString dependancies;
+ QString packageSize;
+ QString section;
Destination *installedTo;
};
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 539ebf0..7c3257b 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -27,8 +27,9 @@
#include <fstream>
using namespace std;
#include "server.h"
+#include "datamgr.h"
#ifdef QWS
#include <qpe/global.h>
#include <qpe/applnk.h>
@@ -210,8 +211,20 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
{
if ( currPackage )
currPackage->setFilename( value );
}
+ else if ( key == "Size" )
+ {
+ if ( currPackage )
+ currPackage->setPackageSize( value );
+ }
+ else if ( key == "Section" )
+ {
+ if ( currPackage )
+ currPackage->setSection( value );
+
+ DataManager::setAvailableCategories( value );
+ }
else if ( key == "" )
{
newPackage = true;
}
@@ -269,9 +282,15 @@ QString Server :: toString()
ret += "\n " + packageList[i].toString();
return ret;
+} /*
+void addAvailableSection( QString section )
+{
+ if ( DataManager::availableCategories.find( value ) == -1 )
+// DataManager::availableCategories += "#" + value;
}
+*/
vector<Package> &Server::getPackageList()
{
return packageList;
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h
index e9f434c..f585b8f 100644
--- a/noncore/settings/aqpkg/server.h
+++ b/noncore/settings/aqpkg/server.h
@@ -58,8 +58,9 @@ private:
QString serverUrl;
QString packageFile;
bool active;
+
vector<Package> packageList;
};
#endif