SVN_SILENT made messages (.desktop file)
[kdeadmin.git] / kpackage / pkgInterface.h
blob949ea7d591c1ee03200e941e892ac9ca522ad050
1 /*
2 ** Copyright (C) 1999,2000 Toivo Pedaste <toivo@ucs.uwa.edu.au>
3 **
4 */
6 /*
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program in a file called COPYING; if not, write to
19 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 ** MA 02110-1301, USA.
24 ** Bug reports and questions can be sent to kde-devel@kde.org
28 #ifndef PKGINTERFACE_H
29 #define PKGINTERFACE_H
31 #include <QtCore/QList>
33 #include <QtCore/QStringList>
34 //Added by qt3to4:
35 #include <QtGui/QPixmap>
37 #include <kglobal.h>
38 #include <kstandarddirs.h>
40 #include "packageInfo.h"
41 #include "procbuf.h"
42 #include "managementWidget.h"
44 class packageInfo;
45 class pkgOptions;
46 class Locations;
47 class LcacheObj;
48 class cacheObj;
49 class KActionCollection;
50 //////////////////////////////////////////////////////////////////////////////
51 //////////////////////////////////////////////////////////////////////////////
53 // flags to install and uninstall
54 class param
56 public:
57 param(const QString &nameP, bool initP, bool invertP, const QString &flagP);
58 param(const QString &nameP, bool initP, bool invertP, const QString &flagP, const QString &flagAP);
59 ~param();
61 QString name; // Name of flag
62 bool init; // Initial value
63 bool invert; // Whether it needs to be inverted
64 QString flag; // text flag on command
65 QString flagA; // text flag on command
68 //////////////////////////////////////////////////////////////////////////////
69 //////////////////////////////////////////////////////////////////////////////
70 class pkgInterface: public QObject
72 Q_OBJECT
74 public:
75 pkgInterface();
76 ~pkgInterface();
78 virtual void makeMenu(KActionCollection* act);
79 virtual void setMenu(KActionCollection* act, bool enable);
81 bool ifExe(QString exe);
82 // Check if this executable exists
84 virtual packageInfo *getPackageInfo(const QString &name) ;
85 // get info on installed package
87 virtual void getFileList(packageInfo *p);
88 // get list of files in the package
90 virtual void getIFileList(packageInfo *p);
91 // get list of files in installed package
93 virtual void getFFileList(packageInfo *p);
94 // get list of files in package file
96 QStringList depends(const QString &name, int src);
97 // check dependencies for package
99 QStringList verify(packageInfo *p, const QStringList &files);
100 // check the installed files in a package
102 virtual QStringList FindFile(const QString &name, bool seachAll=false);
103 // search for packages containing a file
105 virtual QStringList getChangeLog(packageInfo *p);
106 // Get change log
108 virtual bool filesTab(packageInfo *p);
109 // If files tab is to be enabled
111 bool depTab(packageInfo *p) ;
112 // If dependency tab is to be enabled
114 virtual bool changeTab(packageInfo *p);
115 // If change log tab is to be enabled
117 bool parseName(const QString &name, QString *n, QString *v);
118 // breakup file name into package name and version
120 void listPackages(QList<packageInfo *> &pki);
121 // scan various locations for list of packages
123 void listRemotePackages(QList<packageInfo *> &pki);
125 void listPackagesFile(QList<packageInfo *> &pki);
127 QStringList getPackageState( const QStringList &packages);
128 // update installed/uninstalled state of packages
130 void getPackageDepends(packageInfo *p);
131 // Get package depends info
133 virtual packageInfo *getFPackageInfo(const QString &name);
134 // Get package Info from file
136 void listInstalledPackages(QList<packageInfo *> &pki);
137 // produce list of currently installed packages
139 QStringList listInstalls(const QStringList &packs, bool install, bool &cancel);
140 // Convert list of packages requested to install to list of all packages to install
142 void smerge(packageInfo *p);
143 // merge in package info entry
145 packageInfo *collectPath(const QString &name);
148 packageInfo *collectDir(const QString &name, const QString &size, const QString &dir);
149 // build packageInfo object from directory entry
151 QString provMap(const QString &p);
152 // convert from package depends to package
154 QString setOptions(int flags, QList<param *> &params);
155 // convert un/install flags to text
157 packageInfo* collectInfo(QStringList &ln, pkgInterface *pkgInt = 0);
158 // Parse package info
160 QString doUninstall(int uninstallFlags, const QString &packs, bool &test);
161 QString doInstall(int installFlags, const QString &packs, bool &test);
163 void removeLastEmpty(QStringList &list);
165 QString uninstall(int uninstallFlags, QList<packageInfo *> p,
166 bool &test);
167 QString uninstall(int uninstallFlags, packageInfo *p,
168 bool &test);
170 QString install(int installFlags, QList<packageInfo *> p,
171 bool &test);
172 QString install(int installFlags, packageInfo *p,
173 bool &test);
175 QString getDelimiter(short ptype);
176 // return name version delimiter character
178 ///////////// DATA ///////////////////////
180 pkgOptions *uninstallation, *installation;
182 QAction *updateM, *upgradeM, *fixupM, *fileM;
184 QString icon;
185 // name icon file
186 QPixmap pict, bad_pict, new_pict, updated_pict;
187 // icons for package states
188 QPixmap folder;
189 // icon for package group
190 QPixmap markInst;
191 QPixmap markUnInst;
192 // icon indicating mark for install/uninstall
194 Locations *locatedialog;
195 // dialog for setting the locations of uninstalled packages
196 LcacheObj *packageLoc;
197 // List of locations of uninstalled pacckages
199 bool dirOK;
200 // variables related to reading packages from directories
202 QString packagePattern;
203 QString queryMsg;
204 // Parameters for reading packages from directories
206 QList<param *> paramsInst;
207 QList<param *> paramsUninst;
209 QRegExp pFile, deb, rpm, slack, fin;
210 // Regular expressions that match package names
212 bool noFetch;
213 // kpackage doesn't fetch this type of package itself
215 bool defaultHandle;
216 // This package type defaults to on
218 QString errExe;
219 // The name of an executable that wasn't found
221 procbuf reader;
222 QString procMsg;
223 // for running processes
225 QString DELMSG;
227 bool hasRemote;
228 // can access on remote host
230 bool hasSearchAll;
231 // can search uninstalled packages for files
233 bool hasProgram;
234 // the program needed to handle this package type is available
236 int pCnt;
237 // Count of packages read in
239 QString env;
241 QStringList packList;
242 // Buffer for splitting up package entries
244 short lastType;
245 // The type of the last package
247 public slots:
248 void textIn(const QString &s);
249 // Process remote packace info
251 void updateS();
252 void upgradeS();
253 void fixupS();
257 #endif // PKGINTERFACE_H