* fixed all build warnings by collectcatkeys that I found

* automatic whitespace cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37747 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2010-07-25 22:58:29 +00:00
parent ad51686353
commit 8eff03f570
23 changed files with 252 additions and 227 deletions
+1 -1
View File
@@ -250,7 +250,7 @@ DefaultPartitionPage::_CreatePopUpMenu()
void void
DefaultPartitionPage::_GetTimeoutLabel(int32 timeout, BString& label) DefaultPartitionPage::_GetTimeoutLabel(int32 timeout, BString& label)
{ {
const char* text = B_TRANSLATE(get_label_for_timeout(timeout)); const char* text = B_TRANSLATE_NOCOLLECT(get_label_for_timeout(timeout));
label = B_TRANSLATE("Timeout: %s"); label = B_TRANSLATE("Timeout: %s");
label.ReplaceFirst("%s", text); label.ReplaceFirst("%s", text);
} }
+8 -7
View File
@@ -170,8 +170,9 @@ TBeMenu::AddNextItem()
bool enabled = false; bool enabled = false;
for (int i = 0; i < recentTypes; i++) { for (int i = 0; i < recentTypes; i++) {
recentItem[i] = new TRecentsMenu(B_TRANSLATE(recentTitle[i]), recentItem[i]
fBarView, recentType[i]); = new TRecentsMenu(B_TRANSLATE_NOCOLLECT(recentTitle[i]),
fBarView, recentType[i]);
if (recentItem[i]) if (recentItem[i])
enabled |= recentItem[i]->RecentsEnabled(); enabled |= recentItem[i]->RecentsEnabled();
@@ -252,9 +253,9 @@ TBeMenu::AddStandardBeMenuItems()
item = new BMenuItem( item = new BMenuItem(
#ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL #ifdef HAIKU_DISTRO_COMPATIBILITY_OFFICIAL
B_TRANSLATE(kAboutHaikuMenuItemStr) B_TRANSLATE_NOCOLLECT(kAboutHaikuMenuItemStr)
#else #else
B_TRANSLATE(kAboutThisSystemMenuItemStr) B_TRANSLATE_NOCOLLECT(kAboutThisSystemMenuItemStr)
#endif #endif
, new BMessage(kShowSplash)); , new BMessage(kShowSplash));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
@@ -268,7 +269,7 @@ TBeMenu::AddStandardBeMenuItems()
TrackerBuildRecentFindItemsMenu(kFindMenuItemStr), TrackerBuildRecentFindItemsMenu(kFindMenuItemStr),
new BMessage(kFindButton)); new BMessage(kFindButton));
#else #else
item = new BMenuItem(B_TRANSLATE(kFindMenuItemStr), item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kFindMenuItemStr),
new BMessage(kFindButton)); new BMessage(kFindButton));
#endif #endif
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
@@ -284,7 +285,7 @@ TBeMenu::AddStandardBeMenuItems()
#ifdef MOUNT_MENU_IN_DESKBAR #ifdef MOUNT_MENU_IN_DESKBAR
DeskbarMountMenu* mountMenu = new DeskbarMountMenu( DeskbarMountMenu* mountMenu = new DeskbarMountMenu(
B_TRANSLATE(kMountMenuStr)); B_TRANSLATE_NOCOLLECT(kMountMenuStr));
mountMenu->SetEnabled(!dragging); mountMenu->SetEnabled(!dragging);
AddItem(mountMenu); AddItem(mountMenu);
#endif #endif
@@ -307,7 +308,7 @@ TBeMenu::AddStandardBeMenuItems()
static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend"); static const char* kSuspendMenuItemStr = B_TRANSLATE_MARK("Suspend");
if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) { if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
item = new BMenuItem(B_TRANSLATE(kSuspendMenuItemStr), item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSuspendMenuItemStr),
new BMessage(kSuspendSystem)); new BMessage(kSuspendSystem));
item->SetEnabled(!dragging); item->SetEnabled(!dragging);
shutdownMenu->AddItem(item); shutdownMenu->AddItem(item);
+1 -1
View File
@@ -232,7 +232,7 @@ PairsWindow::MessageReceived(BMessage* message)
strAbout.Replace("%s", score.String(), 1); strAbout.Replace("%s", score.String(), 1);
BAlert* alert = new BAlert("about", BAlert* alert = new BAlert("about",
B_TRANSLATE(strAbout.String()), strAbout.String(),
B_TRANSLATE("New game"), B_TRANSLATE("New game"),
B_TRANSLATE("Quit game")); B_TRANSLATE("Quit game"));
+11 -10
View File
@@ -131,7 +131,7 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent,
_ReadSettings(); _ReadSettings();
// _NewScreenshot() needs a valid fNameControl // _NewScreenshot() needs a valid fNameControl
BString name(B_TRANSLATE(fUtility.sDefaultFileNameBase)); BString name(B_TRANSLATE_NOCOLLECT(fUtility.sDefaultFileNameBase));
name << 1; name << 1;
name = _FindValidFileName(name.String()); name = _FindValidFileName(name.String());
fNameControl = new BTextControl("", B_TRANSLATE("Name:"), name, NULL); fNameControl = new BTextControl("", B_TRANSLATE("Name:"), name, NULL);
@@ -141,7 +141,7 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent,
_NewScreenshot(silent, clipboard); _NewScreenshot(silent, clipboard);
return; return;
} }
fScreenshot = fUtility.MakeScreenshot(fIncludeCursor, fGrabActiveWindow, fScreenshot = fUtility.MakeScreenshot(fIncludeCursor, fGrabActiveWindow,
fIncludeBorder); fIncludeBorder);
@@ -192,7 +192,7 @@ ScreenshotWindow::ScreenshotWindow(const Utility& utility, bool silent,
.Add(fNameControl->CreateTextViewLayoutItem(), 1, 0) .Add(fNameControl->CreateTextViewLayoutItem(), 1, 0)
.Add(menuField->CreateLabelLayoutItem(), 0, 1) .Add(menuField->CreateLabelLayoutItem(), 0, 1)
.Add(menuField->CreateMenuBarLayoutItem(), 1, 1) .Add(menuField->CreateMenuBarLayoutItem(), 1, 1)
.Add(new BButton("", B_TRANSLATE("Settings"B_UTF8_ELLIPSIS), .Add(new BButton("", B_TRANSLATE("Settings"B_UTF8_ELLIPSIS),
new BMessage(kSettings)), 2, 1) new BMessage(kSettings)), 2, 1)
.Add(menuField2->CreateLabelLayoutItem(), 0, 2) .Add(menuField2->CreateLabelLayoutItem(), 0, 2)
.Add(menuField2->CreateMenuBarLayoutItem(), 1, 2); .Add(menuField2->CreateMenuBarLayoutItem(), 1, 2);
@@ -339,11 +339,11 @@ ScreenshotWindow::MessageReceived(BMessage* message)
case B_COPY: case B_COPY:
fUtility.CopyToClipboard(fScreenshot); fUtility.CopyToClipboard(fScreenshot);
break; break;
case kSettings: case kSettings:
_ShowSettings(true); _ShowSettings(true);
break; break;
case kCloseTranslatorSettings: case kCloseTranslatorSettings:
fSettingsWindow->Lock(); fSettingsWindow->Lock();
fSettingsWindow->Quit(); fSettingsWindow->Quit();
@@ -376,7 +376,7 @@ ScreenshotWindow::_NewScreenshot(bool silent, bool clipboard)
message.AddString("argv", "screenshot"); message.AddString("argv", "screenshot");
message.AddString("argv", "--delay"); message.AddString("argv", "--delay");
message.AddString("argv", delay); message.AddString("argv", delay);
if (silent || clipboard) { if (silent || clipboard) {
if (silent) { if (silent) {
argc++; argc++;
@@ -419,7 +419,7 @@ ScreenshotWindow::_UpdatePreviewPanel()
{ {
float height = 150.0f; float height = 150.0f;
float width = (fScreenshot->Bounds().Width() float width = (fScreenshot->Bounds().Width()
/ fScreenshot->Bounds().Height()) * height; / fScreenshot->Bounds().Height()) * height;
// to prevent a preview way too wide // to prevent a preview way too wide
@@ -595,7 +595,7 @@ ScreenshotWindow::_ShowSettings(bool activate)
{ {
if (!fSettingsWindow && !activate) if (!fSettingsWindow && !activate)
return; return;
// Find a translator // Find a translator
translator_id translator = 0; translator_id translator = 0;
BTranslatorRoster *roster = BTranslatorRoster::Default(); BTranslatorRoster *roster = BTranslatorRoster::Default();
@@ -643,7 +643,7 @@ ScreenshotWindow::_ShowSettings(bool activate)
if (activate) if (activate)
fSettingsWindow->Activate(); fSettingsWindow->Activate();
} else { } else {
fSettingsWindow = new BWindow(rect, fSettingsWindow = new BWindow(rect,
B_TRANSLATE("Translator Settings"), B_TRANSLATE("Translator Settings"),
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE); B_NOT_ZOOMABLE | B_NOT_RESIZABLE);
@@ -681,7 +681,8 @@ ScreenshotWindow::_FindValidFileName(const char* name)
if (!BEntry(outputPath.Path()).Exists()) if (!BEntry(outputPath.Path()).Exists())
return fileName; return fileName;
if (baseName.FindFirst(B_TRANSLATE(fUtility.sDefaultFileNameBase)) == 0) if (baseName.FindFirst(B_TRANSLATE_NOCOLLECT(
fUtility.sDefaultFileNameBase)) == 0)
baseName.SetTo(fUtility.sDefaultFileNameBase); baseName.SetTo(fUtility.sDefaultFileNameBase);
BEntry entry; BEntry entry;
+4 -4
View File
@@ -36,7 +36,7 @@
#define B_TRANSLATE_CONTEXT "Screenshot" #define B_TRANSLATE_CONTEXT "Screenshot"
const char* Utility::sDefaultFileNameBase = const char* Utility::sDefaultFileNameBase =
B_TRANSLATE_MARK_COMMENT("screenshot", B_TRANSLATE_MARK_COMMENT("screenshot",
"Base filename of screenshot files"); "Base filename of screenshot files");
@@ -97,8 +97,8 @@ Utility::Save(BBitmap** screenshot, const char* fileName, uint32 imageType)
BString extension = GetFileNameExtension(imageType); BString extension = GetFileNameExtension(imageType);
do { do {
fileNameString.SetTo(homePath.Path()); fileNameString.SetTo(homePath.Path());
fileNameString << "/" << B_TRANSLATE(sDefaultFileNameBase) << index++ fileNameString << "/" << B_TRANSLATE_NOCOLLECT(sDefaultFileNameBase)
<< extension; << index++ << extension;
entry.SetTo(fileNameString.String()); entry.SetTo(fileNameString.String());
} while (entry.Exists()); } while (entry.Exists());
} }
@@ -156,7 +156,7 @@ Utility::MakeScreenshot(bool includeMouse, bool activeWindow,
if (activeWindow && activeWindowFrame.IsValid()) { if (activeWindow && activeWindowFrame.IsValid()) {
BRect frame(activeWindowFrame); BRect frame(activeWindowFrame);
if (includeBorder) { if (includeBorder) {
frame.InsetBy(-borderSize, -borderSize); frame.InsetBy(-borderSize, -borderSize);
frame.top -= tabFrame.bottom - tabFrame.top; frame.top -= tabFrame.bottom - tabFrame.top;
+29 -27
View File
@@ -781,7 +781,8 @@ InitCopy(CopyLoopControl* loopControl, uint32 moveMode,
// check for free space before starting copy // check for free space before starting copy
if ((totalSize + (4 * kKBSize)) >= dstVol->FreeBytes()) { if ((totalSize + (4 * kKBSize)) >= dstVol->FreeBytes()) {
BAlert* alert = new BAlert("", BAlert* alert = new BAlert("",
B_TRANSLATE(kNoFreeSpace), B_TRANSLATE("Cancel"), B_TRANSLATE_NOCOLLECT(kNoFreeSpace),
B_TRANSLATE("Cancel"),
0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT); 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->Go(); alert->Go();
@@ -1084,8 +1085,8 @@ CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir,
// check for free space first // check for free space first
if ((srcStat->st_size + kKBSize) >= volume.FreeBytes()) { if ((srcStat->st_size + kKBSize) >= volume.FreeBytes()) {
loopControl->FileError(B_TRANSLATE(kNoFreeSpace), "", B_DEVICE_FULL, loopControl->FileError(B_TRANSLATE_NOCOLLECT(kNoFreeSpace), "",
false); B_DEVICE_FULL, false);
throw (status_t)B_DEVICE_FULL; throw (status_t)B_DEVICE_FULL;
} }
@@ -1131,8 +1132,8 @@ CopyFile(BEntry *srcFile, StatStruct *srcStat, BDirectory *destDir,
throw (status_t)err; throw (status_t)err;
if (err != B_OK) { if (err != B_OK) {
if (!loopControl->FileError(B_TRANSLATE(kFileErrorString), destName, if (!loopControl->FileError(B_TRANSLATE_NOCOLLECT(kFileErrorString),
err, true)) { destName, err, true)) {
throw (status_t)err; throw (status_t)err;
} else { } else {
// user selected continue in spite of error, update status bar // user selected continue in spite of error, update status bar
@@ -1453,8 +1454,8 @@ CopyFolder(BEntry *srcEntry, BDirectory *destDir, CopyLoopControl *loopControl,
} }
#endif #endif
if (err != B_OK) { if (err != B_OK) {
if (!loopControl->FileError(B_TRANSLATE(kFolderErrorString), if (!loopControl->FileError(B_TRANSLATE_NOCOLLECT(
destName, err, true)) { kFolderErrorString), destName, err, true)) {
throw err; throw err;
} }
@@ -1956,7 +1957,7 @@ PreFlightNameCheck(BObjectList<entry_ref> *srcList, const BDirectory *destDir,
if (*collisionCount > 1) { if (*collisionCount > 1) {
const char* verb = (moveMode == kMoveSelectionTo) const char* verb = (moveMode == kMoveSelectionTo)
? B_TRANSLATE("moving") : B_TRANSLATE("copying"); ? B_TRANSLATE("moving") : B_TRANSLATE("copying");
BString replaceMsg(B_TRANSLATE(kReplaceManyStr)); BString replaceMsg(B_TRANSLATE_NOCOLLECT(kReplaceManyStr));
replaceMsg.ReplaceAll("%verb", verb); replaceMsg.ReplaceAll("%verb", verb);
BAlert* alert = new BAlert("", replaceMsg.String(), BAlert* alert = new BAlert("", replaceMsg.String(),
@@ -2081,10 +2082,10 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
BString replaceMsg; BString replaceMsg;
if (moveMode == kCreateLink || moveMode == kCreateRelativeLink) { if (moveMode == kCreateLink || moveMode == kCreateRelativeLink) {
replaceMsg.SetTo(B_TRANSLATE(kSymLinkReplaceStr)); replaceMsg.SetTo(B_TRANSLATE_NOCOLLECT(kSymLinkReplaceStr));
replaceMsg.ReplaceFirst("%name", name); replaceMsg.ReplaceFirst("%name", name);
} else if (sourceEntry->IsDirectory()) { } else if (sourceEntry->IsDirectory()) {
replaceMsg.SetTo(B_TRANSLATE(kDirectoryReplaceStr)); replaceMsg.SetTo(B_TRANSLATE_NOCOLLECT(kDirectoryReplaceStr));
replaceMsg.ReplaceFirst("%name", name); replaceMsg.ReplaceFirst("%name", name);
replaceMsg.ReplaceFirst("%verb", replaceMsg.ReplaceFirst("%verb",
moveMode == kMoveSelectionTo moveMode == kMoveSelectionTo
@@ -2105,7 +2106,7 @@ CheckName(uint32 moveMode, const BEntry *sourceEntry,
else else
destBuffer[0] = '\0'; destBuffer[0] = '\0';
replaceMsg.SetTo(B_TRANSLATE(kReplaceStr)); replaceMsg.SetTo(B_TRANSLATE_NOCOLLECT(kReplaceStr));
replaceMsg.ReplaceAll("%name", name); replaceMsg.ReplaceAll("%name", name);
replaceMsg.ReplaceFirst("%dest", destBuffer); replaceMsg.ReplaceFirst("%dest", destBuffer);
replaceMsg.ReplaceFirst("%src", sourceBuffer); replaceMsg.ReplaceFirst("%src", sourceBuffer);
@@ -2195,8 +2196,8 @@ FSDeleteFolder(BEntry *dir_entry, CopyLoopControl *loopControl,
else if (err == B_OK) else if (err == B_OK)
dir.Rewind(); dir.Rewind();
else { else {
loopControl->FileError(B_TRANSLATE(kFileDeleteErrorString), loopControl->FileError(B_TRANSLATE_NOCOLLECT(
ref.name, err, false); kFileDeleteErrorString), ref.name, err, false);
} }
} }
@@ -2781,9 +2782,10 @@ _DeleteTask(BObjectList<entry_ref> *list, bool confirm)
if (!dontMoveToTrash) { if (!dontMoveToTrash) {
BAlert* alert = new BAlert("", BAlert* alert = new BAlert("",
B_TRANSLATE(kDeleteConfirmationStr), B_TRANSLATE("Cancel"), B_TRANSLATE_NOCOLLECT(kDeleteConfirmationStr),
B_TRANSLATE("Move to Trash"), B_TRANSLATE("Delete"), B_TRANSLATE("Cancel"), B_TRANSLATE("Move to Trash"),
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT); B_TRANSLATE("Delete"), B_WIDTH_AS_USUAL, B_OFFSET_SPACING,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'm'); alert->SetShortcut(1, 'm');
@@ -2799,9 +2801,9 @@ _DeleteTask(BObjectList<entry_ref> *list, bool confirm)
} }
} else { } else {
BAlert* alert = new BAlert("", BAlert* alert = new BAlert("",
B_TRANSLATE(kDeleteConfirmationStr), B_TRANSLATE("Cancel"), B_TRANSLATE_NOCOLLECT(kDeleteConfirmationStr),
B_TRANSLATE("Delete"), NULL, B_WIDTH_AS_USUAL, B_TRANSLATE("Cancel"), B_TRANSLATE("Delete"), NULL,
B_OFFSET_SPACING, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd'); alert->SetShortcut(1, 'd');
@@ -3191,7 +3193,7 @@ _TrackerLaunchAppWithDocuments(const entry_ref *appRef, const BMessage *refs,
alertString.ReplaceFirst("%name", appRef->name); alertString.ReplaceFirst("%name", appRef->name);
alertString.ReplaceFirst("%error", strerror(error)); alertString.ReplaceFirst("%error", strerror(error));
if (refs && openWithOK && error != B_SHUTTING_DOWN) { if (refs && openWithOK && error != B_SHUTTING_DOWN) {
alertString << B_TRANSLATE(kFindAlternativeStr); alertString << B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
BAlert* alert = new BAlert("", alertString.String(), BAlert* alert = new BAlert("", alertString.String(),
B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0, B_WIDTH_AS_USUAL, B_TRANSLATE("Cancel"), B_TRANSLATE("Find"), 0, B_WIDTH_AS_USUAL,
B_WARNING_ALERT); B_WARNING_ALERT);
@@ -3348,7 +3350,7 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
alertString.ReplaceFirst("%name", documentRef.name); alertString.ReplaceFirst("%name", documentRef.name);
alertString.ReplaceFirst("%error", strerror(error)); alertString.ReplaceFirst("%error", strerror(error));
if (openWithOK) if (openWithOK)
alternative = B_TRANSLATE(kFindApplicationStr); alternative = B_TRANSLATE_NOCOLLECT(kFindApplicationStr);
break; break;
} else { } else {
@@ -3431,19 +3433,19 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
return; return;
} }
alternative = B_TRANSLATE(kFindApplicationStr); alternative = B_TRANSLATE_NOCOLLECT(kFindApplicationStr);
} else if (error == B_LAUNCH_FAILED_APP_IN_TRASH) { } else if (error == B_LAUNCH_FAILED_APP_IN_TRASH) {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" " alertString.SetTo(B_TRANSLATE("Could not open \"%document\" "
"because application \"%app\" is in the Trash. ")); "because application \"%app\" is in the Trash. "));
alertString.ReplaceFirst("%document", documentRef.name); alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name); alertString.ReplaceFirst("%app", app.name);
alternative = B_TRANSLATE(kFindAlternativeStr); alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} else if (error == B_LAUNCH_FAILED_APP_NOT_FOUND) { } else if (error == B_LAUNCH_FAILED_APP_NOT_FOUND) {
alertString.SetTo( alertString.SetTo(
B_TRANSLATE("Could not open \"%name\" (%error). ")); B_TRANSLATE("Could not open \"%name\" (%error). "));
alertString.ReplaceFirst("%name", documentRef.name); alertString.ReplaceFirst("%name", documentRef.name);
alertString.ReplaceFirst("%error", strerror(error)); alertString.ReplaceFirst("%error", strerror(error));
alternative = B_TRANSLATE(kFindAlternativeStr); alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} else if (error == B_MISSING_SYMBOL } else if (error == B_MISSING_SYMBOL
&& LoaderErrorDetails(&app, loaderErrorString) == B_OK) { && LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
if (openedDocuments) { if (openedDocuments) {
@@ -3458,7 +3460,7 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
alertString.ReplaceFirst("%document", documentRef.name); alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%symbol", loaderErrorString.String()); alertString.ReplaceFirst("%symbol", loaderErrorString.String());
} }
alternative = B_TRANSLATE(kFindAlternativeStr); alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} else if (error == B_MISSING_LIBRARY } else if (error == B_MISSING_LIBRARY
&& LoaderErrorDetails(&app, loaderErrorString) == B_OK) { && LoaderErrorDetails(&app, loaderErrorString) == B_OK) {
if (openedDocuments) { if (openedDocuments) {
@@ -3474,14 +3476,14 @@ _TrackerLaunchDocuments(const entry_ref */*doNotUse*/, const BMessage *refs,
alertString.ReplaceFirst("%document", documentRef.name); alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%library", loaderErrorString.String()); alertString.ReplaceFirst("%library", loaderErrorString.String());
} }
alternative = B_TRANSLATE(kFindAlternativeStr); alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} else { } else {
alertString.SetTo(B_TRANSLATE("Could not open \"%document\" with " alertString.SetTo(B_TRANSLATE("Could not open \"%document\" with "
"application \"%app\" (%error). ")); "application \"%app\" (%error). "));
alertString.ReplaceFirst("%document", documentRef.name); alertString.ReplaceFirst("%document", documentRef.name);
alertString.ReplaceFirst("%app", app.name); alertString.ReplaceFirst("%app", app.name);
alertString.ReplaceFirst("%error", strerror(error)); alertString.ReplaceFirst("%error", strerror(error));
alternative = B_TRANSLATE(kFindAlternativeStr); alternative = B_TRANSLATE_NOCOLLECT(kFindAlternativeStr);
} }
} }
+7 -5
View File
@@ -733,9 +733,9 @@ FindPanel::FindPanel(BRect frame, BFile *node, FindWindow *parent,
dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[0]); dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[0]);
dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[1]); dragNDropMessage.AddString("be:filetypes", kDragNDropTypes[1]);
dragNDropMessage.AddString("be:actionspecifier", dragNDropMessage.AddString("be:actionspecifier",
B_TRANSLATE(kDragNDropActionSpecifiers[0])); B_TRANSLATE_NOCOLLECT(kDragNDropActionSpecifiers[0]));
dragNDropMessage.AddString("be:actionspecifier", dragNDropMessage.AddString("be:actionspecifier",
B_TRANSLATE(kDragNDropActionSpecifiers[1])); B_TRANSLATE_NOCOLLECT(kDragNDropActionSpecifiers[1]));
BMessenger self(this); BMessenger self(this);
fDraggableIcon = new DraggableQueryIcon(DraggableIcon::PreferredRect(draggableIconOrigin, fDraggableIcon = new DraggableQueryIcon(DraggableIcon::PreferredRect(draggableIconOrigin,
@@ -1132,11 +1132,13 @@ FindPanel::MessageReceived(BMessage *message)
if (actionSpecifier if (actionSpecifier
&& strcasecmp(actionSpecifier, && strcasecmp(actionSpecifier,
B_TRANSLATE(kDragNDropActionSpecifiers[0])) == 0) { B_TRANSLATE_NOCOLLECT(
kDragNDropActionSpecifiers[0])) == 0) {
query = true; query = true;
} else if (actionSpecifier } else if (actionSpecifier
&& strcasecmp(actionSpecifier, && strcasecmp(actionSpecifier,
B_TRANSLATE(kDragNDropActionSpecifiers[1])) == 0) { B_TRANSLATE_NOCOLLECT(
kDragNDropActionSpecifiers[1])) == 0) {
queryTemplate = true; queryTemplate = true;
} else if (mimeType && strcasecmp(mimeType, } else if (mimeType && strcasecmp(mimeType,
kDragNDropTypes[0]) == 0) { kDragNDropTypes[0]) == 0) {
@@ -2391,7 +2393,7 @@ TAttrView::TAttrView(BRect frame, int32 index)
for (int32 i = 0; i < 5; i++) { for (int32 i = 0; i < 5; i++) {
message = new BMessage(kAttributeItem); message = new BMessage(kAttributeItem);
message->AddInt32("operator", operators[i]); message->AddInt32("operator", operators[i]);
submenu->AddItem(new BMenuItem(B_TRANSLATE(operatorLabels[i]), submenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(operatorLabels[i]),
message)); message));
} }
+81 -81
View File
@@ -112,7 +112,7 @@ Model::Model(const Model &cloneThis)
{ {
fStatBuf.st_dev = cloneThis.NodeRef()->device; fStatBuf.st_dev = cloneThis.NodeRef()->device;
fStatBuf.st_ino = cloneThis.NodeRef()->node; fStatBuf.st_ino = cloneThis.NodeRef()->node;
if (cloneThis.IsSymLink() && cloneThis.LinkTo()) if (cloneThis.IsSymLink() && cloneThis.LinkTo())
fLinkTo = new Model(*cloneThis.LinkTo()); fLinkTo = new Model(*cloneThis.LinkTo());
@@ -164,7 +164,7 @@ Model::Model(const entry_ref *ref, bool traverse, bool open, bool writable)
} }
void void
Model::DeletePreferredAppVolumeNameLinkTo() Model::DeletePreferredAppVolumeNameLinkTo()
{ {
if (IsSymLink()) { if (IsSymLink()) {
@@ -185,9 +185,9 @@ Model::DeletePreferredAppVolumeNameLinkTo()
Model::~Model() Model::~Model()
{ {
#ifdef CHECK_OPEN_MODEL_LEAKS #ifdef CHECK_OPEN_MODEL_LEAKS
if (writableOpenModelList) if (writableOpenModelList)
writableOpenModelList->RemoveItem(this); writableOpenModelList->RemoveItem(this);
if (readOnlyOpenModelList) if (readOnlyOpenModelList)
readOnlyOpenModelList->RemoveItem(this); readOnlyOpenModelList->RemoveItem(this);
#endif #endif
@@ -205,7 +205,7 @@ Model::~Model()
} }
status_t status_t
Model::SetTo(const BEntry *entry, bool open, bool writable) Model::SetTo(const BEntry *entry, bool open, bool writable)
{ {
delete fNode; delete fNode;
@@ -218,20 +218,20 @@ Model::SetTo(const BEntry *entry, bool open, bool writable)
fStatus = entry->GetRef(&fEntryRef); fStatus = entry->GetRef(&fEntryRef);
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
fStatus = entry->GetStat(&fStatBuf); fStatus = entry->GetStat(&fStatBuf);
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
fStatus = OpenNode(writable); fStatus = OpenNode(writable);
if (!open) if (!open)
CloseNode(); CloseNode();
return fStatus; return fStatus;
} }
status_t status_t
Model::SetTo(const entry_ref *newRef, bool traverse, bool open, bool writable) Model::SetTo(const entry_ref *newRef, bool traverse, bool open, bool writable)
{ {
delete fNode; delete fNode;
@@ -254,16 +254,16 @@ Model::SetTo(const entry_ref *newRef, bool traverse, bool open, bool writable)
fStatus = tmpEntry.GetStat(&fStatBuf); fStatus = tmpEntry.GetStat(&fStatBuf);
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
fStatus = OpenNode(writable); fStatus = OpenNode(writable);
if (!open) if (!open)
CloseNode(); CloseNode();
return fStatus; return fStatus;
} }
status_t status_t
Model::SetTo(const node_ref *dirNode, const node_ref *nodeRef, const char *name, Model::SetTo(const node_ref *dirNode, const node_ref *nodeRef, const char *name,
bool open, bool writable) bool open, bool writable)
{ {
@@ -284,7 +284,7 @@ Model::SetTo(const node_ref *dirNode, const node_ref *nodeRef, const char *name,
fStatus = tmpNode.InitCheck(); fStatus = tmpNode.InitCheck();
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
fStatus = tmpNode.GetStat(&fStatBuf); fStatus = tmpNode.GetStat(&fStatBuf);
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
@@ -293,12 +293,12 @@ Model::SetTo(const node_ref *dirNode, const node_ref *nodeRef, const char *name,
if (!open) if (!open)
CloseNode(); CloseNode();
return fStatus; return fStatus;
} }
status_t status_t
Model::InitCheck() const Model::InitCheck() const
{ {
return fStatus; return fStatus;
@@ -339,18 +339,18 @@ Model::Name() const
switch (fBaseType) { switch (fBaseType) {
case kRootNode: case kRootNode:
return B_TRANSLATE(kRootNodeName); return B_TRANSLATE_NOCOLLECT(kRootNodeName);
case kVolumeNode: case kVolumeNode:
if (fVolumeName) if (fVolumeName)
return fVolumeName; return fVolumeName;
break; break;
case kTrashNode: case kTrashNode:
return B_TRANSLATE(kTrashNodeName); return B_TRANSLATE_NOCOLLECT(kTrashNodeName);
case kDesktopNode: case kDesktopNode:
return B_TRANSLATE(kDesktopNodeName); return B_TRANSLATE_NOCOLLECT(kDesktopNodeName);
default: default:
break; break;
@@ -359,29 +359,29 @@ Model::Name() const
} }
status_t status_t
Model::OpenNode(bool writable) Model::OpenNode(bool writable)
{ {
if (IsNodeOpen() && (writable == IsNodeOpenForWriting())) if (IsNodeOpen() && (writable == IsNodeOpenForWriting()))
return B_OK; return B_OK;
OpenNodeCommon(writable); OpenNodeCommon(writable);
return fStatus; return fStatus;
} }
status_t status_t
Model::UpdateStatAndOpenNode(bool writable) Model::UpdateStatAndOpenNode(bool writable)
{ {
if (IsNodeOpen() && (writable == IsNodeOpenForWriting())) if (IsNodeOpen() && (writable == IsNodeOpenForWriting()))
return B_OK; return B_OK;
// try reading the stat structure again // try reading the stat structure again
BEntry tmpEntry(&fEntryRef); BEntry tmpEntry(&fEntryRef);
fStatus = tmpEntry.InitCheck(); fStatus = tmpEntry.InitCheck();
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
fStatus = tmpEntry.GetStat(&fStatBuf); fStatus = tmpEntry.GetStat(&fStatBuf);
if (fStatus != B_OK) if (fStatus != B_OK)
return fStatus; return fStatus;
@@ -399,9 +399,9 @@ Model::OpenNodeCommon(bool writable)
#endif #endif
#ifdef CHECK_OPEN_MODEL_LEAKS #ifdef CHECK_OPEN_MODEL_LEAKS
if (writableOpenModelList) if (writableOpenModelList)
writableOpenModelList->RemoveItem(this); writableOpenModelList->RemoveItem(this);
if (readOnlyOpenModelList) if (readOnlyOpenModelList)
readOnlyOpenModelList->RemoveItem(this); readOnlyOpenModelList->RemoveItem(this);
#endif #endif
@@ -486,7 +486,7 @@ Model::OpenNodeCommon(bool writable)
} }
void void
Model::CloseNode() Model::CloseNode()
{ {
#if xDEBUG #if xDEBUG
@@ -494,9 +494,9 @@ Model::CloseNode()
#endif #endif
#ifdef CHECK_OPEN_MODEL_LEAKS #ifdef CHECK_OPEN_MODEL_LEAKS
if (writableOpenModelList) if (writableOpenModelList)
writableOpenModelList->RemoveItem(this); writableOpenModelList->RemoveItem(this);
if (readOnlyOpenModelList) if (readOnlyOpenModelList)
readOnlyOpenModelList->RemoveItem(this); readOnlyOpenModelList->RemoveItem(this);
#endif #endif
@@ -505,7 +505,7 @@ Model::CloseNode()
} }
bool bool
Model::IsNodeOpen() const Model::IsNodeOpen() const
{ {
return fNode != NULL; return fNode != NULL;
@@ -513,7 +513,7 @@ Model::IsNodeOpen() const
bool bool
Model::IsNodeOpenForWriting() const Model::IsNodeOpenForWriting() const
{ {
return fNode != NULL && fWritable; return fNode != NULL && fWritable;
@@ -531,10 +531,10 @@ Model::SetupBaseType()
case S_IFREG: case S_IFREG:
// regular file // regular file
if (fStatBuf.st_mode & S_IXUSR) if (fStatBuf.st_mode & S_IXUSR)
// executable // executable
fBaseType = kExecutableNode; fBaseType = kExecutableNode;
else else
// non-executable // non-executable
fBaseType = kPlainNode; fBaseType = kPlainNode;
break; break;
@@ -602,7 +602,7 @@ Model::FinishSettingUpType()
DeletePreferredAppVolumeNameLinkTo(); DeletePreferredAppVolumeNameLinkTo();
if (mimeString[0]) if (mimeString[0])
fPreferredAppName = strdup(mimeString); fPreferredAppName = strdup(mimeString);
} }
} }
} }
@@ -611,12 +611,12 @@ Model::FinishSettingUpType()
case kDirectoryNode: case kDirectoryNode:
entry.SetTo(&fEntryRef); entry.SetTo(&fEntryRef);
if (entry.InitCheck() == B_OK) { if (entry.InitCheck() == B_OK) {
if (FSIsTrashDir(&entry)) if (FSIsTrashDir(&entry))
fBaseType = kTrashNode; fBaseType = kTrashNode;
else if (FSIsDeskDir(&entry)) else if (FSIsDeskDir(&entry))
fBaseType = kDesktopNode; fBaseType = kDesktopNode;
} }
fMimeType = B_DIR_MIMETYPE; // should use a shared string here fMimeType = B_DIR_MIMETYPE; // should use a shared string here
if (IsNodeOpen()) { if (IsNodeOpen()) {
BNodeInfo info(fNode); BNodeInfo info(fNode);
@@ -678,7 +678,7 @@ Model::FinishSettingUpType()
DeletePreferredAppVolumeNameLinkTo(); DeletePreferredAppVolumeNameLinkTo();
if (signature[0]) if (signature[0])
fPreferredAppName = strdup(signature); fPreferredAppName = strdup(signature);
} }
} }
if (!fMimeType.Length()) if (!fMimeType.Length())
@@ -693,7 +693,7 @@ Model::FinishSettingUpType()
} }
void void
Model::ResetIconFrom() Model::ResetIconFrom()
{ {
BModelOpener opener(this); BModelOpener opener(this);
@@ -727,7 +727,7 @@ Model::PreferredAppSignature() const
} }
void void
Model::SetPreferredAppSignature(const char *signature) Model::SetPreferredAppSignature(const char *signature)
{ {
ASSERT(!IsVolume() && !IsSymLink()); ASSERT(!IsVolume() && !IsSymLink());
@@ -768,7 +768,7 @@ Model::ResolveIfLink()
} }
void void
Model::SetLinkTo(Model *model) Model::SetLinkTo(Model *model)
{ {
ASSERT(IsSymLink()); ASSERT(IsSymLink());
@@ -779,7 +779,7 @@ Model::SetLinkTo(Model *model)
} }
void void
Model::GetPreferredAppForBrokenSymLink(BString &result) Model::GetPreferredAppForBrokenSymLink(BString &result)
{ {
if (!IsSymLink() || LinkTo()) { if (!IsSymLink() || LinkTo()) {
@@ -788,7 +788,7 @@ Model::GetPreferredAppForBrokenSymLink(BString &result)
} }
BModelOpener opener(this); BModelOpener opener(this);
BNodeInfo info(fNode); BNodeInfo info(fNode);
status_t error = info.GetPreferredApp(result.LockBuffer(B_MIME_TYPE_LENGTH)); status_t error = info.GetPreferredApp(result.LockBuffer(B_MIME_TYPE_LENGTH));
result.UnlockBuffer(); result.UnlockBuffer();
@@ -806,7 +806,7 @@ Model::UpdateEntryRef(const node_ref *dirNode, const char *name)
if (IsVolume()) { if (IsVolume()) {
if (fVolumeName) if (fVolumeName)
DeletePreferredAppVolumeNameLinkTo(); DeletePreferredAppVolumeNameLinkTo();
fVolumeName = strdup(name); fVolumeName = strdup(name);
} }
@@ -820,11 +820,11 @@ Model::UpdateEntryRef(const node_ref *dirNode, const char *name)
} }
status_t status_t
Model::WatchVolumeAndMountPoint(uint32 , BHandler *target) Model::WatchVolumeAndMountPoint(uint32 , BHandler *target)
{ {
ASSERT(IsVolume()); ASSERT(IsVolume());
if (fEntryRef.name && fVolumeName if (fEntryRef.name && fVolumeName
&& strcmp(fEntryRef.name, "boot") == 0) { && strcmp(fEntryRef.name, "boot") == 0) {
// watch mount point for boot volume // watch mount point for boot volume
@@ -842,7 +842,7 @@ Model::WatchVolumeAndMountPoint(uint32 , BHandler *target)
} }
bool bool
Model::AttrChanged(const char *attrName) Model::AttrChanged(const char *attrName)
{ {
// called on an attribute changed node monitor // called on an attribute changed node monitor
@@ -865,7 +865,7 @@ Model::AttrChanged(const char *attrName)
fMimeType = ""; fMimeType = "";
else { else {
// node has a specific mime type // node has a specific mime type
fMimeType = mimeString; fMimeType = mimeString;
if (!IsVolume() if (!IsVolume()
&& !IsSymLink() && !IsSymLink()
&& info.GetPreferredApp(mimeString) == B_OK) && info.GetPreferredApp(mimeString) == B_OK)
@@ -890,7 +890,7 @@ Model::AttrChanged(const char *attrName)
} }
bool bool
Model::StatChanged() Model::StatChanged()
{ {
ASSERT(IsNodeOpen()); ASSERT(IsNodeOpen());
@@ -950,22 +950,22 @@ Model::IsDropTarget(const Model *forDocument, bool traverse) const
} }
Model::CanHandleResult Model::CanHandleResult
Model::CanHandleDrops() const Model::CanHandleDrops() const
{ {
if (IsDirectory()) if (IsDirectory())
// directories take anything // directories take anything
// resolve permissions here // resolve permissions here
return kCanHandle; return kCanHandle;
if (IsSymLink()) { if (IsSymLink()) {
// descend into symlink and try again on it's target // descend into symlink and try again on it's target
BEntry entry(&fEntryRef, true); BEntry entry(&fEntryRef, true);
if (entry.InitCheck() != B_OK) if (entry.InitCheck() != B_OK)
return kCannotHandle; return kCannotHandle;
if (entry == BEntry(EntryRef())) if (entry == BEntry(EntryRef()))
// self-referencing link, avoid infinite recursion // self-referencing link, avoid infinite recursion
return kCannotHandle; return kCannotHandle;
@@ -976,7 +976,7 @@ Model::CanHandleDrops() const
return model.CanHandleDrops(); return model.CanHandleDrops();
} }
if (IsExecutable()) if (IsExecutable())
return kNeedToCheckType; return kNeedToCheckType;
@@ -1007,7 +1007,7 @@ MatchMimeTypeString(/*const */BString *documentType, const char *handlerType)
int32 supertypeOnlyLength = 0; int32 supertypeOnlyLength = 0;
const char *tmp = strstr(handlerType, "/"); const char *tmp = strstr(handlerType, "/");
if (!tmp) if (!tmp)
// no subtype - supertype string only // no subtype - supertype string only
supertypeOnlyLength = (int32)strlen(handlerType); supertypeOnlyLength = (int32)strlen(handlerType);
@@ -1022,7 +1022,7 @@ MatchMimeTypeString(/*const */BString *documentType, const char *handlerType)
return kDontMatch; return kDontMatch;
} }
} }
if (documentType->ICompare(handlerType) == 0) if (documentType->ICompare(handlerType) == 0)
return kMatch; return kMatch;
@@ -1030,7 +1030,7 @@ MatchMimeTypeString(/*const */BString *documentType, const char *handlerType)
} }
int32 int32
Model::SupportsMimeType(const char *type, const BObjectList<BString> *list, Model::SupportsMimeType(const char *type, const BObjectList<BString> *list,
bool exactReason) const bool exactReason) const
{ {
@@ -1038,12 +1038,12 @@ Model::SupportsMimeType(const char *type, const BObjectList<BString> *list,
// pass in one or the other // pass in one or the other
int32 result = kDoesNotSupportType; int32 result = kDoesNotSupportType;
BFile file(EntryRef(), O_RDONLY); BFile file(EntryRef(), O_RDONLY);
BAppFileInfo handlerInfo(&file); BAppFileInfo handlerInfo(&file);
BMessage message; BMessage message;
if (handlerInfo.GetSupportedTypes(&message) != B_OK) if (handlerInfo.GetSupportedTypes(&message) != B_OK)
return kDoesNotSupportType; return kDoesNotSupportType;
for (int32 index = 0; ; index++) { for (int32 index = 0; ; index++) {
@@ -1053,17 +1053,17 @@ Model::SupportsMimeType(const char *type, const BObjectList<BString> *list,
int32 bufferLength; int32 bufferLength;
if (message.FindData("types", 'CSTR', index, (const void **)&mimeSignature, if (message.FindData("types", 'CSTR', index, (const void **)&mimeSignature,
&bufferLength)) &bufferLength))
return result; return result;
if (IsSuperHandlerSignature(mimeSignature)) { if (IsSuperHandlerSignature(mimeSignature)) {
if (!exactReason) if (!exactReason)
return kSuperhandlerModel; return kSuperhandlerModel;
if (result == kDoesNotSupportType) if (result == kDoesNotSupportType)
result = kSuperhandlerModel; result = kSuperhandlerModel;
} }
int32 match; int32 match;
if (type) { if (type) {
@@ -1073,12 +1073,12 @@ Model::SupportsMimeType(const char *type, const BObjectList<BString> *list,
match = WhileEachListItem(const_cast<BObjectList<BString> *>(list), match = WhileEachListItem(const_cast<BObjectList<BString> *>(list),
MatchMimeTypeString, mimeSignature); MatchMimeTypeString, mimeSignature);
// const_cast shouldnt be here, have to have it until MW cleans up // const_cast shouldnt be here, have to have it until MW cleans up
if (match == kMatch) if (match == kMatch)
// supports the actual type, it can't get any better // supports the actual type, it can't get any better
return kModelSupportsType; return kModelSupportsType;
else if (match == kMatchSupertype) { else if (match == kMatchSupertype) {
if (!exactReason) if (!exactReason)
return kModelSupportsSupertype; return kModelSupportsSupertype;
// we already know this model supports the file as a supertype, // we already know this model supports the file as a supertype,
@@ -1091,7 +1091,7 @@ Model::SupportsMimeType(const char *type, const BObjectList<BString> *list,
} }
bool bool
Model::IsDropTargetForList(const BObjectList<BString> *list) const Model::IsDropTargetForList(const BObjectList<BString> *list) const
{ {
switch (CanHandleDrops()) { switch (CanHandleDrops()) {
@@ -1100,7 +1100,7 @@ Model::IsDropTargetForList(const BObjectList<BString> *list) const
case kCannotHandle: case kCannotHandle:
return false; return false;
default: default:
break; break;
} }
@@ -1108,7 +1108,7 @@ Model::IsDropTargetForList(const BObjectList<BString> *list) const
} }
bool bool
Model::IsSuperHandler() const Model::IsSuperHandler() const
{ {
ASSERT(CanHandleDrops() == kNeedToCheckType); ASSERT(CanHandleDrops() == kNeedToCheckType);
@@ -1135,14 +1135,14 @@ Model::IsSuperHandler() const
} }
void void
Model::GetEntry(BEntry *entry) const Model::GetEntry(BEntry *entry) const
{ {
entry->SetTo(EntryRef()); entry->SetTo(EntryRef());
} }
void void
Model::GetPath(BPath *path) const Model::GetPath(BPath *path) const
{ {
BEntry entry(EntryRef()); BEntry entry(EntryRef());
@@ -1150,7 +1150,7 @@ Model::GetPath(BPath *path) const
} }
bool bool
Model::Mimeset(bool force) Model::Mimeset(bool force)
{ {
BString oldType = MimeType(); BString oldType = MimeType();
@@ -1172,12 +1172,12 @@ Model::Mimeset(bool force)
} }
ssize_t ssize_t
Model::WriteAttr(const char *attr, type_code type, off_t offset, Model::WriteAttr(const char *attr, type_code type, off_t offset,
const void *buffer, size_t length) const void *buffer, size_t length)
{ {
BModelWriteOpener opener(this); BModelWriteOpener opener(this);
if (!fNode) if (!fNode)
return 0; return 0;
ssize_t result = fNode->WriteAttr(attr, type, offset, buffer, length); ssize_t result = fNode->WriteAttr(attr, type, offset, buffer, length);
@@ -1185,14 +1185,14 @@ Model::WriteAttr(const char *attr, type_code type, off_t offset,
} }
ssize_t ssize_t
Model::WriteAttrKillForeign(const char *attr, const char *foreignAttr, Model::WriteAttrKillForeign(const char *attr, const char *foreignAttr,
type_code type, off_t offset, const void *buffer, size_t length) type_code type, off_t offset, const void *buffer, size_t length)
{ {
BModelWriteOpener opener(this); BModelWriteOpener opener(this);
if (!fNode) if (!fNode)
return 0; return 0;
ssize_t result = fNode->WriteAttr(attr, type, offset, buffer, length); ssize_t result = fNode->WriteAttr(attr, type, offset, buffer, length);
if (result == (ssize_t)length) if (result == (ssize_t)length)
// nuke attribute in opposite endianness // nuke attribute in opposite endianness
@@ -1201,7 +1201,7 @@ Model::WriteAttrKillForeign(const char *attr, const char *foreignAttr,
} }
status_t status_t
Model::GetLongVersionString(BString &result, version_kind kind) Model::GetLongVersionString(BString &result, version_kind kind)
{ {
BFile file(EntryRef(), O_RDONLY); BFile file(EntryRef(), O_RDONLY);
@@ -1223,7 +1223,7 @@ Model::GetLongVersionString(BString &result, version_kind kind)
return B_OK; return B_OK;
} }
status_t status_t
Model::GetVersionString(BString &result, version_kind kind) Model::GetVersionString(BString &result, version_kind kind)
{ {
BFile file(EntryRef(), O_RDONLY); BFile file(EntryRef(), O_RDONLY);
+1 -1
View File
@@ -85,7 +85,7 @@ APRView::APRView(const char *name, uint32 flags)
for (int32 i = 0; i < color_description_count(); i++) { for (int32 i = 0; i < color_description_count(); i++) {
const ColorDescription& description = *get_color_description(i); const ColorDescription& description = *get_color_description(i);
const char* text = B_TRANSLATE(description.text); const char* text = B_TRANSLATE_NOCOLLECT(description.text);
color_which which = description.which; color_which which = description.which;
fAttrList->AddItem(new ColorWhichItem(text, which)); fAttrList->AddItem(new ColorWhichItem(text, which));
} }
@@ -235,14 +235,15 @@ AntialiasingSettingsView::_BuildAntialiasingMenu()
BMessage* message = new BMessage(kMsgSetAntialiasing); BMessage* message = new BMessage(kMsgSetAntialiasing);
message->AddBool("antialiasing", false); message->AddBool("antialiasing", false);
BMenuItem* item = new BMenuItem(B_TRANSLATE(kGrayscaleLabel), message); BMenuItem* item
= new BMenuItem(B_TRANSLATE_NOCOLLECT(kGrayscaleLabel), message);
fAntialiasingMenu->AddItem(item); fAntialiasingMenu->AddItem(item);
message = new BMessage(kMsgSetAntialiasing); message = new BMessage(kMsgSetAntialiasing);
message->AddBool("antialiasing", true); message->AddBool("antialiasing", true);
item = new BMenuItem(B_TRANSLATE(kSubpixelLabel), message); item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kSubpixelLabel), message);
fAntialiasingMenu->AddItem(item); fAntialiasingMenu->AddItem(item);
} }
@@ -255,18 +256,18 @@ AntialiasingSettingsView::_BuildHintingMenu()
BMessage* message = new BMessage(kMsgSetHinting); BMessage* message = new BMessage(kMsgSetHinting);
message->AddInt8("hinting", HINTING_MODE_OFF); message->AddInt8("hinting", HINTING_MODE_OFF);
fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE(kNoHintingLabel), fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(kNoHintingLabel),
message)); message));
message = new BMessage(kMsgSetHinting); message = new BMessage(kMsgSetHinting);
message->AddInt8("hinting", HINTING_MODE_ON); message->AddInt8("hinting", HINTING_MODE_ON);
fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE(kFullHintingLabel), fHintingMenu->AddItem(new BMenuItem(
message)); B_TRANSLATE_NOCOLLECT(kFullHintingLabel), message));
message = new BMessage(kMsgSetHinting); message = new BMessage(kMsgSetHinting);
message->AddInt8("hinting", HINTING_MODE_MONOSPACED_ONLY); message->AddInt8("hinting", HINTING_MODE_MONOSPACED_ONLY);
fHintingMenu->AddItem(new BMenuItem(B_TRANSLATE(kMonospacedHintingLabel), fHintingMenu->AddItem(new BMenuItem(
message)); B_TRANSLATE_NOCOLLECT(kMonospacedHintingLabel), message));
} }
@@ -275,8 +276,8 @@ AntialiasingSettingsView::_SetCurrentAntialiasing()
{ {
BMenuItem *item = fAntialiasingMenu->FindItem( BMenuItem *item = fAntialiasingMenu->FindItem(
fCurrentSubpixelAntialiasing fCurrentSubpixelAntialiasing
? B_TRANSLATE(kSubpixelLabel) ? B_TRANSLATE_NOCOLLECT(kSubpixelLabel)
: B_TRANSLATE(kGrayscaleLabel)); : B_TRANSLATE_NOCOLLECT(kGrayscaleLabel));
if (item != NULL) if (item != NULL)
item->SetMarked(true); item->SetMarked(true);
if (fCurrentSubpixelAntialiasing) if (fCurrentSubpixelAntialiasing)
@@ -300,7 +301,7 @@ AntialiasingSettingsView::_SetCurrentHinting()
break; break;
} }
BMenuItem *item = fHintingMenu->FindItem(B_TRANSLATE(label)); BMenuItem *item = fHintingMenu->FindItem(B_TRANSLATE_NOCOLLECT(label));
if (item != NULL) if (item != NULL)
item->SetMarked(true); item->SetMarked(true);
} }
@@ -18,6 +18,7 @@
#include <TextView.h> #include <TextView.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Device View" #define B_TRANSLATE_CONTEXT "Device View"
BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice, BluetoothDeviceView::BluetoothDeviceView(BRect frame, BluetoothDevice* bDevice,
@@ -15,6 +15,7 @@
#include "defs.h" #include "defs.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "main" #define B_TRANSLATE_CONTEXT "main"
BluetoothApplication::BluetoothApplication(void) BluetoothApplication::BluetoothApplication(void)
@@ -26,6 +26,8 @@
#include "defs.h" #include "defs.h"
#include "BluetoothWindow.h" #include "BluetoothWindow.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Settings view" #define B_TRANSLATE_CONTEXT "Settings view"
static const int32 kMsgSetAntialiasing = 'anti'; static const int32 kMsgSetAntialiasing = 'anti';
@@ -203,18 +205,18 @@ BluetoothSettingsView::_BuildConnectionPolicy()
BMessage* message = new BMessage(kMsgSetAntialiasing); BMessage* message = new BMessage(kMsgSetAntialiasing);
message->AddBool("antialiasing", false); message->AddBool("antialiasing", false);
BMenuItem* item = new BMenuItem(B_TRANSLATE(kAllLabel), message); BMenuItem* item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kAllLabel), message);
fPolicyMenu->AddItem(item); fPolicyMenu->AddItem(item);
message = new BMessage(kMsgSetAntialiasing); message = new BMessage(kMsgSetAntialiasing);
message->AddBool("antialiasing", true); message->AddBool("antialiasing", true);
item = new BMenuItem(B_TRANSLATE(kTrustedLabel), message); item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kTrustedLabel), message);
fPolicyMenu->AddItem(item); fPolicyMenu->AddItem(item);
BMenuItem* item2 = new BMenuItem(B_TRANSLATE(kAlwaysLabel), NULL); BMenuItem* item2 = new BMenuItem(B_TRANSLATE_NOCOLLECT(kAlwaysLabel), NULL);
fPolicyMenu->AddItem(item2); fPolicyMenu->AddItem(item2);
@@ -229,23 +231,24 @@ BluetoothSettingsView::_BuildClassMenu()
BMessage* message; BMessage* message;
message = new BMessage(kMsgSetDeviceClassDesktop); message = new BMessage(kMsgSetDeviceClassDesktop);
BMenuItem* item = new BMenuItem(B_TRANSLATE(kDesktopLabel), message); BMenuItem* item
= new BMenuItem(B_TRANSLATE_NOCOLLECT(kDesktopLabel), message);
fClassMenu->AddItem(item); fClassMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassServer); message = new BMessage(kMsgSetDeviceClassServer);
item = new BMenuItem(B_TRANSLATE(kServerLabel), message); item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kServerLabel), message);
fClassMenu->AddItem(item); fClassMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassLaptop); message = new BMessage(kMsgSetDeviceClassLaptop);
item = new BMenuItem(B_TRANSLATE(kLaptopLabel), message); item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kLaptopLabel), message);
fClassMenu->AddItem(item); fClassMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassHandheld); message = new BMessage(kMsgSetDeviceClassHandheld);
item = new BMenuItem(B_TRANSLATE(kHandheldLabel), message); item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kHandheldLabel), message);
fClassMenu->AddItem(item); fClassMenu->AddItem(item);
message = new BMessage(kMsgSetDeviceClassSmartPhone); message = new BMessage(kMsgSetDeviceClassSmartPhone);
item = new BMenuItem(B_TRANSLATE(kPhoneLabel), message); item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kPhoneLabel), message);
fClassMenu->AddItem(item); fClassMenu->AddItem(item);
} }
@@ -20,6 +20,8 @@
#include "defs.h" #include "defs.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Window" #define B_TRANSLATE_CONTEXT "Window"
static const uint32 kMsgSetDefaults = 'dflt'; static const uint32 kMsgSetDefaults = 'dflt';
@@ -16,6 +16,8 @@
#include <SpaceLayoutItem.h> #include <SpaceLayoutItem.h>
#include <StringView.h> #include <StringView.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Extended local device view" #define B_TRANSLATE_CONTEXT "Extended local device view"
ExtendedLocalDeviceView::ExtendedLocalDeviceView(BRect frame, ExtendedLocalDeviceView::ExtendedLocalDeviceView(BRect frame,
@@ -26,6 +26,8 @@
#include "DeviceListItem.h" #include "DeviceListItem.h"
#include "InquiryPanel.h" #include "InquiryPanel.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Inquiry panel" #define B_TRANSLATE_CONTEXT "Inquiry panel"
using Bluetooth::DeviceListItem; using Bluetooth::DeviceListItem;
@@ -26,6 +26,8 @@
#include "InquiryPanel.h" #include "InquiryPanel.h"
#include "RemoteDevicesView.h" #include "RemoteDevicesView.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "Remote devices" #define B_TRANSLATE_CONTEXT "Remote devices"
static const uint32 kMsgAddDevices = 'ddDv'; static const uint32 kMsgAddDevices = 'ddDv';
+2 -2
View File
@@ -131,7 +131,7 @@ SettingsView::SettingsView(MouseSettings &settings)
BMessage *message = new BMessage(kMsgMouseFocusMode); BMessage *message = new BMessage(kMsgMouseFocusMode);
message->AddInt32("mode", focusModes[i]); message->AddInt32("mode", focusModes[i]);
fFocusMenu->AddItem(new BMenuItem(B_TRANSLATE(focusLabels[i]), fFocusMenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(focusLabels[i]),
message)); message));
} }
@@ -154,7 +154,7 @@ SettingsView::SettingsView(MouseSettings &settings)
focusFollowsMouseModes[i]); focusFollowsMouseModes[i]);
fFocusFollowsMouseMenu->AddItem(new BMenuItem( fFocusFollowsMouseMenu->AddItem(new BMenuItem(
B_TRANSLATE(focusFollowsMouseLabels[i]), message)); B_TRANSLATE_NOCOLLECT(focusFollowsMouseLabels[i]), message));
} }
BMenuField *fFocusFollowsMouseField = new BMenuField( BMenuField *fFocusFollowsMouseField = new BMenuField(
@@ -66,8 +66,12 @@ byte_string(int64 size)
if (value < 1024) if (value < 1024)
snprintf(string, sizeof(string), B_TRANSLATE("%Ld B"), size); snprintf(string, sizeof(string), B_TRANSLATE("%Ld B"), size);
else { else {
static const char *units[] = {B_TRANSLATE_MARK("KB"), static const char *units[] = {
B_TRANSLATE_MARK("MB"), B_TRANSLATE_MARK("GB"), NULL}; B_TRANSLATE_MARK("KB"),
B_TRANSLATE_MARK("MB"),
B_TRANSLATE_MARK("GB"),
NULL
};
int32 i = -1; int32 i = -1;
do { do {
@@ -76,7 +80,8 @@ byte_string(int64 size)
} while (value >= 1024 && units[i + 1]); } while (value >= 1024 && units[i + 1]);
off_t rounded = off_t(value * 100LL); off_t rounded = off_t(value * 100LL);
sprintf(string, "%g %s", rounded / 100.0, B_TRANSLATE(units[i])); sprintf(string, "%g %s", rounded / 100.0,
B_TRANSLATE_NOCOLLECT(units[i]));
} }
return string; return string;
+25 -25
View File
@@ -75,26 +75,26 @@ static struct PageFormat
"paper size"), ledger_width, ledger_height }, "paper size"), ledger_width, ledger_height },
{B_TRANSLATE_MARK_COMMENT("Tabloid", "ANSI B (tabloid), a North American " {B_TRANSLATE_MARK_COMMENT("Tabloid", "ANSI B (tabloid), a North American "
"paper size"), tabloid_width, tabloid_height }, "paper size"), tabloid_width, tabloid_height },
{B_TRANSLATE_MARK_COMMENT("A0", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A0", "ISO 216 paper size"),
a0_width, a0_height }, a0_width, a0_height },
{B_TRANSLATE_MARK_COMMENT("A1", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A1", "ISO 216 paper size"),
a1_width, a1_height }, a1_width, a1_height },
{B_TRANSLATE_MARK_COMMENT("A2", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A2", "ISO 216 paper size"),
a2_width, a2_height }, a2_width, a2_height },
{B_TRANSLATE_MARK_COMMENT("A3", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A3", "ISO 216 paper size"),
a3_width, a3_height }, a3_width, a3_height },
{B_TRANSLATE_MARK_COMMENT("A4", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A4", "ISO 216 paper size"),
a4_width, a4_height }, a4_width, a4_height },
{B_TRANSLATE_MARK_COMMENT("A5", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A5", "ISO 216 paper size"),
a5_width, a5_height }, a5_width, a5_height },
{B_TRANSLATE_MARK_COMMENT("A6", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("A6", "ISO 216 paper size"),
a6_width, a6_height }, a6_width, a6_height },
{B_TRANSLATE_MARK_COMMENT("B5", "ISO 216 paper size"), {B_TRANSLATE_MARK_COMMENT("B5", "ISO 216 paper size"),
b5_width, b5_height }, b5_width, b5_height },
}; };
static void static void
GetPageFormat(float w, float h, BString& label) GetPageFormat(float w, float h, BString& label)
{ {
w = floor(w + 0.5); h = floor(h + 0.5); w = floor(w + 0.5); h = floor(h + 0.5);
@@ -102,7 +102,7 @@ GetPageFormat(float w, float h, BString& label)
struct PageFormat& pf = pageFormat[i]; struct PageFormat& pf = pageFormat[i];
if ((pf.width == w && pf.height == h) || (pf.width == h if ((pf.width == w && pf.height == h) || (pf.width == h
&& pf.height == w)) { && pf.height == w)) {
label = B_TRANSLATE(pf.label); label = B_TRANSLATE_NOCOLLECT(pf.label);
return; return;
} }
} }
@@ -137,7 +137,7 @@ ConfigWindow::ConfigWindow(config_setup_kind kind, Printer* defaultPrinter,
{ {
MimeTypeForSender(settings, fSenderMimeType); MimeTypeForSender(settings, fSenderMimeType);
PrinterForMimeType(); PrinterForMimeType();
if (kind == kJobSetup) if (kind == kJobSetup)
SetTitle(B_TRANSLATE("Print setup")); SetTitle(B_TRANSLATE("Print setup"));
@@ -249,7 +249,7 @@ ConfigWindow::~ConfigWindow()
} }
void void
ConfigWindow::Go() ConfigWindow::Go()
{ {
sem_id sid = create_sem(0, "finished"); sem_id sid = create_sem(0, "finished");
@@ -264,7 +264,7 @@ ConfigWindow::Go()
} }
void void
ConfigWindow::MessageReceived(BMessage* m) ConfigWindow::MessageReceived(BMessage* m)
{ {
switch (m->what) { switch (m->what) {
@@ -316,7 +316,7 @@ ConfigWindow::AboutRequested()
} }
void void
ConfigWindow::FrameMoved(BPoint p) ConfigWindow::FrameMoved(BPoint p)
{ {
BRect frame = GetWindowFrame(); BRect frame = GetWindowFrame();
@@ -325,7 +325,7 @@ ConfigWindow::FrameMoved(BPoint p)
} }
BRect BRect
ConfigWindow::GetWindowFrame() ConfigWindow::GetWindowFrame()
{ {
BAutolock lock(gLock); BAutolock lock(gLock);
@@ -336,7 +336,7 @@ ConfigWindow::GetWindowFrame()
} }
void void
ConfigWindow::SetWindowFrame(BRect r) ConfigWindow::SetWindowFrame(BRect r)
{ {
BAutolock lock(gLock); BAutolock lock(gLock);
@@ -345,7 +345,7 @@ ConfigWindow::SetWindowFrame(BRect r)
} }
BPictureButton* BPictureButton*
ConfigWindow::AddPictureButton(BView* panel, BRect frame, ConfigWindow::AddPictureButton(BView* panel, BRect frame,
const char* name, const char* on, const char* off, uint32 what) const char* name, const char* on, const char* off, uint32 what)
{ {
@@ -386,7 +386,7 @@ ConfigWindow::AddPictureButton(BView* panel, BRect frame,
} }
void void
ConfigWindow::PrinterForMimeType() ConfigWindow::PrinterForMimeType()
{ {
BAutolock lock(gLock); BAutolock lock(gLock);
@@ -409,7 +409,7 @@ ConfigWindow::PrinterForMimeType()
} }
void void
ConfigWindow::SetupPrintersMenu(BMenu* menu) ConfigWindow::SetupPrintersMenu(BMenu* menu)
{ {
// clear menu // clear menu
@@ -434,7 +434,7 @@ ConfigWindow::SetupPrintersMenu(BMenu* menu)
} }
void void
ConfigWindow::UpdateAppSettings(const char* mime, const char* printer) ConfigWindow::UpdateAppSettings(const char* mime, const char* printer)
{ {
BAutolock lock(gLock); BAutolock lock(gLock);
@@ -449,7 +449,7 @@ ConfigWindow::UpdateAppSettings(const char* mime, const char* printer)
} }
void void
ConfigWindow::UpdateSettings(bool read) ConfigWindow::UpdateSettings(bool read)
{ {
BAutolock lock(gLock); BAutolock lock(gLock);
@@ -473,7 +473,7 @@ ConfigWindow::UpdateSettings(bool read)
} }
void void
ConfigWindow::UpdateUI() ConfigWindow::UpdateUI()
{ {
if (fCurrentPrinter == NULL) { if (fCurrentPrinter == NULL) {
@@ -518,9 +518,9 @@ ConfigWindow::UpdateUI()
if (fJobSettings.FindInt32(PSRV_FIELD_FIRST_PAGE, &first) == B_OK if (fJobSettings.FindInt32(PSRV_FIELD_FIRST_PAGE, &first) == B_OK
&& fJobSettings.FindInt32(PSRV_FIELD_LAST_PAGE, &last) == && fJobSettings.FindInt32(PSRV_FIELD_LAST_PAGE, &last) ==
B_OK) { B_OK) {
bool printRange = first >= 1 && first <= last && last != INT_MAX; bool printRange = first >= 1 && first <= last && last != INT_MAX;
char number[12]; char number[12];
if (fJobSettings.FindInt32(PSRV_FIELD_COPIES, &copies) if (fJobSettings.FindInt32(PSRV_FIELD_COPIES, &copies)
== B_OK && copies > 1) { == B_OK && copies > 1) {
if (printRange) { if (printRange) {
@@ -548,14 +548,14 @@ ConfigWindow::UpdateUI()
} }
} else } else
job << B_TRANSLATE("Undefined"); job << B_TRANSLATE("Undefined");
fJobSetupText->SetText(job.String()); fJobSetupText->SetText(job.String());
} }
} }
} }
void void
ConfigWindow::Setup(config_setup_kind kind) ConfigWindow::Setup(config_setup_kind kind)
{ {
if (fCurrentPrinter) { if (fCurrentPrinter) {
+21 -21
View File
@@ -45,7 +45,7 @@ static property_info prop_list[] = {
{ "UseConfigWindow", { B_GET_PROPERTY, B_SET_PROPERTY }, { "UseConfigWindow", { B_GET_PROPERTY, B_SET_PROPERTY },
{ B_DIRECT_SPECIFIER }, { B_DIRECT_SPECIFIER },
B_TRANSLATE_MARK("Show configuration window") }, B_TRANSLATE_MARK("Show configuration window") },
{ 0 } // terminate list { 0 } // terminate list
}; };
@@ -62,19 +62,19 @@ PrintServerApp::HandleScriptingCommand(BMessage* msg)
case B_GET_PROPERTY: case B_GET_PROPERTY:
if (propName == "ActivePrinter") { if (propName == "ActivePrinter") {
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
reply.AddString("result", fDefaultPrinter reply.AddString("result", fDefaultPrinter
? fDefaultPrinter->Name() : ""); ? fDefaultPrinter->Name() : "");
reply.AddInt32("error", B_OK); reply.AddInt32("error", B_OK);
msg->SendReply(&reply); msg->SendReply(&reply);
} else if (propName == "UseConfigWindow") { } else if (propName == "UseConfigWindow") {
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
reply.AddString("result", fUseConfigWindow reply.AddString("result", fUseConfigWindow
? "true" : "false"); ? "true" : "false");
reply.AddInt32("error", B_OK); reply.AddInt32("error", B_OK);
msg->SendReply(&reply); msg->SendReply(&reply);
} }
break; break;
case B_SET_PROPERTY: case B_SET_PROPERTY:
if (propName == "ActivePrinter") { if (propName == "ActivePrinter") {
BString newActivePrinter; BString newActivePrinter;
@@ -90,11 +90,11 @@ PrintServerApp::HandleScriptingCommand(BMessage* msg)
fUseConfigWindow = useConfigWindow; fUseConfigWindow = useConfigWindow;
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
reply.AddInt32("error", fUseConfigWindow); reply.AddInt32("error", fUseConfigWindow);
msg->SendReply(&reply); msg->SendReply(&reply);
} }
} }
break; break;
case B_CREATE_PROPERTY: case B_CREATE_PROPERTY:
if (propName == "Printer") { if (propName == "Printer") {
BString name, driver, transport, config; BString name, driver, transport, config;
@@ -111,20 +111,20 @@ PrintServerApp::HandleScriptingCommand(BMessage* msg)
} }
} }
break; break;
case B_DELETE_PROPERTY: { case B_DELETE_PROPERTY: {
Printer* printer = GetPrinterFromSpecifier(&spec); Printer* printer = GetPrinterFromSpecifier(&spec);
status_t rc = B_BAD_VALUE; status_t rc = B_BAD_VALUE;
if (printer != NULL) if (printer != NULL)
rc=printer->Remove(); rc=printer->Remove();
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
reply.AddInt32("error", rc); reply.AddInt32("error", rc);
msg->SendReply(&reply); msg->SendReply(&reply);
} }
break; break;
case B_COUNT_PROPERTIES: case B_COUNT_PROPERTIES:
if (propName == "Printers") { if (propName == "Printers") {
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
@@ -143,7 +143,7 @@ PrintServerApp::HandleScriptingCommand(BMessage* msg)
} }
Printer* Printer*
PrintServerApp::GetPrinterFromSpecifier(BMessage* msg) PrintServerApp::GetPrinterFromSpecifier(BMessage* msg)
{ {
switch(msg->what) { switch(msg->what) {
@@ -154,7 +154,7 @@ PrintServerApp::GetPrinterFromSpecifier(BMessage* msg)
return Printer::Find(name.String()); return Printer::Find(name.String());
break; break;
} }
case B_INDEX_SPECIFIER: case B_INDEX_SPECIFIER:
{ {
int32 idx; int32 idx;
@@ -171,12 +171,12 @@ PrintServerApp::GetPrinterFromSpecifier(BMessage* msg)
break; break;
} }
} }
return NULL; return NULL;
} }
Transport* Transport*
PrintServerApp::GetTransportFromSpecifier(BMessage* msg) PrintServerApp::GetTransportFromSpecifier(BMessage* msg)
{ {
switch(msg->what) { switch(msg->what) {
@@ -187,7 +187,7 @@ PrintServerApp::GetTransportFromSpecifier(BMessage* msg)
return Transport::Find(name); return Transport::Find(name);
break; break;
} }
case B_INDEX_SPECIFIER: case B_INDEX_SPECIFIER:
{ {
int32 idx; int32 idx;
@@ -204,7 +204,7 @@ PrintServerApp::GetTransportFromSpecifier(BMessage* msg)
break; break;
} }
} }
return NULL; return NULL;
} }
@@ -223,7 +223,7 @@ PrintServerApp::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
case 1: case 1:
// GET Printer [arg] // GET Printer [arg]
if ((rc=GetPrinterFromSpecifier(spec)) == NULL) { if ((rc=GetPrinterFromSpecifier(spec)) == NULL) {
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
reply.AddInt32("error", B_BAD_INDEX); reply.AddInt32("error", B_BAD_INDEX);
msg->SendReply(&reply); msg->SendReply(&reply);
@@ -246,7 +246,7 @@ PrintServerApp::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
default: default:
rc = this; rc = this;
} }
return rc; return rc;
} }
@@ -255,16 +255,16 @@ status_t
PrintServerApp::GetSupportedSuites(BMessage* msg) PrintServerApp::GetSupportedSuites(BMessage* msg)
{ {
msg->AddString("suites", "suite/vnd.OpenBeOS-printserver"); msg->AddString("suites", "suite/vnd.OpenBeOS-printserver");
static bool localized = false; static bool localized = false;
if (!localized) { if (!localized) {
localized = true; localized = true;
for (int i = 0; prop_list[i].name != NULL; i ++) for (int i = 0; prop_list[i].name != NULL; i ++)
prop_list[i].usage = B_TRANSLATE(prop_list[i].usage); prop_list[i].usage = B_TRANSLATE_NOCOLLECT(prop_list[i].usage);
} }
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
msg->AddFlat("messages", &prop_info); msg->AddFlat("messages", &prop_info);
return Inherited::GetSupportedSuites(msg); return Inherited::GetSupportedSuites(msg);
} }
+10 -10
View File
@@ -25,7 +25,7 @@
static property_info prop_list[] = { static property_info prop_list[] = {
{ "Name", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Name", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
B_TRANSLATE_MARK("Get name of printer") }, B_TRANSLATE_MARK("Get name of printer") },
{ "TransportAddon", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "TransportAddon", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
B_TRANSLATE_MARK("Get name of the transport add-on used for this printer") }, B_TRANSLATE_MARK("Get name of the transport add-on used for this printer") },
{ "TransportConfig", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "TransportConfig", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
@@ -34,11 +34,11 @@ static property_info prop_list[] = {
B_TRANSLATE_MARK("Get name of the printer add-on used for this printer") }, B_TRANSLATE_MARK("Get name of the printer add-on used for this printer") },
{ "Comments", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Comments", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
B_TRANSLATE_MARK("Get comments about this printer") }, B_TRANSLATE_MARK("Get comments about this printer") },
{ 0 } // terminate list { 0 } // terminate list
}; };
void void
Printer::HandleScriptingCommand(BMessage* msg) Printer::HandleScriptingCommand(BMessage* msg)
{ {
status_t rc = B_ERROR; status_t rc = B_ERROR;
@@ -84,24 +84,24 @@ Printer::HandleScriptingCommand(BMessage* msg)
} }
} }
BHandler* BHandler*
Printer::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec, Printer::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
int32 form, const char* prop) int32 form, const char* prop)
{ {
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
BHandler* rc = this; BHandler* rc = this;
int32 idx; int32 idx;
switch( idx=prop_info.FindMatch(msg,0,spec,form,prop) ) { switch( idx=prop_info.FindMatch(msg,0,spec,form,prop) ) {
case B_ERROR: case B_ERROR:
rc = Inherited::ResolveSpecifier(msg,index,spec,form,prop); rc = Inherited::ResolveSpecifier(msg,index,spec,form,prop);
break; break;
} }
return rc; return rc;
} }
status_t status_t
Printer::GetSupportedSuites(BMessage* msg) Printer::GetSupportedSuites(BMessage* msg)
{ {
msg->AddString("suites", "application/x-vnd.OpenBeOS-printer"); msg->AddString("suites", "application/x-vnd.OpenBeOS-printer");
@@ -110,11 +110,11 @@ Printer::GetSupportedSuites(BMessage* msg)
if (!localized) { if (!localized) {
localized = true; localized = true;
for (int i = 0; prop_list[i].name != NULL; i ++) for (int i = 0; prop_list[i].name != NULL; i ++)
prop_list[i].usage = B_TRANSLATE(prop_list[i].usage); prop_list[i].usage = B_TRANSLATE_NOCOLLECT(prop_list[i].usage);
} }
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
msg->AddFlat("messages", &prop_info); msg->AddFlat("messages", &prop_info);
return Inherited::GetSupportedSuites(msg); return Inherited::GetSupportedSuites(msg);
} }
+11 -11
View File
@@ -23,14 +23,14 @@
static property_info prop_list[] = { static property_info prop_list[] = {
{ "Name", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Name", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
B_TRANSLATE_MARK("Get name of transport") }, B_TRANSLATE_MARK("Get name of transport") },
{ "Ports", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER }, { "Ports", { B_GET_PROPERTY }, { B_DIRECT_SPECIFIER },
B_TRANSLATE_MARK("Get currently available ports/devices") }, B_TRANSLATE_MARK("Get currently available ports/devices") },
{ 0 } // terminate list { 0 } // terminate list
}; };
void void
Transport::HandleScriptingCommand(BMessage* msg) Transport::HandleScriptingCommand(BMessage* msg)
{ {
status_t rc = B_ERROR; status_t rc = B_ERROR;
@@ -77,38 +77,38 @@ Transport::HandleScriptingCommand(BMessage* msg)
} }
BHandler* BHandler*
Transport::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec, Transport::ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
int32 form, const char* prop) int32 form, const char* prop)
{ {
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
BHandler* rc = this; BHandler* rc = this;
int32 idx; int32 idx;
switch (idx=prop_info.FindMatch(msg,0,spec,form,prop)) { switch (idx=prop_info.FindMatch(msg,0,spec,form,prop)) {
case B_ERROR: case B_ERROR:
rc = Inherited::ResolveSpecifier(msg,index,spec,form,prop); rc = Inherited::ResolveSpecifier(msg,index,spec,form,prop);
break; break;
} }
return rc; return rc;
} }
status_t status_t
Transport::GetSupportedSuites(BMessage* msg) Transport::GetSupportedSuites(BMessage* msg)
{ {
msg->AddString("suites", "application/x-vnd.OpenBeOS-transport"); msg->AddString("suites", "application/x-vnd.OpenBeOS-transport");
static bool localized = false; static bool localized = false;
if (!localized) { if (!localized) {
localized = true; localized = true;
for (int i = 0; prop_list[i].name != NULL; i ++) for (int i = 0; prop_list[i].name != NULL; i ++)
prop_list[i].usage = B_TRANSLATE(prop_list[i].usage); prop_list[i].usage = B_TRANSLATE_NOCOLLECT(prop_list[i].usage);
} }
BPropertyInfo prop_info(prop_list); BPropertyInfo prop_info(prop_list);
msg->AddFlat("messages", &prop_info); msg->AddFlat("messages", &prop_info);
return Inherited::GetSupportedSuites(msg); return Inherited::GetSupportedSuites(msg);
} }