1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
/*
* dselect - Debian package maintenance user interface
* pkginfo.cc - handles (re)draw of package list window infopad
*
* Copyright © 1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
*
* This 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.
*
* This is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <compat.h>
#include <string.h>
#include <stdio.h>
#include <dpkg/i18n.h>
#include <dpkg/dpkg.h>
#include <dpkg/dpkg-db.h>
#include <dpkg/string.h>
#include "dselect.h"
#include "bindings.h"
#include "helpmsgs.h"
const struct helpmenuentry *packagelist::helpmenulist() {
static const struct helpmenuentry
rw[]= {
{ 'i', &hlp_mainintro },
{ 'k', &hlp_listkeys },
{ 'l', &hlp_displayexplain1 },
{ 'd', &hlp_displayexplain2 },
{ 0 }
},
ro[]= {
{ 'i', &hlp_readonlyintro },
{ 'k', &hlp_listkeys },
{ 'l', &hlp_displayexplain1 },
{ 'd', &hlp_displayexplain2 },
{ 0 }
},
recur[]= {
{ 'i', &hlp_recurintro },
{ 'k', &hlp_listkeys },
{ 'l', &hlp_displayexplain1 },
{ 'd', &hlp_displayexplain2 },
{ 0 }
};
return
modstatdb_get_status() == msdbrw_readonly ? ro :
!recursive ? rw :
recur;
}
bool
packagelist::itr_recursive()
{
return recursive;
}
const packagelist::infotype packagelist::infoinfos[]= {
{ &packagelist::itr_recursive, &packagelist::itd_relations },
{ nullptr, &packagelist::itd_description },
{ nullptr, &packagelist::itd_statuscontrol },
{ nullptr, &packagelist::itd_availablecontrol },
{ nullptr, nullptr }
};
const packagelist::infotype *const packagelist::baseinfo= infoinfos;
void packagelist::severalinfoblurb()
{
varbuf vb;
vb(_("The line you have highlighted represents many packages; "
"if you ask to install, remove, hold, etc. it you will affect all "
"the packages which match the criterion shown.\n"
"\n"
"If you move the highlight to a line for a particular package "
"you will see information about that package displayed here."
"\n"
"You can use 'o' and 'O' to change the sort order and give yourself "
"the opportunity to mark packages in different kinds of groups."));
wordwrapinfo(0,vb.string());
}
void packagelist::itd_relations() {
whatinfovb(_("Interrelationships"));
if (table[cursorline]->pkg->set->name) {
debug(dbg_general, "packagelist[%p]::idt_relations(); '%s'",
this, table[cursorline]->relations.string());
waddstr(infopad,table[cursorline]->relations.string());
} else {
severalinfoblurb();
}
}
void packagelist::itd_description() {
whatinfovb(_("Description"));
if (table[cursorline]->pkg->set->name) {
const char *m= table[cursorline]->pkg->available.description;
if (str_is_unset(m))
m = table[cursorline]->pkg->installed.description;
if (str_is_unset(m))
m = _("No description available.");
const char *p = strchrnul(m, '\n');
ptrdiff_t l = p - m;
wattrset(infopad, part_attr[info_head]);
waddstr(infopad, table[cursorline]->pkg->set->name);
waddstr(infopad," - ");
waddnstr(infopad,m,l);
wattrset(infopad, part_attr[info_body]);
if (*p) {
waddstr(infopad,"\n\n");
wordwrapinfo(1,++p);
}
} else {
severalinfoblurb();
}
}
void packagelist::itd_statuscontrol() {
whatinfovb(_("Installed control file information"));
werase(infopad);
if (!table[cursorline]->pkg->set->name) {
severalinfoblurb();
} else {
varbuf vb;
varbuf_stanza(&vb, table[cursorline]->pkg,
&table[cursorline]->pkg->installed);
debug(dbg_general, "packagelist[%p]::idt_statuscontrol(); '%s'",
this, vb.string());
waddstr(infopad,vb.string());
}
}
void packagelist::itd_availablecontrol() {
whatinfovb(_("Available control file information"));
werase(infopad);
if (!table[cursorline]->pkg->set->name) {
severalinfoblurb();
} else {
varbuf vb;
varbuf_stanza(&vb, table[cursorline]->pkg,
&table[cursorline]->pkg->available);
debug(dbg_general, "packagelist[%p]::idt_availablecontrol(); '%s'",
this, vb.string());
waddstr(infopad,vb.string());
}
}
void packagelist::redrawinfo() {
for (;;) {
if (!currentinfo || !currentinfo->display) currentinfo= baseinfo;
if (!currentinfo->relevant) break;
if ((this->*currentinfo->relevant)()) break;
currentinfo++;
}
if (!info_height) return;
whatinfovb.reset();
werase(infopad); wmove(infopad,0,0);
debug(dbg_general, "packagelist[%p]::redrawinfo(); #=%zd",
this, currentinfo - baseinfo);
(this->*currentinfo->display)();
int y,x;
getyx(infopad, y,x);
if (x) y++;
infolines= y;
refreshinfo();
}
|