Undo last change (Search spool folder by name stored in attribute

'Printer Name'). In other parts of the print_server we had assumed that
printer spool directory name = printer name. So the change broke some
things.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21753 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer 2007-07-30 17:41:06 +00:00
parent cfc9ef8ac3
commit 820f5fa5a5

View File

@ -463,33 +463,20 @@ bool Printer::HasCurrentPrinter(BString& name) {
// Try to move job to another printer folder. // Try to move job to another printer folder.
// //
// Parameters: // Parameters:
// name - the printer name. // name - the printer folder name.
// //
// Returns: // Returns:
// true if successful. // true if successful.
// --------------------------------------------------------------- // ---------------------------------------------------------------
bool Printer::MoveJob(const BString& name) { bool Printer::MoveJob(const BString& name) {
BPath file(&fJob->EntryRef());
BPath path; BPath path;
if (::find_directory(B_USER_PRINTERS_DIRECTORY, &path) != B_OK) file.GetParent(&path);
return false; path.Append(".."); path.Append(name.String());
BDirectory dir(path.Path());
// search printer folder with given name BEntry entry(&fJob->EntryRef());
BDirectory printersFolder(path.Path()); // try to move job file to proper directory
BEntry printerEntry; return entry.MoveTo(&dir) == B_OK;
while (printersFolder.GetNextEntry(&printerEntry) == B_OK) {
BNode printerNode(&printerEntry);
BString printerName;
if (printerNode.ReadAttrString(PSRV_PRINTER_ATTR_PRT_NAME, &printerName) != B_OK)
continue;
if (name != printerName)
continue;
BEntry jobEntry(&fJob->EntryRef());
BDirectory printerDirectory(&printerEntry);
return jobEntry.MoveTo(&printerDirectory) == B_OK;
// try to move job file to proper directory
}
return false;
} }
// --------------------------------------------------------------- // ---------------------------------------------------------------