summaryrefslogtreecommitdiff
authorandyq <andyq>2002-09-28 23:22:41 (UTC)
committer andyq <andyq>2002-09-28 23:22:41 (UTC)
commit8ebc71609e5263d096f7331a5e0fa95b41eb1d77 (patch) (side-by-side diff)
treeb51cc78a419a8735d4bc447229b4561b5c6edbe5
parente78460a23cb8bea25f45cdd01f74e8c1d07da1a8 (diff)
downloadopie-8ebc71609e5263d096f7331a5e0fa95b41eb1d77.zip
opie-8ebc71609e5263d096f7331a5e0fa95b41eb1d77.tar.gz
opie-8ebc71609e5263d096f7331a5e0fa95b41eb1d77.tar.bz2
*** empty log message ***
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro41
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp197
-rw-r--r--noncore/settings/aqpkg/datamgr.h64
-rw-r--r--noncore/settings/aqpkg/destination.cpp29
-rw-r--r--noncore/settings/aqpkg/destination.h41
-rw-r--r--noncore/settings/aqpkg/doc.txt49
-rw-r--r--noncore/settings/aqpkg/global.h78
-rw-r--r--noncore/settings/aqpkg/helpwindow.cpp95
-rw-r--r--noncore/settings/aqpkg/helpwindow.h34
-rw-r--r--noncore/settings/aqpkg/inputdlg.cpp121
-rw-r--r--noncore/settings/aqpkg/inputdlg.h50
-rw-r--r--noncore/settings/aqpkg/install.ui118
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp193
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h54
-rw-r--r--noncore/settings/aqpkg/instoptions.ui132
-rw-r--r--noncore/settings/aqpkg/instoptionsimpl.cpp49
-rw-r--r--noncore/settings/aqpkg/instoptionsimpl.h33
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp345
-rw-r--r--noncore/settings/aqpkg/ipkg.h72
-rw-r--r--noncore/settings/aqpkg/main.cpp61
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp85
-rw-r--r--noncore/settings/aqpkg/mainwin.h47
-rw-r--r--noncore/settings/aqpkg/mem.cpp105
-rw-r--r--noncore/settings/aqpkg/moc_aqpkg.cpp95
-rw-r--r--noncore/settings/aqpkg/moc_qinputdialog.cpp88
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp395
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h70
-rw-r--r--noncore/settings/aqpkg/package.cpp109
-rw-r--r--noncore/settings/aqpkg/package.h75
-rw-r--r--noncore/settings/aqpkg/progressdlg.cpp65
-rw-r--r--noncore/settings/aqpkg/progressdlg.h37
-rw-r--r--noncore/settings/aqpkg/server.cpp266
-rw-r--r--noncore/settings/aqpkg/server.h63
-rw-r--r--noncore/settings/aqpkg/settings.ui531
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp195
-rw-r--r--noncore/settings/aqpkg/settingsimpl.h52
-rw-r--r--noncore/settings/aqpkg/utils.cpp74
-rw-r--r--noncore/settings/aqpkg/utils.h38
38 files changed, 4246 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
new file mode 100644
index 0000000..01f9eff
--- a/dev/null
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -0,0 +1,41 @@
+TEMPLATE = app
+CONFIG = qt warn_on debug
+HEADERS = global.h \
+ mainwin.h \
+ datamgr.h \
+ settingsimpl.h \
+ ipkg.h \
+ networkpkgmgr.h \
+ package.h \
+ progressdlg.h \
+ installdlgimpl.h \
+ instoptionsimpl.h \
+ destination.h \
+ utils.h \
+ server.h \
+ helpwindow.h \
+ inputdlg.h
+SOURCES = mainwin.cpp \
+ datamgr.cpp \
+ mem.cpp \
+ settingsimpl.cpp \
+ ipkg.cpp \
+ networkpkgmgr.cpp \
+ main.cpp \
+ package.cpp \
+ progressdlg.cpp \
+ installdlgimpl.cpp \
+ instoptionsimpl.cpp \
+ destination.cpp \
+ utils.cpp \
+ server.cpp \
+ helpwindow.cpp \
+ inputdlg.cpp
+INTERFACES = settings.ui \
+ install.ui \
+ instoptions.ui
+TARGET = aqpkg
+INCLUDEPATH += $(QPEDIR)/include
+DEPENDPATH += $(QPEDIR)/include
+LIBS += -lqpe -lstdc++
+
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
new file mode 100644
index 0000000..7f724af
--- a/dev/null
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -0,0 +1,197 @@
+/***************************************************************************
+ datamgr.cpp - description
+ -------------------
+ begin : Thu Aug 29 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 <fstream>
+#include <iostream>
+using namespace std;
+
+#include <stdio.h>
+
+#include "datamgr.h"
+#include "global.h"
+
+
+DataManager::DataManager()
+{
+ activeServer = "";
+}
+
+DataManager::~DataManager()
+{
+}
+
+Server *DataManager :: getServer( const char *name )
+{
+ Server *s = 0;
+ vector<Server>::iterator it = serverList.begin();
+ while ( it != serverList.end() && s == 0 )
+ {
+ if ( it->getServerName() == name )
+ s = &(*it);
+
+ ++it;
+ }
+
+ return s;
+}
+
+Destination *DataManager :: getDestination( const char *name )
+{
+ Destination *d = 0;
+ vector<Destination>::iterator it = destList.begin();
+ while ( it != destList.end() && d == 0 )
+ {
+ if ( it->getDestinationName() == name )
+ d = &(*it);
+
+ ++it;
+ }
+
+ return d;
+}
+
+void DataManager :: loadServers()
+{
+ // First add our local server - not really a server but
+ // the local config (which packages are installed)
+ serverList.push_back( Server( LOCAL_SERVER, "" ) );
+ serverList.push_back( Server( LOCAL_IPKGS, "" ) );
+
+ // Read file from /etc/ipkg.conf
+ QString ipkg_conf = IPKG_CONF;
+ FILE *fp;
+ fp = fopen( ipkg_conf, "r" );
+ char line[130];
+ QString lineStr;
+ if ( fp == NULL )
+ {
+ cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl;
+ return;
+ }
+ else
+ {
+ while ( fgets( line, sizeof line, fp) != NULL )
+ {
+ lineStr = line;
+ if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) )
+ {
+ char alias[20];
+ char url[100];
+ sscanf( lineStr, "%*[^ ] %s %s", alias, url );
+ Server s( alias, url );
+ serverList.push_back( s );
+
+ if ( lineStr.startsWith( "src" ) )
+ setActiveServer( alias );
+ }
+ else if ( lineStr.startsWith( "dest" ) )
+ {
+ char alias[20];
+ char path[50];
+ sscanf( lineStr, "%*[^ ] %s %s", alias, path );
+ Destination d( alias, path );
+ destList.push_back( d );
+ }
+ }
+ }
+ fclose( fp );
+
+ // Go through the server destination list and add root, cf and card if they
+ // don't already exist
+ vector<Destination>::iterator dit;
+ bool foundRoot = false;
+ bool foundCF = false;
+ bool foundCard = false;
+ for ( dit = destList.begin() ; dit != destList.end() ; ++dit )
+ {
+ if ( dit->getDestinationPath() == "/" )
+ foundRoot = true;
+ if ( dit->getDestinationPath() == "/mnt/cf" )
+ foundCF = true;
+ if ( dit->getDestinationPath() == "/mnt/card" )
+ foundCard = true;
+ }
+
+ // If running on a Zaurus (arm) then if we didn't find root, CF or card
+ // destinations, add them as default
+#ifdef QWS
+#ifndef X86
+ if ( !foundRoot )
+ destList.push_back( Destination( "root", "/" ) );
+ if ( !foundCF )
+ destList.push_back( Destination( "cf", "/mnt/cf" ) );
+ if ( !foundCF )
+ destList.push_back( Destination( "card", "/mnt/card" ) );
+#endif
+#endif
+
+ vector<Server>::iterator it;
+ for ( it = serverList.begin() ; it != serverList.end() ; ++it )
+ reloadServerData( it->getServerName() );
+}
+
+void DataManager :: reloadServerData( const char *serverName )
+{
+ Server *s = getServer( serverName );
+ // Now we've read the config file in we need to read the servers
+ // The local server is a special case. This holds the contents of the
+ // status files the number of which depends on how many destinations
+ // we've set up
+ // The other servers files hold the contents of the server package list
+ if ( s->getServerName() == LOCAL_SERVER )
+ s->readStatusFile( destList );
+ else if ( s->getServerName() == LOCAL_IPKGS )
+ s->readLocalIpks( getServer( LOCAL_SERVER ) );
+ else
+ s->readPackageFile( getServer( LOCAL_SERVER ) );
+
+}
+
+void DataManager :: writeOutIpkgConf()
+{
+ QString ipkg_conf = IPKG_CONF;
+ ofstream out( ipkg_conf );
+
+ out << "# Written by NetworkPackageManager Package Manager" << endl;
+
+ // Write out servers
+ vector<Server>::iterator it = serverList.begin();
+ while ( it != serverList.end() )
+ {
+ QString alias = it->getServerName();
+ // Don't write out local as its a dummy
+ if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS )
+ {
+ QString url = it->getServerUrl();;
+
+ if ( !activeServer || alias != activeServer )
+ out << "#";
+ out << "src " << alias << " " << url << endl;
+ }
+
+ it++;
+ }
+
+ // Write out destinations
+ vector<Destination>::iterator it2 = destList.begin();
+ while ( it2 != destList.end() )
+ {
+ out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl;
+ it2++;
+ }
+
+ out.close();
+}
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
new file mode 100644
index 0000000..94989a9
--- a/dev/null
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -0,0 +1,64 @@
+/***************************************************************************
+ datamgr.h - description
+ -------------------
+ begin : Thu Aug 29 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 DATAMGR_H
+#define DATAMGR_H
+
+#include <map>
+using namespace std;
+
+#include "server.h"
+#include "destination.h"
+
+#define LOCAL_SERVER "local"
+#define LOCAL_IPKGS "local IPKG"
+
+/**
+ *@author Andy Qua
+ */
+
+
+class DataManager
+{
+public:
+ DataManager();
+ ~DataManager();
+
+ void setActiveServer( const QString &act ) { activeServer = act; }
+ QString &getActiveServer( ) { return activeServer; }
+
+ Server *getLocalServer() { return getServer( LOCAL_SERVER ); }
+ vector<Server> &getServerList() { return serverList; }
+ Server *getServer( const char *name );
+
+ vector<Destination> &getDestinationList() { return destList; }
+ Destination *getDestination( const char *name );
+
+ void loadServers();
+ void reloadServerData( const char *sn );
+
+ void writeOutIpkgConf();
+
+
+private:
+ QString activeServer;
+
+ vector<Server> serverList;
+ vector<Destination> destList;
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/destination.cpp b/noncore/settings/aqpkg/destination.cpp
new file mode 100644
index 0000000..ff50e6e
--- a/dev/null
+++ b/noncore/settings/aqpkg/destination.cpp
@@ -0,0 +1,29 @@
+/***************************************************************************
+ destination.cpp - description
+ -------------------
+ begin : Mon Aug 26 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 "destination.h"
+#include "global.h"
+
+Destination::Destination( const char *name, const char *path )
+{
+ destName = name;
+ destPath = path;
+}
+
+Destination::~Destination()
+{
+}
diff --git a/noncore/settings/aqpkg/destination.h b/noncore/settings/aqpkg/destination.h
new file mode 100644
index 0000000..63999d6
--- a/dev/null
+++ b/noncore/settings/aqpkg/destination.h
@@ -0,0 +1,41 @@
+/***************************************************************************
+ destination.h - description
+ -------------------
+ begin : Mon Aug 26 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 DESTINATION_H
+#define DESTINATION_H
+
+#include <qstring.h>
+
+class Destination
+{
+public:
+ Destination() {}
+ Destination( const char *name, const char *path );
+ ~Destination();
+
+ void setDestinationName( const QString &name ) { destName = name; }
+ void setDestinationPath( const QString &path ) { destPath = path; }
+ QString &getDestinationName() { return destName; }
+ QString &getDestinationPath() { return destPath; }
+
+protected:
+
+private:
+ QString destName;
+ QString destPath;
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/doc.txt b/noncore/settings/aqpkg/doc.txt
new file mode 100644
index 0000000..7722c07
--- a/dev/null
+++ b/noncore/settings/aqpkg/doc.txt
@@ -0,0 +1,49 @@
+<qt><h1>Documentation for AQPkg</h1><p>
+AQPkg is a package manager for the Sharp Zaurus.<br>
+Basic Instructions:<br>
+On startup, you will be shown a window. The main part of the window is taken up
+by a list box showing packages. The packages shown will depend on the server selected.<br>
+The servers list contains network servers containing feeds of packages that can be downloaded
+and installed onto your Zaurus. These are held in the file /etc/ipkg.conf and can be maintained
+using AQPkg. In addition to the servers defined in ipkg.conf file, there are two other servers -
+local and local IPKGs. These are not network servers but views of yours Zaurus.<br>
+The local server shows all installed packages, and the local IPKGs server shows all ipks
+that are stored on your Zaurus.<br>
+On the local server, you can only remove packages. On the local IPKGs server you can only
+install and delete packages - removing installed packages is currently not working. On all other
+servers you can install, uninstall, upgrade and download packages.<br>
+To get the latest package list for a server (or refresh the view), select the server you
+wish to update and click the Refresh List button.<br>
+To download a package from a remote server, select the server (any except local and local IPKGs),
+then select the package(s) you wish to download (by tapping in the box next to the package
+name so that a tick appears in the box) and click the Download button. Enter the path where you
+want the package to be downloaded to and click OK to download the package.<br>
+To install, upgrade or remove a package select the packages you wish to install and click the Apply
+button. You will then be shown a dialog which allows you to select which destination you wish
+to install the package to, which packages will be installed, removed and upgraded. You can also
+set various options. (for the moment, see the documentation for IPKG for more details on these
+options). To start the process, click Start. This will perform the necessary operations and
+will show you what is happening. Once everything has completed click the Close button.<br>
+Note: Currently, the operation to perform for a package is automatically decided based on the
+following rules:<br>
+If a package isn't installed, then it will be installed.<br>
+If a package is installed and there isn't a later version available then it will be removed.<br>
+If a package is installed and a different version is available then it will be upgraded. (Note,
+I haven't yet found a way to determine if an available package is newer or older than the one
+currently installed so it is possible that a package may be downgraded).<br>
+As previously mentioned, a package can be explicitly removed by using the local server.<br><br>
+A couple of last notes, in the main window, the following may be useful:<br>
+If a package is installed then it will have (installed) after it.<br>
+If a different version is available then it will have a * after the package name.<br>
+You can view details of a package by tapping twice (quickly) on the package name (NOT the
+box next to the package name). This will show you a brief description of the package, the
+version installed (if it is installed), and the version available for download/installation
+(if a different on is available).<br><br><br>
+Well, hope you enjoy using this program. If you have any ideas/suggestions/ideas for improvements
+then please let me know at andy.qua@blueyonder.co.uk.<br><br>
+Thanks for using this.
+Andy.
+</p></qt>
+
+
+
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h
new file mode 100644
index 0000000..be3ede4
--- a/dev/null
+++ b/noncore/settings/aqpkg/global.h
@@ -0,0 +1,78 @@
+/***************************************************************************
+ global.h - description
+ -------------------
+ begin : Mon Aug 26 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 __GLOBAL_H
+#define __GLOBAL_H
+
+// 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
+
+// Sets up location of ipkg.conf and root directory
+#ifdef QWS
+
+#ifndef X86
+
+// Running QT/Embedded on an arm processor
+#define IPKG_CONF "/etc/ipkg.conf"
+#define ROOT "/"
+#define IPKG_DIR "/usr/lib/ipkg/"
+
+#else
+
+// Running QT/Embedded on a X86 linux box
+#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data"
+#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf"
+#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root"
+
+#endif
+
+#else
+
+// Running QT on a X86 linux box
+#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf"
+#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root"
+#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data"
+
+#endif
+
+
+// Uncomment the below line to turn on memory checking
+//#define _DEBUG 1
+
+#ifndef __MEMFILE_C
+#ifdef _DEBUG
+void * operator new(unsigned int size,const char *file, int line);
+void operator delete(void *p);
+#endif
+
+#ifdef _DEBUG
+#define DEBUG_NEW new(__FILE__, __LINE__)
+//#define DEBUG_NEW new
+#else
+#define DEBUG_NEW new
+#endif
+
+#define new DEBUG_NEW
+#endif
+
+
+void AddTrack(long addr, long asize, const char *fname, long lnum);
+void RemoveTrack(long addr);
+void DumpUnfreed();
+
+#endif
diff --git a/noncore/settings/aqpkg/helpwindow.cpp b/noncore/settings/aqpkg/helpwindow.cpp
new file mode 100644
index 0000000..0302b3f
--- a/dev/null
+++ b/noncore/settings/aqpkg/helpwindow.cpp
@@ -0,0 +1,95 @@
+/***************************************************************************
+ helpwindow.cpp - description
+ -------------------
+ begin : Sun Sep 8 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 <qwidget.h>
+#include <qlayout.h>
+#include <qstring.h>
+#include <qtextview.h>
+
+#include "helpwindow.h"
+#include "global.h"
+
+
+#define HELP_TEXT \
+"<qt><h1>Documentation for AQPkg</h1><p> " \
+"AQPkg is a package manager for the Sharp Zaurus.<br><br> " \
+"Basic Instructions:<br><br> " \
+"On startup, you will be shown a window. The main part of the window is taken up " \
+"by a list box showing packages. The packages shown will depend on the server selected.<br><br> " \
+"The servers list contains network servers containing feeds of packages that can be downloaded " \
+"and installed onto your Zaurus. These are held in the file /etc/ipkg.conf and can be maintained " \
+"using AQPkg. In addition to the servers defined in ipkg.conf file, there are two other servers - " \
+"local and local IPKGs. These are not network servers but views of yours Zaurus.<br><br> " \
+"The local server shows all installed packages, and the local IPKGs server shows all ipks " \
+"that are stored on your Zaurus.<br><br> " \
+"On the local server, you can only remove packages. On the local IPKGs server you can only " \
+"install and delete packages - removing installed packages is currently not working. On all other " \
+"servers you can install, uninstall, upgrade and download packages.<br><br> " \
+"To get the latest package list for a server (or refresh the view), select the server you " \
+"wish to update and click the Refresh List button.<br><br> " \
+"To download a package from a remote server, select the server (any except local and local IPKGs), " \
+"then select the package(s) you wish to download (by tapping in the box next to the package " \
+"name so that a tick appears in the box) and click the Download button. Enter the path where you " \
+"want the package to be downloaded to and click OK to download the package.<br><br> " \
+"To install, upgrade or remove a package select the packages you wish to install and click the Apply " \
+"button. You will then be shown a dialog which allows you to select which destination you wish " \
+"to install the package to, which packages will be installed, removed and upgraded. You can also " \
+"set various options. (for the moment, see the documentation for IPKG for more details on these " \
+"options). To start the process, click Start. This will perform the necessary operations and " \
+"will show you what is happening. Once everything has completed click the Close button.<br><br> " \
+"Note: Currently, the operation to perform for a package is automatically decided based on the " \
+"following rules:<br><br> " \
+" If a package isn't installed, then it will be installed.<br> " \
+" If a package is installed and there isn't a later version available then it will be removed.<br> " \
+" If a package is installed and a different version is available then it will be upgraded. (Note, " \
+"I haven't yet found a way to determine if an available package is newer or older than the one " \
+"currently installed so it is possible that a package may be downgraded).<br><br> " \
+"As previously mentioned, a package can be explicitly removed by using the local server.<br><br> " \
+"A couple of last notes, in the main window, the following may be useful:<br><br> " \
+"If a package is installed then it will have (installed) after it.<br><br> " \
+"If a different version is available then it will have a * after the package name.<br><br> " \
+"You can view details of a package by tapping twice (quickly) on the package name (NOT the " \
+"box next to the package name). This will show you a brief description of the package, the " \
+"version installed (if it is installed), and the version available for download or installation " \
+"(if a different on is available).<br><br> " \
+"Well, hope you enjoy using this program. If you have any ideas/suggestions/ideas for improvements " \
+"then please let me know at andy.qua@blueyonder.co.uk.<br><br> " \
+"Thanks for using this. " \
+"Andy. " \
+"</p></qt>"
+
+
+HelpWindow::HelpWindow( QWidget *parent, const char *name, bool modal, WFlags flags )
+ : QDialog( parent, name, modal, flags )
+{
+// resize( 230, 280 );
+
+ setCaption( "Help for AQPkg" );
+
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ QString text = HELP_TEXT;;
+ QTextView *view = new QTextView( text, 0, this, "view" );
+ layout->insertSpacing( -1, 5 );
+ layout->insertWidget( -1, view );
+ layout->insertSpacing( -1, 5 );
+
+ showMaximized();
+}
+
+HelpWindow::~HelpWindow()
+{
+}
diff --git a/noncore/settings/aqpkg/helpwindow.h b/noncore/settings/aqpkg/helpwindow.h
new file mode 100644
index 0000000..edc1b6e
--- a/dev/null
+++ b/noncore/settings/aqpkg/helpwindow.h
@@ -0,0 +1,34 @@
+/***************************************************************************
+ helpwindow.h - description
+ -------------------
+ begin : Sun Sep 8 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 HELPWINDOW_H
+#define HELPWINDOW_H
+
+#include <qdialog.h>
+
+/**
+ *@author Andy Qua
+ */
+
+class HelpWindow : public QDialog
+{
+public:
+ HelpWindow( QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags flags = 0 );
+ ~HelpWindow();
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/inputdlg.cpp b/noncore/settings/aqpkg/inputdlg.cpp
new file mode 100644
index 0000000..724a891
--- a/dev/null
+++ b/noncore/settings/aqpkg/inputdlg.cpp
@@ -0,0 +1,121 @@
+/***************************************************************************
+ inputdlg.h - description
+ -------------------
+ begin : Mon Aug 26 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 <qlayout.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qspinbox.h>
+#include <qcombobox.h>
+#include <qwidgetstack.h>
+#include <qvalidator.h>
+#include <qapplication.h>
+
+#include "inputdlg.h"
+#include "global.h"
+
+
+InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name,
+ bool modal )
+ : QDialog( parent, name, modal )
+{
+ lineEdit = 0;
+
+ QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
+
+ QLabel* l = new QLabel( label, this );
+ vbox->addWidget( l );
+
+ lineEdit = new QLineEdit( this );
+ vbox->addWidget( lineEdit );
+
+ QHBoxLayout *hbox = new QHBoxLayout( 6 );
+ vbox->addLayout( hbox, AlignRight );
+
+ ok = new QPushButton( tr( "&OK" ), this );
+ ok->setDefault( TRUE );
+ QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this );
+
+ QSize bs( ok->sizeHint() );
+ if ( cancel->sizeHint().width() > bs.width() )
+ bs.setWidth( cancel->sizeHint().width() );
+
+ ok->setFixedSize( bs );
+ cancel->setFixedSize( bs );
+
+ hbox->addWidget( new QWidget( this ) );
+ hbox->addWidget( ok );
+ hbox->addWidget( cancel );
+
+ connect( lineEdit, SIGNAL( returnPressed() ),
+ this, SLOT( tryAccept() ) );
+ connect( lineEdit, SIGNAL( textChanged( const QString & ) ),
+ this, SLOT( textChanged( const QString & ) ) );
+
+ connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
+ connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+
+ resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() );
+}
+
+/*!
+ Destructor.
+*/
+
+InputDialog::~InputDialog()
+{
+}
+
+void InputDialog :: setText( const QString &text )
+{
+ lineEdit->setText( text );
+ lineEdit->selectAll();
+}
+
+QString InputDialog :: getText()
+{
+ return lineEdit->text();
+}
+
+QString InputDialog::getText( const QString &caption, const QString &label,
+ const QString &text, bool *ok, QWidget *parent,
+ const char *name )
+{
+ InputDialog *dlg = new InputDialog( label, parent, name, true );
+ dlg->setCaption( caption );
+ dlg->setText( text );
+
+ QString result;
+ *ok = dlg->exec() == QDialog::Accepted;
+ if ( *ok )
+ result = dlg->getText();
+
+ delete dlg;
+ return result;
+}
+
+
+
+void InputDialog :: textChanged( const QString &s )
+{
+ ok->setEnabled( !s.isEmpty() );
+}
+
+void InputDialog :: tryAccept()
+{
+ if ( !lineEdit->text().isEmpty() )
+ accept();
+}
diff --git a/noncore/settings/aqpkg/inputdlg.h b/noncore/settings/aqpkg/inputdlg.h
new file mode 100644
index 0000000..1e0c5bc
--- a/dev/null
+++ b/noncore/settings/aqpkg/inputdlg.h
@@ -0,0 +1,50 @@
+/***************************************************************************
+ inputdlg.h - description
+ -------------------
+ begin : Mon Aug 26 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 INPUTDIALOG_H
+#define INPUTDIALOG_H
+
+#include <qdialog.h>
+#include <qstring.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+
+class InputDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
+ bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
+
+ InputDialog( const QString &label, QWidget* parent = 0, const char* name = 0,
+ bool modal = TRUE );
+ ~InputDialog();
+
+ void setText( const QString &text );
+ QString getText();
+
+private slots:
+ void textChanged( const QString &s );
+ void tryAccept();
+
+private:
+ QLineEdit *lineEdit;
+ QPushButton *ok;
+};
+
+#endif // INPUTDIALOG_H
diff --git a/noncore/settings/aqpkg/install.ui b/noncore/settings/aqpkg/install.ui
new file mode 100644
index 0000000..daa0ff6
--- a/dev/null
+++ b/noncore/settings/aqpkg/install.ui
@@ -0,0 +1,118 @@
+<!DOCTYPE UI><UI>
+<class>InstallDlg</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>InstallDlg</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>196</width>
+ <height>271</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Install</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>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Destination</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destination</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox2</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Output</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>QMultiLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>output</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnInstall</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Start</string>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnOptions</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Options</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>btnOptions</sender>
+ <signal>clicked()</signal>
+ <receiver>InstallDlg</receiver>
+ <slot>optionsSelected()</slot>
+ </connection>
+ <connection>
+ <sender>btnInstall</sender>
+ <signal>clicked()</signal>
+ <receiver>InstallDlg</receiver>
+ <slot>installSelected()</slot>
+ </connection>
+ <slot access="public">installSelected()</slot>
+ <slot access="public">displayText(const QString &amp;)</slot>
+ <slot access="public">optionsSelected()</slot>
+</connections>
+</UI>
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
new file mode 100644
index 0000000..31be213
--- a/dev/null
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -0,0 +1,193 @@
+/***************************************************************************
+ installdlgimpl.cpp - description
+ -------------------
+ begin : Mon Aug 26 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. *
+ * *
+ ***************************************************************************/
+
+#ifdef QWS
+#include <qpe/config.h>
+#endif
+
+#include <qmultilineedit.h>
+#include <qdialog.h>
+#include <qcombobox.h>
+#include <qcheckbox.h>
+#include <qpushbutton.h>
+
+
+#include "datamgr.h"
+#include "instoptionsimpl.h"
+#include "destination.h"
+#include "installdlgimpl.h"
+#include "global.h"
+
+InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
+ : InstallDlg( parent, name, modal, fl )
+{
+ dataMgr = dataManager;
+ vector<Destination>::iterator dit;
+
+ QString defaultDest = "root";
+#ifdef QWS
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ defaultDest = cfg.readEntry( "dest", "root" );
+
+ // Grab flags - Turn MAKE_LINKS on by default (if no flags found)
+ flags = cfg.readNumEntry( "installFlags", MAKE_LINKS );
+#else
+ flags = 0;
+#endif
+
+ // Output text is read only
+ output->setReadOnly( true );
+
+ // setup destination data
+ int defIndex = 0;
+ int i;
+ for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i )
+ {
+ destination->insertItem( dit->getDestinationName() );
+ if ( dit->getDestinationName() == defaultDest )
+ defIndex = i;
+ }
+
+ destination->setCurrentItem( defIndex );
+
+ vector<QString>::iterator it;
+ // setup package data
+ QString remove = "Remove\n";
+ QString install = "\nInstall\n";
+ QString upgrade = "\nUpgrade\n";
+ for ( it = packageList.begin() ; it != packageList.end() ; ++it )
+ {
+ QString name = *it;
+ if ( name.startsWith( "I" ) )
+ {
+ installList.push_back( name.mid(1) );
+ install += " " + name.mid(1) + "\n";
+ }
+ else if ( name.startsWith( "D" ) )
+ {
+ removeList.push_back( name.mid(1) );
+ remove += " " + name.mid(1) + "\n";
+ }
+ else if ( name.startsWith( "U" ) )
+ {
+ updateList.push_back( name.mid(1) );
+ upgrade += " " + name.mid(1) + "\n";
+ }
+ }
+
+ output->setText( remove + install + upgrade );
+
+ connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+}
+
+InstallDlgImpl::~InstallDlgImpl()
+{
+}
+
+bool InstallDlgImpl :: showDlg()
+{
+ showMaximized();
+ bool ret = exec();
+
+ return ret;
+}
+
+void InstallDlgImpl :: optionsSelected()
+{
+ InstallOptionsDlgImpl opt( flags, this, "Option", true );
+ opt.exec();
+
+ // set options selected from dialog
+ flags = 0;
+ if ( opt.forceDepends->isChecked() )
+ flags |= FORCE_DEPENDS;
+ if ( opt.forceReinstall->isChecked() )
+ flags |= FORCE_REINSTALL;
+ if ( opt.forceRemove->isChecked() )
+ flags |= FORCE_REMOVE;
+ if ( opt.forceOverwrite->isChecked() )
+ flags |= FORCE_OVERWRITE;
+ if ( opt.makeLinks->isChecked() )
+ flags |= MAKE_LINKS;
+
+#ifdef QWS
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ cfg.writeEntry( "installFlags", flags );
+#endif
+}
+
+void InstallDlgImpl :: installSelected()
+{
+ if ( btnInstall->text() == "Close" )
+ {
+ done( 1 );
+ return;
+ }
+
+ btnInstall->setEnabled( false );
+
+ output->setText( "" );
+ Destination *d = dataMgr->getDestination( destination->currentText() );
+ QString dest = d->getDestinationName();
+ QString destDir = d->getDestinationPath();
+
+#ifdef QWS
+ // Save settings
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ cfg.writeEntry( "dest", dest );
+#endif
+
+ // First run through the remove list, then the install list then the upgrade list
+ vector<QString>::iterator it;
+ ipkg.setOption( "remove" );
+ ipkg.setDestination( dest );
+ ipkg.setDestinationDir( destDir );
+ ipkg.setFlags( flags );
+ for ( it = removeList.begin() ; it != removeList.end() ; ++it )
+ {
+ ipkg.setPackage( *it );
+ ipkg.runIpkg();
+ }
+
+ ipkg.setOption( "install" );
+ for ( it = installList.begin() ; it != installList.end() ; ++it )
+ {
+ ipkg.setPackage( *it );
+ ipkg.runIpkg();
+ }
+
+ flags |= FORCE_REINSTALL;
+ ipkg.setFlags( flags );
+ for ( it = updateList.begin() ; it != updateList.end() ; ++it )
+ {
+ ipkg.setPackage( *it );
+ ipkg.runIpkg();
+ }
+
+ btnInstall->setEnabled( true );
+ btnInstall->setText( tr( "Close" ) );
+}
+
+void InstallDlgImpl :: displayText(const QString &text )
+{
+ QString t = output->text() + "\n" + text;
+ output->setText( t );
+ output->setCursorPosition( output->numLines(), 0 );
+}
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
new file mode 100644
index 0000000..195616d
--- a/dev/null
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -0,0 +1,54 @@
+/***************************************************************************
+ installdlgimpl.h - description
+ -------------------
+ begin : Mon Aug 26 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 INSTALLDLGIMPL_H
+#define INSTALLDLGIMPL_H
+
+#include <vector>
+using namespace std;
+
+#include <qstring.h>
+
+#include "ipkg.h"
+#include "install.h"
+
+class InstallDlgImpl : public InstallDlg
+{
+public:
+ InstallDlgImpl( vector<QString> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
+ ~InstallDlgImpl();
+
+ bool showDlg();
+ bool upgradeServer( QString &server );
+
+protected:
+
+private:
+ DataManager *dataMgr;
+ vector<QString> installList;
+ vector<QString> removeList;
+ vector<QString> updateList;
+ int flags;
+ Ipkg ipkg;
+
+ bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
+
+ void optionsSelected();
+ void installSelected();
+ void displayText(const QString &text );
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/instoptions.ui b/noncore/settings/aqpkg/instoptions.ui
new file mode 100644
index 0000000..d4a3548
--- a/dev/null
+++ b/noncore/settings/aqpkg/instoptions.ui
@@ -0,0 +1,132 @@
+<!DOCTYPE UI><UI>
+<class>InstallOptionsDlg</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>InstallOptionsDlg</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>158</width>
+ <height>205</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Options</string>
+ </property>
+ <property stdset="1">
+ <name>sizeGripEnabled</name>
+ <bool>false</bool>
+ </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>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Options</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>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forceDepends</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Force Depends</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forceReinstall</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Force Reinstall</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forceRemove</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Force Remove</string>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forceOverwrite</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Force Overwrite</string>
+ </property>
+ </widget>
+ <widget row="4" column="0" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>makeLinks</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Link to root</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnOK</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>OK</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>btnOK</sender>
+ <signal>clicked()</signal>
+ <receiver>InstallOptionsDlg</receiver>
+ <slot>accept()</slot>
+ </connection>
+</connections>
+</UI>
diff --git a/noncore/settings/aqpkg/instoptionsimpl.cpp b/noncore/settings/aqpkg/instoptionsimpl.cpp
new file mode 100644
index 0000000..d9d2be9
--- a/dev/null
+++ b/noncore/settings/aqpkg/instoptionsimpl.cpp
@@ -0,0 +1,49 @@
+/***************************************************************************
+ instoptionsimpl.cpp - description
+ -------------------
+ begin : Mon Aug 26 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. *
+ * *
+ ***************************************************************************/
+
+#ifdef QWS
+#include <qpe/config.h>
+#endif
+
+#include <qdialog.h>
+#include <qcheckbox.h>
+
+#include "instoptionsimpl.h"
+#include "ipkg.h"
+#include "global.h"
+
+InstallOptionsDlgImpl::InstallOptionsDlgImpl( int flags, QWidget * parent, const char* name, bool modal, WFlags fl )
+ : InstallOptionsDlg( parent, name, modal, fl )
+{
+ if ( flags & FORCE_DEPENDS )
+ forceDepends->setChecked( true );
+ if ( flags & FORCE_REINSTALL )
+ forceReinstall->setChecked( true );
+ if ( flags & FORCE_REMOVE )
+ forceRemove->setChecked( true );
+ if ( flags & FORCE_OVERWRITE )
+ forceOverwrite->setChecked( true );
+ if ( flags & MAKE_LINKS )
+ makeLinks->setChecked( true );
+
+ showMaximized();
+
+}
+
+InstallOptionsDlgImpl::~InstallOptionsDlgImpl()
+{
+}
diff --git a/noncore/settings/aqpkg/instoptionsimpl.h b/noncore/settings/aqpkg/instoptionsimpl.h
new file mode 100644
index 0000000..08ec616
--- a/dev/null
+++ b/noncore/settings/aqpkg/instoptionsimpl.h
@@ -0,0 +1,33 @@
+/***************************************************************************
+ installoptionsimpl.h - description
+ -------------------
+ begin : Mon Aug 26 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 INSTALLOPTIONSIMPL_H
+#define INSTALLOPTIONSIMPL_H
+
+#include "instoptions.h"
+
+class InstallOptionsDlgImpl : public InstallOptionsDlg
+{
+public:
+ InstallOptionsDlgImpl( int flags, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
+ ~InstallOptionsDlgImpl();
+
+protected:
+
+private:
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
new file mode 100644
index 0000000..d5157eb
--- a/dev/null
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -0,0 +1,345 @@
+/***************************************************************************
+ ipkg.cpp - description
+ -------------------
+ begin : Sat Aug 31 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 <fstream>
+using namespace std;
+
+#include <stdio.h>
+#include <unistd.h>
+
+#ifdef QWS
+#include <qpe/qpeapplication.h>
+#else
+#include <qapplication.h>
+#endif
+#include <qdir.h>
+#include <qtextstream.h>
+
+#include "utils.h"
+#include "ipkg.h"
+#include "global.h"
+
+Ipkg :: Ipkg()
+{
+}
+
+Ipkg :: ~Ipkg()
+{
+}
+
+// Option is what we are going to do - install, upgrade, download
+// package is the package name to install - either a fully qualified path and ipk
+// file (if stored locally) or just the name of the package (for a network package)
+// packageName is the package name - (for a network package this will be the same as
+// package parameter)
+// dest is the destination alias (from ipk.conf)
+// destDir is the dir that the destination alias points to (used to link to root)
+// flags is the ipkg options flags
+// dir is the directory to run ipkg in (defaults to "")
+bool Ipkg :: runIpkg( )
+{
+ bool ret = false;
+
+ QDir::setCurrent( "/tmp" );
+ QString cmd = "";
+
+ if ( runtimeDir != "" )
+ {
+ cmd += "cd ";
+ cmd += runtimeDir;
+ cmd += " ; ";
+ }
+ cmd += "ipkg";
+
+ if ( option != "update" && option != "download" )
+ {
+ cmd += " -dest "+ destination;
+ cmd += " -force-defaults";
+
+ if ( flags & FORCE_DEPENDS )
+ cmd += " -force-depends";
+ if ( flags & FORCE_REINSTALL )
+ cmd += " -force-reinstall";
+ if ( flags & FORCE_REMOVE )
+ cmd += " -force-removal-of-essential-packages";
+ if ( flags & FORCE_OVERWRITE )
+ cmd += " -force-overwrite";
+
+ // Handle make links
+ // Rules - If make links is switched on, create links to root
+ // if destDir is NOT /
+ if ( flags & MAKE_LINKS )
+ {
+ // If destDir == / turn off make links as package is being insalled
+ // to root already.
+ if ( destDir == "/" )
+ flags ^= MAKE_LINKS;
+ }
+
+ }
+
+#ifdef X86
+ cmd += " -f ";
+ cmd += IPKG_CONF;
+#endif
+
+ cmd += " " + option + " " + package + " 2>&1";
+
+ qApp->processEvents();
+
+ // If we are removing packages and make links option is selected
+ // create the links
+ if ( option == "remove" )
+ {
+ createLinks = false;
+ if ( flags & MAKE_LINKS )
+ {
+ emit outputText( QString( "Removing symbolic links...\n" ) );
+ linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
+ }
+ }
+
+ emit outputText( cmd );
+
+ // Execute command
+ dependantPackages = new QList<QString>;
+ dependantPackages->setAutoDelete( true );
+ ret = executeIpkgCommand( cmd, option );
+
+ if ( option == "install" )
+ {
+ // If we are not removing packages and make links option is selected
+ // create the links
+ createLinks = true;
+ if ( flags & MAKE_LINKS )
+ {
+ emit outputText( " " );
+ emit outputText( QString( "Creating symbolic links for " )+ package );
+
+ linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
+
+ // link dependant packages that were installed with this release
+ QString *pkg;
+ for ( pkg = dependantPackages->first(); pkg != 0; pkg = dependantPackages->next() )
+ {
+ emit outputText( " " );
+ emit outputText( QString( "Creating symbolic links for " )+ (*pkg) );
+ linkPackage( Utils::getPackageNameFromIpkFilename( *pkg ), destination, destDir );
+ }
+ }
+ }
+
+ delete dependantPackages;
+
+ emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") );
+ return ret;
+}
+
+
+int Ipkg :: executeIpkgCommand( QString &cmd, const QString option )
+{
+ FILE *fp = NULL;
+ char line[130];
+ QString lineStr, lineStrOld;
+ int ret = false;
+
+ fp = popen( (const char *) cmd, "r");
+ if ( fp == NULL )
+ {
+ cout << "Couldn't execute " << cmd << "! err = " << fp << endl;
+ QString text;
+ text.sprintf( "Couldn't execute %s! See stdout for error code", (const char *)cmd );
+ emit outputText( text );
+ }
+ else
+ {
+ while ( fgets( line, sizeof line, fp) != NULL )
+ {
+ lineStr = line;
+ lineStr=lineStr.left( lineStr.length()-1 );
+
+ if ( lineStr != lineStrOld )
+ {
+ //See if we're finished
+ if ( option == "install" )
+ {
+ // Need to keep track of any dependant packages that get installed
+ // so that we can create links to them as necessary
+ if ( lineStr.startsWith( "Installing " ) )
+ {
+ cout << "LineStr = " << lineStr << endl;
+ int start = lineStr.find( " " ) + 1;
+ int end = lineStr.find( " ", start );
+ QString *package = new QString( lineStr.mid( start, end-start ) );
+ dependantPackages->append( package );
+ cout << "installing dependant package <" << *package << ">" << endl;
+ }
+ }
+
+ if ( option == "update" )
+ {
+ if (lineStr.contains("Updated list"))
+ ret = true;
+ }
+ else if ( option == "download" )
+ {
+ if (lineStr.contains("Downloaded"))
+ ret = true;
+ }
+ else
+ {
+ if (lineStr.contains("Done"))
+ ret = true;
+ }
+
+ emit outputText( lineStr );
+ }
+ lineStrOld = lineStr;
+ qApp->processEvents();
+ }
+ pclose(fp);
+ }
+
+ return ret;
+}
+
+
+void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir )
+{
+ if ( dest == "root" || dest == "/" )
+ return;
+
+ qApp->processEvents();
+ QStringList *fileList = getList( packFileName, destDir );
+ qApp->processEvents();
+ processFileList( fileList, destDir );
+ delete fileList;
+}
+
+QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir )
+{
+ QString packageFileDir = destDir+"/usr/lib/ipkg/info/"+packageFilename+".list";
+ QFile f( packageFileDir );
+
+ cout << "Try to open " << packageFileDir.latin1() << endl;
+ if ( !f.open(IO_ReadOnly) )
+ {
+ // Couldn't open from dest, try from /
+// cout << "Could not open:" << packageFileDir << endl;
+ f.close();
+
+ packageFileDir = "/usr/lib/ipkg/info/"+packageFilename+".list";
+ f.setName( packageFileDir );
+// cout << "Try to open " << packageFileDir.latin1() << endl;
+ if ( ! f.open(IO_ReadOnly) )
+ {
+ cout << "Could not open:" << packageFileDir << endl;
+ emit outputText( QString( "Could not open :" ) + packageFileDir );
+ return (QStringList*)0;
+ }
+ }
+ QStringList *fileList = new QStringList();
+ QTextStream t( &f );
+ while ( !t.eof() )
+ *fileList += t.readLine();
+
+ f.close();
+ return fileList;
+}
+
+void Ipkg :: processFileList( const QStringList *fileList, const QString &destDir )
+{
+ if ( !fileList || fileList->isEmpty() )
+ return;
+
+ QString baseDir = ROOT;
+
+ if ( createLinks == true )
+ {
+ for ( uint i=0; i < fileList->count(); i++ )
+ {
+ processLinkDir( (*fileList)[i], baseDir, destDir );
+ qApp->processEvents();
+ }
+ }
+ else
+ {
+ for ( int i = fileList->count()-1; i >= 0 ; i-- )
+ {
+ cout << "i = " << i << ", Dealing with " << (*fileList)[i] << endl;
+ processLinkDir( (*fileList)[i], baseDir, destDir );
+ qApp->processEvents();
+ }
+ }
+}
+
+void Ipkg :: processLinkDir( const QString &file, const QString &destDir, const QString &baseDir )
+{
+ QString sourceFile = baseDir + file;
+ QString linkFile = destDir + file;
+ QString text;
+ if ( createLinks )
+ {
+ // If this file is a directory (ends with a /) and it doesn't exist,
+ // we need to create it
+ if ( file.right(1) == "/" )
+ {
+ QFileInfo f( linkFile );
+ if ( !f.exists() )
+ {
+ emit outputText( QString( "Creating directory " ) + linkFile );
+ QDir d;
+ d.mkdir( linkFile, true );
+ }
+ else
+ emit outputText( QString( "Directory " ) + linkFile + " exists" );
+
+ }
+ else
+ {
+ int rc = symlink( sourceFile, linkFile );
+ text = (rc == 0 ? "Linked " : "Failed to link ");
+ text += sourceFile + " to " + linkFile;
+ emit outputText( text );
+ }
+ }
+ else
+ {
+ QFileInfo f( linkFile );
+ if ( f.exists() )
+ {
+ if ( f.isFile() )
+ {
+ QFile f( linkFile );
+ bool rc = f.remove();
+
+ text = (rc ? "Removed " : "Failed to remove ");
+ text += linkFile;
+ emit outputText( text );
+ }
+ else if ( f.isDir() )
+ {
+ QDir d;
+ bool rc = d.rmdir( linkFile, true );
+ text = (rc ? "Removed " : "Failed to remove ");
+ text += linkFile;
+ emit outputText( text );
+ }
+ }
+ }
+
+}
diff --git a/noncore/settings/aqpkg/ipkg.h b/noncore/settings/aqpkg/ipkg.h
new file mode 100644
index 0000000..63588c4
--- a/dev/null
+++ b/noncore/settings/aqpkg/ipkg.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ ipkg.h - description
+ -------------------
+ begin : Sat Aug 31 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 IPKG_H
+#define IPKG_H
+
+
+/**
+ *@author Andy Qua
+ */
+
+#include <qobject.h>
+#include <qstring.h>
+#include <qlist.h>
+
+#define FORCE_DEPENDS 0x0001
+#define FORCE_REMOVE 0x0002
+#define FORCE_REINSTALL 0x0004
+#define FORCE_OVERWRITE 0x0008
+#define MAKE_LINKS 0x0010
+
+class Ipkg : public QObject
+{
+ Q_OBJECT
+public:
+ Ipkg();
+ ~Ipkg();
+ bool runIpkg( );
+
+ void setOption( const char *opt ) { option = opt; }
+ void setPackage( const char *pkg ) { package = pkg; }
+ void setDestination( const char *dest ) { destination = dest; }
+ void setDestinationDir( const char *dir ) { destDir = dir; }
+ void setFlags( int fl ) { flags = fl; }
+ void setRuntimeDirectory( const char *dir ) { runtimeDir = dir; }
+
+signals:
+ void outputText( const QString &text );
+
+private:
+ bool createLinks;
+ QString option;
+ QString package;
+ QString destination;
+ QString destDir;
+ int flags;
+ QString runtimeDir;
+
+ QList<QString> *dependantPackages;
+
+ int executeIpkgCommand( QString &cmd, const QString option );
+ void linkPackage( const QString &packFileName, const QString &dest, const QString &destDir );
+ QStringList* getList( const QString &packageFilename, const QString &destDir );
+ void processFileList( const QStringList *fileList, const QString &destDir );
+ void processLinkDir( const QString &file, const QString &baseDir, const QString &destDir );
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp
new file mode 100644
index 0000000..e943e49
--- a/dev/null
+++ b/noncore/settings/aqpkg/main.cpp
@@ -0,0 +1,61 @@
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : Mon Aug 26 13:32:30 BST 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. *
+ * *
+ ***************************************************************************/
+
+#ifdef QWS
+#include <qpe/qpeapplication.h>
+#else
+#include <qapplication.h>
+#endif
+
+#include <qobjectdefs.h>
+
+#include "mainwin.h"
+#include "server.h"
+
+#include "global.h"
+
+
+/*
+int main2(int argc, char *argv[])
+{
+ Server local( "local", "", "status" );
+ local.readPackageFile();
+
+ Server s( "opiecvs", "aaa" );
+ s.readPackageFile( &local );
+
+}
+*/
+
+int main(int argc, char *argv[])
+{
+#ifdef QWS
+ QPEApplication a( argc, argv );
+#else
+ QApplication a( argc, argv );
+#endif
+
+ MainWindow *win = new MainWindow();
+ a.setMainWidget(win);
+ win->show();
+
+ a.exec();
+
+ #ifdef _DEBUG
+ DumpUnfreed();
+ #endif
+}
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
new file mode 100644
index 0000000..5de4dc9
--- a/dev/null
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -0,0 +1,85 @@
+/***************************************************************************
+ mainwin.cpp - description
+ -------------------
+ begin : Mon Aug 26 13:32:30 BST 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 <qmenubar.h>
+#include <qpopupmenu.h>
+
+#include "mainwin.h"
+#include "datamgr.h"
+#include "networkpkgmgr.h"
+#include "settingsimpl.h"
+#include "helpwindow.h"
+#include "global.h"
+
+MainWindow :: MainWindow( QWidget *p, char *name )
+ : QMainWindow( p, name )
+{
+#ifdef QWS
+ showMaximized();
+#endif
+
+ setCaption( "AQPkg - Package Manager" );
+
+ // Create our menu
+ QPopupMenu *help = new QPopupMenu( this );
+ help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H );
+ help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
+
+ QPopupMenu *settings = new QPopupMenu( this );
+ settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
+
+ // Create the main menu
+ QMenuBar *menu = menuBar(); //new QMenuBar( this );
+ menu->insertItem( "&Settings", settings );
+ menu->insertItem( "&Help", help );
+
+ mgr = new DataManager();
+ mgr->loadServers();
+
+ stack = new QWidgetStack( this );
+
+ networkPkgWindow = new NetworkPackageManager( mgr, stack );
+ stack->addWidget( networkPkgWindow, 1 );
+
+ setCentralWidget( stack );
+ stack->raiseWidget( networkPkgWindow );
+}
+
+MainWindow :: ~MainWindow()
+{
+ delete networkPkgWindow;
+}
+
+void MainWindow :: displaySettings()
+{
+ SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
+ if ( dlg->showDlg( 0 ) )
+ networkPkgWindow->updateData();
+ delete dlg;
+}
+
+void MainWindow :: displayHelp()
+{
+ HelpWindow *dlg = new HelpWindow( this );
+ dlg->exec();
+ delete dlg;
+}
+
+void MainWindow :: displayAbout()
+{
+
+}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
new file mode 100644
index 0000000..2a182fc
--- a/dev/null
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ mainwin.h - description
+ -------------------
+ begin : Mon Aug 26 13:32:30 BST 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 MAINWIN_H
+#define MAINWIN_H
+
+#include <qmainwindow.h>
+#include <qwidgetstack.h>
+
+
+class NetworkPackageManager;
+class DataManager;
+
+class MainWindow :public QMainWindow
+{
+ Q_OBJECT
+public:
+
+ MainWindow( QWidget *p = 0, char *name = 0 );
+ ~MainWindow();
+
+private:
+ DataManager *mgr;
+
+ QWidgetStack *stack;
+ NetworkPackageManager *networkPkgWindow;
+
+public slots:
+ void displayHelp();
+ void displayAbout();
+ void displaySettings();
+};
+#endif
diff --git a/noncore/settings/aqpkg/mem.cpp b/noncore/settings/aqpkg/mem.cpp
new file mode 100644
index 0000000..76ce35c
--- a/dev/null
+++ b/noncore/settings/aqpkg/mem.cpp
@@ -0,0 +1,105 @@
+/***************************************************************************
+ mem.h - description
+ -------------------
+ begin : Mon Aug 26 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 <stdio.h>
+#include <fstream>
+#include <list>
+using namespace std;
+
+#define __MEMFILE_C
+#include "global.h"
+
+#ifdef _DEBUG
+
+void __cdecl *operator new( unsigned int size, const char *file, int line )
+{
+ void *ptr = (void *)malloc(size);
+ AddTrack((long)ptr, size, file, line);
+ return(ptr);
+}
+
+void operator delete(void *p)
+{
+ RemoveTrack((long)p);
+ free(p);
+}
+
+#endif
+
+
+typedef struct {
+ long address;
+ long size;
+ char file[64];
+ long line;
+} ALLOC_INFO;
+
+typedef list<ALLOC_INFO*> AllocList;
+
+AllocList allocList;
+
+
+
+void AddTrack(long addr, long asize, const char *fname, long lnum)
+{
+ ALLOC_INFO *info;
+
+
+ info = (ALLOC_INFO *)malloc(sizeof( ALLOC_INFO ));
+ info->address = addr;
+ strncpy(info->file, fname, 63);
+ info->line = lnum;
+ info->size = asize;
+ allocList.insert(allocList.begin(), info);
+};
+
+void RemoveTrack(long addr)
+{
+ AllocList::iterator i;
+
+ bool found = false;
+ for(i = allocList.begin(); i != allocList.end(); i++)
+ {
+ if((*i)->address == addr)
+ {
+ allocList.remove((*i));
+ found = true;
+ break;
+ }
+ }
+}
+
+void DumpUnfreed()
+{
+ AllocList::iterator i;
+ long totalSize = 0;
+ char buf[1024];
+
+
+// if(!allocList)
+// return;
+
+ for(i = allocList.begin(); i != allocList.end(); i++) {
+ sprintf(buf, "%-15s: LINE %ld, ADDRESS %ld %ld unfreed",
+ (*i)->file, (*i)->line, (*i)->address, (*i)->size);
+ cout <<buf << endl;
+ totalSize += (*i)->size;
+ }
+ sprintf(buf, "-----------------------------------------------------------\n");
+ cout <<buf << endl;
+ sprintf(buf, "Total Unfreed: %ld bytes\n", totalSize);
+ cout <<buf << endl;
+};
diff --git a/noncore/settings/aqpkg/moc_aqpkg.cpp b/noncore/settings/aqpkg/moc_aqpkg.cpp
new file mode 100644
index 0000000..751d3a2
--- a/dev/null
+++ b/noncore/settings/aqpkg/moc_aqpkg.cpp
@@ -0,0 +1,95 @@
+/****************************************************************************
+** Aqpkg meta object code from reading C++ file 'aqpkg.h'
+**
+** Created: Thu Aug 29 13:01:06 2002
+** by: The Qt MOC ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#define Q_MOC_OUTPUT_REVISION 9
+#elif Q_MOC_OUTPUT_REVISION != 9
+#error "Moc format conflict - please regenerate all moc files"
+#endif
+
+#include "aqpkg.h"
+#include <qmetaobject.h>
+#include <qapplication.h>
+
+
+
+const char *Aqpkg::className() const
+{
+ return "Aqpkg";
+}
+
+QMetaObject *Aqpkg::metaObj = 0;
+
+void Aqpkg::initMetaObject()
+{
+ if ( metaObj )
+ return;
+ if ( qstrcmp(QWidget::className(), "QWidget") != 0 )
+ badSuperclassWarning("Aqpkg","QWidget");
+ (void) staticMetaObject();
+}
+
+#ifndef QT_NO_TRANSLATION
+
+QString Aqpkg::tr(const char* s)
+{
+ return qApp->translate( "Aqpkg", s, 0 );
+}
+
+QString Aqpkg::tr(const char* s, const char * c)
+{
+ return qApp->translate( "Aqpkg", s, c );
+}
+
+#endif // QT_NO_TRANSLATION
+
+QMetaObject* Aqpkg::staticMetaObject()
+{
+ if ( metaObj )
+ return metaObj;
+ (void) QWidget::staticMetaObject();
+#ifndef QT_NO_PROPERTIES
+#endif // QT_NO_PROPERTIES
+ typedef void (Aqpkg::*m1_t0)(int);
+ typedef void (QObject::*om1_t0)(int);
+ typedef void (Aqpkg::*m1_t1)();
+ typedef void (QObject::*om1_t1)();
+ typedef void (Aqpkg::*m1_t2)();
+ typedef void (QObject::*om1_t2)();
+ m1_t0 v1_0 = &Aqpkg::serverSelected;
+ om1_t0 ov1_0 = (om1_t0)v1_0;
+ m1_t1 v1_1 = &Aqpkg::applyChanges;
+ om1_t1 ov1_1 = (om1_t1)v1_1;
+ m1_t2 v1_2 = &Aqpkg::updateServer;
+ om1_t2 ov1_2 = (om1_t2)v1_2;
+ QMetaData *slot_tbl = QMetaObject::new_metadata(3);
+ QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(3);
+ slot_tbl[0].name = "serverSelected(int)";
+ slot_tbl[0].ptr = (QMember)ov1_0;
+ slot_tbl_access[0] = QMetaData::Public;
+ slot_tbl[1].name = "applyChanges()";
+ slot_tbl[1].ptr = (QMember)ov1_1;
+ slot_tbl_access[1] = QMetaData::Public;
+ slot_tbl[2].name = "updateServer()";
+ slot_tbl[2].ptr = (QMember)ov1_2;
+ slot_tbl_access[2] = QMetaData::Public;
+ metaObj = QMetaObject::new_metaobject(
+ "Aqpkg", "QWidget",
+ slot_tbl, 3,
+ 0, 0,
+#ifndef QT_NO_PROPERTIES
+ 0, 0,
+ 0, 0,
+#endif // QT_NO_PROPERTIES
+ 0, 0 );
+ metaObj->set_slot_access( slot_tbl_access );
+#ifndef QT_NO_PROPERTIES
+#endif // QT_NO_PROPERTIES
+ return metaObj;
+}
diff --git a/noncore/settings/aqpkg/moc_qinputdialog.cpp b/noncore/settings/aqpkg/moc_qinputdialog.cpp
new file mode 100644
index 0000000..ab98a7e
--- a/dev/null
+++ b/noncore/settings/aqpkg/moc_qinputdialog.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+** QInputDialog meta object code from reading C++ file 'qinputdialog.h'
+**
+** Created: Sun Sep 8 17:28:15 2002
+** by: The Qt MOC ($Id$)
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#if !defined(Q_MOC_OUTPUT_REVISION)
+#define Q_MOC_OUTPUT_REVISION 9
+#elif Q_MOC_OUTPUT_REVISION != 9
+#error "Moc format conflict - please regenerate all moc files"
+#endif
+
+#include "qinputdialog.h"
+#include <qmetaobject.h>
+#include <qapplication.h>
+
+
+
+const char *QInputDialog::className() const
+{
+ return "QInputDialog";
+}
+
+QMetaObject *QInputDialog::metaObj = 0;
+
+void QInputDialog::initMetaObject()
+{
+ if ( metaObj )
+ return;
+ if ( qstrcmp(QDialog::className(), "QDialog") != 0 )
+ badSuperclassWarning("QInputDialog","QDialog");
+ (void) staticMetaObject();
+}
+
+#ifndef QT_NO_TRANSLATION
+
+QString QInputDialog::tr(const char* s)
+{
+ return qApp->translate( "QInputDialog", s, 0 );
+}
+
+QString QInputDialog::tr(const char* s, const char * c)
+{
+ return qApp->translate( "QInputDialog", s, c );
+}
+
+#endif // QT_NO_TRANSLATION
+
+QMetaObject* QInputDialog::staticMetaObject()
+{
+ if ( metaObj )
+ return metaObj;
+ (void) QDialog::staticMetaObject();
+#ifndef QT_NO_PROPERTIES
+#endif // QT_NO_PROPERTIES
+ typedef void (QInputDialog::*m1_t0)(const QString&);
+ typedef void (QObject::*om1_t0)(const QString&);
+ typedef void (QInputDialog::*m1_t1)();
+ typedef void (QObject::*om1_t1)();
+ m1_t0 v1_0 = &QInputDialog::textChanged;
+ om1_t0 ov1_0 = (om1_t0)v1_0;
+ m1_t1 v1_1 = &QInputDialog::tryAccept;
+ om1_t1 ov1_1 = (om1_t1)v1_1;
+ QMetaData *slot_tbl = QMetaObject::new_metadata(2);
+ QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(2);
+ slot_tbl[0].name = "textChanged(const QString&)";
+ slot_tbl[0].ptr = (QMember)ov1_0;
+ slot_tbl_access[0] = QMetaData::Private;
+ slot_tbl[1].name = "tryAccept()";
+ slot_tbl[1].ptr = (QMember)ov1_1;
+ slot_tbl_access[1] = QMetaData::Private;
+ metaObj = QMetaObject::new_metaobject(
+ "QInputDialog", "QDialog",
+ slot_tbl, 2,
+ 0, 0,
+#ifndef QT_NO_PROPERTIES
+ 0, 0,
+ 0, 0,
+#endif // QT_NO_PROPERTIES
+ 0, 0 );
+ metaObj->set_slot_access( slot_tbl_access );
+#ifndef QT_NO_PROPERTIES
+#endif // QT_NO_PROPERTIES
+ return metaObj;
+}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
new file mode 100644
index 0000000..91a318c
--- a/dev/null
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -0,0 +1,395 @@
+/***************************************************************************
+ networkpkgmgr.cpp - description
+ -------------------
+ begin : Mon Aug 26 13:32:30 BST 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 <fstream>
+#include <iostream>
+using namespace std;
+
+#include <unistd.h>
+#include <stdlib.h>
+
+#ifdef QWS
+#include <qpe/qpeapplication.h>
+#include <qpe/qcopenvelope_qws.h>
+#include <qpe/config.h>
+#else
+#include <qapplication.h>
+#endif
+#include <qlabel.h>
+#include <qfile.h>
+
+#include "datamgr.h"
+#include "networkpkgmgr.h"
+#include "installdlgimpl.h"
+#include "ipkg.h"
+#include "inputdlg.h"
+
+#include "global.h"
+
+NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ dataMgr = dataManager;
+
+ initGui();
+ setupConnections();
+
+ progressDlg = 0;
+ timerId = startTimer( 100 );
+}
+
+NetworkPackageManager::~NetworkPackageManager()
+{
+}
+
+void NetworkPackageManager :: timerEvent ( QTimerEvent * )
+{
+ killTimer( timerId );
+
+// showProgressDialog();
+ // Add server names to listbox
+ updateData();
+
+// progressDlg->hide();
+}
+
+void NetworkPackageManager :: updateData()
+{
+ serversList->clear();
+ packagesList->clear();
+
+ vector<Server>::iterator it;
+ int activeItem = -1;
+ int i;
+ for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
+ {
+ serversList->insertItem( it->getServerName() );
+ if ( it->getServerName() == dataMgr->getActiveServer() )
+ activeItem = i;
+ }
+
+ // set selected server to be active server
+ if ( activeItem != -1 )
+ serversList->setCurrentItem( activeItem );
+ serverSelected( 0 );
+}
+
+
+void NetworkPackageManager :: initGui()
+{
+ QLabel *l = new QLabel( "Servers", this );
+ serversList = new QComboBox( this );
+ packagesList = new QListView( this );
+ update = new QPushButton( "Refresh List", this );
+ download = new QPushButton( "Download", this );
+ apply = new QPushButton( "Apply", this );
+
+ QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
+ QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
+ hbox1->addWidget( l );
+ hbox1->addWidget( serversList );
+
+ vbox->addWidget( packagesList );
+ packagesList->addColumn( "Packages" );
+
+ QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
+ hbox2->addWidget( update );
+ hbox2->addWidget( download );
+ hbox2->addWidget( apply );
+}
+
+void NetworkPackageManager :: setupConnections()
+{
+ connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
+ connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
+ connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
+ connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
+}
+
+void NetworkPackageManager :: showProgressDialog()
+{
+ if ( !progressDlg )
+ progressDlg = new ProgressDlg( this, "Progress", false );
+ progressDlg->setText( "Reading installed packages" );
+ progressDlg->show();
+}
+
+
+void NetworkPackageManager :: serverSelected( int )
+{
+ packagesList->clear();
+
+ // display packages
+ QString serverName = serversList->currentText();
+ Server *s = dataMgr->getServer( serverName );
+ dataMgr->setActiveServer( serverName );
+
+ vector<Package> &list = s->getPackageList();
+ vector<Package>::iterator it;
+ for ( it = list.begin() ; it != list.end() ; ++it )
+ {
+ QString text = "";
+
+ // If the local server, only display installed packages
+ if ( serverName == LOCAL_SERVER && !it->isInstalled() )
+ continue;
+
+ text += it->getPackageName();
+ if ( it->isInstalled() )
+ {
+ text += " (installed)";
+
+ // If a different version of package is available, postfix it with an *
+ if ( it->getVersion() != it->getInstalledVersion() )
+ text += "*";
+ }
+
+ QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
+ if ( !it->isPackageStoredLocally() )
+ new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
+ else
+ new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() );
+
+ new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
+ if ( it->getLocalPackage() )
+ {
+ if ( it->isInstalled() )
+ new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
+ }
+ packagesList->insertItem( item );
+ }
+
+ // If the local server or the local ipkgs server disable the download button
+ download->setText( "Download" );
+ if ( serverName == LOCAL_SERVER )
+ download->setEnabled( false );
+ else if ( serverName == LOCAL_IPKGS )
+ {
+ download->setEnabled( true );
+ download->setText( "Remove" );
+ }
+ else
+ download->setEnabled( true );
+}
+
+void NetworkPackageManager :: updateServer()
+{
+ QString serverName = serversList->currentText();
+
+ // Update the current server
+ // Display dialog
+ ProgressDlg *dlg = new ProgressDlg( this );
+ QString status = "Updating package list for ";
+ status += serverName;
+ dlg->show();
+ dlg->setText( status );
+
+ // Disable buttons to stop silly people clicking lots on them :)
+
+ // First, write out ipkg_conf file so that ipkg can use it
+ dataMgr->writeOutIpkgConf();
+
+ if ( serverName == LOCAL_SERVER )
+ ;
+ else if ( serverName == LOCAL_IPKGS )
+ ;
+ else
+ {
+ QString option = "update";
+ QString dummy = "";
+ Ipkg ipkg;
+ connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+ ipkg.setOption( option );
+
+ ipkg.runIpkg( );
+ }
+
+ // Reload data
+ dataMgr->reloadServerData( serversList->currentText() );
+ serverSelected(-1);
+ delete dlg;
+}
+
+
+void NetworkPackageManager :: downloadPackage()
+{
+ if ( download->text() == "Download" )
+ {
+ // First, write out ipkg_conf file so that ipkg can use it
+ dataMgr->writeOutIpkgConf();
+
+ // Display dialog to user asking where to download the files to
+ bool ok = FALSE;
+ QString dir = "";
+#ifdef QWS
+ // read download directory from config file
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
+#endif
+
+ QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
+ if ( ok && !text.isEmpty() )
+ dir = text; // user entered something and pressed ok
+ else
+ return; // user entered nothing or pressed cancel
+
+#ifdef QWS
+ // Store download directory in config file
+ cfg.writeEntry( "downloadDir", dir );
+#endif
+
+ // Get starting directory
+ char initDir[PATH_MAX];
+ getcwd( initDir, PATH_MAX );
+
+ // Download each package
+ Ipkg ipkg;
+ connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
+
+ QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+ ipkg.setOption( "download" );
+ ipkg.setRuntimeDirectory( initDir );
+ do
+ {
+ if ( item->isOn() )
+ {
+ QString name = item->text();
+ int pos = name.find( "*" );
+ name.truncate( pos );
+
+ // if (there is a (installed), remove it
+ pos = name.find( "(installed)" );
+ if ( pos > 0 )
+ name.truncate( pos - 1 );
+
+ ipkg.setPackage( name );
+ ipkg.runIpkg( );
+ }
+
+ item = (QCheckListItem *)item->nextSibling();
+ } while ( item );
+ }
+ else if ( download->text() == "Remove" )
+ {
+ QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+ do
+ {
+ if ( item->isOn() )
+ {
+ QString name = item->text();
+ int pos = name.find( "*" );
+ name.truncate( pos );
+
+ // if (there is a (installed), remove it
+ pos = name.find( "(installed)" );
+ if ( pos > 0 )
+ name.truncate( pos - 1 );
+
+ Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
+ QFile f( p->getFilename() );
+ f.remove();
+ }
+ item = (QCheckListItem *)item->nextSibling();
+ } while ( item );
+ }
+
+ dataMgr->reloadServerData( LOCAL_IPKGS );
+ serverSelected( -1 );
+}
+
+
+void NetworkPackageManager :: applyChanges()
+{
+ // Disable buttons to stop silly people clicking lots on them :)
+
+ // First, write out ipkg_conf file so that ipkg can use it
+ dataMgr->writeOutIpkgConf();
+
+ // Now for each selected item
+ // deal with it
+
+ vector<QString> workingPackages;
+ QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
+ do
+ {
+ if ( item->isOn() )
+ {
+ QString p = dealWithItem( item );
+ workingPackages.push_back( p );
+ }
+
+ item = (QCheckListItem *)item->nextSibling();
+ } while ( item );
+
+ // do the stuff
+ InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
+ dlg.showDlg();
+
+ // Reload data
+ dataMgr->reloadServerData( LOCAL_SERVER );
+ dataMgr->reloadServerData( serversList->currentText() );
+ serverSelected(-1);
+
+#ifdef QWS
+ // Finally let the main system update itself
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
+#endif
+}
+
+// decide what to do - either remove, upgrade or install
+// Current rules:
+// If not installed - install
+// If installed and different version available - upgrade
+// If installed and version up to date - remove
+QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
+{
+ QString name = item->text();
+ int pos = name.find( "*" );
+ name.truncate( pos );
+
+ // if (there is a (installed), remove it
+ pos = name.find( "(installed)" );
+ if ( pos > 0 )
+ name.truncate( pos - 1 );
+
+ // Get package
+ Server *s = dataMgr->getServer( serversList->currentText() );
+ Package *p = s->getPackage( name );
+
+ // If the package has a filename then it is a local file
+ if ( p->isPackageStoredLocally() )
+ name = p->getFilename();
+ QString option;
+ QString dest = "root";
+ if ( !p->isInstalled() )
+ return QString( "I" ) + name;
+ else
+ {
+ if ( p->getVersion() == p->getInstalledVersion() )
+ return QString( "D" ) + name;
+ else
+ return QString( "U" ) + name;
+ }
+}
+
+void NetworkPackageManager :: displayText( const QString &t )
+{
+ cout << t << endl;
+}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
new file mode 100644
index 0000000..874b1bd
--- a/dev/null
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ networkpkgmgr.h - description
+ -------------------
+ begin : Mon Aug 26 13:32:30 BST 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 NETWORKPKGMGR_H
+#define NETWORKPKGMGR_H
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qwidget.h>
+#include <qcombobox.h>
+#include <qlistview.h>
+
+#include "datamgr.h"
+#include "progressdlg.h"
+
+/** NetworkPackageManager is the base class of the project */
+class NetworkPackageManager : public QWidget
+{
+ Q_OBJECT
+public:
+ /** construtor */
+ NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0);
+ /** destructor */
+ ~NetworkPackageManager();
+
+ void updateData();
+
+private:
+ DataManager *dataMgr;
+
+ QComboBox *serversList;
+ QListView *packagesList;
+ QPushButton *update;
+ QPushButton *download;
+ QPushButton *apply;
+
+ ProgressDlg *progressDlg;
+
+ int timerId;
+
+ void timerEvent ( QTimerEvent * );
+
+ void initGui();
+ void setupConnections();
+ void showProgressDialog();
+ QString dealWithItem( QCheckListItem *item );
+
+public slots:
+ void serverSelected( int index );
+ void applyChanges();
+ void downloadPackage();
+ void updateServer();
+ void displayText( const QString &t );
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp
new file mode 100644
index 0000000..48b6934
--- a/dev/null
+++ b/noncore/settings/aqpkg/package.cpp
@@ -0,0 +1,109 @@
+/***************************************************************************
+ package.cpp - description
+ -------------------
+ begin : Mon Aug 26 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 "package.h"
+#include "global.h"
+
+Package::Package( QString &name )
+{
+ packageName = name;
+ localPackage = 0;
+ installed = false;
+ packageStoredLocally = false;
+ installedToRoot = false;
+}
+
+Package::Package( char *name )
+{
+ packageName = name;
+ localPackage = 0;
+}
+
+Package::~Package()
+{
+}
+
+QString Package :: toString()
+{
+ QString ret = "Package - " + getPackageName() +
+ "\n version - " + getVersion();
+
+ if ( localPackage )
+ ret += "\n inst version - " + localPackage->getVersion();
+
+
+ return ret;
+}
+
+void Package :: setStatus( QString &s )
+{
+ status = s;
+
+ if ( status.find( "installed" ) != -1 )
+ installed = true;
+}
+
+void Package :: setLocalPackage( Package *p )
+{
+ localPackage = p;
+
+ if ( localPackage )
+ if ( localPackage->getVersion() != getVersion() )
+ differentVersionAvailable = true;
+ else
+ differentVersionAvailable = false;
+}
+
+void Package :: setVersion( QString &v )
+{
+ version = v;
+
+ if ( localPackage )
+ if ( localPackage->getVersion() != getVersion() )
+ differentVersionAvailable = true;
+ else
+ differentVersionAvailable = false;
+}
+
+void Package :: setPackageName( QString &name )
+{
+ packageName = name;
+}
+
+void Package :: setDescription( QString &d )
+{
+ description = d;
+}
+
+void Package :: setFilename( QString &f )
+{
+ filename = f;
+}
+
+
+QString Package :: getInstalledVersion()
+{
+ if ( localPackage )
+ return localPackage->getVersion();
+ else
+ return getVersion();
+}
+
+bool Package :: isInstalled()
+{
+ return installed || ( localPackage && localPackage->isInstalled() );
+}
diff --git a/noncore/settings/aqpkg/package.h b/noncore/settings/aqpkg/package.h
new file mode 100644
index 0000000..d885ab6
--- a/dev/null
+++ b/noncore/settings/aqpkg/package.h
@@ -0,0 +1,75 @@
+/***************************************************************************
+ package.h - description
+ -------------------
+ begin : Mon Aug 26 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 PACKAGE_H
+#define PACKAGE_H
+
+#include <stdlib.h>
+
+/**
+ *@author Andy Qua
+ */
+
+#include <qstring.h>
+
+class Package
+{
+public:
+ Package( QString &name );
+ Package( char *name );
+ ~Package();
+
+ void setLocalPackage( Package *p );
+ void setPackageName( QString &name );
+ void setVersion( QString &v );
+ void setStatus( QString &s );
+ void setDescription( QString &d );
+ void setFilename( QString &f );
+ void setPackageStoredLocally( bool local ) { packageStoredLocally = local; }
+ void setInstalledToRoot( bool root ) { installedToRoot = root; }
+
+ Package *getLocalPackage() { return localPackage; }
+ QString getPackageName() { return packageName; }
+ QString getVersion() { return version; }
+ QString getStatus() { return status; }
+ QString getDescription() { return description; }
+ QString getFilename() { return filename; }
+
+ bool isInstalled();
+ bool isPackageStoredLocally() { return packageStoredLocally; }
+ bool isInstalledToRoot() { return installedToRoot; }
+ QString getInstalledVersion();
+
+ QString toString();
+
+
+private:
+ Package *localPackage;
+
+ QString packageName;
+ QString version;
+ QString status;
+ QString description;
+ QString filename;
+ QString installedTo;
+ bool packageStoredLocally;
+ bool installedToRoot;
+ bool installed;
+ bool differentVersionAvailable;
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/progressdlg.cpp b/noncore/settings/aqpkg/progressdlg.cpp
new file mode 100644
index 0000000..3fa4367
--- a/dev/null
+++ b/noncore/settings/aqpkg/progressdlg.cpp
@@ -0,0 +1,65 @@
+/***************************************************************************
+ progressdlg.h - description
+ -------------------
+ begin : Mon Aug 26 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 "progressdlg.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include "global.h"
+/*
+ * Constructs a ProgressDlg which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+ProgressDlg::ProgressDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ if ( !name )
+ setName( "ProgressDlg" );
+ resize( 240, 73 );
+ setCaption( tr( "Progress" ) );
+
+ TextLabel2 = new QLabel( this, "TextLabel2" );
+ TextLabel2->setGeometry( QRect( 10, 10, 240, 50 ) );
+ TextLabel2->setFrameShape( QLabel::Box );
+ TextLabel2->setText( tr( "Text" ) );
+ TextLabel2->setAlignment( QLabel::WordBreak | QLabel::AlignHCenter | QLabel::AlignVCenter );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+ProgressDlg::~ProgressDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void ProgressDlg :: setText( QString &text )
+{
+ TextLabel2->setText( text );
+}
+
+void ProgressDlg :: setText( const char *text )
+{
+ TextLabel2->setText( text );
+}
diff --git a/noncore/settings/aqpkg/progressdlg.h b/noncore/settings/aqpkg/progressdlg.h
new file mode 100644
index 0000000..3e83455
--- a/dev/null
+++ b/noncore/settings/aqpkg/progressdlg.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ progressdlg.h - description
+ -------------------
+ begin : Mon Aug 26 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 PROGRESSDLG_H
+#define PROGRESSDLG_H
+
+#include <qdialog.h>
+
+class QLabel;
+
+class ProgressDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ProgressDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~ProgressDlg();
+
+ QLabel* TextLabel2;
+
+ void setText( QString &text );
+ void setText( const char *text );
+};
+
+#endif // PROGRESSDLG_H
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
new file mode 100644
index 0000000..0069a60
--- a/dev/null
+++ b/noncore/settings/aqpkg/server.cpp
@@ -0,0 +1,266 @@
+/***************************************************************************
+ server.cpp - description
+ -------------------
+ begin : Mon Aug 26 2002
+ copyright : (C) 2002 by Andy Qua
+ email : andy.qua@blueyonder.co.uk
+ description : This class holds details about a server
+ : e.g. all the packages that contained on the server
+ : the installation status
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <iostream>
+#include <fstream>
+using namespace std;
+
+#include "server.h"
+
+#ifdef QWS
+#include <qpe/global.h>
+#include <qpe/applnk.h>
+#include <qlist.h>
+#endif
+
+#include "utils.h"
+
+#include "global.h"
+
+Server :: Server( const char *name, const char *url )
+{
+ serverName = name;
+ serverUrl = url;
+ packageFile = IPKG_DIR;
+ packageFile += "lists/" + serverName;
+}
+
+Server :: ~Server()
+{
+ cleanUp();
+}
+
+void Server :: cleanUp()
+{
+ packageList.clear();
+}
+
+void Server :: readStatusFile( vector<Destination> &destList )
+{
+ cleanUp();
+
+ vector<Destination>::iterator dit;
+ bool rootRead = false;
+ for ( dit = destList.begin() ; dit != destList.end() ; ++dit )
+ {
+ bool installingToRoot = false;
+
+ QString path = dit->getDestinationPath();
+ if ( path.right( 1 ) != "/" )
+ path += "/";
+
+ if ( path == "/" )
+ {
+ rootRead = true;
+ installingToRoot = true;
+ }
+
+ packageFile = path + "usr/lib/ipkg/status";
+ readPackageFile( 0, false, installingToRoot );
+ }
+
+ // Ensure that the root status file is read
+ if ( !rootRead )
+ {
+ cout << "Reading status file " << "/usr/lib/ipkg/status" << endl;
+ packageFile = "/usr/lib/ipkg/status";
+ readPackageFile( 0, false, true );
+ }
+}
+
+void Server :: readLocalIpks( Server *local )
+{
+ cleanUp();
+
+#ifdef QWS
+ // First, get any local IPKGs in the documents area
+ // Only applicable to Qtopie/Opie
+
+ DocLnkSet files;
+ Global::findDocuments( &files, "application/ipkg" );
+
+ // Now add the items to the list
+ QListIterator<DocLnk> it( files.children() );
+
+ for ( ; it.current() ; ++it )
+ {
+ // OK, we have a local IPK file, I think the standard naming conventions
+ // for these are packagename_version_arm.ipk
+ QString file = (*it)->file();
+
+ QString packageName = Utils::getPackageNameFromIpkFilename( file );
+ QString ver = Utils::getPackageVersionFromIpkFilename( file );
+ packageList.push_back( Package( packageName ) );
+ packageList.back().setVersion( ver );
+ packageList.back().setFilename( file );
+ packageList.back().setPackageStoredLocally( true );
+
+ }
+#else
+ QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" };
+ for ( int i = 0 ; i < 4 ; ++i )
+ {
+ // OK, we have a local IPK file, I think the standard naming conventions
+ // for these are packagename_version_arm.ipk
+ QString file = names[i];
+ int p = file.find( "_" );
+ QString tmp = file.mid( 0, p );
+ packageList.push_back( Package( tmp ) );
+ int p2 = file.find( "_", p+1 );
+ tmp = file.mid( p+1, p2-(p+1) );
+ packageList.back().setVersion( tmp );
+ packageList.back().setPackageStoredLocally( true );
+ }
+#endif
+
+ // build local packages
+ buildLocalPackages( local );
+}
+
+void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot )
+{
+ ifstream in( packageFile );
+ if ( !in.is_open() )
+ return;
+
+ char line[1001];
+ char k[21];
+ char v[1001];
+ QString key;
+ QString value;
+
+ if ( clearAll )
+ cleanUp();
+ Package *currPackage = 0;
+
+ bool newPackage = true;
+ do
+ {
+ in.getline( line, 1000 );
+ if ( in.eof() )
+ continue;
+
+ k[0] = '\0';
+ v[0] = '\0';
+
+ sscanf( line, "%[^:]: %[^\n]", k, v );
+ key = k;
+ value = v;
+ key.stripWhiteSpace();
+ if ( key == "Package" && newPackage )
+ {
+ newPackage = false;
+
+ currPackage = getPackage( value );
+ if ( !currPackage )
+ {
+ packageList.push_back( Package( value ) );
+ currPackage = &(packageList.back());
+
+ if ( installingToRoot )
+ currPackage->setInstalledToRoot( true );
+ }
+ }
+ else if ( key == "Version" )
+ {
+ if ( currPackage )
+ currPackage->setVersion( value );
+ }
+ else if ( key == "Status" )
+ {
+ if ( currPackage )
+ currPackage->setStatus( value );
+ }
+ else if ( key == "Description" )
+ {
+ if ( currPackage )
+ currPackage->setDescription( value );
+ }
+ else if ( key == "Filename" )
+ {
+ if ( currPackage )
+ currPackage->setFilename( value );
+ }
+ else if ( key == "" )
+ {
+ newPackage = true;
+ }
+ } while ( !in.eof() );
+
+ in.close();
+
+ // build local packages
+ buildLocalPackages( local );
+}
+
+void Server :: buildLocalPackages( Server *local )
+{
+ for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
+ {
+ QString name = packageList[i].getPackageName();
+ if ( local )
+ packageList[i].setLocalPackage( local->getPackage( name ) );
+ else
+ packageList[i].setLocalPackage( 0 );
+ }
+
+}
+
+Package *Server :: getPackage( QString &name )
+{
+ return getPackage( (const char *)name );
+}
+
+Package *Server :: getPackage( const char *name )
+{
+ Package *ret = 0;
+
+ for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i )
+ {
+ if ( packageList[i].getPackageName() == name )
+ ret = &packageList[i];
+ }
+
+ return ret;
+}
+
+QString Server :: toString()
+{
+ QString ret = "Server\n name - " + serverName +
+ "\n url - " + serverUrl +
+ "\n";
+
+ for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
+ ret += "\n " + packageList[i].toString();
+
+
+ return ret;
+}
+
+vector<Package> &Server::getPackageList()
+{
+ return packageList;
+}
+
diff --git a/noncore/settings/aqpkg/server.h b/noncore/settings/aqpkg/server.h
new file mode 100644
index 0000000..8f8d384
--- a/dev/null
+++ b/noncore/settings/aqpkg/server.h
@@ -0,0 +1,63 @@
+/***************************************************************************
+ server.h - description
+ -------------------
+ begin : Mon Aug 26 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 SERVER_H
+#define SERVER_H
+
+#include <qstring.h>
+
+#include <vector>
+using namespace std;
+
+#include "package.h"
+#include "destination.h"
+
+class Server
+{
+public:
+ Server() {}
+ Server( const char *name, const char *url );
+ Server( const char *name, const char *url, const char *file );
+ ~Server();
+
+ void cleanUp();
+
+ void readStatusFile( vector<Destination> &v );
+ void readLocalIpks( Server *local );
+ void readPackageFile( Server *local = 0, bool clearAll = true, bool installedToRoot= false );
+ void buildLocalPackages( Server *local );
+ Package *getPackage( const char *name );
+ Package *getPackage( QString &name );
+ QString toString();
+ vector<Package> &getPackageList();
+
+ void setServerName( const QString &name ) { serverName = name; }
+ void setServerUrl( const QString &url ) { serverUrl = url; }
+ QString &getServerName() { return serverName; }
+ QString &getServerUrl() { return serverUrl; }
+
+protected:
+
+private:
+ QString serverName;
+ QString serverUrl;
+ QString packageFile;
+
+
+ vector<Package> packageList;
+};
+
+#endif
diff --git a/noncore/settings/aqpkg/settings.ui b/noncore/settings/aqpkg/settings.ui
new file mode 100644
index 0000000..eb99cf7
--- a/dev/null
+++ b/noncore/settings/aqpkg/settings.ui
@@ -0,0 +1,531 @@
+<!DOCTYPE UI><UI>
+<class>SettingsBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Settings</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>331</width>
+ <height>456</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Package Servers</string>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </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>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TabWidget</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Servers</string>
+ </attribute>
+ <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" rowspan="1" colspan="2" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout2</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Servers</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Servers</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget row="1" column="0" rowspan="1" colspan="2" >
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>servers</cstring>
+ </property>
+ <property stdset="1">
+ <name>selectionMode</name>
+ <enum>Extended</enum>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removeserver</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remove</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>newserver</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>New</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="3" column="0" rowspan="1" colspan="2" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout10</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="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>serverurl</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>URL:</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>servername</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnChangeServer</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Change</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Destinations</string>
+ </attribute>
+ <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>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout3</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Destinations</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Destinations</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>newdestination</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>New</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removedestination</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remove</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="0" column="0" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="1" column="0" >
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinations</cstring>
+ </property>
+ <property stdset="1">
+ <name>selectionMode</name>
+ <enum>Single</enum>
+ </property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout8</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>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinationname</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinationurl</cstring>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnChangeDest</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Change</string>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_3_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_3_2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>URL:</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>newserver</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>newServer()</slot>
+ </connection>
+ <connection>
+ <sender>removeserver</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>removeServer()</slot>
+ </connection>
+ <connection>
+ <sender>newdestination</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>newDestination()</slot>
+ </connection>
+ <connection>
+ <sender>removedestination</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>removeDestination()</slot>
+ </connection>
+ <connection>
+ <sender>servers</sender>
+ <signal>highlighted(int)</signal>
+ <receiver>Settings</receiver>
+ <slot>editServer(int)</slot>
+ </connection>
+ <connection>
+ <sender>destinations</sender>
+ <signal>highlighted(int)</signal>
+ <receiver>Settings</receiver>
+ <slot>editDestination(int)</slot>
+ </connection>
+ <connection>
+ <sender>btnChangeServer</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>changeServerDetails()</slot>
+ </connection>
+ <connection>
+ <sender>btnChangeDest</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>changeDestinationDetails()</slot>
+ </connection>
+ <slot access="public">activeServerChanged()</slot>
+ <slot access="public">changeServerDetails()</slot>
+ <slot access="public">createLinksToDest()</slot>
+ <slot access="public">destNameChanged(const QString&amp;)</slot>
+ <slot access="public">destUrlChanged(const QString&amp;)</slot>
+ <slot access="public">editDestination(int)</slot>
+ <slot access="public">editServer(int)</slot>
+ <slot access="public">installationSettingChange(int)</slot>
+ <slot access="public">installationSettingSetName(const QString &amp;)</slot>
+ <slot access="public">linkEnabled(bool)</slot>
+ <slot access="public">newDestination()</slot>
+ <slot access="public">newInstallationSetting()</slot>
+ <slot access="public">newServer()</slot>
+ <slot access="public">changeDestinationDetails()</slot>
+ <slot access="public">removeDestination()</slot>
+ <slot access="public">removeInstallationSetting()</slot>
+ <slot access="public">removeLinksToDest()</slot>
+ <slot access="public">removeServer()</slot>
+ <slot access="public">renameInstallationSetting()</slot>
+ <slot access="public">serverNameChanged(const QString&amp;)</slot>
+ <slot access="public">serverUrlChanged(const QString&amp;)</slot>
+</connections>
+</UI>
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
new file mode 100644
index 0000000..81e89ed
--- a/dev/null
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -0,0 +1,195 @@
+/***************************************************************************
+ settingsimpl.cpp - description
+ -------------------
+ begin : Thu Aug 29 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 <fstream>
+using namespace std;
+
+#include <qlistbox.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+
+#include "settingsimpl.h"
+
+#include "global.h"
+
+SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
+ : SettingsBase( parent, name, modal, fl )
+{
+ dataMgr = dataManager;
+
+ setupData();
+ changed = false;
+ newserver = false;
+ newdestination = false;
+}
+
+SettingsImpl :: ~SettingsImpl()
+{
+
+}
+
+bool SettingsImpl :: showDlg( int i )
+{
+ TabWidget->setCurrentPage( i );
+ showMaximized();
+ exec();
+
+ if ( changed )
+ dataMgr->writeOutIpkgConf();
+
+ return changed;
+}
+
+void SettingsImpl :: setupData()
+{
+ // add servers
+ vector<Server>::iterator it;
+ for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it )
+ {
+ if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS )
+ continue;
+
+ servers->insertItem( it->getServerName() );
+ }
+
+ // add destinations
+ vector<Destination>::iterator it2;
+ for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 )
+ destinations->insertItem( it2->getDestinationName() );
+
+}
+
+//------------------ Servers tab ----------------------
+
+void SettingsImpl :: editServer( int sel )
+{
+ currentSelectedServer = sel;
+ Server *s = dataMgr->getServer( servers->currentText() );
+ serverName = s->getServerName();
+ servername->setText( s->getServerName() );
+ serverurl->setText( s->getServerUrl() );
+}
+
+void SettingsImpl :: newServer()
+{
+ newserver = true;
+ servername->setText( "" );
+ serverurl->setText( "" );
+ servername->setFocus();
+}
+
+void SettingsImpl :: removeServer()
+{
+ changed = true;
+ Server *s = dataMgr->getServer( servers->currentText() );
+ dataMgr->getServerList().erase( s );
+ servers->removeItem( currentSelectedServer );
+}
+
+void SettingsImpl :: changeServerDetails()
+{
+ changed = true;
+
+ QString newName = servername->text();
+ if ( !newserver )
+ {
+ Server *s = dataMgr->getServer( serverName );
+
+ // Update url
+ s->setServerUrl( serverurl->text() );
+
+ // Check if server name has changed, if it has then we need to replace the key in the map
+ if ( serverName != newName )
+ {
+ // Update server name
+ s->setServerName( newName );
+
+ // See if this server is the active server
+ if ( dataMgr->getActiveServer() == serverName )
+ dataMgr->setActiveServer( newName );
+
+ // Update list box
+ servers->changeItem( newName, currentSelectedServer );
+ }
+ }
+ else
+ {
+ dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) );
+ servers->insertItem( newName );
+ servers->setCurrentItem( servers->count() );
+ newserver = false;
+ }
+}
+
+//------------------ Destinations tab ----------------------
+
+void SettingsImpl :: editDestination( int sel )
+{
+ currentSelectedDestination = sel;
+ Destination *s = dataMgr->getDestination( destinations->currentText() );
+ destinationName = s->getDestinationName();
+ destinationname->setText( s->getDestinationName() );
+ destinationurl->setText( s->getDestinationPath() );
+}
+
+void SettingsImpl :: newDestination()
+{
+ newdestination = true;
+ destinationname->setText( "" );
+ destinationurl->setText( "" );
+ destinationname->setFocus();
+}
+
+void SettingsImpl :: removeDestination()
+{
+ changed = true;
+ Destination *d = dataMgr->getDestination( destinations->currentText() );
+ dataMgr->getDestinationList().erase( d );
+ destinations->removeItem( currentSelectedDestination );
+}
+
+void SettingsImpl :: changeDestinationDetails()
+{
+ changed = true;
+
+ QString newName = destinationname->text();
+ if ( !newdestination )
+ {
+ Destination *d = dataMgr->getDestination( destinationName );
+
+ // Update url
+ d->setDestinationPath( destinationurl->text() );
+
+ // Check if server name has changed, if it has then we need to replace the key in the map
+ if ( destinationName != newName )
+ {
+ // Update server name
+ d->setDestinationName( newName );
+
+ // Update list box
+ destinations->changeItem( newName, currentSelectedDestination );
+ }
+ }
+ else
+ {
+ dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );
+ destinations->insertItem( newName );
+ destinations->setCurrentItem( destinations->count() );
+ newdestination = false;
+ }
+}
diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h
new file mode 100644
index 0000000..bc231a1
--- a/dev/null
+++ b/noncore/settings/aqpkg/settingsimpl.h
@@ -0,0 +1,52 @@
+/***************************************************************************
+ settingsimpl.h - description
+ -------------------
+ begin : Thu Aug 29 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 "settings.h"
+
+#include "datamgr.h"
+
+class SettingsImpl : public SettingsBase
+{
+public:
+ SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~SettingsImpl();
+
+ bool showDlg( int i );
+
+private:
+ DataManager *dataMgr;
+ QString serverName;
+ QString destinationName;
+ int currentSelectedServer;
+ int currentSelectedDestination;
+ bool changed;
+ bool newserver;
+ bool newdestination;
+
+ void setupConnections();
+ void setupData();
+
+ void editServer( int s );
+ void changeServerDetails();
+ void newServer();
+ void removeServer();
+
+ void editDestination( int s );
+ void changeDestinationDetails();
+ void newDestination();
+ void removeDestination();
+};
diff --git a/noncore/settings/aqpkg/utils.cpp b/noncore/settings/aqpkg/utils.cpp
new file mode 100644
index 0000000..77d82d4
--- a/dev/null
+++ b/noncore/settings/aqpkg/utils.cpp
@@ -0,0 +1,74 @@
+/***************************************************************************
+ utils.cpp - description
+ -------------------
+ begin : Sat Sep 7 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 "utils.h"
+#include "global.h"
+
+Utils :: Utils()
+{
+}
+
+Utils :: ~Utils()
+{
+}
+
+
+QString Utils :: getPathfromIpkFilename( const QString &file )
+{
+ int p = file.findRev( "/" );
+ QString path = "";
+ if ( p != -1 )
+ path = file.left( p );
+
+ return path;
+
+}
+
+QString Utils :: getFilenameFromIpkFilename( const QString &file )
+{
+ int p = file.findRev( "/" );
+ QString name = file;
+ if ( p != -1 )
+ name = name.mid( p + 1 );
+
+
+ return name;
+}
+
+QString Utils :: getPackageNameFromIpkFilename( const QString &file )
+{
+ int p = file.findRev( "/" );
+ QString name = file;
+ if ( p != -1 )
+ name = name.mid( p + 1 );
+ p = name.find( "_" );
+ QString packageName = name.mid( 0, p );
+ return packageName;
+}
+
+QString Utils :: getPackageVersionFromIpkFilename( const QString &file )
+{
+ int p = file.findRev( "/" );
+ QString name = file;
+ if ( p != -1 )
+ name = name.mid( p + 1 );
+ p = name.find( "_" ) + 1;
+ int p2 = name.find( "_", p );
+ QString version = name.mid( p, p2 - p );
+ return version;
+}
+
diff --git a/noncore/settings/aqpkg/utils.h b/noncore/settings/aqpkg/utils.h
new file mode 100644
index 0000000..15ee4e6
--- a/dev/null
+++ b/noncore/settings/aqpkg/utils.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ utils.h - description
+ -------------------
+ begin : Sat Sep 7 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 UTILS_H
+#define UTILS_H
+
+#include <qstring.h>
+
+/**
+ *@author Andy Qua
+ */
+
+class Utils {
+public:
+ Utils();
+ ~Utils();
+
+ static QString getPathfromIpkFilename( const QString &file );
+ static QString getFilenameFromIpkFilename( const QString &file );
+ static QString getPackageNameFromIpkFilename( const QString &file );
+ static QString getPackageVersionFromIpkFilename( const QString &file );
+};
+
+#endif