Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

opackagemanager.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C)2004, 2005 Dan Williams <drw@handhelds.org>
00005               =.
00006             .=l.
00007            .>+-=
00008  _;:,     .>    :=|.         This program is free software; you can
00009 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00010 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00011 .="- .-=="i,     .._         License as published by the Free Software
00012  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00013      ._= =}       :          or (at your option) any later version.
00014     .%`+i>       _;_.
00015     .i_,=:_.      -<s.       This program is distributed in the hope that
00016      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00017     : ..    .:,     . . .    without even the implied warranty of
00018     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00019   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00020 ..}^=.=       =       ;      Library General Public License for more
00021 ++=   -.     .`     .:       details.
00022 :     =  ...= . :.=-
00023  -.   .:....=;==+<;          You should have received a copy of the GNU
00024   -_. . .   )=.  =           Library General Public License along with
00025     --        :-=`           this library; see the file COPYING.LIB.
00026                              If not, write to the Free Software Foundation,
00027                              Inc., 59 Temple Place - Suite 330,
00028                              Boston, MA 02111-1307, USA.
00029 */
00030 
00031 #ifndef OPACKAGEMANAGER_H
00032 #define OPACKAGEMANAGER_H
00033 
00034 #include "oipkg.h"
00035 
00036 #include <qpe/config.h>
00037 
00038 #include <qdict.h>
00039 #include <qobject.h>
00040 #include <qstringlist.h>
00041 
00042 class OPackageManager : public QObject
00043 {
00044     Q_OBJECT
00045 
00046 public:
00047     OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 );
00048 
00049     void loadAvailablePackages();
00050     void loadInstalledPackages();
00051 
00052     enum Status { All, NotInstalled, Installed, Updated, NotDefined };
00053 
00054     OPackageList *packages();
00055     OPackageList *filterPackages( const QString &name = QString::null,
00056                                   const QString &server = QString::null,
00057                                   const QString &destination = QString::null,
00058                                   Status status = NotDefined,
00059                                   const QString &category = QString::null );
00060 
00061     const QStringList &categories() { return m_categories; }
00062     QStringList        servers();
00063     QStringList        destinations();
00064 
00065     int compareVersions( const QString &version1, const QString &version2 );
00066 
00067     OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
00068                              const QString &name = QString::null );
00069     OPackage  *findPackage( const QString &name = QString::null );
00070 
00071     bool configureDlg( bool installOptions = false );
00072     void saveSettings();
00073 
00074     bool executeCommand( OPackage::Command command = OPackage::NotDefined,
00075                          const QStringList &parameters = QStringList(),
00076                          const QString &destination = QString::null, const QObject *receiver = 0x0,
00077                          const char *slotOutput = 0x0, bool rawOutput = true );
00078 
00079 private:
00080     Config         *m_config;     // Pointer to application configuration file
00081     OIpkg           m_ipkg;       // OIpkg object to retrieve package/configuration information
00082     QDict<OPackage> m_packages;   // Global list of available packages
00083     QStringList     m_categories; // List of all categories
00084 
00085     void parseVersion( const QString &verstr, int *epoch, QString *version, QString *revision );
00086     int verrevcmp( const char *val, const char *ref );
00087 
00088 signals:
00089     void initStatus( int numSteps );
00090     void statusText( const QString &status );
00091     void statusBar( int currStep );
00092 };
00093 
00094 #endif

Generated on Sat Nov 5 16:17:57 2005 for OPIE by  doxygen 1.4.2