From 9f3d8cb64fdbfd9b5ceff4e63669fdbb8dac0fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 12 May 2007 13:37:02 +0000 Subject: [PATCH] code style update now mount the target partition before copying git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21113 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/installer/CopyEngine.cpp | 163 +++++++++++------- src/apps/installer/CopyEngine.h | 36 ++-- src/apps/installer/DrawButton.cpp | 4 +- src/apps/installer/DrawButton.h | 18 +- src/apps/installer/InstallerApp.cpp | 26 +-- src/apps/installer/InstallerApp.h | 16 +- .../installer/InstallerCopyLoopControl.cpp | 32 ++-- src/apps/installer/InstallerCopyLoopControl.h | 20 +-- src/apps/installer/InstallerWindow.cpp | 82 ++++----- src/apps/installer/InstallerWindow.h | 62 +++---- src/apps/installer/PackageViews.cpp | 44 ++--- src/apps/installer/PackageViews.h | 84 ++++----- src/apps/installer/PartitionMenuItem.cpp | 4 +- src/apps/installer/PartitionMenuItem.h | 6 +- 14 files changed, 315 insertions(+), 282 deletions(-) diff --git a/src/apps/installer/CopyEngine.cpp b/src/apps/installer/CopyEngine.cpp index 464614da71..40ab7be915 100644 --- a/src/apps/installer/CopyEngine.cpp +++ b/src/apps/installer/CopyEngine.cpp @@ -16,37 +16,41 @@ #include #include -//#define COPY_TRACE +#define COPY_TRACE #ifdef COPY_TRACE #define CALLED() printf("CALLED %s\n",__PRETTY_FUNCTION__) +#define ERR2(x, y...) fprintf(stderr, "CopyEngine: "x" %s\n", y, strerror(err)) +#define ERR(x) fprintf(stderr, "CopyEngine: "x" %s\n", strerror(err)) #else #define CALLED() +#define ERR(x) +#define ERR2(x, y...) #endif const char BOOT_PATH[] = "/boot"; extern void SizeAsString(off_t size, char *string); -class SourceVisitor : public BDiskDeviceVisitor +class SourceVisitor : public BDiskDeviceVisitor { -public: - SourceVisitor(BMenu *menu); - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); -private: - BMenu *fMenu; + public: + SourceVisitor(BMenu *menu); + virtual bool Visit(BDiskDevice *device); + virtual bool Visit(BPartition *partition, int32 level); + private: + BMenu *fMenu; }; class TargetVisitor : public BDiskDeviceVisitor { -public: - TargetVisitor(BMenu *menu); - virtual bool Visit(BDiskDevice *device); - virtual bool Visit(BPartition *partition, int32 level); -private: - void MakeLabel(BPartition *partition, char *label, char *menuLabel); - BMenu *fMenu; + public: + TargetVisitor(BMenu *menu); + virtual bool Visit(BDiskDevice *device); + virtual bool Visit(BPartition *partition, int32 level); + private: + void MakeLabel(BPartition *partition, char *label, char *menuLabel); + BMenu *fMenu; }; @@ -67,7 +71,9 @@ CopyEngine::MessageReceived(BMessage*msg) CALLED(); switch (msg->what) { case ENGINE_START: - Start(fWindow->GetSourceMenu(), fWindow->GetTargetMenu()); + status_t err = Start(fWindow->GetSourceMenu(), fWindow->GetTargetMenu()); + if (err != B_OK) + ERR("Start failed"); break; } } @@ -91,7 +97,7 @@ CopyEngine::LaunchInitScript(BPath &path) command += bootPath.Path(); command += "/InstallerInitScript "; command += path.Path(); - SetStatusMessage("Starting Installation."); + SetStatusMessage("Starting Installation."); system(command.String()); } @@ -105,22 +111,23 @@ CopyEngine::LaunchFinishScript(BPath &path) command += bootPath.Path(); command += "/InstallerFinishScript "; command += path.Path(); - SetStatusMessage("Finishing Installation."); + SetStatusMessage("Finishing Installation."); system(command.String()); } -void +status_t CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu) { CALLED(); + status_t err = B_OK; PartitionMenuItem *targetItem = (PartitionMenuItem *)targetMenu->FindMarked(); PartitionMenuItem *srcItem = (PartitionMenuItem *)srcMenu->FindMarked(); if (!srcItem || !targetItem) { - fprintf(stderr, "bad menu items\n"); - return; + ERR("bad menu items\n"); + return B_BAD_VALUE; } - + // check if target is initialized // ask if init or mount as is @@ -130,49 +137,75 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu) BVolume targetVolume; if (fDDRoster.GetPartitionWithID(targetItem->ID(), &device, &partition) == B_OK) { - if (partition->GetVolume(&targetVolume)!=B_OK) - return; - if (partition->GetMountPoint(&targetDirectory)!=B_OK) - return; + if (!partition->IsMounted()) { + if ((err = partition->Mount()) < B_OK) { + SetStatusMessage("The disk can't be mounted. Please choose a different disk."); + ERR("BPartition::Mount"); + return err; + } + } + if ((err = partition->GetVolume(&targetVolume)) != B_OK) { + ERR("BPartition::GetVolume"); + return err; + } + if ((err = partition->GetMountPoint(&targetDirectory)) != B_OK) { + ERR("BPartition::GetMountPoint"); + return err; + } } else if (fDDRoster.GetDeviceWithID(targetItem->ID(), &device) == B_OK) { - if (device.GetVolume(&targetVolume)!=B_OK) - return; - if (device.GetMountPoint(&targetDirectory)!=B_OK) - return; - } else - return; // shouldn't happen + if (!device.IsMounted()) { + if ((err = device.Mount()) < B_OK) { + SetStatusMessage("The disk can't be mounted. Please choose a different disk."); + ERR("BDiskDevice::Mount"); + return err; + } + } + if ((err = device.GetVolume(&targetVolume)) != B_OK) { + ERR("BDiskDevice::GetVolume"); + return err; + } + if ((err = device.GetMountPoint(&targetDirectory)) != B_OK) { + ERR("BDiskDevice::GetMountPoint"); + return err; + } + } else + return B_ERROR; // shouldn't happen // check if target has enough space - if ((fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired) + if ((fSpaceRequired > 0 && targetVolume.FreeBytes() < fSpaceRequired) && ((new BAlert("", "The destination disk may not have enough space. Try choosing a different disk or \ choose to not install optional items.", "Try installing anyway", "Cancel", 0, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { - return; + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { + return B_OK; } BPath srcDirectory; - if (fDDRoster.GetPartitionWithID(srcItem->ID(), &device, &partition) == B_OK) { - if (partition->GetMountPoint(&srcDirectory)!=B_OK) - return; - } else if (fDDRoster.GetDeviceWithID(srcItem->ID(), &device) == B_OK) { - if (device.GetMountPoint(&srcDirectory)!=B_OK) - return; - } else - return; // shouldn't happen - + if (fDDRoster.GetPartitionWithID(srcItem->ID(), &device, &partition) == B_OK) { + if ((err = partition->GetMountPoint(&srcDirectory)) != B_OK) { + ERR("BPartition::GetMountPoint"); + return err; + } + } else if (fDDRoster.GetDeviceWithID(srcItem->ID(), &device) == B_OK) { + if ((err = device.GetMountPoint(&srcDirectory)) != B_OK) { + ERR("BDiskDevice::GetMountPoint"); + return err; + } + } else + return B_ERROR; // shouldn't happen + // check not installing on itself if (strcmp(srcDirectory.Path(), targetDirectory.Path()) == 0) { SetStatusMessage("You can't install the contents of a disk onto itself. Please choose a different disk."); - return; + return B_OK; } - + // check not installing on boot volume - if ((strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0) + if ((strncmp(BOOT_PATH, targetDirectory.Path(), strlen(BOOT_PATH)) == 0) && ((new BAlert("", "Are you sure you want to install onto the current boot disk? \ The installer will have to reboot your machine if you proceed.", "OK", "Cancel", 0, - B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { + B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go() != 0)) { SetStatusMessage("Installation stopped."); - return; + return B_OK; } LaunchInitScript(targetDirectory); @@ -188,7 +221,7 @@ The installer will have to reboot your machine if you proceed.", "OK", "Cancel", srcDir.SetTo(srcDirectory.Path()); BDirectory packageDir; int32 count = fPackages->CountItems(); - for (int32 i=0; i(fPackages->ItemAt(i)); packageDir.SetTo(&srcDir, p->Folder()); CopyFolder(packageDir, targetDir); @@ -206,7 +239,7 @@ void CopyEngine::CopyFolder(BDirectory &srcDir, BDirectory &targetDir) { BEntry entry; - status_t status; + status_t err; while (srcDir.GetNextEntry(&entry) == B_OK) { char name[B_FILE_NAME_LENGTH]; entry.GetName(name); @@ -214,11 +247,11 @@ CopyEngine::CopyFolder(BDirectory &srcDir, BDirectory &targetDir) continue; Undo undo; - status = FSCopyFolder(&entry, &targetDir, fControl, NULL, false, undo); - if (status != B_OK) { + err = FSCopyFolder(&entry, &targetDir, fControl, NULL, false, undo); + if (err != B_OK) { BPath path; entry.GetPath(&path); - fprintf(stderr, "error while copying %s : %s\n", path.Path(), strerror(status)); + ERR2("error while copying %s", path.Path()); } } } @@ -257,17 +290,17 @@ SourceVisitor::SourceVisitor(BMenu *menu) bool SourceVisitor::Visit(BDiskDevice *device) { - if (!device->ContentType() || strcmp(device->ContentType(), kPartitionTypeBFS)!=0) + if (!device->ContentType() || strcmp(device->ContentType(), kPartitionTypeBFS) != 0) return false; BPath path; - if (device->GetPath(&path)==B_OK) - printf("SourceVisitor::Visit(BDiskDevice *) : %s type:%s, contentType:%s\n", + if (device->GetPath(&path) == B_OK) + printf("SourceVisitor::Visit(BDiskDevice *) : %s type:%s, contentType:%s\n", path.Path(), device->Type(), device->ContentType()); PartitionMenuItem *item = new PartitionMenuItem(NULL, device->ContentName(), NULL, new BMessage(SRC_PARTITION), device->ID()); if (device->IsMounted()) { BPath mountPoint; device->GetMountPoint(&mountPoint); - if (strcmp(BOOT_PATH, mountPoint.Path())==0) + if (strcmp(BOOT_PATH, mountPoint.Path()) == 0) item->SetMarked(true); } fMenu->AddItem(item); @@ -278,17 +311,17 @@ SourceVisitor::Visit(BDiskDevice *device) bool SourceVisitor::Visit(BPartition *partition, int32 level) { - if (!partition->ContentType() || strcmp(partition->ContentType(), kPartitionTypeBFS)!=0) + if (!partition->ContentType() || strcmp(partition->ContentType(), kPartitionTypeBFS) != 0) return false; BPath path; - if (partition->GetPath(&path)==B_OK) + if (partition->GetPath(&path) == B_OK) printf("SourceVisitor::Visit(BPartition *) : %s\n", path.Path()); printf("SourceVisitor::Visit(BPartition *) : %s\n", partition->Name()); PartitionMenuItem *item = new PartitionMenuItem(NULL, partition->ContentName(), NULL, new BMessage(SRC_PARTITION), partition->ID()); if (partition->IsMounted()) { BPath mountPoint; partition->GetMountPoint(&mountPoint); - if (strcmp(BOOT_PATH, mountPoint.Path())==0) + if (strcmp(BOOT_PATH, mountPoint.Path()) == 0) item->SetMarked(true); } fMenu->AddItem(item); @@ -308,7 +341,7 @@ TargetVisitor::Visit(BDiskDevice *device) if (device->IsReadOnly() || device->IsReadOnlyMedia()) return false; BPath path; - if (device->GetPath(&path)==B_OK) + if (device->GetPath(&path) == B_OK) printf("TargetVisitor::Visit(BDiskDevice *) : %s\n", path.Path()); char label[255], menuLabel[255]; MakeLabel(device, label, menuLabel); @@ -323,7 +356,7 @@ TargetVisitor::Visit(BPartition *partition, int32 level) if (partition->IsReadOnly()) return false; BPath path; - if (partition->GetPath(&path)==B_OK) + if (partition->GetPath(&path) == B_OK) printf("TargetVisitor::Visit(BPartition *) : %s\n", path.Path()); printf("TargetVisitor::Visit(BPartition *) : %s\n", partition->Name()); char label[255], menuLabel[255]; @@ -341,9 +374,9 @@ TargetVisitor::MakeLabel(BPartition *partition, char *label, char *menuLabel) BPath path; if (partition->Parent()) partition->Parent()->GetPath(&path); - + sprintf(label, "%s - %s [%s] [%s partition:%li]", partition->ContentName(), size, partition->ContentType(), - path.Path(), partition->ID()); + path.Path(), partition->ID()); sprintf(menuLabel, "%s - %s [%s]", partition->ContentName(), size, partition->ContentType()); } diff --git a/src/apps/installer/CopyEngine.h b/src/apps/installer/CopyEngine.h index a780b455cf..7f01d3798e 100644 --- a/src/apps/installer/CopyEngine.h +++ b/src/apps/installer/CopyEngine.h @@ -20,24 +20,24 @@ class InstallerWindow; const uint32 ENGINE_START = 'eSRT'; class CopyEngine : public BLooper { -public: - CopyEngine(InstallerWindow *window); - void MessageReceived(BMessage *msg); - void SetStatusMessage(char *status); - void Start(BMenu *srcMenu, BMenu *targetMenu); - void ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu); - void SetPackagesList(BList *list); - void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; }; -private: - void LaunchInitScript(BPath &path); - void LaunchFinishScript(BPath &path); - void CopyFolder(BDirectory &srcDir, BDirectory &targetDir); - - InstallerWindow *fWindow; - BDiskDeviceRoster fDDRoster; - InstallerCopyLoopControl *fControl; - BList *fPackages; - off_t fSpaceRequired; + public: + CopyEngine(InstallerWindow *window); + void MessageReceived(BMessage *msg); + void SetStatusMessage(char *status); + status_t Start(BMenu *srcMenu, BMenu *targetMenu); + void ScanDisksPartitions(BMenu *srcMenu, BMenu *targetMenu); + void SetPackagesList(BList *list); + void SetSpaceRequired(off_t bytes) { fSpaceRequired = bytes; }; + private: + void LaunchInitScript(BPath &path); + void LaunchFinishScript(BPath &path); + void CopyFolder(BDirectory &srcDir, BDirectory &targetDir); + + InstallerWindow *fWindow; + BDiskDeviceRoster fDDRoster; + InstallerCopyLoopControl *fControl; + BList *fPackages; + off_t fSpaceRequired; }; #endif /* _CopyEngine_h */ diff --git a/src/apps/installer/DrawButton.cpp b/src/apps/installer/DrawButton.cpp index 36aab4b858..dddd4d9f08 100644 --- a/src/apps/installer/DrawButton.cpp +++ b/src/apps/installer/DrawButton.cpp @@ -9,7 +9,7 @@ #include "DrawButton.h" DrawButton::DrawButton(BRect frame, const char *name, const char *labelOn, const char* labelOff, - BMessage *msg, int32 resize, int32 flags) + BMessage *msg, int32 resize, int32 flags) : PaneSwitch(frame, name, "", resize, flags) { fLabelOn = strdup(labelOn); @@ -28,7 +28,7 @@ DrawButton::~DrawButton(void) void DrawButton::Draw(BRect update) { - BPoint point(18,9); + BPoint point(18, 9); if (Value()) { DrawString(fLabelOn, point); } else { diff --git a/src/apps/installer/DrawButton.h b/src/apps/installer/DrawButton.h index ad45ba52c5..bf0ea7736a 100644 --- a/src/apps/installer/DrawButton.h +++ b/src/apps/installer/DrawButton.h @@ -12,15 +12,15 @@ class DrawButton : public PaneSwitch { -public: - DrawButton(BRect frame, const char *name, const char *labelOn, const char* labelOff, - BMessage *msg, int32 resize = B_FOLLOW_LEFT|B_FOLLOW_TOP, - int32 flags = B_WILL_DRAW | B_NAVIGABLE); - ~DrawButton(void); - - void Draw(BRect update); -private: - char* fLabelOn, *fLabelOff; + public: + DrawButton(BRect frame, const char *name, const char *labelOn, const char* labelOff, + BMessage *msg, int32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP, + int32 flags = B_WILL_DRAW | B_NAVIGABLE); + ~DrawButton(void); + + void Draw(BRect update); + private: + char *fLabelOn, *fLabelOff; }; #endif diff --git a/src/apps/installer/InstallerApp.cpp b/src/apps/installer/InstallerApp.cpp index c6142db1c3..79fade6e3b 100644 --- a/src/apps/installer/InstallerApp.cpp +++ b/src/apps/installer/InstallerApp.cpp @@ -28,30 +28,30 @@ int main(int, char **) InstallerApp::InstallerApp() : BApplication(APP_SIG) { - BRect windowFrame(0,0,INSTALLER_RIGHT, 160); + BRect windowFrame(0, 0, INSTALLER_RIGHT, 160); BRect frame = BScreen().Frame(); - windowFrame.OffsetBy((frame.Width() - windowFrame.Width())/2, - frame.Height()/2 - windowFrame.Height()/4 - 113); + windowFrame.OffsetBy((frame.Width() - windowFrame.Width()) / 2, + frame.Height() / 2 - windowFrame.Height() / 4 - 113); fWindow = new InstallerWindow(windowFrame); // show the EULA BAlert *alert = new BAlert("", EULA_TEXT, " Disagree ", " Agree ", NULL, - B_WIDTH_FROM_WIDEST, B_EMPTY_ALERT); + B_WIDTH_FROM_WIDEST, B_EMPTY_ALERT); BTextView *alertView = alert->TextView(); - alertView->SetViewColor(255,255,255); + alertView->SetViewColor(255, 255, 255); BView *parent = alertView->Parent(); alertView->RemoveSelf(); - alertView->MoveBy(3,7); - alertView->ResizeTo(460,283); + alertView->MoveBy(3, 7); + alertView->ResizeTo(460, 283); alertView->SetResizingMode(B_FOLLOW_ALL_SIDES); - alert->ResizeTo(500,350); + alert->ResizeTo(500, 350); BScrollView *scroll = new BScrollView("", alertView, B_FOLLOW_ALL_SIDES, B_FRAME_EVENTS, false, true, B_FANCY_BORDER); parent->AddChild(scroll); BRect alertFrame = alert->Frame(); - alertFrame.OffsetTo((frame.Width() - alertFrame.Width())/2, - (frame.Height() - alertFrame.Height())/2); + alertFrame.OffsetTo((frame.Width() - alertFrame.Width()) / 2, + (frame.Height() - alertFrame.Height()) / 2); alert->MoveTo(alertFrame.LeftTop()); - if (alert->Go()!=1) + if (alert->Go() != 1) PostMessage(B_QUIT_REQUESTED); } @@ -68,7 +68,7 @@ InstallerApp::AboutRequested() view->GetFont(&font); font.SetSize(18); - font.SetFace(B_BOLD_FACE); + font.SetFace(B_BOLD_FACE); view->SetFontAndColor(0, 14, &font); alert->Go(); @@ -79,6 +79,6 @@ InstallerApp::AboutRequested() void InstallerApp::ReadyToRun() { - + } diff --git a/src/apps/installer/InstallerApp.h b/src/apps/installer/InstallerApp.h index dd7fa8564c..9183bbc5b2 100644 --- a/src/apps/installer/InstallerApp.h +++ b/src/apps/installer/InstallerApp.h @@ -10,15 +10,15 @@ #include "InstallerWindow.h" class InstallerApp : public BApplication { -public: - InstallerApp(); + public: + InstallerApp(); -public: - virtual void AboutRequested(); - virtual void ReadyToRun(); - -private: - InstallerWindow *fWindow; + public: + virtual void AboutRequested(); + virtual void ReadyToRun(); + + private: + InstallerWindow *fWindow; }; #endif /* _InstallerApp_h */ diff --git a/src/apps/installer/InstallerCopyLoopControl.cpp b/src/apps/installer/InstallerCopyLoopControl.cpp index 4221366c51..a4e2c9e729 100644 --- a/src/apps/installer/InstallerCopyLoopControl.cpp +++ b/src/apps/installer/InstallerCopyLoopControl.cpp @@ -14,9 +14,9 @@ InstallerCopyLoopControl::InstallerCopyLoopControl(InstallerWindow *window) } -bool +bool InstallerCopyLoopControl::FileError(const char *message, const char *name, status_t error, - bool allowContinue) + bool allowContinue) { char buffer[512]; sprintf(buffer, message, name, strerror(error)); @@ -29,11 +29,11 @@ InstallerCopyLoopControl::FileError(const char *message, const char *name, statu B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); return false; } - -void -InstallerCopyLoopControl::UpdateStatus(const char *name, entry_ref ref, int32 count, - bool optional) + +void +InstallerCopyLoopControl::UpdateStatus(const char *name, entry_ref ref, int32 count, + bool optional) { if (name) { BMessage msg(STATUS_MESSAGE); @@ -45,17 +45,17 @@ InstallerCopyLoopControl::UpdateStatus(const char *name, entry_ref ref, int32 co } -bool +bool InstallerCopyLoopControl::CheckUserCanceled() { return false; } -InstallerCopyLoopControl::OverwriteMode -InstallerCopyLoopControl::OverwriteOnConflict(const BEntry *srcEntry, - const char *destName, const BDirectory *destDir, bool srcIsDir, - bool dstIsDir) +InstallerCopyLoopControl::OverwriteMode +InstallerCopyLoopControl::OverwriteOnConflict(const BEntry *srcEntry, + const char *destName, const BDirectory *destDir, bool srcIsDir, + bool dstIsDir) { if (srcIsDir && dstIsDir) return kMerge; @@ -64,34 +64,34 @@ InstallerCopyLoopControl::OverwriteOnConflict(const BEntry *srcEntry, } -bool +bool InstallerCopyLoopControl::SkipEntry(const BEntry *, bool file) { return false; } -void +void InstallerCopyLoopControl::ChecksumChunk(const char *block, size_t size) { } -bool +bool InstallerCopyLoopControl::ChecksumFile(const entry_ref *ref) { return true; } -bool +bool InstallerCopyLoopControl::SkipAttribute(const char *attributeName) { return false; } -bool +bool InstallerCopyLoopControl::PreserveAttribute(const char *attributeName) { return false; diff --git a/src/apps/installer/InstallerCopyLoopControl.h b/src/apps/installer/InstallerCopyLoopControl.h index 24dff86b73..db038deaed 100644 --- a/src/apps/installer/InstallerCopyLoopControl.h +++ b/src/apps/installer/InstallerCopyLoopControl.h @@ -13,32 +13,32 @@ class InstallerWindow; class InstallerCopyLoopControl : public CopyLoopControl { -public: + public: InstallerCopyLoopControl(InstallerWindow *window); virtual ~InstallerCopyLoopControl() {}; - + virtual bool FileError(const char *message, const char *name, status_t error, bool allowContinue); - virtual void UpdateStatus(const char *name, entry_ref ref, int32 count, + virtual void UpdateStatus(const char *name, entry_ref ref, int32 count, bool optional = false); virtual bool CheckUserCanceled(); - virtual OverwriteMode OverwriteOnConflict(const BEntry *srcEntry, - const char *destName, const BDirectory *destDir, bool srcIsDir, + virtual OverwriteMode OverwriteOnConflict(const BEntry *srcEntry, + const char *destName, const BDirectory *destDir, bool srcIsDir, bool dstIsDir); virtual bool SkipEntry(const BEntry *, bool file); - + virtual void ChecksumChunk(const char *block, size_t size); virtual bool ChecksumFile(const entry_ref *); virtual bool SkipAttribute(const char *attributeName); virtual bool PreserveAttribute(const char *attributeName); - -private: - InstallerWindow *fWindow; - BMessenger fMessenger; + + private: + InstallerWindow *fWindow; + BMessenger fMessenger; }; #endif diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 1548f7d245..f8429b2e53 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -28,8 +28,8 @@ const uint32 PACKAGE_CHECKBOX = 'iPCB'; class LogoView : public BBox { public: - LogoView(const BRect &r); - ~LogoView(void); + LogoView(const BRect &r); + ~LogoView(void); virtual void Draw(BRect update); private: BBitmap *fLogo; @@ -38,7 +38,7 @@ class LogoView : public BBox { LogoView::LogoView(const BRect &r) - : BBox(r, "logoview", B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER) + : BBox(r, "logoview", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_NO_BORDER) { fLogo = BTranslationUtils::GetBitmap('PNG ', "haikulogo.png"); if (fLogo) { @@ -69,13 +69,13 @@ InstallerWindow::InstallerWindow(BRect frame_rect) fLastTargetItem(NULL) { fCopyEngine = new CopyEngine(this); - + BRect bounds = Bounds(); bounds.bottom += 1; bounds.right += 1; fBackBox = new BBox(bounds, NULL, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); AddChild(fBackBox); - + BRect logoRect = fBackBox->Bounds(); logoRect.left += 1; logoRect.top = 12; @@ -84,53 +84,53 @@ InstallerWindow::InstallerWindow(BRect frame_rect) LogoView *logoView = new LogoView(logoRect); fBackBox->AddChild(logoView); - BRect statusRect(bounds.right-222, logoRect.top+2, bounds.right-14, logoRect.bottom - B_H_SCROLL_BAR_HEIGHT+4); + BRect statusRect(bounds.right - 222, logoRect.top + 2, bounds.right - 14, logoRect.bottom - B_H_SCROLL_BAR_HEIGHT + 4); BRect textRect(statusRect); textRect.OffsetTo(B_ORIGIN); - textRect.InsetBy(2,2); + textRect.InsetBy(2, 2); fStatusView = new BTextView(statusRect, "statusView", textRect, be_plain_font, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); fStatusView->MakeEditable(false); fStatusView->MakeSelectable(false); - - BScrollView *scroll = new BScrollView("statusScroll", fStatusView, B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW|B_FRAME_EVENTS); - fBackBox->AddChild(scroll); - fBeginButton = new BButton(BRect(bounds.right-90, bounds.bottom-35, bounds.right-11, bounds.bottom-11), + BScrollView *scroll = new BScrollView("statusScroll", fStatusView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS); + fBackBox->AddChild(scroll); + + fBeginButton = new BButton(BRect(bounds.right - 90, bounds.bottom - 35, bounds.right - 11, bounds.bottom - 11), "begin_button", "Begin", new BMessage(BEGIN_MESSAGE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fBeginButton->MakeDefault(true); fBackBox->AddChild(fBeginButton); - fSetupButton = new BButton(BRect(bounds.left+11, bounds.bottom-35, - bounds.left + be_plain_font->StringWidth("Setup partitions") + 36, bounds.bottom-22), - "setup_button", "Setup partitions" B_UTF8_ELLIPSIS, new BMessage(SETUP_MESSAGE), B_FOLLOW_LEFT|B_FOLLOW_BOTTOM); + fSetupButton = new BButton(BRect(bounds.left + 11, bounds.bottom - 35, + bounds.left + be_plain_font->StringWidth("Setup partitions") + 36, bounds.bottom - 22), + "setup_button", "Setup partitions" B_UTF8_ELLIPSIS, new BMessage(SETUP_MESSAGE), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); fBackBox->AddChild(fSetupButton); fSetupButton->Hide(); - fPackagesView = new PackagesView(BRect(bounds.left+12, bounds.top+4, bounds.right-15-B_V_SCROLL_BAR_WIDTH, bounds.bottom-61), "packages_view"); + fPackagesView = new PackagesView(BRect(bounds.left + 12, bounds.top + 4, bounds.right - 15 - B_V_SCROLL_BAR_WIDTH, bounds.bottom - 61), "packages_view"); fPackagesScrollView = new BScrollView("packagesScroll", fPackagesView, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW, false, true); fBackBox->AddChild(fPackagesScrollView); fPackagesScrollView->Hide(); - fDrawButton = new DrawButton(BRect(bounds.left+12, bounds.bottom-33, bounds.left+120, bounds.bottom-20), + fDrawButton = new DrawButton(BRect(bounds.left + 12, bounds.bottom - 33, bounds.left + 120, bounds.bottom - 20), "options_button", "Fewer options", "More options", new BMessage(SHOW_BOTTOM_MESSAGE)); fBackBox->AddChild(fDrawButton); fDestMenu = new BPopUpMenu("scanning" B_UTF8_ELLIPSIS, true, false); fSrcMenu = new BPopUpMenu("scanning" B_UTF8_ELLIPSIS, true, false); - BRect fieldRect(bounds.left+50, bounds.top+70, bounds.right-13, bounds.top+90); + BRect fieldRect(bounds.left + 50, bounds.top + 70, bounds.right - 13, bounds.top + 90); fSrcMenuField = new BMenuField(fieldRect, "srcMenuField", - "Install from: ", fSrcMenu); - fSrcMenuField->SetDivider(bounds.right-274); + "Install from: ", fSrcMenu); + fSrcMenuField->SetDivider(bounds.right - 274); fSrcMenuField->SetAlignment(B_ALIGN_RIGHT); fBackBox->AddChild(fSrcMenuField); - fieldRect.OffsetBy(0,23); + fieldRect.OffsetBy(0, 23); fDestMenuField = new BMenuField(fieldRect, "destMenuField", "Onto: ", fDestMenu); - fDestMenuField->SetDivider(bounds.right-274); + fDestMenuField->SetDivider(bounds.right - 274); fDestMenuField->SetAlignment(B_ALIGN_RIGHT); fBackBox->AddChild(fDestMenuField); @@ -149,7 +149,7 @@ InstallerWindow::InstallerWindow(BRect frame_rect) fDriveSetupLaunched = be_roster->IsRunning(DRIVESETUP_SIG); be_roster->StartWatching(this); - + PostMessage(START_SCAN); } @@ -166,7 +166,7 @@ InstallerWindow::MessageReceived(BMessage *msg) case START_SCAN: StartScan(); break; - case BEGIN_MESSAGE: + case BEGIN_MESSAGE: { BList *list = new BList(); int32 size = 0; @@ -219,17 +219,17 @@ InstallerWindow::MessageReceived(BMessage *msg) case B_SOME_APP_QUIT: { const char *signature; - if (msg->FindString("be:signature", &signature)==B_OK - && strcasecmp(signature, DRIVESETUP_SIG)==0) { + if (msg->FindString("be:signature", &signature) == B_OK + && strcasecmp(signature, DRIVESETUP_SIG) == 0) { fDriveSetupLaunched = msg->what == B_SOME_APP_LAUNCHED; DisableInterface(fDriveSetupLaunched); if (fDriveSetupLaunched) SetStatusMessage("Running DriveSetup" B_UTF8_ELLIPSIS "\nClose DriveSetup to continue with the\ninstallation."); else StartScan(); - } - break; - } + } + break; + } default: BWindow::MessageReceived(msg); break; @@ -240,7 +240,7 @@ bool InstallerWindow::QuitRequested() { if (fDriveSetupLaunched) { - (new BAlert("driveSetup", + (new BAlert("driveSetup", "Please close the DriveSetup window before closing the\nInstaller window.", "OK"))->Go(); return false; } @@ -250,7 +250,7 @@ InstallerWindow::QuitRequested() } -void +void InstallerWindow::ShowBottom() { if (fDrawButton->Value()) { @@ -276,7 +276,7 @@ InstallerWindow::ShowBottom() void InstallerWindow::LaunchDriveSetup() { - if (be_roster->Launch(DRIVESETUP_SIG)!=B_OK) + if (be_roster->Launch(DRIVESETUP_SIG) != B_OK) fprintf(stderr, "There was an error while launching DriveSetup\n"); } @@ -324,7 +324,7 @@ InstallerWindow::AdjustMenus() else fSrcMenuField->MenuItem()->SetLabel(((PartitionMenuItem *)fSrcMenu->ItemAt(0))->MenuLabel()); } - + PartitionMenuItem *item2 = (PartitionMenuItem *)fDestMenu->FindMarked(); if (item2) { fDestMenuField->MenuItem()->SetLabel(item2->MenuLabel()); @@ -335,7 +335,7 @@ InstallerWindow::AdjustMenus() fDestMenuField->MenuItem()->SetLabel(((PartitionMenuItem *)fDestMenu->ItemAt(0))->MenuLabel()); } char message[255]; - sprintf(message, "Press the Begin button to install from '%s' onto '%s'", + sprintf(message, "Press the Begin button to install from '%s' onto '%s'", item1 ? item1->Name() : "null", item2 ? item2->Name() : "null"); SetStatusMessage(message); } @@ -355,25 +355,25 @@ InstallerWindow::PublishPackages() BDiskDevice device; BPartition *partition; if (roster.GetPartitionWithID(item->ID(), &device, &partition) == B_OK) { - if (partition->GetMountPoint(&directory)!=B_OK) + if (partition->GetMountPoint(&directory) != B_OK) return; } else if (roster.GetDeviceWithID(item->ID(), &device) == B_OK) { - if (device.GetMountPoint(&directory)!=B_OK) + if (device.GetMountPoint(&directory) != B_OK) return; - } else + } else return; // shouldn't happen #else BPath directory = "/BeOS 5 PE Max Edition V3.1 beta"; #endif - + directory.Append(PACKAGES_DIRECTORY); BDirectory dir(directory.Path()); - if (dir.InitCheck()!=B_OK) + if (dir.InitCheck() != B_OK) return; BEntry packageEntry; BList packages; - while (dir.GetNextEntry(&packageEntry)==B_OK) { + while (dir.GetNextEntry(&packageEntry) == B_OK) { Package *package = Package::PackageFromEntry(packageEntry); if (package) { packages.AddItem(package); @@ -382,11 +382,11 @@ InstallerWindow::PublishPackages() packages.SortItems(ComparePackages); fPackagesView->AddPackages(packages, new BMessage(PACKAGE_CHECKBOX)); - PostMessage(PACKAGE_CHECKBOX); + PostMessage(PACKAGE_CHECKBOX); } -int +int InstallerWindow::ComparePackages(const void *firstArg, const void *secondArg) { const Group *group1 = *static_cast(firstArg); diff --git a/src/apps/installer/InstallerWindow.h b/src/apps/installer/InstallerWindow.h index 46452814ce..aac5f78b91 100644 --- a/src/apps/installer/InstallerWindow.h +++ b/src/apps/installer/InstallerWindow.h @@ -25,39 +25,39 @@ const uint32 INSTALL_FINISHED = 'iIFN'; const char PACKAGES_DIRECTORY[] = "_packages_"; class InstallerWindow : public BWindow { -public: - InstallerWindow(BRect frameRect); - virtual ~InstallerWindow(); + public: + InstallerWindow(BRect frameRect); + virtual ~InstallerWindow(); - virtual void MessageReceived(BMessage *msg); - virtual bool QuitRequested(); - BMenu *GetSourceMenu() { return fSrcMenu; }; - BMenu *GetTargetMenu() { return fDestMenu; }; -private: - void DisableInterface(bool disable); - void LaunchDriveSetup(); - void PublishPackages(); - void ShowBottom(); - void StartScan(); - void AdjustMenus(); - void SetStatusMessage(const char *text); - static int ComparePackages(const void *firstArg, const void *secondArg); - BBox *fBackBox; - BButton *fBeginButton, *fSetupButton; - DrawButton *fDrawButton; - bool fDriveSetupLaunched; - BTextView *fStatusView; - BMenu* fSrcMenu, *fDestMenu; - BMenuField* fSrcMenuField, *fDestMenuField; - PackagesView *fPackagesView; - BScrollView *fPackagesScrollView; - BStringView *fSizeView; + virtual void MessageReceived(BMessage *msg); + virtual bool QuitRequested(); + BMenu *GetSourceMenu() { return fSrcMenu; }; + BMenu *GetTargetMenu() { return fDestMenu; }; + private: + void DisableInterface(bool disable); + void LaunchDriveSetup(); + void PublishPackages(); + void ShowBottom(); + void StartScan(); + void AdjustMenus(); + void SetStatusMessage(const char *text); + static int ComparePackages(const void *firstArg, const void *secondArg); + BBox *fBackBox; + BButton *fBeginButton, *fSetupButton; + DrawButton *fDrawButton; + bool fDriveSetupLaunched; + BTextView *fStatusView; + BMenu* fSrcMenu, *fDestMenu; + BMenuField* fSrcMenuField, *fDestMenuField; + PackagesView *fPackagesView; + BScrollView *fPackagesScrollView; + BStringView *fSizeView; - BBitmap *fLogo; - BPoint fDrawPoint; - CopyEngine *fCopyEngine; - BString fLastStatus; - BMenuItem *fLastSrcItem, *fLastTargetItem; + BBitmap *fLogo; + BPoint fDrawPoint; + CopyEngine *fCopyEngine; + BString fLastStatus; + BMenuItem *fLastSrcItem, *fLastTargetItem; }; #endif /* _InstallerWindow_h */ diff --git a/src/apps/installer/PackageViews.cpp b/src/apps/installer/PackageViews.cpp index 2e4bddde4c..c88073b6b7 100644 --- a/src/apps/installer/PackageViews.cpp +++ b/src/apps/installer/PackageViews.cpp @@ -56,7 +56,7 @@ Package::Package(const char *folder) Package::~Package() { - delete fIcon; + delete fIcon; } @@ -66,7 +66,7 @@ Package::PackageFromEntry(BEntry &entry) char folder[B_FILE_NAME_LENGTH]; entry.GetName(folder); BDirectory directory(&entry); - if (directory.InitCheck()!=B_OK) + if (directory.InitCheck() != B_OK) return NULL; Package *package = new Package(folder); bool alwaysOn; @@ -74,17 +74,17 @@ Package::PackageFromEntry(BEntry &entry) int32 size; char group[64]; memset(group, 0, 64); - if (directory.ReadAttr("INSTALLER PACKAGE: NAME", B_STRING_TYPE, 0, package->fName, 64)<0) + if (directory.ReadAttr("INSTALLER PACKAGE: NAME", B_STRING_TYPE, 0, package->fName, 64) < 0) goto err; - if (directory.ReadAttr("INSTALLER PACKAGE: GROUP", B_STRING_TYPE, 0, group, 64)<0) + if (directory.ReadAttr("INSTALLER PACKAGE: GROUP", B_STRING_TYPE, 0, group, 64) < 0) goto err; - if (directory.ReadAttr("INSTALLER PACKAGE: DESCRIPTION", B_STRING_TYPE, 0, package->fDescription, 64)<0) + if (directory.ReadAttr("INSTALLER PACKAGE: DESCRIPTION", B_STRING_TYPE, 0, package->fDescription, 64) < 0) goto err; - if (directory.ReadAttr("INSTALLER PACKAGE: ON_BY_DEFAULT", B_BOOL_TYPE, 0, &onByDefault, sizeof(onByDefault))<0) + if (directory.ReadAttr("INSTALLER PACKAGE: ON_BY_DEFAULT", B_BOOL_TYPE, 0, &onByDefault, sizeof(onByDefault)) < 0) goto err; - if (directory.ReadAttr("INSTALLER PACKAGE: ALWAYS_ON", B_BOOL_TYPE, 0, &alwaysOn, sizeof(alwaysOn))<0) + if (directory.ReadAttr("INSTALLER PACKAGE: ALWAYS_ON", B_BOOL_TYPE, 0, &alwaysOn, sizeof(alwaysOn)) < 0) goto err; - if (directory.ReadAttr("INSTALLER PACKAGE: SIZE", B_INT32_TYPE, 0, &size, sizeof(size))<0) + if (directory.ReadAttr("INSTALLER PACKAGE: SIZE", B_INT32_TYPE, 0, &size, sizeof(size)) < 0) goto err; package->SetGroupName(group); package->SetSize(size); @@ -107,7 +107,7 @@ err: } -void +void Package::GetSizeAsString(char *string) { SizeAsString(fSize, string); @@ -124,8 +124,8 @@ Group::~Group() } -PackageCheckBox::PackageCheckBox(BRect rect, Package *item) - : BCheckBox(rect.OffsetBySelf(7,0), "pack_cb", item->Name(), NULL), +PackageCheckBox::PackageCheckBox(BRect rect, Package *item) + : BCheckBox(rect.OffsetBySelf(7, 0), "pack_cb", item->Name(), NULL), fPackage(item) { } @@ -137,7 +137,7 @@ PackageCheckBox::~PackageCheckBox() } -void +void PackageCheckBox::Draw(BRect update) { BCheckBox::Draw(update); @@ -182,7 +182,7 @@ GroupView::~GroupView() PackagesView::PackagesView(BRect rect, const char* name) - : BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_FRAME_EVENTS) + : BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS) { } @@ -203,7 +203,7 @@ PackagesView::Clean() delete view; } } - ScrollTo(0,0); + ScrollTo(0, 0); } @@ -217,9 +217,9 @@ PackagesView::AddPackages(BList &packages, BMessage *msg) rect.bottom = 15; rect.top = 0; BString lastGroup = ""; - for (int32 i=0; i (item); + Package *package = static_cast(item); if (lastGroup != BString(package->GroupName())) { rect.OffsetBy(0, 1); lastGroup = package->GroupName(); @@ -246,20 +246,20 @@ PackagesView::AddPackages(BList &packages, BMessage *msg) } else { vertScroller->SetRange(0.0f, rect.top - vertScroller->Bounds().Height()); vertScroller->SetProportion(vertScroller->Bounds().Height() / rect.top); - } + } vertScroller->SetSteps(15, vertScroller->Bounds().Height()); - + Invalidate(); } -void +void PackagesView::GetTotalSizeAsString(char *string) { int32 count = CountChildren(); int32 size = 0; - for (int32 i=0; i(ChildAt(i)); if (cb && cb->Value()) size += cb->GetPackage()->Size(); @@ -268,12 +268,12 @@ PackagesView::GetTotalSizeAsString(char *string) } -void +void PackagesView::GetPackagesToInstall(BList *list, int32 *size) { int32 count = CountChildren(); *size = 0; - for (int32 i=0; i(ChildAt(i)); if (cb && cb->Value()) { list->AddItem(cb->GetPackage()); diff --git a/src/apps/installer/PackageViews.h b/src/apps/installer/PackageViews.h index f1767443df..3f660c3eac 100644 --- a/src/apps/installer/PackageViews.h +++ b/src/apps/installer/PackageViews.h @@ -15,44 +15,44 @@ #include class Group { -public: - Group(); - virtual ~Group(); - void SetGroupName(const char *group) { strcpy(fGroup, group); }; - const char * GroupName() const { return fGroup; }; -private: - char fGroup[64]; + public: + Group(); + virtual ~Group(); + void SetGroupName(const char *group) { strcpy(fGroup, group); }; + const char * GroupName() const { return fGroup; }; + private: + char fGroup[64]; }; class Package : public Group { -public: - Package(const char *folder); - virtual ~Package(); - void SetFolder(const char *folder) { strcpy(fFolder, folder); }; - void SetName(const char *name) { strcpy(fName, name);}; - void SetDescription(const char *description) { strcpy(fDescription, description);}; - void SetSize(const int32 size) { fSize = size; }; - void SetIcon(BBitmap * icon) { delete fIcon; fIcon = icon; }; - void SetOnByDefault(bool onByDefault) { fOnByDefault = onByDefault; }; - void SetAlwaysOn(bool alwaysOn) { fAlwaysOn = alwaysOn; }; - const char * Folder() const { return fFolder; }; - const char * Name() const { return fName; }; - const char * Description() const { return fDescription; }; - const int32 Size() const { return fSize; }; - void GetSizeAsString(char *string); - const BBitmap * Icon() const { return fIcon; }; - bool OnByDefault() const { return fOnByDefault; }; - bool AlwaysOn() const { return fAlwaysOn; }; + public: + Package(const char *folder); + virtual ~Package(); + void SetFolder(const char *folder) { strcpy(fFolder, folder); }; + void SetName(const char *name) { strcpy(fName, name);}; + void SetDescription(const char *description) { strcpy(fDescription, description);}; + void SetSize(const int32 size) { fSize = size; }; + void SetIcon(BBitmap * icon) { delete fIcon; fIcon = icon; }; + void SetOnByDefault(bool onByDefault) { fOnByDefault = onByDefault; }; + void SetAlwaysOn(bool alwaysOn) { fAlwaysOn = alwaysOn; }; + const char * Folder() const { return fFolder; }; + const char * Name() const { return fName; }; + const char * Description() const { return fDescription; }; + const int32 Size() const { return fSize; }; + void GetSizeAsString(char *string); + const BBitmap * Icon() const { return fIcon; }; + bool OnByDefault() const { return fOnByDefault; }; + bool AlwaysOn() const { return fAlwaysOn; }; - static Package *PackageFromEntry(BEntry &dir); -private: - char fFolder[64]; - char fName[64]; - char fDescription[64]; - int32 fSize; - BBitmap *fIcon; - bool fAlwaysOn, fOnByDefault; + static Package *PackageFromEntry(BEntry &dir); + private: + char fFolder[64]; + char fName[64]; + char fDescription[64]; + int32 fSize; + BBitmap *fIcon; + bool fAlwaysOn, fOnByDefault; }; @@ -78,15 +78,15 @@ class GroupView : public BStringView { class PackagesView : public BView { -public: - PackagesView(BRect rect, const char* name); - virtual ~PackagesView(); - void Clean(); - void AddPackages(BList &list, BMessage *msg); - void GetTotalSizeAsString(char *string); - void GetPackagesToInstall(BList *list, int32 *size); -private: - BList fViews; + public: + PackagesView(BRect rect, const char* name); + virtual ~PackagesView(); + void Clean(); + void AddPackages(BList &list, BMessage *msg); + void GetTotalSizeAsString(char *string); + void GetPackagesToInstall(BList *list, int32 *size); + private: + BList fViews; }; #endif /* __PACKAGEVIEWS_H__ */ diff --git a/src/apps/installer/PartitionMenuItem.cpp b/src/apps/installer/PartitionMenuItem.cpp index 163d1f4860..6c8d959a6d 100644 --- a/src/apps/installer/PartitionMenuItem.cpp +++ b/src/apps/installer/PartitionMenuItem.cpp @@ -9,8 +9,8 @@ #include "PartitionMenuItem.h" -PartitionMenuItem::PartitionMenuItem(const char *name, const char *label, const char *menuLabel, - BMessage *msg, partition_id id) +PartitionMenuItem::PartitionMenuItem(const char *name, const char *label, const char *menuLabel, + BMessage *msg, partition_id id) : BMenuItem(label, msg) { fID = id; diff --git a/src/apps/installer/PartitionMenuItem.h b/src/apps/installer/PartitionMenuItem.h index d42b89879d..d4b244f69d 100644 --- a/src/apps/installer/PartitionMenuItem.h +++ b/src/apps/installer/PartitionMenuItem.h @@ -14,12 +14,12 @@ const uint32 TARGET_PARTITION = 'iTPT'; class PartitionMenuItem : public BMenuItem { public: - PartitionMenuItem(const char *name, const char *label, + PartitionMenuItem(const char *name, const char *label, const char* menuLabel, BMessage *msg, partition_id id); ~PartitionMenuItem(); partition_id ID() const { return fID; }; - const char *MenuLabel() { return fMenuLabel ? fMenuLabel : Label(); }; - const char *Name() { return fName ? fName : Label(); }; + const char *MenuLabel() { return fMenuLabel ? fMenuLabel : Label(); }; + const char *Name() { return fName ? fName : Label(); }; private: partition_id fID; char *fMenuLabel;