~jibel/synaptic/bugs.290524.502582

« back to all changes in this revision

Viewing changes to common/rpackagestatus.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-08-22 12:40:10 UTC
  • Revision ID: james.westby@ubuntu.com-20080822124010-5z3kuzjp2jozl13a
Tags: 0.62.1ubuntu8
* common/rpackageview.cc:
  - add new "Missing Recommends" default filter
* common/rpackage.cc:
  - fix code to get candidate origin
  - support getting the candidate release file name
* common/rpackagestatus.cc:
  - support maintenanceEndTime() (if the distro supports that)
* 10_ubuntu_maintenance_gui.dpatch:
  - add support for displaying when the maintaince ends

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* rpackagestatus.h - wrapper for accessing packagestatus information
 
2
 * 
 
3
 * Copyright (c) 2000, 2001 Conectiva S/A 
 
4
 *               2002-2008 Michael Vogt <mvo@debian.org>
 
5
 * 
 
6
 * Author: Alfredo K. Kojima <kojima@conectiva.com.br>
 
7
 *         Michael Vogt <mvo@debian.org>
 
8
 * 
 
9
 * Portions Taken from Gnome APT
 
10
 *   Copyright (C) 1998 Havoc Pennington <hp@pobox.com>
 
11
 * 
 
12
 *
 
13
 * This program is free software; you can redistribute it and/or 
 
14
 * modify it under the terms of the GNU General Public License as 
 
15
 * published by the Free Software Foundation; either version 2 of the
 
16
 * License, or (at your option) any later version.
 
17
 *
 
18
 * This program is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program; if not, write to the Free Software
 
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 
26
 * USA
 
27
 */
 
28
 
 
29
#ifndef _RPACKAGESTATUS_H_
 
30
#define _RPACKAGESTATUS_H_
 
31
 
 
32
#include <time.h>
 
33
#include <vector>
 
34
#include <string>
 
35
#include <sstream>
 
36
#include <apt-pkg/configuration.h>
 
37
 
 
38
#include "i18n.h"
 
39
#include "rpackage.h"
 
40
 
 
41
using namespace std;
 
42
 
 
43
class RPackageStatus {
 
44
 public:
 
45
   enum PkgStatus {
 
46
      ToInstall, ToReInstall, ToUpgrade, ToDowngrade, ToRemove, ToPurge,
 
47
      NotInstalled, NotInstalledLocked,
 
48
      InstalledUpdated, InstalledOutdated, InstalledLocked,
 
49
      IsBroken, IsNew,
 
50
      N_STATUS_COUNT
 
51
   };
 
52
 
 
53
 protected:
 
54
   // the supported archive-labels and components
 
55
   vector<string> supportedLabels;
 
56
   vector<string> supportedComponents;
 
57
   bool markUnsupported;
 
58
 
 
59
   // this is the short string to load the icons
 
60
   const char *PackageStatusShortString[N_STATUS_COUNT];
 
61
   // this is the long string for the gui description of the state
 
62
   const char *PackageStatusLongString[N_STATUS_COUNT];
 
63
 
 
64
 
 
65
   // this does the actual work
 
66
   int getStatus(RPackage *pkg);
 
67
 
 
68
 
 
69
 public:
 
70
   RPackageStatus() : markUnsupported(false) {};
 
71
   virtual ~RPackageStatus() {};
 
72
 
 
73
   // this reads the pixmaps and the colors
 
74
   virtual void init();
 
75
 
 
76
   // here we get the description for the States
 
77
   const char *getLongStatusString(int i) {
 
78
      return PackageStatusLongString[i];
 
79
   };
 
80
   const char *getLongStatusString(RPackage *pkg) {
 
81
      return PackageStatusLongString[getStatus(pkg)];
 
82
   };
 
83
 
 
84
   const char *getShortStatusString(int i) {
 
85
      return PackageStatusShortString[i];
 
86
   };
 
87
 
 
88
   bool isSupported(RPackage *pkg);
 
89
 
 
90
   // return the time until the package is supported
 
91
   bool maintenanceEndTime(RPackage *pkg, struct tm *support_end_tm);
 
92
};
 
93
 
 
94
#endif