Skip to content

Commit 7a5690b

Browse files
committed
PackageManager: Add ChangeLog and Content Tree views for installed packages
1 parent 3b5455a commit 7a5690b

12 files changed

Lines changed: 398 additions & 53 deletions

File tree

headers/os/experimental/package/PackageRoster.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
// The kit's read entry point: every query is request-in/reply-out via
1717
// a BMessenger, never a synchronous container return. Each reply
1818
// (codes in PackageDefs.h) carries int32 "status"; on failure it is
19-
// kVMsgQueryError with int32 "error" and BString "detail". On success:
19+
// kVMsgQueryError with int32 "error" and BString "detail", plus
20+
// BString "name" when the failed request named a package. On success:
2021
// kVMsgPackageListReply: repeated B_POINTER "package"; ownership of
2122
// each reference transfers to the receiver (wrap in VPackageInfoRef
2223
// or ReleaseReference() it).

src/apps/packagemanager/AptBackend.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,18 @@ AptBackend::_CheckDpkgLock()
523523
char mode[16] = { 0 };
524524
char rw[16] = { 0 };
525525
int pid = -1;
526-
if (sscanf(line.String(), "%d: %15s %15s %15s %d", &id, type, mode,
527-
rw, &pid) == 5) {
526+
bool havePid = sscanf(line.String(), "%d: %15s %15s %15s %d", &id,
527+
type, mode, rw, &pid) == 5;
528+
if (havePid)
528529
fLockHolderPid = (pid_t)pid;
529-
}
530530
fLockPath.SetTo(kLockPaths[i]);
531531

532532
BString detail;
533-
detail.SetToFormat("%s held by pid %d", kLockPaths[i], pid);
533+
if (havePid)
534+
detail.SetToFormat("%s held by pid %d", kLockPaths[i], pid);
535+
else
536+
detail.SetToFormat("%s held by an unknown process",
537+
kLockPaths[i]);
534538
_SetError(kAptErrorLockHeld, detail.String());
535539
return false;
536540
}

src/apps/packagemanager/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Application(PackageManager
1111
PackageRow.cpp
1212
PackageWorker.cpp
1313
WorkStatusView.cpp
14-
LIBS shared tracker localestub vpackage
14+
LIBS shared tracker localestub vpackage apt-pkg
1515
RDEF PackageManager.rdef
1616
)
1717
UsePrivateHeaders(PackageManager app interface shared storage tracker)

src/apps/packagemanager/MainWindow.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,28 @@ MainWindow::MessageReceived(BMessage* message)
148148
break;
149149

150150
case kMsgRefreshList:
151+
{
152+
// Only this path warns: the startup and post-transaction
153+
// refreshes must consume marks silently.
154+
int32 marked = _CountMarked();
155+
if (marked > 0 && !fTransactionActive) {
156+
BString text(B_TRANSLATE(
157+
"There are %count% marked changes that have not been "
158+
"applied. Refreshing now will discard them."));
159+
BString countText;
160+
countText << marked;
161+
text.ReplaceFirst("%count%", countText);
162+
BAlert* alert = new BAlert(B_TRANSLATE("Package manager"),
163+
text.String(), B_TRANSLATE("Cancel"),
164+
B_TRANSLATE("Refresh anyway"), NULL, B_WIDTH_AS_USUAL,
165+
B_WARNING_ALERT);
166+
alert->SetShortcut(0, B_ESCAPE);
167+
if (alert->Go() != 1)
168+
break;
169+
}
151170
fWorker->PostMessage(kMsgRefreshList);
152171
break;
172+
}
153173

154174
case kMsgReloadLog:
155175
fWorker->PostMessage(kMsgLoadLog);

src/apps/packagemanager/PackageInfo.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "PackageInfo.h"
77

8-
#include <Bitmap.h>
98
#include <Catalog.h>
109

1110

@@ -21,15 +20,13 @@ PackageInfo::PackageInfo(const char* name)
2120
fState(kPackageAvailable),
2221
fChannel(kChannelUnknown),
2322
fMark(kMarkNone),
24-
fHasDetails(false),
25-
fIcon(NULL)
23+
fHasDetails(false)
2624
{
2725
}
2826

2927

3028
PackageInfo::~PackageInfo()
3129
{
32-
delete fIcon;
3330
}
3431

3532

@@ -131,17 +128,6 @@ PackageInfo::SetHasDetails(bool hasDetails)
131128
}
132129

133130

134-
void
135-
PackageInfo::SetIcon(BBitmap* icon)
136-
{
137-
if (fIcon == icon)
138-
return;
139-
140-
delete fIcon;
141-
fIcon = icon;
142-
}
143-
144-
145131
const char*
146132
PackageInfo::ChannelLabel() const
147133
{

src/apps/packagemanager/PackageInfo.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#include "PackageManagerDefs.h"
1111

1212

13-
class BBitmap;
14-
15-
1613
class PackageInfo {
1714
public:
1815
PackageInfo(const char* name);
@@ -64,11 +61,6 @@ class PackageInfo {
6461
void SetMark(package_mark mark);
6562
void SetHasDetails(bool hasDetails);
6663

67-
// PackageInfo takes ownership of the icon.
68-
const BBitmap* Icon() const
69-
{ return fIcon; }
70-
void SetIcon(BBitmap* icon);
71-
7264
const char* ChannelLabel() const;
7365

7466
private:
@@ -87,7 +79,6 @@ class PackageInfo {
8779
package_channel fChannel;
8880
package_mark fMark;
8981
bool fHasDetails;
90-
BBitmap* fIcon;
9182
};
9283

9384

0 commit comments

Comments
 (0)